@agconnect/instance
Advanced tools
Comparing version 1.3.1-beta to 1.3.1
@@ -8,9 +8,2 @@ import { AGCInstance } from '@agconnect/instance-types'; | ||
export { RequestConstructor } from "./src/server/RequestConstructor"; | ||
export declare const enum AGCRoutePolicy { | ||
UNKNOWN = 0, | ||
CHINA = 1, | ||
GERMANY = 2, | ||
RUSSIA = 3, | ||
SINGAPORE = 4 | ||
} | ||
import { AGCApi } from '@agconnect/api-types'; | ||
@@ -17,0 +10,0 @@ declare module '@agconnect/api-types' { |
@@ -15,2 +15,2 @@ import t from"@agconnect/api";import{DEFAULT_CATEGORY as e,InstanceMap as o}from"@agconnect/core";import{Logger as r}from"@agconnect/log"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)};var i=function(t){function e(o,r,n){var i=this,s=o.code+e.COLON+o.message;return n&&(s=n+e.DASH+s),r&&r.message&&(s=s+e.COMMA+r.message),(i=t.call(this,s)||this).__proto__=e.prototype,i.code=o.code,i.message=o.message,r&&r.message&&(i.message=o.message+e.COMMA+r.message),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,t),e.COLON=": ",e.COMMA=", ",e.DASH="-",e}(Error),s=function(){function t(){}return t.AGC_INNER_ERROR={code:1e4,message:"agc inner error"},t.NETWORK_REQUEST_ERROR={code:10001,message:"agc network request error"},t.GET_AAID_ERROR={code:10002,message:"agc get aaid error"},t.ABTEST_LOAD_EXPERIMENTS_ERROR={code:10003,message:"abtest load experiments error"},t.ABTEST_SAVE_EXPERIMENTS_ERROR={code:10004,message:"abtest save experiments error"},t.ABTEST_REPLACE_EXPERIMENTS_ERROR={code:10005,message:"abtest repalce experiments error"},t.FAIL_TO_GET_STORAGE_SERVICE={code:10006,message:"get agcStorage service failed"},t.FAIL_TO_GET_NETWORK_SERVICE={code:10007,message:"get agcNetwork service failed"},t.REMOVE_TOKEN_FAILED={code:10008,message:"remove client token faild"},t.GET_TOKEN_FAILED={code:10009,message:"get client token faild"},t.AGC_INIT_ERROR={code:10010,message:"AGCInstance init error"},t.FAIL_TO_GET_CRIDENTIAL_SERVICE={code:10011,message:"get agcCredential service failed"},t.WEBSOCKET_NOT_SUPPORT={code:10012,message:"websocket is not support"},t.WEBSOCKET_ERROR={code:10013,message:"websocket error"},t}(),c=r.createLogger("agconnectInstance"),p=function(){function t(t,o){this.appVersion="",this._config=null,this._customCredentialsProvider=null,this._customAuthProvider=null,this.cryptImpl=void 0,this.option=null,this.fetch=void 0,this.storage=void 0,this.app=void 0,this.configuration=void 0,this.webSocket=void 0,this.repo_=t,this.name_=o||e}return t.prototype.name=function(){return this.name_},t.prototype.configInstance=function(t){return this._config=t,this},t.prototype.config=function(){return this.checkBeforeSetKey(),this._config},t.prototype.setApiKey=function(t){this.checkBeforeSetKey(),this._config.client.api_key=t},t.prototype.setClientSecret=function(t){this.checkBeforeSetKey(),this._config.client.client_secret=t},t.prototype.setClientId=function(t){this.checkBeforeSetKey(),this._config.client.client_id=t},t.prototype.getService=function(t){return this.repo_.getService(t,this,this.name_)},t.prototype.setCustomCredentialsProvider=function(t){return t?t.getToken?1!=t.getToken.length?(c.error("the customCredentialsProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customCredentialsProvider=t,!0):(c.error("the customCredentialsProvider must contain getToken method."),!1):(this._customCredentialsProvider=t,!0)},t.prototype.setCustomAuthProvider=function(t){return t?t.getToken?1!=t.getToken.length?(c.error("the customAuthProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customAuthProvider=t,!0):(c.error("the customAuthProvider must contain getToken method."),!1):(this._customAuthProvider=t,!0)},t.prototype.getCustomCredentialsProvider=function(){return this._customCredentialsProvider},t.prototype.getCustomAuthProvider=function(){return this._customAuthProvider},t.prototype.setCryptImp=function(t){return t?t.decrypt&&t.decrypt instanceof Function&&t.encrypt&&t.encrypt instanceof Function?(this.cryptImpl=t,!0):(c.error("the crypt is not exist necessary methods."),!1):(c.error("the crypt is not available."),!1)},t.prototype.setAppVersion=function(t){this.appVersion=t},t.prototype.setOption=function(t){this.option=t},t.prototype.addHttpToUrl=function(t){return t&&!t.startsWith("https://")?"https://"+t:t},t.prototype.getGwUrl=function(){return null!=this.option?this.option.routePolicy==Number(1)?this.addHttpToUrl(this._config.agcgw_all.CN):this.option.routePolicy==Number(2)?this.addHttpToUrl(this._config.agcgw_all.DE):this.option.routePolicy==Number(3)?this.addHttpToUrl(this._config.agcgw_all.RU):this.option.routePolicy==Number(4)?this.addHttpToUrl(this._config.agcgw_all.SG):this.addHttpToUrl(this._config.agcgw.url):this.addHttpToUrl(this._config.agcgw.url)},t.prototype.getGwBackUrl=function(){return null!=this.option?1==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.CN_back):2==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.DE_back):3==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.RU_back):4==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.SG_back):this.addHttpToUrl(this._config.agcgw.backurl):this.addHttpToUrl(this._config.agcgw.backurl)},t.prototype.getAppVersion=function(){return this.appVersion},t.prototype.getCryptImp=function(){return this.cryptImpl},t.prototype.checkBeforeSetKey=function(){if(null==this._config)throw new i(s.AGC_INIT_ERROR,{message:"AGCInstance not configurated. call agconnect.instance().configInstance() to configure the agconnect."},"instance");if(!this._config.agcgw||!this._config.client)throw new i(s.AGC_INIT_ERROR,{message:"AGCInstance config is invalid."},"instance")},t.prototype.setFetch=function(t){this.fetch=t},t.prototype.getFetch=function(){return this.fetch},t.prototype.setStorage=function(t){this.storage=t},t.prototype.getStorage=function(){return this.storage},t.prototype.setApp=function(t){this.app=t},t.prototype.getApp=function(){return this.app},t.prototype.setConfiguration=function(t){this.configuration=t},t.prototype.getConfiguration=function(){return this.configuration},t.prototype.setwebSocket=function(t){this.webSocket=t},t.prototype.getwebSocket=function(){return this.webSocket},t}(),a=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=""),this.code=t,this.msg=e}return t.prototype.getCode=function(){return this.code},t.prototype.setCode=function(t){this.code=t},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t}(),u=function(){function t(){this.ret=new a}return t.prototype.isSuccess=function(){return null!=this.ret&&0==this.ret.getCode()},t.prototype.getRet=function(){return this.ret},t.prototype.setRet=function(t){this.ret=t},t.prototype.constructResponse=function(t){},t}(),g=new o((function(e){return new p(t,e[0])}));t.registerApiProvider("instance",(function(t){return g.get(t)}));export{i as AGCError,s as AGCErrorCode,u as BaseResponse,a as ConnectRet}; | ||
***************************************************************************** */var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)};var i,s,c=function(t){function e(o,r,n){var i=this,s=o.code+e.COLON+o.message;return n&&(s=n+e.DASH+s),r&&(r.message?s=s+e.COMMA+r.message:"string"==typeof r&&(s=s+e.COMMA+r)),(i=t.call(this,s)||this).__proto__=e.prototype,i.code=o.code,i.message=o.message,r&&(r.message?i.message=o.message+e.COMMA+r.message:"string"==typeof r&&(i.message=o.message+e.COMMA+r)),i.msg=i.message,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,t),e.COLON=": ",e.COMMA=", ",e.DASH="-",e}(Error),a=function(){function t(){}return t.AGC_INNER_ERROR={code:1e4,message:"agc inner error"},t.NETWORK_REQUEST_ERROR={code:10001,message:"agc network request error"},t.GET_AAID_ERROR={code:10002,message:"agc get aaid error"},t.ABTEST_LOAD_EXPERIMENTS_ERROR={code:10003,message:"abtest load experiments error"},t.ABTEST_SAVE_EXPERIMENTS_ERROR={code:10004,message:"abtest save experiments error"},t.ABTEST_REPLACE_EXPERIMENTS_ERROR={code:10005,message:"abtest repalce experiments error"},t.FAIL_TO_GET_STORAGE_SERVICE={code:10006,message:"get agcStorage service failed"},t.FAIL_TO_GET_NETWORK_SERVICE={code:10007,message:"get agcNetwork service failed"},t.REMOVE_TOKEN_FAILED={code:10008,message:"remove client token faild"},t.GET_TOKEN_FAILED={code:10009,message:"get client token faild"},t.AGC_INIT_ERROR={code:10010,message:"AGCInstance init error"},t.FAIL_TO_GET_CRIDENTIAL_SERVICE={code:10011,message:"get agcCredential service failed"},t.WEBSOCKET_NOT_SUPPORT={code:10012,message:"websocket is not support"},t.WEBSOCKET_ERROR={code:10013,message:"websocket error"},t}(),p=r.createLogger("agconnectInstance"),u=function(){function t(t,o){this.appVersion="",this._config=null,this._customCredentialsProvider=null,this._customAuthProvider=null,this.cryptImpl=void 0,this.option=null,this.repo_=t,this.name_=o||e}return t.prototype.name=function(){return this.name_},t.prototype.configInstance=function(t){return this._config=t,this},t.prototype.config=function(){return this.checkBeforeSetKey(),this._config},t.prototype.setApiKey=function(t){this.checkBeforeSetKey(),this._config.client.api_key=t},t.prototype.setClientSecret=function(t){this.checkBeforeSetKey(),this._config.client.client_secret=t},t.prototype.setClientId=function(t){this.checkBeforeSetKey(),this._config.client.client_id=t},t.prototype.getService=function(t){return this.repo_.getService(t,this,this.name_)},t.prototype.setCustomCredentialsProvider=function(t){return t?t.getToken?1!=t.getToken.length?(p.error("the customCredentialsProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customCredentialsProvider=t,!0):(p.error("the customCredentialsProvider must contain getToken method."),!1):(this._customCredentialsProvider=t,!0)},t.prototype.setCustomAuthProvider=function(t){return t?t.getToken?1!=t.getToken.length?(p.error("the customAuthProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customAuthProvider=t,!0):(p.error("the customAuthProvider must contain getToken method."),!1):(this._customAuthProvider=t,!0)},t.prototype.getCustomCredentialsProvider=function(){return this._customCredentialsProvider},t.prototype.getCustomAuthProvider=function(){return this._customAuthProvider},t.prototype.setCryptImp=function(t){return t?t.decrypt&&t.decrypt instanceof Function&&t.encrypt&&t.encrypt instanceof Function?(this.cryptImpl=t,!0):(p.error("the crypt is not exist necessary methods."),!1):(p.error("the crypt is not available."),!1)},t.prototype.setAppVersion=function(t){this.appVersion=t},t.prototype.setOption=function(t){this.option=t},t.prototype.addHttpToUrl=function(t){return t&&!t.startsWith("https://")?"https://"+t:t},t.prototype.getGwUrl=function(){return null!=this.option?this.option.routePolicy==Number(1)?this.addHttpToUrl(this._config.agcgw_all.CN):this.option.routePolicy==Number(2)?this.addHttpToUrl(this._config.agcgw_all.DE):this.option.routePolicy==Number(3)?this.addHttpToUrl(this._config.agcgw_all.RU):this.option.routePolicy==Number(4)?this.addHttpToUrl(this._config.agcgw_all.SG):this.addHttpToUrl(this._config.agcgw.url):this.addHttpToUrl(this._config.agcgw.url)},t.prototype.getGwBackUrl=function(){return null!=this.option?1==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.CN_back):2==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.DE_back):3==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.RU_back):4==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.SG_back):this.addHttpToUrl(this._config.agcgw.backurl):this.addHttpToUrl(this._config.agcgw.backurl)},t.prototype.getAppVersion=function(){return this.appVersion},t.prototype.getCryptImp=function(){return this.cryptImpl},t.prototype.checkBeforeSetKey=function(){if(null==this._config)throw new c(a.AGC_INIT_ERROR,{message:"AGCInstance not configurated. call agconnect.instance().configInstance() to configure the agconnect."},"instance");if(!this._config.agcgw||!this._config.client)throw new c(a.AGC_INIT_ERROR,{message:"AGCInstance config is invalid."},"instance")},t}(),g=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=""),this.code=t,this.msg=e}return t.prototype.getCode=function(){return this.code},t.prototype.setCode=function(t){this.code=t},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t}(),h=function(){function t(){this.ret=new g}return t.prototype.isSuccess=function(){return null!=this.ret&&0==this.ret.getCode()},t.prototype.getRet=function(){return this.ret},t.prototype.setRet=function(t){this.ret=t},t.prototype.constructResponse=function(t){},t}(),l=new o((function(e){return new u(t,e[0])}));!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.CHINA=1]="CHINA",t[t.GERMANY=2]="GERMANY",t[t.RUSSIA=3]="RUSSIA",t[t.SINGAPORE=4]="SINGAPORE"}(i||(i={})),s={AGCRoutePolicy:i},t.registerApiProvider("instance",(function(t){return l.get(t)}),s);export{c as AGCError,a as AGCErrorCode,h as BaseResponse,g as ConnectRet}; |
@@ -15,2 +15,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@agconnect/api"),e=require("@agconnect/core"),o=require("@agconnect/log");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(t),i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)}; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var s=function(t){function e(o,r,n){var i=this,s=o.code+e.COLON+o.message;return n&&(s=n+e.DASH+s),r&&r.message&&(s=s+e.COMMA+r.message),(i=t.call(this,s)||this).__proto__=e.prototype,i.code=o.code,i.message=o.message,r&&r.message&&(i.message=o.message+e.COMMA+r.message),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,t),e.COLON=": ",e.COMMA=", ",e.DASH="-",e}(Error),c=function(){function t(){}return t.AGC_INNER_ERROR={code:1e4,message:"agc inner error"},t.NETWORK_REQUEST_ERROR={code:10001,message:"agc network request error"},t.GET_AAID_ERROR={code:10002,message:"agc get aaid error"},t.ABTEST_LOAD_EXPERIMENTS_ERROR={code:10003,message:"abtest load experiments error"},t.ABTEST_SAVE_EXPERIMENTS_ERROR={code:10004,message:"abtest save experiments error"},t.ABTEST_REPLACE_EXPERIMENTS_ERROR={code:10005,message:"abtest repalce experiments error"},t.FAIL_TO_GET_STORAGE_SERVICE={code:10006,message:"get agcStorage service failed"},t.FAIL_TO_GET_NETWORK_SERVICE={code:10007,message:"get agcNetwork service failed"},t.REMOVE_TOKEN_FAILED={code:10008,message:"remove client token faild"},t.GET_TOKEN_FAILED={code:10009,message:"get client token faild"},t.AGC_INIT_ERROR={code:10010,message:"AGCInstance init error"},t.FAIL_TO_GET_CRIDENTIAL_SERVICE={code:10011,message:"get agcCredential service failed"},t.WEBSOCKET_NOT_SUPPORT={code:10012,message:"websocket is not support"},t.WEBSOCKET_ERROR={code:10013,message:"websocket error"},t}(),p=o.Logger.createLogger("agconnectInstance"),a=function(){function t(t,o){this.appVersion="",this._config=null,this._customCredentialsProvider=null,this._customAuthProvider=null,this.cryptImpl=void 0,this.option=null,this.fetch=void 0,this.storage=void 0,this.app=void 0,this.configuration=void 0,this.webSocket=void 0,this.repo_=t,this.name_=o||e.DEFAULT_CATEGORY}return t.prototype.name=function(){return this.name_},t.prototype.configInstance=function(t){return this._config=t,this},t.prototype.config=function(){return this.checkBeforeSetKey(),this._config},t.prototype.setApiKey=function(t){this.checkBeforeSetKey(),this._config.client.api_key=t},t.prototype.setClientSecret=function(t){this.checkBeforeSetKey(),this._config.client.client_secret=t},t.prototype.setClientId=function(t){this.checkBeforeSetKey(),this._config.client.client_id=t},t.prototype.getService=function(t){return this.repo_.getService(t,this,this.name_)},t.prototype.setCustomCredentialsProvider=function(t){return t?t.getToken?1!=t.getToken.length?(p.error("the customCredentialsProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customCredentialsProvider=t,!0):(p.error("the customCredentialsProvider must contain getToken method."),!1):(this._customCredentialsProvider=t,!0)},t.prototype.setCustomAuthProvider=function(t){return t?t.getToken?1!=t.getToken.length?(p.error("the customAuthProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customAuthProvider=t,!0):(p.error("the customAuthProvider must contain getToken method."),!1):(this._customAuthProvider=t,!0)},t.prototype.getCustomCredentialsProvider=function(){return this._customCredentialsProvider},t.prototype.getCustomAuthProvider=function(){return this._customAuthProvider},t.prototype.setCryptImp=function(t){return t?t.decrypt&&t.decrypt instanceof Function&&t.encrypt&&t.encrypt instanceof Function?(this.cryptImpl=t,!0):(p.error("the crypt is not exist necessary methods."),!1):(p.error("the crypt is not available."),!1)},t.prototype.setAppVersion=function(t){this.appVersion=t},t.prototype.setOption=function(t){this.option=t},t.prototype.addHttpToUrl=function(t){return t&&!t.startsWith("https://")?"https://"+t:t},t.prototype.getGwUrl=function(){return null!=this.option?this.option.routePolicy==Number(1)?this.addHttpToUrl(this._config.agcgw_all.CN):this.option.routePolicy==Number(2)?this.addHttpToUrl(this._config.agcgw_all.DE):this.option.routePolicy==Number(3)?this.addHttpToUrl(this._config.agcgw_all.RU):this.option.routePolicy==Number(4)?this.addHttpToUrl(this._config.agcgw_all.SG):this.addHttpToUrl(this._config.agcgw.url):this.addHttpToUrl(this._config.agcgw.url)},t.prototype.getGwBackUrl=function(){return null!=this.option?1==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.CN_back):2==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.DE_back):3==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.RU_back):4==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.SG_back):this.addHttpToUrl(this._config.agcgw.backurl):this.addHttpToUrl(this._config.agcgw.backurl)},t.prototype.getAppVersion=function(){return this.appVersion},t.prototype.getCryptImp=function(){return this.cryptImpl},t.prototype.checkBeforeSetKey=function(){if(null==this._config)throw new s(c.AGC_INIT_ERROR,{message:"AGCInstance not configurated. call agconnect.instance().configInstance() to configure the agconnect."},"instance");if(!this._config.agcgw||!this._config.client)throw new s(c.AGC_INIT_ERROR,{message:"AGCInstance config is invalid."},"instance")},t.prototype.setFetch=function(t){this.fetch=t},t.prototype.getFetch=function(){return this.fetch},t.prototype.setStorage=function(t){this.storage=t},t.prototype.getStorage=function(){return this.storage},t.prototype.setApp=function(t){this.app=t},t.prototype.getApp=function(){return this.app},t.prototype.setConfiguration=function(t){this.configuration=t},t.prototype.getConfiguration=function(){return this.configuration},t.prototype.setwebSocket=function(t){this.webSocket=t},t.prototype.getwebSocket=function(){return this.webSocket},t}(),u=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=""),this.code=t,this.msg=e}return t.prototype.getCode=function(){return this.code},t.prototype.setCode=function(t){this.code=t},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t}(),g=function(){function t(){this.ret=new u}return t.prototype.isSuccess=function(){return null!=this.ret&&0==this.ret.getCode()},t.prototype.getRet=function(){return this.ret},t.prototype.setRet=function(t){this.ret=t},t.prototype.constructResponse=function(t){},t}(),h=new e.InstanceMap((function(t){return new a(n.default,t[0])}));n.default.registerApiProvider("instance",(function(t){return h.get(t)})),exports.AGCError=s,exports.AGCErrorCode=c,exports.BaseResponse=g,exports.ConnectRet=u; | ||
***************************************************************************** */var s,c,a,p=function(t){function e(o,r,n){var i=this,s=o.code+e.COLON+o.message;return n&&(s=n+e.DASH+s),r&&(r.message?s=s+e.COMMA+r.message:"string"==typeof r&&(s=s+e.COMMA+r)),(i=t.call(this,s)||this).__proto__=e.prototype,i.code=o.code,i.message=o.message,r&&(r.message?i.message=o.message+e.COMMA+r.message:"string"==typeof r&&(i.message=o.message+e.COMMA+r)),i.msg=i.message,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,t),e.COLON=": ",e.COMMA=", ",e.DASH="-",e}(Error),u=function(){function t(){}return t.AGC_INNER_ERROR={code:1e4,message:"agc inner error"},t.NETWORK_REQUEST_ERROR={code:10001,message:"agc network request error"},t.GET_AAID_ERROR={code:10002,message:"agc get aaid error"},t.ABTEST_LOAD_EXPERIMENTS_ERROR={code:10003,message:"abtest load experiments error"},t.ABTEST_SAVE_EXPERIMENTS_ERROR={code:10004,message:"abtest save experiments error"},t.ABTEST_REPLACE_EXPERIMENTS_ERROR={code:10005,message:"abtest repalce experiments error"},t.FAIL_TO_GET_STORAGE_SERVICE={code:10006,message:"get agcStorage service failed"},t.FAIL_TO_GET_NETWORK_SERVICE={code:10007,message:"get agcNetwork service failed"},t.REMOVE_TOKEN_FAILED={code:10008,message:"remove client token faild"},t.GET_TOKEN_FAILED={code:10009,message:"get client token faild"},t.AGC_INIT_ERROR={code:10010,message:"AGCInstance init error"},t.FAIL_TO_GET_CRIDENTIAL_SERVICE={code:10011,message:"get agcCredential service failed"},t.WEBSOCKET_NOT_SUPPORT={code:10012,message:"websocket is not support"},t.WEBSOCKET_ERROR={code:10013,message:"websocket error"},t}(),g=o.Logger.createLogger("agconnectInstance"),h=function(){function t(t,o){this.appVersion="",this._config=null,this._customCredentialsProvider=null,this._customAuthProvider=null,this.cryptImpl=void 0,this.option=null,this.repo_=t,this.name_=o||e.DEFAULT_CATEGORY}return t.prototype.name=function(){return this.name_},t.prototype.configInstance=function(t){return this._config=t,this},t.prototype.config=function(){return this.checkBeforeSetKey(),this._config},t.prototype.setApiKey=function(t){this.checkBeforeSetKey(),this._config.client.api_key=t},t.prototype.setClientSecret=function(t){this.checkBeforeSetKey(),this._config.client.client_secret=t},t.prototype.setClientId=function(t){this.checkBeforeSetKey(),this._config.client.client_id=t},t.prototype.getService=function(t){return this.repo_.getService(t,this,this.name_)},t.prototype.setCustomCredentialsProvider=function(t){return t?t.getToken?1!=t.getToken.length?(g.error("the customCredentialsProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customCredentialsProvider=t,!0):(g.error("the customCredentialsProvider must contain getToken method."),!1):(this._customCredentialsProvider=t,!0)},t.prototype.setCustomAuthProvider=function(t){return t?t.getToken?1!=t.getToken.length?(g.error("the customAuthProvider getToken method must contain single parameter:forceRefresh."),!1):(this._customAuthProvider=t,!0):(g.error("the customAuthProvider must contain getToken method."),!1):(this._customAuthProvider=t,!0)},t.prototype.getCustomCredentialsProvider=function(){return this._customCredentialsProvider},t.prototype.getCustomAuthProvider=function(){return this._customAuthProvider},t.prototype.setCryptImp=function(t){return t?t.decrypt&&t.decrypt instanceof Function&&t.encrypt&&t.encrypt instanceof Function?(this.cryptImpl=t,!0):(g.error("the crypt is not exist necessary methods."),!1):(g.error("the crypt is not available."),!1)},t.prototype.setAppVersion=function(t){this.appVersion=t},t.prototype.setOption=function(t){this.option=t},t.prototype.addHttpToUrl=function(t){return t&&!t.startsWith("https://")?"https://"+t:t},t.prototype.getGwUrl=function(){return null!=this.option?this.option.routePolicy==Number(1)?this.addHttpToUrl(this._config.agcgw_all.CN):this.option.routePolicy==Number(2)?this.addHttpToUrl(this._config.agcgw_all.DE):this.option.routePolicy==Number(3)?this.addHttpToUrl(this._config.agcgw_all.RU):this.option.routePolicy==Number(4)?this.addHttpToUrl(this._config.agcgw_all.SG):this.addHttpToUrl(this._config.agcgw.url):this.addHttpToUrl(this._config.agcgw.url)},t.prototype.getGwBackUrl=function(){return null!=this.option?1==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.CN_back):2==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.DE_back):3==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.RU_back):4==this.option.routePolicy?this.addHttpToUrl(this._config.agcgw_all.SG_back):this.addHttpToUrl(this._config.agcgw.backurl):this.addHttpToUrl(this._config.agcgw.backurl)},t.prototype.getAppVersion=function(){return this.appVersion},t.prototype.getCryptImp=function(){return this.cryptImpl},t.prototype.checkBeforeSetKey=function(){if(null==this._config)throw new p(u.AGC_INIT_ERROR,{message:"AGCInstance not configurated. call agconnect.instance().configInstance() to configure the agconnect."},"instance");if(!this._config.agcgw||!this._config.client)throw new p(u.AGC_INIT_ERROR,{message:"AGCInstance config is invalid."},"instance")},t}(),l=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=""),this.code=t,this.msg=e}return t.prototype.getCode=function(){return this.code},t.prototype.setCode=function(t){this.code=t},t.prototype.getMsg=function(){return this.msg},t.prototype.setMsg=function(t){this.msg=t},t}(),f=function(){function t(){this.ret=new l}return t.prototype.isSuccess=function(){return null!=this.ret&&0==this.ret.getCode()},t.prototype.getRet=function(){return this.ret},t.prototype.setRet=function(t){this.ret=t},t.prototype.constructResponse=function(t){},t}(),d=new e.InstanceMap((function(t){return new h(n.default,t[0])}));!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.CHINA=1]="CHINA",t[t.GERMANY=2]="GERMANY",t[t.RUSSIA=3]="RUSSIA",t[t.SINGAPORE=4]="SINGAPORE"}(s||(s={})),c=n.default,a={AGCRoutePolicy:s},c.registerApiProvider("instance",(function(t){return d.get(t)}),a),exports.AGCError=p,exports.AGCErrorCode=u,exports.BaseResponse=f,exports.ConnectRet=l; |
@@ -11,3 +11,4 @@ export interface ErrorCode { | ||
message: string; | ||
msg: string; | ||
constructor(errorCode: ErrorCode, e?: any, moduleName?: string); | ||
} |
@@ -14,7 +14,2 @@ import { AGCInstance, AGConnectOptions, AGConnectServicesConfig, Crypt } from '@agconnect/instance-types'; | ||
private option; | ||
private fetch; | ||
private storage; | ||
private app; | ||
private configuration; | ||
private webSocket; | ||
constructor(repo: ServiceRepository, name?: string); | ||
@@ -41,13 +36,3 @@ name(): string; | ||
private checkBeforeSetKey; | ||
setFetch(fetch: any): void; | ||
getFetch(): any; | ||
setStorage(storage: any): void; | ||
getStorage(): any; | ||
setApp(app: any): void; | ||
getApp(): any; | ||
setConfiguration(configuration: any): void; | ||
getConfiguration(): any; | ||
setwebSocket(storage: any): void; | ||
getwebSocket(): any; | ||
} | ||
export { instanceLogger, AGCInstanceImpl }; |
{ | ||
"name": "@agconnect/instance", | ||
"version": "1.3.1-beta", | ||
"version": "1.3.1", | ||
"main": "./dist/index.node.cjs.js", | ||
"module": "./dist/index.esm.js", | ||
"description": "@agconnect/instance", | ||
"author": "https://developer.huawei.com/", | ||
"description": "AppGallery Connect Client JavaScript SDK inner module", | ||
"author": { | ||
"name": "AppGallery Connect", | ||
"url": "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/" | ||
}, | ||
"homepage": "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/", | ||
"license": "ISC", | ||
@@ -14,3 +18,5 @@ "scripts": { | ||
"files": [ | ||
"dist" | ||
"dist/", | ||
"package.json", | ||
"readme.md" | ||
], | ||
@@ -30,8 +36,8 @@ "typings": "dist/index.d.ts", | ||
"dependencies": { | ||
"@agconnect/api": "1.3.1-beta", | ||
"@agconnect/api-types": "1.3.1-beta", | ||
"@agconnect/core": "1.3.1-beta", | ||
"@agconnect/instance-types": "1.3.1-beta", | ||
"@agconnect/log": "1.3.1-beta" | ||
"@agconnect/api": "1.3.1", | ||
"@agconnect/api-types": "1.3.1", | ||
"@agconnect/core": "1.3.1", | ||
"@agconnect/instance-types": "1.3.1", | ||
"@agconnect/log": "1.3.1" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
0
20396
193
+ Added@agconnect/api@1.3.1(transitive)
+ Added@agconnect/api-types@1.3.1(transitive)
+ Added@agconnect/core@1.3.1(transitive)
+ Added@agconnect/instance-types@1.3.1(transitive)
+ Added@agconnect/log@1.3.1(transitive)
- Removed@agconnect/api@1.3.1-beta(transitive)
- Removed@agconnect/api-types@1.3.1-beta(transitive)
- Removed@agconnect/core@1.3.1-beta(transitive)
- Removed@agconnect/instance-types@1.3.1-beta(transitive)
- Removed@agconnect/log@1.3.1-beta(transitive)
Updated@agconnect/api@1.3.1
Updated@agconnect/api-types@1.3.1
Updated@agconnect/core@1.3.1
Updated@agconnect/log@1.3.1