@ray-js/api 1.7.53 → 1.7.55
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/lib/cloud/alarm.js +2 -2
- package/lib/cloud/core.js +1 -1
- package/lib/cloud/device.js +8 -7
- package/lib/cloud/deviceFile.js +5 -5
- package/lib/cloud/doorlock/auth.js +8 -8
- package/lib/cloud/doorlock/device.js +13 -13
- package/lib/cloud/doorlock/fittings.js +4 -4
- package/lib/cloud/doorlock/log.js +7 -7
- package/lib/cloud/doorlock/member-opmode.js +6 -6
- package/lib/cloud/doorlock/member.js +13 -13
- package/lib/cloud/doorlock/offline-pwd.js +4 -4
- package/lib/cloud/doorlock/sence.js +3 -3
- package/lib/cloud/doorlock/service.js +1 -1
- package/lib/cloud/doorlock/setting.js +11 -11
- package/lib/cloud/doorlock/temp-pwd.js +7 -7
- package/lib/cloud/doorlock/unlock-method.js +3 -3
- package/lib/cloud/doorlock/unlock.js +3 -3
- package/lib/cloud/electrician/tariffService.js +2 -2
- package/lib/cloud/highlights.js +8 -7
- package/lib/cloud/linkage.js +17 -17
- package/lib/cloud/outdoor.js +9 -9
- package/lib/cloud/recipe/basket.js +11 -10
- package/lib/cloud/recipe/category-list.js +2 -2
- package/lib/cloud/recipe/custom.js +5 -4
- package/lib/cloud/recipe/menu.js +6 -5
- package/lib/cloud/recipe/query.js +4 -3
- package/lib/cloud/recipe/record.js +3 -3
- package/lib/cloud/recipe/score.js +4 -3
- package/lib/cloud/recipe/star.js +6 -5
- package/lib/cloud/remoteGroup.js +2 -2
- package/lib/cloud/statistic.js +9 -9
- package/lib/cloud/timer.js +14 -14
- package/lib/getBoundingClientRect/index.thing.js +1 -0
- package/lib/getBoundingClientRect/index.wechat.js +1 -0
- package/lib/getCdnUrl/index.d.ts +1 -0
- package/lib/getCdnUrl/index.js +1 -0
- package/lib/getCdnUrl/index.thing.d.ts +1 -1
- package/lib/getCdnUrl/index.thing.js +25 -20
- package/lib/getCdnUrl/index.wechat.js +5 -5
- package/lib/getElementById/index.thing.js +1 -1
- package/lib/getElementById/index.wechat.js +1 -1
- package/lib/panel/i18n/index.js +16 -12
- package/lib/panel/i18n/index.wechat.js +16 -12
- package/lib/panel/publishDps.js +1 -1
- package/lib/redirectTo/index.js +2 -0
- package/lib/utils.js +9 -9
- package/lib/utils.wechat.js +6 -5
- package/package.json +5 -5
package/lib/cloud/recipe/menu.js
CHANGED
|
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
const _excluded = ["query"],
|
|
4
4
|
_excluded2 = ["like"];
|
|
5
|
+
import "core-js/modules/es.json.stringify.js";
|
|
5
6
|
import { THING } from '../../constants';
|
|
6
7
|
import requestCloud from '../../requestCloud';
|
|
7
8
|
// #region 食谱列表
|
|
@@ -33,7 +34,7 @@ export const getRecipeList = params => {
|
|
|
33
34
|
} = params,
|
|
34
35
|
rest = _objectWithoutProperties(params, _excluded);
|
|
35
36
|
return requestCloud({
|
|
36
|
-
api:
|
|
37
|
+
api: "".concat(THING, ".m.menu.lang.list"),
|
|
37
38
|
version: '2.0',
|
|
38
39
|
data: _objectSpread({
|
|
39
40
|
queryJson: JSON.stringify(query)
|
|
@@ -67,7 +68,7 @@ export const getRecipeList = params => {
|
|
|
67
68
|
// 获取食谱详情的函数
|
|
68
69
|
export const getRecipeDetail = params => {
|
|
69
70
|
return requestCloud({
|
|
70
|
-
api:
|
|
71
|
+
api: "".concat(THING, ".m.menu.get"),
|
|
71
72
|
version: '1.0',
|
|
72
73
|
data: params
|
|
73
74
|
});
|
|
@@ -92,7 +93,7 @@ export const operateRecipeLike = params => {
|
|
|
92
93
|
} = params,
|
|
93
94
|
rest = _objectWithoutProperties(params, _excluded2);
|
|
94
95
|
return requestCloud({
|
|
95
|
-
api:
|
|
96
|
+
api: "m.ha.recipe.operate.like",
|
|
96
97
|
version: '1.0',
|
|
97
98
|
data: _objectSpread({
|
|
98
99
|
likeJson: JSON.stringify(like)
|
|
@@ -119,7 +120,7 @@ export const getPanelRecipeList = params => {
|
|
|
119
120
|
query
|
|
120
121
|
} = params;
|
|
121
122
|
return requestCloud({
|
|
122
|
-
api:
|
|
123
|
+
api: "m.ha.recipe.panel.list",
|
|
123
124
|
version: '1.0',
|
|
124
125
|
data: {
|
|
125
126
|
devId,
|
|
@@ -142,7 +143,7 @@ export const getPanelRecipeList = params => {
|
|
|
142
143
|
*/
|
|
143
144
|
export const getPanelRecipeDetail = params => {
|
|
144
145
|
return requestCloud({
|
|
145
|
-
api:
|
|
146
|
+
api: "m.ha.recipe.panel.get",
|
|
146
147
|
version: '1.0',
|
|
147
148
|
data: params
|
|
148
149
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
const _excluded = ["query"];
|
|
4
|
+
import "core-js/modules/es.json.stringify.js";
|
|
4
5
|
import { THING } from '../../constants';
|
|
5
6
|
import requestCloud from '../../requestCloud';
|
|
6
7
|
|
|
@@ -24,7 +25,7 @@ import requestCloud from '../../requestCloud';
|
|
|
24
25
|
*/
|
|
25
26
|
export const getAllLanguages = () => {
|
|
26
27
|
return requestCloud({
|
|
27
|
-
api:
|
|
28
|
+
api: "".concat(THING, ".m.cookbook.all.lang"),
|
|
28
29
|
version: '1.0',
|
|
29
30
|
data: {}
|
|
30
31
|
});
|
|
@@ -57,7 +58,7 @@ export const getAllLanguages = () => {
|
|
|
57
58
|
*/
|
|
58
59
|
export const getSearchModel = params => {
|
|
59
60
|
return requestCloud({
|
|
60
|
-
api:
|
|
61
|
+
api: "".concat(THING, ".m.menu.query.model.list"),
|
|
61
62
|
version: '1.0',
|
|
62
63
|
data: params
|
|
63
64
|
});
|
|
@@ -90,7 +91,7 @@ export const getCookingTimeCondition = params => {
|
|
|
90
91
|
} = params,
|
|
91
92
|
rest = _objectWithoutProperties(params, _excluded);
|
|
92
93
|
return requestCloud({
|
|
93
|
-
api:
|
|
94
|
+
api: "".concat(THING, ".m.menu.search.condition"),
|
|
94
95
|
version: '1.0',
|
|
95
96
|
data: _objectSpread({
|
|
96
97
|
queryJson: JSON.stringify(query)
|
|
@@ -24,7 +24,7 @@ import requestCloud from '../../requestCloud';
|
|
|
24
24
|
*/
|
|
25
25
|
export function getSearchHistoryList(params) {
|
|
26
26
|
return requestCloud({
|
|
27
|
-
api:
|
|
27
|
+
api: "".concat(THING, ".m.menu.query.history.list"),
|
|
28
28
|
version: '1.0',
|
|
29
29
|
data: params
|
|
30
30
|
});
|
|
@@ -51,7 +51,7 @@ export function getSearchHistoryList(params) {
|
|
|
51
51
|
*/
|
|
52
52
|
export function deleteSearchHistory(params) {
|
|
53
53
|
return requestCloud({
|
|
54
|
-
api:
|
|
54
|
+
api: "".concat(THING, ".m.menu.query.history.delete"),
|
|
55
55
|
version: '1.0',
|
|
56
56
|
data: params
|
|
57
57
|
});
|
|
@@ -78,7 +78,7 @@ export function deleteSearchHistory(params) {
|
|
|
78
78
|
*/
|
|
79
79
|
export function cleanSearchHistory(params) {
|
|
80
80
|
return requestCloud({
|
|
81
|
-
api:
|
|
81
|
+
api: "".concat(THING, ".m.menu.query.history.clean"),
|
|
82
82
|
version: '1.0',
|
|
83
83
|
data: params
|
|
84
84
|
});
|
|
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
const _excluded = ["scoreInfo"],
|
|
4
4
|
_excluded2 = ["query"];
|
|
5
|
+
import "core-js/modules/es.json.stringify.js";
|
|
5
6
|
import { THING } from '../../constants';
|
|
6
7
|
import requestCloud from '../../requestCloud';
|
|
7
8
|
// #region 用户添加评分
|
|
@@ -31,7 +32,7 @@ export const addRecipeScore = params => {
|
|
|
31
32
|
} = params,
|
|
32
33
|
rest = _objectWithoutProperties(params, _excluded);
|
|
33
34
|
return requestCloud({
|
|
34
|
-
api:
|
|
35
|
+
api: "".concat(THING, ".m.menu.score.add"),
|
|
35
36
|
version: '1.0',
|
|
36
37
|
data: _objectSpread({
|
|
37
38
|
scoreJson: JSON.stringify(scoreInfo)
|
|
@@ -62,7 +63,7 @@ export const addRecipeScore = params => {
|
|
|
62
63
|
*/
|
|
63
64
|
export const getRecipeScoreByMenuId = params => {
|
|
64
65
|
return requestCloud({
|
|
65
|
-
api:
|
|
66
|
+
api: "".concat(THING, ".m.menu.score.get"),
|
|
66
67
|
version: '1.0',
|
|
67
68
|
data: params
|
|
68
69
|
});
|
|
@@ -95,7 +96,7 @@ export const getRecipeScoresByMenuIds = params => {
|
|
|
95
96
|
} = params,
|
|
96
97
|
rest = _objectWithoutProperties(params, _excluded2);
|
|
97
98
|
return requestCloud({
|
|
98
|
-
api:
|
|
99
|
+
api: "".concat(THING, ".m.menu.score.bat.get"),
|
|
99
100
|
version: '1.0',
|
|
100
101
|
data: _objectSpread({
|
|
101
102
|
queryJson: JSON.stringify(query)
|
package/lib/cloud/recipe/star.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
const _excluded = ["query"];
|
|
4
|
+
import "core-js/modules/es.json.stringify.js";
|
|
4
5
|
import { THING } from '../../constants';
|
|
5
6
|
import requestCloud from '../../requestCloud';
|
|
6
7
|
// #region 获取食谱收藏列表
|
|
@@ -36,7 +37,7 @@ export const getRecipeCollectionList = params => {
|
|
|
36
37
|
} = params,
|
|
37
38
|
rest = _objectWithoutProperties(params, _excluded);
|
|
38
39
|
return requestCloud({
|
|
39
|
-
api:
|
|
40
|
+
api: "".concat(THING, ".m.menu.star.list"),
|
|
40
41
|
version: '2.0',
|
|
41
42
|
data: _objectSpread({
|
|
42
43
|
queryJson: JSON.stringify(query)
|
|
@@ -65,7 +66,7 @@ export const getRecipeCollectionList = params => {
|
|
|
65
66
|
*/
|
|
66
67
|
export const addRecipeToFavorites = params => {
|
|
67
68
|
return requestCloud({
|
|
68
|
-
api:
|
|
69
|
+
api: "".concat(THING, ".m.menu.star.add"),
|
|
69
70
|
version: '1.0',
|
|
70
71
|
data: params
|
|
71
72
|
});
|
|
@@ -92,7 +93,7 @@ export const addRecipeToFavorites = params => {
|
|
|
92
93
|
*/
|
|
93
94
|
export const removeRecipeFromFavorites = params => {
|
|
94
95
|
return requestCloud({
|
|
95
|
-
api:
|
|
96
|
+
api: "".concat(THING, ".m.menu.star.delete"),
|
|
96
97
|
version: '1.0',
|
|
97
98
|
data: params
|
|
98
99
|
});
|
|
@@ -117,7 +118,7 @@ export const removeRecipeFromFavorites = params => {
|
|
|
117
118
|
*/
|
|
118
119
|
export const checkRecipeIsStarred = params => {
|
|
119
120
|
return requestCloud({
|
|
120
|
-
api:
|
|
121
|
+
api: "".concat(THING, ".m.menu.star.check"),
|
|
121
122
|
version: '1.0',
|
|
122
123
|
data: params
|
|
123
124
|
});
|
|
@@ -142,7 +143,7 @@ export const checkRecipeIsStarred = params => {
|
|
|
142
143
|
*/
|
|
143
144
|
export const getRecipeStarCount = params => {
|
|
144
145
|
return requestCloud({
|
|
145
|
-
api:
|
|
146
|
+
api: "".concat(THING, ".m.menu.star.count"),
|
|
146
147
|
version: '1.0',
|
|
147
148
|
data: params
|
|
148
149
|
});
|
package/lib/cloud/remoteGroup.js
CHANGED
|
@@ -6,7 +6,7 @@ import { THING } from '../constants';
|
|
|
6
6
|
*/
|
|
7
7
|
const getZigbeeLocalGroupRelation = params => {
|
|
8
8
|
return requestCloud({
|
|
9
|
-
api:
|
|
9
|
+
api: "".concat(THING, ".p.remote.local.relation.get"),
|
|
10
10
|
version: '1.0',
|
|
11
11
|
data: {
|
|
12
12
|
devId: params.devId,
|
|
@@ -20,7 +20,7 @@ const getZigbeeLocalGroupRelation = params => {
|
|
|
20
20
|
*/
|
|
21
21
|
const getZigbeeLocalGroupDeviceList = params => {
|
|
22
22
|
return requestCloud({
|
|
23
|
-
api:
|
|
23
|
+
api: "".concat(THING, ".m.device.group.dev.list"),
|
|
24
24
|
version: '1.0',
|
|
25
25
|
data: params,
|
|
26
26
|
extData: {
|
package/lib/cloud/statistic.js
CHANGED
|
@@ -14,7 +14,7 @@ import { THING } from '../constants';
|
|
|
14
14
|
*/
|
|
15
15
|
const getLogInSpecifiedTime = params => {
|
|
16
16
|
return requestCloud({
|
|
17
|
-
api:
|
|
17
|
+
api: "".concat(THING, ".m.smart.operate.all.log"),
|
|
18
18
|
version: '1.0',
|
|
19
19
|
data: _objectSpread({}, params)
|
|
20
20
|
});
|
|
@@ -62,7 +62,7 @@ const getLogUserAction = params => {
|
|
|
62
62
|
*/
|
|
63
63
|
const getDpLogDays = params => {
|
|
64
64
|
return requestCloud({
|
|
65
|
-
api:
|
|
65
|
+
api: "".concat(THING, ".m.dp.stat.days.list"),
|
|
66
66
|
version: '1.0',
|
|
67
67
|
data: _objectSpread({}, params)
|
|
68
68
|
});
|
|
@@ -76,7 +76,7 @@ const getDpLogDays = params => {
|
|
|
76
76
|
*/
|
|
77
77
|
const getDpResultByMonth = params => {
|
|
78
78
|
return requestCloud({
|
|
79
|
-
api:
|
|
79
|
+
api: "".concat(THING, ".m.dp.stat.month.list"),
|
|
80
80
|
version: '1.0',
|
|
81
81
|
data: _objectSpread({}, params)
|
|
82
82
|
});
|
|
@@ -93,7 +93,7 @@ const getDpResultByMonth = params => {
|
|
|
93
93
|
*/
|
|
94
94
|
const getDpResultByHour = params => {
|
|
95
95
|
return requestCloud({
|
|
96
|
-
api:
|
|
96
|
+
api: "".concat(THING, ".m.dp.rang.stat.hour.list"),
|
|
97
97
|
version: '1.0',
|
|
98
98
|
data: _objectSpread({}, params)
|
|
99
99
|
});
|
|
@@ -111,7 +111,7 @@ const getDpResultByHour = params => {
|
|
|
111
111
|
*/
|
|
112
112
|
const getDataWithSpecified = params => {
|
|
113
113
|
return requestCloud({
|
|
114
|
-
api:
|
|
114
|
+
api: "".concat(THING, ".m.dp.rang.stat.day.list"),
|
|
115
115
|
version: '2.0',
|
|
116
116
|
data: _objectSpread({}, params)
|
|
117
117
|
});
|
|
@@ -127,7 +127,7 @@ const getDataWithSpecified = params => {
|
|
|
127
127
|
*/
|
|
128
128
|
const getWeekWithSpecified = params => {
|
|
129
129
|
return requestCloud({
|
|
130
|
-
api:
|
|
130
|
+
api: "".concat(THING, ".m.dp.rang.stat.week.list"),
|
|
131
131
|
version: '1.0',
|
|
132
132
|
data: _objectSpread({}, params)
|
|
133
133
|
});
|
|
@@ -145,7 +145,7 @@ const getWeekWithSpecified = params => {
|
|
|
145
145
|
*/
|
|
146
146
|
const getMonthWithSpecified = params => {
|
|
147
147
|
return requestCloud({
|
|
148
|
-
api:
|
|
148
|
+
api: "".concat(THING, ".m.dp.rang.stat.month.list"),
|
|
149
149
|
version: '2.0',
|
|
150
150
|
data: _objectSpread({}, params)
|
|
151
151
|
});
|
|
@@ -159,7 +159,7 @@ const getMonthWithSpecified = params => {
|
|
|
159
159
|
*/
|
|
160
160
|
const getDpAllStatistResult = params => {
|
|
161
161
|
return requestCloud({
|
|
162
|
-
api:
|
|
162
|
+
api: "".concat(THING, ".m.dp.stat.total"),
|
|
163
163
|
version: '1.0',
|
|
164
164
|
data: _objectSpread({}, params)
|
|
165
165
|
});
|
|
@@ -179,7 +179,7 @@ const getDpAllStatistResult = params => {
|
|
|
179
179
|
*/
|
|
180
180
|
const getMultiDpsAllResult = params => {
|
|
181
181
|
return requestCloud({
|
|
182
|
-
api:
|
|
182
|
+
api: "".concat(THING, ".m.device.query.device.log"),
|
|
183
183
|
version: '1.0',
|
|
184
184
|
data: _objectSpread({}, params)
|
|
185
185
|
});
|
package/lib/cloud/timer.js
CHANGED
|
@@ -15,7 +15,7 @@ import { THING } from '../constants';
|
|
|
15
15
|
*/
|
|
16
16
|
const addSingleTimer = params => {
|
|
17
17
|
return requestCloud({
|
|
18
|
-
api:
|
|
18
|
+
api: "".concat(THING, ".m.clock.dps.add"),
|
|
19
19
|
version: '1.0',
|
|
20
20
|
data: _objectSpread({}, params)
|
|
21
21
|
});
|
|
@@ -29,7 +29,7 @@ const addSingleTimer = params => {
|
|
|
29
29
|
*/
|
|
30
30
|
const queryTimerTasks = params => {
|
|
31
31
|
return requestCloud({
|
|
32
|
-
api:
|
|
32
|
+
api: "".concat(THING, ".m.clock.dps.list"),
|
|
33
33
|
version: '1.0',
|
|
34
34
|
data: _objectSpread({}, params)
|
|
35
35
|
});
|
|
@@ -48,7 +48,7 @@ const queryTimerTasks = params => {
|
|
|
48
48
|
*/
|
|
49
49
|
const modifySingleTimer = params => {
|
|
50
50
|
return requestCloud({
|
|
51
|
-
api:
|
|
51
|
+
api: "".concat(THING, ".m.clock.dps.update"),
|
|
52
52
|
version: '1.0',
|
|
53
53
|
data: _objectSpread({}, params)
|
|
54
54
|
});
|
|
@@ -67,7 +67,7 @@ const modifySingleTimer = params => {
|
|
|
67
67
|
*/
|
|
68
68
|
const addGroupTimer = params => {
|
|
69
69
|
return requestCloud({
|
|
70
|
-
api:
|
|
70
|
+
api: "".concat(THING, ".m.clock.dps.group.add"),
|
|
71
71
|
version: '1.0',
|
|
72
72
|
data: _objectSpread({}, params)
|
|
73
73
|
});
|
|
@@ -81,7 +81,7 @@ const addGroupTimer = params => {
|
|
|
81
81
|
*/
|
|
82
82
|
const queryGroupTimerTasks = params => {
|
|
83
83
|
return requestCloud({
|
|
84
|
-
api:
|
|
84
|
+
api: "".concat(THING, ".m.clock.dps.group.list"),
|
|
85
85
|
version: '1.0',
|
|
86
86
|
data: _objectSpread({}, params)
|
|
87
87
|
});
|
|
@@ -99,7 +99,7 @@ const queryGroupTimerTasks = params => {
|
|
|
99
99
|
*/
|
|
100
100
|
const modifyGroupTimer = params => {
|
|
101
101
|
return requestCloud({
|
|
102
|
-
api:
|
|
102
|
+
api: "".concat(THING, ".m.clock.dps.group.update"),
|
|
103
103
|
version: '1.0',
|
|
104
104
|
data: _objectSpread({}, params)
|
|
105
105
|
});
|
|
@@ -114,7 +114,7 @@ const modifyGroupTimer = params => {
|
|
|
114
114
|
*/
|
|
115
115
|
const modDeleteTaskByIds = params => {
|
|
116
116
|
return requestCloud({
|
|
117
|
-
api:
|
|
117
|
+
api: "".concat(THING, ".m.clock.batch.status.update"),
|
|
118
118
|
version: '1.0',
|
|
119
119
|
data: _objectSpread({}, params)
|
|
120
120
|
});
|
|
@@ -129,7 +129,7 @@ const modDeleteTaskByIds = params => {
|
|
|
129
129
|
*/
|
|
130
130
|
const modDeleteTaskByCategory = params => {
|
|
131
131
|
return requestCloud({
|
|
132
|
-
api:
|
|
132
|
+
api: "".concat(THING, ".m.clock.category.status.update"),
|
|
133
133
|
version: '1.0',
|
|
134
134
|
data: _objectSpread({}, params)
|
|
135
135
|
});
|
|
@@ -170,7 +170,7 @@ const getDpsLastTimer = params => {
|
|
|
170
170
|
*/
|
|
171
171
|
const getLastTimerPeriod = params => {
|
|
172
172
|
return requestCloud({
|
|
173
|
-
api:
|
|
173
|
+
api: "".concat(THING, ".m.timer.nearest.get"),
|
|
174
174
|
version: '1.0',
|
|
175
175
|
data: _objectSpread({}, params)
|
|
176
176
|
});
|
|
@@ -181,7 +181,7 @@ const getLastTimerPeriod = params => {
|
|
|
181
181
|
*/
|
|
182
182
|
const getAstronomicalList = params => {
|
|
183
183
|
return requestCloud({
|
|
184
|
-
api:
|
|
184
|
+
api: "".concat(THING, ".m.timer.astronomical.list"),
|
|
185
185
|
version: '1.0',
|
|
186
186
|
data: _objectSpread({}, params)
|
|
187
187
|
});
|
|
@@ -203,7 +203,7 @@ const getAstronomicalList = params => {
|
|
|
203
203
|
*/
|
|
204
204
|
const addAstronomical = params => {
|
|
205
205
|
return requestCloud({
|
|
206
|
-
api:
|
|
206
|
+
api: "".concat(THING, ".m.timer.astronomical.add"),
|
|
207
207
|
version: '1.0',
|
|
208
208
|
data: _objectSpread({}, params)
|
|
209
209
|
});
|
|
@@ -225,7 +225,7 @@ const addAstronomical = params => {
|
|
|
225
225
|
*/
|
|
226
226
|
const updateAstronomical = params => {
|
|
227
227
|
return requestCloud({
|
|
228
|
-
api:
|
|
228
|
+
api: "".concat(THING, ".m.timer.astronomical.update"),
|
|
229
229
|
version: '1.0',
|
|
230
230
|
data: _objectSpread({}, params)
|
|
231
231
|
});
|
|
@@ -238,7 +238,7 @@ const updateAstronomical = params => {
|
|
|
238
238
|
*/
|
|
239
239
|
const updateAstronomicalStatus = params => {
|
|
240
240
|
return requestCloud({
|
|
241
|
-
api:
|
|
241
|
+
api: "".concat(THING, ".m.timer.astronomical.status.update"),
|
|
242
242
|
version: '1.0',
|
|
243
243
|
data: _objectSpread({}, params)
|
|
244
244
|
});
|
|
@@ -250,7 +250,7 @@ const updateAstronomicalStatus = params => {
|
|
|
250
250
|
*/
|
|
251
251
|
const removeAstronomical = params => {
|
|
252
252
|
return requestCloud({
|
|
253
|
-
api:
|
|
253
|
+
api: "".concat(THING, ".m.timer.astronomical.remove"),
|
|
254
254
|
version: '1.0',
|
|
255
255
|
data: _objectSpread({}, params)
|
|
256
256
|
});
|
package/lib/getCdnUrl/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ interface IImageProcessOptions {
|
|
|
25
25
|
* @param path - 图片路径
|
|
26
26
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
27
27
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
28
|
+
* @param process - 图片处理参数对象
|
|
28
29
|
* @returns CDN 完整地址
|
|
29
30
|
*/
|
|
30
31
|
export default function getCdnUrl(path: string, cdnMap?: ICdnMap, region?: IRegionCode, process?: IImageProcessOptions): string;
|
package/lib/getCdnUrl/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export declare function getRegionCode(): Promise<IRegionCode>;
|
|
|
26
26
|
* @param path - 图片路径
|
|
27
27
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
28
28
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
29
|
-
* @param process -
|
|
29
|
+
* @param process - 图片处理参数对象
|
|
30
30
|
* @returns CDN 完整地址
|
|
31
31
|
*/
|
|
32
32
|
export default function getCdnUrl(path: string, cdnMap?: ICdnMap, region?: IRegionCode, process?: IImageProcessOptions): string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
2
|
+
import "core-js/modules/es.string.replace.js";
|
|
1
3
|
import get from 'lodash/get';
|
|
2
4
|
const regionMap = {
|
|
3
5
|
AY: 'https://images.tuyacn.com',
|
|
@@ -12,6 +14,8 @@ const regionMap = {
|
|
|
12
14
|
|
|
13
15
|
// 国外有处理参数时统一使用该域名
|
|
14
16
|
const unifiedProcessDomain = 'https://d395y9yyizm1zb.cdn5th.com';
|
|
17
|
+
// 西欧区不接受 aws 相关服务,有处理参数时使用该域名
|
|
18
|
+
const weProcessDomain = 'https://weimagedq8qoz7.cdn5th.com';
|
|
15
19
|
let _globalRegionCode;
|
|
16
20
|
const getInternalRegionCode = () => {
|
|
17
21
|
if (!_globalRegionCode) {
|
|
@@ -46,9 +50,9 @@ export function getRegionCode() {
|
|
|
46
50
|
const concatRegionOrigin = (regionCode, path) => {
|
|
47
51
|
const regionOrigin = get(regionMap, [regionCode]) || get(regionMap, ['EU']);
|
|
48
52
|
if (path.indexOf('/') === 0) {
|
|
49
|
-
return
|
|
53
|
+
return "".concat(regionOrigin).concat(path);
|
|
50
54
|
}
|
|
51
|
-
return
|
|
55
|
+
return "".concat(regionOrigin, "/").concat(path);
|
|
52
56
|
};
|
|
53
57
|
const isEmptyOrUndefined = obj => {
|
|
54
58
|
return !obj || Object.keys(obj).length === 0;
|
|
@@ -66,10 +70,10 @@ const buildOperationChain = opts => {
|
|
|
66
70
|
y
|
|
67
71
|
} = opts.crop;
|
|
68
72
|
const cropParts = ['crop'];
|
|
69
|
-
if (w != null) cropParts.push(
|
|
70
|
-
if (h != null) cropParts.push(
|
|
71
|
-
if (x != null) cropParts.push(
|
|
72
|
-
if (y != null) cropParts.push(
|
|
73
|
+
if (w != null) cropParts.push("w_".concat(w));
|
|
74
|
+
if (h != null) cropParts.push("h_".concat(h));
|
|
75
|
+
if (x != null) cropParts.push("x_".concat(x));
|
|
76
|
+
if (y != null) cropParts.push("y_".concat(y));
|
|
73
77
|
seg.push(cropParts.join(','));
|
|
74
78
|
}
|
|
75
79
|
if (opts.resize && !isEmptyOrUndefined(opts.resize)) {
|
|
@@ -78,15 +82,15 @@ const buildOperationChain = opts => {
|
|
|
78
82
|
h
|
|
79
83
|
} = opts.resize;
|
|
80
84
|
const resizeParts = ['resize'];
|
|
81
|
-
if (w != null) resizeParts.push(
|
|
82
|
-
if (h != null) resizeParts.push(
|
|
85
|
+
if (w != null) resizeParts.push("w_".concat(w));
|
|
86
|
+
if (h != null) resizeParts.push("h_".concat(h));
|
|
83
87
|
seg.push(resizeParts.join(','));
|
|
84
88
|
}
|
|
85
89
|
if (opts.rotate && opts.rotate.value) {
|
|
86
|
-
seg.push(
|
|
90
|
+
seg.push("rotate,".concat(opts.rotate.value));
|
|
87
91
|
}
|
|
88
92
|
if (opts.format && opts.format.value) {
|
|
89
|
-
seg.push(
|
|
93
|
+
seg.push("format,".concat(opts.format.value));
|
|
90
94
|
}
|
|
91
95
|
if (seg.length === 1) return '';
|
|
92
96
|
return seg.join('/');
|
|
@@ -98,12 +102,12 @@ const buildProcessQuery = (regionCode, opts) => {
|
|
|
98
102
|
const chain = buildOperationChain(opts);
|
|
99
103
|
if (!chain) return '';
|
|
100
104
|
const key = regionCode === 'AY' ? 'x-oss-process' : 'process';
|
|
101
|
-
return
|
|
105
|
+
return "".concat(key, "=").concat(chain);
|
|
102
106
|
};
|
|
103
107
|
const appendQuery = (url, query) => {
|
|
104
108
|
if (!query) return url;
|
|
105
|
-
if (url.indexOf('?') === -1) return
|
|
106
|
-
return url.endsWith('?') || url.endsWith('&') ?
|
|
109
|
+
if (url.indexOf('?') === -1) return "".concat(url, "?").concat(query);
|
|
110
|
+
return url.endsWith('?') || url.endsWith('&') ? "".concat(url).concat(query) : "".concat(url, "&").concat(query);
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
/**
|
|
@@ -113,16 +117,17 @@ const appendQuery = (url, query) => {
|
|
|
113
117
|
* @param path - 图片路径
|
|
114
118
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
115
119
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
116
|
-
* @param process -
|
|
120
|
+
* @param process - 图片处理参数对象
|
|
117
121
|
* @returns CDN 完整地址
|
|
118
122
|
*/
|
|
119
123
|
export default function getCdnUrl(path, cdnMap, region, process) {
|
|
120
124
|
const regionCode = region || getInternalRegionCode();
|
|
121
125
|
const hasProcess = !!process && !isEmptyOrUndefined(process);
|
|
122
126
|
const queryPart = buildProcessQuery(regionCode, process);
|
|
127
|
+
const processDomain = regionCode === 'WE' ? weProcessDomain : unifiedProcessDomain;
|
|
123
128
|
if (isEmptyOrUndefined(cdnMap)) {
|
|
124
129
|
if (hasProcess && regionCode !== 'AY') {
|
|
125
|
-
const url = path.indexOf('/') === 0 ?
|
|
130
|
+
const url = path.indexOf('/') === 0 ? "".concat(processDomain).concat(path) : "".concat(processDomain, "/").concat(path);
|
|
126
131
|
return appendQuery(url, queryPart);
|
|
127
132
|
}
|
|
128
133
|
return appendQuery(concatRegionOrigin(regionCode, path), queryPart);
|
|
@@ -131,9 +136,9 @@ export default function getCdnUrl(path, cdnMap, region, process) {
|
|
|
131
136
|
// 总是使用 EU 进行兜底
|
|
132
137
|
const cdnShortPath = get(cdnMap, [regionCode, path]) || get(cdnMap, ['EU', path]) || get(cdnMap, [path]);
|
|
133
138
|
if (!cdnShortPath) {
|
|
134
|
-
console.warn(
|
|
139
|
+
console.warn("[App] cdn \"".concat(path, "\" is not exist."));
|
|
135
140
|
if (hasProcess && regionCode !== 'AY') {
|
|
136
|
-
const url = path.indexOf('/') === 0 ?
|
|
141
|
+
const url = path.indexOf('/') === 0 ? "".concat(processDomain).concat(path) : "".concat(processDomain, "/").concat(path);
|
|
137
142
|
return appendQuery(url, queryPart);
|
|
138
143
|
}
|
|
139
144
|
return appendQuery(path, queryPart);
|
|
@@ -142,14 +147,14 @@ export default function getCdnUrl(path, cdnMap, region, process) {
|
|
|
142
147
|
if (cdnShortPath.indexOf('http') === 0 || cdnShortPath.indexOf('//') === 0) {
|
|
143
148
|
finalUrl = cdnShortPath;
|
|
144
149
|
} else if (cdnShortPath.indexOf('/') === 0) {
|
|
145
|
-
finalUrl =
|
|
150
|
+
finalUrl = "".concat(regionMap[regionCode]).concat(cdnShortPath);
|
|
146
151
|
} else {
|
|
147
|
-
finalUrl =
|
|
152
|
+
finalUrl = "".concat(regionMap[regionCode], "/").concat(cdnShortPath);
|
|
148
153
|
}
|
|
149
154
|
if (hasProcess && regionCode !== 'AY') {
|
|
150
155
|
const originPrefix = regionMap[regionCode];
|
|
151
156
|
if (finalUrl.startsWith(originPrefix)) {
|
|
152
|
-
finalUrl = finalUrl.replace(originPrefix,
|
|
157
|
+
finalUrl = finalUrl.replace(originPrefix, processDomain);
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
return appendQuery(finalUrl, queryPart);
|
|
@@ -5,9 +5,9 @@ const regionMap = {
|
|
|
5
5
|
const concatRegionOrigin = (regionCode, path) => {
|
|
6
6
|
const regionOrigin = get(regionMap, [regionCode]) || get(regionMap, ['EU']);
|
|
7
7
|
if (path.indexOf('/') === 0) {
|
|
8
|
-
return
|
|
8
|
+
return "".concat(regionOrigin).concat(path);
|
|
9
9
|
}
|
|
10
|
-
return
|
|
10
|
+
return "".concat(regionOrigin, "/").concat(path);
|
|
11
11
|
};
|
|
12
12
|
const isEmptyOrUndefined = obj => {
|
|
13
13
|
return !obj || Object.keys(obj).length === 0;
|
|
@@ -32,16 +32,16 @@ export default function getCdnUrl(path, cdnMap) {
|
|
|
32
32
|
// 总是使用 EU 进行兜底
|
|
33
33
|
const cdnShortPath = get(cdnMap, [regionCode, path]) || get(cdnMap, ['AY', path]) || get(cdnMap, [path]);
|
|
34
34
|
if (!cdnShortPath) {
|
|
35
|
-
console.warn(
|
|
35
|
+
console.warn("[App] cdn \"".concat(path, "\" is not exist."));
|
|
36
36
|
return path;
|
|
37
37
|
}
|
|
38
38
|
if (cdnShortPath.indexOf('http') === 0 || cdnShortPath.indexOf('//') === 0) {
|
|
39
39
|
return cdnShortPath;
|
|
40
40
|
}
|
|
41
41
|
if (cdnShortPath.indexOf('/') === 0) {
|
|
42
|
-
return
|
|
42
|
+
return "".concat(regionMap[regionCode]).concat(cdnShortPath);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return "".concat(regionMap[regionCode], "/").concat(cdnShortPath);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|