@zyui/error-monitor-sdk 0.1.0 → 0.2.0
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/dist/client.js +3 -1
- package/dist/transport.js +2 -0
- package/dist/types.d.ts +1 -1
- package/package.json +43 -43
package/dist/client.js
CHANGED
|
@@ -92,7 +92,9 @@ export async function captureError(error, options) {
|
|
|
92
92
|
throttleMap.set(key, now);
|
|
93
93
|
}
|
|
94
94
|
const payload = buildPayload(details, options);
|
|
95
|
-
if (!cfg
|
|
95
|
+
if (!cfg)
|
|
96
|
+
return;
|
|
97
|
+
if (!cfg.endpoint && !cfg.transport)
|
|
96
98
|
return;
|
|
97
99
|
const finalPayload = cfg.beforeSend ? cfg.beforeSend(payload) : payload;
|
|
98
100
|
if (!finalPayload)
|
package/dist/transport.js
CHANGED
|
@@ -25,6 +25,8 @@ export async function send(payload, config) {
|
|
|
25
25
|
}
|
|
26
26
|
const headers = mergeHeaders({ "Content-Type": "application/json" }, config.headers);
|
|
27
27
|
const url = config.endpoint;
|
|
28
|
+
if (!url)
|
|
29
|
+
return;
|
|
28
30
|
const body = JSON.stringify(payload);
|
|
29
31
|
try {
|
|
30
32
|
if (typeof fetch === "function") {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type Level = "debug" | "info" | "warn" | "error" | "fatal";
|
|
2
2
|
export type Transport = (payload: ErrorPayload, config: InitConfig) => Promise<void>;
|
|
3
3
|
export interface InitConfig {
|
|
4
|
-
endpoint
|
|
4
|
+
endpoint?: string;
|
|
5
5
|
appKey?: string;
|
|
6
6
|
environment?: string;
|
|
7
7
|
headers?: Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zyui/error-monitor-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"default": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./react-native": {
|
|
14
|
-
"types": "./dist/utils/reactNative.d.ts",
|
|
15
|
-
"default": "./dist/utils/reactNative.js"
|
|
16
|
-
},
|
|
17
|
-
"./web": {
|
|
18
|
-
"types": "./dist/utils/web.d.ts",
|
|
19
|
-
"default": "./dist/utils/web.js"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"dist"
|
|
24
|
-
],
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@zyui/error-monitor-sdk",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./react-native": {
|
|
14
|
+
"types": "./dist/utils/reactNative.d.ts",
|
|
15
|
+
"default": "./dist/utils/reactNative.js"
|
|
16
|
+
},
|
|
17
|
+
"./web": {
|
|
18
|
+
"types": "./dist/utils/web.d.ts",
|
|
19
|
+
"default": "./dist/utils/web.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=16"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "^5.6.3",
|
|
33
|
+
"@changesets/cli": "^2.27.7"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"example": "npm run build && node examples/dev-server.js",
|
|
39
|
+
"changeset": "changeset",
|
|
40
|
+
"version-packages": "changeset version",
|
|
41
|
+
"release": "npm run build && changeset publish"
|
|
42
|
+
}
|
|
43
|
+
}
|