@tuya-miniapp/ark-extension-virtual-device 1.8.8-beta-2 → 1.8.8-beta-4

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.
@@ -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.8-beta-1",
220755
+ version: "1.8.8-beta-3",
220756
220756
  license: "MIT",
220757
220757
  files: [
220758
220758
  "manifest.json",
@@ -262798,7 +262798,22 @@ var getDeviceInfo = async (body) => {
262798
262798
  productIds: [productId]
262799
262799
  });
262800
262800
  if (productResponse.result instanceof Array && productResponse.result.length > 0) {
262801
- const product = productResponse.result[0];
262801
+ const product = productResponse?.result?.[0];
262802
+ try {
262803
+ const { dps } = response?.result;
262804
+ const { schema } = product.schemaInfo;
262805
+ const oDps = { ...dps };
262806
+ JSON.parse(schema).map((item) => {
262807
+ const { id, type, property } = item;
262808
+ if (Object.keys(oDps).includes(`${id}`) && type === "raw") {
262809
+ const b2 = Buffer.from(oDps[id], "base64");
262810
+ oDps[id] = b2.toString("hex");
262811
+ }
262812
+ });
262813
+ response.result.dps = oDps;
262814
+ } catch (error) {
262815
+ console.log("dps parse error", error);
262816
+ }
262802
262817
  groupInfoList[body?.deviceId] = {
262803
262818
  result: {
262804
262819
  ...response?.result,
@@ -264299,6 +264314,20 @@ async function getGroupInfo(params) {
264299
264314
  const { deviceList = [] } = glist?.data;
264300
264315
  result.deviceList = deviceList;
264301
264316
  }
264317
+ try {
264318
+ const { schema, dps } = groupInfo;
264319
+ const oDps = { ...dps };
264320
+ schema.map((item) => {
264321
+ const { id, type, property } = item;
264322
+ if (Object.keys(oDps).includes(`${id}`) && type === "raw") {
264323
+ const b2 = Buffer.from(oDps[id], "base64");
264324
+ oDps[id] = b2.toString("hex");
264325
+ }
264326
+ });
264327
+ groupInfo.dps = oDps;
264328
+ } catch (error) {
264329
+ console.log("dps parse error", error);
264330
+ }
264302
264331
  }
264303
264332
  cachedGroups[groupId] = { ...result };
264304
264333
  delete result["devId"];
@@ -264399,6 +264428,14 @@ async function publishGroupDps2(params) {
264399
264428
  }
264400
264429
  }
264401
264430
  async function publishGroupDpCodes(params) {
264431
+ const dpCodes = params.dpCodes;
264432
+ if (typeof dpCodes === "object") {
264433
+ const isAllDpId = Object.keys(dpCodes).every((key) => /^\d+$/.test(key));
264434
+ if (isAllDpId) {
264435
+ params.dps = dpCodes;
264436
+ delete params.dpCodes;
264437
+ }
264438
+ }
264402
264439
  const { groupId } = params;
264403
264440
  if (!groupId) {
264404
264441
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/ark-extension-virtual-device",
3
- "version": "1.8.8-beta-2",
3
+ "version": "1.8.8-beta-4",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "manifest.json",