@ohbug/angular 1.0.6 → 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 +4 -5
- package/dist/index.d.ts +12 -3
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +21 -24
- package/dist/createProvider.d.ts +0 -11
- package/dist/createProvider.d.ts.map +0 -1
- package/dist/extension.d.ts +0 -2
- package/dist/extension.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/ohbug-angular.es.js +0 -15
- package/dist/ohbug-angular.umd.js +0 -15
package/README.md
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ohbug/angular)
|
|
4
4
|
[](https://bundlephobia.com/result?p=@ohbug/angular)
|
|
5
|
-
[](https://github.com/prettier/prettier)
|
|
6
5
|
|
|
7
6
|
English | [简体中文](./README-zh_CN.md)
|
|
8
7
|
|
|
9
8
|
## Installation
|
|
10
9
|
|
|
11
10
|
```
|
|
12
|
-
|
|
11
|
+
pnpm instal @ohbug/browser @ohbug/angular
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
## Usage
|
|
@@ -18,13 +17,13 @@ yarn add @ohbug/browser @ohbug/angular
|
|
|
18
17
|
// app.module.ts
|
|
19
18
|
import Ohbug from '@ohbug/browser'
|
|
20
19
|
import { ErrorHandler } from '@angular/core'
|
|
20
|
+
import OhbugAngular from '@ohbug/angular'
|
|
21
21
|
|
|
22
|
-
const client = Ohbug.
|
|
23
|
-
const OhbugProvider = client.use(OhbugAngular, ErrorHandler)
|
|
22
|
+
const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
|
|
24
23
|
|
|
25
24
|
@NgModule({
|
|
26
25
|
// others
|
|
27
|
-
providers: [
|
|
26
|
+
providers: [OhbugAngular(client, ErrorHandler)],
|
|
28
27
|
})
|
|
29
28
|
export class AppModule {}
|
|
30
29
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ErrorHandler } from '@angular/core';
|
|
2
|
+
import { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
|
|
3
|
+
|
|
4
|
+
interface AngularErrorDetail extends OhbugBaseDetail {
|
|
5
|
+
stack?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function createProvider(client: OhbugClient, errorHandler: ErrorHandler): {
|
|
8
|
+
provide: ErrorHandler;
|
|
9
|
+
useClass: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { AngularErrorDetail, createProvider as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var a in r)n(e,a,{get:r[a],enumerable:!0})},c=(e,r,a,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of d(r))!g.call(e,t)&&t!==a&&n(e,t,{get:()=>r[t],enumerable:!(o=p(r,t))||o.enumerable});return e};var m=e=>c(n({},"__esModule",{value:!0}),e);var v={};E(v,{default:()=>s});module.exports=m(v);var l=require("@ohbug/core");function y(e,r){class a{handleError(t){let i={message:t.message,stack:t.stack},u=e.createEvent({category:"error",type:l.EventTypes.ANGULAR,detail:i});e.notify(u)}}return{provide:r,useClass:a}}var s=y;0&&(module.exports={});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventTypes as i}from"@ohbug/core";function u(r,t){class a{handleError(e){let o={message:e.message,stack:e.stack},n=r.createEvent({category:"error",type:i.ANGULAR,detail:o});r.notify(n)}}return{provide:t,useClass:a}}var p=u;export{p as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Ohbug SDK for Angular",
|
|
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,40 +12,36 @@
|
|
|
11
12
|
"type": "git",
|
|
12
13
|
"url": "https://github.com/ohbug-org/ohbug"
|
|
13
14
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"unpkg": "./dist/ohbug-angular.umd.js",
|
|
18
|
-
"jsdelivr": "./dist/ohbug-angular.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
|
],
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@angular/core": "^13.0.0"
|
|
31
|
+
},
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"@ohbug/core": "
|
|
33
|
+
"@ohbug/core": "2.0.2",
|
|
34
|
+
"@ohbug/types": "2.0.2"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
|
-
"@angular/core": "^
|
|
34
|
-
},
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"@angular/core": "^10.0.0"
|
|
37
|
-
},
|
|
38
|
-
"buildOptions": {
|
|
39
|
-
"name": "OhbugAngular",
|
|
40
|
-
"formats": [
|
|
41
|
-
"es",
|
|
42
|
-
"umd"
|
|
43
|
-
],
|
|
44
|
-
"order": 4
|
|
37
|
+
"@angular/core": "^13.3.8"
|
|
45
38
|
},
|
|
46
39
|
"publishConfig": {
|
|
47
40
|
"access": "public"
|
|
48
41
|
},
|
|
49
|
-
"
|
|
50
|
-
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"dev": "tsup --watch"
|
|
45
|
+
},
|
|
46
|
+
"readme": "# `@ohbug/angular`\n\n[](https://www.npmjs.com/package/@ohbug/angular)\n[](https://bundlephobia.com/result?p=@ohbug/angular)\n\nEnglish | [简体中文](./README-zh_CN.md)\n\n## Installation\n\n```\npnpm instal @ohbug/browser @ohbug/angular\n```\n\n## Usage\n\n```jsx\n// app.module.ts\nimport Ohbug from '@ohbug/browser'\nimport { ErrorHandler } from '@angular/core'\nimport OhbugAngular from '@ohbug/angular'\n\nconst client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })\n\n@NgModule({\n // others\n providers: [OhbugAngular(client, ErrorHandler)],\n})\nexport class AppModule {}\n```\n"
|
|
47
|
+
}
|
package/dist/createProvider.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ErrorHandler } from '@angular/core';
|
|
2
|
-
import type { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
|
|
3
|
-
export interface AngularErrorDetail extends OhbugBaseDetail {
|
|
4
|
-
stack?: string;
|
|
5
|
-
}
|
|
6
|
-
declare function createProvider(client: OhbugClient, errorHandler: ErrorHandler): {
|
|
7
|
-
provide: ErrorHandler;
|
|
8
|
-
useClass: any;
|
|
9
|
-
};
|
|
10
|
-
export default createProvider;
|
|
11
|
-
//# sourceMappingURL=createProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createProvider.d.ts","sourceRoot":"","sources":["../src/createProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAGhE,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,iBAAS,cAAc,CACrB,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,YAAY,GACzB;IACD,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,GAAG,CAAA;CACd,CAoBA;AAED,eAAe,cAAc,CAAA"}
|
package/dist/extension.d.ts
DELETED
package/dist/extension.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,4CAGpB,CAAA"}
|
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,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/ohbug-angular.es.js
DELETED
|
@@ -1,15 +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 t=function(){return(t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function e(t){return"string"==typeof t}var r=function(t,e,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function n(t,e){var r=t.apiKey,n=t.appVersion,a=t.appType,i=t.releaseStage,o=t.timestamp,s=t.category,p=t.type,u=t.sdk,c=t.detail,E=t.device,h=t.user,l=t.actions,f=t.metaData;this.apiKey=r,this.appVersion=n,this.appType=a,this.releaseStage=i,this.timestamp=o,this.category=s,this.type=p,this.sdk=u,this.detail=c,this.device=E,this.user=h,this.actions=l,this.metaData=f,this._client=e}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(t,n,a,i){var o,s,p=this.actions,u=e(t)?t:"",c=n||{},E=e(a)?a:"",h=new r(u,c,E,i);p.length>=(null!==(s=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(h)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(e){var r;if(function(t){return"[object Object]"===Object.prototype.toString.call(t)}(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(t,e){return new Error("Invalid data\n- "+t+", got "+JSON.stringify(e))}("setUser should be an object and have up to 6 attributes",e))},n.prototype.addMetaData=function(t,e){return function(t,e,r){e&&(t[e]=r)}(this.metaData,t,e)},n.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},n.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},n.prototype.toJSON=function(){var t=this;return{apiKey:t.apiKey,appVersion:t.appVersion,appType:t.appType,timestamp:t.timestamp,category:t.category,type:t.type,sdk:t.sdk,device:t.device,detail:t.detail,user:t.user,actions:t.actions,metaData:t.metaData,releaseStage:t.releaseStage}}}();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"});var n={name:"OhbugAngular",init:function(t,e){return function(t,e){return{provide:e,useClass:function(){function e(){}return e.prototype.handleError=function(e){var r={message:e.message,stack:e.stack},n=t.createEvent({category:"error",type:"angular",detail:r});t.notify(n)},e}()}}(t,e)}};export{n as default};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).OhbugAngular=e()}(this,(function(){"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(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function e(t){return"string"==typeof t}var r=function(t,e,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function n(t,e){var r=t.apiKey,n=t.appVersion,i=t.appType,a=t.releaseStage,o=t.timestamp,s=t.category,u=t.type,p=t.sdk,c=t.detail,f=t.device,l=t.user,h=t.actions,d=t.metaData;this.apiKey=r,this.appVersion=n,this.appType=i,this.releaseStage=a,this.timestamp=o,this.category=s,this.type=u,this.sdk=p,this.detail=c,this.device=f,this.user=l,this.actions=h,this.metaData=d,this._client=e}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(t,n,i,a){var o,s,u=this.actions,p=e(t)?t:"",c=n||{},f=e(i)?i:"",l=new r(p,c,f,a);u.length>=(null!==(s=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==s?s:30)&&u.shift(),u.push(l)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(e){var r;if(function(t){return"[object Object]"===Object.prototype.toString.call(t)}(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(t,e){return new Error("Invalid data\n- "+t+", got "+JSON.stringify(e))}("setUser should be an object and have up to 6 attributes",e))},n.prototype.addMetaData=function(t,e){return function(t,e,r){e&&(t[e]=r)}(this.metaData,t,e)},n.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},n.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},n.prototype.toJSON=function(){var t=this;return{apiKey:t.apiKey,appVersion:t.appVersion,appType:t.appType,timestamp:t.timestamp,category:t.category,type:t.type,sdk:t.sdk,device:t.device,detail:t.detail,user:t.user,actions:t.actions,metaData:t.metaData,releaseStage:t.releaseStage}}}();return 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"}),{name:"OhbugAngular",init:function(t,e){return function(t,e){return{provide:e,useClass:function(){function e(){}return e.prototype.handleError=function(e){var r={message:e.message,stack:e.stack},n=t.createEvent({category:"error",type:"angular",detail:r});t.notify(n)},e}()}}(t,e)}}}));
|