@formant/data-sdk 1.14.0 → 1.14.1
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 +15 -8
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +15 -8
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/devices/Device.d.ts +8 -1
- package/package.json +1 -1
package/dist/data-sdk.es.js
CHANGED
|
@@ -1590,22 +1590,29 @@ class S extends Y {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
)).json()).items;
|
|
1592
1592
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1593
|
+
/**
|
|
1594
|
+
* Asynchronously retrieves the configuration document for a device.
|
|
1595
|
+
*
|
|
1596
|
+
* @param {boolean} getDesiredConfigurationVersion - Whether to retrieve the desired configuration version
|
|
1597
|
+
* @returns {Promise<ConfigurationDocument>} A promise that resolves to the configuration document
|
|
1598
|
+
* @throws {Error} Throws an error if the device has no configuration or has never been turned on
|
|
1599
|
+
*/
|
|
1600
|
+
async getConfiguration(e = !1) {
|
|
1601
|
+
let t = await fetch(`${h}/v1/admin/devices/${this.id}`, {
|
|
1595
1602
|
method: "GET",
|
|
1596
1603
|
headers: {
|
|
1597
1604
|
"Content-Type": "application/json",
|
|
1598
1605
|
Authorization: "Bearer " + r.token
|
|
1599
1606
|
}
|
|
1600
1607
|
});
|
|
1601
|
-
const
|
|
1602
|
-
if (!
|
|
1608
|
+
const n = await t.json();
|
|
1609
|
+
if (!n.state.reportedConfiguration)
|
|
1603
1610
|
throw new Error(
|
|
1604
1611
|
"Device has no configuration, has it ever been turned on?"
|
|
1605
1612
|
);
|
|
1606
|
-
const
|
|
1607
|
-
return
|
|
1608
|
-
`${h}/v1/admin/devices/${this.id}/configurations/${
|
|
1613
|
+
const i = e ? n.desiredConfigurationVersion : n.state.reportedConfiguration.version;
|
|
1614
|
+
return t = await fetch(
|
|
1615
|
+
`${h}/v1/admin/devices/${this.id}/configurations/${i}`,
|
|
1609
1616
|
{
|
|
1610
1617
|
method: "GET",
|
|
1611
1618
|
headers: {
|
|
@@ -1613,7 +1620,7 @@ class S extends Y {
|
|
|
1613
1620
|
Authorization: "Bearer " + r.token
|
|
1614
1621
|
}
|
|
1615
1622
|
}
|
|
1616
|
-
), (await
|
|
1623
|
+
), (await t.json()).document;
|
|
1617
1624
|
}
|
|
1618
1625
|
async getFileUrl(e) {
|
|
1619
1626
|
return (await (await fetch(`${h}/v1/admin/files/query`, {
|