@agconnect/util
Advanced tools
Comparing version 1.3.0 to 1.3.1-beta
@@ -1,1 +0,15 @@ | ||
import t from"@agconnect/api";import{DEFAULT_CATEGORY as e}from"@agconnect/core";import"@agconnect/instance";import"@agconnect/storage";import{Logger as n}from"@agconnect/log";var r,o=function(){function t(){this.storageImpl=void 0}return t.prototype.getAaid=function(r){var o=this,i=n.createLogger("ClientInfoService");try{var c="agcAaid_"+r.name()+":"+r.config().client.client_id;r.name()===e&&(c="agcAaid:"+r.config().client.client_id);var a=r.getService("AGCStorageService");return null==a?(i.error("Get AGC storage Service failed."),Promise.reject("Get AGC storage Service failed.")):(this.storageImpl||(this.storageImpl=a.getStorageInstance(t.persistence)),this.storageImpl.get(c).then((function(t){return null!=t&&null!=t&&""!=t||(t=o.getRandomString(),o.storageImpl.set(c,t)),t})))}catch(t){return Promise.reject(t)}},t.prototype.getRandomString=function(){var t="0123456789abcdef",e=t.length;return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/x/g,(function(){return t.charAt(Math.floor(Math.random()*e))}))},t.persistence=0,t.INSTANCE=new t,t}(),i=function(){function t(){}return t.getEnvironmentIns=function(){return t.instance},t.prototype.isBrowser=function(){return"object"==typeof self&&self.self===self},t.prototype.isNodeJS=function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return!1}},t.prototype.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},t.prototype.isQuickApp=function(){try{return global&&"fastapp"in global}catch(t){return!1}},t.instance=new t,t}(),c=function(){function e(e){this.instance=e||t.instance()}return e.prototype.getAaid=function(){return o.INSTANCE.getAaid(this.instance)},e.prototype.getEnvironmentUtil=function(){return i.getEnvironmentIns()},e}();function a(t){return null!=t}!function(t){var e=function(t,e,n){if("function"==typeof t||a(e)||a(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}};t.ObserverImpl=e}(r||(r={})),t.registerInternalService({name:"ClientInfoService",serviceFactory:function(t){return new c(t)}});export{i as EnvironmentUtil,r as ObserverUtil}; | ||
import e from"@agconnect/api";import{DEFAULT_CATEGORY as t}from"@agconnect/core";import{AGCError as n,AGCErrorCode as r}from"@agconnect/instance";import"@agconnect/storage";import{Logger as o}from"@agconnect/log"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function i(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))}function a(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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var c,s=function(){function e(){this.storageImpl=void 0}return e.prototype.getAaid=function(c){return i(this,void 0,void 0,(function(){var i,s,l,u,f;return a(this,(function(a){switch(a.label){case 0:i=o.createLogger("ClientInfoService"),a.label=1;case 1:return a.trys.push([1,5,,6]),s="agcAaid_"+c.name()+":"+c.config().client.client_id,c.name()===t&&(s="agcAaid:"+c.config().client.client_id),null==(l=c.getService("AGCStorageService"))?(i.error("Get AGC storage Service failed."),[2,Promise.reject(new n(r.GET_AAID_ERROR,{message:"get AGC storage Service failed"},"util"))]):(this.storageImpl||(this.storageImpl=l.getStorageInstance(e.persistence)),[4,this.storageImpl.get(s).catch((function(e){return i.error("get aaid failed",e.message),Promise.reject(new n(r.GET_AAID_ERROR,{message:"get aaid from storage failed"},"util"))}))]);case 2:return null!=(u=a.sent())&&null!=u&&""!=u?[3,4]:(u=this.getRandomString(),[4,this.storageImpl.set(s,u).catch((function(e){return i.error("get aaid failed",e.message),Promise.reject(new n(r.GET_AAID_ERROR,{message:"save aaid to storage failed"},"util"))}))]);case 3:a.sent(),a.label=4;case 4:return[2,u];case 5:return f=a.sent(),i.error("get aaid failed",f.message),[2,Promise.reject(new n(r.GET_AAID_ERROR,f,"util"))];case 6:return[2]}}))}))},e.prototype.getRandomString=function(){var e="0123456789abcdef",t=e.length;return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/x/g,(function(){return e.charAt(Math.floor(Math.random()*t))}))},e.persistence=0,e.INSTANCE=new e,e}(),l=function(){function e(){}return e.getEnvironmentIns=function(){return e.instance},e.prototype.isBrowser=function(){return"object"==typeof self&&self.self===self},e.prototype.isNodeJS=function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}},e.prototype.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.prototype.isQuickApp=function(){try{return global&&"fastapp"in global}catch(e){return!1}},e.instance=new e,e}(),u=function(){function t(t){this.instance=t||e.instance()}return t.prototype.getAaid=function(){return s.INSTANCE.getAaid(this.instance)},t.prototype.getEnvironmentUtil=function(){return l.getEnvironmentIns()},t}();function f(e){return null!=e}!function(e){var t=function(e,t,n){if("function"==typeof e||f(t)||f(n))this.next=e,this.error=t||null,this.complete=n||null;else{var r=e;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}};e.ObserverImpl=t}(c||(c={})),e.registerInternalService({name:"ClientInfoService",serviceFactory:function(e){return new u(e)}});export{l as EnvironmentUtil,c as ObserverUtil}; |
@@ -1,1 +0,15 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@agconnect/api"),t=require("@agconnect/core");require("@agconnect/instance"),require("@agconnect/storage");var r=require("@agconnect/log");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o,i=n(e),c=function(){function e(){this.storageImpl=void 0}return e.prototype.getAaid=function(n){var o=this,i=r.Logger.createLogger("ClientInfoService");try{var c="agcAaid_"+n.name()+":"+n.config().client.client_id;n.name()===t.DEFAULT_CATEGORY&&(c="agcAaid:"+n.config().client.client_id);var a=n.getService("AGCStorageService");return null==a?(i.error("Get AGC storage Service failed."),Promise.reject("Get AGC storage Service failed.")):(this.storageImpl||(this.storageImpl=a.getStorageInstance(e.persistence)),this.storageImpl.get(c).then((function(e){return null!=e&&null!=e&&""!=e||(e=o.getRandomString(),o.storageImpl.set(c,e)),e})))}catch(e){return Promise.reject(e)}},e.prototype.getRandomString=function(){var e="0123456789abcdef",t=e.length;return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/x/g,(function(){return e.charAt(Math.floor(Math.random()*t))}))},e.persistence=0,e.INSTANCE=new e,e}(),a=function(){function e(){}return e.getEnvironmentIns=function(){return e.instance},e.prototype.isBrowser=function(){return"object"==typeof self&&self.self===self},e.prototype.isNodeJS=function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}},e.prototype.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.prototype.isQuickApp=function(){try{return global&&"fastapp"in global}catch(e){return!1}},e.instance=new e,e}(),s=function(){function e(e){this.instance=e||i.default.instance()}return e.prototype.getAaid=function(){return c.INSTANCE.getAaid(this.instance)},e.prototype.getEnvironmentUtil=function(){return a.getEnvironmentIns()},e}();function u(e){return null!=e}exports.ObserverUtil=void 0,o=function(e,t,r){if("function"==typeof e||u(t)||u(r))this.next=e,this.error=t||null,this.complete=r||null;else{var n=e;this.next=n.next||null,this.error=n.error||null,this.complete=n.complete||null}},(exports.ObserverUtil||(exports.ObserverUtil={})).ObserverImpl=o,i.default.registerInternalService({name:"ClientInfoService",serviceFactory:function(e){return new s(e)}}),exports.EnvironmentUtil=a; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@agconnect/api"),t=require("@agconnect/core"),r=require("@agconnect/instance");require("@agconnect/storage");var n=require("@agconnect/log");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(e); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function a(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))}function c(e,t){var r,n,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(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var s,u=function(){function e(){this.storageImpl=void 0}return e.prototype.getAaid=function(o){return a(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:i=n.Logger.createLogger("ClientInfoService"),c.label=1;case 1:return c.trys.push([1,5,,6]),a="agcAaid_"+o.name()+":"+o.config().client.client_id,o.name()===t.DEFAULT_CATEGORY&&(a="agcAaid:"+o.config().client.client_id),null==(s=o.getService("AGCStorageService"))?(i.error("Get AGC storage Service failed."),[2,Promise.reject(new r.AGCError(r.AGCErrorCode.GET_AAID_ERROR,{message:"get AGC storage Service failed"},"util"))]):(this.storageImpl||(this.storageImpl=s.getStorageInstance(e.persistence)),[4,this.storageImpl.get(a).catch((function(e){return i.error("get aaid failed",e.message),Promise.reject(new r.AGCError(r.AGCErrorCode.GET_AAID_ERROR,{message:"get aaid from storage failed"},"util"))}))]);case 2:return null!=(u=c.sent())&&null!=u&&""!=u?[3,4]:(u=this.getRandomString(),[4,this.storageImpl.set(a,u).catch((function(e){return i.error("get aaid failed",e.message),Promise.reject(new r.AGCError(r.AGCErrorCode.GET_AAID_ERROR,{message:"save aaid to storage failed"},"util"))}))]);case 3:c.sent(),c.label=4;case 4:return[2,u];case 5:return l=c.sent(),i.error("get aaid failed",l.message),[2,Promise.reject(new r.AGCError(r.AGCErrorCode.GET_AAID_ERROR,l,"util"))];case 6:return[2]}}))}))},e.prototype.getRandomString=function(){var e="0123456789abcdef",t=e.length;return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/x/g,(function(){return e.charAt(Math.floor(Math.random()*t))}))},e.persistence=0,e.INSTANCE=new e,e}(),l=function(){function e(){}return e.getEnvironmentIns=function(){return e.instance},e.prototype.isBrowser=function(){return"object"==typeof self&&self.self===self},e.prototype.isNodeJS=function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}},e.prototype.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.prototype.isQuickApp=function(){try{return global&&"fastapp"in global}catch(e){return!1}},e.instance=new e,e}(),f=function(){function e(e){this.instance=e||i.default.instance()}return e.prototype.getAaid=function(){return u.INSTANCE.getAaid(this.instance)},e.prototype.getEnvironmentUtil=function(){return l.getEnvironmentIns()},e}();function p(e){return null!=e}exports.ObserverUtil=void 0,s=function(e,t,r){if("function"==typeof e||p(t)||p(r))this.next=e,this.error=t||null,this.complete=r||null;else{var n=e;this.next=n.next||null,this.error=n.error||null,this.complete=n.complete||null}},(exports.ObserverUtil||(exports.ObserverUtil={})).ObserverImpl=s,i.default.registerInternalService({name:"ClientInfoService",serviceFactory:function(e){return new f(e)}}),exports.EnvironmentUtil=l; |
{ | ||
"name": "@agconnect/util", | ||
"version": "1.3.0", | ||
"version": "1.3.1-beta", | ||
"main": "./dist/index.node.cjs.js", | ||
@@ -28,11 +28,11 @@ "module": "./dist/index.esm.js", | ||
"dependencies": { | ||
"@agconnect/api": "1.3.0", | ||
"@agconnect/api-types": "1.3.0", | ||
"@agconnect/instance": "1.3.0", | ||
"@agconnect/instance-types": "1.3.0", | ||
"@agconnect/storage": "1.3.0", | ||
"@agconnect/storage-types": "1.3.0", | ||
"@agconnect/log": "1.3.0", | ||
"@agconnect/core": "1.3.0" | ||
"@agconnect/api": "1.3.1-beta", | ||
"@agconnect/api-types": "1.3.1-beta", | ||
"@agconnect/instance": "1.3.1-beta", | ||
"@agconnect/instance-types": "1.3.1-beta", | ||
"@agconnect/storage": "1.3.1-beta", | ||
"@agconnect/storage-types": "1.3.1-beta", | ||
"@agconnect/log": "1.3.1-beta", | ||
"@agconnect/core": "1.3.1-beta" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13735
120
3
+ Added@agconnect/api@1.3.1-beta(transitive)
+ Added@agconnect/api-types@1.3.1-beta(transitive)
+ Added@agconnect/core@1.3.1-beta(transitive)
+ Added@agconnect/instance@1.3.1-beta(transitive)
+ Added@agconnect/instance-types@1.3.1-beta(transitive)
+ Added@agconnect/log@1.3.1-beta(transitive)
+ Added@agconnect/storage@1.3.1-beta(transitive)
+ Added@agconnect/storage-types@1.3.1-beta(transitive)
- Removed@agconnect/api@1.3.0(transitive)
- Removed@agconnect/api-types@1.3.0(transitive)
- Removed@agconnect/core@1.3.0(transitive)
- Removed@agconnect/instance@1.3.0(transitive)
- Removed@agconnect/instance-types@1.3.0(transitive)
- Removed@agconnect/log@1.3.0(transitive)
- Removed@agconnect/storage@1.3.0(transitive)
- Removed@agconnect/storage-types@1.3.0(transitive)
Updated@agconnect/api@1.3.1-beta
Updated@agconnect/core@1.3.1-beta
Updated@agconnect/log@1.3.1-beta