@xifan052/monitor 0.1.7 → 0.1.9

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,14 @@
1
+ import { CaptureContext, MonitorUser } from './index.js';
2
+
3
+ declare abstract class BaseClient {
4
+ protected sentry: any;
5
+ protected options: any;
6
+ constructor(sentry: any, options: any);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser): void;
11
+ get ErrorBoundary(): any;
12
+ }
13
+
14
+ export { BaseClient as B };
@@ -0,0 +1,13 @@
1
+ import { CaptureContext, MonitorUser } from './index.js';
2
+
3
+ declare abstract class BaseClient {
4
+ protected sentry: any;
5
+ protected options: any;
6
+ constructor(sentry: any, options: any);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser): void;
11
+ }
12
+
13
+ export { BaseClient as B };
@@ -0,0 +1,14 @@
1
+ import { CaptureContext, MonitorUser } from './index.cjs';
2
+
3
+ declare abstract class BaseClient {
4
+ protected sentry: any;
5
+ protected options: any;
6
+ constructor(sentry: any, options: any);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser): void;
11
+ get ErrorBoundary(): any;
12
+ }
13
+
14
+ export { BaseClient as B };
@@ -0,0 +1,13 @@
1
+ import { CaptureContext, MonitorUser } from './index.cjs';
2
+
3
+ declare abstract class BaseClient {
4
+ protected sentry: any;
5
+ protected options: any;
6
+ constructor(sentry: any, options: any);
7
+ init(): void;
8
+ captureException(error: Error, ctx?: CaptureContext): void;
9
+ captureMessage(message: string, ctx?: CaptureContext): void;
10
+ setUser(user: MonitorUser): void;
11
+ }
12
+
13
+ export { BaseClient as B };
package/dist/index.cjs CHANGED
@@ -1,14 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  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
6
  var __copyProps = (to, from, except, desc) => {
13
7
  if (from && typeof from === "object" || typeof from === "function") {
14
8
  for (let key of __getOwnPropNames(from))
@@ -17,74 +11,8 @@ var __copyProps = (to, from, except, desc) => {
17
11
  }
18
12
  return to;
19
13
  };
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
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
15
 
30
16
  // src/index.ts
31
17
  var src_exports = {};
32
- __export(src_exports, {
33
- RNMonitorClient: () => RNMonitorClient,
34
- WebMonitorClient: () => WebMonitorClient
35
- });
36
18
  module.exports = __toCommonJS(src_exports);
37
-
38
- // src/adapter/web/index.ts
39
- var Sentry = __toESM(require("@sentry/browser"), 1);
40
-
41
- // src/core/baseClient.ts
42
- var BaseClient = class {
43
- constructor(sentry, options) {
44
- this.sentry = sentry;
45
- this.options = options;
46
- }
47
- init() {
48
- this.sentry.init(this.options);
49
- }
50
- captureException(error, ctx) {
51
- this.sentry.captureException(error, (scope) => {
52
- (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
53
- (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
54
- return scope;
55
- });
56
- }
57
- captureMessage(message, ctx) {
58
- this.sentry.captureMessage(message, (scope) => {
59
- (ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
60
- (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
61
- return scope;
62
- });
63
- }
64
- setUser(user) {
65
- this.sentry.setUser(user);
66
- }
67
- get ErrorBoundary() {
68
- return this.sentry.ErrorBoundary;
69
- }
70
- };
71
-
72
- // src/adapter/web/index.ts
73
- var WebMonitorClient = class extends BaseClient {
74
- constructor(options) {
75
- super(Sentry, options);
76
- }
77
- };
78
-
79
- // src/adapter/rn/index.ts
80
- var Sentry2 = __toESM(require("@sentry/react-native"), 1);
81
- var RNMonitorClient = class extends BaseClient {
82
- constructor(options) {
83
- super(Sentry2, options);
84
- }
85
- };
86
- // Annotate the CommonJS export names for ESM import in node:
87
- 0 && (module.exports = {
88
- RNMonitorClient,
89
- WebMonitorClient
90
- });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,12 @@
1
- export { C as CaptureContext, M as MonitorUser } from './baseClient-CpBY_Ydd.cjs';
2
- export { WebMonitorClient } from './web.cjs';
3
- export { RNMonitorClient } from './rn.cjs';
4
- import '@sentry/browser';
5
- import '@sentry/react-native';
1
+ interface MonitorUser {
2
+ id?: string;
3
+ email?: string;
4
+ username?: string;
5
+ [key: string]: string | undefined;
6
+ }
7
+ interface CaptureContext {
8
+ tags?: Record<string, string>;
9
+ extra?: Record<string, any>;
10
+ }
11
+
12
+ export type { CaptureContext, MonitorUser };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,12 @@
1
- export { C as CaptureContext, M as MonitorUser } from './baseClient-CpBY_Ydd.js';
2
- export { WebMonitorClient } from './web.js';
3
- export { RNMonitorClient } from './rn.js';
4
- import '@sentry/browser';
5
- import '@sentry/react-native';
1
+ interface MonitorUser {
2
+ id?: string;
3
+ email?: string;
4
+ username?: string;
5
+ [key: string]: string | undefined;
6
+ }
7
+ interface CaptureContext {
8
+ tags?: Record<string, string>;
9
+ extra?: Record<string, any>;
10
+ }
11
+
12
+ export type { CaptureContext, MonitorUser };
package/dist/index.js CHANGED
@@ -1,52 +0,0 @@
1
- // src/adapter/web/index.ts
2
- import * as Sentry from "@sentry/browser";
3
-
4
- // src/core/baseClient.ts
5
- var BaseClient = class {
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 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
16
- (ctx == null ? 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 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
23
- (ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
24
- return scope;
25
- });
26
- }
27
- setUser(user) {
28
- this.sentry.setUser(user);
29
- }
30
- get ErrorBoundary() {
31
- return this.sentry.ErrorBoundary;
32
- }
33
- };
34
-
35
- // src/adapter/web/index.ts
36
- var WebMonitorClient = class extends BaseClient {
37
- constructor(options) {
38
- super(Sentry, options);
39
- }
40
- };
41
-
42
- // src/adapter/rn/index.ts
43
- import * as Sentry2 from "@sentry/react-native";
44
- var RNMonitorClient = class extends BaseClient {
45
- constructor(options) {
46
- super(Sentry2, options);
47
- }
48
- };
49
- export {
50
- RNMonitorClient,
51
- WebMonitorClient
52
- };
package/dist/rn.cjs CHANGED
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/adapter/rn/index.ts
31
31
  var rn_exports = {};
32
32
  __export(rn_exports, {
33
- RNMonitorClient: () => RNMonitorClient
33
+ MonitorClient: () => MonitorClient
34
34
  });
35
35
  module.exports = __toCommonJS(rn_exports);
36
36
  var Sentry = __toESM(require("@sentry/react-native"), 1);
@@ -61,18 +61,27 @@ var BaseClient = class {
61
61
  setUser(user) {
62
62
  this.sentry.setUser(user);
63
63
  }
64
- get ErrorBoundary() {
65
- return this.sentry.ErrorBoundary;
66
- }
67
64
  };
68
65
 
69
66
  // src/adapter/rn/index.ts
70
- var RNMonitorClient = class extends BaseClient {
67
+ var MonitorClient = class extends BaseClient {
71
68
  constructor(options) {
72
69
  super(Sentry, options);
70
+ return new Proxy(this, {
71
+ get(target, key, receiver) {
72
+ if (key in target) {
73
+ return Reflect.get(target, key, receiver);
74
+ }
75
+ const sentryValue = Sentry[key];
76
+ if (typeof sentryValue === "function") {
77
+ return sentryValue.bind(Sentry);
78
+ }
79
+ return sentryValue;
80
+ }
81
+ });
73
82
  }
74
83
  };
75
84
  // Annotate the CommonJS export names for ESM import in node:
76
85
  0 && (module.exports = {
77
- RNMonitorClient
86
+ MonitorClient
78
87
  });
package/dist/rn.d.cts CHANGED
@@ -1,8 +1,9 @@
1
- import * as Sentry from '@sentry/react-native';
2
- import { B as BaseClient } from './baseClient-CpBY_Ydd.cjs';
1
+ import { ReactNativeOptions } from '@sentry/react-native';
2
+ import { B as BaseClient } from './baseClient-DuhASKYf.cjs';
3
+ import './index.cjs';
3
4
 
4
- declare class RNMonitorClient extends BaseClient {
5
- constructor(options: Sentry.ReactNativeOptions);
5
+ declare class MonitorClient extends BaseClient {
6
+ constructor(options: ReactNativeOptions);
6
7
  }
7
8
 
8
- export { RNMonitorClient };
9
+ export { MonitorClient };
package/dist/rn.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import * as Sentry from '@sentry/react-native';
2
- import { B as BaseClient } from './baseClient-CpBY_Ydd.js';
1
+ import { ReactNativeOptions } from '@sentry/react-native';
2
+ import { B as BaseClient } from './baseClient-CzPUJKaJ.js';
3
+ import './index.js';
3
4
 
4
- declare class RNMonitorClient extends BaseClient {
5
- constructor(options: Sentry.ReactNativeOptions);
5
+ declare class MonitorClient extends BaseClient {
6
+ constructor(options: ReactNativeOptions);
6
7
  }
7
8
 
8
- export { RNMonitorClient };
9
+ export { MonitorClient };
package/dist/rn.js CHANGED
@@ -27,17 +27,26 @@ var BaseClient = class {
27
27
  setUser(user) {
28
28
  this.sentry.setUser(user);
29
29
  }
30
- get ErrorBoundary() {
31
- return this.sentry.ErrorBoundary;
32
- }
33
30
  };
34
31
 
35
32
  // src/adapter/rn/index.ts
36
- var RNMonitorClient = class extends BaseClient {
33
+ var MonitorClient = class extends BaseClient {
37
34
  constructor(options) {
38
35
  super(Sentry, options);
36
+ return new Proxy(this, {
37
+ get(target, key, receiver) {
38
+ if (key in target) {
39
+ return Reflect.get(target, key, receiver);
40
+ }
41
+ const sentryValue = Sentry[key];
42
+ if (typeof sentryValue === "function") {
43
+ return sentryValue.bind(Sentry);
44
+ }
45
+ return sentryValue;
46
+ }
47
+ });
39
48
  }
40
49
  };
41
50
  export {
42
- RNMonitorClient
51
+ MonitorClient
43
52
  };
package/dist/web.cjs CHANGED
@@ -30,10 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/adapter/web/index.ts
31
31
  var web_exports = {};
32
32
  __export(web_exports, {
33
- WebMonitorClient: () => WebMonitorClient
33
+ MonitorClient: () => MonitorClient
34
34
  });
35
35
  module.exports = __toCommonJS(web_exports);
36
- var Sentry = __toESM(require("@sentry/browser"), 1);
36
+ var Sentry = __toESM(require("@sentry/react"), 1);
37
37
 
38
38
  // src/core/baseClient.ts
39
39
  var BaseClient = class {
@@ -61,18 +61,27 @@ var BaseClient = class {
61
61
  setUser(user) {
62
62
  this.sentry.setUser(user);
63
63
  }
64
- get ErrorBoundary() {
65
- return this.sentry.ErrorBoundary;
66
- }
67
64
  };
68
65
 
69
66
  // src/adapter/web/index.ts
70
- var WebMonitorClient = class extends BaseClient {
67
+ var MonitorClient = class extends BaseClient {
71
68
  constructor(options) {
72
69
  super(Sentry, options);
70
+ return new Proxy(this, {
71
+ get(target, key, receiver) {
72
+ if (key in target) {
73
+ return Reflect.get(target, key, receiver);
74
+ }
75
+ const sentryValue = Sentry[key];
76
+ if (typeof sentryValue === "function") {
77
+ return sentryValue.bind(Sentry);
78
+ }
79
+ return sentryValue;
80
+ }
81
+ });
73
82
  }
74
83
  };
75
84
  // Annotate the CommonJS export names for ESM import in node:
76
85
  0 && (module.exports = {
77
- WebMonitorClient
86
+ MonitorClient
78
87
  });
package/dist/web.d.cts CHANGED
@@ -1,8 +1,9 @@
1
- import * as Sentry from '@sentry/browser';
2
- import { B as BaseClient } from './baseClient-CpBY_Ydd.cjs';
1
+ import { BrowserOptions } from '@sentry/react';
2
+ import { B as BaseClient } from './baseClient-DuhASKYf.cjs';
3
+ import './index.cjs';
3
4
 
4
- declare class WebMonitorClient extends BaseClient {
5
- constructor(options: Sentry.BrowserOptions);
5
+ declare class MonitorClient extends BaseClient {
6
+ constructor(options: BrowserOptions);
6
7
  }
7
8
 
8
- export { WebMonitorClient };
9
+ export { MonitorClient };
package/dist/web.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import * as Sentry from '@sentry/browser';
2
- import { B as BaseClient } from './baseClient-CpBY_Ydd.js';
1
+ import { BrowserOptions } from '@sentry/react';
2
+ import { B as BaseClient } from './baseClient-CzPUJKaJ.js';
3
+ import './index.js';
3
4
 
4
- declare class WebMonitorClient extends BaseClient {
5
- constructor(options: Sentry.BrowserOptions);
5
+ declare class MonitorClient extends BaseClient {
6
+ constructor(options: BrowserOptions);
6
7
  }
7
8
 
8
- export { WebMonitorClient };
9
+ export { MonitorClient };
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/adapter/web/index.ts
2
- import * as Sentry from "@sentry/browser";
2
+ import * as Sentry from "@sentry/react";
3
3
 
4
4
  // src/core/baseClient.ts
5
5
  var BaseClient = class {
@@ -27,17 +27,26 @@ var BaseClient = class {
27
27
  setUser(user) {
28
28
  this.sentry.setUser(user);
29
29
  }
30
- get ErrorBoundary() {
31
- return this.sentry.ErrorBoundary;
32
- }
33
30
  };
34
31
 
35
32
  // src/adapter/web/index.ts
36
- var WebMonitorClient = class extends BaseClient {
33
+ var MonitorClient = class extends BaseClient {
37
34
  constructor(options) {
38
35
  super(Sentry, options);
36
+ return new Proxy(this, {
37
+ get(target, key, receiver) {
38
+ if (key in target) {
39
+ return Reflect.get(target, key, receiver);
40
+ }
41
+ const sentryValue = Sentry[key];
42
+ if (typeof sentryValue === "function") {
43
+ return sentryValue.bind(Sentry);
44
+ }
45
+ return sentryValue;
46
+ }
47
+ });
39
48
  }
40
49
  };
41
50
  export {
42
- WebMonitorClient
51
+ MonitorClient
43
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xifan052/monitor",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -10,11 +10,6 @@
10
10
  "dist"
11
11
  ],
12
12
  "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.cjs"
17
- },
18
13
  "./web": {
19
14
  "types": "./dist/web.d.ts",
20
15
  "import": "./dist/web.js",
@@ -35,7 +30,7 @@
35
30
  "prepublishOnly": "pnpm build"
36
31
  },
37
32
  "peerDependencies": {
38
- "@sentry/browser": "^7",
33
+ "@sentry/react": "^7",
39
34
  "@sentry/react-native": "^5"
40
35
  },
41
36
  "devDependencies": {