@xifan052/monitor 0.1.1

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.
@@ -0,0 +1,24 @@
1
+ interface MonitorUser {
2
+ id?: string;
3
+ email?: string;
4
+ username?: string;
5
+ }
6
+ interface CaptureContext {
7
+ tags?: Record<string, string>;
8
+ extra?: Record<string, any>;
9
+ }
10
+ interface MonitorClient {
11
+ init(): void;
12
+ captureException(error: Error, ctx?: CaptureContext): void;
13
+ captureMessage(message: string, ctx?: CaptureContext): void;
14
+ setUser(user: MonitorUser | null): void;
15
+ }
16
+
17
+ declare abstract class BaseMonitorClient implements MonitorClient {
18
+ abstract init(): void;
19
+ abstract captureException(error: Error, ctx?: CaptureContext): void;
20
+ abstract captureMessage(message: string, ctx?: CaptureContext): void;
21
+ abstract setUser(user: MonitorUser | null): void;
22
+ }
23
+
24
+ export { BaseMonitorClient as B, type CaptureContext as C, type MonitorUser as M, type MonitorClient as a };
@@ -0,0 +1,24 @@
1
+ interface MonitorUser {
2
+ id?: string;
3
+ email?: string;
4
+ username?: string;
5
+ }
6
+ interface CaptureContext {
7
+ tags?: Record<string, string>;
8
+ extra?: Record<string, any>;
9
+ }
10
+ interface MonitorClient {
11
+ init(): void;
12
+ captureException(error: Error, ctx?: CaptureContext): void;
13
+ captureMessage(message: string, ctx?: CaptureContext): void;
14
+ setUser(user: MonitorUser | null): void;
15
+ }
16
+
17
+ declare abstract class BaseMonitorClient implements MonitorClient {
18
+ abstract init(): void;
19
+ abstract captureException(error: Error, ctx?: CaptureContext): void;
20
+ abstract captureMessage(message: string, ctx?: CaptureContext): void;
21
+ abstract setUser(user: MonitorUser | null): void;
22
+ }
23
+
24
+ export { BaseMonitorClient as B, type CaptureContext as C, type MonitorUser as M, type MonitorClient as a };
package/dist/index.cjs ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ BaseMonitorClient: () => BaseMonitorClient,
34
+ WebSentryClient: () => WebSentryClient
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+
38
+ // src/core/baseClient.ts
39
+ var BaseMonitorClient = class {
40
+ };
41
+
42
+ // src/adapter/web/index.ts
43
+ var Sentry = __toESM(require("@sentry/browser"), 1);
44
+ var WebSentryClient = class extends BaseMonitorClient {
45
+ constructor(options) {
46
+ super();
47
+ this.options = options;
48
+ }
49
+ init() {
50
+ Sentry.init(this.options);
51
+ }
52
+ captureException(error, ctx) {
53
+ Sentry.captureException(error, (scope) => {
54
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
55
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
56
+ return scope;
57
+ });
58
+ }
59
+ captureMessage(message, ctx) {
60
+ Sentry.captureMessage(message, (scope) => {
61
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
62
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
63
+ return scope;
64
+ });
65
+ }
66
+ setUser(user) {
67
+ Sentry.setUser(user);
68
+ }
69
+ };
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ BaseMonitorClient,
73
+ WebSentryClient
74
+ });
75
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/core/baseClient.ts","../src/adapter/web/index.ts"],"sourcesContent":["export * from \"./core/types\";\r\nexport * from \"./core/baseClient\";\r\n\r\nexport { WebSentryClient } from \"./adapter/web\";\r\n","import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n","import * as Sentry from \"@sentry/browser\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class WebSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.BrowserOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAe,oBAAf,MAA0D;AAKjE;;;ACPA,aAAwB;AAIjB,IAAM,kBAAN,cAA8B,kBAAkB;AAAA,EACrD,YAAoB,SAAgC;AAClD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { B as BaseMonitorClient, C as CaptureContext, a as MonitorClient, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
2
+ export { WebSentryClient } from './web.cjs';
3
+ import '@sentry/browser';
@@ -0,0 +1,3 @@
1
+ export { B as BaseMonitorClient, C as CaptureContext, a as MonitorClient, M as MonitorUser } from './baseClient-COsZhsZf.js';
2
+ export { WebSentryClient } from './web.js';
3
+ import '@sentry/browser';
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ // src/core/baseClient.ts
2
+ var BaseMonitorClient = class {
3
+ };
4
+
5
+ // src/adapter/web/index.ts
6
+ import * as Sentry from "@sentry/browser";
7
+ var WebSentryClient = class extends BaseMonitorClient {
8
+ constructor(options) {
9
+ super();
10
+ this.options = options;
11
+ }
12
+ init() {
13
+ Sentry.init(this.options);
14
+ }
15
+ captureException(error, ctx) {
16
+ Sentry.captureException(error, (scope) => {
17
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
18
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
19
+ return scope;
20
+ });
21
+ }
22
+ captureMessage(message, ctx) {
23
+ Sentry.captureMessage(message, (scope) => {
24
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
25
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
26
+ return scope;
27
+ });
28
+ }
29
+ setUser(user) {
30
+ Sentry.setUser(user);
31
+ }
32
+ };
33
+ export {
34
+ BaseMonitorClient,
35
+ WebSentryClient
36
+ };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/baseClient.ts","../src/adapter/web/index.ts"],"sourcesContent":["import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n","import * as Sentry from \"@sentry/browser\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class WebSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.BrowserOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n"],"mappings":";AAEO,IAAe,oBAAf,MAA0D;AAKjE;;;ACPA,YAAY,YAAY;AAIjB,IAAM,kBAAN,cAA8B,kBAAkB;AAAA,EACrD,YAAoB,SAAgC;AAClD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
package/dist/rn.cjs ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/adapter/rn/index.ts
31
+ var rn_exports = {};
32
+ __export(rn_exports, {
33
+ RNSentryClient: () => RNSentryClient
34
+ });
35
+ module.exports = __toCommonJS(rn_exports);
36
+ var Sentry = __toESM(require("@sentry/react-native"), 1);
37
+
38
+ // src/core/baseClient.ts
39
+ var BaseMonitorClient = class {
40
+ };
41
+
42
+ // src/adapter/rn/index.ts
43
+ var RNSentryClient = class extends BaseMonitorClient {
44
+ constructor(options) {
45
+ super();
46
+ this.options = options;
47
+ }
48
+ init() {
49
+ Sentry.init(this.options);
50
+ }
51
+ captureException(error, ctx) {
52
+ Sentry.captureException(error, (scope) => {
53
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
54
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
55
+ return scope;
56
+ });
57
+ }
58
+ captureMessage(message, ctx) {
59
+ Sentry.captureMessage(message, (scope) => {
60
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
61
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
62
+ return scope;
63
+ });
64
+ }
65
+ setUser(user) {
66
+ Sentry.setUser(user);
67
+ }
68
+ };
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ RNSentryClient
72
+ });
73
+ //# sourceMappingURL=rn.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapter/rn/index.ts","../src/core/baseClient.ts"],"sourcesContent":["import * as Sentry from \"@sentry/react-native\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class RNSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.ReactNativeOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n","import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;;;ACEjB,IAAe,oBAAf,MAA0D;AAKjE;;;ADHO,IAAM,iBAAN,cAA6B,kBAAkB;AAAA,EACpD,YAAoB,SAAoC;AACtD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
package/dist/rn.d.cts ADDED
@@ -0,0 +1,13 @@
1
+ import * as Sentry from '@sentry/react-native';
2
+ import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
3
+
4
+ declare class RNSentryClient extends BaseMonitorClient {
5
+ private options;
6
+ constructor(options: Sentry.ReactNativeOptions);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser | null): void;
11
+ }
12
+
13
+ export { RNSentryClient };
package/dist/rn.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import * as Sentry from '@sentry/react-native';
2
+ import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.js';
3
+
4
+ declare class RNSentryClient extends BaseMonitorClient {
5
+ private options;
6
+ constructor(options: Sentry.ReactNativeOptions);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser | null): void;
11
+ }
12
+
13
+ export { RNSentryClient };
package/dist/rn.js ADDED
@@ -0,0 +1,38 @@
1
+ // src/adapter/rn/index.ts
2
+ import * as Sentry from "@sentry/react-native";
3
+
4
+ // src/core/baseClient.ts
5
+ var BaseMonitorClient = class {
6
+ };
7
+
8
+ // src/adapter/rn/index.ts
9
+ var RNSentryClient = class extends BaseMonitorClient {
10
+ constructor(options) {
11
+ super();
12
+ this.options = options;
13
+ }
14
+ init() {
15
+ Sentry.init(this.options);
16
+ }
17
+ captureException(error, ctx) {
18
+ Sentry.captureException(error, (scope) => {
19
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
20
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
21
+ return scope;
22
+ });
23
+ }
24
+ captureMessage(message, ctx) {
25
+ Sentry.captureMessage(message, (scope) => {
26
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
27
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
28
+ return scope;
29
+ });
30
+ }
31
+ setUser(user) {
32
+ Sentry.setUser(user);
33
+ }
34
+ };
35
+ export {
36
+ RNSentryClient
37
+ };
38
+ //# sourceMappingURL=rn.js.map
package/dist/rn.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapter/rn/index.ts","../src/core/baseClient.ts"],"sourcesContent":["import * as Sentry from \"@sentry/react-native\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class RNSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.ReactNativeOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n","import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n"],"mappings":";AAAA,YAAY,YAAY;;;ACEjB,IAAe,oBAAf,MAA0D;AAKjE;;;ADHO,IAAM,iBAAN,cAA6B,kBAAkB;AAAA,EACpD,YAAoB,SAAoC;AACtD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
package/dist/web.cjs ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/adapter/web/index.ts
31
+ var web_exports = {};
32
+ __export(web_exports, {
33
+ WebSentryClient: () => WebSentryClient
34
+ });
35
+ module.exports = __toCommonJS(web_exports);
36
+ var Sentry = __toESM(require("@sentry/browser"), 1);
37
+
38
+ // src/core/baseClient.ts
39
+ var BaseMonitorClient = class {
40
+ };
41
+
42
+ // src/adapter/web/index.ts
43
+ var WebSentryClient = class extends BaseMonitorClient {
44
+ constructor(options) {
45
+ super();
46
+ this.options = options;
47
+ }
48
+ init() {
49
+ Sentry.init(this.options);
50
+ }
51
+ captureException(error, ctx) {
52
+ Sentry.captureException(error, (scope) => {
53
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
54
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
55
+ return scope;
56
+ });
57
+ }
58
+ captureMessage(message, ctx) {
59
+ Sentry.captureMessage(message, (scope) => {
60
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
61
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
62
+ return scope;
63
+ });
64
+ }
65
+ setUser(user) {
66
+ Sentry.setUser(user);
67
+ }
68
+ };
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ WebSentryClient
72
+ });
73
+ //# sourceMappingURL=web.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapter/web/index.ts","../src/core/baseClient.ts"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class WebSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.BrowserOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n","import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;;;ACEjB,IAAe,oBAAf,MAA0D;AAKjE;;;ADHO,IAAM,kBAAN,cAA8B,kBAAkB;AAAA,EACrD,YAAoB,SAAgC;AAClD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
package/dist/web.d.cts ADDED
@@ -0,0 +1,13 @@
1
+ import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
2
+ import * as Sentry from '@sentry/browser';
3
+
4
+ declare class WebSentryClient extends BaseMonitorClient {
5
+ private options;
6
+ constructor(options: Sentry.BrowserOptions);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser | null): void;
11
+ }
12
+
13
+ export { WebSentryClient };
package/dist/web.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.js';
2
+ import * as Sentry from '@sentry/browser';
3
+
4
+ declare class WebSentryClient extends BaseMonitorClient {
5
+ private options;
6
+ constructor(options: Sentry.BrowserOptions);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser | null): void;
11
+ }
12
+
13
+ export { WebSentryClient };
package/dist/web.js ADDED
@@ -0,0 +1,38 @@
1
+ // src/adapter/web/index.ts
2
+ import * as Sentry from "@sentry/browser";
3
+
4
+ // src/core/baseClient.ts
5
+ var BaseMonitorClient = class {
6
+ };
7
+
8
+ // src/adapter/web/index.ts
9
+ var WebSentryClient = class extends BaseMonitorClient {
10
+ constructor(options) {
11
+ super();
12
+ this.options = options;
13
+ }
14
+ init() {
15
+ Sentry.init(this.options);
16
+ }
17
+ captureException(error, ctx) {
18
+ Sentry.captureException(error, (scope) => {
19
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
20
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
21
+ return scope;
22
+ });
23
+ }
24
+ captureMessage(message, ctx) {
25
+ Sentry.captureMessage(message, (scope) => {
26
+ (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
27
+ (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
28
+ return scope;
29
+ });
30
+ }
31
+ setUser(user) {
32
+ Sentry.setUser(user);
33
+ }
34
+ };
35
+ export {
36
+ WebSentryClient
37
+ };
38
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapter/web/index.ts","../src/core/baseClient.ts"],"sourcesContent":["import * as Sentry from \"@sentry/browser\";\r\nimport { BaseMonitorClient } from \"../../core/baseClient\";\r\nimport type { CaptureContext, MonitorUser } from \"../../core/types\";\r\n\r\nexport class WebSentryClient extends BaseMonitorClient {\r\n constructor(private options: Sentry.BrowserOptions) {\r\n super();\r\n }\r\n\r\n init() {\r\n Sentry.init(this.options);\r\n }\r\n\r\n captureException(error: Error, ctx?: CaptureContext) {\r\n Sentry.captureException(error, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n captureMessage(message: string, ctx?: CaptureContext) {\r\n Sentry.captureMessage(message, (scope) => {\r\n ctx?.tags && scope.setTags(ctx.tags);\r\n ctx?.extra && scope.setExtras(ctx.extra);\r\n return scope;\r\n });\r\n }\r\n\r\n setUser(user: MonitorUser | null) {\r\n Sentry.setUser(user);\r\n }\r\n}\r\n","import type { MonitorClient, MonitorUser, CaptureContext } from \"./types\";\r\n\r\nexport abstract class BaseMonitorClient implements MonitorClient {\r\n abstract init(): void;\r\n abstract captureException(error: Error, ctx?: CaptureContext): void;\r\n abstract captureMessage(message: string, ctx?: CaptureContext): void;\r\n abstract setUser(user: MonitorUser | null): void;\r\n}\r\n"],"mappings":";AAAA,YAAY,YAAY;;;ACEjB,IAAe,oBAAf,MAA0D;AAKjE;;;ADHO,IAAM,kBAAN,cAA8B,kBAAkB;AAAA,EACrD,YAAoB,SAAgC;AAClD,UAAM;AADY;AAAA,EAEpB;AAAA,EAEA,OAAO;AACL,IAAO,YAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,iBAAiB,OAAc,KAAsB;AACnD,IAAO,wBAAiB,OAAO,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,SAAiB,KAAsB;AACpD,IAAO,sBAAe,SAAS,CAAC,UAAU;AACxC,kCAAK,SAAQ,MAAM,QAAQ,IAAI,IAAI;AACnC,kCAAK,UAAS,MAAM,UAAU,IAAI,KAAK;AACvC,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,QAAQ,MAA0B;AAChC,IAAO,eAAQ,IAAI;AAAA,EACrB;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@xifan052/monitor",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ },
18
+ "./web": {
19
+ "types": "./dist/web.d.ts",
20
+ "import": "./dist/web.js",
21
+ "require": "./dist/web.cjs"
22
+ },
23
+ "./rn": {
24
+ "types": "./dist/rn.d.ts",
25
+ "import": "./dist/rn.js",
26
+ "require": "./dist/rn.cjs"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "tsup --dts",
31
+ "test": "vitest",
32
+ "prepublishOnly": "pnpm build"
33
+ },
34
+ "peerDependencies": {
35
+ "@sentry/browser": "^7",
36
+ "@sentry/react-native": "^5"
37
+ },
38
+ "devDependencies": {
39
+ "typescript": "^5",
40
+ "vitest": "^1"
41
+ },
42
+ "dependencies": {
43
+ "tsup": "^8.5.1"
44
+ }
45
+ }