@formant/data-sdk 1.0.0-rc.2 → 1.0.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 (26) hide show
  1. package/dist/data-sdk.es.js +21469 -21337
  2. package/dist/data-sdk.umd.js +30 -30
  3. package/dist/types/data-sdk/src/App.d.ts +2 -1
  4. package/dist/types/data-sdk/src/AppRtcClientPools.d.ts +20 -0
  5. package/dist/types/data-sdk/src/Device.d.ts +11 -10
  6. package/dist/types/data-sdk/src/Fleet.d.ts +13 -9
  7. package/dist/types/data-sdk/src/main.d.ts +2 -1
  8. package/dist/types/data-sdk/src/model/AggregateType.d.ts +2 -0
  9. package/dist/types/data-sdk/src/model/IH264VideoFrame.d.ts +5 -0
  10. package/dist/types/data-sdk/src/model/IJointState.d.ts +8 -0
  11. package/dist/types/data-sdk/src/model/IMarker3D.d.ts +27 -0
  12. package/dist/types/data-sdk/src/model/IMarker3DArray.d.ts +4 -0
  13. package/dist/types/data-sdk/src/model/IPoseWithCovariance.d.ts +5 -0
  14. package/dist/types/data-sdk/src/model/IRtcPointCloud.d.ts +5 -0
  15. package/dist/types/data-sdk/src/model/IVector2.d.ts +4 -0
  16. package/dist/types/data-sdk/src/model/Marker3DAction.d.ts +2 -0
  17. package/dist/types/data-sdk/src/model/Marker3DType.d.ts +2 -0
  18. package/dist/types/data-sdk/src/model/SessionType.d.ts +22 -0
  19. package/dist/types/data-sdk/src/model/aggregateTypes.d.ts +1 -0
  20. package/dist/types/data-sdk/src/model/marker3DActions.d.ts +1 -0
  21. package/dist/types/data-sdk/src/model/marker3DTypes.d.ts +1 -0
  22. package/dist/types/data-sdk/src/utils/RtcClientPool.d.ts +25 -0
  23. package/dist/types/data-sdk/src/utils/index.d.ts +1 -0
  24. package/dist/types/data-sdk/src/utils/isRtcPeer.d.ts +1 -1
  25. package/dist/types/data-sdk/src/utils/rtcClientVersion.d.ts +2 -0
  26. package/package.json +5 -4
@@ -9,6 +9,7 @@ export type AppMessage = {
9
9
  type: "request_date";
10
10
  minTime?: Date;
11
11
  maxTime?: Date;
12
+ time?: Date;
12
13
  } | {
13
14
  type: "go_to_time";
14
15
  time: number;
@@ -150,7 +151,7 @@ export declare class App {
150
151
  okText?: string;
151
152
  cancelText?: string;
152
153
  }): Promise<any>;
153
- static getDate(minTime?: Date, maxTime?: Date): Promise<unknown>;
154
+ static getDate(time?: Date, minTime?: Date, maxTime?: Date): Promise<unknown>;
154
155
  static disableAnalyticsBottomBar(): Promise<void>;
155
156
  private static _isOnline;
156
157
  private static _handleOnlineEvent;
@@ -0,0 +1,20 @@
1
+ import { RtcClient, RtcClientV1 } from "@formant/realtime-sdk";
2
+ import { SessionType } from "./model/SessionType";
3
+ import { RtcClientPool } from "./utils/RtcClientPool";
4
+ export declare const AppRtcClientPools: {
5
+ readonly unknown: RtcClientPool<RtcClient>;
6
+ readonly teleop: RtcClientPool<RtcClient>;
7
+ readonly portForward: RtcClientPool<RtcClient>;
8
+ readonly observe: RtcClientPool<RtcClient>;
9
+ readonly 0: RtcClientPool<RtcClient>;
10
+ readonly 1: RtcClientPool<RtcClient>;
11
+ readonly 2: RtcClientPool<RtcClient>;
12
+ readonly 3: RtcClientPool<RtcClient>;
13
+ };
14
+ export declare const defaultRtcClientPool: RtcClientPool<RtcClient>;
15
+ export declare const v1RtcClientPool: RtcClientPool<RtcClientV1>;
16
+ export declare const getRtcClientPool: (options: {
17
+ version: string;
18
+ sessionType?: SessionType;
19
+ }) => RtcClientPool<RtcClient> | RtcClientPool<RtcClientV1>;
20
+ export declare function debug(): void;
@@ -15,10 +15,10 @@ import { IEventQuery } from "./model/IEventQuery";
15
15
  import { AggregateLevel } from "./model/AggregateLevel";
16
16
  import { EventType } from "./model/EventType";
17
17
  import { IShare } from "./model/IShare";
18
+ import { ITags } from "./model/ITags";
19
+ import { SessionType } from "./model/SessionType";
18
20
  export interface ConfigurationDocument {
19
- tags: {
20
- [key: string]: string;
21
- };
21
+ tags: ITags;
22
22
  urdfFiles: string[];
23
23
  telemetry?: {
24
24
  streams?: {
@@ -93,10 +93,11 @@ export type RealtimeVideoStream = {
93
93
  export type RealtimeDataStream = {
94
94
  name: string;
95
95
  };
96
- export declare const SessionType: {
97
- Teleop: number;
98
- Observe: number;
99
- };
96
+ interface IStartRealtimeConnectionOptions {
97
+ sessionType?: SessionType;
98
+ deadlineMs?: number;
99
+ maxConnectRetries?: number;
100
+ }
100
101
  export interface IRealtimeDevice {
101
102
  startRealtimeConnection(sessionType?: number): Promise<void>;
102
103
  startListeningToRealtimeDataStream(stream: RealtimeDataStream): Promise<void>;
@@ -122,13 +123,12 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
122
123
  getRealtimePing(): number | undefined;
123
124
  /**
124
125
  * Starts a real-time connection with the remote device using WebRTC.
125
- * @param {number} [sessionType] - Optional session type to be used for the connection.
126
+ * @param {number} [options] - Optional session type to be used for the connection.
126
127
  * @throws `Error` If the connection could not be established or if a connection already exists.
127
128
  * @returns {void}
128
129
  */
129
- startRealtimeConnection(sessionType?: number): Promise<void>;
130
+ startRealtimeConnection(options?: SessionType | IStartRealtimeConnectionOptions): Promise<void>;
130
131
  private getRemoteDevicePeerId;
131
- private createSession;
132
132
  private initConnectionMonitoring;
133
133
  private isV2Signaling;
134
134
  private stopConnectionMonitoring;
@@ -179,3 +179,4 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
179
179
  createShareLink(share: IShare, view: string): Promise<string | null>;
180
180
  private getRemotePeerId;
181
181
  }
182
+ export {};
@@ -1,20 +1,24 @@
1
1
  import { IRtcPeer } from "@formant/realtime-sdk/dist/model/IRtcPeer";
2
2
  import { Device } from "./Device";
3
+ import { AggregateLevel } from "./model/AggregateLevel";
4
+ import { EventType } from "./model/EventType";
5
+ import { IAnalyticsModule } from "./model/IAnalyticsModule";
6
+ import { IDeviceQuery } from "./model/IDeviceQuery";
3
7
  import { IEvent } from "./model/IEvent";
4
8
  import { IEventQuery } from "./model/IEventQuery";
5
9
  import { IQuery } from "./model/IQuery";
6
- import { IStreamAggregateData } from "./model/IStreamAggregateData";
7
- import { IStreamData } from "./model/IStreamData";
8
- import { PeerDevice } from "./PeerDevice";
9
- import { IDeviceQuery } from "./model/IDeviceQuery";
10
+ import { IShare } from "./model/IShare";
11
+ import { ISqlQuery } from "./model/ISqlQuery";
12
+ import { ISqlResult } from "./model/ISqlResult";
10
13
  import { IStream } from "./model/IStream";
11
- import { IView } from "./model/IView";
12
- import { EventType, AggregateLevel, IShare, IStreamTypeMap, IStreamCurrentValue } from "./main";
13
- import { IAnalyticsModule } from "./model/IAnalyticsModule";
14
+ import { IStreamAggregateData } from "./model/IStreamAggregateData";
14
15
  import { IStreamColumn } from "./model/IStreamColumn";
16
+ import { IStreamCurrentValue } from "./model/IStreamCurrentValue";
17
+ import { IStreamData } from "./model/IStreamData";
18
+ import { IStreamTypeMap } from "./model/IStreamTypeMap";
15
19
  import { ITaskReportColumn } from "./model/ITaskReportColumn";
16
- import { ISqlQuery } from "./model/ISqlQuery";
17
- import { ISqlResult } from "./model/ISqlResult";
20
+ import { IView } from "./model/IView";
21
+ import { PeerDevice } from "./PeerDevice";
18
22
  export interface TelemetryResult {
19
23
  deviceId: string;
20
24
  name: string;
@@ -114,7 +114,8 @@ export * from "./model/VideoMimeType";
114
114
  export * from "./model/IDeviceQuery";
115
115
  export * from "./model/IAnnotationQuery";
116
116
  export * from "./model/IStream";
117
- export { IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, } from "@formant/realtime-sdk";
117
+ export { SessionTypeConstants as SessionType } from "./model/SessionType";
118
+ export type { IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, } from "@formant/realtime-sdk";
118
119
  export * from "./model/JsonSchema";
119
120
  export * from "./utils/aggregateFunctionUtils";
120
121
  export * from "./model/IStreamColumn";
@@ -0,0 +1,2 @@
1
+ import { aggregateTypes } from "./aggregateTypes";
2
+ export type AggregateType = (typeof aggregateTypes)[number];
@@ -0,0 +1,5 @@
1
+ export interface IH264VideoFrame {
2
+ index: number;
3
+ flags: number;
4
+ frame_data: string;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { ITransform } from "./ITransform";
2
+ export interface IJointState {
3
+ world_to_local?: ITransform;
4
+ name: string[];
5
+ position: number[];
6
+ velocity?: number[];
7
+ effort?: number[];
8
+ }
@@ -0,0 +1,27 @@
1
+ import { IColorRGBA } from "./IColorRGBA";
2
+ import { IQuaternion } from "./IQuaternion";
3
+ import { IVector3 } from "./IVector3";
4
+ export interface IMarker3D {
5
+ world_to_local?: {
6
+ position: IVector3;
7
+ orientation: IQuaternion;
8
+ };
9
+ ns: string;
10
+ id: number;
11
+ type: number;
12
+ action: number;
13
+ pose: {
14
+ position: IVector3;
15
+ orientation: IQuaternion;
16
+ };
17
+ scale: IVector3;
18
+ color: IColorRGBA;
19
+ lifetime: number;
20
+ frame_id: string;
21
+ frame_locked: boolean;
22
+ points: IVector3[];
23
+ colors: IColorRGBA[];
24
+ text: string;
25
+ mesh_resource: string;
26
+ mesh_use_embedded_materials: boolean;
27
+ }
@@ -0,0 +1,4 @@
1
+ import { IMarker3D } from "./IMarker3D";
2
+ export interface IMarker3DArray {
3
+ markers: IMarker3D[];
4
+ }
@@ -0,0 +1,5 @@
1
+ import { ITransform } from "./ITransform";
2
+ export interface IPoseWithCovariance {
3
+ pose: ITransform;
4
+ covariance: Array<number>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ITransform } from "./ITransform";
2
+ export interface IRtcPointCloud {
3
+ world_to_local?: ITransform;
4
+ data: string;
5
+ }
@@ -0,0 +1,4 @@
1
+ export interface IVector2 {
2
+ x: number;
3
+ y: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ import { marker3DActions } from "./marker3DActions";
2
+ export type Marker3DAction = (typeof marker3DActions)[number];
@@ -0,0 +1,2 @@
1
+ import { marker3DTypes } from "./marker3DTypes";
2
+ export type Marker3DType = (typeof marker3DTypes)[number];
@@ -0,0 +1,22 @@
1
+ import { IRtcClientConfiguration } from "@formant/realtime-sdk";
2
+ export type SessionType = NonNullable<IRtcClientConfiguration["sessionType"]>;
3
+ export declare const SessionTypes: {
4
+ readonly UNKNOWN: 0;
5
+ readonly TELEOP: 1;
6
+ readonly PORT_FORWARD: 2;
7
+ readonly OBSERVE: 3;
8
+ };
9
+ export declare const SessionTypeConstants: {
10
+ readonly Unknown: 0;
11
+ readonly Teleop: 1;
12
+ readonly PortForward: 2;
13
+ readonly Observe: 3;
14
+ readonly unknown: 0;
15
+ readonly teleop: 1;
16
+ readonly portForward: 2;
17
+ readonly observe: 3;
18
+ readonly UNKNOWN: 0;
19
+ readonly TELEOP: 1;
20
+ readonly PORT_FORWARD: 2;
21
+ readonly OBSERVE: 3;
22
+ };
@@ -0,0 +1 @@
1
+ export declare const aggregateTypes: readonly ["min", "max", "standard deviation", "average", "sum", "count"];
@@ -0,0 +1 @@
1
+ export declare const marker3DActions: readonly ["add", "modify", "delete", "delete_all"];
@@ -0,0 +1 @@
1
+ export declare const marker3DTypes: readonly ["arrow", "cube", "sphere", "cylinder", "line_strip", "line_list", "cube_list", "sphere_list", "points", "text_view_facing", "mesh_resource", "triangle_list"];
@@ -0,0 +1,25 @@
1
+ import { RtcClient, RtcClientV1, IRtcClientConfiguration } from "@formant/realtime-sdk";
2
+ type ReceiveFn = IRtcClientConfiguration["receive"];
3
+ type CreateClientFn<T extends RtcClient | RtcClientV1> = (receive: ReceiveFn) => T;
4
+ export interface IRtcClientPoolOptions<T extends RtcClient | RtcClientV1> {
5
+ createClient: CreateClientFn<T>;
6
+ ttlMs?: number;
7
+ }
8
+ declare const singleton: unique symbol;
9
+ export declare class RtcClientPool<T extends RtcClient | RtcClientV1> {
10
+ [singleton]: T | null;
11
+ private readonly createClient;
12
+ private readonly ttlMs;
13
+ private readonly proxyHandler;
14
+ private proxyReceivers;
15
+ private teardownTimeout;
16
+ constructor(options: IRtcClientPoolOptions<T>);
17
+ get isActive(): boolean;
18
+ get size(): number;
19
+ get(onReceive?: ReceiveFn): T;
20
+ private allocate;
21
+ private teardown;
22
+ private dispatch;
23
+ private releaseInstance;
24
+ }
25
+ export {};
@@ -3,3 +3,4 @@ export * from "./numericAggregateUtils";
3
3
  export * from "./timeout";
4
4
  export * from "./serializeHash";
5
5
  export * from "./isRtcPeer";
6
+ export { getRtcClientVersion } from "./rtcClientVersion";
@@ -1,2 +1,2 @@
1
1
  import { IRtcPeer } from "@formant/realtime-sdk/dist/model/IRtcPeer";
2
- export declare const isRtcPeer: (_: IRtcPeer | any) => _ is IRtcPeer;
2
+ export declare const isRtcPeer: (peer: IRtcPeer | undefined) => peer is IRtcPeer;
@@ -0,0 +1,2 @@
1
+ export declare function overrideRtcClientVersion(newVersion: string | null): void;
2
+ export declare function getRtcClientVersion(): string | null;
package/package.json CHANGED
@@ -24,18 +24,19 @@
24
24
  }
25
25
  }
26
26
  },
27
- "version": "1.0.0-rc.2",
27
+ "version": "1.0.0",
28
28
  "scripts": {
29
- "preversion": "make",
29
+ "preversion": "npm run test && tsc --project ./configs/tsconfig.type-check.json",
30
+ "postversion": "make",
30
31
  "dev": "vite --port 5173",
31
- "build": "tsc && vite build",
32
+ "build": "tsc -p ./configs/tsconfig.demo.json && vite build",
32
33
  "serve": "vite preview",
33
34
  "test": "concurrently --kill-others-on-fail npm:test:*",
34
35
  "test:unit": "vitest run",
35
36
  "coverage": "vitest run --coverage",
36
37
  "prettier:check": "prettier --check src/",
37
38
  "prettier:write": "prettier --write src/",
38
- "types": "tsc --project ./tsconfig.types.json",
39
+ "types": "tsc --project ./configs/tsconfig.types.json",
39
40
  "docs": "typedoc src/main.ts --theme default --out ../../docs/data-sdk/"
40
41
  },
41
42
  "devDependencies": {