@cloudbase/app 2.20.14 → 2.21.0
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/dist/cjs/constants/common.d.ts +2 -2
- package/dist/cjs/constants/common.js +4 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/libs/request.d.ts +2 -2
- package/dist/cjs/libs/request.js +4 -3
- package/dist/esm/constants/common.d.ts +2 -2
- package/dist/esm/constants/common.js +4 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/libs/request.d.ts +2 -2
- package/dist/esm/libs/request.js +4 -3
- package/dist/miniprogram/index.js +1 -1
- package/package.json +4 -4
- package/src/constants/common.ts +3 -4
- package/src/index.ts +1 -1
- package/src/libs/request.ts +3 -3
package/src/constants/common.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EndPointKey } from '@cloudbase/types'
|
|
1
2
|
import { constants } from '@cloudbase/utilities'
|
|
2
3
|
|
|
3
4
|
// @ts-ignore
|
|
@@ -23,8 +24,6 @@ export function getSdkName() {
|
|
|
23
24
|
}
|
|
24
25
|
export const DATA_VERSION = '2020-01-10'
|
|
25
26
|
|
|
26
|
-
export type EndPointKey = 'CLOUD_API' | 'GATEWAY'
|
|
27
|
-
|
|
28
27
|
interface EndPointInfo {
|
|
29
28
|
env: string
|
|
30
29
|
endPointKey: EndPointKey
|
|
@@ -85,8 +84,8 @@ export function setRegionLevelEndpoint(env: string, region: string, protocol?: '
|
|
|
85
84
|
setEndPointInfo({ env, region, baseUrl, protocol, endPointKey: 'CLOUD_API' })
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
export function getBaseEndPoint(env: string) {
|
|
89
|
-
const info = getEndPointInfo(env,
|
|
87
|
+
export function getBaseEndPoint(env: string, endPointKey: EndPointKey = 'CLOUD_API') {
|
|
88
|
+
const info = getEndPointInfo(env, endPointKey)
|
|
90
89
|
|
|
91
90
|
const { protocol: PROTOCOL, baseUrl: BASE_URL } = info
|
|
92
91
|
const webEndpoint = `${PROTOCOL}${BASE_URL}`
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ICloudbaseExtension,
|
|
8
8
|
KV,
|
|
9
9
|
ICloudbasePlatformInfo,
|
|
10
|
+
EndPointKey,
|
|
10
11
|
} from '@cloudbase/types'
|
|
11
12
|
import { ICloudbaseAuth } from '@cloudbase/types/auth'
|
|
12
13
|
import adapterForWxMp from '@cloudbase/adapter-wx_mp'
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
setRegionLevelEndpoint,
|
|
24
25
|
setSdkName,
|
|
25
26
|
setGatewayEndPointWithEnv,
|
|
26
|
-
type EndPointKey,
|
|
27
27
|
type ISetEndPointWithKey,
|
|
28
28
|
setEndPointInfo,
|
|
29
29
|
getEndPointInfo,
|
package/src/libs/request.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
IFetchOptions,
|
|
9
9
|
} from '@cloudbase/adapter-interface'
|
|
10
10
|
import { utils, constants, langEvent } from '@cloudbase/utilities'
|
|
11
|
-
import { KV } from '@cloudbase/types'
|
|
11
|
+
import { EndPointKey, KV } from '@cloudbase/types'
|
|
12
12
|
import {
|
|
13
13
|
IGetAccessTokenResult,
|
|
14
14
|
ICloudbaseRequestConfig,
|
|
@@ -138,8 +138,8 @@ export class CloudbaseRequest implements ICloudbaseRequest {
|
|
|
138
138
|
return res
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
public getBaseEndPoint() {
|
|
142
|
-
return getBaseEndPoint(this.config.env)
|
|
141
|
+
public getBaseEndPoint(endPointKey: EndPointKey = 'CLOUD_API') {
|
|
142
|
+
return getBaseEndPoint(this.config.env, endPointKey)
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
public async getOauthAccessTokenV2(oauthClient: any): Promise<IGetAccessTokenResult> {
|