@cloudbase/app 2.21.0 → 2.21.2

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/src/index.ts CHANGED
@@ -43,7 +43,7 @@ const { catchErrorsDecorator } = helpers
43
43
  */
44
44
  const DEFAULT_INIT_CONFIG: Partial<ICloudbaseConfig> = {
45
45
  timeout: 15000,
46
- persistence: 'local',
46
+ persistence: 'local', // 持久化存储类型
47
47
  }
48
48
 
49
49
  // timeout上限10分钟
@@ -140,7 +140,7 @@ class Cloudbase implements ICloudbase {
140
140
  setGatewayEndPointWithEnv(env)
141
141
 
142
142
  const app = new Cloudbase(this.cloudbaseConfig)
143
- initRequest({ env, region: config.region || '', timeout, oauthClient, _fromApp: app, i18n })
143
+ initRequest({ env, region: config.region || '', timeout, oauthClient, _fromApp: app, i18n, endPointMode: config.endPointMode })
144
144
  app.requestClient = this.requestClient
145
145
  ;(this as any)?.fire?.('cloudbase_init', app)
146
146
  this.try2InitAuth(config, app)
@@ -243,13 +243,13 @@ export class CloudbaseRequest implements ICloudbaseRequest {
243
243
  ...formatQuery,
244
244
  })
245
245
 
246
- const { baseUrl: BASE_URL, protocol: PROTOCOL } = getEndPointInfo(this.config.env, 'CLOUD_API')
246
+ const { baseUrl: BASE_URL, protocol: PROTOCOL } = getEndPointInfo(this.config.env, this.config.endPointMode || 'CLOUD_API')
247
247
  // 生成请求 url
248
248
  let newUrl
249
249
  if (options.pathname) {
250
250
  newUrl = formatUrl(
251
251
  PROTOCOL,
252
- `${getBaseEndPoint(this.config.env)?.replace(/^https?:/, '')}/${options.pathname}`,
252
+ `${getBaseEndPoint(this.config.env, this.config.endPointMode || 'CLOUD_API')?.replace(/^https?:/, '')}/${options.pathname}`,
253
253
  formatQuery,
254
254
  )
255
255
  } else {