@formant/data-sdk 0.0.135 → 0.0.137

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 (27) hide show
  1. package/dist/data-sdk.es.js +18564 -14924
  2. package/dist/data-sdk.umd.js +53 -39
  3. package/dist/types/data-sdk/src/Authentication.d.ts +23 -0
  4. package/dist/types/data-sdk/src/Device.d.ts +2 -0
  5. package/dist/types/data-sdk/src/Fleet.d.ts +139 -2
  6. package/dist/types/data-sdk/src/main.d.ts +13 -0
  7. package/dist/types/data-sdk/src/model/AggregateLevel.d.ts +1 -1
  8. package/dist/types/data-sdk/src/model/AnalyticsAggregateType.d.ts +2 -0
  9. package/dist/types/data-sdk/src/model/AnalyticsChartType.d.ts +2 -0
  10. package/dist/types/data-sdk/src/model/IAggregateRow.d.ts +8 -0
  11. package/dist/types/data-sdk/src/model/IAnalyticsModule.d.ts +15 -0
  12. package/dist/types/data-sdk/src/model/IAnalyticsModuleConfiguration.d.ts +6 -0
  13. package/dist/types/data-sdk/src/model/IScopeFilter.d.ts +6 -0
  14. package/dist/types/data-sdk/src/model/IShare.d.ts +16 -0
  15. package/dist/types/data-sdk/src/model/ISqlColumn.d.ts +6 -0
  16. package/dist/types/data-sdk/src/model/ISqlQuery.d.ts +21 -0
  17. package/dist/types/data-sdk/src/model/ISqlResult.d.ts +12 -0
  18. package/dist/types/data-sdk/src/model/ISqlRow.d.ts +5 -0
  19. package/dist/types/data-sdk/src/model/IStreamColumn.d.ts +7 -0
  20. package/dist/types/data-sdk/src/model/ITaskReportColumn.d.ts +7 -0
  21. package/dist/types/data-sdk/src/model/analyticsAggregteTypes.d.ts +1 -0
  22. package/dist/types/data-sdk/src/model/analyticsChartTypes.d.ts +1 -0
  23. package/dist/types/data-sdk/src/utils/aggregateFunctionUtils.d.ts +4 -3
  24. package/dist/types/data-sdk/src/utils/index.d.ts +2 -0
  25. package/dist/types/data-sdk/src/utils/serializeHash.d.ts +2 -0
  26. package/dist/types/data-sdk/src/utils/timeout.d.ts +1 -0
  27. package/package.json +7 -3
@@ -11,6 +11,16 @@ export interface IAuthentication {
11
11
  refreshToken: string;
12
12
  userId: string;
13
13
  }
14
+ export interface IConfirmForgotPasswordRequest {
15
+ email: string;
16
+ confirmationCode: string;
17
+ newPassword: string;
18
+ }
19
+ export interface IRespondToNewPasswordRequiredChallengeRequest {
20
+ userId: string;
21
+ session: string;
22
+ newPassword: string;
23
+ }
14
24
  export declare class Authentication {
15
25
  static token: string | undefined;
16
26
  static refreshToken: string | undefined;
@@ -25,4 +35,17 @@ export declare class Authentication {
25
35
  static getCurrentUser(): User | undefined;
26
36
  static waitTilAuthenticated(): Promise<boolean>;
27
37
  static listenForRefresh(): Promise<void>;
38
+ static forgotPassword(email: string): Promise<void>;
39
+ /**
40
+ * @example
41
+ * // Body
42
+ * await Authentication.confirmForgotPassword({
43
+ * email: "joe@gmail.com"
44
+ * confirmationCode: "1",
45
+ * newPassword: "NewPassword"
46
+ * });
47
+ */
48
+ static confirmForgotPassword(request: IConfirmForgotPasswordRequest): Promise<boolean>;
49
+ static respondToNewPasswordRequiredChallenge(request: IRespondToNewPasswordRequiredChallengeRequest): Promise<any>;
50
+ static loginWithGoogle(token: string): Promise<any>;
28
51
  }
@@ -10,6 +10,7 @@ import { RtcStreamType } from "@formant/realtime-sdk/dist/model/RtcStreamType";
10
10
  import { IEventQuery } from "./main";
11
11
  import { AggregateLevel } from "./main";
12
12
  import { EventType } from "./main";
13
+ import { IShare } from "./model/IShare";
13
14
  export interface ConfigurationDocument {
14
15
  urdfFiles: string[];
15
16
  telemetry?: {
@@ -147,4 +148,5 @@ export declare class Device implements IRealtimeDevice {
147
148
  date: string;
148
149
  events: import("./main").IEvent[];
149
150
  }[]>;
151
+ createShareLink(params: IShare): Promise<any>;
150
152
  }
@@ -9,8 +9,12 @@ 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 { AggregateLevel } from "./main";
13
- import { EventType } from "./main";
12
+ import { EventType, AggregateLevel, IShare } from "./main";
13
+ import { IAnalyticsModule } from "./model/IAnalyticsModule";
14
+ import { IStreamColumn } from "./model/IStreamColumn";
15
+ import { ITaskReportColumn } from "./model/ITaskReportColumn";
16
+ import { ISqlQuery } from "./model/ISqlQuery";
17
+ import { ISqlResult } from "./model/ISqlResult";
14
18
  export interface TelemetryResult {
15
19
  deviceId: string;
16
20
  name: string;
@@ -63,4 +67,137 @@ export declare class Fleet {
63
67
  date: string;
64
68
  events: IEvent[];
65
69
  }[]>;
70
+ static getAnalyticsModules(): Promise<IAnalyticsModule>;
71
+ /**
72
+ * retrieves a list of all available data streams that can be used for running analytics.
73
+ * This function takes no arguments and returns a list of stream names that can be used for analyzing data.
74
+ * @example
75
+ * // Returns
76
+ * [
77
+ * {
78
+ * streamName: "$.agent.health",
79
+ streamType : "health"
80
+ },
81
+ {
82
+ * streamName: "up.hours",
83
+ streamType : "numeric"
84
+ }
85
+ ]
86
+ */
87
+ static getAnalyticStreams(): Promise<IStreamColumn[]>;
88
+ /**
89
+ * retrieves a list of all available tables that can be used to create task reports.
90
+ * This function takes no arguments and returns a list of table names that can be used for creating task reports.
91
+ * @returns List all available tables
92
+ * @example
93
+ * // Returns
94
+ *[
95
+ * {
96
+ * name: "",
97
+ * tableName: "TASK_REPORTS_CLEANING_MODE",
98
+ * columns: [
99
+ * {
100
+ * name: "TYPE",
101
+ * isNullable: true,
102
+ * dataType: "string",
103
+ * tableName: "custom"
104
+ * }
105
+ * ]
106
+ * }
107
+ *]
108
+ */
109
+ static getTaskReportTables(): Promise<ITaskReportColumn[]>;
110
+ /**
111
+ *Retrieves all stream rows
112
+ * @example
113
+ * // Body
114
+ * const analytics = await Fleet.queryAnalytics({
115
+ * aggregateLevel: "day",
116
+ * orderByColumn: "TIMESTAMP",
117
+ * streamColumns: [
118
+ * {
119
+ * streamName: "consumables_residual_percentage",
120
+ * streamType: "numeric set",
121
+ * },
122
+ * ],
123
+ * });
124
+ * //Returns
125
+ * {
126
+ * aggregates: [],
127
+ * columns: [
128
+ * {
129
+ * name: 'TIMESTAMP',
130
+ * isNullable: true,
131
+ * dataType: 'string',
132
+ * tableName: 'NUMERIC_SET_MAIN'
133
+ * }
134
+ * ],
135
+ * items: [
136
+ * {
137
+ * axisLabel: "suction_blade",
138
+ * name: "consumables_residual_percentage",
139
+ * tableName: "NUMERIC_SET_TEST",
140
+ * time: "2020-04-20T08:00:00.000Z",
141
+ * type: "numeric set",
142
+ * unitLabel: "percent"
143
+ * }
144
+ * ],
145
+ * rowCount: 14,
146
+ * rows: []
147
+ * sqlText: "SELECT dateadd(day, dayofweek(TIMESTAMP), to_timestamp_tz('4/20/2020')) AS TIMESTAMP, SUM(VALUE)"
148
+ * }
149
+ */
150
+ static queryAnalytics(query: ISqlQuery): Promise<ISqlResult>;
151
+ /**
152
+ * Retrieves all rows
153
+ * sqlQuery is required
154
+ * @param query
155
+ * @returns
156
+ */
157
+ static getAnalyticsRows(query: ISqlQuery): Promise<any>;
158
+ /**
159
+ * @param taskColumns is required
160
+ * @returns
161
+ * All task reports
162
+ * @example
163
+ * // Body
164
+ * const tasks = await Fleet.getTaskReports({
165
+ * taskColumns: [
166
+ * {
167
+ * columns: [
168
+ * {
169
+ * dataType: "string",
170
+ * isNullable: true,
171
+ * name: "TYPE",
172
+ * tableName: "custom",
173
+ * },
174
+ * ],
175
+ * name: "DURATION_SECONDS",
176
+ * tableName: "TASK_REPORTS_CLEANING_MODE",
177
+ * yAxis: "DURATION_SECONDS",
178
+ * },
179
+ * ],
180
+ * });
181
+ */
182
+ static getTaskReportRows(query: ISqlQuery): Promise<any>;
183
+ /**
184
+ * @param scope is required
185
+ * @param time is required
186
+ * @returns
187
+ * Share link
188
+ * @example
189
+ * // Body
190
+ * const link = await Fleet.createShareLink({
191
+ * delegateTeleop: false
192
+ * message: "See bot in action",
193
+ * scope: {
194
+ * deviceIds: ["d64520a6-a308-4a59-9267-b7f8a7bfc7ab"],
195
+ * start: "2023-04-04T19:51:47.125Z",
196
+ * end: "2023-04-04T20:51:47.125Z"
197
+ * },
198
+ * time: "2023-04-04T20:21:47.125Z",
199
+ * userName: "User",
200
+ * });
201
+ */
202
+ static createShareLink(share: IShare): Promise<string>;
66
203
  }
@@ -116,3 +116,16 @@ export * from "./model/IAnnotationQuery";
116
116
  export * from "./model/IStream";
117
117
  export { IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, } from "@formant/realtime-sdk";
118
118
  export * from "./model/JsonSchema";
119
+ export * from "./utils/aggregateFunctionUtils";
120
+ export * from "./model/IStreamColumn";
121
+ export * from "./model/IAnalyticsModule";
122
+ export * from "./model/ITaskReportColumn";
123
+ export * from "./model/IView";
124
+ export * from "./model/IShare";
125
+ export * from "./model/ISqlQuery";
126
+ export * from "./model/IScopeFilter";
127
+ export * from "./model/ISqlColumn";
128
+ export * from "./model/ISqlResult";
129
+ export * from "./model/IAnalyticsModuleConfiguration";
130
+ export * from "./model/IAggregateRow";
131
+ export * from "./model/ISqlRow";
@@ -1 +1 @@
1
- export type AggregateLevel = "year" | "month" | "week" | "day" | "hour" | "minute" | "quarter";
1
+ export type AggregateLevel = "year" | "month" | "week" | "day" | "12 hours" | "4 hours" | "hour" | "30 minutes" | "5 minutes" | "minute" | "30 seconds" | "5 seconds" | "second" | "quarter";
@@ -0,0 +1,2 @@
1
+ import { analyticsAggregateTypes } from "./analyticsAggregteTypes";
2
+ export type AnalyticsAggregateType = typeof analyticsAggregateTypes[number];
@@ -0,0 +1,2 @@
1
+ import { analyicsChartTypes } from "./analyticsChartTypes";
2
+ export type AnalyticsChartType = typeof analyicsChartTypes[number];
@@ -0,0 +1,8 @@
1
+ import { AnalyticsAggregateType } from "./AnalyticsAggregateType";
2
+ export interface IAggregateRow {
3
+ unit?: string;
4
+ label?: string;
5
+ name: string;
6
+ value: number;
7
+ type: AnalyticsAggregateType;
8
+ }
@@ -0,0 +1,15 @@
1
+ import { IBaseEntity } from "./IBaseEntity";
2
+ import { Uuid } from "./Uuid";
3
+ import { ISqlQuery } from "./ISqlQuery";
4
+ import { IAnalyticsModuleConfiguration } from "./IAnalyticsModuleConfiguration";
5
+ export interface IAnalyticsModule extends IBaseEntity {
6
+ id?: Uuid;
7
+ organizationId?: Uuid;
8
+ name: string;
9
+ query: ISqlQuery | null;
10
+ configuration: IAnalyticsModuleConfiguration | null;
11
+ layout: any | null;
12
+ data: any[] | null;
13
+ streamIds: Uuid[];
14
+ fullscreen?: boolean;
15
+ }
@@ -0,0 +1,6 @@
1
+ import { AnalyticsAggregateType } from "./AnalyticsAggregateType";
2
+ import { AnalyticsChartType } from "./AnalyticsChartType";
3
+ export interface IAnalyticsModuleConfiguration {
4
+ chartType?: AnalyticsChartType;
5
+ aggregateType?: AnalyticsAggregateType;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { IFilter } from "./IFilter";
2
+ import { IsoDate } from "./IsoDate";
3
+ export interface IScopeFilter extends IFilter {
4
+ start?: IsoDate;
5
+ end?: IsoDate;
6
+ }
@@ -0,0 +1,16 @@
1
+ import { IBaseEntity } from "./IBaseEntity";
2
+ import { Uuid } from "./Uuid";
3
+ import { IScopeFilter } from "./IScopeFilter";
4
+ import { IsoDate } from "./IsoDate";
5
+ export interface IShare extends IBaseEntity {
6
+ organizationId?: Uuid;
7
+ userId?: Uuid;
8
+ code?: string;
9
+ scope: IScopeFilter;
10
+ time: IsoDate;
11
+ expiration?: IsoDate | null;
12
+ channelId?: Uuid;
13
+ message?: string;
14
+ userName?: string;
15
+ delegateTeleop?: boolean;
16
+ }
@@ -0,0 +1,6 @@
1
+ export interface ISqlColumn {
2
+ name: string;
3
+ tableName: string;
4
+ isNullable?: boolean;
5
+ dataType: "string" | "timestamp" | "boolean" | "number" | "null";
6
+ }
@@ -0,0 +1,21 @@
1
+ import { IsoDate } from "./IsoDate";
2
+ import { IFilter } from "./IFilter";
3
+ import { AggregateLevel } from "./AggregateLevel";
4
+ import { IStreamColumn } from "./IStreamColumn";
5
+ import { ITaskReportColumn } from "./ITaskReportColumn";
6
+ export interface ISqlQuery extends IFilter {
7
+ sqlQuery?: string;
8
+ parameters?: string[];
9
+ start?: IsoDate;
10
+ end?: IsoDate;
11
+ streamColumns?: IStreamColumn[];
12
+ taskColumns?: ITaskReportColumn[];
13
+ aggregateLevel?: AggregateLevel;
14
+ limit?: number;
15
+ orderByColumn?: string;
16
+ orderByDescending?: boolean;
17
+ visibleColumns?: string[];
18
+ filters?: string[];
19
+ type?: "stream" | "task" | "advanced";
20
+ unit?: string;
21
+ }
@@ -0,0 +1,12 @@
1
+ import { IAggregateRow } from "./IAggregateRow";
2
+ import { ISqlColumn } from "./ISqlColumn";
3
+ import { ISqlRow } from "./ISqlRow";
4
+ export interface ISqlResult {
5
+ rows: ISqlRow[];
6
+ columns: ISqlColumn[];
7
+ aggregates?: IAggregateRow[];
8
+ sqlText: string;
9
+ aggregateSqlText?: string;
10
+ rowCount: number;
11
+ unit?: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { IsoDate } from "./IsoDate";
2
+ export interface ISqlRow {
3
+ [key: string]: string | IsoDate | number | boolean | null;
4
+ tableName: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { StreamType } from "./StreamType";
2
+ import { AnalyticsAggregateType } from "./AnalyticsAggregateType";
3
+ export interface IStreamColumn {
4
+ streamName: string;
5
+ streamType: StreamType;
6
+ aggregateType?: AnalyticsAggregateType;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ISqlColumn } from "./ISqlColumn";
2
+ export interface ITaskReportColumn {
3
+ tableName: string;
4
+ columns?: ISqlColumn[];
5
+ name: string;
6
+ yAxis?: string;
7
+ }
@@ -0,0 +1 @@
1
+ export declare const analyticsAggregateTypes: readonly ["avg", "sum", "count", "min", "max"];
@@ -0,0 +1 @@
1
+ export declare const analyicsChartTypes: readonly ["line", "bar", "table", "pie", "summary"];
@@ -1,7 +1,8 @@
1
1
  import { INumericAggregate } from "../model/INumericAggregate";
2
- import { AggregateLevel } from "../main";
2
+ export declare const vailableAggregationIntervals: readonly ["day", "week", "month", "year", "hour", "minute", "quarter"];
3
+ export type ValidAggregationInterval = typeof vailableAggregationIntervals[number];
3
4
  export type IAggregateByDateFunctions = {
4
- [key in AggregateLevel]: AggregateFunction;
5
+ [key in ValidAggregationInterval]: AggregateFunction;
5
6
  };
6
7
  export declare const aggregateFunctions: readonly ["interval", "start", "end", "sub", "get"];
7
8
  export type AggregateFunctions = typeof aggregateFunctions[number];
@@ -23,5 +24,5 @@ export declare const aggregateFunctionMap: {
23
24
  sum: typeof getSum;
24
25
  count: typeof getCount;
25
26
  };
26
- export declare const aggregateByDateFunctions: IAggregateByDateFunctions;
27
+ export declare const aggregateByDateFunctions: any;
27
28
  export declare const formatTimeFrameText: (start: string, end: string) => string;
@@ -1,2 +1,4 @@
1
1
  export * from "./aggregateFunctionUtils";
2
2
  export * from "./numericAggregateUtils";
3
+ export * from "./timeout";
4
+ export * from "./serializeHash";
@@ -0,0 +1,2 @@
1
+ export declare function serializeHash(value: any): string;
2
+ export declare function deserializeHash(value: string): any;
@@ -0,0 +1 @@
1
+ export declare const timeout: (s: number) => Promise<unknown>;
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "require": "./dist/data-sdk.umd.js"
19
19
  }
20
20
  },
21
- "version": "0.0.135",
21
+ "version": "0.0.137",
22
22
  "scripts": {
23
23
  "dev": "vite --port 9146",
24
24
  "build": "tsc && vite build",
@@ -27,9 +27,13 @@
27
27
  "docs": "typedoc src/main.ts --theme default --out ../../docs/data-sdk/"
28
28
  },
29
29
  "devDependencies": {
30
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
31
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
32
+ "@rollup/plugin-node-resolve": "^15.0.2",
33
+ "@types/node": "^18.15.11",
30
34
  "typedoc": "^0.22.13",
31
- "typescript": "^4.3.2",
32
- "vite": "^2.5.4"
35
+ "typescript": "^4.9.3",
36
+ "vite": "^4.1.0"
33
37
  },
34
38
  "types": "./dist/types/data-sdk/src/main.d.ts",
35
39
  "dependencies": {