@formant/data-sdk 1.14.0 → 1.15.0
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.cjs.js +2 -2
- package/dist/data-sdk.cjs.js.map +1 -1
- package/dist/data-sdk.es.js +85 -61
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +32 -8
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/devices/Device.d.ts +15 -1
- package/package.json +1 -1
package/dist/data-sdk.es6.js
CHANGED
|
@@ -23936,22 +23936,29 @@ class Device extends BaseDevice {
|
|
|
23936
23936
|
}
|
|
23937
23937
|
)).json()).items;
|
|
23938
23938
|
}
|
|
23939
|
-
|
|
23940
|
-
|
|
23939
|
+
/**
|
|
23940
|
+
* Asynchronously retrieves the configuration document for a device.
|
|
23941
|
+
*
|
|
23942
|
+
* @param {boolean} getDesiredConfigurationVersion - Whether to retrieve the desired configuration version
|
|
23943
|
+
* @returns {Promise<ConfigurationDocument>} A promise that resolves to the configuration document
|
|
23944
|
+
* @throws {Error} Throws an error if the device has no configuration or has never been turned on
|
|
23945
|
+
*/
|
|
23946
|
+
async getConfiguration(t = !1) {
|
|
23947
|
+
let n = await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}`, {
|
|
23941
23948
|
method: "GET",
|
|
23942
23949
|
headers: {
|
|
23943
23950
|
"Content-Type": "application/json",
|
|
23944
23951
|
Authorization: "Bearer " + Authentication.token
|
|
23945
23952
|
}
|
|
23946
23953
|
});
|
|
23947
|
-
const
|
|
23948
|
-
if (!
|
|
23954
|
+
const r = await n.json();
|
|
23955
|
+
if (!r.state.reportedConfiguration)
|
|
23949
23956
|
throw new Error(
|
|
23950
23957
|
"Device has no configuration, has it ever been turned on?"
|
|
23951
23958
|
);
|
|
23952
|
-
const
|
|
23953
|
-
return
|
|
23954
|
-
`${FORMANT_API_URL}/v1/admin/devices/${this.id}/configurations/${
|
|
23959
|
+
const o = t ? r.desiredConfigurationVersion : r.state.reportedConfiguration.version;
|
|
23960
|
+
return n = await fetch(
|
|
23961
|
+
`${FORMANT_API_URL}/v1/admin/devices/${this.id}/configurations/${o}`,
|
|
23955
23962
|
{
|
|
23956
23963
|
method: "GET",
|
|
23957
23964
|
headers: {
|
|
@@ -23959,7 +23966,24 @@ class Device extends BaseDevice {
|
|
|
23959
23966
|
Authorization: "Bearer " + Authentication.token
|
|
23960
23967
|
}
|
|
23961
23968
|
}
|
|
23962
|
-
), (await
|
|
23969
|
+
), (await n.json()).document;
|
|
23970
|
+
}
|
|
23971
|
+
/**
|
|
23972
|
+
* Asynchronously retrieves the device's agent version string
|
|
23973
|
+
*
|
|
23974
|
+
* @returns {Promise<string | undefined | null>} A promise that resolves to the agent version
|
|
23975
|
+
* @throws {Error} Throws an error if the device info cannot be fetched
|
|
23976
|
+
*/
|
|
23977
|
+
async getAgentVersion() {
|
|
23978
|
+
var r;
|
|
23979
|
+
const n = await (await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}`, {
|
|
23980
|
+
method: "GET",
|
|
23981
|
+
headers: {
|
|
23982
|
+
"Content-Type": "application/json",
|
|
23983
|
+
Authorization: "Bearer " + Authentication.token
|
|
23984
|
+
}
|
|
23985
|
+
})).json();
|
|
23986
|
+
return (r = n == null ? void 0 : n.state) == null ? void 0 : r.agentVersion;
|
|
23963
23987
|
}
|
|
23964
23988
|
async getFileUrl(t) {
|
|
23965
23989
|
return (await (await fetch(`${FORMANT_API_URL}/v1/admin/files/query`, {
|