@cloudbase/types 3.0.3 → 3.0.4
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/auth.d.ts +1 -0
- package/index.d.ts +56 -1
- package/package.json +2 -2
- package/request.d.ts +1 -1
package/auth.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface KVstring {
|
|
|
22
22
|
|
|
23
23
|
export type EndPointKey = 'CLOUD_API' | 'GATEWAY'
|
|
24
24
|
|
|
25
|
+
export interface ICredentialsInfo {
|
|
26
|
+
private_key_id: string
|
|
27
|
+
private_key: string
|
|
28
|
+
env_id: string
|
|
29
|
+
}
|
|
25
30
|
export interface ICloudbaseConfig {
|
|
26
31
|
env: string
|
|
27
32
|
region?: string
|
|
@@ -43,7 +48,29 @@ export interface ICloudbaseConfig {
|
|
|
43
48
|
useWxCloud?: boolean // 是否使用微信云开发链路
|
|
44
49
|
auth?: {
|
|
45
50
|
detectSessionInUrl?: boolean
|
|
51
|
+
secretId?: string
|
|
52
|
+
secretKey?: string
|
|
53
|
+
sessionToken?: string
|
|
54
|
+
secretType?: 'SESSION_SECRET' | 'SECRET'
|
|
55
|
+
credentials?: ICredentialsInfo // 自定义登录私钥信息,node端使用
|
|
46
56
|
}
|
|
57
|
+
// @cloudbase/functions-framework 函数上下文,只要求部分字段,只在云函数或云托管中有效
|
|
58
|
+
context?: Readonly<{
|
|
59
|
+
eventID: string
|
|
60
|
+
extendedContext?: {
|
|
61
|
+
envId: string // 环境 ID
|
|
62
|
+
// uin: string // 请求的 UIN
|
|
63
|
+
source: string // 请求来源,如 wx
|
|
64
|
+
accessToken?: string // 调用请求时的 AccessToken
|
|
65
|
+
userId?: string // 请求的用户 ID
|
|
66
|
+
tmpSecret?: {
|
|
67
|
+
// 临时凭证
|
|
68
|
+
secretId: string // secretId
|
|
69
|
+
secretKey: string // secretKey
|
|
70
|
+
token: string // token
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}>
|
|
47
74
|
}
|
|
48
75
|
// 可更新的配置字段
|
|
49
76
|
export type ICloudbaseUpgradedConfig = Pick<ICloudbaseConfig, 'persistence' | 'region' | 'debug'>
|
|
@@ -86,8 +113,36 @@ export interface ICloudbase {
|
|
|
86
113
|
}
|
|
87
114
|
auth?: (options?: { persistence: cloudbase.auth.Persistence }) => cloudbase.auth.App
|
|
88
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Node.js 端适配器扩展方法
|
|
119
|
+
*/
|
|
120
|
+
export interface INodeAdapterExtend {
|
|
121
|
+
/**
|
|
122
|
+
* 从环境变量中获取腾讯云临时密钥信息
|
|
123
|
+
* 用于 API 请求签名
|
|
124
|
+
*/
|
|
125
|
+
getSecretInfo?: (config?: ICloudbaseConfig) => {
|
|
126
|
+
env: string
|
|
127
|
+
secretId: string
|
|
128
|
+
secretKey: string
|
|
129
|
+
sessionToken: string
|
|
130
|
+
accessKey: string
|
|
131
|
+
secretType: string
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 初始化 Node.js 端工具方法,挂载到 js-sdk app 实例上
|
|
135
|
+
* 包含:auth 相关方法、模板消息推送、context 解析
|
|
136
|
+
*/
|
|
137
|
+
nodeTool?: (
|
|
138
|
+
/** js-sdk cloudbase 实例 */
|
|
139
|
+
app: any,
|
|
140
|
+
/** 配置信息,包含认证凭证和环境 ID */
|
|
141
|
+
config: ICloudbaseConfig,
|
|
142
|
+
) => void
|
|
143
|
+
}
|
|
89
144
|
export interface ICloudbasePlatformInfo {
|
|
90
|
-
adapter?: SDKAdapterInterface
|
|
145
|
+
adapter?: SDKAdapterInterface & INodeAdapterExtend
|
|
91
146
|
runtime?: string
|
|
92
147
|
}
|
|
93
148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/types",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "cloudbase javascript sdk types",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.js",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"lint": "eslint --fix \"./**/*.ts\"",
|
|
44
44
|
"precommit": "npm run lint"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b5f5f8541b7e0d944bf345f8aa23c4e0ccb42b4f"
|
|
47
47
|
}
|
package/request.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface IGetAccessTokenResult {
|
|
|
10
10
|
accessTokenExpire: number;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export type ICloudbaseRequestConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'timeout' | 'oauthClient' | '_fromApp' | 'i18n' | 'endPointMode'>;
|
|
13
|
+
export type ICloudbaseRequestConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'timeout' | 'oauthClient' | '_fromApp' | 'i18n' | 'endPointMode' | 'auth'>;
|
|
14
14
|
|
|
15
15
|
export interface IAppendedRequestInfo {
|
|
16
16
|
data: KV<any>;
|