@tuya-miniapp/ark-extension-virtual-device 1.8.5 → 1.8.6-beta-2
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 +661 -4
- 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.
|
|
220755
|
+
version: "1.8.6-beta-1",
|
|
220756
220756
|
license: "MIT",
|
|
220757
220757
|
files: [
|
|
220758
220758
|
"manifest.json",
|
|
@@ -262484,7 +262484,6 @@ var setDebugMode = async ({ mode }) => {
|
|
|
262484
262484
|
};
|
|
262485
262485
|
var setCompilationParams = async (p2) => {
|
|
262486
262486
|
const { page, params } = await ark.project.getCompilationParams() || {};
|
|
262487
|
-
const mode = await getDebugMode();
|
|
262488
262487
|
let debugParams = parseSearchParams(params);
|
|
262489
262488
|
const realParams = {};
|
|
262490
262489
|
Object.keys(debugParams).map((key) => {
|
|
@@ -262833,6 +262832,8 @@ var getDeviceInfo = async (body) => {
|
|
|
262833
262832
|
devId: body?.deviceId
|
|
262834
262833
|
}
|
|
262835
262834
|
});
|
|
262835
|
+
console.log("devInfo>>>>>", JSON.stringify(devInfo));
|
|
262836
|
+
console.log("devINfo2>>>", JSON.stringify(devInfo32));
|
|
262836
262837
|
if (!devInfo.success && !devInfo.result) {
|
|
262837
262838
|
return null;
|
|
262838
262839
|
}
|
|
@@ -262844,6 +262845,7 @@ var getDeviceInfo = async (body) => {
|
|
|
262844
262845
|
devInfo.result.parentId = devInfo32.result?.deviceTopo.parentDevId;
|
|
262845
262846
|
devInfo.result.nodeId = devInfo32.result?.deviceTopo.nodeId;
|
|
262846
262847
|
devInfo.result.devAttribute = devInfo32.result?.devAttribute;
|
|
262848
|
+
devInfo.result.extModuleType = -1;
|
|
262847
262849
|
if (Object.hasOwn(devInfo32.result, "cloudOnline")) {
|
|
262848
262850
|
devInfo.result.cloudOnline = devInfo32.result?.cloudOnline;
|
|
262849
262851
|
}
|
|
@@ -263974,6 +263976,7 @@ var MqttClientManager = class _MqttClientManager {
|
|
|
263974
263976
|
}
|
|
263975
263977
|
});
|
|
263976
263978
|
});
|
|
263979
|
+
console.log("mqtt clientId", clientId);
|
|
263977
263980
|
client.on("error", (err) => {
|
|
263978
263981
|
console.log("\u8FDE\u63A5\u5931\u8D25", err.message);
|
|
263979
263982
|
viewLog(`[MQTT] @i18n(connectFail) ${err.message}`);
|
|
@@ -281874,6 +281877,14 @@ ark.miniapp.addPluginMethod(
|
|
|
281874
281877
|
// worker/api/TUNIDeviceDetailManager.ts
|
|
281875
281878
|
var import_TYUniCode11 = __toESM(require_dist());
|
|
281876
281879
|
var import_crypto7 = require("crypto");
|
|
281880
|
+
|
|
281881
|
+
// worker/utils/getParams.ts
|
|
281882
|
+
async function getParams() {
|
|
281883
|
+
const { params } = await ark.project.getCompilationParams() || {};
|
|
281884
|
+
return parseSearchParams(params || "{}");
|
|
281885
|
+
}
|
|
281886
|
+
|
|
281887
|
+
// worker/api/TUNIDeviceDetailManager.ts
|
|
281877
281888
|
async function addTimer(params) {
|
|
281878
281889
|
const {
|
|
281879
281890
|
deviceId,
|
|
@@ -282444,6 +282455,55 @@ async function getRemoteRebootTimers(params) {
|
|
|
282444
282455
|
errorMsg: import_TYUniCode11.TYUniPluginError.SUCCESS.des
|
|
282445
282456
|
};
|
|
282446
282457
|
}
|
|
282458
|
+
async function dispatchDataResult(params) {
|
|
282459
|
+
const { success, fail, complete, ...rest } = params;
|
|
282460
|
+
ark.miniapp.emitPluginEvent({
|
|
282461
|
+
name: "TUNIDeviceDetailManager.dispatchDataResult",
|
|
282462
|
+
data: {
|
|
282463
|
+
...rest
|
|
282464
|
+
}
|
|
282465
|
+
});
|
|
282466
|
+
return {
|
|
282467
|
+
data: true,
|
|
282468
|
+
errorCode: 0,
|
|
282469
|
+
errorMsg: import_TYUniCode11.TYUniPluginError.SUCCESS.des
|
|
282470
|
+
};
|
|
282471
|
+
}
|
|
282472
|
+
async function getSubFunctionExtShowData(params) {
|
|
282473
|
+
const { id, data } = params;
|
|
282474
|
+
const { deviceId } = await getParams();
|
|
282475
|
+
switch (id) {
|
|
282476
|
+
case "connect_cloud_activation":
|
|
282477
|
+
return {
|
|
282478
|
+
data: {
|
|
282479
|
+
data: {
|
|
282480
|
+
extModuleType: -1,
|
|
282481
|
+
deviceId
|
|
282482
|
+
}
|
|
282483
|
+
},
|
|
282484
|
+
errorCode: 0,
|
|
282485
|
+
errorMsg: import_TYUniCode11.TYUniPluginError.SUCCESS.des
|
|
282486
|
+
};
|
|
282487
|
+
case "location_manage":
|
|
282488
|
+
return {
|
|
282489
|
+
data: {
|
|
282490
|
+
data: {
|
|
282491
|
+
deviceLocation: 0,
|
|
282492
|
+
deviceId
|
|
282493
|
+
}
|
|
282494
|
+
},
|
|
282495
|
+
errorCode: 0,
|
|
282496
|
+
errorMsg: import_TYUniCode11.TYUniPluginError.SUCCESS.des
|
|
282497
|
+
};
|
|
282498
|
+
}
|
|
282499
|
+
return {
|
|
282500
|
+
data: {
|
|
282501
|
+
data: {}
|
|
282502
|
+
},
|
|
282503
|
+
errorCode: 0,
|
|
282504
|
+
errorMsg: import_TYUniCode11.TYUniPluginError.SUCCESS.des
|
|
282505
|
+
};
|
|
282506
|
+
}
|
|
282447
282507
|
ark.miniapp.addPluginMethod(
|
|
282448
282508
|
"TUNIDeviceDetailManager",
|
|
282449
282509
|
"removeShareDevice",
|
|
@@ -282510,6 +282570,16 @@ ark.miniapp.addPluginMethod(
|
|
|
282510
282570
|
"getRemoteRebootTimers1",
|
|
282511
282571
|
getRemoteRebootTimers
|
|
282512
282572
|
);
|
|
282573
|
+
ark.miniapp.addPluginMethod(
|
|
282574
|
+
"TUNIDeviceDetailManager",
|
|
282575
|
+
"dispatchDataResult",
|
|
282576
|
+
dispatchDataResult
|
|
282577
|
+
);
|
|
282578
|
+
ark.miniapp.addPluginMethod(
|
|
282579
|
+
"TUNIDeviceDetailManager",
|
|
282580
|
+
"getSubFunctionExtShowData",
|
|
282581
|
+
getSubFunctionExtShowData
|
|
282582
|
+
);
|
|
282513
282583
|
|
|
282514
282584
|
// worker/api/TUNIThingControlManager.ts
|
|
282515
282585
|
var import_TYUniCode12 = __toESM(require_dist());
|
|
@@ -282615,8 +282685,595 @@ ark.miniapp.addPluginMethod(
|
|
|
282615
282685
|
updateDeviceThingModelInfo
|
|
282616
282686
|
);
|
|
282617
282687
|
|
|
282618
|
-
// worker/api/
|
|
282688
|
+
// worker/api/TUNIAppInfoManager.ts
|
|
282619
282689
|
var import_TYUniCode13 = __toESM(require_dist());
|
|
282690
|
+
|
|
282691
|
+
// worker/utils/ngConfig.ts
|
|
282692
|
+
var defaultVersion = "6.0.0";
|
|
282693
|
+
var ngConfig_default = (appVersion = defaultVersion) => [
|
|
282694
|
+
{
|
|
282695
|
+
lastGmtModified: 0,
|
|
282696
|
+
lastVersion: 0,
|
|
282697
|
+
module: "tuyaclient:activator:EZBleFirstEnable",
|
|
282698
|
+
type: "ios",
|
|
282699
|
+
appVersion,
|
|
282700
|
+
lastId: ""
|
|
282701
|
+
},
|
|
282702
|
+
{
|
|
282703
|
+
lastGmtModified: 0,
|
|
282704
|
+
lastVersion: 0,
|
|
282705
|
+
module: "tuyaclient:activator:EZBleFirstEnable",
|
|
282706
|
+
type: "ios",
|
|
282707
|
+
appVersion,
|
|
282708
|
+
lastId: ""
|
|
282709
|
+
},
|
|
282710
|
+
{
|
|
282711
|
+
lastGmtModified: 0,
|
|
282712
|
+
lastVersion: 0,
|
|
282713
|
+
module: "tuyaclient:deviceBiz:group",
|
|
282714
|
+
type: "ios",
|
|
282715
|
+
appVersion,
|
|
282716
|
+
lastId: ""
|
|
282717
|
+
},
|
|
282718
|
+
{
|
|
282719
|
+
lastGmtModified: 0,
|
|
282720
|
+
lastVersion: 0,
|
|
282721
|
+
module: "tuyaclient:LoginSDK:ChangeBindSwitch",
|
|
282722
|
+
type: "ios",
|
|
282723
|
+
appVersion,
|
|
282724
|
+
lastId: ""
|
|
282725
|
+
},
|
|
282726
|
+
{
|
|
282727
|
+
lastGmtModified: 0,
|
|
282728
|
+
lastVersion: 0,
|
|
282729
|
+
module: "tuyaclient:Location:Frequency",
|
|
282730
|
+
type: "ios",
|
|
282731
|
+
appVersion,
|
|
282732
|
+
lastId: ""
|
|
282733
|
+
},
|
|
282734
|
+
{
|
|
282735
|
+
lastGmtModified: 0,
|
|
282736
|
+
lastVersion: 0,
|
|
282737
|
+
module: "tuyaclient:OSApp:ABTestConfig",
|
|
282738
|
+
type: "ios",
|
|
282739
|
+
appVersion,
|
|
282740
|
+
lastId: ""
|
|
282741
|
+
},
|
|
282742
|
+
{
|
|
282743
|
+
lastGmtModified: 0,
|
|
282744
|
+
lastVersion: 0,
|
|
282745
|
+
module: "tuyaclient:Location:UpdateReduce",
|
|
282746
|
+
type: "ios",
|
|
282747
|
+
appVersion,
|
|
282748
|
+
lastId: ""
|
|
282749
|
+
},
|
|
282750
|
+
{
|
|
282751
|
+
lastGmtModified: 0,
|
|
282752
|
+
lastVersion: 0,
|
|
282753
|
+
module: "tuyaclient:deviceBiz:deviceDetail",
|
|
282754
|
+
type: "ios",
|
|
282755
|
+
appVersion,
|
|
282756
|
+
lastId: ""
|
|
282757
|
+
},
|
|
282758
|
+
{
|
|
282759
|
+
lastGmtModified: 0,
|
|
282760
|
+
lastVersion: 0,
|
|
282761
|
+
module: "tuyaclient:hybrid:config",
|
|
282762
|
+
type: "ios",
|
|
282763
|
+
appVersion,
|
|
282764
|
+
lastId: ""
|
|
282765
|
+
},
|
|
282766
|
+
{
|
|
282767
|
+
lastGmtModified: 0,
|
|
282768
|
+
lastVersion: 0,
|
|
282769
|
+
module: "tuyaclient:miniApp:basicRule",
|
|
282770
|
+
type: "ios",
|
|
282771
|
+
appVersion,
|
|
282772
|
+
lastId: ""
|
|
282773
|
+
},
|
|
282774
|
+
{
|
|
282775
|
+
lastGmtModified: 0,
|
|
282776
|
+
lastVersion: 0,
|
|
282777
|
+
module: "tuyaclient:cubeBiz:config",
|
|
282778
|
+
type: "ios",
|
|
282779
|
+
appVersion,
|
|
282780
|
+
lastId: ""
|
|
282781
|
+
},
|
|
282782
|
+
{
|
|
282783
|
+
lastGmtModified: 0,
|
|
282784
|
+
lastVersion: 0,
|
|
282785
|
+
module: "tuyaclient:iap:iosDisable",
|
|
282786
|
+
type: "ios",
|
|
282787
|
+
appVersion,
|
|
282788
|
+
lastId: ""
|
|
282789
|
+
},
|
|
282790
|
+
{
|
|
282791
|
+
lastGmtModified: 0,
|
|
282792
|
+
lastVersion: 0,
|
|
282793
|
+
module: "tuyaclient:voiceBiz:thirdPartAuth",
|
|
282794
|
+
type: "ios",
|
|
282795
|
+
appVersion,
|
|
282796
|
+
lastId: ""
|
|
282797
|
+
},
|
|
282798
|
+
{
|
|
282799
|
+
lastGmtModified: 0,
|
|
282800
|
+
lastVersion: 0,
|
|
282801
|
+
module: "tuyaclient:tangram:tracker",
|
|
282802
|
+
type: "ios",
|
|
282803
|
+
appVersion,
|
|
282804
|
+
lastId: ""
|
|
282805
|
+
},
|
|
282806
|
+
{
|
|
282807
|
+
lastGmtModified: 0,
|
|
282808
|
+
lastVersion: 0,
|
|
282809
|
+
module: "tuyaclient:oem:config",
|
|
282810
|
+
type: "ios",
|
|
282811
|
+
appVersion,
|
|
282812
|
+
lastId: ""
|
|
282813
|
+
},
|
|
282814
|
+
{
|
|
282815
|
+
lastGmtModified: 0,
|
|
282816
|
+
lastVersion: 0,
|
|
282817
|
+
module: "tuyaclient:sdk:mqtt",
|
|
282818
|
+
type: "ios",
|
|
282819
|
+
appVersion,
|
|
282820
|
+
lastId: ""
|
|
282821
|
+
},
|
|
282822
|
+
{
|
|
282823
|
+
lastGmtModified: 0,
|
|
282824
|
+
lastVersion: 0,
|
|
282825
|
+
module: "tuyaclient:sdk:bleconfig",
|
|
282826
|
+
type: "ios",
|
|
282827
|
+
appVersion,
|
|
282828
|
+
lastId: ""
|
|
282829
|
+
},
|
|
282830
|
+
{
|
|
282831
|
+
lastGmtModified: 0,
|
|
282832
|
+
lastVersion: 0,
|
|
282833
|
+
module: "tuyaclient:sdk:control",
|
|
282834
|
+
type: "ios",
|
|
282835
|
+
appVersion,
|
|
282836
|
+
lastId: ""
|
|
282837
|
+
},
|
|
282838
|
+
{
|
|
282839
|
+
lastGmtModified: 0,
|
|
282840
|
+
lastVersion: 0,
|
|
282841
|
+
module: "tuyaclient:sdk:pskIOS",
|
|
282842
|
+
type: "ios",
|
|
282843
|
+
appVersion,
|
|
282844
|
+
lastId: ""
|
|
282845
|
+
},
|
|
282846
|
+
{
|
|
282847
|
+
lastGmtModified: 0,
|
|
282848
|
+
lastVersion: 0,
|
|
282849
|
+
module: "tuyaclient:sdk:apmQueueRequest",
|
|
282850
|
+
type: "ios",
|
|
282851
|
+
appVersion,
|
|
282852
|
+
lastId: ""
|
|
282853
|
+
},
|
|
282854
|
+
{
|
|
282855
|
+
lastGmtModified: 0,
|
|
282856
|
+
lastVersion: 0,
|
|
282857
|
+
module: "tuyaclient:sdk:functionConfig",
|
|
282858
|
+
type: "ios",
|
|
282859
|
+
appVersion,
|
|
282860
|
+
lastId: ""
|
|
282861
|
+
},
|
|
282862
|
+
{
|
|
282863
|
+
lastGmtModified: 0,
|
|
282864
|
+
lastVersion: 0,
|
|
282865
|
+
module: "tuyaclient:sdk:deviceNameMap",
|
|
282866
|
+
type: "ios",
|
|
282867
|
+
appVersion,
|
|
282868
|
+
lastId: ""
|
|
282869
|
+
},
|
|
282870
|
+
{
|
|
282871
|
+
lastGmtModified: 0,
|
|
282872
|
+
lastVersion: 0,
|
|
282873
|
+
module: "tuyaclient:sdk:dpReportConfig",
|
|
282874
|
+
type: "ios",
|
|
282875
|
+
appVersion,
|
|
282876
|
+
lastId: ""
|
|
282877
|
+
},
|
|
282878
|
+
{
|
|
282879
|
+
lastGmtModified: 0,
|
|
282880
|
+
lastVersion: 0,
|
|
282881
|
+
module: "tuyaclient:sdk:BLEMultiConfig",
|
|
282882
|
+
type: "ios",
|
|
282883
|
+
appVersion,
|
|
282884
|
+
lastId: ""
|
|
282885
|
+
},
|
|
282886
|
+
{
|
|
282887
|
+
lastGmtModified: 0,
|
|
282888
|
+
lastVersion: 0,
|
|
282889
|
+
module: "tuyaclient:sdk:neutralDomainSet",
|
|
282890
|
+
type: "ios",
|
|
282891
|
+
appVersion,
|
|
282892
|
+
lastId: ""
|
|
282893
|
+
},
|
|
282894
|
+
{
|
|
282895
|
+
lastGmtModified: 0,
|
|
282896
|
+
lastVersion: 0,
|
|
282897
|
+
module: "tuyaclient:sdk:network",
|
|
282898
|
+
type: "ios",
|
|
282899
|
+
appVersion,
|
|
282900
|
+
lastId: ""
|
|
282901
|
+
},
|
|
282902
|
+
{
|
|
282903
|
+
lastGmtModified: 0,
|
|
282904
|
+
lastVersion: 0,
|
|
282905
|
+
module: "tuyaclient:sdk:bleConnectConfig",
|
|
282906
|
+
type: "ios",
|
|
282907
|
+
appVersion,
|
|
282908
|
+
lastId: ""
|
|
282909
|
+
},
|
|
282910
|
+
{
|
|
282911
|
+
lastGmtModified: 0,
|
|
282912
|
+
lastVersion: 0,
|
|
282913
|
+
module: "tuyaclient:miniApp:ReleaseRule",
|
|
282914
|
+
type: "ios",
|
|
282915
|
+
appVersion,
|
|
282916
|
+
lastId: ""
|
|
282917
|
+
},
|
|
282918
|
+
{
|
|
282919
|
+
lastGmtModified: 0,
|
|
282920
|
+
lastVersion: 0,
|
|
282921
|
+
module: "tuyaclient:miniApp:redirectMatch",
|
|
282922
|
+
type: "ios",
|
|
282923
|
+
appVersion,
|
|
282924
|
+
lastId: ""
|
|
282925
|
+
},
|
|
282926
|
+
{
|
|
282927
|
+
lastGmtModified: 0,
|
|
282928
|
+
lastVersion: 0,
|
|
282929
|
+
module: "tuyaclient:tangram:config",
|
|
282930
|
+
type: "ios",
|
|
282931
|
+
appVersion,
|
|
282932
|
+
lastId: ""
|
|
282933
|
+
},
|
|
282934
|
+
{
|
|
282935
|
+
lastGmtModified: 0,
|
|
282936
|
+
lastVersion: 0,
|
|
282937
|
+
module: "tuyaclient:sdk:supportPlugplay",
|
|
282938
|
+
type: "ios",
|
|
282939
|
+
appVersion,
|
|
282940
|
+
lastId: ""
|
|
282941
|
+
},
|
|
282942
|
+
{
|
|
282943
|
+
lastGmtModified: 0,
|
|
282944
|
+
lastVersion: 0,
|
|
282945
|
+
module: "tuyaclient:sdk:ble",
|
|
282946
|
+
type: "ios",
|
|
282947
|
+
appVersion,
|
|
282948
|
+
lastId: ""
|
|
282949
|
+
},
|
|
282950
|
+
{
|
|
282951
|
+
lastGmtModified: 0,
|
|
282952
|
+
lastVersion: 0,
|
|
282953
|
+
module: "tuyaclient:OSHome:openDeviceListMajorization",
|
|
282954
|
+
type: "ios",
|
|
282955
|
+
appVersion,
|
|
282956
|
+
lastId: ""
|
|
282957
|
+
},
|
|
282958
|
+
{
|
|
282959
|
+
lastGmtModified: 0,
|
|
282960
|
+
lastVersion: 0,
|
|
282961
|
+
module: "tuyaclient:sdk:bleCache",
|
|
282962
|
+
type: "ios",
|
|
282963
|
+
appVersion,
|
|
282964
|
+
lastId: ""
|
|
282965
|
+
},
|
|
282966
|
+
{
|
|
282967
|
+
lastGmtModified: 0,
|
|
282968
|
+
lastVersion: 0,
|
|
282969
|
+
module: "tuyaclient:sdk:advCache",
|
|
282970
|
+
type: "ios",
|
|
282971
|
+
appVersion,
|
|
282972
|
+
lastId: ""
|
|
282973
|
+
},
|
|
282974
|
+
{
|
|
282975
|
+
lastGmtModified: 0,
|
|
282976
|
+
lastVersion: 0,
|
|
282977
|
+
module: "tuyaclient:DeviceBiz:DeviceDetail",
|
|
282978
|
+
type: "ios",
|
|
282979
|
+
appVersion,
|
|
282980
|
+
lastId: ""
|
|
282981
|
+
},
|
|
282982
|
+
{
|
|
282983
|
+
lastGmtModified: 0,
|
|
282984
|
+
lastVersion: 0,
|
|
282985
|
+
module: "tuyaclient:sdk:mqttConfig",
|
|
282986
|
+
type: "ios",
|
|
282987
|
+
appVersion,
|
|
282988
|
+
lastId: ""
|
|
282989
|
+
},
|
|
282990
|
+
{
|
|
282991
|
+
lastGmtModified: 0,
|
|
282992
|
+
lastVersion: 0,
|
|
282993
|
+
module: "tuyaclient:OSApp:appRightAuthType",
|
|
282994
|
+
type: "ios",
|
|
282995
|
+
appVersion,
|
|
282996
|
+
lastId: ""
|
|
282997
|
+
},
|
|
282998
|
+
{
|
|
282999
|
+
lastGmtModified: 0,
|
|
283000
|
+
lastVersion: 0,
|
|
283001
|
+
module: "tuyaclient:network:monitor",
|
|
283002
|
+
type: "ios",
|
|
283003
|
+
appVersion,
|
|
283004
|
+
lastId: ""
|
|
283005
|
+
},
|
|
283006
|
+
{
|
|
283007
|
+
lastGmtModified: 0,
|
|
283008
|
+
lastVersion: 0,
|
|
283009
|
+
module: "tuyaclient:sdk:deviceInfoBindConfig",
|
|
283010
|
+
type: "ios",
|
|
283011
|
+
appVersion,
|
|
283012
|
+
lastId: ""
|
|
283013
|
+
},
|
|
283014
|
+
{
|
|
283015
|
+
lastGmtModified: 0,
|
|
283016
|
+
lastVersion: 0,
|
|
283017
|
+
module: "tuyaclient:sdk:activatorConfig",
|
|
283018
|
+
type: "ios",
|
|
283019
|
+
appVersion,
|
|
283020
|
+
lastId: ""
|
|
283021
|
+
},
|
|
283022
|
+
{
|
|
283023
|
+
lastGmtModified: 0,
|
|
283024
|
+
lastVersion: 0,
|
|
283025
|
+
module: "tuyaclient:sdk:plugPlayConfig",
|
|
283026
|
+
type: "ios",
|
|
283027
|
+
appVersion,
|
|
283028
|
+
lastId: ""
|
|
283029
|
+
},
|
|
283030
|
+
{
|
|
283031
|
+
lastGmtModified: 0,
|
|
283032
|
+
lastVersion: 0,
|
|
283033
|
+
module: "tuyaclient:sdk:shouldUseNewUIPanelModel",
|
|
283034
|
+
type: "ios",
|
|
283035
|
+
appVersion,
|
|
283036
|
+
lastId: ""
|
|
283037
|
+
},
|
|
283038
|
+
{
|
|
283039
|
+
lastGmtModified: 0,
|
|
283040
|
+
lastVersion: 0,
|
|
283041
|
+
module: "tuyaclient:miniApp:preInfos",
|
|
283042
|
+
type: "ios",
|
|
283043
|
+
appVersion,
|
|
283044
|
+
lastId: ""
|
|
283045
|
+
},
|
|
283046
|
+
{
|
|
283047
|
+
lastGmtModified: 0,
|
|
283048
|
+
lastVersion: 0,
|
|
283049
|
+
module: "tuyaclient:sdk:ipcConfig",
|
|
283050
|
+
type: "ios",
|
|
283051
|
+
appVersion,
|
|
283052
|
+
lastId: ""
|
|
283053
|
+
},
|
|
283054
|
+
{
|
|
283055
|
+
lastGmtModified: 0,
|
|
283056
|
+
lastVersion: 0,
|
|
283057
|
+
module: "tuyaclient:OSApp:DynamicUpdateCustomConfig",
|
|
283058
|
+
type: "ios",
|
|
283059
|
+
appVersion,
|
|
283060
|
+
lastId: ""
|
|
283061
|
+
}
|
|
283062
|
+
];
|
|
283063
|
+
|
|
283064
|
+
// worker/utils/getNgConfig.ts
|
|
283065
|
+
async function requestNgConfig(uid) {
|
|
283066
|
+
try {
|
|
283067
|
+
const { appId = 168 } = await getParams();
|
|
283068
|
+
const res = await apiRequestByAtop({
|
|
283069
|
+
api: "tuya.m.pull.config.data.for.app",
|
|
283070
|
+
version: "1.0",
|
|
283071
|
+
params: {
|
|
283072
|
+
input: JSON.stringify(ngConfig_default())
|
|
283073
|
+
},
|
|
283074
|
+
meta: {
|
|
283075
|
+
appId
|
|
283076
|
+
}
|
|
283077
|
+
});
|
|
283078
|
+
if (res.success) {
|
|
283079
|
+
ark.storage.set(`ng_config_${uid}`, JSON.stringify(res));
|
|
283080
|
+
}
|
|
283081
|
+
return res;
|
|
283082
|
+
} catch (error) {
|
|
283083
|
+
return {};
|
|
283084
|
+
}
|
|
283085
|
+
}
|
|
283086
|
+
async function getCacheNGConfig() {
|
|
283087
|
+
const authInfo = await ark.auth.getCustomerUserInfo();
|
|
283088
|
+
const uid = authInfo?.uid || "unlogin";
|
|
283089
|
+
try {
|
|
283090
|
+
const config = await ark.storage.get(`ng_config_${uid}`);
|
|
283091
|
+
if (config) {
|
|
283092
|
+
return JSON.parse(config);
|
|
283093
|
+
}
|
|
283094
|
+
return requestNgConfig(uid);
|
|
283095
|
+
} catch (error) {
|
|
283096
|
+
console.log("getCacheNGConfig error", error);
|
|
283097
|
+
}
|
|
283098
|
+
return {};
|
|
283099
|
+
}
|
|
283100
|
+
async function getAppInfo() {
|
|
283101
|
+
const { appId = 168 } = await getParams();
|
|
283102
|
+
const homeId = await getHomeId();
|
|
283103
|
+
const res = await apiRequestByAtop({
|
|
283104
|
+
api: "s.open.app.info",
|
|
283105
|
+
version: "2.0",
|
|
283106
|
+
params: {
|
|
283107
|
+
appId
|
|
283108
|
+
},
|
|
283109
|
+
meta: {
|
|
283110
|
+
appId,
|
|
283111
|
+
gid: homeId
|
|
283112
|
+
}
|
|
283113
|
+
});
|
|
283114
|
+
return res;
|
|
283115
|
+
}
|
|
283116
|
+
|
|
283117
|
+
// worker/api/TUNIAppInfoManager.ts
|
|
283118
|
+
async function getFunctionList(keys) {
|
|
283119
|
+
try {
|
|
283120
|
+
const res = await getCacheNGConfig();
|
|
283121
|
+
if (res.success) {
|
|
283122
|
+
const data = res.result?.output || [];
|
|
283123
|
+
const config = data.find((item) => item.module === "tuyaclient:oem:config");
|
|
283124
|
+
const obj = JSON.parse(config?.data || "{}");
|
|
283125
|
+
const result = {};
|
|
283126
|
+
keys.forEach((key) => {
|
|
283127
|
+
result[key] = typeof obj[key] !== "undefined" ? obj[key] : true;
|
|
283128
|
+
});
|
|
283129
|
+
console.log("getFunctionList result", result);
|
|
283130
|
+
return result;
|
|
283131
|
+
}
|
|
283132
|
+
return {};
|
|
283133
|
+
} catch (error) {
|
|
283134
|
+
console.log("getFunctionList error", error);
|
|
283135
|
+
return {};
|
|
283136
|
+
}
|
|
283137
|
+
}
|
|
283138
|
+
async function getConfigList(keys) {
|
|
283139
|
+
try {
|
|
283140
|
+
const res = await getCacheNGConfig();
|
|
283141
|
+
if (res.success) {
|
|
283142
|
+
const result = {};
|
|
283143
|
+
keys.forEach((key) => {
|
|
283144
|
+
const ks = key.split(":");
|
|
283145
|
+
if (ks && ks.length > 1) {
|
|
283146
|
+
const module2 = "tuyaclient:" + ks[0] + ":" + ks[1];
|
|
283147
|
+
const config = res.result?.output.find((item) => item.module === module2);
|
|
283148
|
+
if (ks.length === 2) {
|
|
283149
|
+
result[key] = config?.data || "";
|
|
283150
|
+
} else if (ks.length === 3) {
|
|
283151
|
+
const obj = JSON.parse(config?.data || "{}");
|
|
283152
|
+
try {
|
|
283153
|
+
result[key] = JSON.parse(obj[ks[2]]) || void 0;
|
|
283154
|
+
} catch (error) {
|
|
283155
|
+
result[key] = obj[ks[2]] || void 0;
|
|
283156
|
+
}
|
|
283157
|
+
} else {
|
|
283158
|
+
try {
|
|
283159
|
+
let tmp = JSON.parse(config?.data || "{}");
|
|
283160
|
+
for (let i2 = 2; i2 < ks.length; i2++) {
|
|
283161
|
+
const ki = tmp[ks[i2]];
|
|
283162
|
+
try {
|
|
283163
|
+
tmp = JSON.parse(ki) || void 0;
|
|
283164
|
+
console.log("==================", tmp);
|
|
283165
|
+
} catch (error) {
|
|
283166
|
+
tmp = ki || void 0;
|
|
283167
|
+
}
|
|
283168
|
+
}
|
|
283169
|
+
result[key] = tmp || void 0;
|
|
283170
|
+
} catch (e2) {
|
|
283171
|
+
console.log("getConfigList error", e2);
|
|
283172
|
+
result[key] = "";
|
|
283173
|
+
}
|
|
283174
|
+
}
|
|
283175
|
+
}
|
|
283176
|
+
});
|
|
283177
|
+
for (const key in result) {
|
|
283178
|
+
if (typeof result[key] === "undefined") {
|
|
283179
|
+
delete result[key];
|
|
283180
|
+
}
|
|
283181
|
+
}
|
|
283182
|
+
console.log("getFunctionList result", result);
|
|
283183
|
+
return result;
|
|
283184
|
+
}
|
|
283185
|
+
return {};
|
|
283186
|
+
} catch (error) {
|
|
283187
|
+
console.log("getFunctionList error", error);
|
|
283188
|
+
return {};
|
|
283189
|
+
}
|
|
283190
|
+
}
|
|
283191
|
+
async function getNGConfigByKeys(params) {
|
|
283192
|
+
try {
|
|
283193
|
+
const res = await getFunctionList(params.keys);
|
|
283194
|
+
return {
|
|
283195
|
+
data: { config: res },
|
|
283196
|
+
errorCode: 0,
|
|
283197
|
+
errorMsg: import_TYUniCode13.TYUniPluginError.SUCCESS.des
|
|
283198
|
+
};
|
|
283199
|
+
} catch (error) {
|
|
283200
|
+
console.log("getNGConfigByKeys error>>>>", error);
|
|
283201
|
+
return {
|
|
283202
|
+
data: {},
|
|
283203
|
+
errorCode: 0,
|
|
283204
|
+
errorMsg: import_TYUniCode13.TYUniPluginError.SUCCESS.des
|
|
283205
|
+
};
|
|
283206
|
+
}
|
|
283207
|
+
}
|
|
283208
|
+
async function getConfigByKeys(params) {
|
|
283209
|
+
try {
|
|
283210
|
+
const res = await getConfigList(params.keys);
|
|
283211
|
+
return {
|
|
283212
|
+
data: { config: res },
|
|
283213
|
+
errorCode: 0,
|
|
283214
|
+
errorMsg: import_TYUniCode13.TYUniPluginError.SUCCESS.des
|
|
283215
|
+
};
|
|
283216
|
+
} catch (error) {
|
|
283217
|
+
console.log("getNGConfigByKeys error>>>>", error);
|
|
283218
|
+
return {
|
|
283219
|
+
data: {},
|
|
283220
|
+
errorCode: 0,
|
|
283221
|
+
errorMsg: import_TYUniCode13.TYUniPluginError.SUCCESS.des
|
|
283222
|
+
};
|
|
283223
|
+
}
|
|
283224
|
+
}
|
|
283225
|
+
ark.miniapp.addPluginMethod(
|
|
283226
|
+
"TUNIAppInfoManager",
|
|
283227
|
+
"getNGConfigByKeys",
|
|
283228
|
+
getNGConfigByKeys
|
|
283229
|
+
);
|
|
283230
|
+
ark.miniapp.addPluginMethod(
|
|
283231
|
+
"TUNIAppInfoManager",
|
|
283232
|
+
"getConfigByKeys",
|
|
283233
|
+
getConfigByKeys
|
|
283234
|
+
);
|
|
283235
|
+
|
|
283236
|
+
// worker/api/TUNINGManager.ts
|
|
283237
|
+
async function getFunction(key) {
|
|
283238
|
+
try {
|
|
283239
|
+
const res = await getCacheNGConfig();
|
|
283240
|
+
if (res.success) {
|
|
283241
|
+
const data = res.result?.output || [];
|
|
283242
|
+
const config = data.find((item) => item.module === "tuyaclient:oem:config");
|
|
283243
|
+
const obj = JSON.parse(config?.data || "{}");
|
|
283244
|
+
console.log("getFunction result", obj[key]);
|
|
283245
|
+
return obj[key];
|
|
283246
|
+
}
|
|
283247
|
+
return {};
|
|
283248
|
+
} catch (error) {
|
|
283249
|
+
console.log("getFunctionList error", error);
|
|
283250
|
+
return {};
|
|
283251
|
+
}
|
|
283252
|
+
}
|
|
283253
|
+
async function getNgRawData(params) {
|
|
283254
|
+
const { rawKey } = params;
|
|
283255
|
+
if (rawKey === "appType") {
|
|
283256
|
+
const res = await getAppInfo();
|
|
283257
|
+
const { appType = "0" } = await getParams();
|
|
283258
|
+
console.log("---------res", res);
|
|
283259
|
+
return {
|
|
283260
|
+
data: { rawData: appType },
|
|
283261
|
+
errorCode: 0,
|
|
283262
|
+
errorMsg: "success"
|
|
283263
|
+
};
|
|
283264
|
+
} else {
|
|
283265
|
+
const result = await getFunction(rawKey);
|
|
283266
|
+
return {
|
|
283267
|
+
data: { rawData: result },
|
|
283268
|
+
errorCode: 0,
|
|
283269
|
+
errorMsg: "success"
|
|
283270
|
+
};
|
|
283271
|
+
}
|
|
283272
|
+
}
|
|
283273
|
+
ark.miniapp.addPluginMethod("TUNINGManager", "getNgRawData", getNgRawData);
|
|
283274
|
+
|
|
283275
|
+
// worker/api/Bridge.ts
|
|
283276
|
+
var import_TYUniCode14 = __toESM(require_dist());
|
|
282620
283277
|
var bridgeWall = {
|
|
282621
283278
|
// 向小程序发送消息
|
|
282622
283279
|
send(event, payload) {
|
|
@@ -282639,7 +283296,7 @@ async function handle(params) {
|
|
|
282639
283296
|
return {
|
|
282640
283297
|
data: { status: 0 },
|
|
282641
283298
|
errorCode: 0,
|
|
282642
|
-
errorMsg:
|
|
283299
|
+
errorMsg: import_TYUniCode14.TYUniPluginError.SUCCESS.des
|
|
282643
283300
|
};
|
|
282644
283301
|
} else {
|
|
282645
283302
|
return checkOTAUpgradeStatus(params);
|