@djangocfg/monitor 2.1.231 → 2.1.233
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 +6 -0
- package/dist/client.cjs +37 -33
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +37 -33
- package/dist/client.mjs.map +1 -1
- package/dist/index.cjs +36 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +36 -32
- package/dist/index.mjs.map +1 -1
- package/dist/server.cjs +36 -32
- package/dist/server.cjs.map +1 -1
- package/dist/server.mjs +36 -32
- package/dist/server.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/cfg_monitor/client.ts +39 -42
package/dist/client.mjs
CHANGED
|
@@ -972,43 +972,47 @@ var _APIClient = class _APIClient {
|
|
|
972
972
|
if (error instanceof APIError) {
|
|
973
973
|
throw error;
|
|
974
974
|
}
|
|
975
|
-
|
|
975
|
+
let possiblyCors = false;
|
|
976
|
+
if (error instanceof TypeError && typeof window !== "undefined") {
|
|
977
|
+
try {
|
|
978
|
+
const isCrossOrigin = (() => {
|
|
979
|
+
try {
|
|
980
|
+
return new URL(url).origin !== window.location.origin;
|
|
981
|
+
} catch {
|
|
982
|
+
return false;
|
|
983
|
+
}
|
|
984
|
+
})();
|
|
985
|
+
if (isCrossOrigin) {
|
|
986
|
+
const entries = performance.getEntriesByName(url, "resource");
|
|
987
|
+
if (entries.length > 0) {
|
|
988
|
+
const last = entries[entries.length - 1];
|
|
989
|
+
possiblyCors = "responseStatus" in last && last.responseStatus === 0;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
} catch {
|
|
993
|
+
}
|
|
994
|
+
}
|
|
976
995
|
if (this.logger) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
this.logger.error(` \u2192
|
|
981
|
-
} else {
|
|
982
|
-
this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
|
|
983
|
-
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
996
|
+
this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
|
|
997
|
+
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
998
|
+
if (possiblyCors) {
|
|
999
|
+
this.logger.error(` \u2192 Possibly blocked by CORS policy (configure CORS on the server)`);
|
|
984
1000
|
}
|
|
985
1001
|
}
|
|
986
1002
|
if (typeof window !== "undefined") {
|
|
987
1003
|
try {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
window.dispatchEvent(new CustomEvent("network-error", {
|
|
1001
|
-
detail: {
|
|
1002
|
-
url,
|
|
1003
|
-
method,
|
|
1004
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1005
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
1006
|
-
},
|
|
1007
|
-
bubbles: true,
|
|
1008
|
-
cancelable: false
|
|
1009
|
-
}));
|
|
1010
|
-
}
|
|
1011
|
-
} catch (eventError) {
|
|
1004
|
+
window.dispatchEvent(new CustomEvent("network-error", {
|
|
1005
|
+
detail: {
|
|
1006
|
+
url,
|
|
1007
|
+
method,
|
|
1008
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1009
|
+
possibly_cors: possiblyCors,
|
|
1010
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1011
|
+
},
|
|
1012
|
+
bubbles: true,
|
|
1013
|
+
cancelable: false
|
|
1014
|
+
}));
|
|
1015
|
+
} catch {
|
|
1012
1016
|
}
|
|
1013
1017
|
}
|
|
1014
1018
|
const networkError = error instanceof Error ? new NetworkError(error.message, url, error) : new NetworkError("Unknown error", url);
|
|
@@ -1337,7 +1341,7 @@ __name(sendBatch, "sendBatch");
|
|
|
1337
1341
|
// src/client/utils/env.ts
|
|
1338
1342
|
var isDevelopment = true;
|
|
1339
1343
|
var isProduction = false;
|
|
1340
|
-
var MONITOR_VERSION = "2.1.
|
|
1344
|
+
var MONITOR_VERSION = "2.1.233";
|
|
1341
1345
|
|
|
1342
1346
|
// src/client/store/index.ts
|
|
1343
1347
|
var CIRCUIT_BREAKER_THRESHOLD = 3;
|