@cloudbase/js-sdk 3.4.7-beta.0 → 3.4.7
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/CHANGELOG.md +3 -0
- package/ai/dist/index.esm.js +1 -1
- package/ai/dist/index.esm.js.map +1 -1
- package/apis/dist/index.esm.js +1 -1
- package/apis/dist/index.esm.js.map +1 -1
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.esm.js.map +1 -1
- package/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/cloudrun/dist/index.esm.js +1 -1
- package/cloudrun/dist/index.esm.js.map +1 -1
- package/container/dist/index.esm.js +1 -1
- package/container/dist/index.esm.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/functions/dist/index.esm.js +1 -1
- package/functions/dist/index.esm.js.map +1 -1
- package/miniprogram_dist/auth.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/model/dist/index.esm.js +1 -1
- package/model/dist/index.esm.js.map +1 -1
- package/mysql/dist/index.esm.js +1 -1
- package/mysql/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/realtime/dist/index.esm.js +1 -1
- package/realtime/dist/index.esm.js.map +1 -1
- package/storage/dist/index.esm.js +1 -1
- package/storage/dist/index.esm.js.map +1 -1
- package/types/package.json +1 -1
- package/utilities/package.json +2 -2
package/apis/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={
|
|
1
|
+
var t={946:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var n="@cloudbase/js-sdk";e.setSdkName=function(t){n=t},e.getSdkName=function(){return n};var r="https:";e.setProtocol=function(t){r=t},e.getProtocol=function(){return r},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},205:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},794:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,o(n(946),e),o(n(205),e),e.OATUH_LOGINTYPE="constants"}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};(()=>{n.d(r,{m:()=>u,J:()=>p});var t=n(794),e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)},o=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},i=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}};function a(n,r){var a,c,s,u;return o(this,void 0,Promise,(function(){var o,l,f,p,d,h,v,O,y,b,E,P,g,R,_,A,T,m,I,N,w,S,j;return i(this,(function(i){switch(i.label){case 0:l=(o=n||{}).name,f=o.body,p=o.path,d=void 0===p?"":p,h=o.method,v=void 0===h?"POST":h,O=o.headers,y=void 0===O?{}:O,b=(n||{}).token,E={};try{E=JSON.parse(f)}catch(t){E=f||{}}if(!l)throw new Error(JSON.stringify({code:t.ERRORS.INVALID_PARAMS,msg:"[apis] invalid api name"}));return P="",R=(g=this).gatewayOrigin,_=g.getAccessToken,A=g.env,R?P="".concat(R,"/v1"):this.getEndPointWithKey?(T=this.getEndPointWithKey("GATEWAY"),m=T.BASE_URL,I=T.PROTOCOL,P="".concat(I).concat(m)):P="https://".concat(A,".api.tcloudbasegateway.com/v1"),N="".concat(P,"/apis/").concat(l),w=d.startsWith("/")?d:"/".concat(d),_?[4,_()]:[3,2];case 1:S=i.sent().accessToken,y.Authorization="Bearer ".concat(S),i.label=2;case 2:if(j=["GET","HEAD"].includes(null===(a=null==v?void 0:v.toUpperCase)||void 0===a?void 0:a.call(v)))try{w="".concat(w).concat(w.includes("?")?"&":"?").concat(Object.keys(E).map((function(t){return"".concat(t,"=").concat(E[t])})).join("&"))}catch(t){}return[4,this.request.fetch(e(e(e({url:"".concat(N).concat(w),method:v||"POST",headers:e({"Content-Type":"application/json; charset=utf-8"},y)},j?{}:{body:JSON.stringify(E)}),{token:(null===(c=null==b?void 0:b.trim)||void 0===c?void 0:c.call(b))||(null===(u=null===(s=y.Authorization)||void 0===s?void 0:s.replace)||void 0===u?void 0:u.call(s,/^Bearer /,""))||null}),r))];case 3:return[4,i.sent().data];case 4:return[2,i.sent()]}}))}))}var c=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH","REQUEST"];function s(t){var n=this;return new Proxy({},{get:function(r,s){if("string"!=typeof s)throw new Error("[apis] method must be string");var u=s.toLocaleUpperCase();if(!c.includes(u))throw new Error("[apis] invalid method: ".concat(s));return function(r,c){return o(n,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,a.call(this,e({name:t,method:("REQUEST"===u?r.method:u)||"POST"},r),c)];case 1:return[2,n.sent()]}}))}))}}})}function u(t){var e=this;return Object.keys(t||{}).forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),new Proxy({},{get:function(t,n){if("string"==typeof n)return s.call(e,n)}})}var l="apis",f={name:l,IIFE:!0,entity:function(){Object.defineProperty(this.prototype,l,{get:function(){return u.call(this)},configurable:!0,enumerable:!0})}};function p(t){try{t.registerComponent(f)}catch(t){console.warn(t)}}try{cloudbase.registerComponent(f)}catch(t){}try{window.registerApis=p}catch(t){}})();var o=r.m,i=r.J;export{o as generateApis,i as registerApis};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","mappings":"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","sources":["webpack://@cloudbase/js-sdk/callApis.ts","webpack://@cloudbase/js-sdk/index.ts","webpack://@cloudbase/js-sdk/../../../src/constants/common.ts","webpack://@cloudbase/js-sdk/../../../src/constants/errors.ts","webpack://@cloudbase/js-sdk/../../../src/constants/index.ts","webpack://@cloudbase/js-sdk/webpack/bootstrap","webpack://@cloudbase/js-sdk/webpack/startup"],"sourcesContent":["import { ERRORS } from '@cloudbase/utilities/dist/cjs/constants'\nimport { ICallApiOptions, KV } from '@cloudbase/types'\nimport { ResponseObject, SDKRequestInterface } from '@cloudbase/adapter-interface'\n\nexport async function callApi(callApiOptions: ICallApiOptions, opts?: KV<any>): Promise<ResponseObject['data']> {\n const { name, body, path = '', method = 'POST', headers = {} } = callApiOptions || {}\n const { token } = callApiOptions || {}\n let dataParse = {}\n try {\n dataParse = JSON.parse(body as any)\n } catch (error) {\n dataParse = body || {}\n }\n\n if (!name) {\n throw new Error(JSON.stringify({\n code: ERRORS.INVALID_PARAMS,\n msg: '[apis] invalid api name',\n }),)\n }\n\n let url = ''\n\n const { gatewayOrigin, getAccessToken, env } = this\n\n if (gatewayOrigin) {\n url = `${gatewayOrigin}/v1`\n } else if (this.getEndPointWithKey) {\n const { BASE_URL, PROTOCOL } = this.getEndPointWithKey('GATEWAY')\n url = `${PROTOCOL}${BASE_URL}`\n } else {\n url = `https://${env}.api.tcloudbasegateway.com/v1`\n }\n const endpoint = `${url}/apis/${name}`\n let reqPath = path.startsWith('/') ? path : `/${path}`\n\n if (getAccessToken) {\n const { accessToken } = await getAccessToken()\n headers.Authorization = `Bearer ${accessToken}`\n }\n\n const isGetAndHead = ['GET', 'HEAD'].includes(method?.toUpperCase?.())\n\n if (isGetAndHead) {\n try {\n reqPath = `${reqPath}${reqPath.includes('?') ? '&' : '?'}${Object.keys(dataParse)\n .map(key => `${key}=${dataParse[key]}`)\n .join('&')}`\n } catch (error) {\n //\n }\n }\n\n const response = await this.request.fetch({\n url: `${endpoint}${reqPath}`,\n method: method || 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n ...headers,\n },\n // Request with GET/HEAD method cannot have body\n ...(isGetAndHead ? {} : { body: JSON.stringify(dataParse) }),\n token: token?.trim?.() || headers.Authorization?.replace?.(/^Bearer /, '') || null,\n ...opts,\n })\n\n return await response.data\n}\n\nconst SUPPORT_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'PATCH', 'REQUEST']\ndeclare type MethodType = 'request' | 'post' | 'get' | 'head' | 'patch' | 'delete' | 'put'\n\nexport function generateCallApis(apiName: string): { [method in MethodType]: typeof callApi } {\n return new Proxy({} as any, {\n get: (_, method) => {\n if (typeof method !== 'string') {\n throw new Error('[apis] method must be string')\n }\n\n const upMethod = method.toLocaleUpperCase()\n\n if (!SUPPORT_METHODS.includes(upMethod)) {\n throw new Error(`[apis] invalid method: ${method}`)\n }\n\n return async (callApiOptions: ICallApiOptions, opts: KV<any>) => await callApi.call(\n this,\n {\n name: apiName,\n method: (upMethod === 'REQUEST' ? callApiOptions.method : upMethod) || 'POST',\n ...callApiOptions,\n },\n opts,\n )\n },\n })\n}\n\nexport function generateApis(params?: {\n env?: string\n request?: SDKRequestInterface\n gatewayOrigin?: string\n getAccessToken?: () => Promise<{ accessToken: string }>\n}): { [apiName: string]: { [method in MethodType]: typeof callApi } } {\n Object.keys(params || {}).forEach((key) => {\n if (params[key] !== undefined) this[key] = params[key]\n })\n\n return new Proxy(\n {},\n {\n get: (_, apiName) => {\n if (typeof apiName === 'string') {\n return generateCallApis.call(this, apiName)\n }\n },\n },\n )\n}\n","import type { ICloudbase } from '@cloudbase/types'\nimport type { ICloudbaseComponent } from '@cloudbase/types/component'\nimport { generateApis } from './callApis'\n\ndeclare const cloudbase: ICloudbase\n\nconst COMPONENT_NAME = 'apis'\n\nconst component: ICloudbaseComponent = {\n name: COMPONENT_NAME,\n IIFE: true,\n entity() {\n Object.defineProperty(this.prototype, COMPONENT_NAME, {\n get() {\n // 这里的 this 是 cloudbase 实例\n return generateApis.call(this)\n },\n configurable: true,\n enumerable: true,\n })\n },\n}\n\nfunction registerApis(app: ICloudbase) {\n try {\n app.registerComponent(component)\n } catch (e) {\n console.warn(e)\n }\n}\n\ntry {\n cloudbase.registerComponent(component)\n} catch (e) {\n}\n\nexport { generateApis, registerApis }\nexport * from './type'\n\ntry {\n (window as any).registerApis = registerApis\n} catch (e) {}\n","let sdkName = '@cloudbase/js-sdk'\nexport function setSdkName(name: string) {\n sdkName = name\n}\nexport function getSdkName() {\n return sdkName\n}\n\nlet PROTOCOL = 'https:'\n\nexport function setProtocol(protocol: 'http:' | 'https:') {\n PROTOCOL = protocol\n}\n\nexport function getProtocol() {\n return PROTOCOL\n}\n// 是否为开发模式\nexport const IS_DEBUG_MODE = typeof process === 'undefined' || typeof process.env === 'undefined' ? false : process.env.NODE_ENV === 'development'\n// 问答社区链接\nexport const COMMUNITY_SITE_URL = 'https://support.qq.com/products/148793'\n","export const ERRORS = {\n INVALID_PARAMS: 'INVALID_PARAMS',\n INVALID_SYNTAX: 'INVALID_SYNTAX',\n INVALID_OPERATION: 'INVALID_OPERATION',\n OPERATION_FAIL: 'OPERATION_FAIL',\n NETWORK_ERROR: 'NETWORK_ERROR',\n UNKOWN_ERROR: 'UNKOWN_ERROR',\n}\n","export * from './common'\nexport * from './errors'\n\nexport const OATUH_LOGINTYPE = 'constants'\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(749);\n"],"names":["constants_1","require","callApi","callApiOptions","opts","Promise","name","_e","body","_f","path","_g","method","_h","headers","token","dataParse","JSON","parse","error","Error","stringify","code","ERRORS","INVALID_PARAMS","msg","url","gatewayOrigin","_j","this","getAccessToken","env","concat","getEndPointWithKey","_k","BASE_URL","PROTOCOL","endpoint","reqPath","startsWith","accessToken","_l","sent","Authorization","isGetAndHead","includes","_a","toUpperCase","call","Object","keys","map","key","join","request","fetch","__assign","_b","trim","_d","_c","replace","data","exports","SUPPORT_METHODS","generateCallApis","apiName","_this","Proxy","get","_","upMethod","toLocaleUpperCase","__awaiter","params","forEach","undefined","callApis_1","enumerable","generateApis","COMPONENT_NAME","component","IIFE","entity","defineProperty","prototype","configurable","registerApis","app","registerComponent","e","console","warn","cloudbase","__exportStar","window","sdkName","protocol","INVALID_SYNTAX","INVALID_OPERATION","OPERATION_FAIL","NETWORK_ERROR","UNKOWN_ERROR","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","module","__webpack_modules__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"index.esm.js","mappings":"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","sources":["webpack://@cloudbase/js-sdk/../../../src/constants/common.ts","webpack://@cloudbase/js-sdk/../../../src/constants/errors.ts","webpack://@cloudbase/js-sdk/../../../src/constants/index.ts","webpack://@cloudbase/js-sdk/webpack/bootstrap","webpack://@cloudbase/js-sdk/webpack/runtime/define property getters","webpack://@cloudbase/js-sdk/webpack/runtime/hasOwnProperty shorthand","webpack://@cloudbase/js-sdk/callApis.ts","webpack://@cloudbase/js-sdk/index.ts"],"sourcesContent":["let sdkName = '@cloudbase/js-sdk'\nexport function setSdkName(name: string) {\n sdkName = name\n}\nexport function getSdkName() {\n return sdkName\n}\n\nlet PROTOCOL = 'https:'\n\nexport function setProtocol(protocol: 'http:' | 'https:') {\n PROTOCOL = protocol\n}\n\nexport function getProtocol() {\n return PROTOCOL\n}\n// 是否为开发模式\nexport const IS_DEBUG_MODE = typeof process === 'undefined' || typeof process.env === 'undefined' ? false : process.env.NODE_ENV === 'development'\n// 问答社区链接\nexport const COMMUNITY_SITE_URL = 'https://support.qq.com/products/148793'\n","export const ERRORS = {\n INVALID_PARAMS: 'INVALID_PARAMS',\n INVALID_SYNTAX: 'INVALID_SYNTAX',\n INVALID_OPERATION: 'INVALID_OPERATION',\n OPERATION_FAIL: 'OPERATION_FAIL',\n NETWORK_ERROR: 'NETWORK_ERROR',\n UNKOWN_ERROR: 'UNKOWN_ERROR',\n}\n","export * from './common'\nexport * from './errors'\n\nexport const OATUH_LOGINTYPE = 'constants'\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { ERRORS } from '@cloudbase/utilities/dist/cjs/constants'\nimport { ICallApiOptions, KV } from '@cloudbase/types'\nimport { ResponseObject, SDKRequestInterface } from '@cloudbase/adapter-interface'\n\nexport async function callApi(callApiOptions: ICallApiOptions, opts?: KV<any>): Promise<ResponseObject['data']> {\n const { name, body, path = '', method = 'POST', headers = {} } = callApiOptions || {}\n const { token } = callApiOptions || {}\n let dataParse = {}\n try {\n dataParse = JSON.parse(body as any)\n } catch (error) {\n dataParse = body || {}\n }\n\n if (!name) {\n throw new Error(JSON.stringify({\n code: ERRORS.INVALID_PARAMS,\n msg: '[apis] invalid api name',\n }),)\n }\n\n let url = ''\n\n const { gatewayOrigin, getAccessToken, env } = this\n\n if (gatewayOrigin) {\n url = `${gatewayOrigin}/v1`\n } else if (this.getEndPointWithKey) {\n const { BASE_URL, PROTOCOL } = this.getEndPointWithKey('GATEWAY')\n url = `${PROTOCOL}${BASE_URL}`\n } else {\n url = `https://${env}.api.tcloudbasegateway.com/v1`\n }\n const endpoint = `${url}/apis/${name}`\n let reqPath = path.startsWith('/') ? path : `/${path}`\n\n if (getAccessToken) {\n const { accessToken } = await getAccessToken()\n headers.Authorization = `Bearer ${accessToken}`\n }\n\n const isGetAndHead = ['GET', 'HEAD'].includes(method?.toUpperCase?.())\n\n if (isGetAndHead) {\n try {\n reqPath = `${reqPath}${reqPath.includes('?') ? '&' : '?'}${Object.keys(dataParse)\n .map(key => `${key}=${dataParse[key]}`)\n .join('&')}`\n } catch (error) {\n //\n }\n }\n\n const response = await this.request.fetch({\n url: `${endpoint}${reqPath}`,\n method: method || 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n ...headers,\n },\n // Request with GET/HEAD method cannot have body\n ...(isGetAndHead ? {} : { body: JSON.stringify(dataParse) }),\n token: token?.trim?.() || headers.Authorization?.replace?.(/^Bearer /, '') || null,\n ...opts,\n })\n\n return await response.data\n}\n\nconst SUPPORT_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'PATCH', 'REQUEST']\ndeclare type MethodType = 'request' | 'post' | 'get' | 'head' | 'patch' | 'delete' | 'put'\n\nexport function generateCallApis(apiName: string): { [method in MethodType]: typeof callApi } {\n return new Proxy({} as any, {\n get: (_, method) => {\n if (typeof method !== 'string') {\n throw new Error('[apis] method must be string')\n }\n\n const upMethod = method.toLocaleUpperCase()\n\n if (!SUPPORT_METHODS.includes(upMethod)) {\n throw new Error(`[apis] invalid method: ${method}`)\n }\n\n return async (callApiOptions: ICallApiOptions, opts: KV<any>) => await callApi.call(\n this,\n {\n name: apiName,\n method: (upMethod === 'REQUEST' ? callApiOptions.method : upMethod) || 'POST',\n ...callApiOptions,\n },\n opts,\n )\n },\n })\n}\n\nexport function generateApis(params?: {\n env?: string\n request?: SDKRequestInterface\n gatewayOrigin?: string\n getAccessToken?: () => Promise<{ accessToken: string }>\n}): { [apiName: string]: { [method in MethodType]: typeof callApi } } {\n Object.keys(params || {}).forEach((key) => {\n if (params[key] !== undefined) this[key] = params[key]\n })\n\n return new Proxy(\n {},\n {\n get: (_, apiName) => {\n if (typeof apiName === 'string') {\n return generateCallApis.call(this, apiName)\n }\n },\n },\n )\n}\n","import type { ICloudbase } from '@cloudbase/types'\nimport type { ICloudbaseComponent } from '@cloudbase/types/component'\nimport { generateApis } from './callApis'\n\ndeclare const cloudbase: ICloudbase\n\nconst COMPONENT_NAME = 'apis'\n\nconst component: ICloudbaseComponent = {\n name: COMPONENT_NAME,\n IIFE: true,\n entity() {\n Object.defineProperty(this.prototype, COMPONENT_NAME, {\n get() {\n // 这里的 this 是 cloudbase 实例\n return generateApis.call(this)\n },\n configurable: true,\n enumerable: true,\n })\n },\n}\n\nfunction registerApis(app: ICloudbase) {\n try {\n app.registerComponent(component)\n } catch (e) {\n console.warn(e)\n }\n}\n\ntry {\n cloudbase.registerComponent(component)\n} catch (e) {\n}\n\nexport { generateApis, registerApis }\nexport * from './type'\n\ntry {\n (window as any).registerApis = registerApis\n} catch (e) {}\n"],"names":["sdkName","exports","name","PROTOCOL","protocol","INVALID_PARAMS","INVALID_SYNTAX","INVALID_OPERATION","OPERATION_FAIL","NETWORK_ERROR","UNKOWN_ERROR","__exportStar","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","module","__webpack_modules__","call","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","callApi","callApiOptions","opts","Promise","_e","body","_f","path","_g","method","_h","headers","token","dataParse","JSON","parse","error","Error","stringify","code","ERRORS","msg","url","gatewayOrigin","_j","this","getAccessToken","env","concat","getEndPointWithKey","_k","BASE_URL","endpoint","reqPath","startsWith","accessToken","_l","sent","Authorization","isGetAndHead","includes","_a","toUpperCase","keys","map","join","request","fetch","__assign","_b","trim","_d","_c","replace","data","SUPPORT_METHODS","generateCallApis","apiName","_this","Proxy","_","upMethod","toLocaleUpperCase","__awaiter","generateApis","params","forEach","COMPONENT_NAME","component","IIFE","entity","configurable","registerApis","app","registerComponent","e","console","warn","cloudbase","window"],"sourceRoot":""}
|
package/app/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"@cloudbase/adapter-interface";import*as t from"@cloudbase/adapter-wx_mp";import*as n from"jwt-decode";var r={922:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH2_LOGINTYPE_PREFIX=t.LOGINTYPE=t.getBaseEndPoint=t.setRegionLevelEndpoint=t.setGatewayEndPointWithEnv=t.getEndPointInfo=t.setEndPointInfo=t.DEFAULT_PROTOCOL=t.DATA_VERSION=t.getSdkName=t.setSdkName=t.getSdkVersion=t.setSdkVersion=void 0;var o=n(877),i=o.constants.setSdkName,a=o.constants.setProtocol,s="",c="@cloudbase/js-sdk";t.setSdkVersion=function(e){s=e},t.getSdkVersion=function(){return s},t.setSdkName=function(e){c=e,i(e)},t.getSdkName=function(){return c},t.DATA_VERSION="2020-01-10";var u,l=[],d=["env","endPointKey","region"];function f(e){return l.find((function(t){return d.filter((function(t){return null!=e[t]})).every((function(n){return t[n]===e[n]}))}))}function p(e){var n,o;e.protocol&&!/:$/.test(e.protocol)&&(e.protocol="".concat(e.protocol,":"));var i=f(e);i?(null!=e.baseUrl&&(i.baseUrl=e.baseUrl),null!=e.protocol&&(i.protocol=e.protocol)):l.push(r(r({},e),{protocol:null!==(n=e.protocol)&&void 0!==n?n:t.DEFAULT_PROTOCOL})),"CLOUD_API"===e.endPointKey&&a(null!==(o=e.protocol)&&void 0!==o?o:t.DEFAULT_PROTOCOL)}function h(e,t,n){return f({env:e,endPointKey:t,region:n})}t.DEFAULT_PROTOCOL="https:",t.setEndPointInfo=p,t.getEndPointInfo=h,t.setGatewayEndPointWithEnv=function(e,t,n){var r="//".concat(e,".api.tcloudbasegateway.com/v1");n&&(r="//".concat(e,".api.intl.tcloudbasegateway.com/v1")),p({endPointKey:"GATEWAY",env:e,baseUrl:r,protocol:t})},t.setRegionLevelEndpoint=function(e,t,n){p({env:e,region:t,baseUrl:"//".concat(e,".").concat(t||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:n,endPointKey:"CLOUD_API"})},t.getBaseEndPoint=function(e,t){void 0===t&&(t="CLOUD_API");var n=h(e,t||"CLOUD_API"),r=n.protocol,o=n.baseUrl;return"".concat(r).concat(o).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]},(u=t.LOGINTYPE||(t.LOGINTYPE={})).NULL="NULL",u.ANONYMOUS="ANONYMOUS",u.WECHAT="WECHAT",u.WECHAT_PUBLIC="WECHAT-PUBLIC",u.WECHAT_OPEN="WECHAT-OPEN",u.CUSTOM="CUSTOM",u.EMAIL="EMAIL",u.USERNAME="USERNAME",u.PHONE="PHONE",t.OAUTH2_LOGINTYPE_PREFIX="OAUTH2"},950:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.cloudbase=t.LANGS=t.getBaseEndPoint=void 0;var c=n(877),u=n(276),l=n(985),d=n(938),f=n(901),p=n(922),h=n(509),v=n(922);Object.defineProperty(t,"getBaseEndPoint",{enumerable:!0,get:function(){return v.getBaseEndPoint}});var g=n(509);Object.defineProperty(t,"LANGS",{enumerable:!0,get:function(){return g.LANGS}});var y=c.adapters.useAdapters,b=c.adapters.useDefaultAdapter,m=c.constants.ERRORS,O=c.constants.COMMUNITY_SITE_URL,_=c.utils.printWarn,w=c.helpers.catchErrorsDecorator,E={timeout:15e3,persistence:"local"},P=6e5,A={},I=function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=(0,p.getSdkVersion)()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return l.Platform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return(0,d.getCacheByEnvId)(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return(0,d.getLocalCache)(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return(0,f.getRequestByEnvId)(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var n,o,i;if(void 0===t&&(t={env:""}),t.endPointMode=t.endPointMode||"GATEWAY",l.Platform.adapter||this.useDefaultAdapter(),!(t=this.dealNodeAdapterConfig(t)).env)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"env must not be specified"}));this.isInitialized(t);var a={timeout:t.timeout||15e3,timeoutMsg:"[".concat((0,p.getSdkName)(),"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s"),auth:t.auth};this.requestClient=new l.Platform.adapter.reqClass(a),this.cloudbaseConfig=r(r(r({},E),t),{i18n:(0,h.i18nProxy)(l.Platform,t)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var s=this.cloudbaseConfig,c=s.env,u=s.persistence,v=s.debug,g=s.timeout,y=s.oauthClient,b=s.i18n;(0,d.initCache)({env:c,persistence:u,debug:v,platformInfo:this.platform}),(0,p.setRegionLevelEndpoint)(c,t.region||""),(0,p.setGatewayEndPointWithEnv)(c,p.DEFAULT_PROTOCOL,t.intl);var O=new e(this.cloudbaseConfig);return(0,f.initRequest)({env:c,region:t.region||"",timeout:g,oauthClient:y,_fromApp:O,i18n:b,endPointMode:t.endPointMode,auth:t.auth}),O.requestClient=this.requestClient,null===(n=null==this?void 0:this.fire)||void 0===n||n.call(this,"cloudbase_init",O),this.try2InitAuth(O),(null===(o=l.Platform.adapter)||void 0===o?void 0:o.nodeTool)&&(null===(i=l.Platform.adapter)||void 0===i||i.nodeTool(O,this.cloudbaseConfig)),O},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=n,(0,d.initCache)({env:this.cloudbaseConfig.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.updateLang=function(e){var t;e&&e!==(null===(t=this.cloudbaseConfig.i18n)||void 0===t?void 0:t.lang)&&(this.cloudbaseConfig.i18n.lang=e)},e.prototype.registerExtension=function(e){A[e.name]=e},e.prototype.invokeExtension=function(e,t){return a(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:if(!(n=A[e]))throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}}))}))},e.prototype.useAdapters=function(e,t){var n=y(e,t)||{},r=n.adapter,o=n.runtime;r&&(l.Platform.adapter=r),o&&(l.Platform.runtime=o)},e.prototype.registerHook=function(t){(0,u.registerHook)(e,t)},e.prototype.registerComponent=function(t){(0,u.registerComponent)(e,t)},e.prototype.registerVersion=function(e){(0,p.setSdkVersion)(e),this.version=e},e.prototype.registerSdkName=function(e){(0,p.setSdkName)(e)},e.prototype.isInitialized=function(e){return void 0===e&&(e=this.cloudbaseConfig),["your-env-id","your-envid","your_env_id","xxx-yyy","xxxx-yyy","envId","env-id","your-environment-id","REPLACE_ME"].some((function(t){return e.env.toLowerCase()===t.toLowerCase()}))&&_(m.INVALID_PARAMS,'[CloudBase] 检测到环境 ID "'.concat(e.env,'" 可能是占位符,请替换为真实的环境 ID。\n')+" 获取方式:登录腾讯云开发平台 → 环境管理 → 环境设置 → 环境 ID\n 建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV"),!!(null==e?void 0:e.env)},e.prototype.registerEndPoint=function(e,t){(0,p.setEndPointInfo)({baseUrl:e,protocol:t,env:this.config.env,endPointKey:"CLOUD_API"})},e.prototype.registerEndPointWithKey=function(e){(0,p.setEndPointInfo)({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.getEndPointWithKey=function(e){var t=(0,p.getEndPointInfo)(this.config.env,e);return{BASE_URL:t.baseUrl,PROTOCOL:t.protocol}},e.prototype.parseCaptcha=function(e){return c.utils.parseCaptcha(e)},e.prototype.useDefaultAdapter=function(){var e=b.bind(this)(),t=e.adapter,n=e.runtime;l.Platform.adapter=t,l.Platform.runtime=n},e.prototype.formatTimeout=function(e){switch(!0){case e>P:return _(m.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),P;case e<100:return _(m.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},e.prototype.try2InitAuth=function(e){try{e.auth()}catch(e){console.log("try2InitAuth error:",e)}},e.prototype.dealNodeAdapterConfig=function(e){return e},o([w({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(O)]}),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",e)],e.prototype,"init",null),o([w({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(O)]}),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}();t.cloudbase=new I,t.cloudbase.useAdapters((0,l.getWxDefaultAdapter)()),t.default=t.cloudbase},985:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},s=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.getWxDefaultAdapter=t.Platform=void 0;var c=a(n(232)),u=n(149);t.Platform={},t.getWxDefaultAdapter=function(){return c.WxRequest.prototype.upload=function(e){var t=this,n=this;return new Promise((function(o){var i=e.url,a=e.file,s=e.data,c=e.headers,u=wx.getFileSystemManager(),l=wx.request({url:i,method:e.method,header:r({"content-type":" "},c),data:u.readFileSync(a),timeout:t._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&(null==s?void 0:s.success_action_status)&&(t.statusCode=parseInt(s.success_action_status,10)),o(t)},fail:function(e){o(e)},complete:function(e){if((null==e?void 0:e.errMsg)&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(n._timeoutMsg);try{l.abort()}catch(e){}}}})}))},c.default.genAdapter=function(e){return{root:{globalThis:{}},reqClass:c.WxRequest,wsClass:c.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(t){var n=e.EventBus,o={},i=t;console.log("openURIWithCallback",t);var a=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(a){i=a[1],console.log("openURIWithCallback url",i);var u=a[2];u&&(o=(0,c.parseQueryString)(u))}console.log("openURIWithCallback queryObj",o);var l=o.token,d=s(o,["token"]);return/^data:/.test(i)&&!l?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(t)}):l?new Promise((function(e){console.log("wait for captcha..."),n.$emit("CAPTCHA_DATA_CHANGE",r(r({},d),{token:l,url:i})),n.$once("RESOLVE_CAPTCHA_DATA",(function(t){e(t)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:c.wxMpStorage,primaryStorage:u.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.plugin.appId:""}}},c.default}},938:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalCache=t.getCacheByEnvId=t.initCache=void 0;var o=n(877).cache.CloudbaseCache,i={},a={};t.initCache=function(e){var t=e.env,n=e.platformInfo,s={userInfoKey:"".concat("user_info","_").concat(t)};i[t]=i[t]||new o(r(r({},e),{keys:s,platformInfo:n})),a[t]=a[t]||new o(r(r({},e),{keys:s,platformInfo:n,persistence:"local"}))},t.getCacheByEnvId=function(e){return i[e]},t.getLocalCache=function(e){return a[e]}},276:function(e,t,n){var r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.registerHook=t.registerComponent=void 0;var o=n(877).constants.ERRORS,i={};function a(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=a(e[o],t[o]))}return e}t.registerComponent=function(e,t){var n=t.name,s=t.namespace,c=t.entity,u=t.injectEvents,l=t.IIFE,d=void 0!==l&&l;if(i[n]||s&&e[s])throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(d){if(!c||"function"!=typeof c)throw new Error(JSON.stringify({code:o.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));c.call(e)}if(i[n]=t,s?e.prototype[s]=c:a(e.prototype,c),u){var f=u.bus,p=u.events;if(!f||!p||0===p.length)return;var h=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=r(r([],e.prototype.events[n].events,!0),p,!0):e.prototype.events[n]={bus:f,events:p},e.prototype.fire=function(e,t){h(e,t);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var o=r[n],i=this.events[o],a=i.bus;if(i.events.includes(e)){a.fire(e,t);break}}}}},t.registerHook=function(e,t){var n=t.entity,i=t.target;if(Object.prototype.hasOwnProperty.call(e,i))throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"target:".concat(i," is not exist")}));var a=e.prototype[i];if("function"!=typeof a)throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"target:".concat(i," is not a function which is the only type supports hook")}));e.prototype[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,r([this],e,!1)),a.call.apply(a,r([this],e,!1))}}},509:(e,t,n)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.i18nProxy=t.t=t.langMap=t.LANG_HEADER_KEY=t.LANGS=void 0;var o,i=n(877);!function(e){e.ZH="zh-CN",e.EN="en-US"}(o=t.LANGS||(t.LANGS={})),t.LANG_HEADER_KEY="Accept-Language",t.langMap=((r={})[o.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code",错误信息:"error message",未实现:"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs",请求超时:"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},r),t.t=function(e,n){var r;return(null===(r=t.langMap[n])||void 0===r?void 0:r[e])||e},t.i18nProxy=function(e,n){var r,a,s=function(e){return"lang_".concat(e.clientId||e.env)}(n),c=(e.adapter||{}).localStorage,u=n.lang||(null===(r=null==c?void 0:c.getItem)||void 0===r?void 0:r.call(c,s))||o.ZH;return null===(a=null==c?void 0:c.setItem)||void 0===a||a.call(c,s,u),new Proxy({t:function(e){return(0,t.t)(e,u)},LANG_HEADER_KEY:t.LANG_HEADER_KEY,lang:u},{get:function(e,t){var n;return"lang"===t&&(null===(n=null==c?void 0:c.getItem)||void 0===n?void 0:n.call(c,s))||e[t]},set:function(e,n,r){var o;return"lang"===n&&r!==e[n]&&(e[n]=r,e.t=function(e){return(0,t.t)(e,r)},null===(o=null==c?void 0:c.setItem)||void 0===o||o.call(c,s,r),i.langEvent.bus.fire(i.langEvent.LANG_CHANGE_EVENT,{i18n:e})),e[n]=r,!0}})}},901:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.getRequestByEnvId=t.initRequest=t.CloudbaseRequest=void 0;var s=n(922),c=n(877),u=n(938),l=n(985),d=c.constants.ERRORS,f=c.utils.genSeqId,p=c.utils.isFormData,h=c.utils.formatUrl,v=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function g(e,t,n){var o=e[t];e[t]=function(t){var i={},a={};n.forEach((function(n){var r=n.call(e,t),o=r.data,s=r.headers;Object.assign(i,o),Object.assign(a,s)}));var s=t.data;return s&&(p(s)?Object.keys(i).forEach((function(e){s.append(e,i[e])})):t.data=r(r({},s),i)),t.headers=r(r({},t.headers||{}),a),o.call(e,t)}}function y(){var e=f();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat((0,s.getSdkVersion)()),"x-seqid":e}}}var b=function(){function e(e){var t=this;this.throwWhenRequestFail=!1,this.config=e;var n={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"],auth:e.auth};this.reqClass=new l.Platform.adapter.reqClass(n),this.throwWhenRequestFail=e.throw||!1,this.localCache=(0,u.getLocalCache)(this.config.env),"GATEWAY"!==this.config.endPointMode&&(g(this.reqClass,"post",[y]),g(this.reqClass,"upload",[y]),g(this.reqClass,"download",[y])),c.langEvent.bus.on(c.langEvent.LANG_CHANGE_EVENT,(function(e){var n;t.config.i18n=(null===(n=e.data)||void 0===n?void 0:n.i18n)||t.config.i18n}))}return e.prototype.getAccessToken=function(e){return void 0===e&&(e=null),o(this,void 0,void 0,(function(){var t,n,r;return i(this,(function(o){switch(o.label){case 0:if(null!=e)return[2,e];if(!(t=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return n=t.oauthInstance,r=n.oauth2client,[4,this.getOauthAccessTokenV2(r)];case 1:return[2,o.sent().accessToken]}}))}))},e.prototype.getDefaultHeaders=function(){var e,t,n;return(e={})[null===(t=this.config.i18n)||void 0===t?void 0:t.LANG_HEADER_KEY]=null===(n=this.config.i18n)||void 0===n?void 0:n.lang,e["X-SDK-Version"]="@cloudbase/js-sdk/".concat((0,s.getSdkVersion)()),e},e.prototype.post=function(e,t){return o(this,void 0,Promise,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.reqClass.post(r(r({},e),{headers:r(r({},e.headers),this.getDefaultHeaders()),customReqOpts:t}))];case 1:return[2,n.sent()]}}))}))},e.prototype.upload=function(e){return o(this,void 0,Promise,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.upload(r(r({},e),{headers:r(r({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return o(this,void 0,Promise,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.download(r(r({},e),{headers:r(r({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.getBaseEndPoint=function(e){return void 0===e&&(e="CLOUD_API"),(0,s.getBaseEndPoint)(this.config.env,e)},e.prototype.getOauthAccessTokenV2=function(e){return o(this,void 0,Promise,(function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return[4,e.getAccessToken()];case 1:return t=r.sent(),[4,e.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:t,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},e.prototype.request=function(e,t,n,a){var c,u;return o(this,void 0,Promise,(function(){var o,l,d,f,p,g,y,b,m,O,_,w,E,P,A,I,S,j,C,R,x,N,k;return i(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,4,,5]),o="x-tcb-trace_".concat(this.config.env),l="application/x-www-form-urlencoded",d=r({action:e,dataVersion:s.DATA_VERSION,env:this.config.env},t),-1!==v.indexOf(e))return[3,2];if(!(f=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return p=f.oauthInstance,g=p.oauth2client,y=d,[4,this.getOauthAccessTokenV2(g)];case 1:y.access_token=i.sent().accessToken,i.label=2;case 2:return"storage.uploadFile"===e?(b=new FormData,Object.keys(b).forEach((function(e){Object.prototype.hasOwnProperty.call(b,e)&&void 0!==b[e]&&b.append(e,d[e])})),l="multipart/form-data"):(l="application/json;charset=UTF-8",b={},Object.keys(d).forEach((function(e){void 0!==d[e]&&(b[e]=d[e])}))),m={headers:r(r({"content-type":l},this.getDefaultHeaders()),null==n?void 0:n.headers)},(null==n?void 0:n.onUploadProgress)&&(m.onUploadProgress=n.onUploadProgress),this.config.region&&(m.headers["X-TCB-Region"]=this.config.region),(O=this.localCache.getStore(o))&&(m.headers["X-TCB-Trace"]=O),_=void 0!==(null==n?void 0:n.parse)?n.parse:t.parse,w=void 0!==(null==n?void 0:n.inQuery)?n.inQuery:t.inQuery,E=void 0!==(null==n?void 0:n.search)?n.search:t.search,P=r(r({},(null==n?void 0:n.defaultQuery)||{}),{env:this.config.env}),_&&(P.parse=!0),w&&(P=r(r({},w),P)),A=(null==n?void 0:n.endPointMode)||this.config.endPointMode||"CLOUD_API",I=(0,s.getEndPointInfo)(this.config.env,A),S=I.baseUrl,j=I.protocol,"GATEWAY"===A&&/^((database)\.)|(auth\.wsWebSign)/.test(e)&&(C=(0,s.getEndPointInfo)(this.config.env,"CLOUD_API"),S="".concat(C.baseUrl.match(/\/\/([^/?#]*)/)[0],"/web")),R=void 0,R=n.pathname?h(j,"".concat(null===(c=(0,s.getBaseEndPoint)(this.config.env,A))||void 0===c?void 0:c.replace(/^https?:/,""),"/").concat(n.pathname),P):h(j,S,P),E&&(R+=E),[4,this.post(r({url:R,data:b},m),a)];case 3:if(x=i.sent(),(N=null===(u=x.header)||void 0===u?void 0:u["x-tcb-trace"])&&this.localCache.setStore(o,N),200!==Number(x.status)&&200!==Number(x.statusCode)||!x.data)throw new Error("network request error");return[2,x];case 4:k=i.sent();try{k.requestId=k.requestId||(null==n?void 0:n.headers["x-request-id"])||(null==n?void 0:n.headers["X-Request-Id"])||""}catch(e){}throw k;case 5:return[2]}}))}))},e.prototype.fetch=function(e){var t,n,c,u,l,d,f,p;return o(this,void 0,Promise,(function(){var h,v,g,y,b,m,O,_,w=this;return i(this,(function(E){switch(E.label){case 0:h=e.token,v=e.headers,g=void 0===v?{}:v,y=e.withCredentials,b=void 0===y||y,m=a(e,["token","headers","withCredentials"]),O=function(){return o(w,void 0,void 0,(function(){var e,t,n;return i(this,(function(o){switch(o.label){case 0:return e={},b?(t=e,n="Bearer ".concat,[4,this.getAccessToken(h)]):[3,2];case 1:t.Authorization=n.apply("Bearer ",[o.sent()]),o.label=2;case 2:return[2,this.reqClass.fetch(r({headers:r(r(r({"X-SDK-Version":"@cloudbase/js-sdk/".concat((0,s.getSdkVersion)())},e),this.getDefaultHeaders()),g)},m))]}}))}))},E.label=1;case 1:return E.trys.push([1,3,,6]),[4,O()];case 2:return[2,E.sent()];case 3:_=E.sent();try{_.requestId=_.requestId||g["x-request-id"]||g["X-Request-Id"]||""}catch(e){}if("ACCESS_TOKEN_EXPIRED"!==(null==_?void 0:_.code))return[3,5];if("function"!=typeof(null===(u=null===(c=null===(n=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===n?void 0:n.oauthInstance)||void 0===c?void 0:c.authApi)||void 0===u?void 0:u.refreshTokenForce))throw _;return[4,null===(p=null===(f=null===(d=null===(l=this.config)||void 0===l?void 0:l._fromApp)||void 0===d?void 0:d.oauthInstance)||void 0===f?void 0:f.authApi)||void 0===p?void 0:p.refreshTokenForce()];case 4:return E.sent(),[2,O()];case 5:throw _;case 6:return[2]}}))}))},e.prototype.send=function(e,t,n,a){return void 0===t&&(t={}),void 0===n&&(n={}),o(this,void 0,Promise,(function(){var o;return i(this,(function(i){switch(i.label){case 0:return[4,this.request(e,t,r(r({},n),{onUploadProgress:t.onUploadProgress}),a)];case 1:if((o=i.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:d.OPERATION_FAIL,msg:"[".concat(o.data.code,"] ").concat(o.data.message)}));return[2,o.data]}}))}))},e.prototype.gateWay=function(e,t){var n;return o(this,void 0,void 0,(function(){var o,a,u,l,f,p,h,v,g,y,b,m,O,_,w,E,P,A,I;return i(this,(function(i){switch(i.label){case 0:if(o=e.url,a=e.name,u=e.data,l=e.path,f=void 0===l?"":l,p=e.method,h=e.header,v=void 0===h?{}:h,!(a&&f||o))throw new Error(JSON.stringify({code:d.INVALID_PARAMS,msg:"[gateWay] invalid function name or path or url"}));try{g=u?JSON.stringify(u):""}catch(e){throw new Error(JSON.stringify({code:d.INVALID_PARAMS,msg:"[gateWay] invalid data"}))}if(y=c.utils.generateRequestId(),b=(0,s.getEndPointInfo)(this.config.env,"GATEWAY"),m=b.baseUrl,O=b.protocol,_="".concat(O).concat(m).concat(o||"/".concat(f,"/").concat(a)),w=["GET","HEAD"].includes(null===(n=null==p?void 0:p.toUpperCase)||void 0===n?void 0:n.call(p)))try{E={};try{E=JSON.parse(u)}catch(e){E=u||{}}_="".concat(_).concat(_.includes("?")?"&":"?").concat(Object.keys(E).map((function(e){return"".concat(e,"=").concat(E[e])})).join("&"))}catch(e){}return[4,this.fetch(r(r({method:p||"POST",headers:r({"Content-Type":"application/json; charset=utf-8","X-Request-Id":y},v)},w?{}:{body:g}),{url:_,customReqOpts:t}))];case 1:return P=i.sent(),A=[r({requestId:y},P)],I={},[4,P.data];case 2:return[2,r.apply(void 0,A.concat([(I.data=i.sent(),I)]))]}}))}))},e}();t.CloudbaseRequest=b;var m={};t.initRequest=function(e){m[e.env]=new b(r(r({},e),{throw:!0}))},t.getRequestByEnvId=function(e){return m[e]}},130:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=r(n(950)),i=r(n(30));o.default.registerVersion(i.default.version);try{window.cloudbase=o.default}catch(e){}t.default=o.default,e.exports=o.default},563:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,c=a(n(92)),u=n(962);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e,t){for(var n=0,o=(0,u.isArray)(e)?e:[e];n<o.length;n++){var i=o[n],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:r({isMatch:a},s(t)),runtime:c}}},t.useDefaultAdapter=function(){return{adapter:r({},c.genAdapter()),runtime:s.WEB}}},92:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var c=n(149),u=n(962),l=n(464),d=function(e){function t(t){var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,o=e.method,a=e.headers,s=void 0===a?{}:a,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===c?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",r),u.append("file",n),this.request(i(i({},e),{data:u,method:c}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return a(this,void 0,Promise,(function(){var t,n,r,o;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return a(this,void 0,Promise,(function(){var n,r,o,c,u,l,d,f,p,h,v,g,y,b=this;return s(this,(function(m){switch(m.label){case 0:return n=new AbortController,r=e.url,o=e.enableAbort,c=void 0!==o&&o,u=e.stream,l=void 0!==u&&u,d=e.signal,f=e.timeout,p=e.shouldThrowOnError,h=void 0===p||p,v=null!=f?f:this.timeout,d&&(d.aborted&&n.abort(),d.addEventListener("abort",(function(){return n.abort()}))),g=null,c&&v&&(g=setTimeout((function(){console.warn(b.timeoutMsg),n.abort(new Error(b.timeoutMsg))}),v)),[4,fetch(r,i(i({},e),{signal:n.signal})).then((function(e){return a(b,void 0,void 0,(function(){var t,n,r;return s(this,(function(o){switch(o.label){case 0:return clearTimeout(g),h?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,t];case 4:return[2,e]}}))}))})).catch((function(e){if(clearTimeout(g),h)return Promise.reject(e)}))];case 1:return y=m.sent(),[2,{data:l?y.body:(null===(t=y.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?y.json():y.text(),statusCode:y.status,header:y.headers}]}}))}))},t.prototype.request=function(e,t){var n=this;void 0===t&&(t=!1);var r=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,a,s=e.url,c=e.headers,d=void 0===c?{}:c,f=e.data,p=e.responseType,h=e.withCredentials,v=e.body,g=e.onUploadProgress,y=(0,u.formatUrl)((0,l.getProtocol)(),s,"get"===r?f:{}),b=new XMLHttpRequest;b.open(r,y),p&&(b.responseType=p),Object.keys(d).forEach((function(e){b.setRequestHeader(e,d[e])})),g&&b.upload.addEventListener("progress",g),b.onreadystatechange=function(){var e={};if(4===b.readyState){var t=b.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach((function(e){var t=e.split(": "),r=t.shift().toLowerCase(),o=t.join(": ");n[r]=o})),e.header=n,e.statusCode=b.status;try{e.data="blob"===p?b.response:JSON.parse(b.responseText)}catch(t){e.data="blob"===p?b.response:b.responseText}clearTimeout(i),o(e)}},t&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),b.abort()}),n.timeout)),a=(0,u.isFormData)(f)?f:"application/x-www-form-urlencoded"===d["content-type"]?(0,u.toQueryString)(f):v||(f?JSON.stringify(f):void 0),h&&(b.withCredentials=!0),b.send(a)}))},t}(c.AbstractSDKRequest);t.WebRequest=d,t.genAdapter=function(){return{type:"default",root:window,reqClass:d,wsClass:WebSocket,localStorage}}},464:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var n="@cloudbase/js-sdk";t.setSdkName=function(e){n=e},t.getSdkName=function(){return n};var r="https:";t.setProtocol=function(e){r=e},t.getProtocol=function(){return r},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},519:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},778:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(n(464),t),o(n(519),t),t.OATUH_LOGINTYPE="constants"},517:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=n(962),a=n(778),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var c=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(e){var t=e.err,n=e.className,r=e.methodName,o=e.sourceLink;if(!o)return null;var i,a=t.stack.split("\n"),c=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),l=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),d=a.findIndex((function(e){return c.test(e)}));if(-1!==d){var f=a.filter((function(e,t){return t>d}));f.unshift(a[d].replace(l,"".concat(n,".").concat(r)).replace(u,o)),(i=new Error).stack="".concat(s?"@debugger":"Error","\n").concat(f.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,n=void 0===t?"async":t,s=e.customInfo,d=void 0===s?{}:s,f=e.title,p=e.messages,h=void 0===p?[]:p;return function(e,t,s){if(a.IS_DEBUG_MODE){var p=d.className||e.constructor.name,v=d.methodName||t,g=s.value,y=function(){var e="",t=(new Error).stack.split("\n"),n=t.findIndex((function(e){return c.test(e)}));if(-1!==n){var r=u.exec(t[n+1]||"");e=r?r[0]:""}return e}();s.value="sync"===n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=l({err:new Error,className:p,methodName:v,sourceLink:y});try{return g.apply(this,e)}catch(e){var r=e,o=e.message,a=e.error,s=e.error_description,c={title:f||"".concat(p,".").concat(v," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(n?(n.code=u.code,n.msg=u.msg):(e.code=u.code,e.message=u.msg),r=n||e,c.content=h.map((function(e){return{type:"info",body:e}})))}throw a&&s&&(c.subtitle=s,n?(n.code=a,n.msg=s):(e.code=a,e.message=s),r=n||e,c.content=h.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(c),r}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(this,void 0,void 0,(function(){var t,n,r,a,s,c,u,d;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:p,methodName:v,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,o.sent()];case 3:throw n=o.sent(),r=n,a=n.message,s=n.error,c=n.error_description,u={title:f||"".concat(p,".").concat(v," failed"),content:[{type:"error",body:n}]},a&&/^\{.*\}$/.test(a)&&(d=JSON.parse(a),u.subtitle=d,d.code&&(t?(t.code=d.code,t.message=d.msg):(n.code=d.code,n.message=d.msg),r=t||n,u.content=h.map((function(e){return{type:"info",body:e}})))),s&&c&&(u.subtitle=c,t?(t.code=s,t.msg=c):(n.code=s,n.message=c),r=t||n,u.content=h.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),r;case 4:return[2]}}))}))}}}}},260:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(517),t)},877:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.langEvent=t.AbortController=t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=i(n(778));t.constants=s;var c=i(n(563));t.adapters=c;var u=i(n(865));t.cache=u;var l=i(n(940));t.events=l;var d=i(n(991));t.langEvent=d;var f=i(n(962));t.utils=f;var p=i(n(260));t.helpers=p;var h=a(n(829));t.AbortController=h.default;var v={decode:a(n(880)).default};t.jwt=v},829:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){var e=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(t,n){"abort"===t&&e.listeners.push(n)}}}return e.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(e){return e()})))},e}();t.default=n},865:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=n(149),c=n(962),u=n(778),l=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return o(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(s.AbstractStorage),d=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=void 0===n?{}:n,o=e.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,c.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,n){return i(this,void 0,void 0,(function(){var r;return a(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:""}(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var n;return i(this,void 0,void 0,(function(){var r;return a(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(r=o.sent())&&r.indexOf(t)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=d},940:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var a=n(962),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var c=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return o(t,e),t}(s);t.IErrorEvent=c;var u=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(null==n?void 0:n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,a.isInstanceOf)(e,c))return console.error(e.error),this;var n=(0,a.isString)(e)?new s(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,u=this.listeners[r]?i([],this.listeners[r],!0):[];o<u.length;o++)u[o].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var l=new u;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},991:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LANG_CHANGE_EVENT=t.bus=void 0;var r=n(940);t.bus=new r.CloudbaseEventEmitter,t.LANG_CHANGE_EVENT="lang_change"},962:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=n(778);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),("x"===n?r:7&r|8).toString(16)}))},t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";return Object.keys(n).forEach((function(e){""===o?!r&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(n[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(n){t.push("".concat(n,"=").concat(encodeURIComponent(e[n])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var n=t||decodeURIComponent(window.location.search),r=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var n=t.split("?")[0],r=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===e&&r.splice(i,1);n="".concat(n,"?").concat(r.join("&"))}return n},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e},t.execCallback=function(e,t,n){if(void 0===n&&(n=null),e&&"function"==typeof e)return e(t,n);if(t)throw t;return n},t.printWarn=function(e,t){console.warn("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t,n=e.title,r=e.subtitle,o=void 0===r?"":r,i=e.content,a=void 0===i?[]:i,s=e.printTrace,c=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(n,o):(console.group||console.error)(n,o);for(var l=0,d=a;l<d.length;l++){var f=d[l],p=f.type,h=f.body;switch(p){case"info":console.log(h);break;case"warn":console.warn(h);break;case"error":console.error(h)}}c&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)},t.parseQueryString=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var n=e.split("="),r=n[0],o=n[1];r=decodeURIComponent(r),o=decodeURIComponent(o),r&&(t[r]?Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]:t[r]=o)})),t},t.parseCaptcha=function(e){var n={},o=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(o){e=o[1];var i=o[2];i&&(n=(0,t.parseQueryString)(i))}var a=n.token,s=r(n,["token"]);return/^data:/.test(e)&&!a?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:a?{state:s.state,token:a,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}},149:t=>{t.exports=e},232:e=>{e.exports=t},880:e=>{e.exports=n},30:e=>{e.exports=JSON.parse('{"name":"@cloudbase/app","version":"3.4.6","description":"cloudbase javascript sdk core","main":"dist/cjs/index.js","module":"dist/esm/index.js","exports":{".":{"node":{"import":"./dist/esm/index.node.js","require":"./dist/cjs/index.node.js"},"import":"./dist/esm/index.js","require":"./dist/cjs/index.js","default":"./dist/cjs/index.js"},"./package.json":"./package.json"},"scripts":{"tsc":"rm -rf dist/ && tsc -p tsconfig.esm.json && tsc -p tsconfig.json","lint":"eslint --fix \\"./src/**/*.ts\\"","build":"npm run lint && npm run tsc && npm run build:mp","build:mp":"webpack --config ./webpack/webpack.miniprogram.js","precommit":"npm run lint"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloudbase-js-sdk"},"keywords":["cloudbase","tcb","javascript","web","sdk","serverless"],"author":"","license":"Apache-2.0","dependencies":{"@cloudbase/adapter-interface":"^0.7.1","@cloudbase/adapter-wx_mp":"^1.3.1","@cloudbase/types":"3.4.6","@cloudbase/utilities":"3.4.6"},"peerDependencies":{"@cloudbase/signature-nodejs":">=1.0.0","jsonwebtoken":">=8.0.0","ws":"^8.18.0"},"peerDependenciesMeta":{"@cloudbase/signature-nodejs":{"optional":true},"jsonwebtoken":{"optional":true},"ws":{"optional":true}},"gitHead":"859557576897d4778857c12fb8d7fe8ca1f3a052","private":true}')}},o={};!function e(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return r[t].call(i.exports,i,i.exports,e),i.exports}(130);
|
|
1
|
+
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";import*as n from"@cloudbase/adapter-wx_mp";var o={d:(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};o.d(r,{Z:()=>Mt});var i="@cloudbase/js-sdk";function a(){return i}var s="https:",c={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};const u=(l={AbstractSDKRequest:()=>t.AbstractSDKRequest,AbstractStorage:()=>t.AbstractStorage,StorageType:()=>t.StorageType},p={},o.d(p,l),p);var l,p;function f(t){return"[object FormData]"===Object.prototype.toString.call(t)}function d(t,e,n){void 0===n&&(n={});var o=/\?/.test(e),r="";return Object.keys(n).forEach((function(t){""===r?!o&&(e+="?"):r+="&",r+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=r)?e:"".concat(t).concat(e)}function h(t,e){console.warn("[".concat(a(),"][").concat(t,"]:").concat(e))}function v(t){var e={},n=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){t=n[1];var o=n[2];o&&(e=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var n=t.split("="),o=n[0],r=n[1];o=decodeURIComponent(o),r=decodeURIComponent(r),o&&(e[o]?Array.isArray(e[o])?e[o].push(r):e[o]=[e[o],r]:e[o]=r)})),e}(o))}var r=e.token,i=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(e,["token"]);return/^data:/.test(t)&&!r?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:r?{state:i.state,token:r,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}var y,g,b=(y=function(t,e){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},y(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),m=function(){return m=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},m.apply(this,arguments)},w=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},O=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},A=function(t){function e(e){var n=t.call(this)||this,o=e.timeout,r=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=o||0,n.timeoutMsg=r||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return b(e,t),e.prototype.get=function(t){return this.request(m(m({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(m(m({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(m(m({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,o=t.name,r=t.method,i=t.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==r?void 0:r.toLowerCase()]||"put",c=new FormData;return"post"===s?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",o),c.append("file",n),this.request(m(m({},t),{data:c,method:s}),this.restrictedMethods.includes("upload"))):this.request(m(m({},t),{method:"put",headers:a,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return w(this,void 0,Promise,(function(){var e,n,o,r;return O(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(m(m({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),o=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=n,r.setAttribute("download",o),r.style.display="none",document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return w(this,void 0,Promise,(function(){var n,o,r,i,a,s,c,u,l,p,f,d,h,v=this;return O(this,(function(y){switch(y.label){case 0:return n=new AbortController,o=t.url,r=t.enableAbort,i=void 0!==r&&r,a=t.stream,s=void 0!==a&&a,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,p=void 0===l||l,f=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",(function(){return n.abort()}))),d=null,i&&f&&(d=setTimeout((function(){console.warn(v.timeoutMsg),n.abort(new Error(v.timeoutMsg))}),f)),[4,fetch(o,m(m({},t),{signal:n.signal})).then((function(t){return w(v,void 0,void 0,(function(){var e,n,o;return O(this,(function(r){switch(r.label){case 0:return clearTimeout(d),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return o=(n=Promise).reject,[4,t.json()];case 2:e=o.apply(n,[r.sent()]),r.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(d),p)return Promise.reject(t)}))];case 1:return h=y.sent(),[2,{data:s?h.body:(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var o=String(t.method).toLowerCase()||"get";return new Promise((function(r){var i,a,c=t.url,u=t.headers,l=void 0===u?{}:u,p=t.data,h=t.responseType,v=t.withCredentials,y=t.body,g=t.onUploadProgress,b=d(s,c,"get"===o?p:{}),m=new XMLHttpRequest;m.open(o,b),h&&(m.responseType=h),Object.keys(l).forEach((function(t){m.setRequestHeader(t,l[t])})),g&&m.upload.addEventListener("progress",g),m.onreadystatechange=function(){var t={};if(4===m.readyState){var e=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),o=e.shift().toLowerCase(),r=e.join(": ");n[o]=r})),t.header=n,t.statusCode=m.status;try{t.data="blob"===h?m.response:JSON.parse(m.responseText)}catch(e){t.data="blob"===h?m.response:m.responseText}clearTimeout(i),r(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),m.abort()}),n.timeout)),a=f(p)?p:"application/x-www-form-urlencoded"===l["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}(p):y||(p?JSON.stringify(p):void 0),v&&(m.withCredentials=!0),m.send(a)}))},e}(u.AbstractSDKRequest),I=function(){return I=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},I.apply(this,arguments)};!function(t){t.WEB="web",t.WX_MP="wx_mp"}(g||(g={}));var E=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),P=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},S=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},_=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return E(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(u.AbstractStorage),C=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,o=void 0===n?{}:n,r=t.keys,i=void 0===r?{}:r;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(h(c.INVALID_PARAMS,"localStorage is not supported on current platform"),new _(e.root));case"none":return new _(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var o={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(o))}catch(t){throw new Error(JSON.stringify({code:c.OPERATION_FAIL,msg:"[".concat(a(),"][").concat(c.OPERATION_FAIL,"]setStore failed"),info:t}))}}else h(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return P(this,void 0,void 0,(function(){var o;return S(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),o={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(o))];case 2:return r.sent(),[3,4];case 3:return r.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(e)>=0?JSON.parse(o).content:""}h(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return P(this,void 0,void 0,(function(){var o;return S(this,(function(r){switch(r.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=r.sent())&&o.indexOf(e)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):h(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return P(this,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),x=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),j=function(t,e){this.data=e||null,this.name=t},R=function(t){function e(e,n){var o=t.call(this,"error",{error:e,data:n})||this;return o.error=e,o}return x(e,t),e}(j),k=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var o=n[t].indexOf(e);-1!==o&&n[t].splice(o,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof R)return console.error(t.error),this;var n="string"==typeof t?new j(t,e||{}):t,o=n.name;if(this.listens(o)){n.target=this;for(var r=0,i=this.listeners[o]?function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([],this.listeners[o],!0):[];r<i.length;r++)i[r].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new k;var T=new k,N="lang_change";"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const D=(t=>{var e={};return o.d(e,t),e})({default:()=>e.default});D.default;var L=function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},U=c,M={};function q(t,e){var n=e.name,o=e.namespace,r=e.entity,i=e.injectEvents,a=e.IIFE,s=void 0!==a&&a;if(M[n]||o&&t[o])throw new Error(JSON.stringify({code:U.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(s){if(!r||"function"!=typeof r)throw new Error(JSON.stringify({code:U.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));r.call(t)}if(M[n]=e,o?t.prototype[o]=r:W(t.prototype,r),i){var c=i.bus,u=i.events;if(!c||!u||0===u.length)return;var l=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=L(L([],t.prototype.events[n].events,!0),u,!0):t.prototype.events[n]={bus:c,events:u},t.prototype.fire=function(t,e){l(t,e);for(var n=0,o=Object.keys(this.events);n<o.length;n++){var r=o[n],i=this.events[r],a=i.bus;if(i.events.includes(t)){a.fire(t,e);break}}}}}function W(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,o=Object.keys(e);n<o.length;n++){var r=o[n];Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=W(t[r],e[r]))}return t}const V=(t=>{var e={};return o.d(e,t),e})({WxMpWebSocket:()=>n.WxMpWebSocket,WxRequest:()=>n.WxRequest,default:()=>n.default,parseQueryString:()=>n.parseQueryString,wxMpStorage:()=>n.wxMpStorage});var B=function(){return B=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},B.apply(this,arguments)},H={},F=function(){return F=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},F.apply(this,arguments)},K=C,J={},G={};function X(t){var e=t.env,n=t.platformInfo,o={userInfoKey:"".concat("user_info","_").concat(e)};J[e]=J[e]||new K(F(F({},t),{keys:o,platformInfo:n})),G[e]=G[e]||new K(F(F({},t),{keys:o,platformInfo:n,persistence:"local"}))}function Y(t){return G[t]}var Q=function(){return Q=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Q.apply(this,arguments)},$="",z="@cloudbase/js-sdk";function Z(){return $}var tt,et=[],nt=["env","endPointKey","region"],ot="https:";function rt(t){return et.find((function(e){return nt.filter((function(e){return null!=t[e]})).every((function(n){return e[n]===t[n]}))}))}function it(t){var e,n;t.protocol&&!/:$/.test(t.protocol)&&(t.protocol="".concat(t.protocol,":"));var o,r=rt(t);r?(null!=t.baseUrl&&(r.baseUrl=t.baseUrl),null!=t.protocol&&(r.protocol=t.protocol)):et.push(Q(Q({},t),{protocol:null!==(e=t.protocol)&&void 0!==e?e:ot})),"CLOUD_API"===t.endPointKey&&(o=null!==(n=t.protocol)&&void 0!==n?n:ot,s=o)}function at(t,e,n){return rt({env:t,endPointKey:e,region:n})}function st(t,e){void 0===e&&(e="CLOUD_API");var n=at(t,e||"CLOUD_API"),o=n.protocol,r=n.baseUrl;return"".concat(o).concat(r).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(tt||(tt={}));var ct=function(){return ct=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},ct.apply(this,arguments)},ut=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},lt=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},pt=c,ft=f,dt=d,ht=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function vt(t,e,n){var o=t[e];t[e]=function(e){var r={},i={};n.forEach((function(n){var o=n.call(t,e),a=o.data,s=o.headers;Object.assign(r,a),Object.assign(i,s)}));var a=e.data;return a&&(ft(a)?Object.keys(r).forEach((function(t){a.append(t,r[t])})):e.data=ct(ct({},a),r)),e.headers=ct(ct({},e.headers||{}),i),o.call(t,e)}}function yt(){var t=Math.random().toString(16).slice(2);return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(Z()),"x-seqid":t}}}var gt,bt,mt=function(){function t(t){var e=this;this.throwWhenRequestFail=!1,this.config=t;var n={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"],auth:t.auth};this.reqClass=new H.adapter.reqClass(n),this.throwWhenRequestFail=t.throw||!1,this.localCache=Y(this.config.env),"GATEWAY"!==this.config.endPointMode&&(vt(this.reqClass,"post",[yt]),vt(this.reqClass,"upload",[yt]),vt(this.reqClass,"download",[yt])),T.on(N,(function(t){var n;e.config.i18n=(null===(n=t.data)||void 0===n?void 0:n.i18n)||e.config.i18n}))}return t.prototype.getAccessToken=function(t){return void 0===t&&(t=null),ut(this,void 0,void 0,(function(){var e,n,o;return lt(this,(function(r){switch(r.label){case 0:if(null!=t)return[2,t];if(!(e=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return n=e.oauthInstance,o=n.oauth2client,[4,this.getOauthAccessTokenV2(o)];case 1:return[2,r.sent().accessToken]}}))}))},t.prototype.getDefaultHeaders=function(){var t,e,n;return(t={})[null===(e=this.config.i18n)||void 0===e?void 0:e.LANG_HEADER_KEY]=null===(n=this.config.i18n)||void 0===n?void 0:n.lang,t["X-SDK-Version"]="@cloudbase/js-sdk/".concat(Z()),t},t.prototype.post=function(t,e){return ut(this,void 0,Promise,(function(){return lt(this,(function(n){switch(n.label){case 0:return[4,this.reqClass.post(ct(ct({},t),{headers:ct(ct({},t.headers),this.getDefaultHeaders()),customReqOpts:e}))];case 1:return[2,n.sent()]}}))}))},t.prototype.upload=function(t){return ut(this,void 0,Promise,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.upload(ct(ct({},t),{headers:ct(ct({},t.headers),this.getDefaultHeaders())}))];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return ut(this,void 0,Promise,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.download(ct(ct({},t),{headers:ct(ct({},t.headers),this.getDefaultHeaders())}))];case 1:return[2,e.sent()]}}))}))},t.prototype.getBaseEndPoint=function(t){return void 0===t&&(t="CLOUD_API"),st(this.config.env,t)},t.prototype.getOauthAccessTokenV2=function(t){return ut(this,void 0,Promise,(function(){var e,n;return lt(this,(function(o){switch(o.label){case 0:return[4,t.getAccessToken()];case 1:return e=o.sent(),[4,t.getCredentials()];case 2:return n=o.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},t.prototype.request=function(t,e,n,o){var r,i;return ut(this,void 0,Promise,(function(){var a,s,c,u,l,p,f,d,h,v,y,g,b,m,w,O,A,I,E,P,S,_,C;return lt(this,(function(x){switch(x.label){case 0:if(x.trys.push([0,4,,5]),a="x-tcb-trace_".concat(this.config.env),s="application/x-www-form-urlencoded",c=ct({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==ht.indexOf(t))return[3,2];if(!(u=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return l=u.oauthInstance,p=l.oauth2client,f=c,[4,this.getOauthAccessTokenV2(p)];case 1:f.access_token=x.sent().accessToken,x.label=2;case 2:return"storage.uploadFile"===t?(d=new FormData,Object.keys(d).forEach((function(t){Object.prototype.hasOwnProperty.call(d,t)&&void 0!==d[t]&&d.append(t,c[t])})),s="multipart/form-data"):(s="application/json;charset=UTF-8",d={},Object.keys(c).forEach((function(t){void 0!==c[t]&&(d[t]=c[t])}))),h={headers:ct(ct({"content-type":s},this.getDefaultHeaders()),null==n?void 0:n.headers)},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(v=this.localCache.getStore(a))&&(h.headers["X-TCB-Trace"]=v),y=void 0!==(null==n?void 0:n.parse)?n.parse:e.parse,g=void 0!==(null==n?void 0:n.inQuery)?n.inQuery:e.inQuery,b=void 0!==(null==n?void 0:n.search)?n.search:e.search,m=ct(ct({},(null==n?void 0:n.defaultQuery)||{}),{env:this.config.env}),y&&(m.parse=!0),g&&(m=ct(ct({},g),m)),w=(null==n?void 0:n.endPointMode)||this.config.endPointMode||"CLOUD_API",O=at(this.config.env,w),A=O.baseUrl,I=O.protocol,"GATEWAY"===w&&/^((database)\.)|(auth\.wsWebSign)/.test(t)&&(E=at(this.config.env,"CLOUD_API"),A="".concat(E.baseUrl.match(/\/\/([^/?#]*)/)[0],"/web")),P=void 0,P=n.pathname?dt(I,"".concat(null===(r=st(this.config.env,w))||void 0===r?void 0:r.replace(/^https?:/,""),"/").concat(n.pathname),m):dt(I,A,m),b&&(P+=b),[4,this.post(ct({url:P,data:d},h),o)];case 3:if(S=x.sent(),(_=null===(i=S.header)||void 0===i?void 0:i["x-tcb-trace"])&&this.localCache.setStore(a,_),200!==Number(S.status)&&200!==Number(S.statusCode)||!S.data)throw new Error("network request error");return[2,S];case 4:C=x.sent();try{C.requestId=C.requestId||(null==n?void 0:n.headers["x-request-id"])||(null==n?void 0:n.headers["X-Request-Id"])||""}catch(t){}throw C;case 5:return[2]}}))}))},t.prototype.fetch=function(t){var e,n,o,r,i,a,s,c;return ut(this,void 0,Promise,(function(){var u,l,p,f,d,h,v,y,g=this;return lt(this,(function(b){switch(b.label){case 0:u=t.token,l=t.headers,p=void 0===l?{}:l,f=t.withCredentials,d=void 0===f||f,h=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(t,["token","headers","withCredentials"]),v=function(){return ut(g,void 0,void 0,(function(){var t,e,n;return lt(this,(function(o){switch(o.label){case 0:return t={},d?(e=t,n="Bearer ".concat,[4,this.getAccessToken(u)]):[3,2];case 1:e.Authorization=n.apply("Bearer ",[o.sent()]),o.label=2;case 2:return[2,this.reqClass.fetch(ct({headers:ct(ct(ct({"X-SDK-Version":"@cloudbase/js-sdk/".concat(Z())},t),this.getDefaultHeaders()),p)},h))]}}))}))},b.label=1;case 1:return b.trys.push([1,3,,6]),[4,v()];case 2:return[2,b.sent()];case 3:y=b.sent();try{y.requestId=y.requestId||p["x-request-id"]||p["X-Request-Id"]||""}catch(t){}if("ACCESS_TOKEN_EXPIRED"!==(null==y?void 0:y.code))return[3,5];if("function"!=typeof(null===(r=null===(o=null===(n=null===(e=this.config)||void 0===e?void 0:e._fromApp)||void 0===n?void 0:n.oauthInstance)||void 0===o?void 0:o.authApi)||void 0===r?void 0:r.refreshTokenForce))throw y;return[4,null===(c=null===(s=null===(a=null===(i=this.config)||void 0===i?void 0:i._fromApp)||void 0===a?void 0:a.oauthInstance)||void 0===s?void 0:s.authApi)||void 0===c?void 0:c.refreshTokenForce()];case 4:return b.sent(),[2,v()];case 5:throw y;case 6:return[2]}}))}))},t.prototype.send=function(t,e,n,o){return void 0===e&&(e={}),void 0===n&&(n={}),ut(this,void 0,Promise,(function(){var r;return lt(this,(function(i){switch(i.label){case 0:return[4,this.request(t,e,ct(ct({},n),{onUploadProgress:e.onUploadProgress}),o)];case 1:if((r=i.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:pt.OPERATION_FAIL,msg:"[".concat(r.data.code,"] ").concat(r.data.message)}));return[2,r.data]}}))}))},t.prototype.gateWay=function(t,e){var n;return ut(this,void 0,void 0,(function(){var o,r,i,a,s,c,u,l,p,f,d,h,v,y,g,b,m,w,O;return lt(this,(function(A){switch(A.label){case 0:if(o=t.url,r=t.name,i=t.data,a=t.path,s=void 0===a?"":a,c=t.method,u=t.header,l=void 0===u?{}:u,!(r&&s||o))throw new Error(JSON.stringify({code:pt.INVALID_PARAMS,msg:"[gateWay] invalid function name or path or url"}));try{p=i?JSON.stringify(i):""}catch(t){throw new Error(JSON.stringify({code:pt.INVALID_PARAMS,msg:"[gateWay] invalid data"}))}if(I=(new Date).getTime(),E=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0,f="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random();return I>0?(e=(I+e)%16|0,I=Math.floor(I/16)):(e=(E+e)%16|0,E=Math.floor(E/16)),("x"===t?e:7&e|8).toString(16)})),d=at(this.config.env,"GATEWAY"),h=d.baseUrl,v=d.protocol,y="".concat(v).concat(h).concat(o||"/".concat(s,"/").concat(r)),g=["GET","HEAD"].includes(null===(n=null==c?void 0:c.toUpperCase)||void 0===n?void 0:n.call(c)))try{b={};try{b=JSON.parse(i)}catch(t){b=i||{}}y="".concat(y).concat(y.includes("?")?"&":"?").concat(Object.keys(b).map((function(t){return"".concat(t,"=").concat(b[t])})).join("&"))}catch(t){}return[4,this.fetch(ct(ct({method:c||"POST",headers:ct({"Content-Type":"application/json; charset=utf-8","X-Request-Id":f},l)},g?{}:{body:p}),{url:y,customReqOpts:e}))];case 1:return m=A.sent(),w=[ct({requestId:f},m)],O={},[4,m.data];case 2:return[2,ct.apply(void 0,w.concat([(O.data=A.sent(),O)]))]}var I,E}))}))},t}(),wt={};!function(t){t.ZH="zh-CN",t.EN="en-US"}(bt||(bt={}));var Ot=((gt={})[bt.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code",错误信息:"error message",未实现:"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs",请求超时:"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},gt),At=function(t,e){var n;return(null===(n=Ot[e])||void 0===n?void 0:n[t])||t},It=function(t,e){var n,o,r=function(t){return"lang_".concat(t.clientId||t.env)}(e),i=(t.adapter||{}).localStorage,a=e.lang||(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||bt.ZH;return null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,a),new Proxy({t:function(t){return At(t,a)},LANG_HEADER_KEY:"Accept-Language",lang:a},{get:function(t,e){var n;return"lang"===e&&(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||t[e]},set:function(t,e,n){var o;return"lang"===e&&n!==t[e]&&(t[e]=n,t.t=function(t){return At(t,n)},null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,n),T.fire(N,{i18n:t})),t[e]=n,!0}})},Et=function(){return Et=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Et.apply(this,arguments)},Pt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},St=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_t=function(){return{adapter:I({},{type:"default",root:window,reqClass:A,wsClass:WebSocket,localStorage}),runtime:g.WEB}},Ct=c,xt="https://support.qq.com/products/148793",jt=h,Rt=function(t){return t.mode,t.customInfo,t.title,t.messages,function(t,e,n){}},kt={timeout:15e3,persistence:"local"},Tt=6e5,Nt={},Dt=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=Z()}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return H},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,J[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return Y(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this.cloudbaseConfig.env,wt[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){var n,o,r;if(void 0===e&&(e={env:""}),e.endPointMode=e.endPointMode||"GATEWAY",H.adapter||this.useDefaultAdapter(),!(e=this.dealNodeAdapterConfig(e)).env)throw new Error(JSON.stringify({code:Ct.INVALID_PARAMS,msg:"env must not be specified"}));this.isInitialized(e);var i={timeout:e.timeout||15e3,timeoutMsg:"[".concat(z,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(e.timeout/1e3,"s"),auth:e.auth};this.requestClient=new H.adapter.reqClass(i),this.cloudbaseConfig=Et(Et(Et({},kt),e),{i18n:It(H,e)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var a=this.cloudbaseConfig,s=a.env,c=a.persistence,u=a.debug,l=a.timeout,p=a.oauthClient,f=a.i18n;X({env:s,persistence:c,debug:u,platformInfo:this.platform}),function(t,e){it({env:t,region:e,baseUrl:"//".concat(t,".").concat(e||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(s,e.region||""),function(t,e,n){var o="//".concat(t,".api.tcloudbasegateway.com/v1");n&&(o="//".concat(t,".api.intl.tcloudbasegateway.com/v1")),it({endPointKey:"GATEWAY",env:t,baseUrl:o,protocol:e})}(s,ot,e.intl);var d=new t(this.cloudbaseConfig);return function(t){wt[t.env]=new mt(ct(ct({},t),{throw:!0}))}({env:s,region:e.region||"",timeout:l,oauthClient:p,_fromApp:d,i18n:f,endPointMode:e.endPointMode,auth:e.auth}),d.requestClient=this.requestClient,null===(n=null==this?void 0:this.fire)||void 0===n||n.call(this,"cloudbase_init",d),this.try2InitAuth(d),(null===(o=H.adapter)||void 0===o?void 0:o.nodeTool)&&(null===(r=H.adapter)||void 0===r||r.nodeTool(d,this.cloudbaseConfig)),d},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,X({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.updateLang=function(t){var e;t&&t!==(null===(e=this.cloudbaseConfig.i18n)||void 0===e?void 0:e.lang)&&(this.cloudbaseConfig.i18n.lang=t)},t.prototype.registerExtension=function(t){Nt[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,o=void 0,i=function(){var n;return function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(o){switch(o.label){case 0:if(!(n=Nt[t]))throw new Error(JSON.stringify({code:Ct.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,o.sent()]}}))},new((r=void 0)||(r=Promise))((function(t,e){function a(t){try{c(i.next(t))}catch(t){e(t)}}function s(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,s)}c((i=i.apply(n,o||[])).next())}));var n,o,r,i},t.prototype.useAdapters=function(t,e){var n=function(t,e){for(var n,o=0,r=(n=t,"[object Array]"===Object.prototype.toString.call(n)?t:[t]);o<r.length;o++){var i=r[o],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:I({isMatch:a},s(e)),runtime:c}}}(t,e)||{},o=n.adapter,r=n.runtime;o&&(H.adapter=o),r&&(H.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,o=e.target;if(Object.prototype.hasOwnProperty.call(t,o))throw new Error(JSON.stringify({code:U.INVALID_OPERATION,msg:"target:".concat(o," is not exist")}));var r=t.prototype[o];if("function"!=typeof r)throw new Error(JSON.stringify({code:U.INVALID_OPERATION,msg:"target:".concat(o," is not a function which is the only type supports hook")}));t.prototype[o]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,L([this],t,!1)),r.call.apply(r,L([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){q(t,e)},t.prototype.registerVersion=function(t){!function(t){$=t}(t),this.version=t},t.prototype.registerSdkName=function(t){!function(t){z=t,function(t){i=t}(t)}(t)},t.prototype.isInitialized=function(t){return void 0===t&&(t=this.cloudbaseConfig),["your-env-id","your-envid","your_env_id","xxx-yyy","xxxx-yyy","envId","env-id","your-environment-id","REPLACE_ME"].some((function(e){return t.env.toLowerCase()===e.toLowerCase()}))&&jt(Ct.INVALID_PARAMS,'[CloudBase] 检测到环境 ID "'.concat(t.env,'" 可能是占位符,请替换为真实的环境 ID。\n')+" 获取方式:登录腾讯云开发平台 → 环境管理 → 环境设置 → 环境 ID\n 建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV"),!!(null==t?void 0:t.env)},t.prototype.registerEndPoint=function(t,e){it({baseUrl:t,protocol:e,env:this.config.env,endPointKey:"CLOUD_API"})},t.prototype.registerEndPointWithKey=function(t){it({env:this.config.env,endPointKey:t.key,baseUrl:t.url,protocol:t.protocol})},t.prototype.getEndPointWithKey=function(t){var e=at(this.config.env,t);return{BASE_URL:e.baseUrl,PROTOCOL:e.protocol}},t.prototype.parseCaptcha=function(t){return v(t)},t.prototype.useDefaultAdapter=function(){var t=_t.bind(this)(),e=t.adapter,n=t.runtime;H.adapter=e,H.runtime=n},t.prototype.formatTimeout=function(t){switch(!0){case t>Tt:return jt(Ct.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),Tt;case t<100:return jt(Ct.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},t.prototype.try2InitAuth=function(t){try{t.auth()}catch(t){console.log("try2InitAuth error:",t)}},t.prototype.dealNodeAdapterConfig=function(t){return t},Pt([Rt({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(xt)]}),St("design:type",Function),St("design:paramtypes",[Object]),St("design:returntype",t)],t.prototype,"init",null),Pt([Rt({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(xt)]}),St("design:type",Function),St("design:paramtypes",[String,Object]),St("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),Lt=new Dt;Lt.useAdapters((V.WxRequest.prototype.upload=function(t){var e=this,n=this;return new Promise((function(o){var r=t.url,i=t.file,a=t.data,s=t.headers,c=wx.getFileSystemManager(),u=wx.request({url:r,method:t.method,header:B({"content-type":" "},s),data:c.readFileSync(i),timeout:e._timeout,success:function(t){var e={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&(null==a?void 0:a.success_action_status)&&(e.statusCode=parseInt(a.success_action_status,10)),o(e)},fail:function(t){o(t)},complete:function(t){if((null==t?void 0:t.errMsg)&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{u.abort()}catch(t){}}}})}))},V.default.genAdapter=function(t){return{root:{globalThis:{}},reqClass:V.WxRequest,wsClass:V.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(e){var n=t.EventBus,o={},r=e;console.log("openURIWithCallback",e);var i=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){r=i[1],console.log("openURIWithCallback url",r);var a=i[2];a&&(o=(0,V.parseQueryString)(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,c=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(o,["token"]);return/^data:/.test(r)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(e)}):s?new Promise((function(t){console.log("wait for captcha..."),n.$emit("CAPTCHA_DATA_CHANGE",B(B({},c),{token:s,url:r})),n.$once("RESOLVE_CAPTCHA_DATA",(function(e){t(e)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:V.wxMpStorage,primaryStorage:u.StorageType.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},V.default));const Ut=Lt;Ut.registerVersion("3.4.6");try{window.cloudbase=Ut}catch(t){}const Mt=Ut;var qt=r.Z;export{qt as default};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|