@ray-js/api 1.4.0-alpha.9 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,402 @@
1
+ /**
2
+ * P2PKit
3
+ *
4
+ * @version 2.0.3
5
+ */
6
+ declare namespace ty.p2p {
7
+ /**
8
+ * P2P SDK 初始化
9
+ */
10
+ export function P2PSDKInit(params: {
11
+ /** 用户id */
12
+ userId: string
13
+ complete?: () => void
14
+ success?: (params: null) => void
15
+ fail?: (params: {
16
+ errorMsg: string
17
+ errorCode: string | number
18
+ innerError: {
19
+ errorCode: string | number
20
+ errorMsg: string
21
+ }
22
+ }) => void
23
+ }): void
24
+
25
+ /**
26
+ * 建立P2P连接
27
+ */
28
+ export function connectDevice(params: {
29
+ /** 设备id */
30
+ deviceId: string
31
+ /** 连接模式,0:INTERNET 1:LAN */
32
+ mode?: number
33
+ /** 超时时长,单位:ms,设置0会设置成默认值,Internet:15000ms, Lan:3000ms */
34
+ timeout?: number
35
+ complete?: () => void
36
+ success?: (params: null) => void
37
+ fail?: (params: {
38
+ errorMsg: string
39
+ errorCode: string | number
40
+ innerError: {
41
+ errorCode: string | number
42
+ errorMsg: string
43
+ }
44
+ }) => void
45
+ }): void
46
+
47
+ /**
48
+ * 检查P2P连接
49
+ */
50
+ export function isP2PActive(params: {
51
+ /** 设备id */
52
+ deviceId: string
53
+ /** 连接模式,0:INTERNET 1:LAN */
54
+ mode?: number
55
+ /** 超时时长,单位:ms,设置0会设置成默认值,Internet:15000ms, Lan:3000ms */
56
+ timeout?: number
57
+ complete?: () => void
58
+ success?: (params: null) => void
59
+ fail?: (params: {
60
+ errorMsg: string
61
+ errorCode: string | number
62
+ innerError: {
63
+ errorCode: string | number
64
+ errorMsg: string
65
+ }
66
+ }) => void
67
+ }): void
68
+
69
+ /**
70
+ * 检查P2P连接
71
+ */
72
+ export function isP2PActiveSync(params?: ThingP2PConnectionParams): null
73
+
74
+ /**
75
+ * 查询设备相册文件索引列表
76
+ */
77
+ export function queryAlbumFileIndexs(params: {
78
+ /** 设备id */
79
+ deviceId: string
80
+ /** albumName 和设备端约定字段 */
81
+ albumName: string
82
+ complete?: () => void
83
+ success?: (params: {
84
+ /** 文件个数 */
85
+ count: number
86
+ /** 文件索引 */
87
+ items: ThingP2PAlbumFileIndex[]
88
+ }) => void
89
+ fail?: (params: {
90
+ errorMsg: string
91
+ errorCode: string | number
92
+ innerError: {
93
+ errorCode: string | number
94
+ errorMsg: string
95
+ }
96
+ }) => void
97
+ }): void
98
+
99
+ /**
100
+ * P2P上传文件
101
+ */
102
+ export function uploadFile(params: {
103
+ /** 设备id */
104
+ deviceId: string
105
+ /** albumName 和设备端约定字段 */
106
+ albumName: string
107
+ /** 文件本地路径 */
108
+ filePath: string
109
+ /** 扩展字段 */
110
+ extData?: string
111
+ /** 扩展字段长度 */
112
+ extDataLength?: number
113
+ complete?: () => void
114
+ success?: (params: null) => void
115
+ fail?: (params: {
116
+ errorMsg: string
117
+ errorCode: string | number
118
+ innerError: {
119
+ errorCode: string | number
120
+ errorMsg: string
121
+ }
122
+ }) => void
123
+ }): void
124
+
125
+ /**
126
+ * P2P下载文件
127
+ */
128
+ export function downloadFile(params: {
129
+ /** 设备id */
130
+ deviceId: string
131
+ /** albumName 和设备端约定字段 */
132
+ albumName: string
133
+ /** 下载文件本地存储路径 */
134
+ filePath: string
135
+ /** 下载的文件名称,eg: {"files":["filesname1", "filesname2", "filesname3" ]} */
136
+ jsonfiles: string
137
+ complete?: () => void
138
+ success?: (params: null) => void
139
+ fail?: (params: {
140
+ errorMsg: string
141
+ errorCode: string | number
142
+ innerError: {
143
+ errorCode: string | number
144
+ errorMsg: string
145
+ }
146
+ }) => void
147
+ }): void
148
+
149
+ /**
150
+ * P2P下载数据流
151
+ */
152
+ export function downloadStream(params: {
153
+ /** 设备id */
154
+ deviceId: string
155
+ /** albumName 和设备端约定字段 */
156
+ albumName: string
157
+ /** 下载的文件名称,eg: {"files":["filesname1", "filesname2", "filesname3" ]} */
158
+ jsonfiles: string
159
+ complete?: () => void
160
+ success?: (params: null) => void
161
+ fail?: (params: {
162
+ errorMsg: string
163
+ errorCode: string | number
164
+ innerError: {
165
+ errorCode: string | number
166
+ errorMsg: string
167
+ }
168
+ }) => void
169
+ }): void
170
+
171
+ /**
172
+ * 取消传输任务
173
+ */
174
+ export function cancelUploadTask(params: {
175
+ /** 设备id */
176
+ deviceId: string
177
+ complete?: () => void
178
+ success?: (params: null) => void
179
+ fail?: (params: {
180
+ errorMsg: string
181
+ errorCode: string | number
182
+ innerError: {
183
+ errorCode: string | number
184
+ errorMsg: string
185
+ }
186
+ }) => void
187
+ }): void
188
+
189
+ /**
190
+ * 取消下载任务
191
+ */
192
+ export function cancelDownloadTask(params: {
193
+ /** 设备id */
194
+ deviceId: string
195
+ complete?: () => void
196
+ success?: (params: null) => void
197
+ fail?: (params: {
198
+ errorMsg: string
199
+ errorCode: string | number
200
+ innerError: {
201
+ errorCode: string | number
202
+ errorMsg: string
203
+ }
204
+ }) => void
205
+ }): void
206
+
207
+ /**
208
+ * 和设备断开连接
209
+ */
210
+ export function disconnectDevice(params: {
211
+ /** 设备id */
212
+ deviceId: string
213
+ complete?: () => void
214
+ success?: (params: null) => void
215
+ fail?: (params: {
216
+ errorMsg: string
217
+ errorCode: string | number
218
+ innerError: {
219
+ errorCode: string | number
220
+ errorMsg: string
221
+ }
222
+ }) => void
223
+ }): void
224
+
225
+ /**
226
+ * P2P SDK 反初始化
227
+ */
228
+ export function deInitSDK(params?: {
229
+ complete?: () => void
230
+ success?: (params: null) => void
231
+ fail?: (params: {
232
+ errorMsg: string
233
+ errorCode: string | number
234
+ innerError: {
235
+ errorCode: string | number
236
+ errorMsg: string
237
+ }
238
+ }) => void
239
+ }): void
240
+
241
+ /**
242
+ * 连接状态改变回调
243
+ */
244
+ export function onSessionStatusChange(listener: (params: ThingP2PSessionStatus) => void): void
245
+
246
+ /**
247
+ * 取消监听:连接状态改变回调
248
+ */
249
+ export function offSessionStatusChange(listener: (params: ThingP2PSessionStatus) => void): void
250
+
251
+ /**
252
+ * 上传进度回调
253
+ */
254
+ export function onUploadProgressUpdate(listener: (params: ProgressEvent) => void): void
255
+
256
+ /**
257
+ * 取消监听:上传进度回调
258
+ */
259
+ export function offUploadProgressUpdate(listener: (params: ProgressEvent) => void): void
260
+
261
+ /**
262
+ * 单个文件下载进度回调
263
+ */
264
+ export function onDownloadProgressUpdate(listener: (params: DownloadProgressEvent) => void): void
265
+
266
+ /**
267
+ * 取消监听:单个文件下载进度回调
268
+ */
269
+ export function offDownloadProgressUpdate(listener: (params: DownloadProgressEvent) => void): void
270
+
271
+ /**
272
+ * 下载总进度回调
273
+ */
274
+ export function onDownloadTotalProgressUpdate(
275
+ listener: (params: DownloadTotalProgressEvent) => void
276
+ ): void
277
+
278
+ /**
279
+ * 取消监听:下载总进度回调
280
+ */
281
+ export function offDownloadTotalProgressUpdate(
282
+ listener: (params: DownloadTotalProgressEvent) => void
283
+ ): void
284
+
285
+ /**
286
+ * 单文件下载完成事件
287
+ */
288
+ export function onFileDownloadComplete(
289
+ listener: (params: FileDownloadCompletionEvent) => void
290
+ ): void
291
+
292
+ /**
293
+ * 取消监听:单文件下载完成事件
294
+ */
295
+ export function offFileDownloadComplete(
296
+ listener: (params: FileDownloadCompletionEvent) => void
297
+ ): void
298
+
299
+ /**
300
+ * 收到数据包事件
301
+ */
302
+ export function onStreamPacketReceive(
303
+ listener: (params: StreamDownloadPacketReceivedEvent) => void
304
+ ): void
305
+
306
+ /**
307
+ * 取消监听:收到数据包事件
308
+ */
309
+ export function offStreamPacketReceive(
310
+ listener: (params: StreamDownloadPacketReceivedEvent) => void
311
+ ): void
312
+
313
+ export type ThingP2PConnectionParams = {
314
+ /** 设备id */
315
+ deviceId: string
316
+ /** 连接模式,0:INTERNET 1:LAN */
317
+ mode?: number
318
+ /** 超时时长,单位:ms,设置0会设置成默认值,Internet:15000ms, Lan:3000ms */
319
+ timeout?: number
320
+ }
321
+
322
+ export type ThingP2PAlbumFileIndex = {
323
+ /** idx 唯一标识,设备提供 */
324
+ idx: number
325
+ /** channel 通道号 */
326
+ channel: number
327
+ /** type 文件类型,0: 图片,2: mp4, 3: 全景拼接文件 */
328
+ type: number
329
+ /** dir 0: 文件,1: 文件夹。保留字段,目前都是 0 */
330
+ dir: number
331
+ /** filename 文件名,带有文件后缀 */
332
+ filename: string
333
+ /** createTime 文件创建时间 */
334
+ createTime: number
335
+ /** duration 视频文件时长 */
336
+ duration: number
337
+ }
338
+
339
+ export type ThingP2PSessionStatus = {
340
+ /** 设备id */
341
+ deviceId: string
342
+ /** 状态值, 小于0为断开连接 */
343
+ status: number
344
+ }
345
+
346
+ export type ProgressEvent = {
347
+ /** 设备id */
348
+ deviceId: string
349
+ /** 文件本地路径 */
350
+ filePath: string
351
+ /** 上传/下载进度 */
352
+ progress: number
353
+ }
354
+
355
+ export type DownloadProgressEvent = {
356
+ /** 设备id */
357
+ deviceId: string
358
+ /** 正在下载的文件名称 */
359
+ fileName: string
360
+ /** 上传/下载进度 */
361
+ progress: number
362
+ }
363
+
364
+ export type DownloadTotalProgressEvent = {
365
+ /** 设备id */
366
+ deviceId: string
367
+ /** 上传/下载进度 */
368
+ progress: number
369
+ }
370
+
371
+ export type FileDownloadCompletionEvent = {
372
+ /** 设备id */
373
+ deviceId: string
374
+ /** 文件名 */
375
+ fileName: string
376
+ /** 索引 */
377
+ index: number
378
+ }
379
+
380
+ export type StreamDownloadPacketReceivedEvent = {
381
+ /** 设备id */
382
+ deviceId: string
383
+ /** 文件个数 */
384
+ totalFiles: number
385
+ /** 文件名 */
386
+ fileName: string
387
+ /** 索引,目前错误数据 */
388
+ fileIndex: number
389
+ /** 文件大小 */
390
+ fileLength: number
391
+ /** 数据 */
392
+ packetData: string
393
+ /** 包大小 */
394
+ packetLength: number
395
+ /** 文件序列号 */
396
+ fileSerialNumber: number
397
+ /** 包索引 */
398
+ packetIndex: number
399
+ /** 包头/包尾 0b00XY Y:包头 X:包尾 */
400
+ packetType: number
401
+ }
402
+ }
@@ -5,3 +5,4 @@
5
5
  /// <reference path="./PlayNetKit.d.ts" />
6
6
  /// <reference path="./MapKit.d.ts" />
7
7
  /// <reference path="./HomeKit.d.ts" />
8
+ /// <reference path="./P2PKit.d.ts" />
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ Copyright © 2014-2022 Tuya.inc
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ /// <reference path="../@types/MapKit.d.ts" />
2
+ export declare const p2p: {
3
+ P2PSDKInit: typeof ty.p2p.P2PSDKInit;
4
+ deInitSDK: typeof ty.p2p.deInitSDK;
5
+ isP2PActive: typeof ty.p2p.isP2PActive;
6
+ isP2PActiveSync: typeof ty.p2p.isP2PActiveSync;
7
+ connectDevice: typeof ty.p2p.connectDevice;
8
+ disconnectDevice: typeof ty.p2p.disconnectDevice;
9
+ uploadFile: typeof ty.p2p.uploadFile;
10
+ cancelUploadTask: typeof ty.p2p.cancelUploadTask;
11
+ downloadFile: typeof ty.p2p.downloadFile;
12
+ cancelDownloadTask: typeof ty.p2p.cancelDownloadTask;
13
+ downloadStream: typeof ty.p2p.downloadStream;
14
+ queryAlbumFileIndexs: typeof ty.p2p.queryAlbumFileIndexs;
15
+ onSessionStatusChange: typeof ty.p2p.onSessionStatusChange;
16
+ offSessionStatusChange: typeof ty.p2p.offSessionStatusChange;
17
+ onUploadProgressUpdate: typeof ty.p2p.onUploadProgressUpdate;
18
+ offUploadProgressUpdate: typeof ty.p2p.offUploadProgressUpdate;
19
+ onDownloadProgressUpdate: typeof ty.p2p.onDownloadProgressUpdate;
20
+ offDownloadProgressUpdate: typeof ty.p2p.offDownloadProgressUpdate;
21
+ onDownloadTotalProgressUpdate: typeof ty.p2p.onDownloadTotalProgressUpdate;
22
+ offDownloadTotalProgressUpdate: typeof ty.p2p.offDownloadTotalProgressUpdate;
23
+ onFileDownloadComplete: typeof ty.p2p.onFileDownloadComplete;
24
+ offFileDownloadComplete: typeof ty.p2p.offFileDownloadComplete;
25
+ onStreamPacketReceive: typeof ty.p2p.onStreamPacketReceive;
26
+ offStreamPacketReceive: typeof ty.p2p.offStreamPacketReceive;
27
+ };
@@ -0,0 +1,79 @@
1
+ /// <reference path="../@types/MapKit.d.ts" />
2
+
3
+ import { factory } from './utils';
4
+
5
+ // ray 1.4.0 集成
6
+ export const p2p = {
7
+ P2PSDKInit: factory('P2PSDKInit', {
8
+ "namespace": "p2p"
9
+ }),
10
+ deInitSDK: factory('deInitSDK', {
11
+ "namespace": "p2p"
12
+ }),
13
+ isP2PActive: factory('isP2PActive', {
14
+ "namespace": "p2p"
15
+ }),
16
+ isP2PActiveSync: factory('isP2PActiveSync', {
17
+ "namespace": "p2p"
18
+ }),
19
+ connectDevice: factory('connectDevice', {
20
+ "namespace": "p2p"
21
+ }),
22
+ disconnectDevice: factory('disconnectDevice', {
23
+ "namespace": "p2p"
24
+ }),
25
+ uploadFile: factory('uploadFile', {
26
+ "namespace": "p2p"
27
+ }),
28
+ cancelUploadTask: factory('cancelUploadTask', {
29
+ "namespace": "p2p"
30
+ }),
31
+ downloadFile: factory('downloadFile', {
32
+ "namespace": "p2p"
33
+ }),
34
+ cancelDownloadTask: factory('cancelDownloadTask', {
35
+ "namespace": "p2p"
36
+ }),
37
+ downloadStream: factory('downloadStream', {
38
+ "namespace": "p2p"
39
+ }),
40
+ queryAlbumFileIndexs: factory('queryAlbumFileIndexs', {
41
+ "namespace": "p2p"
42
+ }),
43
+ onSessionStatusChange: factory('onSessionStatusChange', {
44
+ "namespace": "p2p"
45
+ }),
46
+ offSessionStatusChange: factory('offSessionStatusChange', {
47
+ "namespace": "p2p"
48
+ }),
49
+ onUploadProgressUpdate: factory('onUploadProgressUpdate', {
50
+ "namespace": "p2p"
51
+ }),
52
+ offUploadProgressUpdate: factory('offUploadProgressUpdate', {
53
+ "namespace": "p2p"
54
+ }),
55
+ onDownloadProgressUpdate: factory('onDownloadProgressUpdate', {
56
+ "namespace": "p2p"
57
+ }),
58
+ offDownloadProgressUpdate: factory('offDownloadProgressUpdate', {
59
+ "namespace": "p2p"
60
+ }),
61
+ onDownloadTotalProgressUpdate: factory('onDownloadTotalProgressUpdate', {
62
+ "namespace": "p2p"
63
+ }),
64
+ offDownloadTotalProgressUpdate: factory('offDownloadTotalProgressUpdate', {
65
+ "namespace": "p2p"
66
+ }),
67
+ onFileDownloadComplete: factory('onFileDownloadComplete', {
68
+ "namespace": "p2p"
69
+ }),
70
+ offFileDownloadComplete: factory('offFileDownloadComplete', {
71
+ "namespace": "p2p"
72
+ }),
73
+ onStreamPacketReceive: factory('onStreamPacketReceive', {
74
+ "namespace": "p2p"
75
+ }),
76
+ offStreamPacketReceive: factory('offStreamPacketReceive', {
77
+ "namespace": "p2p"
78
+ })
79
+ };
package/lib/all-kits.d.ts CHANGED
@@ -5,5 +5,6 @@ export * from './MiniKit-3.1.0';
5
5
  export * from './PlayNetKit-1.1.3';
6
6
  export * from './MapKit-3.0.7';
7
7
  export * from './HomeKit-3.1.4';
8
+ export * from './P2PKit-2.0.3';
8
9
  import * as device from './DeviceKit-3.3.1';
9
10
  export { device };
package/lib/all-kits.js CHANGED
@@ -5,5 +5,6 @@ export * from './MiniKit-3.1.0';
5
5
  export * from './PlayNetKit-1.1.3';
6
6
  export * from './MapKit-3.0.7';
7
7
  export * from './HomeKit-3.1.4';
8
+ export * from './P2PKit-2.0.3';
8
9
  import * as device from './DeviceKit-3.3.1';
9
10
  export { device };
@@ -1 +1,2 @@
1
1
  export default function getCdnUrl(path: string): string;
2
+ export declare function getCdnUrlAsync(path: string): Promise<string>;
@@ -1,4 +1,8 @@
1
1
  export default function getCdnUrl(path) {
2
2
  // 暂未实现获取cdn方法,将直接返回path
3
3
  return path;
4
+ }
5
+ export function getCdnUrlAsync(path) {
6
+ // 暂未实现获取cdn方法,将直接返回path
7
+ return Promise.resolve(path);
4
8
  }
@@ -1 +1,3 @@
1
- export default function getCdnUrl(path: string, cdnMap?: Record<string, string>): string;
1
+ export declare function getRegionCode(): Promise<string>;
2
+ export default function getCdnUrl(path: string, cdnMap?: Record<string, string>, region?: string): string;
3
+ export declare function getCdnUrlAsync(path: string, cdnMap?: Record<string, string>, region?: string): Promise<string>;
@@ -1,25 +1,63 @@
1
- export default function getCdnUrl(path, cdnMap) {
1
+ const regionMap = {
2
+ AY: 'images.tuyacn.com',
3
+ AZ: 'usimagesd1448c85ulz2o4.cdn5th.com',
4
+ EU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
5
+ IN: 'inimagesd1jqokb9wptk2t.cdn5th.com',
6
+ RU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
7
+ WE: 'd2h2yqnfpu4gl5.cdn5th.com',
8
+ UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
9
+ };
10
+ let regionCode = 'EU';
11
+ export function getRegionCode() {
12
+ return new Promise((resolve, reject) => {
13
+ ty.getAppInfo({
14
+ success: function (res) {
15
+ resolve(res.regionCode);
16
+ },
17
+ fail: function (err) {
18
+ reject(err);
19
+ }
20
+ });
21
+ });
22
+ }
23
+ ty.getAppInfo({
24
+ success: function (res) {
25
+ regionCode = res.regionCode;
26
+ }
27
+ });
28
+ export default function getCdnUrl(path, cdnMap, region) {
2
29
  if (!cdnMap) {
3
30
  console.warn('请传入cdnMap');
4
31
  return path;
5
32
  }
6
- let regionCode = 'EU';
7
- ty.getAppInfo().then(res => {
8
- regionCode = res.regionCode;
9
- });
10
- const region = {
11
- AY: 'images.tuyacn.com',
12
- AZ: 'usimagesd1448c85ulz2o4.cdn5th.com',
13
- EU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
14
- IN: 'inimagesd1jqokb9wptk2t.cdn5th.com',
15
- RU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
16
- WE: 'd2h2yqnfpu4gl5.cdn5th.com',
17
- UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
18
- }[regionCode];
19
33
  const cdnShortPath = cdnMap[path];
20
34
  if (!cdnShortPath) {
21
35
  console.warn('[App] cdn "' + path + '" is not exist.');
22
36
  return path;
23
37
  }
24
- return 'https://' + region + '/' + cdnShortPath;
38
+ const cdnPath = 'https://' + regionMap[region || regionCode] + '/' + cdnShortPath;
39
+ return cdnPath;
40
+ }
41
+ export async function getCdnUrlAsync(path, cdnMap, region) {
42
+ if (!cdnMap) {
43
+ console.warn('请传入cdnMap');
44
+ return path;
45
+ }
46
+ let _regionCode = 'EU';
47
+ if (region) {
48
+ _regionCode = region;
49
+ } else {
50
+ try {
51
+ _regionCode = await getRegionCode();
52
+ } catch (error) {
53
+ console.warn('[App] getRegionCode error, use default region EU', error);
54
+ }
55
+ }
56
+ const cdnShortPath = cdnMap[path];
57
+ if (!cdnShortPath) {
58
+ console.warn('[App] cdn "' + path + '" is not exist.');
59
+ return path;
60
+ }
61
+ const cdnPath = 'https://' + regionMap[_regionCode] + '/' + cdnShortPath;
62
+ return cdnPath;
25
63
  }
@@ -1 +1,2 @@
1
1
  export default function getCdnUrl(path: string): string;
2
+ export declare function getCdnUrlAsync(path: string): Promise<string>;
@@ -1,4 +1,8 @@
1
1
  export default function getCdnUrl(path) {
2
2
  // 暂未实现获取cdn方法,将直接返回path
3
3
  return path;
4
+ }
5
+ export function getCdnUrlAsync(path) {
6
+ // 暂未实现获取cdn方法,将直接返回path
7
+ return Promise.resolve(path);
4
8
  }
package/lib/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { default as showTabBar } from './showTabBar';
20
20
  export { default as switchTab } from './switchTab';
21
21
  export { default as onNavigationBarBack } from './onNavigationBarBack';
22
22
  export { default as setNavigationBarBack } from './setNavigationBarBack';
23
- export { default as getCdnUrl } from './getCdnUrl';
23
+ export { default as getCdnUrl, getCdnUrlAsync } from './getCdnUrl';
24
24
  /**
25
25
  * 提供 glboal-api 将 wx / ty 对象暴露出去,供给业务在Ray为显示导出api时进行快速响应开发。
26
26
  */
package/lib/index.js CHANGED
@@ -21,7 +21,7 @@ export { default as showTabBar } from './showTabBar';
21
21
  export { default as switchTab } from './switchTab';
22
22
  export { default as onNavigationBarBack } from './onNavigationBarBack';
23
23
  export { default as setNavigationBarBack } from './setNavigationBarBack';
24
- export { default as getCdnUrl } from './getCdnUrl';
24
+ export { default as getCdnUrl, getCdnUrlAsync } from './getCdnUrl';
25
25
 
26
26
  /**
27
27
  * 提供 glboal-api 将 wx / ty 对象暴露出去,供给业务在Ray为显示导出api时进行快速响应开发。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.4.0-alpha.9",
3
+ "version": "1.4.1",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,21 +29,21 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "^1.4.0-alpha.9",
33
- "@ray-js/router": "^1.4.0-alpha.9",
34
- "@ray-js/wechat": "^0.0.32",
32
+ "@ray-js/framework": "^1.4.1",
33
+ "@ray-js/router": "^1.4.1",
34
+ "@ray-js/wechat": "^0.0.33",
35
35
  "base64-browser": "^1.0.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@ray-js/cli": "^1.4.0-alpha.9",
38
+ "@ray-js/cli": "^1.4.1",
39
39
  "art-template": "^4.13.2",
40
40
  "fs-extra": "^10.1.0",
41
- "miniprogram-api-typings": "^3.11.0",
41
+ "miniprogram-api-typings": "^3.12.0",
42
42
  "react": "^17.0.2"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public",
46
46
  "registry": "https://registry.npmjs.org"
47
47
  },
48
- "gitHead": "14cb935df10f020e714b44bb41d4899646db751c"
48
+ "gitHead": "7c45027c91f744019b2b0f9ca76f2b65f6a2c857"
49
49
  }