@ray-js/api 1.5.37-alpha.0 → 1.5.37
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/@types/api-cloud.d.ts +38 -2
- package/@types/api-extend.d.ts +34 -10
- package/lib/cloud/laser-clean/map.d.ts +2 -1
- package/lib/cloud/laser-clean/map.js +2 -1
- package/lib/getCdnUrl/index.thing.js +8 -13
- package/lib/viewAPI.d.ts +1 -0
- package/lib/viewAPI.js +2 -1
- package/package.json +5 -5
package/@types/api-cloud.d.ts
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
// api云能力扩展
|
2
2
|
declare namespace ty {
|
3
|
+
// #region 获取云存储配置
|
4
|
+
type GetSweeperStorageConfigParams = {
|
5
|
+
// 设备id
|
6
|
+
devId: string
|
7
|
+
// 类型
|
8
|
+
type?: string
|
9
|
+
}
|
10
|
+
|
11
|
+
// 获取云存储配置返回值
|
12
|
+
type GetSweeperStorageConfigResponse = {
|
13
|
+
// ak
|
14
|
+
ak: string
|
15
|
+
// bucket
|
16
|
+
bucket: string
|
17
|
+
// sk
|
18
|
+
sk: string
|
19
|
+
// token
|
20
|
+
token: string
|
21
|
+
// endpoint
|
22
|
+
endpoint: string
|
23
|
+
// 过期时间
|
24
|
+
expiration: string
|
25
|
+
// 生命周期
|
26
|
+
lifeCycle: number
|
27
|
+
// 区域
|
28
|
+
region: string
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* 获取云存储配置
|
33
|
+
* @returns 获取云存储配置结果的 Promise
|
34
|
+
*/
|
35
|
+
function getSweeperStorageConfig(
|
36
|
+
params: GetSweeperStorageConfigParams
|
37
|
+
): Promise<GetSweeperStorageConfigResponse>
|
38
|
+
|
3
39
|
// #region 获取扫地机的历史地图
|
4
40
|
type GetMultipleMapFilesParams = {
|
5
41
|
//设备id
|
@@ -29,8 +65,8 @@ declare namespace ty {
|
|
29
65
|
|
30
66
|
// #region 获取清扫记录列表
|
31
67
|
type GetCleaningRecordsParams = {
|
32
|
-
startTime:
|
33
|
-
endTime:
|
68
|
+
startTime: string // 开始时间
|
69
|
+
endTime: string // 结束时间
|
34
70
|
limit: number // 返回的数据长度限制
|
35
71
|
offset: number // 偏移量
|
36
72
|
devId: string // 设备Id
|
package/@types/api-extend.d.ts
CHANGED
@@ -122,20 +122,20 @@ interface setNavigationBarBackParam {
|
|
122
122
|
|
123
123
|
interface CanvasGetImageDataProps extends Callback {
|
124
124
|
canvasId: string
|
125
|
-
x:
|
126
|
-
y:
|
127
|
-
width:
|
128
|
-
height:
|
129
|
-
success(res: { width:
|
125
|
+
x: number
|
126
|
+
y: number
|
127
|
+
width: number
|
128
|
+
height: number
|
129
|
+
success(res: { width: number; height: number; data: Array }): void
|
130
130
|
}
|
131
131
|
|
132
132
|
interface CanvasPutImageDataProps extends Callback {
|
133
133
|
canvasId: string
|
134
|
-
x:
|
135
|
-
y:
|
136
|
-
width:
|
137
|
-
height:
|
138
|
-
data:
|
134
|
+
x: number
|
135
|
+
y: number
|
136
|
+
width: number
|
137
|
+
height: number
|
138
|
+
data: Array
|
139
139
|
}
|
140
140
|
|
141
141
|
interface VideoContext {
|
@@ -226,6 +226,29 @@ interface WebviewContext {
|
|
226
226
|
postMessage(options: { data: Record<string, any> }): void
|
227
227
|
reload(options: Callback): void
|
228
228
|
}
|
229
|
+
|
230
|
+
interface SocketTask {
|
231
|
+
send(option: { data: string | ArrayBuffer; success?: () => void; fail?: () => void; complete?: () => void }): void
|
232
|
+
close(option: { code?: number; reason?: string; success?: () => void; fail?: () => void; complete?: () => void }): void
|
233
|
+
onOpen(callback: () => void): void
|
234
|
+
onClose(callback: () => void): void
|
235
|
+
onError(callback: () => void): void
|
236
|
+
onMessage(callback: (res: { data: string | ArrayBuffer }) => void): void
|
237
|
+
}
|
238
|
+
|
239
|
+
interface ConnectSocketProps {
|
240
|
+
url: string;
|
241
|
+
protocols?: string[];
|
242
|
+
header?: Record<string, string>;
|
243
|
+
timeout?: number;
|
244
|
+
tcpNoDelay?: boolean;
|
245
|
+
perMessageDeflate?: boolean;
|
246
|
+
forceCellularNetwork?: boolean;
|
247
|
+
success?: () => void;
|
248
|
+
fail?: () => void;
|
249
|
+
complete?: () => void
|
250
|
+
}
|
251
|
+
|
229
252
|
declare namespace ty {
|
230
253
|
/**
|
231
254
|
* 小程序云能力
|
@@ -284,6 +307,7 @@ declare namespace ty {
|
|
284
307
|
export type env = {
|
285
308
|
USER_DATA_PATH: string
|
286
309
|
}
|
310
|
+
export function connectSocket(param: ConnectSocketProps): SocketTask
|
287
311
|
}
|
288
312
|
|
289
313
|
declare namespace WechatMiniprogram {
|
@@ -7,22 +7,11 @@ const regionMap = {
|
|
7
7
|
WE: 'd2h2yqnfpu4gl5.cdn5th.com',
|
8
8
|
UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
|
9
9
|
};
|
10
|
-
let
|
11
|
-
let getInternalRegionCode = () => {
|
12
|
-
if (!_regionCode) {
|
13
|
-
ty.getAppInfo({
|
14
|
-
success: function (res) {
|
15
|
-
_regionCode = res.regionCode;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
}
|
19
|
-
return 'EU';
|
20
|
-
};
|
10
|
+
let regionCode = 'EU';
|
21
11
|
export function getRegionCode() {
|
22
12
|
return new Promise((resolve, reject) => {
|
23
13
|
ty.getAppInfo({
|
24
14
|
success: function (res) {
|
25
|
-
_regionCode = res.regionCode;
|
26
15
|
resolve(res.regionCode);
|
27
16
|
},
|
28
17
|
fail: function (err) {
|
@@ -31,6 +20,11 @@ export function getRegionCode() {
|
|
31
20
|
});
|
32
21
|
});
|
33
22
|
}
|
23
|
+
ty.getAppInfo({
|
24
|
+
success: function (res) {
|
25
|
+
regionCode = res.regionCode;
|
26
|
+
}
|
27
|
+
});
|
34
28
|
export default function getCdnUrl(path, cdnMap, region) {
|
35
29
|
if (!cdnMap) {
|
36
30
|
console.warn('请传入cdnMap');
|
@@ -41,7 +35,8 @@ export default function getCdnUrl(path, cdnMap, region) {
|
|
41
35
|
console.warn('[App] cdn "' + path + '" is not exist.');
|
42
36
|
return path;
|
43
37
|
}
|
44
|
-
|
38
|
+
const cdnPath = 'https://' + regionMap[region || regionCode] + '/' + cdnShortPath;
|
39
|
+
return cdnPath;
|
45
40
|
}
|
46
41
|
export async function getCdnUrlAsync(path, cdnMap, region) {
|
47
42
|
if (!cdnMap) {
|
package/lib/viewAPI.d.ts
CHANGED
@@ -13,3 +13,4 @@ export declare const createMapContext: typeof ty.createMapContext;
|
|
13
13
|
export declare const createIpcPlayerContext: typeof ty.createIpcPlayerContext;
|
14
14
|
export declare const createCameraContext: typeof ty.createCameraContext;
|
15
15
|
export declare const createWebviewContext: typeof ty.createWebviewContext;
|
16
|
+
export declare const connectSocket: typeof ty.connectSocket;
|
package/lib/viewAPI.js
CHANGED
@@ -14,4 +14,5 @@ export const createNativeVideoContext = factory('createNativeVideoContext');
|
|
14
14
|
export const createMapContext = factory('createMapContext');
|
15
15
|
export const createIpcPlayerContext = factory('createIpcPlayerContext');
|
16
16
|
export const createCameraContext = factory('createCameraContext');
|
17
|
-
export const createWebviewContext = factory('createWebviewContext');
|
17
|
+
export const createWebviewContext = factory('createWebviewContext');
|
18
|
+
export const connectSocket = factory('connectSocket');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.5.37
|
3
|
+
"version": "1.5.37",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -29,14 +29,14 @@
|
|
29
29
|
"watch": "ray start --type=component"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@ray-js/framework": "1.5.37
|
33
|
-
"@ray-js/router": "1.5.37
|
32
|
+
"@ray-js/framework": "1.5.37",
|
33
|
+
"@ray-js/router": "1.5.37",
|
34
34
|
"@ray-js/wechat": "^0.2.9",
|
35
35
|
"base64-browser": "^1.0.1",
|
36
36
|
"query-string": "^7.1.3"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@ray-js/cli": "1.5.37
|
39
|
+
"@ray-js/cli": "1.5.37",
|
40
40
|
"art-template": "^4.13.2",
|
41
41
|
"fs-extra": "^10.1.0",
|
42
42
|
"miniprogram-api-typings": "^3.12.2",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"access": "public",
|
47
47
|
"registry": "https://registry.npmjs.com"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "b8dccf659440916f9b18a26ff8cee6086a40985b"
|
50
50
|
}
|