@tuya-miniapp/ark-extension-virtual-device 1.8.2-beta-7 → 1.8.2-beta-8
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/worker/index.js +4 -64
- package/package.json +1 -1
package/dist/worker/index.js
CHANGED
|
@@ -220752,7 +220752,7 @@ var require_package2 = __commonJS({
|
|
|
220752
220752
|
"package.json"(exports, module2) {
|
|
220753
220753
|
module2.exports = {
|
|
220754
220754
|
name: "@tuya-miniapp/ark-extension-virtual-device",
|
|
220755
|
-
version: "1.8.2-beta-
|
|
220755
|
+
version: "1.8.2-beta-7",
|
|
220756
220756
|
license: "MIT",
|
|
220757
220757
|
files: [
|
|
220758
220758
|
"manifest.json",
|
|
@@ -280388,73 +280388,13 @@ async function setDeviceProperty(params) {
|
|
|
280388
280388
|
}
|
|
280389
280389
|
async function getDeviceListByDevIds(params) {
|
|
280390
280390
|
const { deviceIds } = params;
|
|
280391
|
-
const
|
|
280392
|
-
const homeAllDeviceResponse = await apiRequestByAtop({
|
|
280393
|
-
api: "tuya.m.my.group.device.list",
|
|
280394
|
-
version: "2.1",
|
|
280395
|
-
params: {
|
|
280396
|
-
gid: homeId
|
|
280397
|
-
},
|
|
280398
|
-
meta: {
|
|
280399
|
-
gid: homeId
|
|
280400
|
-
}
|
|
280401
|
-
});
|
|
280402
|
-
const { result: allDevices = [] } = homeAllDeviceResponse || {};
|
|
280403
|
-
const productIds = [];
|
|
280404
|
-
allDevices.map((item) => {
|
|
280405
|
-
if (!productIds.includes(item.productId)) {
|
|
280406
|
-
productIds.push(item.productId);
|
|
280407
|
-
}
|
|
280408
|
-
});
|
|
280409
|
-
const { result: productInfos } = await apiRequestByAtop({
|
|
280410
|
-
api: "tuya.m.device.ref.info.list",
|
|
280411
|
-
version: "3.0",
|
|
280412
|
-
params: {
|
|
280413
|
-
productIds
|
|
280414
|
-
}
|
|
280415
|
-
});
|
|
280416
|
-
const tempList = allDevices.filter((item) => deviceIds.includes(item.devId));
|
|
280417
|
-
const resetList = [];
|
|
280418
|
-
deviceIds.map((devId) => {
|
|
280419
|
-
const d2 = tempList.find((item) => item.devId === devId);
|
|
280420
|
-
if (!d2) {
|
|
280421
|
-
resetList.push(devId);
|
|
280422
|
-
}
|
|
280423
|
-
});
|
|
280424
|
-
const promises = resetList.map((devId) => {
|
|
280391
|
+
const promises = deviceIds.map((devId) => {
|
|
280425
280392
|
return getDeviceInfo2({ deviceId: devId });
|
|
280426
280393
|
});
|
|
280427
280394
|
const list = await Promise.all(promises);
|
|
280428
|
-
const
|
|
280395
|
+
const result = list.map((item) => {
|
|
280429
280396
|
return item.data;
|
|
280430
|
-
});
|
|
280431
|
-
const devices = [...tempList, ...restList].filter((item) => !!item);
|
|
280432
|
-
const result = devices.map((item) => {
|
|
280433
|
-
const { productId, dataPointInfo, iconUrl } = item;
|
|
280434
|
-
const productInfo = productInfos.find((product) => product.id === productId);
|
|
280435
|
-
const {
|
|
280436
|
-
schemaInfo: { schema },
|
|
280437
|
-
attribute,
|
|
280438
|
-
capability,
|
|
280439
|
-
category,
|
|
280440
|
-
supportGroup,
|
|
280441
|
-
otaInfo
|
|
280442
|
-
} = productInfo;
|
|
280443
|
-
if (productInfo) {
|
|
280444
|
-
item.productInfo = productInfo;
|
|
280445
|
-
}
|
|
280446
|
-
return {
|
|
280447
|
-
...item,
|
|
280448
|
-
schema: JSON.parse(schema),
|
|
280449
|
-
...dataPointInfo,
|
|
280450
|
-
icon: iconUrl,
|
|
280451
|
-
isSupportGroup: supportGroup,
|
|
280452
|
-
attribute,
|
|
280453
|
-
capability,
|
|
280454
|
-
category,
|
|
280455
|
-
isSupportOTA: !!otaInfo
|
|
280456
|
-
};
|
|
280457
|
-
});
|
|
280397
|
+
}).filter((item) => !!item);
|
|
280458
280398
|
return {
|
|
280459
280399
|
data: { deviceInfos: result },
|
|
280460
280400
|
errorCode: 0,
|