@tarojs/taro 3.3.11 → 3.3.15
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/package.json +5 -5
- package/types/api/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +80 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +32 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +167 -121
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/global.d.ts +390 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +33 -75
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro, { DownloadTask, UploadTask } from "../../index"
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace cloud {
|
|
3
5
|
/** 云函数通用返回 */
|
|
4
|
-
interface CallFunctionResult extends
|
|
6
|
+
interface CallFunctionResult extends TaroGeneral.CallbackResult {
|
|
5
7
|
/** 云函数返回的结果 */
|
|
6
|
-
result:
|
|
8
|
+
result: TaroGeneral.IAnyObject | string | undefined
|
|
7
9
|
/** 调用结果 */
|
|
8
10
|
errMsg: string
|
|
9
11
|
}
|
|
10
12
|
/** 云函数通用参数 */
|
|
11
|
-
interface
|
|
13
|
+
interface IApiParam<T = any> {
|
|
12
14
|
/** 配置 */
|
|
13
15
|
config?: IConfig
|
|
14
16
|
/** 接口调用成功的回调函数 */
|
|
15
17
|
success?: (res: T) => void
|
|
16
18
|
/** 接口调用失败的回调函数 */
|
|
17
|
-
fail?: (err:
|
|
19
|
+
fail?: (err: TaroGeneral.CallbackResult) => void
|
|
18
20
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
19
|
-
complete?: (val: T |
|
|
21
|
+
complete?: (val: T | TaroGeneral.CallbackResult) => void
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
// type
|
|
24
|
+
// type IApiFunction<T, P extends IApiParam<T>> = (param?: P) => Promise<T>
|
|
23
25
|
|
|
24
26
|
/** 初始化配置 */
|
|
25
27
|
interface IInitConfig {
|
|
@@ -45,18 +47,18 @@ declare namespace Taro {
|
|
|
45
47
|
traceUser?: boolean
|
|
46
48
|
}
|
|
47
49
|
/** 云函数 API 通用参数 */
|
|
48
|
-
interface ICloudAPIParam<T = any> extends
|
|
50
|
+
interface ICloudAPIParam<T = any> extends IApiParam<T> {
|
|
49
51
|
/** 配置 */
|
|
50
52
|
config?: IConfig
|
|
51
53
|
}
|
|
52
54
|
// interface IICloudAPI {
|
|
53
55
|
// init: (config?: cloud.IInitConfig) => void
|
|
54
|
-
// [api: string]: (...args: any[]) => any | cloud.
|
|
56
|
+
// [api: string]: (...args: any[]) => any | cloud.IApiFunction<any, any>
|
|
55
57
|
// }
|
|
56
58
|
// interface ICloudService {
|
|
57
59
|
// name: string
|
|
58
60
|
|
|
59
|
-
// getAPIs: () => { [name: string]: cloud.
|
|
61
|
+
// getAPIs: () => { [name: string]: cloud.IApiFunction<any, any> }
|
|
60
62
|
// }
|
|
61
63
|
// interface ICloudServices {
|
|
62
64
|
// [serviceName: string]: ICloudService
|
|
@@ -70,20 +72,20 @@ declare namespace Taro {
|
|
|
70
72
|
/** 云函数名 */
|
|
71
73
|
name: string
|
|
72
74
|
/** 传递给云函数的参数,在云函数中可通过 event 参数获取 */
|
|
73
|
-
data?:
|
|
75
|
+
data?: TaroGeneral.IAnyObject
|
|
74
76
|
slow?: boolean
|
|
75
77
|
/** 配置 */
|
|
76
78
|
config?: IConfig
|
|
77
79
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
78
|
-
complete?: (res: CallFunctionResult |
|
|
80
|
+
complete?: (res: CallFunctionResult | TaroGeneral.CallbackResult) => void
|
|
79
81
|
/** 接口调用失败的回调函数 */
|
|
80
|
-
fail?: (res:
|
|
82
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
81
83
|
/** 接口调用成功的回调函数 */
|
|
82
84
|
success?: (res: CallFunctionResult) => void
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
/** 上传文件结果 */
|
|
86
|
-
interface UploadFileResult extends
|
|
88
|
+
interface UploadFileResult extends TaroGeneral.CallbackResult {
|
|
87
89
|
/** 文件 ID */
|
|
88
90
|
fileID: string
|
|
89
91
|
/** 服务器返回的 HTTP 状态码 */
|
|
@@ -98,19 +100,19 @@ declare namespace Taro {
|
|
|
98
100
|
cloudPath: string
|
|
99
101
|
/** 要上传文件资源的路径 */
|
|
100
102
|
filePath: string
|
|
101
|
-
header?:
|
|
103
|
+
header?: TaroGeneral.IAnyObject
|
|
102
104
|
/** 配置 */
|
|
103
105
|
config?: IConfig
|
|
104
106
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
105
|
-
complete?: (res: UploadFileResult |
|
|
107
|
+
complete?: (res: UploadFileResult | TaroGeneral.CallbackResult) => void
|
|
106
108
|
/** 接口调用失败的回调函数 */
|
|
107
|
-
fail?: (res:
|
|
109
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
108
110
|
/** 接口调用成功的回调函数 */
|
|
109
111
|
success?: (res: UploadFileResult) => void
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
/** 下载文件结果 */
|
|
113
|
-
interface DownloadFileResult extends
|
|
115
|
+
interface DownloadFileResult extends TaroGeneral.CallbackResult {
|
|
114
116
|
/** 临时文件路径 */
|
|
115
117
|
tempFilePath: string
|
|
116
118
|
/** 服务器返回的 HTTP 状态码 */
|
|
@@ -127,15 +129,15 @@ declare namespace Taro {
|
|
|
127
129
|
/** 配置 */
|
|
128
130
|
config?: IConfig
|
|
129
131
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
130
|
-
complete?: (res: DownloadFileResult |
|
|
132
|
+
complete?: (res: DownloadFileResult | TaroGeneral.CallbackResult) => void
|
|
131
133
|
/** 接口调用失败的回调函数 */
|
|
132
|
-
fail?: (res:
|
|
134
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
133
135
|
/** 接口调用成功的回调函数 */
|
|
134
136
|
success?: (res: DownloadFileResult) => void
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
/** 获取临时文件结果 */
|
|
138
|
-
interface GetTempFileURLResult extends
|
|
140
|
+
interface GetTempFileURLResult extends TaroGeneral.CallbackResult {
|
|
139
141
|
/** 文件列表 */
|
|
140
142
|
fileList: GetTempFileURLResultItem[]
|
|
141
143
|
/** 调用结果 */
|
|
@@ -143,7 +145,7 @@ declare namespace Taro {
|
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
/** 临时文件列表 */
|
|
146
|
-
interface GetTempFileURLResultItem extends
|
|
148
|
+
interface GetTempFileURLResultItem extends TaroGeneral.CallbackResult {
|
|
147
149
|
/** 云文件 ID */
|
|
148
150
|
fileID: string
|
|
149
151
|
/** 临时文件路径 */
|
|
@@ -161,15 +163,15 @@ declare namespace Taro {
|
|
|
161
163
|
/** 配置 */
|
|
162
164
|
config?: IConfig
|
|
163
165
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
164
|
-
complete?: (res: GetTempFileURLResult |
|
|
166
|
+
complete?: (res: GetTempFileURLResult | TaroGeneral.CallbackResult) => void
|
|
165
167
|
/** 接口调用失败的回调函数 */
|
|
166
|
-
fail?: (res:
|
|
168
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
167
169
|
/** 接口调用成功的回调函数 */
|
|
168
170
|
success?: (res: GetTempFileURLResult) => void
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/** 删除文件结果 */
|
|
172
|
-
interface DeleteFileResult extends
|
|
174
|
+
interface DeleteFileResult extends TaroGeneral.CallbackResult {
|
|
173
175
|
/** 文件列表 */
|
|
174
176
|
fileList: DeleteFileResultItem[]
|
|
175
177
|
/** 调用结果 */
|
|
@@ -177,7 +179,7 @@ declare namespace Taro {
|
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
/** 删除文件列表 */
|
|
180
|
-
interface DeleteFileResultItem extends
|
|
182
|
+
interface DeleteFileResultItem extends TaroGeneral.CallbackResult {
|
|
181
183
|
/** 云文件 ID */
|
|
182
184
|
fileID: string
|
|
183
185
|
/** 状态码 */
|
|
@@ -193,9 +195,9 @@ declare namespace Taro {
|
|
|
193
195
|
/** 配置 */
|
|
194
196
|
config?: IConfig
|
|
195
197
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
196
|
-
complete?: (res: DeleteFileResult |
|
|
198
|
+
complete?: (res: DeleteFileResult | TaroGeneral.CallbackResult) => void
|
|
197
199
|
/** 接口调用失败的回调函数 */
|
|
198
|
-
fail?: (res:
|
|
200
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
199
201
|
/** 接口调用成功的回调函数 */
|
|
200
202
|
success?: (res: DeleteFileResult) => void
|
|
201
203
|
}
|
|
@@ -209,49 +211,49 @@ declare namespace Taro {
|
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
/** 调用云托管参数 */
|
|
212
|
-
interface CallContainerParam < P extends string |
|
|
214
|
+
interface CallContainerParam < P extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
|
|
213
215
|
/** 服务路径 */
|
|
214
216
|
path: string
|
|
215
217
|
/** HTTP请求方法,默认 GET */
|
|
216
|
-
method?: keyof
|
|
218
|
+
method?: keyof request.method
|
|
217
219
|
/** 请求数据 */
|
|
218
220
|
data?: P
|
|
219
221
|
/** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
|
|
220
|
-
header?:
|
|
222
|
+
header?: TaroGeneral.IAnyObject
|
|
221
223
|
/** 超时时间,单位为毫秒 */
|
|
222
224
|
timeout?: number
|
|
223
225
|
/** 返回的数据格式 */
|
|
224
|
-
dataType?:
|
|
226
|
+
dataType?: request.dataType
|
|
225
227
|
/** 响应的数据类型 */
|
|
226
228
|
responseType?: keyof {
|
|
227
229
|
text
|
|
228
230
|
arraybuffer
|
|
229
231
|
}
|
|
230
232
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
231
|
-
complete?: (res: CallFunctionResult |
|
|
233
|
+
complete?: (res: CallFunctionResult | TaroGeneral.CallbackResult) => void
|
|
232
234
|
/** 接口调用失败的回调函数 */
|
|
233
|
-
fail?: (res:
|
|
235
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
234
236
|
/** 接口调用成功的回调函数 */
|
|
235
237
|
success?: (res: CallFunctionResult) => void
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
/** 调用云托管返回值 */
|
|
239
|
-
interface CallContainerResult < R extends string |
|
|
241
|
+
interface CallContainerResult < R extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
|
|
240
242
|
/** 开发者云托管服务返回的数据 */
|
|
241
243
|
data: R
|
|
242
244
|
/** 开发者云托管返回的 HTTP Response Header */
|
|
243
|
-
header:
|
|
245
|
+
header: TaroGeneral.IAnyObject
|
|
244
246
|
/** 开发者云托管服务返回的 HTTP 状态码 */
|
|
245
247
|
statusCode: number
|
|
246
248
|
/** 开发者云托管返回的 cookies,格式为字符串数组,仅小程序端有此字段 */
|
|
247
|
-
cookies?:
|
|
249
|
+
cookies?: TaroGeneral.IAnyObject
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
/** 云开发 SDK 实例
|
|
252
254
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/Cloud.html
|
|
253
255
|
*/
|
|
254
|
-
|
|
256
|
+
interface cloud {
|
|
255
257
|
/** 在调用云开发各 API 前,需先调用初始化方法 init 一次(全局只需一次,多次调用时只有第一次生效)
|
|
256
258
|
* @supported weapp
|
|
257
259
|
* @example
|
|
@@ -262,12 +264,12 @@ declare namespace Taro {
|
|
|
262
264
|
* ```
|
|
263
265
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/init/client.init.html
|
|
264
266
|
*/
|
|
265
|
-
|
|
267
|
+
init(config?: cloud.IInitConfig): void
|
|
266
268
|
|
|
267
269
|
/** 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊对象,将该对象传至云函数可以获取其对应的开放数据。
|
|
268
270
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html
|
|
269
271
|
*/
|
|
270
|
-
|
|
272
|
+
CloudID(cloudID: string): void
|
|
271
273
|
|
|
272
274
|
/** 调用云函数
|
|
273
275
|
* @supported weapp
|
|
@@ -291,8 +293,8 @@ declare namespace Taro {
|
|
|
291
293
|
* ```
|
|
292
294
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html
|
|
293
295
|
*/
|
|
294
|
-
|
|
295
|
-
|
|
296
|
+
callFunction(param: OQ<cloud.CallFunctionParam>): void
|
|
297
|
+
callFunction(param: RQ<cloud.CallFunctionParam>): Promise<cloud.CallFunctionResult>
|
|
296
298
|
|
|
297
299
|
/** 将本地资源上传至云存储空间,如果上传至同一路径则是覆盖写
|
|
298
300
|
* @supported weapp
|
|
@@ -324,8 +326,8 @@ declare namespace Taro {
|
|
|
324
326
|
* ```
|
|
325
327
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/uploadFile/client.uploadFile.html
|
|
326
328
|
*/
|
|
327
|
-
|
|
328
|
-
|
|
329
|
+
uploadFile(param: OQ<cloud.UploadFileParam>): Taro.UploadTask
|
|
330
|
+
uploadFile(param: RQ<cloud.UploadFileParam>): Promise<cloud.UploadFileResult>
|
|
329
331
|
|
|
330
332
|
/** 从云存储空间下载文件
|
|
331
333
|
* @supported weapp
|
|
@@ -355,8 +357,8 @@ declare namespace Taro {
|
|
|
355
357
|
* ```
|
|
356
358
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/downloadFile/client.downloadFile.html
|
|
357
359
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
downloadFile(param: OQ<cloud.DownloadFileParam>): DownloadTask
|
|
361
|
+
downloadFile(param: RQ<cloud.DownloadFileParam>): Promise<cloud.DownloadFileResult>
|
|
360
362
|
|
|
361
363
|
/** 用云文件 ID 换取真实链接,公有读的文件获取的链接不会过期,私有的文件获取的链接十分钟有效期。一次最多取 50 个。
|
|
362
364
|
* @supported weapp
|
|
@@ -389,8 +391,8 @@ declare namespace Taro {
|
|
|
389
391
|
* ```
|
|
390
392
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/Cloud.getTempFileURL.html
|
|
391
393
|
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
|
+
getTempFileURL(param: OQ<cloud.GetTempFileURLParam>): void
|
|
395
|
+
getTempFileURL(param: RQ<cloud.GetTempFileURLParam>): Promise<cloud.GetTempFileURLResult>
|
|
394
396
|
|
|
395
397
|
/** 从云存储空间删除文件,一次最多 50 个
|
|
396
398
|
* @supported weapp
|
|
@@ -423,8 +425,8 @@ declare namespace Taro {
|
|
|
423
425
|
* ```
|
|
424
426
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/Cloud.deleteFile.html
|
|
425
427
|
*/
|
|
426
|
-
|
|
427
|
-
|
|
428
|
+
deleteFile(param: OQ<cloud.DeleteFileParam>): void
|
|
429
|
+
deleteFile(param: RQ<cloud.DeleteFileParam>): Promise<cloud.DeleteFileResult>
|
|
428
430
|
|
|
429
431
|
/** 获取数据库实例
|
|
430
432
|
* @supported weapp
|
|
@@ -444,7 +446,7 @@ declare namespace Taro {
|
|
|
444
446
|
* ```
|
|
445
447
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/Cloud.database.html
|
|
446
448
|
*/
|
|
447
|
-
|
|
449
|
+
database(config?: cloud.IConfig): DB.Database
|
|
448
450
|
|
|
449
451
|
/** 声明新的云开发操作实例
|
|
450
452
|
* @supported weapp
|
|
@@ -476,7 +478,7 @@ declare namespace Taro {
|
|
|
476
478
|
* ```
|
|
477
479
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/utils/Cloud.Cloud.html
|
|
478
480
|
*/
|
|
479
|
-
|
|
481
|
+
Cloud: new (options: cloud.IOptions) => Cloud
|
|
480
482
|
|
|
481
483
|
/** 调用云托管服务
|
|
482
484
|
* @supported weapp
|
|
@@ -491,10 +493,10 @@ declare namespace Taro {
|
|
|
491
493
|
* ```
|
|
492
494
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/container/Cloud.callContainer.html
|
|
493
495
|
*/
|
|
494
|
-
|
|
496
|
+
callContainer < R = any, P = any >(params: cloud.CallContainerParam<P>): Promise<cloud.CallContainerResult<R>>
|
|
495
497
|
}
|
|
496
498
|
|
|
497
|
-
|
|
499
|
+
interface Cloud {
|
|
498
500
|
/** 在调用云开发各 API 前,需先调用初始化方法 init 一次(全局只需一次,多次调用时只有第一次生效)
|
|
499
501
|
* @supported weapp
|
|
500
502
|
* @example
|
|
@@ -510,7 +512,7 @@ declare namespace Taro {
|
|
|
510
512
|
/** 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊对象,将该对象传至云函数可以获取其对应的开放数据。
|
|
511
513
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html
|
|
512
514
|
*/
|
|
513
|
-
|
|
515
|
+
CloudID(cloudID: string): void
|
|
514
516
|
|
|
515
517
|
/** 调用云函数
|
|
516
518
|
* @supported weapp
|
|
@@ -567,7 +569,7 @@ declare namespace Taro {
|
|
|
567
569
|
* ```
|
|
568
570
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/uploadFile/client.uploadFile.html
|
|
569
571
|
*/
|
|
570
|
-
uploadFile(param: OQ<cloud.UploadFileParam>):
|
|
572
|
+
uploadFile(param: OQ<cloud.UploadFileParam>): UploadTask
|
|
571
573
|
uploadFile(param: RQ<cloud.UploadFileParam>): Promise<cloud.UploadFileResult>
|
|
572
574
|
|
|
573
575
|
/** 从云存储空间下载文件
|
|
@@ -598,7 +600,7 @@ declare namespace Taro {
|
|
|
598
600
|
* ```
|
|
599
601
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/downloadFile/client.downloadFile.html
|
|
600
602
|
*/
|
|
601
|
-
downloadFile(param: OQ<cloud.DownloadFileParam>):
|
|
603
|
+
downloadFile(param: OQ<cloud.DownloadFileParam>): DownloadTask
|
|
602
604
|
downloadFile(param: RQ<cloud.DownloadFileParam>): Promise<cloud.DownloadFileResult>
|
|
603
605
|
|
|
604
606
|
/** 用云文件 ID 换取真实链接,公有读的文件获取的链接不会过期,私有的文件获取的链接十分钟有效期。一次最多取 50 个。
|
|
@@ -956,7 +958,7 @@ declare namespace Taro {
|
|
|
956
958
|
* ```
|
|
957
959
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/collection/Collection.field.html
|
|
958
960
|
*/
|
|
959
|
-
field(object:
|
|
961
|
+
field(object: TaroGeneral.IAnyObject): Collection
|
|
960
962
|
|
|
961
963
|
/** 获取集合数据,或获取根据查询条件筛选后的集合数据。
|
|
962
964
|
*
|
|
@@ -1266,7 +1268,7 @@ declare namespace Taro {
|
|
|
1266
1268
|
}
|
|
1267
1269
|
|
|
1268
1270
|
/** 数据库 API 通用参数 */
|
|
1269
|
-
type IDBAPIParam = cloud.
|
|
1271
|
+
type IDBAPIParam = cloud.IApiParam
|
|
1270
1272
|
|
|
1271
1273
|
/** 新增记录的定义 */
|
|
1272
1274
|
interface IAddDocumentOptions extends IDBAPIParam {
|
|
@@ -1275,19 +1277,19 @@ declare namespace Taro {
|
|
|
1275
1277
|
/** 配置 */
|
|
1276
1278
|
config?: cloud.IConfig
|
|
1277
1279
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1278
|
-
complete?: (res:
|
|
1280
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1279
1281
|
/** 接口调用失败的回调函数 */
|
|
1280
|
-
fail?: (res:
|
|
1282
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1281
1283
|
/** 接口调用成功的回调函数 */
|
|
1282
|
-
success?: (res:
|
|
1284
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1283
1285
|
}
|
|
1284
1286
|
|
|
1285
1287
|
/** 监听集合中符合查询条件的数据的更新事件 */
|
|
1286
1288
|
interface IWatchDocumentOptions {
|
|
1287
1289
|
/** 成功回调,回调传入的参数 snapshot 是变更快照 */
|
|
1288
|
-
onChange?: (res:
|
|
1290
|
+
onChange?: (res: TaroGeneral.CallbackResult) => void
|
|
1289
1291
|
/** 失败回调 */
|
|
1290
|
-
onError?: (res:
|
|
1292
|
+
onError?: (res: TaroGeneral.CallbackResult) => void
|
|
1291
1293
|
}
|
|
1292
1294
|
|
|
1293
1295
|
/** 变更快照 */
|
|
@@ -1295,7 +1297,7 @@ declare namespace Taro {
|
|
|
1295
1297
|
/** 更新事件数组 */
|
|
1296
1298
|
docChanges: ChangeEvent[]
|
|
1297
1299
|
/** 数据快照,表示此更新事件发生后查询语句对应的查询结果 */
|
|
1298
|
-
docs:
|
|
1300
|
+
docs: TaroGeneral.IAnyObject[]
|
|
1299
1301
|
/** 快照类型,仅在第一次初始化数据时有值为 init */
|
|
1300
1302
|
type: string
|
|
1301
1303
|
/** 变更事件 id */
|
|
@@ -1313,9 +1315,9 @@ declare namespace Taro {
|
|
|
1313
1315
|
/** 更新的记录 id */
|
|
1314
1316
|
docId: string
|
|
1315
1317
|
/** 更新的完整记录 */
|
|
1316
|
-
doc:
|
|
1318
|
+
doc: TaroGeneral.IAnyObject
|
|
1317
1319
|
/** 所有更新的字段及字段更新后的值,`key` 为更新的字段路径,`value` 为字段更新后的值,仅在 `update` 操作时有此信息 */
|
|
1318
|
-
updatedFields:
|
|
1320
|
+
updatedFields: TaroGeneral.IAnyObject
|
|
1319
1321
|
/** 所有被删除的字段,仅在 `update` 操作时有此信息 */
|
|
1320
1322
|
removedFields: string[]
|
|
1321
1323
|
}
|
|
@@ -1363,11 +1365,11 @@ declare namespace Taro {
|
|
|
1363
1365
|
/** 配置 */
|
|
1364
1366
|
config?: cloud.IConfig
|
|
1365
1367
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1366
|
-
complete?: (res:
|
|
1368
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1367
1369
|
/** 接口调用失败的回调函数 */
|
|
1368
|
-
fail?: (res:
|
|
1370
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1369
1371
|
/** 接口调用成功的回调函数 */
|
|
1370
|
-
success?: (res:
|
|
1372
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1371
1373
|
}
|
|
1372
1374
|
|
|
1373
1375
|
/** 更新单条记录参数 */
|
|
@@ -1377,11 +1379,11 @@ declare namespace Taro {
|
|
|
1377
1379
|
/** 配置 */
|
|
1378
1380
|
config?: cloud.IConfig
|
|
1379
1381
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1380
|
-
complete?: (res:
|
|
1382
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1381
1383
|
/** 接口调用失败的回调函数 */
|
|
1382
|
-
fail?: (res:
|
|
1384
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1383
1385
|
/** 接口调用成功的回调函数 */
|
|
1384
|
-
success?: (res:
|
|
1386
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1385
1387
|
}
|
|
1386
1388
|
|
|
1387
1389
|
/** 替换记录参数 */
|
|
@@ -1391,11 +1393,11 @@ declare namespace Taro {
|
|
|
1391
1393
|
/** 配置 */
|
|
1392
1394
|
config?: cloud.IConfig
|
|
1393
1395
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1394
|
-
complete?: (res:
|
|
1396
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1395
1397
|
/** 接口调用失败的回调函数 */
|
|
1396
|
-
fail?: (res:
|
|
1398
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1397
1399
|
/** 接口调用成功的回调函数 */
|
|
1398
|
-
success?: (res:
|
|
1400
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1399
1401
|
}
|
|
1400
1402
|
|
|
1401
1403
|
/** 替换一条记录参数 */
|
|
@@ -1404,11 +1406,11 @@ declare namespace Taro {
|
|
|
1404
1406
|
/** 配置 */
|
|
1405
1407
|
config?: cloud.IConfig
|
|
1406
1408
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1407
|
-
complete?: (res:
|
|
1409
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1408
1410
|
/** 接口调用失败的回调函数 */
|
|
1409
|
-
fail?: (res:
|
|
1411
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1410
1412
|
/** 接口调用成功的回调函数 */
|
|
1411
|
-
success?: (res:
|
|
1413
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1412
1414
|
}
|
|
1413
1415
|
|
|
1414
1416
|
/** 删除记录参数 */
|
|
@@ -1417,11 +1419,11 @@ declare namespace Taro {
|
|
|
1417
1419
|
/** 配置 */
|
|
1418
1420
|
config?: cloud.IConfig
|
|
1419
1421
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1420
|
-
complete?: (res:
|
|
1422
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1421
1423
|
/** 接口调用失败的回调函数 */
|
|
1422
|
-
fail?: (res:
|
|
1424
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
1423
1425
|
/** 接口调用成功的回调函数 */
|
|
1424
|
-
success?: (res:
|
|
1426
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1425
1427
|
}
|
|
1426
1428
|
|
|
1427
1429
|
/** 删除一条记录参数 */
|
|
@@ -1533,7 +1535,7 @@ declare namespace Taro {
|
|
|
1533
1535
|
* ```
|
|
1534
1536
|
* @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/collection/Collection.field.html
|
|
1535
1537
|
*/
|
|
1536
|
-
field(object:
|
|
1538
|
+
field(object: TaroGeneral.IAnyObject): Query
|
|
1537
1539
|
|
|
1538
1540
|
/** 获取集合数据,或获取根据查询条件筛选后的集合数据。
|
|
1539
1541
|
*
|
|
@@ -1600,26 +1602,26 @@ declare namespace Taro {
|
|
|
1600
1602
|
|
|
1601
1603
|
type IStringQueryCondition = string
|
|
1602
1604
|
|
|
1603
|
-
interface IQueryResult extends
|
|
1605
|
+
interface IQueryResult extends TaroGeneral.CallbackResult {
|
|
1604
1606
|
/** 查询的结果数组,数据的每个元素是一个 Object,代表一条记录 */
|
|
1605
1607
|
data: Document.IDocumentData[]
|
|
1606
1608
|
/** 调用结果 */
|
|
1607
1609
|
errMsg: string
|
|
1608
1610
|
}
|
|
1609
1611
|
|
|
1610
|
-
interface IQuerySingleResult extends
|
|
1612
|
+
interface IQuerySingleResult extends TaroGeneral.CallbackResult {
|
|
1611
1613
|
data: Document.IDocumentData
|
|
1612
1614
|
/** 调用结果 */
|
|
1613
1615
|
errMsg: string
|
|
1614
1616
|
}
|
|
1615
1617
|
|
|
1616
|
-
interface IAddResult extends
|
|
1618
|
+
interface IAddResult extends TaroGeneral.CallbackResult {
|
|
1617
1619
|
_id: Document.DocumentId
|
|
1618
1620
|
/** 调用结果 */
|
|
1619
1621
|
errMsg: string
|
|
1620
1622
|
}
|
|
1621
1623
|
|
|
1622
|
-
interface IUpdateResult extends
|
|
1624
|
+
interface IUpdateResult extends TaroGeneral.CallbackResult {
|
|
1623
1625
|
stats: {
|
|
1624
1626
|
updated: number
|
|
1625
1627
|
// created: number
|
|
@@ -1628,7 +1630,7 @@ declare namespace Taro {
|
|
|
1628
1630
|
errMsg: string
|
|
1629
1631
|
}
|
|
1630
1632
|
|
|
1631
|
-
interface ISetResult extends
|
|
1633
|
+
interface ISetResult extends TaroGeneral.CallbackResult {
|
|
1632
1634
|
_id: Document.DocumentId
|
|
1633
1635
|
stats: {
|
|
1634
1636
|
updated: number
|
|
@@ -1638,7 +1640,7 @@ declare namespace Taro {
|
|
|
1638
1640
|
errMsg: string
|
|
1639
1641
|
}
|
|
1640
1642
|
|
|
1641
|
-
interface IRemoveResult extends
|
|
1643
|
+
interface IRemoveResult extends TaroGeneral.CallbackResult {
|
|
1642
1644
|
stats: {
|
|
1643
1645
|
removed: number,
|
|
1644
1646
|
}
|
|
@@ -1646,7 +1648,7 @@ declare namespace Taro {
|
|
|
1646
1648
|
errMsg: string
|
|
1647
1649
|
}
|
|
1648
1650
|
|
|
1649
|
-
interface ICountResult extends
|
|
1651
|
+
interface ICountResult extends TaroGeneral.CallbackResult {
|
|
1650
1652
|
/** 结果数量 */
|
|
1651
1653
|
total: number
|
|
1652
1654
|
/** 调用结果 */
|
|
@@ -2573,12 +2575,15 @@ declare namespace Taro {
|
|
|
2573
2575
|
}
|
|
2574
2576
|
}
|
|
2575
2577
|
}
|
|
2576
|
-
}
|
|
2577
2578
|
|
|
2578
|
-
|
|
2579
|
+
|
|
2580
|
+
interface TaroStatic {
|
|
2581
|
+
cloud: cloud & Cloud
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2579
2584
|
|
|
2580
2585
|
type OQ<
|
|
2581
|
-
T extends
|
|
2586
|
+
T extends Partial<
|
|
2582
2587
|
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
|
|
2583
2588
|
>
|
|
2584
2589
|
> =
|
|
@@ -2591,7 +2596,7 @@ type OQ<
|
|
|
2591
2596
|
| (RQ<T> & Required<Pick<T, 'fail' | 'complete' | 'success'>>)
|
|
2592
2597
|
|
|
2593
2598
|
type RQ<
|
|
2594
|
-
T extends
|
|
2599
|
+
T extends Partial<
|
|
2595
2600
|
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
|
|
2596
2601
|
>
|
|
2597
2602
|
> = Pick<T, Exclude<keyof T, 'complete' | 'success' | 'fail'>>
|