@cloudbase/types
Advanced tools
+1
-0
@@ -18,2 +18,3 @@ import { ICloudbaseConfig, KV, ICloudbase } from '.' | ||
| | 'useWxCloud' | ||
| | 'auth' | ||
| > & | ||
@@ -20,0 +21,0 @@ ICloudbaseConfig['auth'] |
+66
-1
@@ -25,2 +25,12 @@ import { CloudbaseAdapter, SDKAdapterInterface, ResponseObject } from '@cloudbase/adapter-interface' | ||
| /** 自定义登录凭证信息(从控制台下载的私钥文件) */ | ||
| export interface ICredentialsInfo { | ||
| /** 私钥 ID */ | ||
| private_key_id: string; | ||
| /** RSA 私钥内容 */ | ||
| private_key: string; | ||
| /** 所属环境 ID */ | ||
| env_id: string; | ||
| } | ||
| export interface ICloudbaseConfig { | ||
@@ -47,3 +57,25 @@ env: string | ||
| detectSessionInUrl?: boolean | ||
| secretId?: string | ||
| secretKey?: string | ||
| sessionToken?: string | ||
| secretType?: 'SESSION_SECRET' | 'SECRET' | ||
| credentials?: ICredentialsInfo // 自定义登录私钥信息,node端使用 | ||
| } | ||
| // @cloudbase/functions-framework 函数上下文,只要求部分字段,只在云函数或云托管中有效 | ||
| context?: Readonly<{ | ||
| eventID: string | ||
| extendedContext?: { | ||
| envId: string // 环境 ID | ||
| // uin: string // 请求的 UIN | ||
| source: string // 请求来源,如 wx | ||
| accessToken?: string // 调用请求时的 AccessToken | ||
| userId?: string // 请求的用户 ID | ||
| tmpSecret?: { | ||
| // 临时凭证 | ||
| secretId: string // secretId | ||
| secretKey: string // secretKey | ||
| token: string // token | ||
| } | ||
| } | ||
| }> | ||
| } | ||
@@ -85,2 +117,7 @@ // 可更新的配置字段 | ||
| updateLang?: (lang: LANGS) => void | ||
| /** | ||
| * 检查当前 Cloudbase 实例是否已完成初始化 | ||
| * @returns 是否已初始化 | ||
| */ | ||
| isInitialized?: () => boolean | ||
| getEndPointWithKey?: (key: EndPointKey) => { | ||
@@ -92,4 +129,32 @@ BASE_URL: string | ||
| } | ||
| /** | ||
| * Node.js 端适配器扩展方法 | ||
| */ | ||
| export interface INodeAdapterExtend { | ||
| /** | ||
| * 从环境变量中获取腾讯云临时密钥信息 | ||
| * 用于 API 请求签名 | ||
| */ | ||
| getSecretInfo?: (config?: ICloudbaseConfig) => { | ||
| env: string | ||
| secretId: string | ||
| secretKey: string | ||
| sessionToken: string | ||
| accessKey: string | ||
| secretType: string | ||
| } | ||
| /** | ||
| * 初始化 Node.js 端工具方法,挂载到 js-sdk app 实例上 | ||
| * 包含:auth 相关方法、模板消息推送、context 解析 | ||
| */ | ||
| nodeTool?: ( | ||
| /** js-sdk cloudbase 实例 */ | ||
| app: any, | ||
| /** 配置信息,包含认证凭证和环境 ID */ | ||
| config: ICloudbaseConfig, | ||
| ) => void | ||
| } | ||
| export interface ICloudbasePlatformInfo { | ||
| adapter?: SDKAdapterInterface | ||
| adapter?: SDKAdapterInterface & INodeAdapterExtend | ||
| runtime?: string | ||
@@ -96,0 +161,0 @@ } |
+2
-2
| { | ||
| "name": "@cloudbase/types", | ||
| "version": "2.26.1", | ||
| "version": "2.26.2", | ||
| "description": "cloudbase javascript sdk types", | ||
@@ -46,3 +46,3 @@ "files": [ | ||
| }, | ||
| "gitHead": "e1fabef412c8dad7e66ea8a40dab53839119d4e5" | ||
| "gitHead": "af397dd45339057868b98ac09c417d352e56a217" | ||
| } |
+1
-1
@@ -13,3 +13,3 @@ import { | ||
| export type ICloudbaseRequestConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'timeout' | 'oauthClient' | '_fromApp' | 'i18n' | 'endPointMode'>; | ||
| export type ICloudbaseRequestConfig = Pick<ICloudbaseConfig, 'env' | 'region' | 'timeout' | 'oauthClient' | '_fromApp' | 'i18n' | 'endPointMode' | 'auth'>; | ||
@@ -16,0 +16,0 @@ export interface IAppendedRequestInfo { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
37417
5.33%797
8.73%