@formant/data-sdk 0.0.134 → 0.0.136
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/dist/data-sdk.es.js +173 -24
- package/dist/data-sdk.umd.js +18 -18
- package/dist/types/data-sdk/src/Device.d.ts +2 -0
- package/dist/types/data-sdk/src/Fleet.d.ts +121 -0
- package/dist/types/data-sdk/src/main.d.ts +13 -0
- package/dist/types/data-sdk/src/model/AggregateLevel.d.ts +1 -1
- package/dist/types/data-sdk/src/model/AnalyticsAggregateType.d.ts +2 -0
- package/dist/types/data-sdk/src/model/AnalyticsChartType.d.ts +2 -0
- package/dist/types/data-sdk/src/model/IAggregateRow.d.ts +8 -0
- package/dist/types/data-sdk/src/model/IAnalyticsModule.d.ts +15 -0
- package/dist/types/data-sdk/src/model/IAnalyticsModuleConfiguration.d.ts +6 -0
- package/dist/types/data-sdk/src/model/IScopeFilter.d.ts +6 -0
- package/dist/types/data-sdk/src/model/IShare.d.ts +16 -0
- package/dist/types/data-sdk/src/model/ISqlColumn.d.ts +6 -0
- package/dist/types/data-sdk/src/model/ISqlQuery.d.ts +21 -0
- package/dist/types/data-sdk/src/model/ISqlResult.d.ts +12 -0
- package/dist/types/data-sdk/src/model/ISqlRow.d.ts +5 -0
- package/dist/types/data-sdk/src/model/IStreamColumn.d.ts +7 -0
- package/dist/types/data-sdk/src/model/ITaskReportColumn.d.ts +7 -0
- package/dist/types/data-sdk/src/model/IView.d.ts +15 -0
- package/dist/types/data-sdk/src/model/analyticsAggregteTypes.d.ts +1 -0
- package/dist/types/data-sdk/src/model/analyticsChartTypes.d.ts +1 -0
- package/dist/types/data-sdk/src/utils/aggregateFunctionUtils.d.ts +4 -3
- package/dist/types/data-sdk/src/utils/index.d.ts +1 -0
- package/dist/types/data-sdk/src/utils/timeout.d.ts +1 -0
- package/package.json +2 -1
|
@@ -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
|
}
|
|
@@ -8,8 +8,14 @@ import { IStreamData } from "./model/IStreamData";
|
|
|
8
8
|
import { PeerDevice } from "./PeerDevice";
|
|
9
9
|
import { IDeviceQuery } from "./model/IDeviceQuery";
|
|
10
10
|
import { IStream } from "./model/IStream";
|
|
11
|
+
import { IView } from "./model/IView";
|
|
11
12
|
import { AggregateLevel } from "./main";
|
|
12
13
|
import { EventType } from "./main";
|
|
14
|
+
import { IAnalyticsModule } from "./model/IAnalyticsModule";
|
|
15
|
+
import { IStreamColumn } from "./model/IStreamColumn";
|
|
16
|
+
import { ITaskReportColumn } from "./model/ITaskReportColumn";
|
|
17
|
+
import { ISqlQuery } from "./model/ISqlQuery";
|
|
18
|
+
import { ISqlResult } from "./model/ISqlResult";
|
|
13
19
|
export interface TelemetryResult {
|
|
14
20
|
deviceId: string;
|
|
15
21
|
name: string;
|
|
@@ -56,8 +62,123 @@ export declare class Fleet {
|
|
|
56
62
|
}[]>;
|
|
57
63
|
static getStreams(): Promise<IStream[]>;
|
|
58
64
|
static patchStream(stream: IStream): Promise<IStream>;
|
|
65
|
+
static getViews(): Promise<IView[]>;
|
|
66
|
+
static patchView(view: IView): Promise<IView>;
|
|
59
67
|
static eventsCounter(eventTypes: EventType[], timeFrame: AggregateLevel, range: number, time: number, query?: IEventQuery): Promise<{
|
|
60
68
|
date: string;
|
|
61
69
|
events: IEvent[];
|
|
62
70
|
}[]>;
|
|
71
|
+
static getAnalyticsModules(): Promise<IAnalyticsModule>;
|
|
72
|
+
/**
|
|
73
|
+
* retrieves a list of all available data streams that can be used for running analytics.
|
|
74
|
+
* This function takes no arguments and returns a list of stream names that can be used for analyzing data.
|
|
75
|
+
* @example
|
|
76
|
+
* // Returns
|
|
77
|
+
* [
|
|
78
|
+
* {
|
|
79
|
+
* streamName: "$.agent.health",
|
|
80
|
+
streamType : "health"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
* streamName: "up.hours",
|
|
84
|
+
streamType : "numeric"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
*/
|
|
88
|
+
static getAnalyticStreams(): Promise<IStreamColumn[]>;
|
|
89
|
+
/**
|
|
90
|
+
* retrieves a list of all available tables that can be used to create task reports.
|
|
91
|
+
* This function takes no arguments and returns a list of table names that can be used for creating task reports.
|
|
92
|
+
* @returns List all available tables
|
|
93
|
+
* @example
|
|
94
|
+
* // Returns
|
|
95
|
+
*[
|
|
96
|
+
* {
|
|
97
|
+
* name: "",
|
|
98
|
+
* tableName: "TASK_REPORTS_CLEANING_MODE",
|
|
99
|
+
* columns: [
|
|
100
|
+
* {
|
|
101
|
+
* name: "TYPE",
|
|
102
|
+
* isNullable: true,
|
|
103
|
+
* dataType: "string",
|
|
104
|
+
* tableName: "custom"
|
|
105
|
+
* }
|
|
106
|
+
* ]
|
|
107
|
+
* }
|
|
108
|
+
*]
|
|
109
|
+
*/
|
|
110
|
+
static getTaskReportTables(): Promise<ITaskReportColumn[]>;
|
|
111
|
+
/**
|
|
112
|
+
*Retrieves all stream rows
|
|
113
|
+
* @example
|
|
114
|
+
* // Body
|
|
115
|
+
* const analytics = await Fleet.queryAnalytics({
|
|
116
|
+
* aggregateLevel: "day",
|
|
117
|
+
* orderByColumn: "TIMESTAMP",
|
|
118
|
+
* streamColumns: [
|
|
119
|
+
* {
|
|
120
|
+
* streamName: "consumables_residual_percentage",
|
|
121
|
+
* streamType: "numeric set",
|
|
122
|
+
* },
|
|
123
|
+
* ],
|
|
124
|
+
* });
|
|
125
|
+
* //Returns
|
|
126
|
+
* {
|
|
127
|
+
* aggregates: [],
|
|
128
|
+
* columns: [
|
|
129
|
+
* {
|
|
130
|
+
* name: 'TIMESTAMP',
|
|
131
|
+
* isNullable: true,
|
|
132
|
+
* dataType: 'string',
|
|
133
|
+
* tableName: 'NUMERIC_SET_MAIN'
|
|
134
|
+
* }
|
|
135
|
+
* ],
|
|
136
|
+
* items: [
|
|
137
|
+
* {
|
|
138
|
+
* axisLabel: "suction_blade",
|
|
139
|
+
* name: "consumables_residual_percentage",
|
|
140
|
+
* tableName: "NUMERIC_SET_TEST",
|
|
141
|
+
* time: "2020-04-20T08:00:00.000Z",
|
|
142
|
+
* type: "numeric set",
|
|
143
|
+
* unitLabel: "percent"
|
|
144
|
+
* }
|
|
145
|
+
* ],
|
|
146
|
+
* rowCount: 14,
|
|
147
|
+
* rows: []
|
|
148
|
+
* sqlText: "SELECT dateadd(day, dayofweek(TIMESTAMP), to_timestamp_tz('4/20/2020')) AS TIMESTAMP, SUM(VALUE)"
|
|
149
|
+
* }
|
|
150
|
+
*/
|
|
151
|
+
static queryAnalytics(query: ISqlQuery): Promise<ISqlResult>;
|
|
152
|
+
/**
|
|
153
|
+
* Retrieves all rows
|
|
154
|
+
* sqlQuery is required
|
|
155
|
+
* @param query
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
158
|
+
static getAnalyticsRows(query: ISqlQuery): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* @param taskColumns is required
|
|
161
|
+
* @returns
|
|
162
|
+
* All task reports
|
|
163
|
+
* @example
|
|
164
|
+
* // Body
|
|
165
|
+
* const tasks = await Fleet.getTaskReports({
|
|
166
|
+
* taskColumns: [
|
|
167
|
+
* {
|
|
168
|
+
* columns: [
|
|
169
|
+
* {
|
|
170
|
+
* dataType: "string",
|
|
171
|
+
* isNullable: true,
|
|
172
|
+
* name: "TYPE",
|
|
173
|
+
* tableName: "custom",
|
|
174
|
+
* },
|
|
175
|
+
* ],
|
|
176
|
+
* name: "DURATION_SECONDS",
|
|
177
|
+
* tableName: "TASK_REPORTS_CLEANING_MODE",
|
|
178
|
+
* yAxis: "DURATION_SECONDS",
|
|
179
|
+
* },
|
|
180
|
+
* ],
|
|
181
|
+
* });
|
|
182
|
+
*/
|
|
183
|
+
static getTaskReportRows(query: ISqlQuery): Promise<any>;
|
|
63
184
|
}
|
|
@@ -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,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,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,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,15 @@
|
|
|
1
|
+
import { IsoDate } from "./IsoDate";
|
|
2
|
+
import { Uuid } from "./Uuid";
|
|
3
|
+
export interface IView {
|
|
4
|
+
id: Uuid;
|
|
5
|
+
createdAt: IsoDate;
|
|
6
|
+
updatedAt: IsoDate;
|
|
7
|
+
organizationId: Uuid;
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
showOnSingleDevice: boolean;
|
|
11
|
+
showOnMultiDevice: boolean;
|
|
12
|
+
showOnTeleop: boolean;
|
|
13
|
+
showOnAnalytics: boolean;
|
|
14
|
+
showTimeline: boolean;
|
|
15
|
+
}
|
|
@@ -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
|
-
|
|
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
|
|
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:
|
|
27
|
+
export declare const aggregateByDateFunctions: any;
|
|
27
28
|
export declare const formatTimeFrameText: (start: string, end: string) => string;
|
|
@@ -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.
|
|
21
|
+
"version": "0.0.136",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"dev": "vite --port 9146",
|
|
24
24
|
"build": "tsc && vite build",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"docs": "typedoc src/main.ts --theme default --out ../../docs/data-sdk/"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
+
"@types/node": "^18.15.11",
|
|
30
31
|
"typedoc": "^0.22.13",
|
|
31
32
|
"typescript": "^4.3.2",
|
|
32
33
|
"vite": "^2.5.4"
|