@formant/data-sdk 1.82.0 → 1.82.9
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 +1 -1
- package/dist/data-sdk.cjs.js.map +1 -1
- package/dist/data-sdk.es.js +8 -8
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +8 -8
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/devices/Device.d.ts +4 -2
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -25631,11 +25631,14 @@ class Device extends BaseDevice {
|
|
|
25631
25631
|
/**
|
|
25632
25632
|
* Asynchronously retrieves the configuration document for a device.
|
|
25633
25633
|
*
|
|
25634
|
-
* @param {boolean} getDesiredConfigurationVersion - Whether to retrieve the desired configuration version
|
|
25634
|
+
* @param {boolean} getDesiredConfigurationVersion - Whether to retrieve the desired configuration version.
|
|
25635
|
+
* If false, uses reportedConfiguration.version, falling back to desiredConfigurationVersion
|
|
25636
|
+
* if the device has no reportedConfiguration (e.g., agent never connected).
|
|
25635
25637
|
* @returns {Promise<ConfigurationDocument>} A promise that resolves to the configuration document
|
|
25636
|
-
* @throws {Error} Throws an error if the device has no configuration
|
|
25638
|
+
* @throws {Error} Throws an error if the device has no configuration version
|
|
25637
25639
|
*/
|
|
25638
25640
|
async getConfiguration(n = !1) {
|
|
25641
|
+
var l, u, d;
|
|
25639
25642
|
let r = await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}`, {
|
|
25640
25643
|
method: "GET",
|
|
25641
25644
|
headers: {
|
|
@@ -25643,12 +25646,9 @@ class Device extends BaseDevice {
|
|
|
25643
25646
|
Authorization: "Bearer " + Authentication.token
|
|
25644
25647
|
}
|
|
25645
25648
|
});
|
|
25646
|
-
const o = await r.json();
|
|
25647
|
-
if (!
|
|
25648
|
-
throw new Error(
|
|
25649
|
-
"Device has no configuration, has it ever been turned on?"
|
|
25650
|
-
);
|
|
25651
|
-
const s = n ? o.desiredConfigurationVersion : o.state.reportedConfiguration.version;
|
|
25649
|
+
const o = await r.json(), s = n ? o.desiredConfigurationVersion : (d = (u = (l = o.state) == null ? void 0 : l.reportedConfiguration) == null ? void 0 : u.version) != null ? d : o.desiredConfigurationVersion;
|
|
25650
|
+
if (!s)
|
|
25651
|
+
throw new Error("Device has no configuration version");
|
|
25652
25652
|
return r = await fetch(
|
|
25653
25653
|
`${FORMANT_API_URL}/v1/admin/devices/${this.id}/configurations/${s}`,
|
|
25654
25654
|
{
|