@formant/data-sdk 0.0.49 → 0.0.53

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.
@@ -0,0 +1,44 @@
1
+ export interface ModuleData {
2
+ queryRange: QueryRange;
3
+ time: number;
4
+ streams: {
5
+ [stream_name: string]: Stream;
6
+ };
7
+ }
8
+ export interface QueryRange {
9
+ start: number;
10
+ end: number;
11
+ }
12
+ export interface Stream {
13
+ data: StreamData[];
14
+ loading: boolean;
15
+ tooMuchData: boolean;
16
+ type: string;
17
+ }
18
+ export interface StreamData {
19
+ points: DataPoint[];
20
+ deviceId: string;
21
+ agentId: string;
22
+ name: string;
23
+ tags: {
24
+ [key: string]: string;
25
+ };
26
+ type: string;
27
+ }
28
+ export declare type DataPoint = [number, any];
29
+ export declare class App {
30
+ private static sendAppMessage;
31
+ private static getCurrentModuleContext;
32
+ static isModule(): boolean;
33
+ static goToTime(date: Date): void;
34
+ static showMessage(message: string): void;
35
+ static requestModuleData(): void;
36
+ static setModuleDateTimeRange(beforeInMilliseconds: number, afterInMilliseconds?: number): void;
37
+ static refreshAuthToken(): void;
38
+ static setupModuleMenus(menus: {
39
+ label: string;
40
+ }[]): void;
41
+ static addMenuListener(handler: (label: string) => void): void;
42
+ static addAccessTokenRefreshListener(handler: (token: string) => void): void;
43
+ static addModuleDataListener(handler: (data: ModuleData) => void): void;
44
+ }
@@ -5,14 +5,22 @@ export interface User {
5
5
  organizationId: string;
6
6
  id: string;
7
7
  }
8
+ export interface IAuthentication {
9
+ accessToken: string;
10
+ organizationId: string;
11
+ refreshToken: string;
12
+ userId: string;
13
+ }
8
14
  export declare class Authentication {
9
15
  static token: string | undefined;
16
+ static refreshToken: string | undefined;
10
17
  static currentUser: User | undefined;
11
18
  static defaultDeviceId: string | undefined;
12
19
  static waitingForAuth: ((result: boolean) => void)[];
13
- static login(email: string, password: string): Promise<void>;
14
- static loginWithToken(token: string): Promise<void>;
20
+ static login(email: string, password: string): Promise<IAuthentication | Error>;
21
+ static loginWithToken(token: string, refreshToken?: string): Promise<void>;
15
22
  static isAuthenticated(): boolean;
16
23
  static getCurrentUser(): User | undefined;
17
24
  static waitTilAuthenticated(): Promise<boolean>;
25
+ static listenForRefresh(): Promise<void>;
18
26
  }
@@ -0,0 +1,4 @@
1
+ export declare class KeyValue {
2
+ static set(key: string, value: string): Promise<void>;
3
+ static get(key: string): Promise<string>;
4
+ }
@@ -5,3 +5,4 @@ export * from "./DataChannel";
5
5
  export * from "./CaptureStream";
6
6
  export * from "./Manipulator";
7
7
  export * from "./RequestDataChannel";
8
+ export * from "./App";
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
- "name": "@formant/data-sdk",
3
- "description": "A library for getting data from Formant",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/formantio/toolkit.git"
7
- },
8
- "files": [
9
- "dist"
10
- ],
11
- "license": "MIT",
12
- "homepage": "https://github.com/formantio/toolkit",
13
- "main": "./dist/data-sdk.umd.js",
14
- "module": "./dist/data-sdk.es.js",
15
- "exports": {
16
- ".": {
17
- "import": "./dist/data-sdk.es.js",
18
- "require": "./dist/data-sdk.umd.js"
19
- }
20
- },
21
- "version": "0.0.49",
22
- "scripts": {
23
- "dev": "vite --port 9146",
24
- "build": "tsc && vite build",
25
- "serve": "vite preview",
26
- "types": "tsc src/*.ts --lib ESNext,DOM --declaration --emitDeclarationOnly --downlevelIteration --outDir dist/types",
27
- "docs": "typedoc src/main.ts --theme minimal --out ../../docs/data-sdk/"
28
- },
29
- "devDependencies": {
30
- "typedoc": "^0.21.9",
31
- "typescript": "^4.3.2",
32
- "vite": "^2.5.4"
33
- },
34
- "types": "./dist/types/data-sdk/src/main.d.ts",
35
- "dependencies": {
36
- "@types/google-protobuf": "^3.15.5",
37
- "@formant/realtime-sdk": "0.0.4"
2
+ "name": "@formant/data-sdk",
3
+ "description": "A library for getting data from Formant",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/formantio/toolkit.git"
7
+ },
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "license": "MIT",
12
+ "homepage": "https://github.com/formantio/toolkit",
13
+ "main": "./dist/data-sdk.umd.js",
14
+ "module": "./dist/data-sdk.es.js",
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/data-sdk.es.js",
18
+ "require": "./dist/data-sdk.umd.js"
38
19
  }
20
+ },
21
+ "version": "0.0.53",
22
+ "scripts": {
23
+ "dev": "vite --port 9146",
24
+ "build": "tsc && vite build",
25
+ "serve": "vite preview",
26
+ "types": "tsc src/*.ts --lib ESNext,DOM --declaration --emitDeclarationOnly --downlevelIteration --outDir dist/types",
27
+ "docs": "typedoc src/main.ts --theme minimal --out ../../docs/data-sdk/"
28
+ },
29
+ "devDependencies": {
30
+ "typedoc": "^0.21.9",
31
+ "typescript": "^4.3.2",
32
+ "vite": "^2.5.4"
33
+ },
34
+ "types": "./dist/types/data-sdk/src/main.d.ts",
35
+ "dependencies": {
36
+ "@types/google-protobuf": "^3.15.5",
37
+ "@formant/realtime-sdk": "0.0.4"
38
+ }
39
39
  }