@formant/data-sdk 0.0.105 → 0.0.106

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.
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,6 +16,7 @@ var __spreadValues = (a2, b) => {
14
16
  }
15
17
  return a2;
16
18
  };
19
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
17
20
  var __publicField = (obj, key, value) => {
18
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
22
  return value;
@@ -19932,6 +19935,80 @@ class KeyValue {
19932
19935
  }
19933
19936
  }
19934
19937
  }
19938
+ function getVariance(a2) {
19939
+ if (a2.count < 2) {
19940
+ return 0;
19941
+ }
19942
+ return a2.sumOfSquares / (a2.count - 1);
19943
+ }
19944
+ function getStandardDeviation(a2) {
19945
+ return Math.sqrt(getVariance(a2));
19946
+ }
19947
+ function getMax(a2) {
19948
+ return a2.max;
19949
+ }
19950
+ function getMin(a2) {
19951
+ return a2.min;
19952
+ }
19953
+ function getAverage(a2) {
19954
+ return a2.count === 0 ? -1 : a2.sum / a2.count;
19955
+ }
19956
+ function getSum(a2) {
19957
+ return a2.sum;
19958
+ }
19959
+ function getCount(a2) {
19960
+ return a2.count;
19961
+ }
19962
+ const aggregateFunctionMap = {
19963
+ min: getMin,
19964
+ max: getMax,
19965
+ "standard deviation": getStandardDeviation,
19966
+ average: getAverage,
19967
+ sum: getSum,
19968
+ count: getCount
19969
+ };
19970
+ function getZeroINumericSet() {
19971
+ return {
19972
+ min: Number.MAX_SAFE_INTEGER,
19973
+ max: 0,
19974
+ sum: 0,
19975
+ count: 0,
19976
+ sumOfSquares: 0
19977
+ };
19978
+ }
19979
+ function reduceNumericStreamAggregates(stream) {
19980
+ return stream.aggregates.reduce((acc, entry) => {
19981
+ const aggregate = entry[1];
19982
+ return combineNumericAggregates(aggregate, acc);
19983
+ }, getZeroINumericSet());
19984
+ }
19985
+ function reduceNumericSetStreamAggregates(stream, numericSetKey) {
19986
+ var _a;
19987
+ return (_a = stream.aggregates.reduce((acc, entry) => {
19988
+ const aggregate = entry[1];
19989
+ return combineNumericSetAggregates(aggregate, acc);
19990
+ }, {})[numericSetKey]) == null ? void 0 : _a.value;
19991
+ }
19992
+ function combineNumericAggregates(e1, e2) {
19993
+ return {
19994
+ min: Math.min(e1.min, e2.min),
19995
+ max: Math.max(e1.max, e2.max),
19996
+ sum: e1.sum + e2.sum,
19997
+ count: e1.count + e2.count,
19998
+ sumOfSquares: e1.sumOfSquares + e2.sumOfSquares
19999
+ };
20000
+ }
20001
+ function combineNumericSetAggregates(e1, e2) {
20002
+ return Object.keys(e1).reduce((acc, key) => {
20003
+ var _a, _b;
20004
+ return __spreadProps(__spreadValues({}, acc), {
20005
+ [key]: {
20006
+ value: combineNumericAggregates(e1[key].value, (_b = (_a = e2[key]) == null ? void 0 : _a.value) != null ? _b : getZeroINumericSet()),
20007
+ unit: e1[key].unit
20008
+ }
20009
+ });
20010
+ }, {});
20011
+ }
19935
20012
  function stringToArrayBuffer(input) {
19936
20013
  return Uint8Array.from(atob(input), (_) => _.charCodeAt(0));
19937
20014
  }
@@ -20120,4 +20197,4 @@ if (moduleName) {
20120
20197
  var IRtcSendConfiguration = dist.exports.IRtcSendConfiguration;
20121
20198
  var IRtcStreamMessage = dist.exports.IRtcStreamMessage;
20122
20199
  var IRtcStreamPayload = dist.exports.IRtcStreamPayload;
20123
- export { App, AudioPlayer, Authentication, BinaryRequestDataChannel, CaptureStream, DataChannel, Device, Fleet, IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, KeyValue, Manipulator, PeerDevice, SessionType, TextRequestDataChannel, accessLevels, administrator, aggregateLevels, annotationTypes, eventTypes, healthStatuses, interventionTypes, operator, severities, videoMimeTypes, viewer };
20200
+ export { App, AudioPlayer, Authentication, BinaryRequestDataChannel, CaptureStream, DataChannel, Device, Fleet, IRtcSendConfiguration, IRtcStreamMessage, IRtcStreamPayload, KeyValue, Manipulator, PeerDevice, SessionType, TextRequestDataChannel, accessLevels, administrator, aggregateFunctionMap, aggregateLevels, annotationTypes, combineNumericAggregates, combineNumericSetAggregates, eventTypes, getAverage, getCount, getMax, getMin, getStandardDeviation, getSum, getVariance, getZeroINumericSet, healthStatuses, interventionTypes, operator, reduceNumericSetStreamAggregates, reduceNumericStreamAggregates, severities, videoMimeTypes, viewer };