@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.
@@ -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, 'CLOUD_API')
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,
@@ -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> {