@cloudbase/js-sdk 4.0.0 → 4.0.1-alpha.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/CHANGELOG.md +398 -0
- package/ai/dist/index.esm.js +2 -3
- package/ai/dist/index.esm.js.map +1 -0
- package/ai/dist/index.js +2 -21
- package/ai/dist/index.js.map +1 -0
- package/apis/dist/index.d.ts +1 -0
- package/apis/dist/index.esm.js +2 -0
- package/apis/dist/index.esm.js.map +1 -0
- package/apis/dist/index.js +2 -0
- package/apis/dist/index.js.map +1 -0
- package/{analytics → apis}/package.json +1 -1
- package/app/dist/index.esm.js +2 -11
- package/app/dist/index.esm.js.map +1 -0
- package/app/dist/index.js +2 -18
- package/app/dist/index.js.map +1 -0
- package/app/dist/index.node.esm.js +3 -0
- package/app/dist/index.node.esm.js.LICENSE.txt +13 -0
- package/app/dist/index.node.esm.js.map +1 -0
- package/app/dist/index.node.js +3 -0
- package/app/dist/index.node.js.LICENSE.txt +13 -0
- package/app/dist/index.node.js.map +1 -0
- package/app/package.json +12 -1
- package/auth/dist/index.d.ts +2 -2
- package/auth/dist/index.esm.js +3 -4
- package/auth/dist/index.esm.js.LICENSE.txt +12 -0
- package/auth/dist/index.esm.js.map +1 -0
- package/auth/dist/index.js +3 -9
- package/auth/dist/index.js.LICENSE.txt +12 -0
- package/auth/dist/index.js.map +1 -0
- package/cloudrun/dist/index.esm.js +2 -3
- package/cloudrun/dist/index.esm.js.map +1 -0
- package/cloudrun/dist/index.js +2 -21
- package/cloudrun/dist/index.js.map +1 -0
- package/container/dist/index.d.ts +2 -2
- package/container/dist/index.esm.js +2 -4
- package/container/dist/index.esm.js.map +1 -0
- package/container/dist/index.js +2 -9
- package/container/dist/index.js.map +1 -0
- package/core.d.ts +4331 -0
- package/core.node.d.ts +294 -0
- package/database/dist/index.esm.js +2 -47
- package/database/dist/index.esm.js.map +1 -0
- package/database/dist/index.js +2 -53
- package/database/dist/index.js.map +1 -0
- package/database/package.json +34 -4
- package/dist/index.cjs.js +3 -37
- package/dist/index.cjs.js.LICENSE.txt +12 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +3 -32
- package/dist/index.esm.js.LICENSE.txt +12 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.node.cjs.js +3 -0
- package/dist/index.node.cjs.js.LICENSE.txt +26 -0
- package/dist/index.node.cjs.js.map +1 -0
- package/dist/index.node.esm.js +3 -0
- package/dist/index.node.esm.js.LICENSE.txt +26 -0
- package/dist/index.node.esm.js.map +1 -0
- package/functions/dist/index.d.ts +2 -2
- package/functions/dist/index.esm.js +2 -4
- package/functions/dist/index.esm.js.map +1 -0
- package/functions/dist/index.js +2 -9
- package/functions/dist/index.js.map +1 -0
- package/index.d.ts +7 -1785
- package/index.node.d.ts +13 -0
- package/miniprogram_dist/ai/index.d.ts +42 -0
- package/miniprogram_dist/ai/index.js +2 -0
- package/miniprogram_dist/apis/index.d.ts +5 -0
- package/miniprogram_dist/apis/index.js +1 -0
- package/miniprogram_dist/app/index.d.ts +67 -0
- package/miniprogram_dist/app/index.js +2 -0
- package/miniprogram_dist/auth/index.d.ts +269 -0
- package/miniprogram_dist/auth/index.js +2 -0
- package/miniprogram_dist/cloudrun/index.d.ts +4 -0
- package/miniprogram_dist/cloudrun/index.js +1 -0
- package/miniprogram_dist/container/index.d.ts +13 -0
- package/miniprogram_dist/container/index.js +1 -0
- package/miniprogram_dist/database/index.d.ts +3 -0
- package/miniprogram_dist/database/index.js +1 -0
- package/miniprogram_dist/functions/index.d.ts +2 -0
- package/miniprogram_dist/functions/index.js +1 -0
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/model/index.d.ts +5 -0
- package/miniprogram_dist/model/index.js +1 -0
- package/miniprogram_dist/mysql/index.d.ts +3 -0
- package/miniprogram_dist/mysql/index.js +1 -0
- package/miniprogram_dist/oauth/index.d.ts +22 -0
- package/miniprogram_dist/oauth/index.js +2 -0
- package/miniprogram_dist/realtime/index.d.ts +2 -0
- package/miniprogram_dist/realtime/index.js +1 -0
- package/miniprogram_dist/storage/index.d.ts +13 -0
- package/miniprogram_dist/storage/index.js +1 -0
- package/model/dist/index.esm.js +2 -3
- package/model/dist/index.esm.js.map +1 -0
- package/model/dist/index.js +2 -21
- package/model/dist/index.js.map +1 -0
- package/mysql/dist/index.d.ts +1 -0
- package/mysql/dist/index.esm.js +2 -0
- package/mysql/dist/index.esm.js.map +1 -0
- package/mysql/dist/index.js +2 -0
- package/mysql/dist/index.js.map +1 -0
- package/mysql/package.json +6 -0
- package/oauth/dist/index.esm.js +3 -3
- package/oauth/dist/index.esm.js.LICENSE.txt +12 -0
- package/oauth/dist/index.esm.js.map +1 -0
- package/oauth/dist/index.js +3 -21
- package/oauth/dist/index.js.LICENSE.txt +12 -0
- package/oauth/dist/index.js.map +1 -0
- package/package.json +144 -18
- package/realtime/dist/index.d.ts +2 -2
- package/realtime/dist/index.esm.js +2 -4
- package/realtime/dist/index.esm.js.map +1 -0
- package/realtime/dist/index.js +2 -9
- package/realtime/dist/index.js.map +1 -0
- package/storage/dist/index.d.ts +2 -2
- package/storage/dist/index.esm.js +2 -4
- package/storage/dist/index.esm.js.map +1 -0
- package/storage/dist/index.js +2 -9
- package/storage/dist/index.js.map +1 -0
- package/types/analytics.d.ts +51 -0
- package/types/auth.d.ts +166 -0
- package/types/cache.d.ts +26 -0
- package/types/cloudrun.d.ts +9 -0
- package/types/component.d.ts +17 -0
- package/types/container.d.ts +93 -0
- package/types/database.d.ts +31 -0
- package/types/error.d.ts +40 -0
- package/types/events.d.ts +13 -0
- package/types/functions.d.ts +49 -0
- package/types/index.d.ts +269 -0
- package/types/package.json +47 -0
- package/types/realtime.d.ts +350 -0
- package/types/request.d.ts +30 -0
- package/types/result.d.ts +48 -0
- package/types/storage.d.ts +144 -0
- package/utilities/dist/cjs/adapters/index.d.ts +45 -0
- package/utilities/dist/cjs/adapters/index.js +68 -0
- package/utilities/dist/cjs/adapters/platforms/web.d.ts +20 -0
- package/utilities/dist/cjs/adapters/platforms/web.js +286 -0
- package/utilities/dist/cjs/constants/common.d.ts +6 -0
- package/utilities/dist/cjs/constants/common.js +24 -0
- package/utilities/dist/cjs/constants/errors.d.ts +8 -0
- package/utilities/dist/cjs/constants/errors.js +12 -0
- package/utilities/dist/cjs/constants/index.d.ts +3 -0
- package/utilities/dist/cjs/constants/index.js +21 -0
- package/utilities/dist/cjs/helpers/decorators.d.ts +11 -0
- package/utilities/dist/cjs/helpers/decorators.js +238 -0
- package/utilities/dist/cjs/helpers/index.d.ts +1 -0
- package/utilities/dist/cjs/helpers/index.js +18 -0
- package/utilities/dist/cjs/index.d.ts +13 -0
- package/utilities/dist/cjs/index.js +51 -0
- package/utilities/dist/cjs/libs/abortController.d.ts +9 -0
- package/utilities/dist/cjs/libs/abortController.js +25 -0
- package/utilities/dist/cjs/libs/cache.d.ts +17 -0
- package/utilities/dist/cjs/libs/cache.js +261 -0
- package/utilities/dist/cjs/libs/events.d.ts +27 -0
- package/utilities/dist/cjs/libs/events.js +108 -0
- package/utilities/dist/cjs/libs/langEvent.d.ts +3 -0
- package/utilities/dist/cjs/libs/langEvent.js +7 -0
- package/utilities/dist/cjs/libs/util.d.ts +49 -0
- package/utilities/dist/cjs/libs/util.js +282 -0
- package/utilities/dist/esm/adapters/index.d.ts +45 -0
- package/utilities/dist/esm/adapters/index.js +40 -0
- package/utilities/dist/esm/adapters/platforms/web.d.ts +20 -0
- package/utilities/dist/esm/adapters/platforms/web.js +282 -0
- package/utilities/dist/esm/constants/common.d.ts +6 -0
- package/utilities/dist/esm/constants/common.js +17 -0
- package/utilities/dist/esm/constants/errors.d.ts +8 -0
- package/utilities/dist/esm/constants/errors.js +9 -0
- package/utilities/dist/esm/constants/index.d.ts +3 -0
- package/utilities/dist/esm/constants/index.js +4 -0
- package/utilities/dist/esm/helpers/decorators.d.ts +11 -0
- package/utilities/dist/esm/helpers/decorators.js +234 -0
- package/utilities/dist/esm/helpers/index.d.ts +1 -0
- package/utilities/dist/esm/helpers/index.js +2 -0
- package/utilities/dist/esm/index.d.ts +13 -0
- package/utilities/dist/esm/index.js +14 -0
- package/utilities/dist/esm/libs/abortController.d.ts +9 -0
- package/utilities/dist/esm/libs/abortController.js +23 -0
- package/utilities/dist/esm/libs/cache.d.ts +17 -0
- package/utilities/dist/esm/libs/cache.js +258 -0
- package/utilities/dist/esm/libs/events.d.ts +27 -0
- package/utilities/dist/esm/libs/events.js +102 -0
- package/utilities/dist/esm/libs/langEvent.d.ts +3 -0
- package/utilities/dist/esm/libs/langEvent.js +4 -0
- package/utilities/dist/esm/libs/util.d.ts +49 -0
- package/utilities/dist/esm/libs/util.js +254 -0
- package/utilities/dist/miniprogram/index.js +1 -0
- package/utilities/package.json +26 -0
- package/analytics/dist/index.d.ts +0 -2
- package/analytics/dist/index.esm.js +0 -4
- package/analytics/dist/index.js +0 -9
- package/miniprogram_dist/ai.js +0 -2
- package/miniprogram_dist/analytics.js +0 -1
- package/miniprogram_dist/app.js +0 -2
- package/miniprogram_dist/auth.js +0 -2
- package/miniprogram_dist/cloudrun.js +0 -1
- package/miniprogram_dist/container.js +0 -1
- package/miniprogram_dist/database.js +0 -2
- package/miniprogram_dist/functions.js +0 -1
- package/miniprogram_dist/model.js +0 -1
- package/miniprogram_dist/oauth.js +0 -1
- package/miniprogram_dist/realtime.js +0 -1
- package/miniprogram_dist/storage.js +0 -1
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { CloudbaseAdapter, SDKAdapterInterface, ResponseObject } from '@cloudbase/adapter-interface'
|
|
2
|
+
import { ICloudbaseComponent, ICloudbaseHook } from './component'
|
|
3
|
+
import { ICloudbaseRequest } from './request'
|
|
4
|
+
import { ICloudbaseCache } from './cache'
|
|
5
|
+
import { ICloudbaseAuth } from './auth'
|
|
6
|
+
import { ICallFunctionOptions, ICallFunctionResponse } from './functions'
|
|
7
|
+
import {
|
|
8
|
+
ICloudbaseUploadFileParams,
|
|
9
|
+
ICloudbaseUploadFileResult,
|
|
10
|
+
ICloudbaseDeleteFileParams,
|
|
11
|
+
ICloudbaseDeleteFileResult,
|
|
12
|
+
ICloudbaseGetTempFileURLParams,
|
|
13
|
+
ICloudbaseGetTempFileURLResult,
|
|
14
|
+
ICloudbaseDownloadFileParams,
|
|
15
|
+
ICloudbaseDownloadFileResult,
|
|
16
|
+
ICloudbaseCopyFileParams,
|
|
17
|
+
ICloudbaseCopyFileResult,
|
|
18
|
+
} from './storage'
|
|
19
|
+
import { cloudbase } from '../cloudbase/index'
|
|
20
|
+
|
|
21
|
+
// 统一返回判别联合与错误契约(可辨识联合范式)
|
|
22
|
+
export { Result, SafeResult } from './result'
|
|
23
|
+
export { ICloudbaseError, CloudbaseErrorBrand, CloudbaseErrorLike } from './error'
|
|
24
|
+
|
|
25
|
+
export enum LANGS {
|
|
26
|
+
ZH = 'zh-CN',
|
|
27
|
+
EN = 'en-US',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type Persistence = 'local' | 'session' | 'none'
|
|
31
|
+
|
|
32
|
+
export interface KV<T> {
|
|
33
|
+
[key: string]: T
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface KVstring {
|
|
37
|
+
[key: string]: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type EndPointKey = 'CLOUD_API' | 'GATEWAY'
|
|
41
|
+
|
|
42
|
+
/** 自定义登录凭证信息(从控制台下载的私钥文件) */
|
|
43
|
+
export interface ICredentialsInfo {
|
|
44
|
+
/** 私钥 ID */
|
|
45
|
+
private_key_id: string;
|
|
46
|
+
/** RSA 私钥内容 */
|
|
47
|
+
private_key: string;
|
|
48
|
+
/** 所属环境 ID */
|
|
49
|
+
env_id: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ICloudbaseConfig {
|
|
53
|
+
env: string
|
|
54
|
+
intl?: boolean,
|
|
55
|
+
region?: string
|
|
56
|
+
timeout?: number
|
|
57
|
+
persistence?: Persistence
|
|
58
|
+
oauthClient?: any
|
|
59
|
+
debug?: boolean
|
|
60
|
+
_fromApp?: ICloudbase
|
|
61
|
+
clientId?: string
|
|
62
|
+
oauthInstance?: any
|
|
63
|
+
wxCloud?: any
|
|
64
|
+
i18n?: {
|
|
65
|
+
t: (text: string) => string
|
|
66
|
+
LANG_HEADER_KEY: string
|
|
67
|
+
lang: LANGS
|
|
68
|
+
}
|
|
69
|
+
accessKey?: string
|
|
70
|
+
endPointMode?: EndPointKey // auth请求域名模式,默认CLOUD_API
|
|
71
|
+
useWxCloud?: boolean // 是否使用微信云开发链路
|
|
72
|
+
auth?: {
|
|
73
|
+
detectSessionInUrl?: boolean
|
|
74
|
+
secretId?: string
|
|
75
|
+
secretKey?: string
|
|
76
|
+
sessionToken?: string
|
|
77
|
+
secretType?: 'SESSION_SECRET' | 'SECRET'
|
|
78
|
+
credentials?: ICredentialsInfo // 自定义登录私钥信息,node端使用
|
|
79
|
+
}
|
|
80
|
+
// @cloudbase/functions-framework 函数上下文,只要求部分字段,只在云函数或云托管中有效
|
|
81
|
+
context?: Readonly<{
|
|
82
|
+
eventID: string
|
|
83
|
+
extendedContext?: {
|
|
84
|
+
envId: string // 环境 ID
|
|
85
|
+
// uin: string // 请求的 UIN
|
|
86
|
+
source: string // 请求来源,如 wx
|
|
87
|
+
accessToken?: string // 调用请求时的 AccessToken
|
|
88
|
+
userId?: string // 请求的用户 ID
|
|
89
|
+
tmpSecret?: {
|
|
90
|
+
// 临时凭证
|
|
91
|
+
secretId: string // secretId
|
|
92
|
+
secretKey: string // secretKey
|
|
93
|
+
token: string // token
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}>
|
|
97
|
+
}
|
|
98
|
+
// 可更新的配置字段
|
|
99
|
+
export type ICloudbaseUpgradedConfig = Pick<ICloudbaseConfig, 'persistence' | 'region' | 'debug'>
|
|
100
|
+
|
|
101
|
+
export interface ICloudbaseExtension {
|
|
102
|
+
name: string
|
|
103
|
+
invoke: (opts: any, app: ICloudbase) => Promise<any>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare type MethodType = 'request' | 'post' | 'get' | 'head' | 'patch' | 'delete' | 'put'
|
|
107
|
+
export interface ICloudbaseApis {
|
|
108
|
+
[apiName: string]: {
|
|
109
|
+
[method in MethodType]: (callApiOptions: ICallApiOptions, opts?: KV<any>) => Promise<ResponseObject['data']>
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Cloudbase 核心能力(始终存在,与运行时是否注册某个业务组件无关)。
|
|
115
|
+
*
|
|
116
|
+
* 这些字段/方法由 SDK 初始化流程直接提供,因此**不是可选的**。
|
|
117
|
+
* 业务能力(auth / functions / storage / database / ai / models / mysql 等)
|
|
118
|
+
* 被拆分到独立的 `*Capability` 接口,通过下面的 `ICloudbase` 交叉类型组合。
|
|
119
|
+
*/
|
|
120
|
+
export interface CloudbaseCore {
|
|
121
|
+
config: ICloudbaseConfig
|
|
122
|
+
platform: ICloudbasePlatformInfo
|
|
123
|
+
cache: ICloudbaseCache
|
|
124
|
+
request: ICloudbaseRequest
|
|
125
|
+
oauthClient: any
|
|
126
|
+
localCache: ICloudbaseCache
|
|
127
|
+
authInstance?: ICloudbaseAuth
|
|
128
|
+
oauthInstance?: any
|
|
129
|
+
apis: ICloudbaseApis
|
|
130
|
+
init: (config: ICloudbaseConfig & { lang?: LANGS }) => cloudbase.app
|
|
131
|
+
updateConfig: (config: ICloudbaseUpgradedConfig) => void
|
|
132
|
+
registerExtension: (ext: ICloudbaseExtension) => void
|
|
133
|
+
invokeExtension: (name: string, opts: any) => Promise<any>
|
|
134
|
+
useAdapters: (adapters: CloudbaseAdapter | CloudbaseAdapter[], options?: any) => void
|
|
135
|
+
registerComponent: (component: ICloudbaseComponent) => void
|
|
136
|
+
registerHook: (hook: ICloudbaseHook) => void
|
|
137
|
+
registerVersion: (version: string) => void
|
|
138
|
+
fire?: (...args: any[]) => void
|
|
139
|
+
updateLang?: (lang: LANGS) => void
|
|
140
|
+
/**
|
|
141
|
+
* 检查当前 Cloudbase 实例是否已完成初始化
|
|
142
|
+
* @returns 是否已初始化
|
|
143
|
+
*/
|
|
144
|
+
isInitialized?: () => boolean
|
|
145
|
+
getEndPointWithKey?: (key: EndPointKey) => {
|
|
146
|
+
BASE_URL: string
|
|
147
|
+
PROTOCOL: string
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** 身份鉴权能力(`registerAuth` 注册后可用)。 */
|
|
152
|
+
export interface AuthCapability {
|
|
153
|
+
auth?: (options?: { persistence: cloudbase.auth.Persistence }) => cloudbase.auth.App
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** 云函数能力(`registerFunctions` 注册后可用)。 */
|
|
157
|
+
export interface FunctionsCapability {
|
|
158
|
+
/** 调用云函数 */
|
|
159
|
+
callFunction?: <T = any>(
|
|
160
|
+
options: ICallFunctionOptions,
|
|
161
|
+
callback?: (err: Error | null, res: ICallFunctionResponse<T> | null) => void,
|
|
162
|
+
) => Promise<ICallFunctionResponse<T>>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** 数据库能力(`registerDatabase` 注册后可用)。 */
|
|
166
|
+
export interface DatabaseCapability {
|
|
167
|
+
/** 获取数据库实例 */
|
|
168
|
+
database?: (dbConfig?: { instance?: string; database?: string }) => cloudbase.database.App
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** 云存储能力(`registerStorage` 注册后可用)。 */
|
|
172
|
+
export interface StorageCapability {
|
|
173
|
+
/** Storage 命名空间实例(from 分流 + Bucket 管理) */
|
|
174
|
+
storage?: cloudbase.storage.StorageClient
|
|
175
|
+
/** 上传文件 */
|
|
176
|
+
uploadFile?: (params: ICloudbaseUploadFileParams, callback?: Function) => Promise<ICloudbaseUploadFileResult>
|
|
177
|
+
/** 下载文件 */
|
|
178
|
+
downloadFile?: (params: ICloudbaseDownloadFileParams, callback?: Function) => Promise<ICloudbaseDownloadFileResult>
|
|
179
|
+
/** 删除云端文件 */
|
|
180
|
+
deleteFile?: (params: ICloudbaseDeleteFileParams, callback?: Function) => Promise<ICloudbaseDeleteFileResult>
|
|
181
|
+
/** 获取文件临时下载链接 */
|
|
182
|
+
getTempFileURL?: (params: ICloudbaseGetTempFileURLParams, callback?: Function) => Promise<ICloudbaseGetTempFileURLResult>
|
|
183
|
+
/** 复制/移动文件 */
|
|
184
|
+
copyFile?: (params: ICloudbaseCopyFileParams, callback?: Function) => Promise<ICloudbaseCopyFileResult>
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 完整的 Cloudbase 实例类型。
|
|
189
|
+
*
|
|
190
|
+
* = 核心能力 `CloudbaseCore` + 各业务能力 `*Capability` 的交叉组合。
|
|
191
|
+
* 结构上等价于旧的单一大接口,但拆分后可读性更好、可按需组合,
|
|
192
|
+
* 也为未来 tree-shaking 友好的模块化 client 打基础。
|
|
193
|
+
*
|
|
194
|
+
* 如需只声明「用到的能力子集」,可直接使用 {@link CloudbaseClient} 泛型组合,
|
|
195
|
+
* 例如 `CloudbaseClient<AuthCapability & FunctionsCapability>`。
|
|
196
|
+
*/
|
|
197
|
+
export type ICloudbase = CloudbaseCore
|
|
198
|
+
& AuthCapability
|
|
199
|
+
& FunctionsCapability
|
|
200
|
+
& DatabaseCapability
|
|
201
|
+
& StorageCapability
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 按需组合的 Cloudbase 客户端类型。
|
|
205
|
+
*
|
|
206
|
+
* 始终包含核心能力 `CloudbaseCore`,并叠加调用方声明的能力集合 `Caps`。
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* // 只用到 auth 与云函数能力
|
|
211
|
+
* type MyClient = CloudbaseClient<AuthCapability & FunctionsCapability>
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @typeParam Caps - 需要叠加的能力集合,默认叠加全部内置能力(等价于 `ICloudbase`)
|
|
215
|
+
*/
|
|
216
|
+
export type CloudbaseClient<
|
|
217
|
+
Caps = AuthCapability & FunctionsCapability & DatabaseCapability & StorageCapability,
|
|
218
|
+
> = CloudbaseCore & Caps
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Node.js 端适配器扩展方法
|
|
222
|
+
*/
|
|
223
|
+
export interface INodeAdapterExtend {
|
|
224
|
+
/**
|
|
225
|
+
* 从环境变量中获取腾讯云临时密钥信息
|
|
226
|
+
* 用于 API 请求签名
|
|
227
|
+
*/
|
|
228
|
+
getSecretInfo?: (config?: ICloudbaseConfig) => {
|
|
229
|
+
env: string
|
|
230
|
+
secretId: string
|
|
231
|
+
secretKey: string
|
|
232
|
+
sessionToken: string
|
|
233
|
+
accessKey: string
|
|
234
|
+
secretType: string
|
|
235
|
+
credentials?: string
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* 初始化 Node.js 端工具方法,挂载到 js-sdk app 实例上
|
|
239
|
+
* 包含:auth 相关方法、模板消息推送、context 解析
|
|
240
|
+
*/
|
|
241
|
+
nodeTool?: (
|
|
242
|
+
/** js-sdk cloudbase 实例 */
|
|
243
|
+
app: any,
|
|
244
|
+
/** 配置信息,包含认证凭证和环境 ID */
|
|
245
|
+
config: ICloudbaseConfig,
|
|
246
|
+
) => void
|
|
247
|
+
}
|
|
248
|
+
export interface ICloudbasePlatformInfo {
|
|
249
|
+
adapter?: SDKAdapterInterface & INodeAdapterExtend
|
|
250
|
+
runtime?: string
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface IGenericError<T extends string, P = any> extends Error {
|
|
254
|
+
type: T
|
|
255
|
+
payload: P
|
|
256
|
+
generic: boolean
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface ICallApiOptions {
|
|
260
|
+
/** api标识 */
|
|
261
|
+
name?: string
|
|
262
|
+
/** 请求的path */
|
|
263
|
+
path?: string
|
|
264
|
+
method?: string
|
|
265
|
+
headers?: KV<any>
|
|
266
|
+
/** 请求体,根据content-type可以是不同类型 */
|
|
267
|
+
body?: KV<any> | string
|
|
268
|
+
token?: string
|
|
269
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudbase/types",
|
|
3
|
+
"version": "4.0.1-alpha.1",
|
|
4
|
+
"description": "cloudbase javascript sdk types",
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js",
|
|
7
|
+
"index.d.ts",
|
|
8
|
+
"result.d.ts",
|
|
9
|
+
"error.d.ts",
|
|
10
|
+
"cache.d.ts",
|
|
11
|
+
"events.d.ts",
|
|
12
|
+
"request.d.ts",
|
|
13
|
+
"auth.d.ts",
|
|
14
|
+
"component.d.ts",
|
|
15
|
+
"functions.d.ts",
|
|
16
|
+
"cloudrun.d.ts",
|
|
17
|
+
"container.d.ts",
|
|
18
|
+
"analytics.d.ts",
|
|
19
|
+
"storage.d.ts",
|
|
20
|
+
"realtime.d.ts",
|
|
21
|
+
"database.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/TencentCloudBase/cloudbase-js-sdk"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"cloudbase",
|
|
29
|
+
"Cloudbase",
|
|
30
|
+
"CloudBase",
|
|
31
|
+
"tcb",
|
|
32
|
+
"TCB",
|
|
33
|
+
"serverless",
|
|
34
|
+
"Serverless",
|
|
35
|
+
"javascript",
|
|
36
|
+
"typescript"
|
|
37
|
+
],
|
|
38
|
+
"author": "",
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@cloudbase/adapter-interface": "^0.7.1"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "859557576897d4778857c12fb8d7fe8ca1f3a052"
|
|
47
|
+
}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { DataType, QueueType, ISingleDBEvent } from './database'
|
|
2
|
+
|
|
3
|
+
export type IRequestMsgType =
|
|
4
|
+
| 'LOGIN' // 鉴权(环境维度)
|
|
5
|
+
| 'INIT_WATCH' // 初始化监听
|
|
6
|
+
| 'REBUILD_WATCH' // 重建监听,1)数据失序时 2)checkLast 不一致时
|
|
7
|
+
| 'CHECK_LAST' // 检查是否有未收到的消息
|
|
8
|
+
| 'CLOSE_WATCH' // 取消监听
|
|
9
|
+
| 'PING' // 心跳 ping
|
|
10
|
+
|
|
11
|
+
export type IResponseMsgType =
|
|
12
|
+
| 'LOGIN_RES' // LOGIN 回包
|
|
13
|
+
| 'INIT_EVENT' // INIT_WATCH 回包
|
|
14
|
+
| 'NEXT_EVENT' // 服务端主动推变更事件
|
|
15
|
+
| 'CHECK_EVENT' // CHECK_LAST 回包
|
|
16
|
+
| 'PONG' // 心跳 PING 回包
|
|
17
|
+
| 'ERROR' // 错误异常
|
|
18
|
+
|
|
19
|
+
export interface IRequestMessageBase<W extends boolean = true> {
|
|
20
|
+
watchId: W extends true ? string : undefined
|
|
21
|
+
requestId: string
|
|
22
|
+
msgType: IRequestMsgType
|
|
23
|
+
msgData: IRequestMessageMsgData
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type IRequestMessageMsgData =
|
|
27
|
+
| IRequestMessageInitWatchData
|
|
28
|
+
| IRequestMessageLoginData
|
|
29
|
+
| IRequestMessageRebuildWatchData
|
|
30
|
+
| IRequestMessageCheckLastData
|
|
31
|
+
| IRequestMessageCloseWatchData
|
|
32
|
+
| IRequestMessagePingData
|
|
33
|
+
|
|
34
|
+
export type IRequestMessage =
|
|
35
|
+
| IRequestMessageInitWatchMsg
|
|
36
|
+
| IRequestMessageLoginMsg
|
|
37
|
+
| IRequestMessageRebuildWatchMsg
|
|
38
|
+
| IRequestMessageCheckLastMsg
|
|
39
|
+
| IRequestMessageCloseWatchMsg
|
|
40
|
+
| IRequestMessagePingMsg
|
|
41
|
+
|
|
42
|
+
export interface IRequestMessageLoginData {
|
|
43
|
+
envId: string
|
|
44
|
+
accessToken: string
|
|
45
|
+
referrer: 'web'
|
|
46
|
+
sdkVersion: string
|
|
47
|
+
dataVersion: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface IRequestExtraMessageLoginData {
|
|
51
|
+
runtime: string
|
|
52
|
+
signStr: string
|
|
53
|
+
secretVersion: string
|
|
54
|
+
}
|
|
55
|
+
export interface IRequestMessageLoginMsg extends IRequestMessageBase<false> {
|
|
56
|
+
msgType: 'LOGIN'
|
|
57
|
+
msgData: IRequestMessageLoginData
|
|
58
|
+
exMsgData?: IRequestExtraMessageLoginData
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IRequestMessageInitWatchData {
|
|
62
|
+
envId: string
|
|
63
|
+
collName: string // collection name
|
|
64
|
+
query: string // query that is stringified
|
|
65
|
+
limit?: number
|
|
66
|
+
orderBy?: Record<string, string>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface IRequestMessageInitWatchMsg extends IRequestMessageBase {
|
|
70
|
+
msgType: 'INIT_WATCH'
|
|
71
|
+
msgData: IRequestMessageInitWatchData
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IRequestMessageRebuildWatchData {
|
|
75
|
+
envId: string
|
|
76
|
+
collName: string
|
|
77
|
+
queryID: string
|
|
78
|
+
eventID: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface IRequestMessageRebuildWatchMsg extends IRequestMessageBase {
|
|
82
|
+
msgType: 'REBUILD_WATCH'
|
|
83
|
+
msgData: IRequestMessageRebuildWatchData
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface IRequestMessageCheckLastData {
|
|
87
|
+
queryID: string
|
|
88
|
+
eventID: number
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface IRequestMessageCheckLastMsg extends IRequestMessageBase {
|
|
92
|
+
msgType: 'CHECK_LAST'
|
|
93
|
+
msgData: IRequestMessageCheckLastData
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type IRequestMessageCloseWatchData = null
|
|
97
|
+
|
|
98
|
+
export interface IRequestMessageCloseWatchMsg extends IRequestMessageBase {
|
|
99
|
+
msgType: 'CLOSE_WATCH'
|
|
100
|
+
msgData: IRequestMessageCloseWatchData
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type IRequestMessagePingData = null
|
|
104
|
+
|
|
105
|
+
export interface IRequestMessagePingMsg extends IRequestMessageBase<false> {
|
|
106
|
+
msgType: 'PING'
|
|
107
|
+
msgData: IRequestMessagePingData
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// export interface IResponseMessageBase {
|
|
111
|
+
|
|
112
|
+
export interface IResponseMessageBase<W extends boolean = true> {
|
|
113
|
+
watchId: W extends true ? string : undefined
|
|
114
|
+
// watchId: string
|
|
115
|
+
requestId: string
|
|
116
|
+
msgType: IResponseMsgType
|
|
117
|
+
msgData: IResponseMessageMsgData
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type IResponseMessageMsgData =
|
|
121
|
+
| IResponseMessageLoginResData
|
|
122
|
+
| IResponseMessageInitEventData
|
|
123
|
+
| IResponseMessageNextEventData
|
|
124
|
+
| IResponseMessageCheckEventData
|
|
125
|
+
| IResponseMessagePongData
|
|
126
|
+
| IResponseMessageErrorData
|
|
127
|
+
|
|
128
|
+
export type IResponseMessage =
|
|
129
|
+
| IResponseMessageLoginResMsg
|
|
130
|
+
| IResponseMessageInitEventMsg
|
|
131
|
+
| IResponseMessageNextEventMsg
|
|
132
|
+
| IResponseMessageCheckEventMsg
|
|
133
|
+
| IResponseMessagePongMsg
|
|
134
|
+
| IResponseMessageErrorMsg
|
|
135
|
+
|
|
136
|
+
export type IResponseMessageLoginResData = {
|
|
137
|
+
envId: string
|
|
138
|
+
} & Partial<IResponseMessageErrorData>
|
|
139
|
+
|
|
140
|
+
export interface IResponseMessageLoginResMsg
|
|
141
|
+
extends IResponseMessageBase<false> {
|
|
142
|
+
msgType: 'LOGIN_RES'
|
|
143
|
+
msgData: IResponseMessageLoginResData
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface IResponseMessageInitEventData {
|
|
147
|
+
queryID: string
|
|
148
|
+
currEvent: number
|
|
149
|
+
events: IDBEvent[]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface IResponseMessageInitEventMsg extends IResponseMessageBase {
|
|
153
|
+
msgType: 'INIT_EVENT'
|
|
154
|
+
msgData: IResponseMessageInitEventData
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface IResponseMessageNextEventData {
|
|
158
|
+
queryID: string
|
|
159
|
+
currEvent: number
|
|
160
|
+
events: IDBEvent[]
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface IResponseMessageNextEventMsg extends IResponseMessageBase {
|
|
164
|
+
msgType: 'NEXT_EVENT'
|
|
165
|
+
msgData: IResponseMessageNextEventData
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface IResponseMessageCheckEventData {
|
|
169
|
+
queryID: string
|
|
170
|
+
currEvent: number
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface IResponseMessageCheckEventMsg extends IResponseMessageBase {
|
|
174
|
+
msgType: 'CHECK_EVENT'
|
|
175
|
+
msgData: IResponseMessageCheckEventData
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type IResponseMessagePongData = null
|
|
179
|
+
|
|
180
|
+
export interface IResponseMessagePongMsg extends IResponseMessageBase {
|
|
181
|
+
msgType: 'PONG'
|
|
182
|
+
msgData: IResponseMessagePongData
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type IResponseMessageErrorData = {
|
|
186
|
+
message: string
|
|
187
|
+
} & (
|
|
188
|
+
| { code: 'SYS_ERR' } // 服务器系统错误
|
|
189
|
+
| { code: 'CHECK_LOGIN_FAILED' } // 登陆校验失败
|
|
190
|
+
| { code: 'SIGN_INVALID_ERROR' } // ws签名无效
|
|
191
|
+
| { code: 'SIGN_EXPIRED_ERROR' } // 签名过期
|
|
192
|
+
| { code: 'INVALIID_ENV' } // 环境无效
|
|
193
|
+
| { code: 'SIGN_PARAM_INVALID' } // cam签名无效
|
|
194
|
+
| { code: 'COLLECTION_PERMISSION_DENIED' } // 没有集合操作权限
|
|
195
|
+
| { code: 'QUERYID_INVALID_ERROR' }) // queryID 无效
|
|
196
|
+
|
|
197
|
+
export interface IResponseMessageErrorMsg extends IResponseMessageBase {
|
|
198
|
+
msgType: 'ERROR'
|
|
199
|
+
msgData: IResponseMessageErrorData
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type IDBEvent = IDBInitEvent | IDBNextEvent
|
|
203
|
+
|
|
204
|
+
export interface IDBEventBase {
|
|
205
|
+
ID: number // event id
|
|
206
|
+
DataType: DataType
|
|
207
|
+
QueueType: QueueType
|
|
208
|
+
DocID: string
|
|
209
|
+
Doc: string
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface IDBInitEvent extends IDBEventBase {
|
|
213
|
+
DataType: 'init'
|
|
214
|
+
QueueType: 'init'
|
|
215
|
+
UpdatedFields?: any
|
|
216
|
+
removedFields?: any
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// <DataType, QueueType>
|
|
220
|
+
// * <update, update>
|
|
221
|
+
// * <update, enqueue>
|
|
222
|
+
// * <update, dequeue>
|
|
223
|
+
// * <add, enqueue>
|
|
224
|
+
// * <remove, dequeue>
|
|
225
|
+
|
|
226
|
+
// export interface IDBNextEvent extends IDBEventBase {
|
|
227
|
+
// DocID: string
|
|
228
|
+
// Doc: string
|
|
229
|
+
// UpdatedFields?: any
|
|
230
|
+
// removedFields?: any
|
|
231
|
+
// }
|
|
232
|
+
|
|
233
|
+
export type IDBNextEvent =
|
|
234
|
+
| IDBNextEventDataUpdate
|
|
235
|
+
| IDBNextEventDataReplace
|
|
236
|
+
| IDBNextEventDataAdd
|
|
237
|
+
| IDBNextEventDataRemove
|
|
238
|
+
| IDBNextEventDataLimit
|
|
239
|
+
|
|
240
|
+
export type IDBNextEventDataUpdate =
|
|
241
|
+
| IDBNextEventDataUpdateQueueUpdate
|
|
242
|
+
| IDBNextEventDataUpdateQueueEnqueue
|
|
243
|
+
| IDBNextEventDataUpdateQueueDequeue
|
|
244
|
+
|
|
245
|
+
export type IDBNextEventDataReplace =
|
|
246
|
+
| IDBNextEventDataReplaceQueueUpdate
|
|
247
|
+
| IDBNextEventDataReplaceQueueEnqueue
|
|
248
|
+
| IDBNextEventDataReplaceQueueDequeue
|
|
249
|
+
|
|
250
|
+
export type IDBNextEventDataLimit =
|
|
251
|
+
| IDBNextEventDataLimitQueueEnqueue
|
|
252
|
+
| IDBNextEventDataLimitQueueDequeue
|
|
253
|
+
|
|
254
|
+
export interface IDBNextEventDataUpdateQueueUpdate extends IDBEventBase {
|
|
255
|
+
DataType: 'update'
|
|
256
|
+
QueueType: 'update'
|
|
257
|
+
Doc: ''
|
|
258
|
+
UpdatedFields: string
|
|
259
|
+
RemovedFields: string
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface IDBNextEventDataUpdateQueueEnqueue extends IDBEventBase {
|
|
263
|
+
DataType: 'update'
|
|
264
|
+
QueueType: 'enqueue'
|
|
265
|
+
Doc: string // full doc
|
|
266
|
+
UpdatedFields: string
|
|
267
|
+
RemovedFields: string
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface IDBNextEventDataUpdateQueueDequeue extends IDBEventBase {
|
|
271
|
+
DataType: 'update'
|
|
272
|
+
QueueType: 'dequeue'
|
|
273
|
+
Doc: ''
|
|
274
|
+
UpdatedFields: string
|
|
275
|
+
RemovedFields: string
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface IDBNextEventDataReplaceQueueUpdate extends IDBEventBase {
|
|
279
|
+
DataType: 'replace'
|
|
280
|
+
QueueType: 'update'
|
|
281
|
+
Doc: string
|
|
282
|
+
UpdatedFields: ''
|
|
283
|
+
RemovedFields: ''
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface IDBNextEventDataReplaceQueueEnqueue extends IDBEventBase {
|
|
287
|
+
DataType: 'replace'
|
|
288
|
+
QueueType: 'enqueue'
|
|
289
|
+
Doc: string
|
|
290
|
+
UpdatedFields: ''
|
|
291
|
+
RemovedFields: ''
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface IDBNextEventDataReplaceQueueDequeue extends IDBEventBase {
|
|
295
|
+
DataType: 'replace'
|
|
296
|
+
QueueType: 'dequeue'
|
|
297
|
+
Doc: string
|
|
298
|
+
UpdatedFields: ''
|
|
299
|
+
RemovedFields: ''
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface IDBNextEventDataAdd extends IDBEventBase {
|
|
303
|
+
DataType: 'add'
|
|
304
|
+
QueueType: 'enqueue'
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface IDBNextEventDataRemove extends IDBEventBase {
|
|
308
|
+
DataType: 'remove'
|
|
309
|
+
QueueType: 'dequeue'
|
|
310
|
+
Doc: ''
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface IDBNextEventDataLimitQueueEnqueue extends IDBEventBase {
|
|
314
|
+
DataType: 'limit'
|
|
315
|
+
QueueType: 'enqueue'
|
|
316
|
+
Doc: string
|
|
317
|
+
UpdatedFields: ''
|
|
318
|
+
RemovedFields: ''
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface IDBNextEventDataLimitQueueDequeue extends IDBEventBase {
|
|
322
|
+
DataType: 'limit'
|
|
323
|
+
QueueType: 'dequeue'
|
|
324
|
+
Doc: ''
|
|
325
|
+
UpdatedFields: ''
|
|
326
|
+
RemovedFields: ''
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface IWatchOptions {
|
|
330
|
+
// server realtime data init & change event
|
|
331
|
+
onChange: (snapshot: ISnapshot) => void
|
|
332
|
+
// error while connecting / listening
|
|
333
|
+
onError: (error: any) => void
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface ISnapshot {
|
|
337
|
+
id: number
|
|
338
|
+
docChanges: ISingleDBEvent[]
|
|
339
|
+
docs: Record<string, any>
|
|
340
|
+
type?: SnapshotType
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface DBRealtimeListener {
|
|
344
|
+
// "And Now His Watch Is Ended"
|
|
345
|
+
close: () => void
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export type IRealtimeListenerConstructorOptions = IWatchOptions
|
|
349
|
+
|
|
350
|
+
export type SnapshotType = 'init'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IFetchOptions,
|
|
3
|
+
IRequestOptions, IUploadRequestOptions, ResponseObject,
|
|
4
|
+
} from '@cloudbase/adapter-interface'
|
|
5
|
+
|
|
6
|
+
import { ICloudbaseConfig, KV } from '.'
|
|
7
|
+
|
|
8
|
+
export interface IGetAccessTokenResult {
|
|
9
|
+
accessToken: string;
|
|
10
|
+
accessTokenExpire: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ICloudbaseRequestConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'timeout' | 'oauthClient' | '_fromApp' | 'i18n' | 'endPointMode' | 'auth'>;
|
|
14
|
+
|
|
15
|
+
export interface IAppendedRequestInfo {
|
|
16
|
+
data: KV<any>;
|
|
17
|
+
headers: KV<string>;
|
|
18
|
+
}
|
|
19
|
+
export type IRequestBeforeHook = (...args: any[]) => IAppendedRequestInfo;
|
|
20
|
+
export interface ICloudbaseRequest {
|
|
21
|
+
// fetch: (urlOrPath: string, init?: RequestInit) => Promise<Response>;
|
|
22
|
+
post: (options: IRequestOptions) => Promise<ResponseObject>;
|
|
23
|
+
upload: (options: IUploadRequestOptions) => Promise<ResponseObject>;
|
|
24
|
+
download: (options: IRequestOptions) => Promise<ResponseObject>;
|
|
25
|
+
// refreshAccessToken: () => Promise<IGetAccessTokenResult>;
|
|
26
|
+
// getAccessToken: () => Promise<IGetAccessTokenResult>;
|
|
27
|
+
request: (action: string, params: KV<any>, options?: KV<any>) => Promise<ResponseObject>;
|
|
28
|
+
send: (action: string, data: KV<any>) => Promise<any>;
|
|
29
|
+
fetch: (options: IFetchOptions) => Promise<ResponseObject>;
|
|
30
|
+
}
|