@formant/data-sdk 0.0.104 → 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;
@@ -18368,6 +18371,24 @@ class App {
18368
18371
  const moduleName2 = urlParams2.get("module");
18369
18372
  return moduleName2;
18370
18373
  }
18374
+ static async getCurrentModuleConfiguration() {
18375
+ let urlParams2 = new URLSearchParams("");
18376
+ if (typeof window !== "undefined") {
18377
+ urlParams2 = new URLSearchParams(window.location.search);
18378
+ }
18379
+ const configurationId = urlParams2.get("configuration");
18380
+ if (configurationId === null || configurationId.trim() === "") {
18381
+ return void 0;
18382
+ }
18383
+ const response = await fetch(`${FORMANT_API_URL}/v1/admin/module-configurations/` + configurationId, {
18384
+ headers: {
18385
+ "Content-Type": "application/json",
18386
+ Authorization: "Bearer " + Authentication.token
18387
+ }
18388
+ });
18389
+ const moduleConfiguration = await response.json();
18390
+ return moduleConfiguration.configuration;
18391
+ }
18371
18392
  static isModule() {
18372
18393
  return this.getCurrentModuleContext() !== null;
18373
18394
  }
@@ -18981,7 +19002,7 @@ class Device {
18981
19002
  const result = await fetch(`${FORMANT_API_URL}/v1/admin/files/query`, {
18982
19003
  method: "POST",
18983
19004
  body: JSON.stringify({
18984
- fileId: [fileId]
19005
+ fileIds: [fileId]
18985
19006
  }),
18986
19007
  headers: {
18987
19008
  "Content-Type": "application/json",
@@ -19914,6 +19935,80 @@ class KeyValue {
19914
19935
  }
19915
19936
  }
19916
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
+ }
19917
20012
  function stringToArrayBuffer(input) {
19918
20013
  return Uint8Array.from(atob(input), (_) => _.charCodeAt(0));
19919
20014
  }
@@ -20102,4 +20197,4 @@ if (moduleName) {
20102
20197
  var IRtcSendConfiguration = dist.exports.IRtcSendConfiguration;
20103
20198
  var IRtcStreamMessage = dist.exports.IRtcStreamMessage;
20104
20199
  var IRtcStreamPayload = dist.exports.IRtcStreamPayload;
20105
- 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 };