@formant/data-sdk 0.0.133 → 0.0.134
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 +65 -15
- package/dist/data-sdk.umd.js +3 -3
- package/dist/types/data-sdk/src/Device.d.ts +7 -2
- package/dist/types/data-sdk/src/Fleet.d.ts +7 -2
- package/dist/types/data-sdk/src/main.d.ts +1 -0
- package/dist/types/data-sdk/src/model/AggregateLevel.d.ts +1 -1
- package/dist/types/data-sdk/src/utils/aggregateFunctionUtils.d.ts +5 -5
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -20627,21 +20627,25 @@ class Device {
|
|
|
20627
20627
|
const interventionResponse = await response.json();
|
|
20628
20628
|
return interventionResponse;
|
|
20629
20629
|
}
|
|
20630
|
-
async getAnnotationCount(query,
|
|
20630
|
+
async getAnnotationCount(query, tagKey) {
|
|
20631
20631
|
return await Fleet.getAnnotationCount(
|
|
20632
20632
|
{ ...query, deviceIds: [this.id] },
|
|
20633
|
-
annotationName,
|
|
20634
20633
|
tagKey
|
|
20635
20634
|
);
|
|
20636
20635
|
}
|
|
20637
|
-
async getAnnotationCountByIntervals(query,
|
|
20636
|
+
async getAnnotationCountByIntervals(query, tagKey, aggregate) {
|
|
20638
20637
|
return await Fleet.getAnnotationCountByIntervals(
|
|
20639
20638
|
{ ...query, deviceIds: [this.id] },
|
|
20640
|
-
annotationName,
|
|
20641
20639
|
tagKey,
|
|
20642
20640
|
aggregate
|
|
20643
20641
|
);
|
|
20644
20642
|
}
|
|
20643
|
+
async eventsCounter(eventTypes2, timeFrame, range, time, query) {
|
|
20644
|
+
return await Fleet.eventsCounter(eventTypes2, timeFrame, range, time, {
|
|
20645
|
+
...query,
|
|
20646
|
+
deviceIds: [this.id]
|
|
20647
|
+
});
|
|
20648
|
+
}
|
|
20645
20649
|
}
|
|
20646
20650
|
class PeerDevice {
|
|
20647
20651
|
constructor(peerUrl) {
|
|
@@ -21221,10 +21225,9 @@ const _Fleet = class {
|
|
|
21221
21225
|
});
|
|
21222
21226
|
return devices;
|
|
21223
21227
|
}
|
|
21224
|
-
static async getAnnotationCount(query,
|
|
21228
|
+
static async getAnnotationCount(query, tagKey) {
|
|
21225
21229
|
const annotations = await this.queryEvents({
|
|
21226
21230
|
...query,
|
|
21227
|
-
message: annotationName,
|
|
21228
21231
|
eventTypes: ["annotation"]
|
|
21229
21232
|
});
|
|
21230
21233
|
const validAnnotations = annotations.filter(
|
|
@@ -21241,7 +21244,7 @@ const _Fleet = class {
|
|
|
21241
21244
|
}, {});
|
|
21242
21245
|
return annotationCounter;
|
|
21243
21246
|
}
|
|
21244
|
-
static async getAnnotationCountByIntervals(query,
|
|
21247
|
+
static async getAnnotationCountByIntervals(query, tagKey, aggregate) {
|
|
21245
21248
|
const { end, start } = query;
|
|
21246
21249
|
const dateFunctions = aggregateByDateFunctions[aggregate];
|
|
21247
21250
|
const intervals = dateFunctions.interval({
|
|
@@ -21257,7 +21260,6 @@ const _Fleet = class {
|
|
|
21257
21260
|
start: startDate,
|
|
21258
21261
|
end: endDate
|
|
21259
21262
|
},
|
|
21260
|
-
annotationName,
|
|
21261
21263
|
tagKey
|
|
21262
21264
|
);
|
|
21263
21265
|
});
|
|
@@ -21300,6 +21302,33 @@ const _Fleet = class {
|
|
|
21300
21302
|
);
|
|
21301
21303
|
return await response.json();
|
|
21302
21304
|
}
|
|
21305
|
+
static async eventsCounter(eventTypes2, timeFrame, range, time, query) {
|
|
21306
|
+
const dateFunctions = aggregateByDateFunctions[timeFrame];
|
|
21307
|
+
return await Promise.all(
|
|
21308
|
+
Array(range).fill(0).map(async (_, dateOffset) => {
|
|
21309
|
+
const activePointInTimeLine = new Date(time);
|
|
21310
|
+
const startDate = dateFunctions.sub(
|
|
21311
|
+
dateFunctions.start(activePointInTimeLine),
|
|
21312
|
+
range - dateOffset - 1
|
|
21313
|
+
);
|
|
21314
|
+
const endDate = dateFunctions.sub(
|
|
21315
|
+
dateFunctions.end(activePointInTimeLine),
|
|
21316
|
+
range - dateOffset - 1
|
|
21317
|
+
);
|
|
21318
|
+
const date = formatTimeFrameText(
|
|
21319
|
+
startDate.toLocaleDateString(),
|
|
21320
|
+
endDate.toLocaleDateString()
|
|
21321
|
+
);
|
|
21322
|
+
const events = await _Fleet.queryEvents({
|
|
21323
|
+
...query,
|
|
21324
|
+
eventTypes: eventTypes2,
|
|
21325
|
+
start: new Date(startDate).toISOString(),
|
|
21326
|
+
end: new Date(endDate).toISOString()
|
|
21327
|
+
});
|
|
21328
|
+
return { date, events };
|
|
21329
|
+
})
|
|
21330
|
+
);
|
|
21331
|
+
}
|
|
21303
21332
|
};
|
|
21304
21333
|
let Fleet = _Fleet;
|
|
21305
21334
|
__publicField(Fleet, "defaultDeviceId");
|
|
@@ -21387,6 +21416,13 @@ class KeyValue {
|
|
|
21387
21416
|
}
|
|
21388
21417
|
}
|
|
21389
21418
|
}
|
|
21419
|
+
const aggregateFunctions = [
|
|
21420
|
+
"interval",
|
|
21421
|
+
"start",
|
|
21422
|
+
"end",
|
|
21423
|
+
"sub",
|
|
21424
|
+
"get"
|
|
21425
|
+
];
|
|
21390
21426
|
function getVariance(a2) {
|
|
21391
21427
|
if (a2.count < 2) {
|
|
21392
21428
|
return 0;
|
|
@@ -21424,39 +21460,53 @@ const aggregateByDateFunctions = {
|
|
|
21424
21460
|
interval: dateFns.eachDayOfInterval,
|
|
21425
21461
|
start: dateFns.startOfDay,
|
|
21426
21462
|
end: dateFns.endOfDay,
|
|
21427
|
-
sub: dateFns.subDays
|
|
21463
|
+
sub: dateFns.subDays,
|
|
21464
|
+
get: dateFns.getDay
|
|
21428
21465
|
},
|
|
21429
21466
|
week: {
|
|
21430
21467
|
interval: dateFns.eachWeekOfInterval,
|
|
21431
21468
|
start: dateFns.startOfWeek,
|
|
21432
21469
|
end: dateFns.endOfWeek,
|
|
21433
|
-
sub: dateFns.subWeeks
|
|
21470
|
+
sub: dateFns.subWeeks,
|
|
21471
|
+
get: dateFns.getWeek
|
|
21434
21472
|
},
|
|
21435
21473
|
month: {
|
|
21436
21474
|
interval: dateFns.eachMonthOfInterval,
|
|
21437
21475
|
start: dateFns.startOfMonth,
|
|
21438
21476
|
end: dateFns.endOfMonth,
|
|
21439
|
-
sub: dateFns.subMonths
|
|
21477
|
+
sub: dateFns.subMonths,
|
|
21478
|
+
get: dateFns.getMonth
|
|
21440
21479
|
},
|
|
21441
21480
|
year: {
|
|
21442
21481
|
interval: dateFns.eachYearOfInterval,
|
|
21443
21482
|
start: dateFns.startOfYear,
|
|
21444
21483
|
end: dateFns.endOfYear,
|
|
21445
|
-
sub: dateFns.subYears
|
|
21484
|
+
sub: dateFns.subYears,
|
|
21485
|
+
get: dateFns.getYear
|
|
21446
21486
|
},
|
|
21447
21487
|
hour: {
|
|
21448
21488
|
interval: dateFns.eachHourOfInterval,
|
|
21449
21489
|
start: dateFns.startOfHour,
|
|
21450
21490
|
end: dateFns.endOfHour,
|
|
21451
|
-
sub: dateFns.subHours
|
|
21491
|
+
sub: dateFns.subHours,
|
|
21492
|
+
get: dateFns.getHours
|
|
21452
21493
|
},
|
|
21453
21494
|
minute: {
|
|
21454
21495
|
interval: dateFns.eachMinuteOfInterval,
|
|
21455
21496
|
start: dateFns.startOfMinute,
|
|
21456
21497
|
end: dateFns.endOfMinute,
|
|
21457
|
-
sub: dateFns.subMinutes
|
|
21498
|
+
sub: dateFns.subMinutes,
|
|
21499
|
+
get: dateFns.getMinutes
|
|
21500
|
+
},
|
|
21501
|
+
quarter: {
|
|
21502
|
+
interval: dateFns.eachQuarterOfInterval,
|
|
21503
|
+
start: dateFns.startOfQuarter,
|
|
21504
|
+
end: dateFns.endOfQuarter,
|
|
21505
|
+
sub: dateFns.subQuarters,
|
|
21506
|
+
get: dateFns.getQuarter
|
|
21458
21507
|
}
|
|
21459
21508
|
};
|
|
21509
|
+
const formatTimeFrameText = (start, end) => start.split("/")[0] + "/" + start.split("/")[1] + "\u2013" + end.split("/")[0] + "/" + end.split("/")[1];
|
|
21460
21510
|
function getZeroINumericSet() {
|
|
21461
21511
|
return {
|
|
21462
21512
|
min: Number.MAX_SAFE_INTEGER,
|
|
@@ -21699,4 +21749,4 @@ if (moduleName) {
|
|
|
21699
21749
|
var IRtcSendConfiguration = dist.exports.IRtcSendConfiguration;
|
|
21700
21750
|
var IRtcStreamMessage = dist.exports.IRtcStreamMessage;
|
|
21701
21751
|
var IRtcStreamPayload = dist.exports.IRtcStreamPayload;
|
|
21702
|
-
export { App, AudioPlayer, Authentication, BinaryRequestDataChannel, CaptureStream, DataChannel, Device, Fleet, IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, KeyValue, Manipulator, PeerDevice, SessionType, TextRequestDataChannel, accessLevels, administrator, aggregateByDateFunctions, aggregateFunctionMap, aggregateLevels, annotationTypes, combineNumericAggregates, combineNumericSetAggregates, eventTypes, getAverage, getCount, getMax, getMin, getStandardDeviation, getSum, getVariance, getZeroINumericSet, healthStatuses, interventionTypes, operator, reduceNumericSetStreamAggregates, reduceNumericStreamAggregates, severities, videoMimeTypes, viewer };
|
|
21752
|
+
export { App, AudioPlayer, Authentication, BinaryRequestDataChannel, CaptureStream, DataChannel, Device, Fleet, IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, KeyValue, Manipulator, PeerDevice, SessionType, TextRequestDataChannel, accessLevels, administrator, aggregateByDateFunctions, aggregateFunctionMap, aggregateFunctions, aggregateLevels, annotationTypes, combineNumericAggregates, combineNumericSetAggregates, eventTypes, formatTimeFrameText, getAverage, getCount, getMax, getMin, getStandardDeviation, getSum, getVariance, getZeroINumericSet, healthStatuses, interventionTypes, operator, reduceNumericSetStreamAggregates, reduceNumericStreamAggregates, severities, videoMimeTypes, viewer };
|