import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK, auth } from '@cloudbase/weda-client'
const {
  setConfig,
  initTcb,
  CLOUD_SDK,
  createDataset,
  createStateDataSourceVar,
  generateParamsParser,
  EXTRA_API,
  DS_SDK,
} = WEDA_CLOUD_SDK
const getAccessToken = auth.getAccessToken
const loginScope = auth.loginScope

export {
  createDataset,
  createStateDataSourceVar,
  generateParamsParser,
  EXTRA_API,
  CLOUD_SDK,
  DS_SDK,
  setConfig,
  getAccessToken,
  loginScope,
  initTcb,
}

import { default as config, AEGIS_CONFIG } from './config'

setConfig(config)
initTcb()

<% if(cdnEndpoints.aegis){ %>
require.async('../packages/$wd_system/index.js').then(({ Aegis }) => {
  let _aegis = new Aegis(AEGIS_CONFIG);
  const app = getApp();
  if(!app.globalData) {
    app.globalData = {}
  }
  app.globalData._aegis = _aegis;
})
<% }%>
