@formant/data-sdk 0.0.147 → 1.0.0-rc.1

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.
@@ -48,6 +48,8 @@ export type AppMessage = {
48
48
  data: any;
49
49
  } | {
50
50
  type: "request_devices";
51
+ } | {
52
+ type: "formant_online";
51
53
  };
52
54
  export type ModuleConfigurationMessage = {
53
55
  type: "module_configuration";
@@ -85,6 +87,9 @@ export type EmbeddedAppMessage = {
85
87
  type: "prompt_response";
86
88
  promptId: string;
87
89
  data: any;
90
+ } | {
91
+ type: "formant_online";
92
+ online: boolean;
88
93
  } | ModuleConfigurationMessage;
89
94
  export interface ModuleData {
90
95
  queryRange: QueryRange;
@@ -144,4 +149,10 @@ export declare class App {
144
149
  cancelText?: string;
145
150
  }): Promise<any>;
146
151
  static getDate(minTime?: Date, maxTime?: Date): Promise<unknown>;
152
+ private static _isOnline;
153
+ private static _handleOnlineEvent;
154
+ static get isOnline(): boolean | null;
155
+ static listenForConnectionEvents(): void;
156
+ static checkConnection(deadlineMs?: number): Promise<boolean>;
157
+ static waitForConnection(deadlineMs?: number): Promise<void>;
147
158
  }
@@ -1,19 +1,24 @@
1
1
  /// <reference types="node" />
2
+ import { EventEmitter } from "events";
2
3
  import { IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, RtcClient, RtcClientV1 } from "@formant/realtime-sdk";
4
+ import { RtcStreamType } from "@formant/realtime-sdk/dist/model/RtcStreamType";
5
+ import { IRtcPeer } from "@formant/realtime-sdk/dist/model/IRtcPeer";
3
6
  import { DataChannel } from "./DataChannel";
4
7
  import { CaptureStream } from "./CaptureStream";
5
8
  import { Manipulator } from "./Manipulator";
6
9
  import { TextRequestDataChannel, BinaryRequestDataChannel } from "./RequestDataChannel";
7
- import { InterventionType } from "./main";
8
- import { IInterventionTypeMap } from "./main";
9
- import { IInterventionResponse } from "./main";
10
- import { RtcStreamType } from "@formant/realtime-sdk/dist/model/RtcStreamType";
11
- import { IEventQuery } from "./main";
12
- import { AggregateLevel } from "./main";
13
- import { EventType } from "./main";
10
+ import { Uuid } from "./model/Uuid";
11
+ import { InterventionType } from "./model/InterventionType";
12
+ import { IInterventionTypeMap } from "./model/IInterventionTypeMap";
13
+ import { IInterventionResponse } from "./model/IInterventionResponse";
14
+ import { IEventQuery } from "./model/IEventQuery";
15
+ import { AggregateLevel } from "./model/AggregateLevel";
16
+ import { EventType } from "./model/EventType";
14
17
  import { IShare } from "./model/IShare";
15
- import { EventEmitter } from "events";
16
18
  export interface ConfigurationDocument {
19
+ tags: {
20
+ [key: string]: string;
21
+ };
17
22
  urdfFiles: string[];
18
23
  telemetry?: {
19
24
  streams?: {
@@ -37,6 +42,7 @@ export interface ConfigurationDocument {
37
42
  topicType: string;
38
43
  }[];
39
44
  };
45
+ adapters?: IAdapterConfiguration[];
40
46
  }
41
47
  export interface Command {
42
48
  id: string;
@@ -59,6 +65,13 @@ export interface TelemetryStream {
59
65
  name: string;
60
66
  onDemand: boolean;
61
67
  }
68
+ export interface IAdapterConfiguration {
69
+ id: Uuid;
70
+ name: string;
71
+ fileId: Uuid;
72
+ execCommand: string;
73
+ configuration?: string;
74
+ }
62
75
  export type RealtimeMessage = {
63
76
  header: {
64
77
  created: number;
@@ -97,7 +110,7 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
97
110
  name: string;
98
111
  private organizationId;
99
112
  rtcClient: RtcClient | RtcClientV1 | undefined;
100
- remoteDevicePeerId: string | undefined;
113
+ remoteDevicePeerId: string | null;
101
114
  realtimeListeners: RealtimeListener[];
102
115
  private connectionMonitorInterval;
103
116
  constructor(id: string, name: string, organizationId: string);
@@ -107,7 +120,15 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
107
120
  private handleMessage;
108
121
  getRealtimeStatus(): "disconnected" | "connecting" | "connected";
109
122
  getRealtimePing(): number | undefined;
123
+ /**
124
+ * 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
+ * @throws `Error` If the connection could not be established or if a connection already exists.
127
+ * @returns {void}
128
+ */
110
129
  startRealtimeConnection(sessionType?: number): Promise<void>;
130
+ private getRemoteDevicePeerId;
131
+ private createSession;
111
132
  private initConnectionMonitoring;
112
133
  private isV2Signaling;
113
134
  private stopConnectionMonitoring;
@@ -124,7 +145,7 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
124
145
  enableRealtimeTelemetryPriorityIngestion(streamName: string): Promise<void>;
125
146
  changeStreamAudioType(streamName: string, newFormat: "wav" | "opus"): Promise<void>;
126
147
  disableRealtimeTelemetryPriorityIngestion(streamName: string): Promise<void>;
127
- getRemotePeer(): Promise<import("@formant/realtime-sdk/dist/model/IRtcPeer").IRtcPeer>;
148
+ getRemotePeer(): Promise<IRtcPeer>;
128
149
  stopRealtimeConnection(): Promise<void>;
129
150
  isInRealtimeSession(): Promise<boolean>;
130
151
  getAvailableCommands(): Promise<Command[]>;
@@ -156,4 +177,5 @@ export declare class Device extends EventEmitter implements IRealtimeDevice {
156
177
  events: import("./main").IEvent[];
157
178
  }[]>;
158
179
  createShareLink(share: IShare, view: string): Promise<string | null>;
180
+ private getRemotePeerId;
159
181
  }
@@ -9,7 +9,7 @@ import { PeerDevice } from "./PeerDevice";
9
9
  import { IDeviceQuery } from "./model/IDeviceQuery";
10
10
  import { IStream } from "./model/IStream";
11
11
  import { IView } from "./model/IView";
12
- import { EventType, AggregateLevel, IShare } from "./main";
12
+ import { EventType, AggregateLevel, IShare, IStreamTypeMap, IStreamCurrentValue } from "./main";
13
13
  import { IAnalyticsModule } from "./model/IAnalyticsModule";
14
14
  import { IStreamColumn } from "./model/IStreamColumn";
15
15
  import { ITaskReportColumn } from "./model/ITaskReportColumn";
@@ -39,13 +39,13 @@ export declare class Fleet {
39
39
  [key in string]: string[];
40
40
  }>;
41
41
  static getRealtimeDevices(): Promise<Device[]>;
42
- static getLatestTelemetry(deviceIdOrDeviceIds?: string | string[]): Promise<any>;
42
+ static getLatestTelemetry(...ids: (string | string[])[]): Promise<IStreamCurrentValue<keyof IStreamTypeMap>[]>;
43
43
  static getTelemetry(deviceIdOrDeviceIds: string | string[], streamNameOrStreamNames: string | string[], start: Date, end: Date, tags?: {
44
44
  [key in string]: string[];
45
45
  }): Promise<TelemetryResult[]>;
46
46
  static getFileUrl(uuid: string): Promise<string>;
47
- static queryTelemetry(query: IQuery): Promise<IStreamData<keyof import("./main").IStreamTypeMap>[]>;
48
- static aggregateTelemetry(query: IQuery): Promise<IStreamAggregateData<keyof import("./main").IStreamTypeMap>[]>;
47
+ static queryTelemetry(query: IQuery): Promise<IStreamData<keyof IStreamTypeMap>[]>;
48
+ static aggregateTelemetry(query: IQuery): Promise<IStreamAggregateData<keyof IStreamTypeMap>[]>;
49
49
  static queryEvents(query: IEventQuery): Promise<IEvent[]>;
50
50
  static getEvent(uuid: string): Promise<IEvent>;
51
51
  static getInterventions(): Promise<IEvent[]>;
@@ -2,3 +2,4 @@ export * from "./aggregateFunctionUtils";
2
2
  export * from "./numericAggregateUtils";
3
3
  export * from "./timeout";
4
4
  export * from "./serializeHash";
5
+ export * from "./isRtcPeer";
@@ -0,0 +1,2 @@
1
+ import { IRtcPeer } from "@formant/realtime-sdk/dist/model/IRtcPeer";
2
+ export declare const isRtcPeer: (_: IRtcPeer | any) => _ is IRtcPeer;
package/package.json CHANGED
@@ -24,9 +24,10 @@
24
24
  }
25
25
  }
26
26
  },
27
- "version": "0.0.147",
27
+ "version": "1.0.0-rc.1",
28
28
  "scripts": {
29
- "dev": "vite --port 9146",
29
+ "preversion": "make",
30
+ "dev": "vite --port 5173",
30
31
  "build": "tsc && vite build",
31
32
  "serve": "vite preview",
32
33
  "test": "concurrently --kill-others-on-fail npm:test:*",