@ohbug/core 1.1.7 → 2.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/README.md +1 -2
- package/dist/index.d.ts +30 -6
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +17 -21
- package/dist/action.d.ts +0 -9
- package/dist/action.d.ts.map +0 -1
- package/dist/client.d.ts +0 -3
- package/dist/client.d.ts.map +0 -1
- package/dist/config.d.ts +0 -3
- package/dist/config.d.ts.map +0 -1
- package/dist/event.d.ts +0 -81
- package/dist/event.d.ts.map +0 -1
- package/dist/extension.d.ts +0 -12
- package/dist/extension.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/getErrorMessage.d.ts +0 -4
- package/dist/lib/getErrorMessage.d.ts.map +0 -1
- package/dist/lib/metaData.d.ts +0 -5
- package/dist/lib/metaData.d.ts.map +0 -1
- package/dist/lib/verifyConfig.d.ts +0 -8
- package/dist/lib/verifyConfig.d.ts.map +0 -1
- package/dist/notify.d.ts +0 -9
- package/dist/notify.d.ts.map +0 -1
- package/dist/ohbug-core.es.js +0 -29
- package/dist/ohbug-core.umd.js +0 -29
- package/dist/types.d.ts +0 -18
- package/dist/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ohbug/core)
|
|
4
4
|
[](https://bundlephobia.com/result?p=@ohbug/core)
|
|
5
|
-
[](https://github.com/prettier/prettier)
|
|
6
5
|
|
|
7
6
|
English | [简体中文](./README-zh_CN.md)
|
|
8
7
|
|
|
@@ -13,5 +12,5 @@ ohbug's core module is responsible for managing ohbug's workflow.
|
|
|
13
12
|
## Installation
|
|
14
13
|
|
|
15
14
|
```
|
|
16
|
-
|
|
15
|
+
pnpm instal @ohbug/core
|
|
17
16
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { OhbugClientConstructor, OhbugEventWithMethods, OhbugExtension, OhbugExtensionUI } from '@ohbug/types';
|
|
2
|
+
|
|
3
|
+
declare const Client: OhbugClientConstructor;
|
|
4
|
+
|
|
5
|
+
declare function isEvent(eventLike: any): eventLike is OhbugEventWithMethods<any>;
|
|
6
|
+
|
|
7
|
+
declare function defineExtension(extension: OhbugExtension): OhbugExtension;
|
|
8
|
+
declare function createExtensionUI(extensionUI: OhbugExtensionUI): OhbugExtensionUI;
|
|
9
|
+
|
|
10
|
+
declare const enum EventTypes {
|
|
11
|
+
UNCAUGHT_ERROR = "uncaughtError",
|
|
12
|
+
RESOURCE_ERROR = "resourceError",
|
|
13
|
+
UNHANDLEDREJECTION_ERROR = "unhandledrejectionError",
|
|
14
|
+
AJAX_ERROR = "ajaxError",
|
|
15
|
+
FETCH_ERROR = "fetchError",
|
|
16
|
+
WEBSOCKET_ERROR = "websocketError",
|
|
17
|
+
UNKNOWN_ERROR = "unknownError",
|
|
18
|
+
MESSAGE = "message",
|
|
19
|
+
FEEDBACK = "feedback",
|
|
20
|
+
VIEW = "view",
|
|
21
|
+
REACT = "react",
|
|
22
|
+
VUE = "vue",
|
|
23
|
+
ANGULAR = "angular",
|
|
24
|
+
MINIAPP_ERROR = "miniappError",
|
|
25
|
+
MINIAPP_UNHANDLEDREJECTION_ERROR = "miniappUnhandledrejectionError",
|
|
26
|
+
MINIAPP_PAGENOTFOUND_ERROR = "miniappPagenotfoundError",
|
|
27
|
+
MINIAPP_MEMORYWARNING_ERROR = "miniappMemorywarningError"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Client, EventTypes, createExtensionUI, defineExtension, isEvent };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var _=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames,U=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var v=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))N.call(t,n)&&v(e,n,t[n]);if(U)for(var n of U(t))$.call(t,n)&&v(e,n,t[n]);return e};var B=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of J(t))!N.call(e,i)&&i!==n&&_(e,i,{get:()=>t[i],enumerable:!(r=F(t,i))||r.enumerable});return e};var q=e=>H(_({},"__esModule",{value:!0}),e);var Z={};B(Z,{Client:()=>Y,EventTypes:()=>K,createExtensionUI:()=>Q,defineExtension:()=>z,isEvent:()=>M});module.exports=q(Z);var m=require("@ohbug/utils");var u=require("@ohbug/utils"),V={apiKey:{defaultValue:void 0,message:"is required",validate:e=>Boolean(e)&&(0,u.isString)(e)},appVersion:{defaultValue:void 0,message:"should be a string",validate:e=>e===void 0||(0,u.isString)(e)},appType:{defaultValue:void 0,message:"should be a string",validate:e=>e===void 0||(0,u.isString)(e)},releaseStage:{defaultValue:"production",message:"should be a string",validate:e=>e===void 0||(0,u.isString)(e)},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:e=>e===void 0||(0,u.isString)(e)},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:e=>e===void 0||(0,u.isNumber)(e)&&e>=1&&e<=100},onEvent:{defaultValue:e=>e,message:"should be a function",validate:e=>e===void 0||(0,u.isFunction)(e)},onNotify:{defaultValue:()=>{},message:"should be a function",validate:e=>e===void 0||(0,u.isFunction)(e)},logger:{defaultValue:u.logger,message:"should be null or an object with methods { log, info, warn, error }",validate:e=>e===void 0||e&&["log","info","warn","error"].reduce((t,n)=>t&&typeof e[n]=="function",!0)},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:e=>e===void 0||(0,u.isObject)(e)&&Object.keys(e).length<=6},metaData:{defaultValue:void 0,message:"should be an object",validate:e=>e===void 0||(0,u.isObject)(e)}};var c=require("@ohbug/utils");var p=class{type;timestamp;message;data;constructor(t,n,r,i){this.type=r,this.timestamp=i||new Date().toISOString(),this.message=t,this.data=n}};function W(e,t){return new Error(`Invalid configuration
|
|
2
|
+
${Object.keys(e).map(n=>`- ${n} ${e[n]}, got ${JSON.stringify(t[n])}`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
`)}function y(e,t){return new Error(`Invalid data
|
|
5
|
+
- ${e}, got ${JSON.stringify(t)}`)}function D(e,t,n){!t||(e[t]=n)}function E(e,t){if(e[t])return e[t]}function C(e,t){if(e[t])return delete e[t]}var S=class{apiKey;appVersion;appType;timestamp;category;type;sdk;device;detail;user;actions;metaData;releaseStage;__client;constructor(t,n){let{apiKey:r,appVersion:i,appType:o,releaseStage:a,timestamp:h,category:g,type:d,sdk:f,detail:b,device:R,user:x,actions:G,metaData:A}=t;this.apiKey=r,this.appVersion=i,this.appType=o,this.releaseStage=a,this.timestamp=h,this.category=g,this.type=d,this.sdk=f,this.detail=b,this.device=R,this.user=x,this.actions=G,this.metaData=A!=null?A:{},this.__client=n}get __isOhbugEvent(){return!0}addAction(t,n,r,i){var f,b;let o=this.actions,a=(0,c.isString)(t)?t:"",h=n||{},g=(0,c.isString)(r)?r:"",d=new p(a,h,g,i);o.length>=((b=(f=this.__client)==null?void 0:f.__config.maxActions)!=null?b:30)&&o.shift(),o.push(d)}getUser(){return this.user}setUser(t){var n;if((0,c.isObject)(t)&&Object.keys(t).length<=6)return this.user=O(O({},this.user),t),this.getUser();(n=this.__client)==null||n.__logger.error(y("setUser should be an object and have up to 6 attributes",t))}addMetaData(t,n){return D(this.metaData,t,n)}getMetaData(t){return E(this.metaData,t)}deleteMetaData(t){return C(this.metaData,t)}toJSON(){let{apiKey:t,appVersion:n,appType:r,timestamp:i,category:o,type:a,sdk:h,device:g,detail:d,user:f,actions:b,metaData:R,releaseStage:x}=this;return{apiKey:t,appVersion:n,appType:r,timestamp:i,category:o,type:a,sdk:h,device:g,detail:d,user:f,actions:b,metaData:R,releaseStage:x}}};function w(e,t){let{apiKey:n,appVersion:r,appType:i,releaseStage:o}=t.__config,a=new Date().toISOString(),h=t.__device(t),g,d,f;return(0,c.isObject)(e)&&Object.prototype.hasOwnProperty.call(e,"type")&&Object.prototype.hasOwnProperty.call(e,"detail")?(g=e.category||"error",d=e.type,f=e.detail):(g="error",d="unknownError",f=e),new S({apiKey:n,appVersion:r,appType:i,timestamp:a,category:g,type:d,sdk:t.__sdk,device:h,user:t.__user,detail:f,actions:t.__actions,metaData:t.__metaData,releaseStage:o},t)}function j(e,t){let n=[t.__config.onEvent,...t.__extensions.map(({onEvent:r})=>r)].filter(r=>(0,c.isFunction)(r));return n.length===0?e:n.reduce((r,i)=>r&&(0,c.isFunction)(i)?i(r,t):null,e)}function M(e){return Boolean(e==null?void 0:e.__isOhbugEvent)}var I=require("@ohbug/utils");function X(e,t){[t.__config.onNotify,...t.__extensions.filter(({onNotify:r})=>(0,I.isFunction)(r)).map(({onNotify:r})=>r)].forEach(r=>r==null?void 0:r(e,t))}async function k(e,t){try{let n=null;return e&&(n=await t.__notifier(e),X(e,t)),n}catch(n){t.__logger.error(n)}}function P(e,t){return Object.keys(t).reduce((r,i)=>{let o=e[i],{defaultValue:a,message:h,validate:g}=t[i];return o!==void 0?g(o)?r.config[i]=o:(r.config[i]=a,r.errors[i]=h):r.config[i]=a,r},{config:{},errors:{}})}var Y=class{__sdk;__config;__logger;__device;__notifier;__extensions;__actions;__user;__metaData;constructor({sdk:t,config:n,schema:r=V,device:i,notifier:o}){let{config:a,errors:h}=P(n,r);this.__sdk=t,this.__config=a,this.__logger=a.logger,this.__device=i,this.__notifier=o,this.__extensions=[],this.__actions=[],this.__user=a.user,this.__metaData={},(0,m.isObject)(a.metaData)&&Object.keys(a.metaData).forEach(g=>{this.addMetaData(g,a.metaData[g])}),Object.keys(h).length&&this.__logger.warn(W(h,n))}use(t){var n;return this.__extensions.push(t),(n=t.setup)==null||n.call(t,this),this}createEvent(t){let n=w(t,this);return j(n,this)}notify(t,n){let r;return Boolean(t)&&!M(t)?r=this.createEvent(t):r=t,n&&(r=n(r)),k(r,this)}addAction(t,n,r,i){let o=this.__actions,a=(0,m.isString)(t)?t:"",h=n||{},g=(0,m.isString)(r)?r:"",d=new p(a,h,g,i);o.length>=this.__config.maxActions&&o.shift(),o.push(d)}getUser(){return this.__user}setUser(t){if((0,m.isObject)(t)&&Object.keys(t).length<=6)return this.__user=O(O({},this.__user),t),this.getUser();this.__logger.warn(y("setUser should be an object and have up to 6 attributes",t))}addMetaData(t,n){return D(this.__metaData,t,n)}getMetaData(t){return E(this.__metaData,t)}deleteMetaData(t){return C(this.__metaData,t)}};function z(e){return e}function Q(e){return e}var K=(s=>(s.UNCAUGHT_ERROR="uncaughtError",s.RESOURCE_ERROR="resourceError",s.UNHANDLEDREJECTION_ERROR="unhandledrejectionError",s.AJAX_ERROR="ajaxError",s.FETCH_ERROR="fetchError",s.WEBSOCKET_ERROR="websocketError",s.UNKNOWN_ERROR="unknownError",s.MESSAGE="message",s.FEEDBACK="feedback",s.VIEW="view",s.REACT="react",s.VUE="vue",s.ANGULAR="angular",s.MINIAPP_ERROR="miniappError",s.MINIAPP_UNHANDLEDREJECTION_ERROR="miniappUnhandledrejectionError",s.MINIAPP_PAGENOTFOUND_ERROR="miniappPagenotfoundError",s.MINIAPP_MEMORYWARNING_ERROR="miniappMemorywarningError",s))(K||{});0&&(module.exports={Client,EventTypes,createExtensionUI,defineExtension,isEvent});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var $=Object.defineProperty;var A=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var S=(e,t,n)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))B.call(t,n)&&S(e,n,t[n]);if(A)for(var n of A(t))H.call(t,n)&&S(e,n,t[n]);return e};import{isObject as G,isString as F}from"@ohbug/utils";import{isFunction as U,isNumber as q,isObject as v,isString as p,logger as X}from"@ohbug/utils";var N={apiKey:{defaultValue:void 0,message:"is required",validate:e=>Boolean(e)&&p(e)},appVersion:{defaultValue:void 0,message:"should be a string",validate:e=>e===void 0||p(e)},appType:{defaultValue:void 0,message:"should be a string",validate:e=>e===void 0||p(e)},releaseStage:{defaultValue:"production",message:"should be a string",validate:e=>e===void 0||p(e)},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:e=>e===void 0||p(e)},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:e=>e===void 0||q(e)&&e>=1&&e<=100},onEvent:{defaultValue:e=>e,message:"should be a function",validate:e=>e===void 0||U(e)},onNotify:{defaultValue:()=>{},message:"should be a function",validate:e=>e===void 0||U(e)},logger:{defaultValue:X,message:"should be null or an object with methods { log, info, warn, error }",validate:e=>e===void 0||e&&["log","info","warn","error"].reduce((t,n)=>t&&typeof e[n]=="function",!0)},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:e=>e===void 0||v(e)&&Object.keys(e).length<=6},metaData:{defaultValue:void 0,message:"should be an object",validate:e=>e===void 0||v(e)}};import{isFunction as W,isObject as j,isString as w}from"@ohbug/utils";var O=class{type;timestamp;message;data;constructor(t,n,r,i){this.type=r,this.timestamp=i||new Date().toISOString(),this.message=t,this.data=n}};function V(e,t){return new Error(`Invalid configuration
|
|
2
|
+
${Object.keys(e).map(n=>`- ${n} ${e[n]}, got ${JSON.stringify(t[n])}`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
`)}function m(e,t){return new Error(`Invalid data
|
|
5
|
+
- ${e}, got ${JSON.stringify(t)}`)}function _(e,t,n){!t||(e[t]=n)}function y(e,t){if(e[t])return e[t]}function D(e,t){if(e[t])return delete e[t]}var R=class{apiKey;appVersion;appType;timestamp;category;type;sdk;device;detail;user;actions;metaData;releaseStage;__client;constructor(t,n){let{apiKey:r,appVersion:i,appType:o,releaseStage:a,timestamp:u,category:g,type:h,sdk:d,detail:c,device:E,user:C,actions:J,metaData:M}=t;this.apiKey=r,this.appVersion=i,this.appType=o,this.releaseStage=a,this.timestamp=u,this.category=g,this.type=h,this.sdk=d,this.detail=c,this.device=E,this.user=C,this.actions=J,this.metaData=M!=null?M:{},this.__client=n}get __isOhbugEvent(){return!0}addAction(t,n,r,i){var d,c;let o=this.actions,a=w(t)?t:"",u=n||{},g=w(r)?r:"",h=new O(a,u,g,i);o.length>=((c=(d=this.__client)==null?void 0:d.__config.maxActions)!=null?c:30)&&o.shift(),o.push(h)}getUser(){return this.user}setUser(t){var n;if(j(t)&&Object.keys(t).length<=6)return this.user=b(b({},this.user),t),this.getUser();(n=this.__client)==null||n.__logger.error(m("setUser should be an object and have up to 6 attributes",t))}addMetaData(t,n){return _(this.metaData,t,n)}getMetaData(t){return y(this.metaData,t)}deleteMetaData(t){return D(this.metaData,t)}toJSON(){let{apiKey:t,appVersion:n,appType:r,timestamp:i,category:o,type:a,sdk:u,device:g,detail:h,user:d,actions:c,metaData:E,releaseStage:C}=this;return{apiKey:t,appVersion:n,appType:r,timestamp:i,category:o,type:a,sdk:u,device:g,detail:h,user:d,actions:c,metaData:E,releaseStage:C}}};function I(e,t){let{apiKey:n,appVersion:r,appType:i,releaseStage:o}=t.__config,a=new Date().toISOString(),u=t.__device(t),g,h,d;return j(e)&&Object.prototype.hasOwnProperty.call(e,"type")&&Object.prototype.hasOwnProperty.call(e,"detail")?(g=e.category||"error",h=e.type,d=e.detail):(g="error",h="unknownError",d=e),new R({apiKey:n,appVersion:r,appType:i,timestamp:a,category:g,type:h,sdk:t.__sdk,device:u,user:t.__user,detail:d,actions:t.__actions,metaData:t.__metaData,releaseStage:o},t)}function k(e,t){let n=[t.__config.onEvent,...t.__extensions.map(({onEvent:r})=>r)].filter(r=>W(r));return n.length===0?e:n.reduce((r,i)=>r&&W(i)?i(r,t):null,e)}function x(e){return Boolean(e==null?void 0:e.__isOhbugEvent)}import{isFunction as Y}from"@ohbug/utils";function z(e,t){[t.__config.onNotify,...t.__extensions.filter(({onNotify:r})=>Y(r)).map(({onNotify:r})=>r)].forEach(r=>r==null?void 0:r(e,t))}async function P(e,t){try{let n=null;return e&&(n=await t.__notifier(e),z(e,t)),n}catch(n){t.__logger.error(n)}}function K(e,t){return Object.keys(t).reduce((r,i)=>{let o=e[i],{defaultValue:a,message:u,validate:g}=t[i];return o!==void 0?g(o)?r.config[i]=o:(r.config[i]=a,r.errors[i]=u):r.config[i]=a,r},{config:{},errors:{}})}var _t=class{__sdk;__config;__logger;__device;__notifier;__extensions;__actions;__user;__metaData;constructor({sdk:t,config:n,schema:r=N,device:i,notifier:o}){let{config:a,errors:u}=K(n,r);this.__sdk=t,this.__config=a,this.__logger=a.logger,this.__device=i,this.__notifier=o,this.__extensions=[],this.__actions=[],this.__user=a.user,this.__metaData={},G(a.metaData)&&Object.keys(a.metaData).forEach(g=>{this.addMetaData(g,a.metaData[g])}),Object.keys(u).length&&this.__logger.warn(V(u,n))}use(t){var n;return this.__extensions.push(t),(n=t.setup)==null||n.call(t,this),this}createEvent(t){let n=I(t,this);return k(n,this)}notify(t,n){let r;return Boolean(t)&&!x(t)?r=this.createEvent(t):r=t,n&&(r=n(r)),P(r,this)}addAction(t,n,r,i){let o=this.__actions,a=F(t)?t:"",u=n||{},g=F(r)?r:"",h=new O(a,u,g,i);o.length>=this.__config.maxActions&&o.shift(),o.push(h)}getUser(){return this.__user}setUser(t){if(G(t)&&Object.keys(t).length<=6)return this.__user=b(b({},this.__user),t),this.getUser();this.__logger.warn(m("setUser should be an object and have up to 6 attributes",t))}addMetaData(t,n){return _(this.__metaData,t,n)}getMetaData(t){return y(this.__metaData,t)}deleteMetaData(t){return D(this.__metaData,t)}};function Et(e){return e}function Ct(e){return e}var Q=(s=>(s.UNCAUGHT_ERROR="uncaughtError",s.RESOURCE_ERROR="resourceError",s.UNHANDLEDREJECTION_ERROR="unhandledrejectionError",s.AJAX_ERROR="ajaxError",s.FETCH_ERROR="fetchError",s.WEBSOCKET_ERROR="websocketError",s.UNKNOWN_ERROR="unknownError",s.MESSAGE="message",s.FEEDBACK="feedback",s.VIEW="view",s.REACT="react",s.VUE="vue",s.ANGULAR="angular",s.MINIAPP_ERROR="miniappError",s.MINIAPP_UNHANDLEDREJECTION_ERROR="miniappUnhandledrejectionError",s.MINIAPP_PAGENOTFOUND_ERROR="miniappPagenotfoundError",s.MINIAPP_MEMORYWARNING_ERROR="miniappMemorywarningError",s))(Q||{});export{_t as Client,Q as EventTypes,Ct as createExtensionUI,Et as defineExtension,x as isEvent};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Responsible for managing Ohbug's workflow",
|
|
5
|
+
"license": "Apache-2.0",
|
|
5
6
|
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
6
7
|
"homepage": "https://github.com/ohbug-org/ohbug",
|
|
7
8
|
"bugs": {
|
|
@@ -11,35 +12,30 @@
|
|
|
11
12
|
"type": "git",
|
|
12
13
|
"url": "https://github.com/ohbug-org/ohbug"
|
|
13
14
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"unpkg": "./dist/ohbug-core.umd.js",
|
|
18
|
-
"jsdelivr": "./dist/ohbug-core.umd.js",
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"module": "dist/index.mjs",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
20
18
|
"exports": {
|
|
21
19
|
".": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"require": "./dist/index.js",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
24
23
|
}
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"dist"
|
|
28
27
|
],
|
|
29
|
-
"
|
|
30
|
-
"name": "OhbugCore",
|
|
31
|
-
"formats": [
|
|
32
|
-
"es",
|
|
33
|
-
"umd"
|
|
34
|
-
],
|
|
35
|
-
"order": 2
|
|
36
|
-
},
|
|
28
|
+
"sideEffects": false,
|
|
37
29
|
"publishConfig": {
|
|
38
30
|
"access": "public"
|
|
39
31
|
},
|
|
40
32
|
"dependencies": {
|
|
41
|
-
"@ohbug/types": "
|
|
42
|
-
"@ohbug/utils": "
|
|
33
|
+
"@ohbug/types": "2.0.2",
|
|
34
|
+
"@ohbug/utils": "2.0.2"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"dev": "tsup --watch"
|
|
43
39
|
},
|
|
44
|
-
"
|
|
45
|
-
}
|
|
40
|
+
"readme": "# `@ohbug/core`\n\n[](https://www.npmjs.com/package/@ohbug/core)\n[](https://bundlephobia.com/result?p=@ohbug/core)\n\nEnglish | [简体中文](./README-zh_CN.md)\n\n## Introduction\n\nohbug's core module is responsible for managing ohbug's workflow.\n\n## Installation\n\n```\npnpm instal @ohbug/core\n```\n"
|
|
41
|
+
}
|
package/dist/action.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { OhbugAction } from '@ohbug/types';
|
|
2
|
-
export declare class Action implements OhbugAction {
|
|
3
|
-
readonly type: string;
|
|
4
|
-
readonly timestamp: string;
|
|
5
|
-
readonly message: string;
|
|
6
|
-
readonly data: Record<string, any>;
|
|
7
|
-
constructor(message: string, data: Record<string, any>, type: string, timestamp?: string);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=action.d.ts.map
|
package/dist/action.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,qBAAa,MAAO,YAAW,WAAW;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;gBAGhC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM;CAOrB"}
|
package/dist/client.d.ts
DELETED
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOV,sBAAsB,EASvB,MAAM,cAAc,CAAA;AAYrB,eAAO,MAAM,MAAM,EAAE,sBAsMpB,CAAA"}
|
package/dist/config.d.ts
DELETED
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAA;AAEtE,eAAO,MAAM,MAAM,EAAE,WAuEpB,CAAA"}
|
package/dist/event.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { OhbugEventWithMethods, OhbugEvent, OhbugCreateEvent, OhbugClient, OhbugUser, OhbugAction, OhbugCategory, OhbugDevice, OhbugReleaseStage, OhbugSDK, OhbugMetaData } from '@ohbug/types';
|
|
2
|
-
export declare class Event<D> implements OhbugEventWithMethods<D> {
|
|
3
|
-
readonly apiKey: string;
|
|
4
|
-
readonly appVersion?: string;
|
|
5
|
-
readonly appType?: string;
|
|
6
|
-
readonly timestamp: string;
|
|
7
|
-
readonly category?: OhbugCategory;
|
|
8
|
-
readonly type: string;
|
|
9
|
-
readonly sdk: OhbugSDK;
|
|
10
|
-
readonly device: OhbugDevice;
|
|
11
|
-
readonly detail: D;
|
|
12
|
-
user?: OhbugUser;
|
|
13
|
-
readonly actions?: OhbugAction[];
|
|
14
|
-
readonly metaData: OhbugMetaData;
|
|
15
|
-
readonly releaseStage?: OhbugReleaseStage;
|
|
16
|
-
readonly _client?: OhbugClient;
|
|
17
|
-
constructor(values: OhbugEvent<D>, client?: OhbugClient);
|
|
18
|
-
get _isOhbugEvent(): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Add an action.
|
|
21
|
-
* Once the threshold is reached, the oldest breadcrumbs will be deleted.
|
|
22
|
-
* 新增一个动作。
|
|
23
|
-
* 一旦达到阈值,最老的 Action 将被删除。
|
|
24
|
-
*
|
|
25
|
-
* @param message
|
|
26
|
-
* @param data
|
|
27
|
-
* @param type
|
|
28
|
-
* @param timestamp
|
|
29
|
-
*/
|
|
30
|
-
addAction(message: string, data: Record<string, any>, type: string, timestamp?: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Get current user information
|
|
33
|
-
* 获取当前的用户信息
|
|
34
|
-
*/
|
|
35
|
-
getUser(): OhbugUser | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Set current user information
|
|
38
|
-
* 设置当前的用户信息
|
|
39
|
-
*/
|
|
40
|
-
setUser(user: OhbugUser): OhbugUser | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Add metaData
|
|
43
|
-
* 新增 metaData
|
|
44
|
-
*
|
|
45
|
-
* @param section
|
|
46
|
-
* @param data
|
|
47
|
-
*/
|
|
48
|
-
addMetaData(section: string, data: any): void;
|
|
49
|
-
/**
|
|
50
|
-
* Get metaData
|
|
51
|
-
* 获取 metaData
|
|
52
|
-
*
|
|
53
|
-
* @param section
|
|
54
|
-
*/
|
|
55
|
-
getMetaData(section: string): any;
|
|
56
|
-
/**
|
|
57
|
-
* Delete metaData
|
|
58
|
-
* 删除 metaData
|
|
59
|
-
*
|
|
60
|
-
* @param section
|
|
61
|
-
*/
|
|
62
|
-
deleteMetaData(section: string): boolean | undefined;
|
|
63
|
-
toJSON(): {
|
|
64
|
-
apiKey: string;
|
|
65
|
-
appVersion: string | undefined;
|
|
66
|
-
appType: string | undefined;
|
|
67
|
-
timestamp: string;
|
|
68
|
-
category: OhbugCategory | undefined;
|
|
69
|
-
type: string;
|
|
70
|
-
sdk: OhbugSDK;
|
|
71
|
-
device: OhbugDevice;
|
|
72
|
-
detail: D;
|
|
73
|
-
user: OhbugUser | undefined;
|
|
74
|
-
actions: OhbugAction[] | undefined;
|
|
75
|
-
metaData: OhbugMetaData;
|
|
76
|
-
releaseStage: string | undefined;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export declare function createEvent<D>(values: OhbugCreateEvent<D>, client: OhbugClient): OhbugEventWithMethods<D>;
|
|
80
|
-
export declare function isEvent(eventLike: any): eventLike is OhbugEventWithMethods<any>;
|
|
81
|
-
//# sourceMappingURL=event.d.ts.map
|
package/dist/event.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACd,MAAM,cAAc,CAAA;AAOrB,qBAAa,KAAK,CAAC,CAAC,CAAE,YAAW,qBAAqB,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IAEvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAE5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;IAEjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAA;IAEtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAE5B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAElB,IAAI,CAAC,EAAE,SAAS,CAAA;IAEhB,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;IAEhC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAEhC,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAEzC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAA;gBAElB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW;IAmCvD,IAAI,aAAa,YAEhB;IAED;;;;;;;;;;OAUG;IACH,SAAS,CACP,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI;IAcP;;;OAGG;IACH,OAAO,IAAI,SAAS,GAAG,SAAS;IAIhC;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS;IAc/C;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAItC;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM;IAI3B;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM;IAI9B,MAAM;;;;;;;;;;;;;;;CAgCP;AAED,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC3B,MAAM,EAAE,WAAW,GAClB,qBAAqB,CAAC,CAAC,CAAC,CAuC1B;AAED,wBAAgB,OAAO,CACrB,SAAS,EAAE,GAAG,GACb,SAAS,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAEzC"}
|
package/dist/extension.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { OhbugClient, OhbugExtension, OhbugExtensionUI } from '@ohbug/types';
|
|
2
|
-
export declare function createExtension(extension: OhbugExtension): OhbugExtension<any>;
|
|
3
|
-
export declare function createExtensionUI(extensionUI: OhbugExtensionUI): OhbugExtensionUI;
|
|
4
|
-
/**
|
|
5
|
-
* Extension loading and initialization
|
|
6
|
-
*
|
|
7
|
-
* @param extension
|
|
8
|
-
* @param client
|
|
9
|
-
* @param args
|
|
10
|
-
*/
|
|
11
|
-
export declare function loadExtension(extension: OhbugExtension, client: OhbugClient, ...args: any[]): OhbugClient | any;
|
|
12
|
-
//# sourceMappingURL=extension.d.ts.map
|
package/dist/extension.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,cAAc,EACd,gBAAgB,EACjB,MAAM,cAAc,CAAA;AAGrB,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,uBAExD;AACD,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,oBAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,WAAW,EACnB,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,WAAW,GAAG,GAAG,CAoCnB"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAChE,cAAc,SAAS,CAAA;AACvB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { OhbugConfig } from '@ohbug/types';
|
|
2
|
-
export declare function getConfigErrorMessage(errors: Record<keyof OhbugConfig, string>, config: OhbugConfig): Error;
|
|
3
|
-
export declare function getErrorMessage(message: string, data: any): Error;
|
|
4
|
-
//# sourceMappingURL=getErrorMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getErrorMessage.d.ts","sourceRoot":"","sources":["../../../../packages/ohbug-core/src/lib/getErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,EACzC,MAAM,EAAE,WAAW,SAWpB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,SAEzD"}
|
package/dist/lib/metaData.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { OhbugMetaData } from '@ohbug/types';
|
|
2
|
-
export declare function addMetaData(map: OhbugMetaData, section: string, data: any): void;
|
|
3
|
-
export declare function getMetaData(map: OhbugMetaData, section: string): any;
|
|
4
|
-
export declare function deleteMetaData(map: OhbugMetaData, section: string): boolean | undefined;
|
|
5
|
-
//# sourceMappingURL=metaData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metaData.d.ts","sourceRoot":"","sources":["../../../../packages/ohbug-core/src/lib/metaData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAIzE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAM9D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,uBAMjE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { OhbugConfig, OhbugSchema } from '@ohbug/types';
|
|
2
|
-
interface ConfigAndErrors {
|
|
3
|
-
config: Record<keyof OhbugConfig, any>;
|
|
4
|
-
errors: Record<keyof OhbugConfig, string>;
|
|
5
|
-
}
|
|
6
|
-
export declare function verifyConfig(config: OhbugConfig, schema: OhbugSchema): ConfigAndErrors;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=verifyConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyConfig.d.ts","sourceRoot":"","sources":["../../../../packages/ohbug-core/src/lib/verifyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,WAAW,EAAE,GAAG,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,CAAA;CAC1C;AACD,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,mBA4BpE"}
|
package/dist/notify.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { OhbugClient, OhbugEventWithMethods } from '@ohbug/types';
|
|
2
|
-
/**
|
|
3
|
-
* Used to control the timing of reporting events and the related life cycle.
|
|
4
|
-
*
|
|
5
|
-
* @param event
|
|
6
|
-
* @param client
|
|
7
|
-
*/
|
|
8
|
-
export declare function notify<D>(event: OhbugEventWithMethods<D> | false, client: OhbugClient): Promise<any>;
|
|
9
|
-
//# sourceMappingURL=notify.d.ts.map
|
package/dist/notify.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAGtE;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAC5B,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,EACvC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,GAAG,CAAC,CAad"}
|
package/dist/ohbug-core.es.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */
|
|
15
|
-
var e=function(){return(e=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}).apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(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(i,u)}s((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function r(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */function o(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}function a(e){return"string"==typeof e}function i(e){return"function"==typeof e}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}var s={apiKey:{defaultValue:void 0,message:"is required",validate:function(e){return Boolean(e)&&a(e)}},appVersion:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||a(e)}},appType:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||a(e)}},releaseStage:{defaultValue:"production",message:"should be a string",validate:function(e){return void 0===e||a(e)}},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:function(e){return void 0===e||a(e)}},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:function(e){return void 0===e||function(e){return"number"==typeof e&&parseInt(""+e,10)===e}(e)&&e>=1&&e<=100}},created:{defaultValue:function(e){return e},message:"should be a function",validate:function(e){return void 0===e||i(e)}},notified:{defaultValue:function(){},message:"should be a function",validate:function(e){return void 0===e||i(e)}},logger:{defaultValue:{log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,o(["Ohbug"],e))},info:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.info.apply(console,o(["Ohbug"],e))},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,o(["Ohbug"],e))},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["Ohbug"],e))}},message:"should be null or an object with methods { log, info, warn, error }",validate:function(e){return void 0===e||e&&["log","info","warn","error"].reduce((function(t,n){return t&&"function"==typeof e[n]}),!0)}},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:function(e){return void 0===e||u(e)&&Object.keys(e).length<=6}},metaData:{defaultValue:void 0,message:"should be an object",validate:function(e){return void 0===e||u(e)}}};function c(e){return e}function l(e){return e}function f(e,t){for(var n,o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];var u=null===(n=e.init)||void 0===n?void 0:n.call.apply(n,r([e,t],o));return t._extensions.push(e),t._hooks.created=function(e,t){var n,o,a=r([t._config.created],t._extensions.filter((function(e){return i(e.created)})).map((function(e){return e.created})));return 0===a.length?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}(e,t):1===a.length?null===(n=a[0])||void 0===n?void 0:n.call(a,e,t):null===(o=a.reduce((function(e,n){return function(r){return n(e(r,t),t)}})))||void 0===o?void 0:o(e,t)},t._hooks.notified=function(e,t){return r([t._config.notified],t._extensions.filter((function(e){return i(e.notified)})).map((function(e){return e.notified}))).forEach((function(n){return null==n?void 0:n(e,t)}))},u||t}var p=function(e,t,n,r){this.type=n,this.timestamp=r||(new Date).toISOString(),this.message=e,this.data=t};function d(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}function h(e,t,n){t&&(e[t]=n)}function g(e,t){if(e[t])return e[t]}function v(e,t){if(e[t])return delete e[t]}var y=function(){function t(e,t){var n=e.apiKey,r=e.appVersion,o=e.appType,a=e.releaseStage,i=e.timestamp,u=e.category,s=e.type,c=e.sdk,l=e.detail,f=e.device,p=e.user,d=e.actions,h=e.metaData;this.apiKey=n,this.appVersion=r,this.appType=o,this.releaseStage=a,this.timestamp=i,this.category=u,this.type=s,this.sdk=c,this.detail=l,this.device=f,this.user=p,this.actions=d,this.metaData=h,this._client=t}return Object.defineProperty(t.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.addAction=function(e,t,n,r){var o,i,u=this.actions,s=a(e)?e:"",c=t||{},l=a(n)?n:"",f=new p(s,c,l,r);u.length>=(null!==(i=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==i?i:30)&&u.shift(),u.push(f)},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(t){var n;if(u(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(n=this._client)||void 0===n||n._logger.warn(d("setUser should be an object and have up to 6 attributes",t))},t.prototype.addMetaData=function(e,t){return h(this.metaData,e,t)},t.prototype.getMetaData=function(e){return g(this.metaData,e)},t.prototype.deleteMetaData=function(e){return v(this.metaData,e)},t.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}},t}();function m(e){return Boolean(null==e?void 0:e._isOhbugEvent)}var b=function(){function o(e){var t=this,n=e.sdk,r=e.config,o=e.schema,a=void 0===o?s:o,i=e.device,c=e.notifier,l=function(e,t){return Object.keys(t).reduce((function(n,r){var o=e[r],a=t[r],i=a.defaultValue,u=a.message,s=a.validate;return void 0!==o?s(o)?n.config[r]=o:(n.config[r]=i,n.errors[r]=u):n.config[r]=i,n}),{config:{},errors:{}})}(r,a),f=l.config,p=l.errors;this._sdk=n,this._config=f,this._logger=f.logger,this._device=i,this._notifier=c,this._extensions=[],this._hooks={created:f.created,notified:f.notified},this._actions=[],this._user=f.user,this._metaData={},u(f.metaData)&&Object.keys(f.metaData).forEach((function(e){t.addMetaData(e,f.metaData[e])})),Object.keys(p).length&&this._logger.warn(function(e,t){return new Error("Invalid configuration\n"+Object.keys(e).map((function(n){return"- "+n+" "+e[n]+", got "+JSON.stringify(t[n])})).join("\n")+"\n ")}(p,r))}return o.prototype.use=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return f.apply(void 0,r([e,this],t))},o.prototype.createEvent=function(e){var t,n,r,o,a,s,c,l,f,p,d,h,g=(t=e,s=(n=this)._config,c=s.apiKey,l=s.appVersion,f=s.appType,p=s.releaseStage,d=(new Date).toISOString(),h=n._device(n),u(t)&&Object.prototype.hasOwnProperty.call(t,"type")&&Object.prototype.hasOwnProperty.call(t,"detail")?(r=t.category||"error",o=t.type,a=t.detail):(r="error",o="unknownError",a=t),new y({apiKey:c,appVersion:l,appType:f,timestamp:d,category:r,type:o,sdk:n._sdk,device:h,user:n._user,detail:a,actions:n._actions,metaData:n._metaData,releaseStage:p},n));return i(this._hooks.created)?this._hooks.created(g,this):g},o.prototype.notify=function(e,r){var o;return o=Boolean(e)&&!m(e)?this.createEvent(e):e,r&&(o=r(o)),function(e,r){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),t=null,e?[4,r._notifier(e)]:[3,2];case 1:t=n.sent(),n.label=2;case 2:return i(r._hooks.notified)&&r._hooks.notified(e,r),[2,t];case 3:return o=n.sent(),r._logger.error(o),[3,4];case 4:return[2]}}))}))}(o,this)},o.prototype.addAction=function(e,t,n,r){var o=this._actions,i=a(e)?e:"",u=t||{},s=a(n)?n:"",c=new p(i,u,s,r);o.length>=this._config.maxActions&&o.shift(),o.push(c)},o.prototype.getUser=function(){return this._user},o.prototype.setUser=function(t){if(u(t)&&Object.keys(t).length<=6)return this._user=e(e({},this._user),t),this.getUser();this._logger.warn(d("setUser should be an object and have up to 6 attributes",t))},o.prototype.addMetaData=function(e,t){return h(this._metaData,e,t)},o.prototype.getMetaData=function(e){return g(this._metaData,e)},o.prototype.deleteMetaData=function(e){return v(this._metaData,e)},o}(),_="uncaughtError",E="resourceError",O="unhandledrejectionError",R="ajaxError",w="fetchError",k="websocketError",D="unknownError",j="message",N="feedback",A="view",S="react",V="vue",U="angular",I="miniappError",M="miniappUnhandledrejectionError",P="miniappPagenotfoundError",x="miniappMemorywarningError",T=Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});export{R as AJAX_ERROR,U as ANGULAR,b as Client,N as FEEDBACK,w as FETCH_ERROR,j as MESSAGE,I as MINIAPP_ERROR,x as MINIAPP_MEMORYWARNING_ERROR,P as MINIAPP_PAGENOTFOUND_ERROR,M as MINIAPP_UNHANDLEDREJECTION_ERROR,S as REACT,E as RESOURCE_ERROR,_ as UNCAUGHT_ERROR,O as UNHANDLEDREJECTION_ERROR,D as UNKNOWN_ERROR,A as VIEW,V as VUE,k as WEBSOCKET_ERROR,c as createExtension,l as createExtensionUI,m as isEvent,T as types};
|
package/dist/ohbug-core.umd.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OhbugCore={})}(this,(function(e){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var t=function(){return(t=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}).apply(this,arguments)};function n(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 u(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,u)}s((r=r.apply(e,t||[])).next())}))}function r(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:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){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,u])}}}function o(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */function i(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}function a(e){return"string"==typeof e}function u(e){return"function"==typeof e}function s(e){return"[object Object]"===Object.prototype.toString.call(e)}var c={apiKey:{defaultValue:void 0,message:"is required",validate:function(e){return Boolean(e)&&a(e)}},appVersion:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||a(e)}},appType:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||a(e)}},releaseStage:{defaultValue:"production",message:"should be a string",validate:function(e){return void 0===e||a(e)}},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:function(e){return void 0===e||a(e)}},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:function(e){return void 0===e||function(e){return"number"==typeof e&&parseInt(""+e,10)===e}(e)&&e>=1&&e<=100}},created:{defaultValue:function(e){return e},message:"should be a function",validate:function(e){return void 0===e||u(e)}},notified:{defaultValue:function(){},message:"should be a function",validate:function(e){return void 0===e||u(e)}},logger:{defaultValue:{log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,i(["Ohbug"],e))},info:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.info.apply(console,i(["Ohbug"],e))},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,i(["Ohbug"],e))},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,i(["Ohbug"],e))}},message:"should be null or an object with methods { log, info, warn, error }",validate:function(e){return void 0===e||e&&["log","info","warn","error"].reduce((function(t,n){return t&&"function"==typeof e[n]}),!0)}},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:function(e){return void 0===e||s(e)&&Object.keys(e).length<=6}},metaData:{defaultValue:void 0,message:"should be an object",validate:function(e){return void 0===e||s(e)}}};function l(e,t){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var a=null===(n=e.init)||void 0===n?void 0:n.call.apply(n,o([e,t],r));return t._extensions.push(e),t._hooks.created=function(e,t){var n,r,i=o([t._config.created],t._extensions.filter((function(e){return u(e.created)})).map((function(e){return e.created})));return 0===i.length?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}(e,t):1===i.length?null===(n=i[0])||void 0===n?void 0:n.call(i,e,t):null===(r=i.reduce((function(e,n){return function(r){return n(e(r,t),t)}})))||void 0===r?void 0:r(e,t)},t._hooks.notified=function(e,t){return o([t._config.notified],t._extensions.filter((function(e){return u(e.notified)})).map((function(e){return e.notified}))).forEach((function(n){return null==n?void 0:n(e,t)}))},a||t}var f=function(e,t,n,r){this.type=n,this.timestamp=r||(new Date).toISOString(),this.message=e,this.data=t};function p(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}function d(e,t,n){t&&(e[t]=n)}function h(e,t){if(e[t])return e[t]}function g(e,t){if(e[t])return delete e[t]}var v=function(){function e(e,t){var n=e.apiKey,r=e.appVersion,o=e.appType,i=e.releaseStage,a=e.timestamp,u=e.category,s=e.type,c=e.sdk,l=e.detail,f=e.device,p=e.user,d=e.actions,h=e.metaData;this.apiKey=n,this.appVersion=r,this.appType=o,this.releaseStage=i,this.timestamp=a,this.category=u,this.type=s,this.sdk=c,this.detail=l,this.device=f,this.user=p,this.actions=d,this.metaData=h,this._client=t}return Object.defineProperty(e.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.addAction=function(e,t,n,r){var o,i,u=this.actions,s=a(e)?e:"",c=t||{},l=a(n)?n:"",p=new f(s,c,l,r);u.length>=(null!==(i=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==i?i:30)&&u.shift(),u.push(p)},e.prototype.getUser=function(){return this.user},e.prototype.setUser=function(e){var n;if(s(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(n=this._client)||void 0===n||n._logger.warn(p("setUser should be an object and have up to 6 attributes",e))},e.prototype.addMetaData=function(e,t){return d(this.metaData,e,t)},e.prototype.getMetaData=function(e){return h(this.metaData,e)},e.prototype.deleteMetaData=function(e){return g(this.metaData,e)},e.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}},e}();function y(e){return Boolean(null==e?void 0:e._isOhbugEvent)}var E=function(){function e(e){var t=this,n=e.sdk,r=e.config,o=e.schema,i=void 0===o?c:o,a=e.device,u=e.notifier,l=function(e,t){return Object.keys(t).reduce((function(n,r){var o=e[r],i=t[r],a=i.defaultValue,u=i.message,s=i.validate;return void 0!==o?s(o)?n.config[r]=o:(n.config[r]=a,n.errors[r]=u):n.config[r]=a,n}),{config:{},errors:{}})}(r,i),f=l.config,p=l.errors;this._sdk=n,this._config=f,this._logger=f.logger,this._device=a,this._notifier=u,this._extensions=[],this._hooks={created:f.created,notified:f.notified},this._actions=[],this._user=f.user,this._metaData={},s(f.metaData)&&Object.keys(f.metaData).forEach((function(e){t.addMetaData(e,f.metaData[e])})),Object.keys(p).length&&this._logger.warn(function(e,t){return new Error("Invalid configuration\n"+Object.keys(e).map((function(n){return"- "+n+" "+e[n]+", got "+JSON.stringify(t[n])})).join("\n")+"\n ")}(p,r))}return e.prototype.use=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return l.apply(void 0,o([e,this],t))},e.prototype.createEvent=function(e){var t,n,r,o,i,a,c,l,f,p,d,h,g=(t=e,a=(n=this)._config,c=a.apiKey,l=a.appVersion,f=a.appType,p=a.releaseStage,d=(new Date).toISOString(),h=n._device(n),s(t)&&Object.prototype.hasOwnProperty.call(t,"type")&&Object.prototype.hasOwnProperty.call(t,"detail")?(r=t.category||"error",o=t.type,i=t.detail):(r="error",o="unknownError",i=t),new v({apiKey:c,appVersion:l,appType:f,timestamp:d,category:r,type:o,sdk:n._sdk,device:h,user:n._user,detail:i,actions:n._actions,metaData:n._metaData,releaseStage:p},n));return u(this._hooks.created)?this._hooks.created(g,this):g},e.prototype.notify=function(e,t){var o;return o=Boolean(e)&&!y(e)?this.createEvent(e):e,t&&(o=t(o)),function(e,t){return n(this,void 0,void 0,(function(){var n,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),n=null,e?[4,t._notifier(e)]:[3,2];case 1:n=r.sent(),r.label=2;case 2:return u(t._hooks.notified)&&t._hooks.notified(e,t),[2,n];case 3:return o=r.sent(),t._logger.error(o),[3,4];case 4:return[2]}}))}))}(o,this)},e.prototype.addAction=function(e,t,n,r){var o=this._actions,i=a(e)?e:"",u=t||{},s=a(n)?n:"",c=new f(i,u,s,r);o.length>=this._config.maxActions&&o.shift(),o.push(c)},e.prototype.getUser=function(){return this._user},e.prototype.setUser=function(e){if(s(e)&&Object.keys(e).length<=6)return this._user=t(t({},this._user),e),this.getUser();this._logger.warn(p("setUser should be an object and have up to 6 attributes",e))},e.prototype.addMetaData=function(e,t){return d(this._metaData,e,t)},e.prototype.getMetaData=function(e){return h(this._metaData,e)},e.prototype.deleteMetaData=function(e){return g(this._metaData,e)},e}(),R="uncaughtError",_="resourceError",b="unhandledrejectionError",O="ajaxError",m="fetchError",N="websocketError",D="unknownError",A="message",w="feedback",k="view",I="react",U="angular",j="miniappError",P="miniappUnhandledrejectionError",S="miniappPagenotfoundError",T="miniappMemorywarningError",M=Object.freeze({__proto__:null,UNCAUGHT_ERROR:R,RESOURCE_ERROR:_,UNHANDLEDREJECTION_ERROR:b,AJAX_ERROR:O,FETCH_ERROR:m,WEBSOCKET_ERROR:N,UNKNOWN_ERROR:D,MESSAGE:A,FEEDBACK:w,VIEW:k,REACT:I,VUE:"vue",ANGULAR:U,MINIAPP_ERROR:j,MINIAPP_UNHANDLEDREJECTION_ERROR:P,MINIAPP_PAGENOTFOUND_ERROR:S,MINIAPP_MEMORYWARNING_ERROR:T});e.AJAX_ERROR=O,e.ANGULAR=U,e.Client=E,e.FEEDBACK=w,e.FETCH_ERROR=m,e.MESSAGE=A,e.MINIAPP_ERROR=j,e.MINIAPP_MEMORYWARNING_ERROR=T,e.MINIAPP_PAGENOTFOUND_ERROR=S,e.MINIAPP_UNHANDLEDREJECTION_ERROR=P,e.REACT=I,e.RESOURCE_ERROR=_,e.UNCAUGHT_ERROR=R,e.UNHANDLEDREJECTION_ERROR=b,e.UNKNOWN_ERROR=D,e.VIEW=k,e.VUE="vue",e.WEBSOCKET_ERROR=N,e.createExtension=function(e){return e},e.createExtensionUI=function(e){return e},e.isEvent=y,e.types=M,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/dist/types.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const UNCAUGHT_ERROR = "uncaughtError";
|
|
2
|
-
export declare const RESOURCE_ERROR = "resourceError";
|
|
3
|
-
export declare const UNHANDLEDREJECTION_ERROR = "unhandledrejectionError";
|
|
4
|
-
export declare const AJAX_ERROR = "ajaxError";
|
|
5
|
-
export declare const FETCH_ERROR = "fetchError";
|
|
6
|
-
export declare const WEBSOCKET_ERROR = "websocketError";
|
|
7
|
-
export declare const UNKNOWN_ERROR = "unknownError";
|
|
8
|
-
export declare const MESSAGE = "message";
|
|
9
|
-
export declare const FEEDBACK = "feedback";
|
|
10
|
-
export declare const VIEW = "view";
|
|
11
|
-
export declare const REACT = "react";
|
|
12
|
-
export declare const VUE = "vue";
|
|
13
|
-
export declare const ANGULAR = "angular";
|
|
14
|
-
export declare const MINIAPP_ERROR = "miniappError";
|
|
15
|
-
export declare const MINIAPP_UNHANDLEDREJECTION_ERROR = "miniappUnhandledrejectionError";
|
|
16
|
-
export declare const MINIAPP_PAGENOTFOUND_ERROR = "miniappPagenotfoundError";
|
|
17
|
-
export declare const MINIAPP_MEMORYWARNING_ERROR = "miniappMemorywarningError";
|
|
18
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,kBAAkB,CAAA;AAC7C,eAAO,MAAM,cAAc,kBAAkB,CAAA;AAC7C,eAAO,MAAM,wBAAwB,4BAA4B,CAAA;AACjE,eAAO,MAAM,UAAU,cAAc,CAAA;AACrC,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAC/C,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C,eAAO,MAAM,OAAO,YAAY,CAAA;AAEhC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAElC,eAAO,MAAM,IAAI,SAAS,CAAA;AAE1B,eAAO,MAAM,KAAK,UAAU,CAAA;AAE5B,eAAO,MAAM,GAAG,QAAQ,CAAA;AAExB,eAAO,MAAM,OAAO,YAAY,CAAA;AAEhC,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAC3C,eAAO,MAAM,gCAAgC,mCAAmC,CAAA;AAChF,eAAO,MAAM,0BAA0B,6BAA6B,CAAA;AACpE,eAAO,MAAM,2BAA2B,8BAA8B,CAAA"}
|