@y-monitor/core 1.0.1-alpha.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.esm.js CHANGED
@@ -131,7 +131,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
131
131
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
132
132
  };
133
133
 
134
- var version = "1.0.0";
134
+ var version = "1.0.1";
135
135
 
136
136
  var SDK_NAME = 'y-monitor';
137
137
  var SDK_VERSION = version;
package/dist/core.js CHANGED
@@ -133,7 +133,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
133
133
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
134
134
  };
135
135
 
136
- var version = "1.0.0";
136
+ var version = "1.0.1";
137
137
 
138
138
  var SDK_NAME = 'y-monitor';
139
139
  var SDK_VERSION = version;
package/dist/core.min.js CHANGED
@@ -1 +1 @@
1
- var MONITOR=function(t){"use strict";var n=function(){function t(){this.events=new Map}return t.prototype.watch=function(t,n){var e=this.events.get(t);e?this.events.set(t,e.concat(n)):this.events.set(t,[n])},t.prototype.notify=function(t,n){var e=this.events.get(t);t&&e&&e.forEach(function(t){try{t(n)}catch(t){}})},t}(),e=function(){function t(t){this.options=t}return t.prototype.use=function(t){var e=this,r=new n;t.forEach(function(t){t.monitor.call(e,r.notify.bind(r));r.watch(t.name,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t.transform.apply(e,n);t.consumer.call(e,o)})})},t.prototype.getOptions=function(){return this.options},t}(),r=function(){return r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function o(t,n,e,r){return new(e||(e=Promise))(function(o,i){function s(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(s,c)}a((r=r.apply(t,n||[])).next())})}function i(t,n){var e,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(e=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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function s(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var c="undefined"!=typeof window?window:0;var a=function(){if(c)return window}(),u=(a.__MONITOR__=a.__MONITOR__||{},a.__MONITOR__);var l="MONITOR Logger",f=function(){function t(){var t=this;if(this.enabled=!1,this._console={},a.console=console||a.console,console||a.console){["log","debug","info","warn","error","assert"].forEach(function(n){n in a.console&&(t._console[n]=a.console[n])})}}return t.prototype.disable=function(){this.enabled=!1},t.prototype.bindOptions=function(t){this.enabled=!!t},t.prototype.enable=function(){this.enabled=!0},t.prototype.getEnableStatus=function(){return this.enabled},t.prototype.log=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.enabled&&(t=this._console).log.apply(t,s(["".concat(l,"[Log]:")],n,!1))},t.prototype.warn=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.enabled&&(t=this._console).warn.apply(t,s(["".concat(l,"[Warn]:")],n,!1))},t.prototype.error=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];(t=this._console).error.apply(t,s(["".concat(l,"[Error]:")],n,!1))},t}(),p=u.logger||(u.logger=new f),h=Object.prototype.toString;function d(t){return function(n){return h.call(n)==="[object ".concat(t,"]")}}function y(t,n,e){return!!function(t,n){return h.call(t)==="[object ".concat(n,"]")}(t,e)||(void 0!==t&&p.error("".concat(n,"期望传入:").concat(e,"类型,当前是:").concat(h.call(t),"类型")),!1)}function b(t){var n=this;t.forEach(function(t){var e=t[0],r=t[1];return y(e,r,t[2])&&(n[r]=e)})}var v={isNumber:d("Number"),isString:d("String"),isBoolean:d("Boolean"),isNull:d("Null"),isUndefined:d("Undefined"),isSymbol:d("Symbol"),isFunction:d("Function"),isObject:d("Object"),isArray:d("Array"),isProcess:d("process"),isWindow:d("Window")};var g=function(){function t(){this.stack=[],this.isFlushing=!1,"Promise"in a&&(this.micro=Promise.resolve())}return t.prototype.addTask=function(t){var n=this;"function"==typeof t&&("Promise"in a?(this.stack.push(t),this.isFlushing||(this.isFlushing=!0,this.micro.then(function(){return n.flushStack()}))):t())},t.prototype.clear=function(){this.stack=[]},t.prototype.getStack=function(){return this.stack},t.prototype.flushStack=function(){var t=this.stack.slice(0);this.stack.length=0,this.isFlushing=!1;for(var n=0,e=t;n<e.length;n++){(0,e[n])()}},t}(),m=function(){function t(){this.dsn="",this.apiKey="",this.beforeDataReport=null,this.queue=new g}return t.prototype.bindOptions=function(t){var n=[[t.dsn,"dsn","String"],[t.apiKey,"apiKey","String"],[t.beforeDataReport,"beforeDataReport","Function"]];b.call(this,n)},t.prototype.getAuthInfo=function(){return{sdkVersion:"1.0.0",sdkName:"y-monitor",apiKey:this.apiKey}},t.prototype.send=function(t,n){return void 0===n&&(n=[]),o(this,void 0,void 0,function(){var e,o;return i(this,function(i){switch(i.label){case 0:return e=r(r({},this.getTransportData(t)),{breadcrumb:n}),"function"!=typeof this.beforeDataReport?[3,2]:[4,this.beforeDataReport(e)];case 1:if(!(e=i.sent()))return[2];i.label=2;case 2:return o=this.dsn,s=o,v.isString(s)&&""===s.trim()||null==s?(p.error("dsn is empty,please check"),[2]):[2,this.sendToServer(e,o)]}var s})})},t.prototype.isSelfDsn=function(t){return this.dsn&&(n=t,e=this.dsn,!!~n.indexOf(e));var n,e},t}(),w=function(){function t(){this.throttleDelayTime=0,this.includeHttpUrlTraceIdRegExp=/.*/}return t.prototype.isFilterHttpUrl=function(t){return this.filterXhrUrlRegExp&&this.filterXhrUrlRegExp.test(t)},t.prototype.bindOptions=function(t){var n=[[t.throttleDelayTime,"throttleDelayTime","Number"],[t.filterXhrUrlRegExp,"filterXhrUrlRegExp","RegExp"],[t.includeHttpUrlTraceIdRegExp,"includeHttpUrlTraceIdRegExp","RegExp"]];b.call(this,n)},t}(),k=function(){function t(t){void 0===t&&(t={}),this.maxBreadcrumbs=10,this.beforePushBreadcrumb=null,this.stack=[],this.bindOptions(t)}return t.prototype.push=function(t){var n=this;if("function"==typeof this.beforePushBreadcrumb){var e=null,r=this.beforePushBreadcrumb;return function(){e=r.call(n,n,t)}(),e?this.immediatePush(e):this.stack}return this.immediatePush(t)},t.prototype.immediatePush=function(t){return t.time||(t.time=Date.now()),this.stack.length>=this.maxBreadcrumbs&&this.shift(),this.stack.push(t),this.stack.sort(function(t,n){return t.time-n.time}),p.log(this.stack),this.stack},t.prototype.shift=function(){return void 0!==this.stack.shift()},t.prototype.clear=function(){this.stack=[]},t.prototype.getStack=function(){return this.stack},t.prototype.bindOptions=function(t){void 0===t&&(t={});var n=t.maxBreadcrumbs,e=t.beforePushBreadcrumb;y(n,"maxBreadcrumbs","Number")&&(this.maxBreadcrumbs=n),y(e,"beforePushBreadcrumb","Function")&&(this.beforePushBreadcrumb=e)},t}();return t.BaseClient=e,t.BaseOptions=w,t.BaseTransport=m,t.Breadcrumb=k,t.Subscribe=n,t}({});
1
+ var MONITOR=function(t){"use strict";var n=function(){function t(){this.events=new Map}return t.prototype.watch=function(t,n){var e=this.events.get(t);e?this.events.set(t,e.concat(n)):this.events.set(t,[n])},t.prototype.notify=function(t,n){var e=this.events.get(t);t&&e&&e.forEach(function(t){try{t(n)}catch(t){}})},t}(),e=function(){function t(t){this.options=t}return t.prototype.use=function(t){var e=this,r=new n;t.forEach(function(t){t.monitor.call(e,r.notify.bind(r));r.watch(t.name,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t.transform.apply(e,n);t.consumer.call(e,o)})})},t.prototype.getOptions=function(){return this.options},t}(),r=function(){return r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function o(t,n,e,r){return new(e||(e=Promise))(function(o,i){function s(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(s,c)}a((r=r.apply(t,n||[])).next())})}function i(t,n){var e,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(e=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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function s(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var c="undefined"!=typeof window?window:0;var a=function(){if(c)return window}(),u=(a.__MONITOR__=a.__MONITOR__||{},a.__MONITOR__);var l="MONITOR Logger",f=function(){function t(){var t=this;if(this.enabled=!1,this._console={},a.console=console||a.console,console||a.console){["log","debug","info","warn","error","assert"].forEach(function(n){n in a.console&&(t._console[n]=a.console[n])})}}return t.prototype.disable=function(){this.enabled=!1},t.prototype.bindOptions=function(t){this.enabled=!!t},t.prototype.enable=function(){this.enabled=!0},t.prototype.getEnableStatus=function(){return this.enabled},t.prototype.log=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.enabled&&(t=this._console).log.apply(t,s(["".concat(l,"[Log]:")],n,!1))},t.prototype.warn=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.enabled&&(t=this._console).warn.apply(t,s(["".concat(l,"[Warn]:")],n,!1))},t.prototype.error=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];(t=this._console).error.apply(t,s(["".concat(l,"[Error]:")],n,!1))},t}(),p=u.logger||(u.logger=new f),h=Object.prototype.toString;function d(t){return function(n){return h.call(n)==="[object ".concat(t,"]")}}function y(t,n,e){return!!function(t,n){return h.call(t)==="[object ".concat(n,"]")}(t,e)||(void 0!==t&&p.error("".concat(n,"期望传入:").concat(e,"类型,当前是:").concat(h.call(t),"类型")),!1)}function b(t){var n=this;t.forEach(function(t){var e=t[0],r=t[1];return y(e,r,t[2])&&(n[r]=e)})}var v={isNumber:d("Number"),isString:d("String"),isBoolean:d("Boolean"),isNull:d("Null"),isUndefined:d("Undefined"),isSymbol:d("Symbol"),isFunction:d("Function"),isObject:d("Object"),isArray:d("Array"),isProcess:d("process"),isWindow:d("Window")};var g=function(){function t(){this.stack=[],this.isFlushing=!1,"Promise"in a&&(this.micro=Promise.resolve())}return t.prototype.addTask=function(t){var n=this;"function"==typeof t&&("Promise"in a?(this.stack.push(t),this.isFlushing||(this.isFlushing=!0,this.micro.then(function(){return n.flushStack()}))):t())},t.prototype.clear=function(){this.stack=[]},t.prototype.getStack=function(){return this.stack},t.prototype.flushStack=function(){var t=this.stack.slice(0);this.stack.length=0,this.isFlushing=!1;for(var n=0,e=t;n<e.length;n++){(0,e[n])()}},t}(),m=function(){function t(){this.dsn="",this.apiKey="",this.beforeDataReport=null,this.queue=new g}return t.prototype.bindOptions=function(t){var n=[[t.dsn,"dsn","String"],[t.apiKey,"apiKey","String"],[t.beforeDataReport,"beforeDataReport","Function"]];b.call(this,n)},t.prototype.getAuthInfo=function(){return{sdkVersion:"1.0.1",sdkName:"y-monitor",apiKey:this.apiKey}},t.prototype.send=function(t,n){return void 0===n&&(n=[]),o(this,void 0,void 0,function(){var e,o;return i(this,function(i){switch(i.label){case 0:return e=r(r({},this.getTransportData(t)),{breadcrumb:n}),"function"!=typeof this.beforeDataReport?[3,2]:[4,this.beforeDataReport(e)];case 1:if(!(e=i.sent()))return[2];i.label=2;case 2:return o=this.dsn,s=o,v.isString(s)&&""===s.trim()||null==s?(p.error("dsn is empty,please check"),[2]):[2,this.sendToServer(e,o)]}var s})})},t.prototype.isSelfDsn=function(t){return this.dsn&&(n=t,e=this.dsn,!!~n.indexOf(e));var n,e},t}(),w=function(){function t(){this.throttleDelayTime=0,this.includeHttpUrlTraceIdRegExp=/.*/}return t.prototype.isFilterHttpUrl=function(t){return this.filterXhrUrlRegExp&&this.filterXhrUrlRegExp.test(t)},t.prototype.bindOptions=function(t){var n=[[t.throttleDelayTime,"throttleDelayTime","Number"],[t.filterXhrUrlRegExp,"filterXhrUrlRegExp","RegExp"],[t.includeHttpUrlTraceIdRegExp,"includeHttpUrlTraceIdRegExp","RegExp"]];b.call(this,n)},t}(),k=function(){function t(t){void 0===t&&(t={}),this.maxBreadcrumbs=10,this.beforePushBreadcrumb=null,this.stack=[],this.bindOptions(t)}return t.prototype.push=function(t){var n=this;if("function"==typeof this.beforePushBreadcrumb){var e=null,r=this.beforePushBreadcrumb;return function(){e=r.call(n,n,t)}(),e?this.immediatePush(e):this.stack}return this.immediatePush(t)},t.prototype.immediatePush=function(t){return t.time||(t.time=Date.now()),this.stack.length>=this.maxBreadcrumbs&&this.shift(),this.stack.push(t),this.stack.sort(function(t,n){return t.time-n.time}),p.log(this.stack),this.stack},t.prototype.shift=function(){return void 0!==this.stack.shift()},t.prototype.clear=function(){this.stack=[]},t.prototype.getStack=function(){return this.stack},t.prototype.bindOptions=function(t){void 0===t&&(t={});var n=t.maxBreadcrumbs,e=t.beforePushBreadcrumb;y(n,"maxBreadcrumbs","Number")&&(this.maxBreadcrumbs=n),y(e,"beforePushBreadcrumb","Function")&&(this.beforePushBreadcrumb=e)},t}();return t.BaseClient=e,t.BaseOptions=w,t.BaseTransport=m,t.Breadcrumb=k,t.Subscribe=n,t}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y-monitor/core",
3
- "version": "1.0.1-alpha.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "dist/core.js",
6
6
  "module": "dist/core.esm.js",
@@ -18,9 +18,9 @@
18
18
  "author": "Joanna",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@y-monitor/shared": "^1.0.1-alpha.0",
22
- "@y-monitor/types": "^1.0.1-alpha.0",
23
- "@y-monitor/utils": "^1.0.1-alpha.0"
21
+ "@y-monitor/shared": "^1.0.1",
22
+ "@y-monitor/types": "^1.0.2",
23
+ "@y-monitor/utils": "^1.0.2"
24
24
  },
25
- "gitHead": "e09fee9557ae052d9644915bb7da353e63ef76d4"
25
+ "gitHead": "1bc1eacf15037a63fa2ab97f82771f94bc668df3"
26
26
  }