@tuya-miniapp/ark-extension-virtual-device 1.1.26-beta-2 → 1.1.26-beta-3
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 +14 -7
- package/package.json +1 -1
package/dist/worker/index.js
CHANGED
|
@@ -173003,7 +173003,7 @@ var require_package = __commonJS({
|
|
|
173003
173003
|
"package.json"(exports2, module2) {
|
|
173004
173004
|
module2.exports = {
|
|
173005
173005
|
name: "@tuya-miniapp/ark-extension-virtual-device",
|
|
173006
|
-
version: "1.1.26-beta-
|
|
173006
|
+
version: "1.1.26-beta-2",
|
|
173007
173007
|
files: [
|
|
173008
173008
|
"manifest.json",
|
|
173009
173009
|
"package.json",
|
|
@@ -235485,6 +235485,19 @@ var publishDps = async ({ deviceId, dps }) => {
|
|
|
235485
235485
|
}
|
|
235486
235486
|
const devId = deviceId || await services_default.getProjectDeviceId();
|
|
235487
235487
|
if (devId) {
|
|
235488
|
+
const devInfo = await getDeviceInfo({ deviceId: devId });
|
|
235489
|
+
const { schema } = devInfo?.result || {};
|
|
235490
|
+
if (schema) {
|
|
235491
|
+
JSON.parse(schema).map((item) => {
|
|
235492
|
+
const { id, code, property, type: oType } = item;
|
|
235493
|
+
const { type } = property || {};
|
|
235494
|
+
if (Object.keys(dps).includes(`${id}`) && (type === "raw" || oType === "raw") && isHexString(dps[id])) {
|
|
235495
|
+
const b = Buffer.from(dps[id], "utf8");
|
|
235496
|
+
dps[id] = b.toString("base64");
|
|
235497
|
+
}
|
|
235498
|
+
});
|
|
235499
|
+
}
|
|
235500
|
+
console.log("publish", devId, dps);
|
|
235488
235501
|
const result = await apiRequestByAtop({
|
|
235489
235502
|
api: "tuya.m.device.dp.publish",
|
|
235490
235503
|
version: "2.0",
|
|
@@ -239511,12 +239524,6 @@ async function getDeviceInfo2(params) {
|
|
|
239511
239524
|
}
|
|
239512
239525
|
async function publishDps2(params) {
|
|
239513
239526
|
const { deviceId, dps } = params;
|
|
239514
|
-
const devInfo = await getDeviceInfo2({ deviceId });
|
|
239515
|
-
const { schema } = devInfo.data || {};
|
|
239516
|
-
schema.map((item) => {
|
|
239517
|
-
const { id, code, property, type: oType } = item;
|
|
239518
|
-
const { type } = property || {};
|
|
239519
|
-
});
|
|
239520
239527
|
try {
|
|
239521
239528
|
await publishDps({ deviceId, dps });
|
|
239522
239529
|
ark.runtime.sendMessage(JSON.stringify({
|