@ray-js/api 1.4.31 → 1.4.33
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/cloud/interface.d.ts +8 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/nativeRouters/device.d.ts +80 -0
- package/lib/nativeRouters/device.js +163 -0
- package/lib/nativeRouters/index.d.ts +2 -1
- package/lib/nativeRouters/index.js +3 -2
- package/lib/nativeRouters/outdoors.d.ts +3 -3
- package/lib/nativeRouters/outdoors.js +33 -35
- package/lib/nativeRouters/root.d.ts +23 -0
- package/lib/nativeRouters/root.js +36 -0
- package/lib/utils.d.ts +3 -1
- package/lib/utils.js +17 -13
- package/package.json +7 -6
- package/lib/nativeRouters/scene.d.ts +0 -34
- package/lib/nativeRouters/scene.js +0 -60
package/lib/cloud/interface.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
type OpenSceneCreateParams = {
|
2
|
+
devId?: string;
|
3
|
+
success?: () => void;
|
4
|
+
fail?: (err?: {
|
5
|
+
errorMsg: string;
|
6
|
+
errorCode: string | number;
|
7
|
+
innerError: {
|
8
|
+
errorCode: string | number;
|
9
|
+
errorMsg: string;
|
10
|
+
};
|
11
|
+
}) => void;
|
12
|
+
complete?: () => void;
|
13
|
+
} & {
|
14
|
+
[key: string]: string | boolean | number;
|
15
|
+
};
|
16
|
+
export declare function openSceneCreate(params?: OpenSceneCreateParams): Promise<void>;
|
17
|
+
export declare const openCreateScene: typeof openSceneCreate;
|
18
|
+
export declare function openUniversalCreateScene(params?: OpenSceneCreateParams): Promise<void>;
|
19
|
+
type OpenSceneEdit = {
|
20
|
+
devId?: string;
|
21
|
+
sceneId?: string;
|
22
|
+
success?: () => void;
|
23
|
+
fail?: (err?: {
|
24
|
+
errorMsg: string;
|
25
|
+
errorCode: string | number;
|
26
|
+
innerError: {
|
27
|
+
errorCode: string | number;
|
28
|
+
errorMsg: string;
|
29
|
+
};
|
30
|
+
}) => void;
|
31
|
+
complete?: () => void;
|
32
|
+
} & {
|
33
|
+
[key: string]: string | boolean | number;
|
34
|
+
};
|
35
|
+
export declare function openSceneEdit(params?: OpenSceneEdit): Promise<void>;
|
36
|
+
export declare const openEditScene: typeof openSceneEdit;
|
37
|
+
type OpenGuideScene = {
|
38
|
+
action?: 'add' | 'edit';
|
39
|
+
success?: () => void;
|
40
|
+
fail?: (err?: {
|
41
|
+
errorMsg: string;
|
42
|
+
errorCode: string | number;
|
43
|
+
innerError: {
|
44
|
+
errorCode: string | number;
|
45
|
+
errorMsg: string;
|
46
|
+
};
|
47
|
+
}) => void;
|
48
|
+
complete?: () => void;
|
49
|
+
} & {
|
50
|
+
[key: string]: string | boolean | number;
|
51
|
+
};
|
52
|
+
/**
|
53
|
+
* 打开APP引导场景页
|
54
|
+
* @param params { action?: 'add' | 'edit', success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
|
55
|
+
* @returns
|
56
|
+
*/
|
57
|
+
export declare function openGuideScene(params?: OpenGuideScene): Promise<void>;
|
58
|
+
type OpenConfigDevice = {
|
59
|
+
devId?: string;
|
60
|
+
sceneId?: string;
|
61
|
+
success?: () => void;
|
62
|
+
fail?: (err?: {
|
63
|
+
errorMsg: string;
|
64
|
+
errorCode: string | number;
|
65
|
+
innerError: {
|
66
|
+
errorCode: string | number;
|
67
|
+
errorMsg: string;
|
68
|
+
};
|
69
|
+
}) => void;
|
70
|
+
complete?: () => void;
|
71
|
+
} & {
|
72
|
+
[key: string]: string | boolean | number;
|
73
|
+
};
|
74
|
+
/**
|
75
|
+
* 打开编辑场景页面
|
76
|
+
* @param params { devId?: string, sceneId?: string, success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
|
77
|
+
* @returns
|
78
|
+
*/
|
79
|
+
export declare function openConfigDevice(params?: OpenConfigDevice): Promise<void>;
|
80
|
+
export {};
|
@@ -0,0 +1,163 @@
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
const _excluded = ["success", "fail", "complete"],
|
3
|
+
_excluded2 = ["success", "fail", "complete"],
|
4
|
+
_excluded3 = ["success", "fail", "complete"],
|
5
|
+
_excluded4 = ["success", "fail", "complete"],
|
6
|
+
_excluded5 = ["success", "fail", "complete"];
|
7
|
+
import { isAndroid } from '@ray-js/env';
|
8
|
+
import { stringifyUrl } from '../utils';
|
9
|
+
export function openSceneCreate(params) {
|
10
|
+
const _ref = params || {},
|
11
|
+
{
|
12
|
+
success,
|
13
|
+
fail,
|
14
|
+
complete
|
15
|
+
} = _ref,
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
17
|
+
return new Promise((resolve, reject) => {
|
18
|
+
ty.router({
|
19
|
+
url: stringifyUrl({
|
20
|
+
url: 'createScene',
|
21
|
+
query: rest
|
22
|
+
}),
|
23
|
+
success() {
|
24
|
+
success === null || success === void 0 ? void 0 : success();
|
25
|
+
resolve();
|
26
|
+
},
|
27
|
+
fail(err) {
|
28
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
29
|
+
reject(err);
|
30
|
+
},
|
31
|
+
complete() {
|
32
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
33
|
+
}
|
34
|
+
});
|
35
|
+
});
|
36
|
+
}
|
37
|
+
export const openCreateScene = openSceneCreate;
|
38
|
+
|
39
|
+
// 兼容Android 端仅支持 Zigbee 本地场景, Android使用createSmartScene
|
40
|
+
export function openUniversalCreateScene(params) {
|
41
|
+
const _ref2 = params || {},
|
42
|
+
{
|
43
|
+
success,
|
44
|
+
fail,
|
45
|
+
complete
|
46
|
+
} = _ref2,
|
47
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
48
|
+
const url = isAndroid ? 'createSmartScene' : 'createScene';
|
49
|
+
return new Promise((resolve, reject) => {
|
50
|
+
ty.router({
|
51
|
+
url: stringifyUrl({
|
52
|
+
url,
|
53
|
+
query: rest
|
54
|
+
}),
|
55
|
+
success() {
|
56
|
+
success === null || success === void 0 ? void 0 : success();
|
57
|
+
resolve();
|
58
|
+
},
|
59
|
+
fail(err) {
|
60
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
61
|
+
reject(err);
|
62
|
+
},
|
63
|
+
complete() {
|
64
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
65
|
+
}
|
66
|
+
});
|
67
|
+
});
|
68
|
+
}
|
69
|
+
export function openSceneEdit(params) {
|
70
|
+
const _ref3 = params || {},
|
71
|
+
{
|
72
|
+
success,
|
73
|
+
fail,
|
74
|
+
complete
|
75
|
+
} = _ref3,
|
76
|
+
rest = _objectWithoutProperties(_ref3, _excluded3);
|
77
|
+
return new Promise((resolve, reject) => {
|
78
|
+
ty.router({
|
79
|
+
url: stringifyUrl({
|
80
|
+
url: 'editScene',
|
81
|
+
query: rest
|
82
|
+
}),
|
83
|
+
success() {
|
84
|
+
success === null || success === void 0 ? void 0 : success();
|
85
|
+
resolve();
|
86
|
+
},
|
87
|
+
fail(err) {
|
88
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
89
|
+
reject(err);
|
90
|
+
},
|
91
|
+
complete() {
|
92
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
}
|
97
|
+
export const openEditScene = openSceneEdit;
|
98
|
+
/**
|
99
|
+
* 打开APP引导场景页
|
100
|
+
* @param params { action?: 'add' | 'edit', success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
|
101
|
+
* @returns
|
102
|
+
*/
|
103
|
+
export function openGuideScene(params) {
|
104
|
+
const _ref4 = params || {},
|
105
|
+
{
|
106
|
+
success,
|
107
|
+
fail,
|
108
|
+
complete
|
109
|
+
} = _ref4,
|
110
|
+
rest = _objectWithoutProperties(_ref4, _excluded4);
|
111
|
+
return new Promise((resolve, reject) => {
|
112
|
+
ty.router({
|
113
|
+
url: stringifyUrl({
|
114
|
+
url: 'thing_add_scene',
|
115
|
+
query: rest
|
116
|
+
}),
|
117
|
+
success() {
|
118
|
+
success === null || success === void 0 ? void 0 : success();
|
119
|
+
resolve();
|
120
|
+
},
|
121
|
+
fail(err) {
|
122
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
123
|
+
reject(err);
|
124
|
+
},
|
125
|
+
complete() {
|
126
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
127
|
+
}
|
128
|
+
});
|
129
|
+
});
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* 打开编辑场景页面
|
133
|
+
* @param params { devId?: string, sceneId?: string, success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
|
134
|
+
* @returns
|
135
|
+
*/
|
136
|
+
export function openConfigDevice(params) {
|
137
|
+
const _ref5 = params || {},
|
138
|
+
{
|
139
|
+
success,
|
140
|
+
fail,
|
141
|
+
complete
|
142
|
+
} = _ref5,
|
143
|
+
rest = _objectWithoutProperties(_ref5, _excluded5);
|
144
|
+
return new Promise((resolve, reject) => {
|
145
|
+
ty.router({
|
146
|
+
url: stringifyUrl({
|
147
|
+
url: 'config_device',
|
148
|
+
query: rest
|
149
|
+
}),
|
150
|
+
success() {
|
151
|
+
success === null || success === void 0 ? void 0 : success();
|
152
|
+
resolve();
|
153
|
+
},
|
154
|
+
fail(err) {
|
155
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
156
|
+
reject(err);
|
157
|
+
},
|
158
|
+
complete() {
|
159
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
160
|
+
}
|
161
|
+
});
|
162
|
+
});
|
163
|
+
}
|
@@ -1,2 +1,3 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './outdoors';
|
1
|
+
export * from './device';
|
2
|
+
export * from './outdoors';
|
3
|
+
export * from './root';
|
@@ -18,7 +18,7 @@ type OpenOutdoorCyclingNavigationParams = {
|
|
18
18
|
* @param params {devId: string}
|
19
19
|
* @returns
|
20
20
|
*/
|
21
|
-
export declare function openOutdoorCyclingNavigation(params
|
21
|
+
export declare function openOutdoorCyclingNavigation(params?: OpenOutdoorCyclingNavigationParams): Promise<void>;
|
22
22
|
type OpenAdditionalUnlockMethodsParams = {
|
23
23
|
devId?: string;
|
24
24
|
success?: () => void;
|
@@ -60,7 +60,7 @@ type OpenOutdoorAmbientLightingParams = {
|
|
60
60
|
* @param params {devId: string}
|
61
61
|
* @returns
|
62
62
|
*/
|
63
|
-
export declare function openOutdoorAmbientLighting(params
|
63
|
+
export declare function openOutdoorAmbientLighting(params?: OpenOutdoorAmbientLightingParams): Promise<void>;
|
64
64
|
type OpenOutdoorShortcutSiriParams = {
|
65
65
|
devId?: string;
|
66
66
|
success?: () => void;
|
@@ -102,5 +102,5 @@ type OpenOutdoorConfigDeviceHomeParams = {
|
|
102
102
|
* @param params {devId: string}
|
103
103
|
* @returns
|
104
104
|
*/
|
105
|
-
export declare function openOutdoorConfigDeviceHome(params
|
105
|
+
export declare function openOutdoorConfigDeviceHome(params?: OpenOutdoorConfigDeviceHomeParams): Promise<void>;
|
106
106
|
export {};
|
@@ -4,26 +4,26 @@ const _excluded = ["success", "fail", "complete"],
|
|
4
4
|
_excluded3 = ["success", "fail", "complete"],
|
5
5
|
_excluded4 = ["success", "fail", "complete"],
|
6
6
|
_excluded5 = ["success", "fail", "complete"];
|
7
|
-
import {
|
7
|
+
import { stringifyUrl } from '../utils';
|
8
8
|
/**
|
9
9
|
* 打开骑行导航页面
|
10
10
|
* @param params {devId: string}
|
11
11
|
* @returns
|
12
12
|
*/
|
13
13
|
export function openOutdoorCyclingNavigation(params) {
|
14
|
-
const {
|
14
|
+
const _ref = params || {},
|
15
|
+
{
|
15
16
|
success,
|
16
17
|
fail,
|
17
18
|
complete
|
18
|
-
} =
|
19
|
-
rest = _objectWithoutProperties(
|
20
|
-
let paramsStr = '';
|
21
|
-
if (Object.keys(rest).length > 0) {
|
22
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
23
|
-
}
|
19
|
+
} = _ref,
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
24
21
|
return new Promise((resolve, reject) => {
|
25
22
|
ty.router({
|
26
|
-
url:
|
23
|
+
url: stringifyUrl({
|
24
|
+
url: 'tsod_outdoor_cycling_navigation',
|
25
|
+
query: rest
|
26
|
+
}),
|
27
27
|
success() {
|
28
28
|
success === null || success === void 0 ? void 0 : success();
|
29
29
|
resolve();
|
@@ -50,13 +50,12 @@ export function openAdditionalUnlockMethods(params) {
|
|
50
50
|
complete
|
51
51
|
} = params,
|
52
52
|
rest = _objectWithoutProperties(params, _excluded2);
|
53
|
-
let paramsStr = '';
|
54
|
-
if (Object.keys(rest).length > 0) {
|
55
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
56
|
-
}
|
57
53
|
return new Promise((resolve, reject) => {
|
58
54
|
ty.router({
|
59
|
-
url:
|
55
|
+
url: stringifyUrl({
|
56
|
+
url: 'tsod_additional_unlock_methods',
|
57
|
+
query: rest
|
58
|
+
}),
|
60
59
|
success() {
|
61
60
|
success === null || success === void 0 ? void 0 : success();
|
62
61
|
resolve();
|
@@ -77,19 +76,19 @@ export function openAdditionalUnlockMethods(params) {
|
|
77
76
|
* @returns
|
78
77
|
*/
|
79
78
|
export function openOutdoorAmbientLighting(params) {
|
80
|
-
const {
|
79
|
+
const _ref2 = params || {},
|
80
|
+
{
|
81
81
|
success,
|
82
82
|
fail,
|
83
83
|
complete
|
84
|
-
} =
|
85
|
-
rest = _objectWithoutProperties(
|
86
|
-
let paramsStr = '';
|
87
|
-
if (Object.keys(rest).length > 0) {
|
88
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
89
|
-
}
|
84
|
+
} = _ref2,
|
85
|
+
rest = _objectWithoutProperties(_ref2, _excluded3);
|
90
86
|
return new Promise((resolve, reject) => {
|
91
87
|
ty.router({
|
92
|
-
url:
|
88
|
+
url: stringifyUrl({
|
89
|
+
url: 'tsod_outdoor_ambient_lighting',
|
90
|
+
query: rest
|
91
|
+
}),
|
93
92
|
success() {
|
94
93
|
success === null || success === void 0 ? void 0 : success();
|
95
94
|
resolve();
|
@@ -116,13 +115,12 @@ export function openOutdoorShortcutSiri(params) {
|
|
116
115
|
complete
|
117
116
|
} = params,
|
118
117
|
rest = _objectWithoutProperties(params, _excluded4);
|
119
|
-
let paramsStr = '';
|
120
|
-
if (Object.keys(rest).length > 0) {
|
121
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
122
|
-
}
|
123
118
|
return new Promise((resolve, reject) => {
|
124
119
|
ty.router({
|
125
|
-
url:
|
120
|
+
url: stringifyUrl({
|
121
|
+
url: 'tsod_outdoor_shortcut_siri',
|
122
|
+
query: rest
|
123
|
+
}),
|
126
124
|
success() {
|
127
125
|
success === null || success === void 0 ? void 0 : success();
|
128
126
|
resolve();
|
@@ -143,19 +141,19 @@ export function openOutdoorShortcutSiri(params) {
|
|
143
141
|
* @returns
|
144
142
|
*/
|
145
143
|
export function openOutdoorConfigDeviceHome(params) {
|
146
|
-
const {
|
144
|
+
const _ref3 = params || {},
|
145
|
+
{
|
147
146
|
success,
|
148
147
|
fail,
|
149
148
|
complete
|
150
|
-
} =
|
151
|
-
rest = _objectWithoutProperties(
|
152
|
-
let paramsStr = '';
|
153
|
-
if (Object.keys(rest).length > 0) {
|
154
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
155
|
-
}
|
149
|
+
} = _ref3,
|
150
|
+
rest = _objectWithoutProperties(_ref3, _excluded5);
|
156
151
|
return new Promise((resolve, reject) => {
|
157
152
|
ty.router({
|
158
|
-
url:
|
153
|
+
url: stringifyUrl({
|
154
|
+
url: 'tsod_outdoor_config_device_home',
|
155
|
+
query: rest
|
156
|
+
}),
|
159
157
|
success() {
|
160
158
|
success === null || success === void 0 ? void 0 : success();
|
161
159
|
resolve();
|
@@ -0,0 +1,23 @@
|
|
1
|
+
type OpenAppScanParams = {
|
2
|
+
gwId?: string;
|
3
|
+
source?: string;
|
4
|
+
success?: () => void;
|
5
|
+
fail?: (err?: {
|
6
|
+
errorMsg: string;
|
7
|
+
errorCode: string | number;
|
8
|
+
innerError: {
|
9
|
+
errorCode: string | number;
|
10
|
+
errorMsg: string;
|
11
|
+
};
|
12
|
+
}) => void;
|
13
|
+
complete?: () => void;
|
14
|
+
} & {
|
15
|
+
[key: string]: string | boolean | number;
|
16
|
+
};
|
17
|
+
/**
|
18
|
+
* 打开APP扫码
|
19
|
+
* @param params {gwId: string, source: string}
|
20
|
+
* @returns
|
21
|
+
*/
|
22
|
+
export declare function openAppScan(params?: OpenAppScanParams): Promise<void>;
|
23
|
+
export {};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
const _excluded = ["success", "fail", "complete"];
|
3
|
+
import { stringifyUrl } from '../utils';
|
4
|
+
/**
|
5
|
+
* 打开APP扫码
|
6
|
+
* @param params {gwId: string, source: string}
|
7
|
+
* @returns
|
8
|
+
*/
|
9
|
+
export function openAppScan(params) {
|
10
|
+
const _ref = params || {},
|
11
|
+
{
|
12
|
+
success,
|
13
|
+
fail,
|
14
|
+
complete
|
15
|
+
} = _ref,
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
17
|
+
return new Promise((resolve, reject) => {
|
18
|
+
ty.router({
|
19
|
+
url: stringifyUrl({
|
20
|
+
url: 'scan',
|
21
|
+
query: rest
|
22
|
+
}),
|
23
|
+
success() {
|
24
|
+
success === null || success === void 0 ? void 0 : success();
|
25
|
+
resolve();
|
26
|
+
},
|
27
|
+
fail(err) {
|
28
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
29
|
+
reject(err);
|
30
|
+
},
|
31
|
+
complete() {
|
32
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
33
|
+
}
|
34
|
+
});
|
35
|
+
});
|
36
|
+
}
|
package/lib/utils.d.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
import { UrlObject } from 'query-string';
|
1
2
|
type Opts = {
|
2
3
|
deprecated?: boolean;
|
3
4
|
namespace?: string;
|
4
5
|
};
|
5
6
|
export declare function factory(name: string, opts?: Opts): () => any;
|
6
7
|
export declare function factoryContants(name: string, opts?: Opts): any;
|
7
|
-
export declare
|
8
|
+
export declare const parseUrl: (url: string) => import("query-string").ParsedUrl;
|
9
|
+
export declare const stringifyUrl: (object: UrlObject) => string;
|
8
10
|
export {};
|
package/lib/utils.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { stringifyUrl as _stringifyUrl, parseUrl as _parseUrl } from 'query-string';
|
1
2
|
export function factory(name) {
|
2
3
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3
4
|
return function () {
|
@@ -11,6 +12,7 @@ export function factory(name) {
|
|
11
12
|
console.warn(`// TODO 暂未实现方法 ${opts.namespace ? opts.namespace + '.' : ''}${name}`);
|
12
13
|
return;
|
13
14
|
}
|
15
|
+
// eslint-disable-next-line prefer-rest-params
|
14
16
|
return method.apply(this, arguments);
|
15
17
|
};
|
16
18
|
}
|
@@ -26,16 +28,18 @@ export function factoryContants(name) {
|
|
26
28
|
}
|
27
29
|
return inst[name];
|
28
30
|
}
|
29
|
-
export
|
30
|
-
|
31
|
-
|
32
|
-
//
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
export const parseUrl = url => {
|
32
|
+
return _parseUrl(url, {
|
33
|
+
arrayFormat: 'bracket',
|
34
|
+
// WARN: 这里的参数与微信不一致, 但是无法进行修改了, 存量的项目已经在使用
|
35
|
+
// 例如 url=encodeURIComponent('https://www.baidu.com?name=1&age=2') 在微信中不会进行 decode
|
36
|
+
// 而在涂鸦小程序上会进行 decode, 这里是需要注意的地方
|
37
|
+
decode: true
|
38
|
+
});
|
39
|
+
};
|
40
|
+
export const stringifyUrl = object => {
|
41
|
+
return _stringifyUrl(object, {
|
42
|
+
arrayFormat: 'bracket',
|
43
|
+
encode: true
|
44
|
+
});
|
45
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.33",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -29,13 +29,14 @@
|
|
29
29
|
"watch": "ray start --type=component"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@ray-js/framework": "1.4.
|
33
|
-
"@ray-js/router": "1.4.
|
32
|
+
"@ray-js/framework": "1.4.33",
|
33
|
+
"@ray-js/router": "1.4.33",
|
34
34
|
"@ray-js/wechat": "^0.0.33",
|
35
|
-
"base64-browser": "^1.0.1"
|
35
|
+
"base64-browser": "^1.0.1",
|
36
|
+
"query-string": "^7.1.3"
|
36
37
|
},
|
37
38
|
"devDependencies": {
|
38
|
-
"@ray-js/cli": "1.4.
|
39
|
+
"@ray-js/cli": "1.4.33",
|
39
40
|
"art-template": "^4.13.2",
|
40
41
|
"fs-extra": "^10.1.0",
|
41
42
|
"miniprogram-api-typings": "^3.12.2",
|
@@ -45,5 +46,5 @@
|
|
45
46
|
"access": "public",
|
46
47
|
"registry": "https://registry.npmjs.org"
|
47
48
|
},
|
48
|
-
"gitHead": "
|
49
|
+
"gitHead": "04fc26f4934f4deef7a711d9a9ade026ec265eca"
|
49
50
|
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
type OpenSceneCreateParams = {
|
2
|
-
devId?: string;
|
3
|
-
success?: () => void;
|
4
|
-
fail?: (err?: {
|
5
|
-
errorMsg: string;
|
6
|
-
errorCode: string | number;
|
7
|
-
innerError: {
|
8
|
-
errorCode: string | number;
|
9
|
-
errorMsg: string;
|
10
|
-
};
|
11
|
-
}) => void;
|
12
|
-
complete?: () => void;
|
13
|
-
} & {
|
14
|
-
[key: string]: string | boolean | number;
|
15
|
-
};
|
16
|
-
export declare function openSceneCreate(params: OpenSceneCreateParams): Promise<void>;
|
17
|
-
type OpenSceneEdit = {
|
18
|
-
devId?: string;
|
19
|
-
sceneId?: string;
|
20
|
-
success?: () => void;
|
21
|
-
fail?: (err?: {
|
22
|
-
errorMsg: string;
|
23
|
-
errorCode: string | number;
|
24
|
-
innerError: {
|
25
|
-
errorCode: string | number;
|
26
|
-
errorMsg: string;
|
27
|
-
};
|
28
|
-
}) => void;
|
29
|
-
complete?: () => void;
|
30
|
-
} & {
|
31
|
-
[key: string]: string | boolean | number;
|
32
|
-
};
|
33
|
-
export declare function openSceneEdit(params: OpenSceneEdit): Promise<void>;
|
34
|
-
export {};
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
-
const _excluded = ["success", "fail", "complete"],
|
3
|
-
_excluded2 = ["success", "fail", "complete"];
|
4
|
-
import { objectToUrlParams } from '../utils';
|
5
|
-
export function openSceneCreate(params) {
|
6
|
-
const {
|
7
|
-
success,
|
8
|
-
fail,
|
9
|
-
complete
|
10
|
-
} = params,
|
11
|
-
rest = _objectWithoutProperties(params, _excluded);
|
12
|
-
let paramsStr = '';
|
13
|
-
if (Object.keys(rest).length > 0) {
|
14
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
15
|
-
}
|
16
|
-
return new Promise((resolve, reject) => {
|
17
|
-
ty.router({
|
18
|
-
url: 'tuyaSmart://createScene' + paramsStr,
|
19
|
-
success() {
|
20
|
-
success === null || success === void 0 ? void 0 : success();
|
21
|
-
resolve();
|
22
|
-
},
|
23
|
-
fail(err) {
|
24
|
-
fail === null || fail === void 0 ? void 0 : fail(err);
|
25
|
-
reject(err);
|
26
|
-
},
|
27
|
-
complete() {
|
28
|
-
complete === null || complete === void 0 ? void 0 : complete();
|
29
|
-
}
|
30
|
-
});
|
31
|
-
});
|
32
|
-
}
|
33
|
-
export function openSceneEdit(params) {
|
34
|
-
const {
|
35
|
-
success,
|
36
|
-
fail,
|
37
|
-
complete
|
38
|
-
} = params,
|
39
|
-
rest = _objectWithoutProperties(params, _excluded2);
|
40
|
-
let paramsStr = '';
|
41
|
-
if (Object.keys(rest).length > 0) {
|
42
|
-
paramsStr = '?' + objectToUrlParams(rest);
|
43
|
-
}
|
44
|
-
return new Promise((resolve, reject) => {
|
45
|
-
ty.router({
|
46
|
-
url: 'tuyaSmart://editScene' + paramsStr,
|
47
|
-
success() {
|
48
|
-
success === null || success === void 0 ? void 0 : success();
|
49
|
-
resolve();
|
50
|
-
},
|
51
|
-
fail(err) {
|
52
|
-
fail === null || fail === void 0 ? void 0 : fail(err);
|
53
|
-
reject(err);
|
54
|
-
},
|
55
|
-
complete() {
|
56
|
-
complete === null || complete === void 0 ? void 0 : complete();
|
57
|
-
}
|
58
|
-
});
|
59
|
-
});
|
60
|
-
}
|