@orbitai/orbitrace 1.1.5 → 1.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.
- package/README.md +2 -2
- package/dist/index.js +12 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ function getOrbitraceInstance({ service }) {
|
|
|
27
27
|
environment: process.env.APP_ENV,
|
|
28
28
|
service,
|
|
29
29
|
version: process.env.APP_VERSION,
|
|
30
|
+
disabled: process.env.APP_ENV !== "production",
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
return Orbitrace;
|
|
@@ -79,6 +80,7 @@ export function getOrbitraceInstance({ service }) {
|
|
|
79
80
|
environment: import.meta.env.VITE_APP_ENV,
|
|
80
81
|
service,
|
|
81
82
|
version: import.meta.env.VITE_APP_VERSION,
|
|
83
|
+
disabled: process.env.APP_ENV !== "production",
|
|
82
84
|
});
|
|
83
85
|
|
|
84
86
|
return orbitrace;
|
|
@@ -198,5 +200,3 @@ ORBITRACE_ENDPOINT=your-endpoint
|
|
|
198
200
|
APP_ENV=your-environment
|
|
199
201
|
APP_VERSION=your-version
|
|
200
202
|
```
|
|
201
|
-
|
|
202
|
-
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,10 @@ class Orbitrace {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
static isBrowser() {
|
|
39
|
+
return typeof window !== "undefined" && Boolean(window.location?.origin);
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
static async captureException(error, metadata = {}) {
|
|
39
43
|
this.checkInitialized();
|
|
40
44
|
|
|
@@ -88,7 +92,7 @@ class Orbitrace {
|
|
|
88
92
|
|
|
89
93
|
static async sendToApi(event, payload) {
|
|
90
94
|
try {
|
|
91
|
-
const
|
|
95
|
+
const fetchOptions = {
|
|
92
96
|
method: "POST",
|
|
93
97
|
headers: {
|
|
94
98
|
"Content-Type": "application/json",
|
|
@@ -100,7 +104,13 @@ class Orbitrace {
|
|
|
100
104
|
event,
|
|
101
105
|
payload,
|
|
102
106
|
}),
|
|
103
|
-
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (this.isBrowser()) {
|
|
110
|
+
fetchOptions.referrerPolicy = "origin";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const response = await fetch(this.#config.endpoint, fetchOptions);
|
|
104
114
|
|
|
105
115
|
if (!response.ok) {
|
|
106
116
|
throw new Error(`HTTP error! status: ${response.status}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbitai/orbitrace",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "Error tracking and monitoring for Node.js and browser applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"author": "Orbitai",
|
|
17
|
-
"license": "MIT"
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://github.com/leandroparedes/orbitrace#readme"
|
|
18
19
|
}
|