@viamrobotics/sdk 0.7.0-rc.2 → 0.7.1-next.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 +2 -0
- package/dist/app/data-client.d.ts +23 -5
- package/dist/app/viam-client.d.ts +12 -6
- package/dist/app/viam-transport.d.ts +17 -0
- package/dist/gen/app/data/v1/data_pb.d.ts +92 -0
- package/dist/gen/app/data/v1/data_pb_service.d.ts +38 -0
- package/dist/gen/app/mltraining/v1/ml_training_pb.d.ts +12 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.es.js +546 -230
- package/dist/main.umd.js +4 -4
- package/dist/robot/dial.d.ts +0 -9
- package/dist/robot/grpc-connection-manager.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Viam TypeScript SDK
|
|
2
2
|
|
|
3
|
+
Build and connect to robots with TypeScript
|
|
4
|
+
|
|
3
5
|
[](https://github.com/viamrobotics/viam-typescript-sdk/blob/main/LICENSE)
|
|
4
6
|
[](https://www.npmjs.com/package/@viamrobotics/sdk)
|
|
5
7
|
[](https://ts.viam.dev)
|
|
@@ -7,17 +7,35 @@ export type FilterOptions = Partial<pb.Filter.AsObject> & {
|
|
|
7
7
|
startTime?: Date;
|
|
8
8
|
tags?: string[];
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
data?:
|
|
12
|
-
[key: string]: googleStructPb.JavaScriptValue;
|
|
13
|
-
};
|
|
10
|
+
interface TabularData {
|
|
11
|
+
data?: Record<string, googleStructPb.JavaScriptValue>;
|
|
14
12
|
metadata?: pb.CaptureMetadata.AsObject;
|
|
15
13
|
timeRequested?: Date;
|
|
16
14
|
timeReceived?: Date;
|
|
17
|
-
}
|
|
15
|
+
}
|
|
18
16
|
export declare class DataClient {
|
|
19
17
|
private service;
|
|
20
18
|
constructor(serviceHost: string, grpcOptions: RpcOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Obtain unified tabular data and metadata, queried with SQL.
|
|
21
|
+
*
|
|
22
|
+
* @param organizationId The ID of the organization that owns the data
|
|
23
|
+
* @param query The SQL query to run
|
|
24
|
+
* @returns An array of data objects
|
|
25
|
+
*/
|
|
26
|
+
tabularDataBySQL(organizationId: string, query: string): Promise<{
|
|
27
|
+
[key: string]: googleStructPb.JavaScriptValue;
|
|
28
|
+
}[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Obtain unified tabular data and metadata, queried with MQL.
|
|
31
|
+
*
|
|
32
|
+
* @param organizationId The ID of the organization that owns the data
|
|
33
|
+
* @param query The MQL query to run
|
|
34
|
+
* @returns An array of data objects
|
|
35
|
+
*/
|
|
36
|
+
tabularDataByMQL(organizationId: string, query: string): Promise<{
|
|
37
|
+
[key: string]: googleStructPb.JavaScriptValue;
|
|
38
|
+
}[]>;
|
|
21
39
|
/**
|
|
22
40
|
* Filter and download tabular data. The returned metadata might be empty if
|
|
23
41
|
* the metadata index of the data is out of the bounds of the returned
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { grpc } from '@improbable-eng/grpc-web';
|
|
2
|
+
import { type Credential, type AccessToken } from './viam-transport';
|
|
2
3
|
import { DataClient } from './data-client';
|
|
4
|
+
export interface ViamClientOptions {
|
|
5
|
+
serviceHost?: string;
|
|
6
|
+
credential: Credential | AccessToken;
|
|
7
|
+
}
|
|
8
|
+
/** Instantiate a connected gRPC client that interfaces with Viam app. */
|
|
9
|
+
export declare const createViamClient: ({ serviceHost, credential, }: ViamClientOptions) => Promise<ViamClient>;
|
|
10
|
+
/** A gRPC client for method calls to Viam app. */
|
|
3
11
|
export declare class ViamClient {
|
|
4
|
-
private serviceHost;
|
|
5
|
-
private dialOpts;
|
|
6
12
|
private transportFactory;
|
|
13
|
+
private serviceHost;
|
|
7
14
|
dataClient: DataClient | undefined;
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
connect(): Promise<void>;
|
|
15
|
+
constructor(transportFactory: grpc.TransportFactory, serviceHost: string);
|
|
16
|
+
connect(): void;
|
|
11
17
|
}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { grpc } from '@improbable-eng/grpc-web';
|
|
2
|
+
/** A credential that can be exchanged to obtain an access token */
|
|
3
|
+
export interface Credential {
|
|
4
|
+
authEntity: string;
|
|
5
|
+
type: CredentialType;
|
|
6
|
+
payload: string;
|
|
7
|
+
}
|
|
8
|
+
export type CredentialType = 'robot-location-secret' | 'api-key' | 'robot-secret';
|
|
9
|
+
/** An access token used to access protected resources. */
|
|
10
|
+
export interface AccessToken {
|
|
11
|
+
type: 'access-token';
|
|
12
|
+
payload: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Initialize an authenticated transport factory that can access protected
|
|
16
|
+
* resources.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createViamTransportFactory: (serviceHost: string, credential: Credential | AccessToken) => Promise<grpc.TransportFactory>;
|
|
2
19
|
export declare class ViamTransport implements grpc.Transport {
|
|
3
20
|
private accessToken;
|
|
4
21
|
protected readonly transport: grpc.Transport;
|
|
@@ -351,6 +351,98 @@ export namespace TabularData {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
export class TabularDataBySQLRequest extends jspb.Message {
|
|
355
|
+
getOrganizationId(): string;
|
|
356
|
+
setOrganizationId(value: string): void;
|
|
357
|
+
|
|
358
|
+
getSqlQuery(): string;
|
|
359
|
+
setSqlQuery(value: string): void;
|
|
360
|
+
|
|
361
|
+
serializeBinary(): Uint8Array;
|
|
362
|
+
toObject(includeInstance?: boolean): TabularDataBySQLRequest.AsObject;
|
|
363
|
+
static toObject(includeInstance: boolean, msg: TabularDataBySQLRequest): TabularDataBySQLRequest.AsObject;
|
|
364
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
365
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
366
|
+
static serializeBinaryToWriter(message: TabularDataBySQLRequest, writer: jspb.BinaryWriter): void;
|
|
367
|
+
static deserializeBinary(bytes: Uint8Array): TabularDataBySQLRequest;
|
|
368
|
+
static deserializeBinaryFromReader(message: TabularDataBySQLRequest, reader: jspb.BinaryReader): TabularDataBySQLRequest;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export namespace TabularDataBySQLRequest {
|
|
372
|
+
export type AsObject = {
|
|
373
|
+
organizationId: string,
|
|
374
|
+
sqlQuery: string,
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export class TabularDataBySQLResponse extends jspb.Message {
|
|
379
|
+
clearDataList(): void;
|
|
380
|
+
getDataList(): Array<google_protobuf_struct_pb.Struct>;
|
|
381
|
+
setDataList(value: Array<google_protobuf_struct_pb.Struct>): void;
|
|
382
|
+
addData(value?: google_protobuf_struct_pb.Struct, index?: number): google_protobuf_struct_pb.Struct;
|
|
383
|
+
|
|
384
|
+
serializeBinary(): Uint8Array;
|
|
385
|
+
toObject(includeInstance?: boolean): TabularDataBySQLResponse.AsObject;
|
|
386
|
+
static toObject(includeInstance: boolean, msg: TabularDataBySQLResponse): TabularDataBySQLResponse.AsObject;
|
|
387
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
388
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
389
|
+
static serializeBinaryToWriter(message: TabularDataBySQLResponse, writer: jspb.BinaryWriter): void;
|
|
390
|
+
static deserializeBinary(bytes: Uint8Array): TabularDataBySQLResponse;
|
|
391
|
+
static deserializeBinaryFromReader(message: TabularDataBySQLResponse, reader: jspb.BinaryReader): TabularDataBySQLResponse;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export namespace TabularDataBySQLResponse {
|
|
395
|
+
export type AsObject = {
|
|
396
|
+
dataList: Array<google_protobuf_struct_pb.Struct.AsObject>,
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export class TabularDataByMQLRequest extends jspb.Message {
|
|
401
|
+
getOrganizationId(): string;
|
|
402
|
+
setOrganizationId(value: string): void;
|
|
403
|
+
|
|
404
|
+
getMqlQuery(): string;
|
|
405
|
+
setMqlQuery(value: string): void;
|
|
406
|
+
|
|
407
|
+
serializeBinary(): Uint8Array;
|
|
408
|
+
toObject(includeInstance?: boolean): TabularDataByMQLRequest.AsObject;
|
|
409
|
+
static toObject(includeInstance: boolean, msg: TabularDataByMQLRequest): TabularDataByMQLRequest.AsObject;
|
|
410
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
411
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
412
|
+
static serializeBinaryToWriter(message: TabularDataByMQLRequest, writer: jspb.BinaryWriter): void;
|
|
413
|
+
static deserializeBinary(bytes: Uint8Array): TabularDataByMQLRequest;
|
|
414
|
+
static deserializeBinaryFromReader(message: TabularDataByMQLRequest, reader: jspb.BinaryReader): TabularDataByMQLRequest;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export namespace TabularDataByMQLRequest {
|
|
418
|
+
export type AsObject = {
|
|
419
|
+
organizationId: string,
|
|
420
|
+
mqlQuery: string,
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export class TabularDataByMQLResponse extends jspb.Message {
|
|
425
|
+
clearDataList(): void;
|
|
426
|
+
getDataList(): Array<google_protobuf_struct_pb.Struct>;
|
|
427
|
+
setDataList(value: Array<google_protobuf_struct_pb.Struct>): void;
|
|
428
|
+
addData(value?: google_protobuf_struct_pb.Struct, index?: number): google_protobuf_struct_pb.Struct;
|
|
429
|
+
|
|
430
|
+
serializeBinary(): Uint8Array;
|
|
431
|
+
toObject(includeInstance?: boolean): TabularDataByMQLResponse.AsObject;
|
|
432
|
+
static toObject(includeInstance: boolean, msg: TabularDataByMQLResponse): TabularDataByMQLResponse.AsObject;
|
|
433
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
434
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
435
|
+
static serializeBinaryToWriter(message: TabularDataByMQLResponse, writer: jspb.BinaryWriter): void;
|
|
436
|
+
static deserializeBinary(bytes: Uint8Array): TabularDataByMQLResponse;
|
|
437
|
+
static deserializeBinaryFromReader(message: TabularDataByMQLResponse, reader: jspb.BinaryReader): TabularDataByMQLResponse;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export namespace TabularDataByMQLResponse {
|
|
441
|
+
export type AsObject = {
|
|
442
|
+
dataList: Array<google_protobuf_struct_pb.Struct.AsObject>,
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
354
446
|
export class BinaryData extends jspb.Message {
|
|
355
447
|
getBinary(): Uint8Array | string;
|
|
356
448
|
getBinary_asU8(): Uint8Array;
|
|
@@ -13,6 +13,24 @@ type DataServiceTabularDataByFilter = {
|
|
|
13
13
|
readonly responseType: typeof app_data_v1_data_pb.TabularDataByFilterResponse;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
type DataServiceTabularDataBySQL = {
|
|
17
|
+
readonly methodName: string;
|
|
18
|
+
readonly service: typeof DataService;
|
|
19
|
+
readonly requestStream: false;
|
|
20
|
+
readonly responseStream: false;
|
|
21
|
+
readonly requestType: typeof app_data_v1_data_pb.TabularDataBySQLRequest;
|
|
22
|
+
readonly responseType: typeof app_data_v1_data_pb.TabularDataBySQLResponse;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type DataServiceTabularDataByMQL = {
|
|
26
|
+
readonly methodName: string;
|
|
27
|
+
readonly service: typeof DataService;
|
|
28
|
+
readonly requestStream: false;
|
|
29
|
+
readonly responseStream: false;
|
|
30
|
+
readonly requestType: typeof app_data_v1_data_pb.TabularDataByMQLRequest;
|
|
31
|
+
readonly responseType: typeof app_data_v1_data_pb.TabularDataByMQLResponse;
|
|
32
|
+
};
|
|
33
|
+
|
|
16
34
|
type DataServiceBinaryDataByFilter = {
|
|
17
35
|
readonly methodName: string;
|
|
18
36
|
readonly service: typeof DataService;
|
|
@@ -169,6 +187,8 @@ type DataServiceRemoveBinaryDataFromDatasetByIDs = {
|
|
|
169
187
|
export class DataService {
|
|
170
188
|
static readonly serviceName: string;
|
|
171
189
|
static readonly TabularDataByFilter: DataServiceTabularDataByFilter;
|
|
190
|
+
static readonly TabularDataBySQL: DataServiceTabularDataBySQL;
|
|
191
|
+
static readonly TabularDataByMQL: DataServiceTabularDataByMQL;
|
|
172
192
|
static readonly BinaryDataByFilter: DataServiceBinaryDataByFilter;
|
|
173
193
|
static readonly BinaryDataByIDs: DataServiceBinaryDataByIDs;
|
|
174
194
|
static readonly DeleteTabularData: DataServiceDeleteTabularData;
|
|
@@ -229,6 +249,24 @@ export class DataServiceClient {
|
|
|
229
249
|
requestMessage: app_data_v1_data_pb.TabularDataByFilterRequest,
|
|
230
250
|
callback: (error: ServiceError|null, responseMessage: app_data_v1_data_pb.TabularDataByFilterResponse|null) => void
|
|
231
251
|
): UnaryResponse;
|
|
252
|
+
tabularDataBySQL(
|
|
253
|
+
requestMessage: app_data_v1_data_pb.TabularDataBySQLRequest,
|
|
254
|
+
metadata: grpc.Metadata,
|
|
255
|
+
callback: (error: ServiceError|null, responseMessage: app_data_v1_data_pb.TabularDataBySQLResponse|null) => void
|
|
256
|
+
): UnaryResponse;
|
|
257
|
+
tabularDataBySQL(
|
|
258
|
+
requestMessage: app_data_v1_data_pb.TabularDataBySQLRequest,
|
|
259
|
+
callback: (error: ServiceError|null, responseMessage: app_data_v1_data_pb.TabularDataBySQLResponse|null) => void
|
|
260
|
+
): UnaryResponse;
|
|
261
|
+
tabularDataByMQL(
|
|
262
|
+
requestMessage: app_data_v1_data_pb.TabularDataByMQLRequest,
|
|
263
|
+
metadata: grpc.Metadata,
|
|
264
|
+
callback: (error: ServiceError|null, responseMessage: app_data_v1_data_pb.TabularDataByMQLResponse|null) => void
|
|
265
|
+
): UnaryResponse;
|
|
266
|
+
tabularDataByMQL(
|
|
267
|
+
requestMessage: app_data_v1_data_pb.TabularDataByMQLRequest,
|
|
268
|
+
callback: (error: ServiceError|null, responseMessage: app_data_v1_data_pb.TabularDataByMQLResponse|null) => void
|
|
269
|
+
): UnaryResponse;
|
|
232
270
|
binaryDataByFilter(
|
|
233
271
|
requestMessage: app_data_v1_data_pb.BinaryDataByFilterRequest,
|
|
234
272
|
metadata: grpc.Metadata,
|
|
@@ -193,6 +193,16 @@ export class TrainingJobMetadata extends jspb.Message {
|
|
|
193
193
|
getErrorStatus(): google_rpc_status_pb.Status | undefined;
|
|
194
194
|
setErrorStatus(value?: google_rpc_status_pb.Status): void;
|
|
195
195
|
|
|
196
|
+
hasTrainingStarted(): boolean;
|
|
197
|
+
clearTrainingStarted(): void;
|
|
198
|
+
getTrainingStarted(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
199
|
+
setTrainingStarted(value?: google_protobuf_timestamp_pb.Timestamp): void;
|
|
200
|
+
|
|
201
|
+
hasTrainingEnded(): boolean;
|
|
202
|
+
clearTrainingEnded(): void;
|
|
203
|
+
getTrainingEnded(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
204
|
+
setTrainingEnded(value?: google_protobuf_timestamp_pb.Timestamp): void;
|
|
205
|
+
|
|
196
206
|
serializeBinary(): Uint8Array;
|
|
197
207
|
toObject(includeInstance?: boolean): TrainingJobMetadata.AsObject;
|
|
198
208
|
static toObject(includeInstance: boolean, msg: TrainingJobMetadata): TrainingJobMetadata.AsObject;
|
|
@@ -212,6 +222,8 @@ export namespace TrainingJobMetadata {
|
|
|
212
222
|
syncedModelId: string,
|
|
213
223
|
id: string,
|
|
214
224
|
errorStatus?: google_rpc_status_pb.Status.AsObject,
|
|
225
|
+
trainingStarted?: google_protobuf_timestamp_pb.Timestamp.AsObject,
|
|
226
|
+
trainingEnded?: google_protobuf_timestamp_pb.Timestamp.AsObject,
|
|
215
227
|
}
|
|
216
228
|
}
|
|
217
229
|
|
package/dist/main.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export { type Robot, type DialConf, type DialDirectConf, type DialWebRTCConf, ty
|
|
|
15
15
|
* @group Clients
|
|
16
16
|
*/
|
|
17
17
|
export { RobotClient as Client } from './robot';
|
|
18
|
-
export { ViamClient } from './app/viam-client';
|
|
18
|
+
export { createViamClient, type ViamClient, type ViamClientOptions, } from './app/viam-client';
|
|
19
|
+
export type { Credential, CredentialType, AccessToken, } from './app/viam-transport';
|
|
19
20
|
/**
|
|
20
21
|
* Raw Protobuf interfaces for a Data service.
|
|
21
22
|
*
|