@formant/data-sdk 0.0.97 → 0.0.99
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 +35 -17
- package/dist/data-sdk.umd.js +2 -2
- package/dist/types/data-sdk/src/Fleet.d.ts +4 -2
- package/dist/types/data-sdk/src/model/IDataAggregate.d.ts +7 -0
- package/dist/types/data-sdk/src/model/INumericAggregate.d.ts +7 -0
- package/dist/types/data-sdk/src/model/INumericSetAggregateMap.d.ts +5 -0
- package/dist/types/data-sdk/src/model/IStreamAggregateData.d.ts +11 -0
- package/dist/types/data-sdk/src/model/IStreamAggregateTypeMap.d.ts +11 -0
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -18334,6 +18334,12 @@ Found: ${e2.toString().split("\n")[0]}
|
|
|
18334
18334
|
}]);
|
|
18335
18335
|
});
|
|
18336
18336
|
})(dist);
|
|
18337
|
+
function defined(value, errorMessage) {
|
|
18338
|
+
if (value !== void 0) {
|
|
18339
|
+
return value;
|
|
18340
|
+
}
|
|
18341
|
+
throw new Error(errorMessage || "Value is undefined");
|
|
18342
|
+
}
|
|
18337
18343
|
let FORMANT_API_URL = "https://api.formant.io";
|
|
18338
18344
|
if (typeof window !== "undefined") {
|
|
18339
18345
|
FORMANT_API_URL = window.FORMANT_API_URL || FORMANT_API_URL;
|
|
@@ -18350,15 +18356,6 @@ const envStage = urlParams$1.get("formant_stage");
|
|
|
18350
18356
|
if (envStage) {
|
|
18351
18357
|
FORMANT_API_URL = "https://api-stage.formant.io";
|
|
18352
18358
|
}
|
|
18353
|
-
function delay(ms) {
|
|
18354
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
18355
|
-
}
|
|
18356
|
-
function defined(value, errorMessage) {
|
|
18357
|
-
if (value !== void 0) {
|
|
18358
|
-
return value;
|
|
18359
|
-
}
|
|
18360
|
-
throw new Error(errorMessage || "Value is undefined");
|
|
18361
|
-
}
|
|
18362
18359
|
class App {
|
|
18363
18360
|
static sendAppMessage(message) {
|
|
18364
18361
|
window.parent.postMessage(message, "*");
|
|
@@ -18597,6 +18594,9 @@ __publicField(Authentication, "currentOrganization");
|
|
|
18597
18594
|
__publicField(Authentication, "isShareToken", false);
|
|
18598
18595
|
__publicField(Authentication, "defaultDeviceId");
|
|
18599
18596
|
__publicField(Authentication, "waitingForAuth", []);
|
|
18597
|
+
function delay(ms) {
|
|
18598
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
18599
|
+
}
|
|
18600
18600
|
class DataChannel {
|
|
18601
18601
|
constructor(dataChannel) {
|
|
18602
18602
|
__publicField(this, "ready", false);
|
|
@@ -18843,19 +18843,21 @@ class BinaryRequestDataChannel extends RequestDataChannel {
|
|
|
18843
18843
|
if (success) {
|
|
18844
18844
|
return payload;
|
|
18845
18845
|
} else {
|
|
18846
|
-
|
|
18846
|
+
console.error({
|
|
18847
18847
|
name: "AdapterError",
|
|
18848
18848
|
message: this.decoder.decode(payload)
|
|
18849
|
-
};
|
|
18849
|
+
});
|
|
18850
|
+
throw new Error("Binary request datachannel adapter error");
|
|
18850
18851
|
}
|
|
18851
18852
|
}
|
|
18852
18853
|
}
|
|
18853
18854
|
}
|
|
18854
18855
|
requestIdToResponseMap.delete(id);
|
|
18855
|
-
|
|
18856
|
+
console.error({
|
|
18856
18857
|
name: "TimeoutError",
|
|
18857
18858
|
message: `Request timed out after ${timeout / 1e3} seconds`
|
|
18858
|
-
};
|
|
18859
|
+
});
|
|
18860
|
+
throw new Error("Binary request data channel request timed out");
|
|
18859
18861
|
}
|
|
18860
18862
|
}
|
|
18861
18863
|
class TextRequestDataChannel extends RequestDataChannel {
|
|
@@ -18905,19 +18907,21 @@ class TextRequestDataChannel extends RequestDataChannel {
|
|
|
18905
18907
|
return data2;
|
|
18906
18908
|
}
|
|
18907
18909
|
if (error) {
|
|
18908
|
-
|
|
18910
|
+
console.error({
|
|
18909
18911
|
name: "AdapterError",
|
|
18910
18912
|
message: error
|
|
18911
|
-
};
|
|
18913
|
+
});
|
|
18914
|
+
throw new Error("Text request datachannel adapter error");
|
|
18912
18915
|
}
|
|
18913
18916
|
}
|
|
18914
18917
|
}
|
|
18915
18918
|
}
|
|
18916
18919
|
requestIdToResponseMap.delete(id);
|
|
18917
|
-
|
|
18920
|
+
console.error({
|
|
18918
18921
|
name: "TimeoutError",
|
|
18919
18922
|
message: `Request timed out after ${timeout / 1e3} seconds`
|
|
18920
|
-
};
|
|
18923
|
+
});
|
|
18924
|
+
throw new Error("Text request datachannel request timed out");
|
|
18921
18925
|
}
|
|
18922
18926
|
}
|
|
18923
18927
|
const SessionType = {
|
|
@@ -19733,6 +19737,20 @@ const _Fleet = class {
|
|
|
19733
19737
|
});
|
|
19734
19738
|
return (await data.json()).items;
|
|
19735
19739
|
}
|
|
19740
|
+
static async aggregateTelemetry(query) {
|
|
19741
|
+
if (!Authentication.token) {
|
|
19742
|
+
throw new Error("Not authenticated");
|
|
19743
|
+
}
|
|
19744
|
+
const data = await fetch(`${FORMANT_API_URL}/v1/queries/queries`, {
|
|
19745
|
+
method: "POST",
|
|
19746
|
+
body: JSON.stringify(query),
|
|
19747
|
+
headers: {
|
|
19748
|
+
"Content-Type": "application/json",
|
|
19749
|
+
Authorization: "Bearer " + Authentication.token
|
|
19750
|
+
}
|
|
19751
|
+
});
|
|
19752
|
+
return (await data.json()).aggregates;
|
|
19753
|
+
}
|
|
19736
19754
|
static async queryEvents(query) {
|
|
19737
19755
|
if (!Authentication.token) {
|
|
19738
19756
|
throw new Error("Not authenticated");
|