@xifan052/monitor 0.1.2 → 0.1.3

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,5 @@
1
+ import * as Sentry from "@sentry/react-native";
2
+ import { BaseClient } from "../../core/baseClient";
3
+ export declare class RNMonitorClient extends BaseClient {
4
+ constructor(options: Sentry.ReactNativeOptions);
5
+ }
@@ -0,0 +1,7 @@
1
+ import * as Sentry from "@sentry/react-native";
2
+ import { BaseClient } from "../../core/baseClient";
3
+ export class RNMonitorClient extends BaseClient {
4
+ constructor(options) {
5
+ super(Sentry, options);
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ import * as Sentry from "@sentry/browser";
2
+ import { BaseClient } from "../../core/baseClient";
3
+ export declare class WebMonitorClient extends BaseClient {
4
+ constructor(options: Sentry.BrowserOptions);
5
+ }
@@ -0,0 +1,7 @@
1
+ import * as Sentry from "@sentry/browser";
2
+ import { BaseClient } from "../../core/baseClient";
3
+ export class WebMonitorClient extends BaseClient {
4
+ constructor(options) {
5
+ super(Sentry, options);
6
+ }
7
+ }
@@ -0,0 +1,25 @@
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
+
11
+ /**
12
+ * 通用的 Sentry 客户端实现
13
+ * 接受 Sentry 实例和初始化选项作为参数
14
+ */
15
+ declare class BaseClient {
16
+ private sentry;
17
+ private options;
18
+ constructor(sentry: any, options: any);
19
+ init(): void;
20
+ captureException(error: Error, ctx?: CaptureContext): void;
21
+ captureMessage(message: string, ctx?: CaptureContext): void;
22
+ setUser(user: MonitorUser | null): void;
23
+ }
24
+
25
+ export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -0,0 +1,25 @@
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
+
11
+ /**
12
+ * 通用的 Sentry 客户端实现
13
+ * 接受 Sentry 实例和初始化选项作为参数
14
+ */
15
+ declare class BaseClient {
16
+ private sentry;
17
+ private options;
18
+ constructor(sentry: any, options: any);
19
+ init(): void;
20
+ captureException(error: Error, ctx?: CaptureContext): void;
21
+ captureMessage(message: string, ctx?: CaptureContext): void;
22
+ setUser(user: MonitorUser | null): void;
23
+ }
24
+
25
+ export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -0,0 +1,14 @@
1
+ import type { CaptureContext, MonitorUser } from "./types";
2
+ /**
3
+ * 通用的 Sentry 客户端实现
4
+ * 接受 Sentry 实例和初始化选项作为参数
5
+ */
6
+ export declare class BaseClient {
7
+ private sentry;
8
+ private options;
9
+ constructor(sentry: any, options: any);
10
+ init(): void;
11
+ captureException(error: Error, ctx?: CaptureContext): void;
12
+ captureMessage(message: string, ctx?: CaptureContext): void;
13
+ setUser(user: MonitorUser | null): void;
14
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * 通用的 Sentry 客户端实现
3
+ * 接受 Sentry 实例和初始化选项作为参数
4
+ */
5
+ export class BaseClient {
6
+ constructor(sentry, options) {
7
+ this.sentry = sentry;
8
+ this.options = options;
9
+ }
10
+ init() {
11
+ this.sentry.init(this.options);
12
+ }
13
+ captureException(error, ctx) {
14
+ this.sentry.captureException(error, (scope) => {
15
+ (ctx === null || ctx === void 0 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
16
+ (ctx === null || ctx === void 0 ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
17
+ return scope;
18
+ });
19
+ }
20
+ captureMessage(message, ctx) {
21
+ this.sentry.captureMessage(message, (scope) => {
22
+ (ctx === null || ctx === void 0 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
23
+ (ctx === null || ctx === void 0 ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
24
+ return scope;
25
+ });
26
+ }
27
+ setUser(user) {
28
+ this.sentry.setUser(user);
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ export interface MonitorUser {
2
+ id?: string;
3
+ email?: string;
4
+ username?: string;
5
+ }
6
+ export interface CaptureContext {
7
+ tags?: Record<string, string>;
8
+ extra?: Record<string, any>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.cjs CHANGED
@@ -1,74 +1 @@
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
- });
1
+ "use strict";var m=Object.create;var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!l.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(s=g(t,n))||s.enumerable});return e};var y=(e,t,r)=>(r=e!=null?m(C(e)):{},u(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e)),E=e=>u(a({},"__esModule",{value:!0}),e);var U={};h(U,{RNMonitorClient:()=>p,WebMonitorClient:()=>i});module.exports=E(U);var M=y(require("@sentry/browser"),1);var o=class{constructor(t,r){this.sentry=t;this.options=r}init(){this.sentry.init(this.options)}captureException(t,r){this.sentry.captureException(t,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}captureMessage(t,r){this.sentry.captureMessage(t,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}setUser(t){this.sentry.setUser(t)}};var i=class extends o{constructor(t){super(M,t)}};var S=y(require("@sentry/react-native"),1);var p=class extends o{constructor(t){super(S,t)}};0&&(module.exports={RNMonitorClient,WebMonitorClient});
package/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
- export { B as BaseMonitorClient, C as CaptureContext, a as MonitorClient, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
2
- export { WebSentryClient } from './web.cjs';
1
+ export { C as CaptureContext, M as MonitorUser } from './baseClient-c4uYDw25.cjs';
2
+ export { WebMonitorClient } from './web.cjs';
3
+ export { RNMonitorClient } from './rn.cjs';
3
4
  import '@sentry/browser';
5
+ import '@sentry/react-native';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export { B as BaseMonitorClient, C as CaptureContext, a as MonitorClient, M as MonitorUser } from './baseClient-COsZhsZf.js';
2
- export { WebSentryClient } from './web.js';
1
+ export { C as CaptureContext, M as MonitorUser } from './baseClient-c4uYDw25.js';
2
+ export { WebMonitorClient } from './web.js';
3
+ export { RNMonitorClient } from './rn.js';
3
4
  import '@sentry/browser';
5
+ import '@sentry/react-native';
package/dist/index.js CHANGED
@@ -1,36 +1 @@
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
- };
1
+ import*as i from"@sentry/browser";var s=class{constructor(t,r){this.sentry=t;this.options=r}init(){this.sentry.init(this.options)}captureException(t,r){this.sentry.captureException(t,e=>(r!=null&&r.tags&&e.setTags(r.tags),r!=null&&r.extra&&e.setExtras(r.extra),e))}captureMessage(t,r){this.sentry.captureMessage(t,e=>(r!=null&&r.tags&&e.setTags(r.tags),r!=null&&r.extra&&e.setExtras(r.extra),e))}setUser(t){this.sentry.setUser(t)}};var o=class extends s{constructor(t){super(i,t)}};import*as p from"@sentry/react-native";var n=class extends s{constructor(t){super(p,t)}};export{n as RNMonitorClient,o as WebMonitorClient};
package/dist/rn.cjs CHANGED
@@ -1,72 +1 @@
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
- });
1
+ "use strict";var u=Object.create;var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of g(e))!h.call(t,a)&&a!==r&&n(t,a,{get:()=>e[a],enumerable:!(s=y(e,a))||s.enumerable});return t};var E=(t,e,r)=>(r=t!=null?u(m(t)):{},p(e||!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),U=t=>p(n({},"__esModule",{value:!0}),t);var l={};C(l,{RNMonitorClient:()=>o});module.exports=U(l);var f=E(require("@sentry/react-native"),1);var i=class{constructor(e,r){this.sentry=e;this.options=r}init(){this.sentry.init(this.options)}captureException(e,r){this.sentry.captureException(e,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}captureMessage(e,r){this.sentry.captureMessage(e,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}setUser(e){this.sentry.setUser(e)}};var o=class extends i{constructor(e){super(f,e)}};0&&(module.exports={RNMonitorClient});
package/dist/rn.d.cts CHANGED
@@ -1,13 +1,8 @@
1
1
  import * as Sentry from '@sentry/react-native';
2
- import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
2
+ import { B as BaseClient } from './baseClient-c4uYDw25.cjs';
3
3
 
4
- declare class RNSentryClient extends BaseMonitorClient {
5
- private options;
4
+ declare class RNMonitorClient extends BaseClient {
6
5
  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
6
  }
12
7
 
13
- export { RNSentryClient };
8
+ export { RNMonitorClient };
package/dist/rn.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import * as Sentry from '@sentry/react-native';
2
- import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.js';
2
+ import { B as BaseClient } from './baseClient-c4uYDw25.js';
3
3
 
4
- declare class RNSentryClient extends BaseMonitorClient {
5
- private options;
4
+ declare class RNMonitorClient extends BaseClient {
6
5
  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
6
  }
12
7
 
13
- export { RNSentryClient };
8
+ export { RNMonitorClient };
package/dist/rn.js CHANGED
@@ -1,37 +1 @@
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
- };
1
+ import*as i from"@sentry/react-native";var s=class{constructor(e,r){this.sentry=e;this.options=r}init(){this.sentry.init(this.options)}captureException(e,r){this.sentry.captureException(e,t=>(r!=null&&r.tags&&t.setTags(r.tags),r!=null&&r.extra&&t.setExtras(r.extra),t))}captureMessage(e,r){this.sentry.captureMessage(e,t=>(r!=null&&r.tags&&t.setTags(r.tags),r!=null&&r.extra&&t.setExtras(r.extra),t))}setUser(e){this.sentry.setUser(e)}};var a=class extends s{constructor(e){super(i,e)}};export{a as RNMonitorClient};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { BaseClient } from "../core/baseClient";
3
+ class MockClient extends BaseClient {
4
+ constructor() {
5
+ super({
6
+ init: () => { },
7
+ captureException: () => { },
8
+ captureMessage: () => { },
9
+ setUser: () => { },
10
+ }, {});
11
+ }
12
+ }
13
+ describe("SentryMonitorClient", () => {
14
+ it("should instantiate", () => {
15
+ const client = new MockClient();
16
+ expect(client).toBeInstanceOf(BaseClient);
17
+ });
18
+ });
package/dist/web.cjs CHANGED
@@ -1,72 +1 @@
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
- });
1
+ "use strict";var u=Object.create;var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var C=(s,e)=>{for(var r in e)n(s,r,{get:e[r],enumerable:!0})},p=(s,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of g(e))!h.call(s,a)&&a!==r&&n(s,a,{get:()=>e[a],enumerable:!(t=y(e,a))||t.enumerable});return s};var E=(s,e,r)=>(r=s!=null?u(m(s)):{},p(e||!s||!s.__esModule?n(r,"default",{value:s,enumerable:!0}):r,s)),U=s=>p(n({},"__esModule",{value:!0}),s);var l={};C(l,{WebMonitorClient:()=>i});module.exports=U(l);var f=E(require("@sentry/browser"),1);var o=class{constructor(e,r){this.sentry=e;this.options=r}init(){this.sentry.init(this.options)}captureException(e,r){this.sentry.captureException(e,t=>(r!=null&&r.tags&&t.setTags(r.tags),r!=null&&r.extra&&t.setExtras(r.extra),t))}captureMessage(e,r){this.sentry.captureMessage(e,t=>(r!=null&&r.tags&&t.setTags(r.tags),r!=null&&r.extra&&t.setExtras(r.extra),t))}setUser(e){this.sentry.setUser(e)}};var i=class extends o{constructor(e){super(f,e)}};0&&(module.exports={WebMonitorClient});
package/dist/web.d.cts CHANGED
@@ -1,13 +1,8 @@
1
- import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.cjs';
2
1
  import * as Sentry from '@sentry/browser';
2
+ import { B as BaseClient } from './baseClient-c4uYDw25.cjs';
3
3
 
4
- declare class WebSentryClient extends BaseMonitorClient {
5
- private options;
4
+ declare class WebMonitorClient extends BaseClient {
6
5
  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
6
  }
12
7
 
13
- export { WebSentryClient };
8
+ export { WebMonitorClient };
package/dist/web.d.ts CHANGED
@@ -1,13 +1,8 @@
1
- import { B as BaseMonitorClient, C as CaptureContext, M as MonitorUser } from './baseClient-COsZhsZf.js';
2
1
  import * as Sentry from '@sentry/browser';
2
+ import { B as BaseClient } from './baseClient-c4uYDw25.js';
3
3
 
4
- declare class WebSentryClient extends BaseMonitorClient {
5
- private options;
4
+ declare class WebMonitorClient extends BaseClient {
6
5
  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
6
  }
12
7
 
13
- export { WebSentryClient };
8
+ export { WebMonitorClient };
package/dist/web.js CHANGED
@@ -1,37 +1 @@
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
- };
1
+ import*as o from"@sentry/browser";var t=class{constructor(e,r){this.sentry=e;this.options=r}init(){this.sentry.init(this.options)}captureException(e,r){this.sentry.captureException(e,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}captureMessage(e,r){this.sentry.captureMessage(e,s=>(r!=null&&r.tags&&s.setTags(r.tags),r!=null&&r.extra&&s.setExtras(r.extra),s))}setUser(e){this.sentry.setUser(e)}};var a=class extends t{constructor(e){super(o,e)}};export{a as WebMonitorClient};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xifan052/monitor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -26,20 +26,23 @@
26
26
  "require": "./dist/rn.cjs"
27
27
  }
28
28
  },
29
- "scripts": {
30
- "build": "tsup --dts",
31
- "test": "vitest",
32
- "prepublishOnly": "pnpm build"
33
- },
34
29
  "peerDependencies": {
35
30
  "@sentry/browser": "^7",
36
31
  "@sentry/react-native": "^5"
37
32
  },
38
33
  "devDependencies": {
34
+ "@changesets/cli": "^2.27.10",
39
35
  "typescript": "^5",
40
36
  "vitest": "^1"
41
37
  },
42
38
  "dependencies": {
43
39
  "tsup": "^8.5.1"
40
+ },
41
+ "scripts": {
42
+ "build": "tsup --dts",
43
+ "changeset": "changeset",
44
+ "version": "changeset version",
45
+ "release": "changeset publish",
46
+ "test": "vitest"
44
47
  }
45
- }
48
+ }
@@ -1,24 +0,0 @@
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 };
@@ -1,24 +0,0 @@
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 };