@ray-js/api 1.4.0-alpha.3 → 1.4.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/BaseKit-3.3.10.js +85 -83
- package/lib/BizKit-3.2.7.js +48 -47
- package/lib/DeviceKit-3.3.1.js +194 -193
- package/lib/HomeKit-3.1.4.js +2 -1
- package/lib/MapKit-3.0.7.js +4 -2
- package/lib/MiniKit-3.1.0.js +65 -64
- package/lib/PlayNetKit-1.1.3.js +2 -1
- package/lib/cloud/alarm.js +4 -7
- package/lib/cloud/core.js +2 -3
- package/lib/cloud/device.js +20 -31
- package/lib/cloud/interface.d.ts +7 -7
- package/lib/cloud/linkage.js +43 -41
- package/lib/cloud/statistic.js +21 -33
- package/lib/cloud/timer.js +31 -48
- package/lib/constants.js +1 -1
- package/lib/core/promisify/index.js +5 -9
- package/lib/getBoundingClientRect/index.js +16 -17
- package/lib/getBoundingClientRect/index.thing.js +16 -17
- package/lib/getBoundingClientRect/index.wechat.js +16 -17
- package/lib/getCdnUrl/index.thing.js +4 -7
- package/lib/getElementById/index.js +1 -3
- package/lib/getElementById/index.thing.js +2 -4
- package/lib/getElementById/index.wechat.js +2 -4
- package/lib/hideTabBar/index.d.ts +7 -1
- package/lib/index.js +3 -2
- package/lib/lifecycles/offAppEvent/index.js +2 -2
- package/lib/lifecycles/offAppHide/index.js +2 -2
- package/lib/lifecycles/offAppShow/index.js +2 -2
- package/lib/lifecycles/offError/index.js +2 -2
- package/lib/lifecycles/offThemeChange/index.js +2 -2
- package/lib/lifecycles/offWindowResize/index.js +2 -2
- package/lib/lifecycles/onAppEvent/index.js +2 -2
- package/lib/lifecycles/onAppHide/index.js +2 -2
- package/lib/lifecycles/onAppShow/index.js +2 -2
- package/lib/lifecycles/onError/index.js +2 -2
- package/lib/lifecycles/onPageNotFound/index.js +2 -2
- package/lib/lifecycles/onThemeChange/index.js +2 -2
- package/lib/lifecycles/onWindowResize/index.js +2 -2
- package/lib/navigateBack/index.js +3 -6
- package/lib/navigateTo/index.js +2 -5
- package/lib/onNavigationBarBack/index.js +1 -2
- package/lib/onNavigationBarBack/index.wechat.js +1 -2
- package/lib/panel/devInfo/index.js +84 -121
- package/lib/panel/i18n/index.d.ts +1 -1
- package/lib/panel/i18n/index.js +180 -262
- package/lib/panel/i18n/index.wechat.d.ts +1 -1
- package/lib/panel/i18n/index.wechat.js +184 -267
- package/lib/panel/normalizeNetwork.d.ts +2 -2
- package/lib/panel/normalizeNetwork.js +2 -7
- package/lib/panel/publishDps.d.ts +1 -1
- package/lib/panel/publishDps.js +13 -18
- package/lib/panel/types/devInfo.d.ts +3 -3
- package/lib/panel/types/utilities.d.ts +8 -8
- package/lib/panel/utils.js +1 -3
- package/lib/reLaunch/index.js +2 -5
- package/lib/redirectTo/index.js +2 -6
- package/lib/requestCloud/index.js +2 -2
- package/lib/requestCloud/index.wechat.js +0 -1
- package/lib/setNavigationBarBack/index.js +1 -2
- package/lib/setNavigationBarBack/index.wechat.js +1 -2
- package/lib/setNavigationBarColor/index.js +3 -6
- package/lib/setNavigationBarTitle/index.js +5 -6
- package/lib/showTabBar/index.d.ts +7 -1
- package/lib/switchTab/index.js +2 -5
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +5 -14
- package/lib/utils.wechat.d.ts +1 -1
- package/lib/utils.wechat.js +9 -21
- package/lib/viewAPI.js +13 -12
- package/package.json +7 -7
- package/LICENSE.md +0 -9
package/lib/HomeKit-3.1.4.js
CHANGED
package/lib/MapKit-3.0.7.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
/// <reference path="../@types/MapKit.d.ts" />
|
2
|
-
import { factory } from './utils'; // ray 1.1.0 集成
|
3
2
|
|
4
|
-
|
3
|
+
import { factory } from './utils';
|
4
|
+
|
5
|
+
// ray 1.1.0 集成
|
6
|
+
export const map = {
|
5
7
|
chooseLocation: factory('chooseLocation', {
|
6
8
|
"namespace": "map"
|
7
9
|
}),
|
package/lib/MiniKit-3.1.0.js
CHANGED
@@ -1,66 +1,67 @@
|
|
1
1
|
/// <reference path="../@types/MiniKit.d.ts" />
|
2
|
-
import { factory } from './utils';
|
3
|
-
export var nativeDisabled = factory('nativeDisabled');
|
4
|
-
export var nativeInovke = factory('nativeInovke');
|
5
|
-
export var getPermissionConfig = factory('getPermissionConfig');
|
6
|
-
export var getPermissionConfigSync = factory('getPermissionConfigSync');
|
7
|
-
export var openSetting = factory('openSetting');
|
8
|
-
export var changeDebugMode = factory('changeDebugMode');
|
9
|
-
export var openHelpCenter = factory('openHelpCenter');
|
10
|
-
export var showTabBarRedDot = factory('showTabBarRedDot');
|
11
|
-
export var showTabBar = factory('showTabBar');
|
12
|
-
export var setTabBarStyle = factory('setTabBarStyle');
|
13
|
-
export var setTabBarItem = factory('setTabBarItem');
|
14
|
-
export var setTabBarBadge = factory('setTabBarBadge');
|
15
|
-
export var removeTabBarBadge = factory('removeTabBarBadge');
|
16
|
-
export var hideTabBarRedDot = factory('hideTabBarRedDot');
|
17
|
-
export var hideTabBar = factory('hideTabBar');
|
18
|
-
export var apiRequestByHighway = factory('apiRequestByHighway');
|
19
|
-
export var navigateBackMiniProgram = factory('navigateBackMiniProgram');
|
20
|
-
export var exitMiniProgram = factory('exitMiniProgram');
|
21
|
-
export var getLaunchOptions = factory('getLaunchOptions');
|
22
|
-
export var getLaunchOptionsSync = factory('getLaunchOptionsSync');
|
23
|
-
export var getEnterOptions = factory('getEnterOptions');
|
24
|
-
export var getEnterOptionsSync = factory('getEnterOptionsSync');
|
25
|
-
export var setBoardTitle = factory('setBoardTitle');
|
26
|
-
export var setBoardTitleSync = factory('setBoardTitleSync');
|
27
|
-
export var getMenuButtonBoundingClientRect = factory('getMenuButtonBoundingClientRect');
|
28
|
-
export var getMenuButtonBoundingClientRectSync = factory('getMenuButtonBoundingClientRectSync');
|
29
|
-
export var preDownloadMiniApp = factory('preDownloadMiniApp');
|
30
|
-
export var login = factory('login');
|
31
|
-
export var setPageOrientation = factory('setPageOrientation');
|
32
|
-
export var hideMenuButton = factory('hideMenuButton');
|
33
|
-
export var showMenuButton = factory('showMenuButton');
|
34
|
-
export var showStatusBar = factory('showStatusBar');
|
35
|
-
export var hideStatusBar = factory('hideStatusBar');
|
36
|
-
export var exitMiniWidget = factory('exitMiniWidget');
|
37
|
-
export var canOpenURL = factory('canOpenURL');
|
38
|
-
export var canOpenURLSync = factory('canOpenURLSync');
|
39
|
-
export var openURL = factory('openURL');
|
40
|
-
export var showNavigationBarLoading = factory('showNavigationBarLoading');
|
41
|
-
export var setNavigationBarTitle = factory('setNavigationBarTitle');
|
42
|
-
export var setNavigationBarColor = factory('setNavigationBarColor');
|
43
|
-
export var hideNavigationBarLoading = factory('hideNavigationBarLoading');
|
44
|
-
export var hideHomeButton = factory('hideHomeButton');
|
45
|
-
export var navigateTo = factory('navigateTo');
|
46
|
-
export var navigateBack = factory('navigateBack');
|
47
|
-
export var redirectTo = factory('redirectTo');
|
48
|
-
export var reLaunch = factory('reLaunch');
|
49
|
-
export var switchTab = factory('switchTab');
|
50
|
-
export var extApiCanIUse = factory('extApiCanIUse');
|
51
|
-
export var extApiCanIUseSync = factory('extApiCanIUseSync');
|
52
|
-
export var extApiInvoke = factory('extApiInvoke');
|
53
|
-
export var extApiInvokeSync = factory('extApiInvokeSync');
|
54
|
-
export var startPullDownRefresh = factory('startPullDownRefresh');
|
55
|
-
export var stopPullDownRefresh = factory('stopPullDownRefresh');
|
56
|
-
export var onNativeEvent = factory('onNativeEvent');
|
57
|
-
export var offNativeEvent = factory('offNativeEvent'); // 3.1.0 新增 - 4.8.0 容器
|
58
2
|
|
59
|
-
|
60
|
-
export
|
61
|
-
export
|
62
|
-
export
|
63
|
-
export
|
64
|
-
export
|
65
|
-
export
|
66
|
-
export
|
3
|
+
import { factory } from './utils';
|
4
|
+
export const nativeDisabled = factory('nativeDisabled');
|
5
|
+
export const nativeInovke = factory('nativeInovke');
|
6
|
+
export const getPermissionConfig = factory('getPermissionConfig');
|
7
|
+
export const getPermissionConfigSync = factory('getPermissionConfigSync');
|
8
|
+
export const openSetting = factory('openSetting');
|
9
|
+
export const changeDebugMode = factory('changeDebugMode');
|
10
|
+
export const openHelpCenter = factory('openHelpCenter');
|
11
|
+
export const showTabBarRedDot = factory('showTabBarRedDot');
|
12
|
+
export const showTabBar = factory('showTabBar');
|
13
|
+
export const setTabBarStyle = factory('setTabBarStyle');
|
14
|
+
export const setTabBarItem = factory('setTabBarItem');
|
15
|
+
export const setTabBarBadge = factory('setTabBarBadge');
|
16
|
+
export const removeTabBarBadge = factory('removeTabBarBadge');
|
17
|
+
export const hideTabBarRedDot = factory('hideTabBarRedDot');
|
18
|
+
export const hideTabBar = factory('hideTabBar');
|
19
|
+
export const apiRequestByHighway = factory('apiRequestByHighway');
|
20
|
+
export const navigateBackMiniProgram = factory('navigateBackMiniProgram');
|
21
|
+
export const exitMiniProgram = factory('exitMiniProgram');
|
22
|
+
export const getLaunchOptions = factory('getLaunchOptions');
|
23
|
+
export const getLaunchOptionsSync = factory('getLaunchOptionsSync');
|
24
|
+
export const getEnterOptions = factory('getEnterOptions');
|
25
|
+
export const getEnterOptionsSync = factory('getEnterOptionsSync');
|
26
|
+
export const setBoardTitle = factory('setBoardTitle');
|
27
|
+
export const setBoardTitleSync = factory('setBoardTitleSync');
|
28
|
+
export const getMenuButtonBoundingClientRect = factory('getMenuButtonBoundingClientRect');
|
29
|
+
export const getMenuButtonBoundingClientRectSync = factory('getMenuButtonBoundingClientRectSync');
|
30
|
+
export const preDownloadMiniApp = factory('preDownloadMiniApp');
|
31
|
+
export const login = factory('login');
|
32
|
+
export const setPageOrientation = factory('setPageOrientation');
|
33
|
+
export const hideMenuButton = factory('hideMenuButton');
|
34
|
+
export const showMenuButton = factory('showMenuButton');
|
35
|
+
export const showStatusBar = factory('showStatusBar');
|
36
|
+
export const hideStatusBar = factory('hideStatusBar');
|
37
|
+
export const exitMiniWidget = factory('exitMiniWidget');
|
38
|
+
export const canOpenURL = factory('canOpenURL');
|
39
|
+
export const canOpenURLSync = factory('canOpenURLSync');
|
40
|
+
export const openURL = factory('openURL');
|
41
|
+
export const showNavigationBarLoading = factory('showNavigationBarLoading');
|
42
|
+
export const setNavigationBarTitle = factory('setNavigationBarTitle');
|
43
|
+
export const setNavigationBarColor = factory('setNavigationBarColor');
|
44
|
+
export const hideNavigationBarLoading = factory('hideNavigationBarLoading');
|
45
|
+
export const hideHomeButton = factory('hideHomeButton');
|
46
|
+
export const navigateTo = factory('navigateTo');
|
47
|
+
export const navigateBack = factory('navigateBack');
|
48
|
+
export const redirectTo = factory('redirectTo');
|
49
|
+
export const reLaunch = factory('reLaunch');
|
50
|
+
export const switchTab = factory('switchTab');
|
51
|
+
export const extApiCanIUse = factory('extApiCanIUse');
|
52
|
+
export const extApiCanIUseSync = factory('extApiCanIUseSync');
|
53
|
+
export const extApiInvoke = factory('extApiInvoke');
|
54
|
+
export const extApiInvokeSync = factory('extApiInvokeSync');
|
55
|
+
export const startPullDownRefresh = factory('startPullDownRefresh');
|
56
|
+
export const stopPullDownRefresh = factory('stopPullDownRefresh');
|
57
|
+
export const onNativeEvent = factory('onNativeEvent');
|
58
|
+
export const offNativeEvent = factory('offNativeEvent');
|
59
|
+
// 3.1.0 新增 - 4.8.0 容器
|
60
|
+
export const getAccountInfo = factory('getAccountInfo');
|
61
|
+
export const getAccountInfoSync = factory('getAccountInfoSync');
|
62
|
+
export const hideBoardTitleIcon = factory('hideBoardTitleIcon');
|
63
|
+
export const hideBoardTitleIconSync = factory('hideBoardTitleIconSync');
|
64
|
+
export const setBoardIcon = factory('setBoardIcon');
|
65
|
+
export const setBoardIconSync = factory('setBoardIconSync');
|
66
|
+
export const showBoardTitleIcon = factory('showBoardTitleIcon');
|
67
|
+
export const showBoardTitleIconSync = factory('showBoardTitleIconSync');
|
package/lib/PlayNetKit-1.1.3.js
CHANGED
package/lib/cloud/alarm.js
CHANGED
@@ -2,34 +2,31 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
// 告警相关接口
|
3
3
|
import { requestCloud } from '../';
|
4
4
|
import { THING } from '../constants';
|
5
|
-
|
6
5
|
/**
|
7
6
|
* 根据设备 ID 查询告警列表信息
|
8
7
|
* @param {string} devId 设备Id
|
9
8
|
*/
|
10
|
-
|
9
|
+
const getDevAlarmList = devId => {
|
11
10
|
return requestCloud({
|
12
11
|
api: "".concat(THING, ".m.linkage.rule.product.query"),
|
13
12
|
version: '1.0',
|
14
13
|
data: {
|
15
|
-
devId
|
14
|
+
devId
|
16
15
|
}
|
17
16
|
});
|
18
17
|
};
|
18
|
+
|
19
19
|
/**
|
20
20
|
* 启用或者禁用设备的告警
|
21
21
|
* @param {string} devId 设备Id
|
22
22
|
* @param {string} ruleIds 要开启或关闭的告警id, 用","隔开
|
23
23
|
* @param {bool} disabled 是否禁用
|
24
24
|
*/
|
25
|
-
|
26
|
-
|
27
|
-
var setAlarmSwitch = function (params) {
|
25
|
+
const setAlarmSwitch = params => {
|
28
26
|
return requestCloud({
|
29
27
|
api: "".concat(THING, ".m.linkage.dev.warn.set"),
|
30
28
|
version: '1.0',
|
31
29
|
data: _objectSpread({}, params)
|
32
30
|
});
|
33
31
|
};
|
34
|
-
|
35
32
|
export { getDevAlarmList, setAlarmSwitch };
|
package/lib/cloud/core.js
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
// 通用核心接口
|
2
2
|
import { requestCloud } from '../';
|
3
3
|
import { THING } from '../constants';
|
4
|
+
|
4
5
|
/**
|
5
6
|
* 获取 App 面板内静态资源地址
|
6
7
|
*/
|
7
|
-
|
8
|
-
var getAssetHostname = function () {
|
8
|
+
const getAssetHostname = () => {
|
9
9
|
return requestCloud({
|
10
10
|
api: "".concat(THING, ".m.app.panel.url.get"),
|
11
11
|
version: '1.0',
|
12
12
|
data: {}
|
13
13
|
});
|
14
14
|
};
|
15
|
-
|
16
15
|
export { getAssetHostname };
|
package/lib/cloud/device.js
CHANGED
@@ -2,19 +2,19 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
// 设备接口
|
3
3
|
import { requestCloud } from '../';
|
4
4
|
import { THING } from '../constants';
|
5
|
-
|
6
5
|
/**
|
7
6
|
* 获取设备所有 DP 信息
|
8
7
|
* @param {string} gwId 设备Id
|
9
8
|
* @param {string} devId 设备Id
|
10
9
|
*/
|
11
|
-
|
10
|
+
const getDpsInfos = params => {
|
12
11
|
return requestCloud({
|
13
12
|
api: 's.m.dev.dp.get',
|
14
13
|
version: '2.0',
|
15
14
|
data: _objectSpread({}, params)
|
16
15
|
});
|
17
16
|
};
|
17
|
+
|
18
18
|
/**
|
19
19
|
* 更新设备 DP 名称
|
20
20
|
* @param {string} gwId 设备Id
|
@@ -22,73 +22,68 @@ var getDpsInfos = function (params) {
|
|
22
22
|
* @param {string} dpId dpId
|
23
23
|
* @param {string} name dp自定义名称
|
24
24
|
*/
|
25
|
-
|
26
|
-
|
27
|
-
var updateDpName = function (params) {
|
25
|
+
const updateDpName = params => {
|
28
26
|
return requestCloud({
|
29
27
|
api: 's.m.dev.dp.name.update',
|
30
28
|
version: '1.0',
|
31
29
|
data: _objectSpread({}, params)
|
32
30
|
});
|
33
31
|
};
|
32
|
+
|
34
33
|
/**
|
35
34
|
* 获取群组设备所有 DP 信息
|
36
35
|
* @param {string} groupId 群组id
|
37
36
|
*/
|
38
|
-
|
39
|
-
|
40
|
-
var getGroupDpsInfos = function (groupId) {
|
37
|
+
const getGroupDpsInfos = groupId => {
|
41
38
|
return requestCloud({
|
42
39
|
api: 's.m.dev.group.dp.get',
|
43
40
|
version: '2.0',
|
44
41
|
data: {
|
45
|
-
groupId
|
42
|
+
groupId
|
46
43
|
}
|
47
44
|
});
|
48
45
|
};
|
46
|
+
|
49
47
|
/**
|
50
48
|
* 更新群组设备 DP 名称
|
51
49
|
* @param {string} groupId 群组id
|
52
50
|
* @param {string} dpId dpId
|
53
51
|
* @param {string} name dp自定义名称
|
54
52
|
*/
|
55
|
-
|
56
|
-
|
57
|
-
var updateGroupDpName = function (params) {
|
53
|
+
const updateGroupDpName = params => {
|
58
54
|
return requestCloud({
|
59
55
|
api: "".concat(THING, ".m.group.dpname.update"),
|
60
56
|
version: '1.0',
|
61
57
|
data: _objectSpread({}, params)
|
62
58
|
});
|
63
59
|
};
|
60
|
+
|
64
61
|
/**
|
65
62
|
* 通过设备 ID 获取当天天气
|
66
63
|
* @param {string} devId 设备Id
|
67
64
|
* @param {boolean} isLocal 要查询的信息
|
68
65
|
*/
|
69
|
-
|
70
|
-
|
71
|
-
var getWeatherQuality = function (params) {
|
66
|
+
const getWeatherQuality = params => {
|
72
67
|
return requestCloud({
|
73
68
|
api: "".concat(THING, ".m.public.weather.get"),
|
74
69
|
version: '2.0',
|
75
70
|
data: _objectSpread({}, params)
|
76
71
|
});
|
77
72
|
};
|
73
|
+
|
78
74
|
/**
|
79
75
|
* 天气预报接口
|
80
76
|
* @param {string} devId 设备Id
|
81
77
|
* @param {number} dataRange 预报天数(默认值为 7,最大可预报天数为 7)
|
82
78
|
*/
|
83
|
-
|
84
|
-
|
85
|
-
var getWeathers = function (params) {
|
79
|
+
const getWeathers = params => {
|
86
80
|
return requestCloud({
|
87
81
|
api: "".concat(THING, ".m.public.weathers.get"),
|
88
82
|
version: '2.0',
|
89
83
|
data: _objectSpread({}, params)
|
90
84
|
});
|
91
85
|
};
|
86
|
+
|
92
87
|
/**
|
93
88
|
* 创建设备自定义位置信息
|
94
89
|
* @param {string} devId 设备Id
|
@@ -96,53 +91,47 @@ var getWeathers = function (params) {
|
|
96
91
|
* @param {string} lat 纬度
|
97
92
|
* @param {string} locationName 位置名称(目前没用,不影响天气返回结果)
|
98
93
|
*/
|
99
|
-
|
100
|
-
|
101
|
-
var saveCustomizePosition = function (params) {
|
94
|
+
const saveCustomizePosition = params => {
|
102
95
|
return requestCloud({
|
103
96
|
api: "".concat(THING, ".m.device.customize.position.save"),
|
104
97
|
version: '1.0',
|
105
98
|
data: _objectSpread({}, params)
|
106
99
|
});
|
107
100
|
};
|
101
|
+
|
108
102
|
/**
|
109
103
|
* 设备自定义位置信息获取
|
110
104
|
* @param {string} devId 设备Id
|
111
105
|
*/
|
112
|
-
|
113
|
-
|
114
|
-
var getCustomizePosition = function (params) {
|
106
|
+
const getCustomizePosition = params => {
|
115
107
|
return requestCloud({
|
116
108
|
api: "".concat(THING, ".m.device.customize.position.get"),
|
117
109
|
version: '1.0',
|
118
110
|
data: _objectSpread({}, params)
|
119
111
|
});
|
120
112
|
};
|
113
|
+
|
121
114
|
/**
|
122
115
|
* 获取设备属性
|
123
116
|
* @param {string} devId 设备Id
|
124
117
|
*/
|
125
|
-
|
126
|
-
|
127
|
-
var getDevProperty = function (params) {
|
118
|
+
const getDevProperty = params => {
|
128
119
|
return requestCloud({
|
129
120
|
api: 's.m.dev.property.get',
|
130
121
|
version: '3.2',
|
131
122
|
data: _objectSpread({}, params)
|
132
123
|
});
|
133
124
|
};
|
125
|
+
|
134
126
|
/**
|
135
127
|
* 保存设备属性
|
136
128
|
* @param {string} devId 设备Id
|
137
129
|
*/
|
138
|
-
|
139
|
-
|
140
|
-
var saveDevProperty = function (params) {
|
130
|
+
const saveDevProperty = params => {
|
141
131
|
return requestCloud({
|
142
132
|
api: 's.m.dev.property.save',
|
143
133
|
version: '5.1',
|
144
134
|
data: _objectSpread({}, params)
|
145
135
|
});
|
146
136
|
};
|
147
|
-
|
148
137
|
export { getDpsInfos, updateDpName, getGroupDpsInfos, updateGroupDpName, getWeatherQuality, getWeathers, saveCustomizePosition, getCustomizePosition, getDevProperty, saveDevProperty };
|
package/lib/cloud/interface.d.ts
CHANGED
@@ -108,7 +108,7 @@ export interface IQueryTimerTasks {
|
|
108
108
|
bizType: string;
|
109
109
|
category: string;
|
110
110
|
}
|
111
|
-
export
|
111
|
+
export type Timers = Array<{
|
112
112
|
/**
|
113
113
|
* 初始化状态,0:关闭;1:开启。
|
114
114
|
*/
|
@@ -655,7 +655,7 @@ export interface IGetLogInSpecifiedTime {
|
|
655
655
|
startTime?: string;
|
656
656
|
endTime?: string;
|
657
657
|
}
|
658
|
-
export
|
658
|
+
export type Dp = {
|
659
659
|
/**
|
660
660
|
* 上报数据的时间戳格式
|
661
661
|
*/
|
@@ -834,7 +834,7 @@ export interface IGetLinkageDeviceList {
|
|
834
834
|
gid: number;
|
835
835
|
sourceType: string;
|
836
836
|
}
|
837
|
-
export
|
837
|
+
export type IGetLinkageDeviceListResponse = Array<{
|
838
838
|
category: string;
|
839
839
|
datapoints: any[];
|
840
840
|
devId: string;
|
@@ -842,7 +842,7 @@ export declare type IGetLinkageDeviceListResponse = Array<{
|
|
842
842
|
name: string;
|
843
843
|
productId: string;
|
844
844
|
}>;
|
845
|
-
export
|
845
|
+
export type IGetSceneListResponse = Array<{
|
846
846
|
actions: any[];
|
847
847
|
attribute: number;
|
848
848
|
auditStatus: number;
|
@@ -906,7 +906,7 @@ export interface IGetBindRuleList {
|
|
906
906
|
sourceEntityId: string;
|
907
907
|
entityType: number;
|
908
908
|
}
|
909
|
-
export
|
909
|
+
export type IGetBindRuleListResponse = Array<{
|
910
910
|
associativeEntityId: string;
|
911
911
|
associativeEntityValueList: any[];
|
912
912
|
bizDomain: string;
|
@@ -932,7 +932,7 @@ export interface IGetDevProperty {
|
|
932
932
|
*/
|
933
933
|
code: string;
|
934
934
|
}
|
935
|
-
export
|
935
|
+
export type IGetDevPropertyResponse = string;
|
936
936
|
export interface ISaveDevProperty {
|
937
937
|
/**
|
938
938
|
* 设备 ID
|
@@ -957,4 +957,4 @@ export interface DeviceProperty {
|
|
957
957
|
*/
|
958
958
|
value: string;
|
959
959
|
}
|
960
|
-
export
|
960
|
+
export type ISaveDevPropertyResponse = boolean;
|
package/lib/cloud/linkage.js
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import { requestCloud } from '../';
|
3
3
|
import { THING } from '../constants';
|
4
|
-
|
5
4
|
/**
|
6
5
|
* 获取家庭下支持联动的设备列表
|
7
6
|
* @param {number} gid 家庭id
|
8
7
|
* @param {string} sourceType 业务范围
|
9
8
|
*/
|
10
|
-
|
9
|
+
const getLinkageDeviceList = params => {
|
11
10
|
return requestCloud({
|
12
11
|
api: "".concat(THING, ".m.linkage.dev.list"),
|
13
12
|
version: '3.0',
|
14
13
|
data: _objectSpread({}, params)
|
15
14
|
});
|
16
15
|
};
|
16
|
+
|
17
17
|
/**
|
18
18
|
* 查询一键执行场景列表
|
19
19
|
* @param {number} devId 设备id
|
20
20
|
*/
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
const getSceneList = _ref => {
|
22
|
+
let {
|
23
|
+
devId
|
24
|
+
} = _ref;
|
25
25
|
return requestCloud({
|
26
26
|
api: "".concat(THING, ".m.linkage.rule.brief.query"),
|
27
27
|
version: '1.0',
|
28
28
|
data: {
|
29
|
-
devId
|
29
|
+
devId
|
30
30
|
}
|
31
31
|
});
|
32
32
|
};
|
33
|
+
|
33
34
|
/**
|
34
35
|
* 查询已绑定的列表
|
35
36
|
* @param {string} bizDomain 业务范围
|
@@ -37,14 +38,14 @@ var getSceneList = function (_ref) {
|
|
37
38
|
* @param {number} entityType 实体类型
|
38
39
|
*/
|
39
40
|
|
40
|
-
|
41
|
-
var getBindRuleList = function (params) {
|
41
|
+
const getBindRuleList = params => {
|
42
42
|
return requestCloud({
|
43
43
|
api: "".concat(THING, ".m.linkage.associative.entity.id.category.query"),
|
44
44
|
version: '1.0',
|
45
45
|
data: _objectSpread({}, params)
|
46
46
|
});
|
47
47
|
};
|
48
|
+
|
48
49
|
/**
|
49
50
|
* 绑定联动
|
50
51
|
* @param {string} devId 设备 ID
|
@@ -54,30 +55,30 @@ var getBindRuleList = function (params) {
|
|
54
55
|
* @param {Array} expr 关联DP点、动作组合
|
55
56
|
* @param {string} bizDomain 业务域
|
56
57
|
*/
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
const bindRule = _ref2 => {
|
59
|
+
let {
|
60
|
+
devId,
|
61
|
+
associativeEntityId,
|
62
|
+
ruleId,
|
63
|
+
entitySubIds,
|
64
|
+
expr,
|
65
|
+
bizDomain
|
66
|
+
} = _ref2;
|
66
67
|
return requestCloud({
|
67
68
|
api: "".concat(THING, ".m.linkage.associative.entity.bind"),
|
68
69
|
version: '1.0',
|
69
70
|
data: {
|
70
71
|
relationExpr: {
|
71
72
|
sourceEntityId: devId,
|
72
|
-
associativeEntityId
|
73
|
+
associativeEntityId,
|
73
74
|
associativeEntityValue: ruleId,
|
74
75
|
triggerRuleVO: {
|
75
76
|
conditions: [{
|
76
77
|
entityId: devId,
|
77
78
|
entityType: 1,
|
78
79
|
condType: 1,
|
79
|
-
entitySubIds
|
80
|
-
expr
|
80
|
+
entitySubIds,
|
81
|
+
expr
|
81
82
|
}],
|
82
83
|
actions: [{
|
83
84
|
entityId: ruleId,
|
@@ -85,12 +86,13 @@ var bindRule = function (_ref2) {
|
|
85
86
|
actionExecutor: 'ruleTrigger'
|
86
87
|
}]
|
87
88
|
},
|
88
|
-
bizDomain
|
89
|
+
bizDomain,
|
89
90
|
uniqueType: 3
|
90
91
|
}
|
91
92
|
}
|
92
93
|
});
|
93
94
|
};
|
95
|
+
|
94
96
|
/**
|
95
97
|
* 解除联动
|
96
98
|
* @param {string} bizDomain 业务范围
|
@@ -98,62 +100,62 @@ var bindRule = function (_ref2) {
|
|
98
100
|
* @param {string} associativeEntityId 关联dp组合
|
99
101
|
* @param {string} associativeEntityValue 规则id
|
100
102
|
*/
|
101
|
-
|
102
|
-
|
103
|
-
var removeRule = function (params) {
|
103
|
+
const removeRule = params => {
|
104
104
|
return requestCloud({
|
105
105
|
api: "".concat(THING, ".m.linkage.associative.entity.remove"),
|
106
106
|
version: '1.0',
|
107
107
|
data: _objectSpread({}, params)
|
108
108
|
});
|
109
109
|
};
|
110
|
+
|
110
111
|
/**
|
111
112
|
* 触发联动
|
112
113
|
* @param {string} ruleId 规则id
|
113
114
|
*/
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
const triggerRule = _ref3 => {
|
116
|
+
let {
|
117
|
+
ruleId
|
118
|
+
} = _ref3;
|
118
119
|
return requestCloud({
|
119
120
|
api: "".concat(THING, ".m.linkage.rule.trigger"),
|
120
121
|
version: '1.0',
|
121
122
|
data: {
|
122
|
-
ruleId
|
123
|
+
ruleId
|
123
124
|
}
|
124
125
|
});
|
125
126
|
};
|
127
|
+
|
126
128
|
/**
|
127
129
|
* 启用联动
|
128
130
|
* @param {string} ruleId 规则id
|
129
131
|
*/
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
132
|
+
const enableRule = _ref4 => {
|
133
|
+
let {
|
134
|
+
ruleId
|
135
|
+
} = _ref4;
|
134
136
|
return requestCloud({
|
135
137
|
api: "".concat(THING, ".m.linkage.rule.enable"),
|
136
138
|
version: '1.0',
|
137
139
|
data: {
|
138
|
-
ruleId
|
140
|
+
ruleId
|
139
141
|
}
|
140
142
|
});
|
141
143
|
};
|
144
|
+
|
142
145
|
/**
|
143
146
|
* 停用联动
|
144
147
|
* @param {string} ruleId 规则id
|
145
148
|
*/
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
149
|
+
const disableRule = _ref5 => {
|
150
|
+
let {
|
151
|
+
ruleId
|
152
|
+
} = _ref5;
|
150
153
|
return requestCloud({
|
151
154
|
api: "".concat(THING, ".m.linkage.rule.disable"),
|
152
155
|
version: '1.0',
|
153
156
|
data: {
|
154
|
-
ruleId
|
157
|
+
ruleId
|
155
158
|
}
|
156
159
|
});
|
157
160
|
};
|
158
|
-
|
159
161
|
export { getLinkageDeviceList, getSceneList, getBindRuleList, bindRule, removeRule, triggerRule, enableRule, disableRule };
|