@ray-js/api 1.0.3 → 1.1.1
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/MapKit.d.ts +374 -0
- package/@types/all-kits.d.ts +2 -0
- package/lib/MapKit-3.0.7.d.ts +12 -0
- package/lib/MapKit-3.0.7.js +14 -0
- package/lib/all-kits.d.ts +1 -0
- package/lib/all-kits.js +1 -0
- package/lib/panel/publishDps.d.ts +12 -0
- package/lib/panel/publishDps.js +1 -2
- package/package.json +5 -5
@@ -0,0 +1,374 @@
|
|
1
|
+
/**
|
2
|
+
* MapKit
|
3
|
+
*
|
4
|
+
* @version 3.0.7
|
5
|
+
*/
|
6
|
+
declare namespace ty.map {
|
7
|
+
/**
|
8
|
+
* 更新地理围栏
|
9
|
+
*权限: [scope.location]
|
10
|
+
*/
|
11
|
+
export function updateGeofence(params: {
|
12
|
+
/** 注册的地理围栏 */
|
13
|
+
registerGeoFence: GeofenceInfo[]
|
14
|
+
/** 取消的地理围栏 */
|
15
|
+
unregisterGeoFence: GeofenceInfo[]
|
16
|
+
complete?: () => void
|
17
|
+
success?: (params: {
|
18
|
+
/** 更新成功 */
|
19
|
+
success?: boolean
|
20
|
+
}) => void
|
21
|
+
fail?: (params: {
|
22
|
+
errorMsg: string
|
23
|
+
errorCode: string | number
|
24
|
+
innerError: {
|
25
|
+
errorCode: string | number
|
26
|
+
errorMsg: string
|
27
|
+
}
|
28
|
+
}) => void
|
29
|
+
}): void
|
30
|
+
|
31
|
+
/**
|
32
|
+
* 地理围栏是否达到上限
|
33
|
+
*权限: [scope.location]
|
34
|
+
*/
|
35
|
+
export function isGeofenceReachLimit(params?: {
|
36
|
+
complete?: () => void
|
37
|
+
success?: (params: {
|
38
|
+
/** 地理围栏是否达到上限 */
|
39
|
+
reachLimit?: boolean
|
40
|
+
}) => void
|
41
|
+
fail?: (params: {
|
42
|
+
errorMsg: string
|
43
|
+
errorCode: string | number
|
44
|
+
innerError: {
|
45
|
+
errorCode: string | number
|
46
|
+
errorMsg: string
|
47
|
+
}
|
48
|
+
}) => void
|
49
|
+
}): void
|
50
|
+
|
51
|
+
/**
|
52
|
+
* 取消地理围栏
|
53
|
+
*权限: [scope.location]
|
54
|
+
*/
|
55
|
+
export function unregisterGeofence(params?: {
|
56
|
+
/** 地理围栏名称 */
|
57
|
+
geoTitle?: string
|
58
|
+
/** 经度 */
|
59
|
+
longitude?: number
|
60
|
+
/** 纬度 */
|
61
|
+
latitude?: number
|
62
|
+
/** 半径 */
|
63
|
+
radius?: number
|
64
|
+
/** id */
|
65
|
+
geofenceId?: string
|
66
|
+
/**
|
67
|
+
* 半径
|
68
|
+
* 0:进度地理围栏
|
69
|
+
* 1:离开地理围栏
|
70
|
+
*/
|
71
|
+
type?: number
|
72
|
+
complete?: () => void
|
73
|
+
success?: (params: null) => void
|
74
|
+
fail?: (params: {
|
75
|
+
errorMsg: string
|
76
|
+
errorCode: string | number
|
77
|
+
innerError: {
|
78
|
+
errorCode: string | number
|
79
|
+
errorMsg: string
|
80
|
+
}
|
81
|
+
}) => void
|
82
|
+
}): void
|
83
|
+
|
84
|
+
/**
|
85
|
+
* 注册地理围栏
|
86
|
+
*权限: [scope.location]
|
87
|
+
*/
|
88
|
+
export function registerGeofence(params?: {
|
89
|
+
/** 地理围栏名称 */
|
90
|
+
geoTitle?: string
|
91
|
+
/** 经度 */
|
92
|
+
longitude?: number
|
93
|
+
/** 纬度 */
|
94
|
+
latitude?: number
|
95
|
+
/** 半径 */
|
96
|
+
radius?: number
|
97
|
+
/** id */
|
98
|
+
geofenceId?: string
|
99
|
+
/**
|
100
|
+
* 半径
|
101
|
+
* 0:进度地理围栏
|
102
|
+
* 1:离开地理围栏
|
103
|
+
*/
|
104
|
+
type?: number
|
105
|
+
complete?: () => void
|
106
|
+
success?: (params: null) => void
|
107
|
+
fail?: (params: {
|
108
|
+
errorMsg: string
|
109
|
+
errorCode: string | number
|
110
|
+
innerError: {
|
111
|
+
errorCode: string | number
|
112
|
+
errorMsg: string
|
113
|
+
}
|
114
|
+
}) => void
|
115
|
+
}): void
|
116
|
+
|
117
|
+
/**
|
118
|
+
* 打开地理围栏地图页面,获取地理围栏信息(新建或者编辑地理围栏)
|
119
|
+
*权限: [scope.location]
|
120
|
+
*/
|
121
|
+
export function openGeofenceMap(params?: {
|
122
|
+
/** 地理围栏名称 */
|
123
|
+
geoTitle?: string
|
124
|
+
/** 经度 */
|
125
|
+
longitude?: number
|
126
|
+
/** 纬度 */
|
127
|
+
latitude?: number
|
128
|
+
/** 半径 */
|
129
|
+
radius?: number
|
130
|
+
/** id */
|
131
|
+
geofenceId?: string
|
132
|
+
/**
|
133
|
+
* 半径
|
134
|
+
* 0:进度地理围栏
|
135
|
+
* 1:离开地理围栏
|
136
|
+
*/
|
137
|
+
type?: number
|
138
|
+
complete?: () => void
|
139
|
+
success?: (params: null) => void
|
140
|
+
fail?: (params: {
|
141
|
+
errorMsg: string
|
142
|
+
errorCode: string | number
|
143
|
+
innerError: {
|
144
|
+
errorCode: string | number
|
145
|
+
errorMsg: string
|
146
|
+
}
|
147
|
+
}) => void
|
148
|
+
}): void
|
149
|
+
|
150
|
+
/**
|
151
|
+
* 获取当前的地理位置、速度
|
152
|
+
*/
|
153
|
+
export function getLocation(params: {
|
154
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 openLocation 的坐标 */
|
155
|
+
type: string
|
156
|
+
/** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
|
157
|
+
altitude: boolean
|
158
|
+
/** 开启高精度定位 */
|
159
|
+
isHighAccuracy: boolean
|
160
|
+
/** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
|
161
|
+
highAccuracyExpireTime: number
|
162
|
+
complete?: () => void
|
163
|
+
success?: (params: {
|
164
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
165
|
+
latitude: number
|
166
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
167
|
+
longitude: number
|
168
|
+
/** 速度,单位 m/s */
|
169
|
+
speed: number
|
170
|
+
/** 位置的精确度 */
|
171
|
+
accuracy: number
|
172
|
+
/** 高度,单位 m */
|
173
|
+
altitude: number
|
174
|
+
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
175
|
+
verticalAccuracy: number
|
176
|
+
/** 水平精度,单位 m */
|
177
|
+
horizontalAccuracy: number
|
178
|
+
/** 城市名称street */
|
179
|
+
cityName: string
|
180
|
+
/** 街道名称 */
|
181
|
+
streetName: string
|
182
|
+
/** 位置名称 */
|
183
|
+
address: string
|
184
|
+
}) => void
|
185
|
+
fail?: (params: {
|
186
|
+
errorMsg: string
|
187
|
+
errorCode: string | number
|
188
|
+
innerError: {
|
189
|
+
errorCode: string | number
|
190
|
+
errorMsg: string
|
191
|
+
}
|
192
|
+
}) => void
|
193
|
+
}): void
|
194
|
+
|
195
|
+
/**
|
196
|
+
* 打开地图选择位置。
|
197
|
+
*/
|
198
|
+
export function chooseLocation(params?: {
|
199
|
+
/** 目标地纬度 */
|
200
|
+
latitude?: number
|
201
|
+
/** 目标地经度 */
|
202
|
+
longitude?: number
|
203
|
+
complete?: () => void
|
204
|
+
success?: (params: {
|
205
|
+
/** 位置名称 */
|
206
|
+
name: string
|
207
|
+
/** 详细地址 */
|
208
|
+
address: string
|
209
|
+
/** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
|
210
|
+
latitude: number
|
211
|
+
/** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
|
212
|
+
longitude: number
|
213
|
+
}) => void
|
214
|
+
fail?: (params: {
|
215
|
+
errorMsg: string
|
216
|
+
errorCode: string | number
|
217
|
+
innerError: {
|
218
|
+
errorCode: string | number
|
219
|
+
errorMsg: string
|
220
|
+
}
|
221
|
+
}) => void
|
222
|
+
}): void
|
223
|
+
|
224
|
+
/**
|
225
|
+
* 获取可跳转第三方地图的地图类型
|
226
|
+
*/
|
227
|
+
export function getMapList(params?: {
|
228
|
+
complete?: () => void
|
229
|
+
success?: (params: {
|
230
|
+
/** 可跳转的地图厂商,目前支持:BMK:百度地图 MA:高德地图 TENCENT:腾讯地图 Google:Google地图 */
|
231
|
+
maps: string[]
|
232
|
+
}) => void
|
233
|
+
fail?: (params: {
|
234
|
+
errorMsg: string
|
235
|
+
errorCode: string | number
|
236
|
+
innerError: {
|
237
|
+
errorCode: string | number
|
238
|
+
errorMsg: string
|
239
|
+
}
|
240
|
+
}) => void
|
241
|
+
}): void
|
242
|
+
|
243
|
+
/**
|
244
|
+
* 使用三方地图查看位置
|
245
|
+
*/
|
246
|
+
export function openMapAppLocation(params: {
|
247
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
248
|
+
latitude: number
|
249
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
250
|
+
longitude: number
|
251
|
+
/** 位置名 */
|
252
|
+
name: string
|
253
|
+
/** 地址的详细说明 */
|
254
|
+
address: string
|
255
|
+
/** 地图类型,目前支持:BMK:百度地图 MA:高德地图 TENCENT:腾讯地图 Google:Google地图 */
|
256
|
+
mapType: string
|
257
|
+
complete?: () => void
|
258
|
+
success?: (params: null) => void
|
259
|
+
fail?: (params: {
|
260
|
+
errorMsg: string
|
261
|
+
errorCode: string | number
|
262
|
+
innerError: {
|
263
|
+
errorCode: string | number
|
264
|
+
errorMsg: string
|
265
|
+
}
|
266
|
+
}) => void
|
267
|
+
}): void
|
268
|
+
|
269
|
+
export type GeofenceInfo = {
|
270
|
+
/** 地理围栏名称 */
|
271
|
+
geoTitle?: string
|
272
|
+
/** 经度 */
|
273
|
+
longitude?: number
|
274
|
+
/** 纬度 */
|
275
|
+
latitude?: number
|
276
|
+
/** 半径 */
|
277
|
+
radius?: number
|
278
|
+
/** id */
|
279
|
+
geofenceId?: string
|
280
|
+
/**
|
281
|
+
* 半径
|
282
|
+
* 0:进度地理围栏
|
283
|
+
* 1:离开地理围栏
|
284
|
+
*/
|
285
|
+
type?: number
|
286
|
+
}
|
287
|
+
|
288
|
+
export type UpdateGeofenceParams = {
|
289
|
+
/** 注册的地理围栏 */
|
290
|
+
registerGeoFence: GeofenceInfo[]
|
291
|
+
/** 取消的地理围栏 */
|
292
|
+
unregisterGeoFence: GeofenceInfo[]
|
293
|
+
}
|
294
|
+
|
295
|
+
export type UpdateGeofenceResponse = {
|
296
|
+
/** 更新成功 */
|
297
|
+
success?: boolean
|
298
|
+
}
|
299
|
+
|
300
|
+
export type IsGeofenceReachLimitResponse = {
|
301
|
+
/** 地理围栏是否达到上限 */
|
302
|
+
reachLimit?: boolean
|
303
|
+
}
|
304
|
+
|
305
|
+
export type LocationBean = {
|
306
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 openLocation 的坐标 */
|
307
|
+
type: string
|
308
|
+
/** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
|
309
|
+
altitude: boolean
|
310
|
+
/** 开启高精度定位 */
|
311
|
+
isHighAccuracy: boolean
|
312
|
+
/** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
|
313
|
+
highAccuracyExpireTime: number
|
314
|
+
}
|
315
|
+
|
316
|
+
export type LocationCB = {
|
317
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
318
|
+
latitude: number
|
319
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
320
|
+
longitude: number
|
321
|
+
/** 速度,单位 m/s */
|
322
|
+
speed: number
|
323
|
+
/** 位置的精确度 */
|
324
|
+
accuracy: number
|
325
|
+
/** 高度,单位 m */
|
326
|
+
altitude: number
|
327
|
+
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
328
|
+
verticalAccuracy: number
|
329
|
+
/** 水平精度,单位 m */
|
330
|
+
horizontalAccuracy: number
|
331
|
+
/** 城市名称street */
|
332
|
+
cityName: string
|
333
|
+
/** 街道名称 */
|
334
|
+
streetName: string
|
335
|
+
/** 位置名称 */
|
336
|
+
address: string
|
337
|
+
}
|
338
|
+
|
339
|
+
export type ChooseBean = {
|
340
|
+
/** 目标地纬度 */
|
341
|
+
latitude?: number
|
342
|
+
/** 目标地经度 */
|
343
|
+
longitude?: number
|
344
|
+
}
|
345
|
+
|
346
|
+
export type ChooseCB = {
|
347
|
+
/** 位置名称 */
|
348
|
+
name: string
|
349
|
+
/** 详细地址 */
|
350
|
+
address: string
|
351
|
+
/** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
|
352
|
+
latitude: number
|
353
|
+
/** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
|
354
|
+
longitude: number
|
355
|
+
}
|
356
|
+
|
357
|
+
export type MapsBean = {
|
358
|
+
/** 可跳转的地图厂商,目前支持:BMK:百度地图 MA:高德地图 TENCENT:腾讯地图 Google:Google地图 */
|
359
|
+
maps: string[]
|
360
|
+
}
|
361
|
+
|
362
|
+
export type OpenMapAppBean = {
|
363
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
364
|
+
latitude: number
|
365
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
366
|
+
longitude: number
|
367
|
+
/** 位置名 */
|
368
|
+
name: string
|
369
|
+
/** 地址的详细说明 */
|
370
|
+
address: string
|
371
|
+
/** 地图类型,目前支持:BMK:百度地图 MA:高德地图 TENCENT:腾讯地图 Google:Google地图 */
|
372
|
+
mapType: string
|
373
|
+
}
|
374
|
+
}
|
package/@types/all-kits.d.ts
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference path="../@types/PlayNetKit.d.ts" />
|
2
|
+
export declare const map: {
|
3
|
+
chooseLocation: typeof ty.map.chooseLocation;
|
4
|
+
getLocation: typeof ty.map.getLocation;
|
5
|
+
getMapList: typeof ty.map.getMapList;
|
6
|
+
isGeofenceReachLimit: typeof ty.map.isGeofenceReachLimit;
|
7
|
+
openGeofenceMap: typeof ty.map.openGeofenceMap;
|
8
|
+
openMapAppLocation: typeof ty.map.openMapAppLocation;
|
9
|
+
registerGeofence: typeof ty.map.registerGeofence;
|
10
|
+
unregisterGeofence: typeof ty.map.unregisterGeofence;
|
11
|
+
updateGeofence: typeof ty.map.updateGeofence;
|
12
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/// <reference path="../@types/PlayNetKit.d.ts" />
|
2
|
+
import { factory } from './utils'; // ray 1.1.0 集成
|
3
|
+
|
4
|
+
export var map = {
|
5
|
+
chooseLocation: factory('chooseLocation'),
|
6
|
+
getLocation: factory('getLocation'),
|
7
|
+
getMapList: factory('getMapList'),
|
8
|
+
isGeofenceReachLimit: factory('isGeofenceReachLimit'),
|
9
|
+
openGeofenceMap: factory('openGeofenceMap'),
|
10
|
+
openMapAppLocation: factory('openMapAppLocation'),
|
11
|
+
registerGeofence: factory('registerGeofence'),
|
12
|
+
unregisterGeofence: factory('unregisterGeofence'),
|
13
|
+
updateGeofence: factory('updateGeofence')
|
14
|
+
};
|
package/lib/all-kits.d.ts
CHANGED
package/lib/all-kits.js
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
import { publishDpsBase } from '../';
|
2
2
|
import { GetTTTAllParams, DpState } from './types';
|
3
3
|
declare type PublishDpsOptions = Omit<GetTTTAllParams<typeof publishDpsBase>, 'deviceId' | 'dps'>;
|
4
|
+
/**
|
5
|
+
* 下发 DP 点控制设备
|
6
|
+
*
|
7
|
+
* @param data - 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
|
8
|
+
* @param options - publishDps 的高阶配置
|
9
|
+
|
10
|
+
* @example
|
11
|
+
*
|
12
|
+
* publishDps({ switch: false });
|
13
|
+
* publishDps({ '1': false })
|
14
|
+
*/
|
15
|
+
export declare function sendDps(data: DpState, options?: PublishDpsOptions): Promise<boolean>;
|
4
16
|
/**
|
5
17
|
* 兼容新旧 publishDps,可以使用原有小程序提供的调用方式,也可以使用 SDK 提供的调用方式。
|
6
18
|
* @param data ty.device.publishDps的参数 或 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
|
package/lib/panel/publishDps.js
CHANGED
@@ -22,7 +22,7 @@ var DEFAULT_OPTIONS = {
|
|
22
22
|
* publishDps({ '1': false })
|
23
23
|
*/
|
24
24
|
|
25
|
-
function sendDps(data) {
|
25
|
+
export function sendDps(data) {
|
26
26
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPTIONS;
|
27
27
|
var devInfo = getDevInfo();
|
28
28
|
var dps = {};
|
@@ -58,7 +58,6 @@ function sendDps(data) {
|
|
58
58
|
* publishDps({ '1': false })
|
59
59
|
*/
|
60
60
|
|
61
|
-
|
62
61
|
export function publishDps(data) {
|
63
62
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_OPTIONS;
|
64
63
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.1.1",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,13 +26,13 @@
|
|
26
26
|
"build:kit:api": "node scripts/api-creator.mjs"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/framework": "^1.
|
30
|
-
"@ray-js/router": "^1.
|
29
|
+
"@ray-js/framework": "^1.1.1",
|
30
|
+
"@ray-js/router": "^1.1.1",
|
31
31
|
"@ray-js/wechat": "^0.0.16",
|
32
32
|
"base64-browser": "^1.0.1"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@ray-js/cli": "^1.
|
35
|
+
"@ray-js/cli": "^1.1.1",
|
36
36
|
"art-template": "^4.13.2",
|
37
37
|
"fs-extra": "^10.1.0",
|
38
38
|
"miniprogram-api-typings": "^3.4.3",
|
@@ -44,6 +44,6 @@
|
|
44
44
|
"email": "tuyafe@tuya.com"
|
45
45
|
}
|
46
46
|
],
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "07feb5c2fada4b55bde8fb37d37c56578fe6ce03",
|
48
48
|
"repository": {}
|
49
49
|
}
|