@swifty.js/sentry 0.0.4 → 0.0.6
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/LICENSE +21 -0
- package/README.md +124 -144
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/core/api.cjs +1 -1
- package/dist/core/api.d.ts +28 -9
- package/dist/core/api.js +1 -1
- package/dist/core/breadcrumb.cjs +1 -1
- package/dist/core/breadcrumb.js +1 -1
- package/dist/core/decorate-http.cjs +1 -1
- package/dist/core/decorate-http.js +1 -1
- package/dist/core/decorate-route.cjs +1 -1
- package/dist/core/decorate-route.js +1 -1
- package/dist/core/decorates.cjs +1 -1
- package/dist/core/decorates.js +1 -1
- package/dist/core/error-dedup.cjs +1 -0
- package/dist/core/error-dedup.js +1 -0
- package/dist/core/framework-error.cjs +1 -1
- package/dist/core/framework-error.js +1 -1
- package/dist/core/handle-code-error.cjs +1 -1
- package/dist/core/handle-code-error.js +1 -1
- package/dist/core/handle-error.cjs +1 -1
- package/dist/core/handle-error.js +1 -1
- package/dist/core/handle-events.cjs +1 -1
- package/dist/core/handle-events.js +1 -1
- package/dist/core/handle-route.cjs +1 -1
- package/dist/core/handle-route.js +1 -1
- package/dist/core/identity.cjs +1 -1
- package/dist/core/identity.js +1 -1
- package/dist/core/options-schema.cjs +1 -1
- package/dist/core/options-schema.d.ts +42 -45
- package/dist/core/options-schema.js +1 -1
- package/dist/core/pv-lifecycle.cjs +1 -1
- package/dist/core/pv-lifecycle.js +1 -1
- package/dist/core/sdk-lifecycle.cjs +1 -1
- package/dist/core/sdk-lifecycle.d.ts +1 -1
- package/dist/core/sdk-lifecycle.js +1 -1
- package/dist/core/setup.cjs +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/core/white-screen.cjs +1 -1
- package/dist/core/white-screen.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1 -1
- package/dist/node/dev-endpoint.cjs +1 -0
- package/dist/node/dev-endpoint.js +1 -0
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/exposure/index.cjs +1 -1
- package/dist/plugins/exposure/index.d.ts +0 -1
- package/dist/plugins/exposure/index.js +1 -1
- package/dist/plugins/performance/first-screen-paint.cjs +1 -1
- package/dist/plugins/performance/first-screen-paint.js +1 -1
- package/dist/plugins/performance/index.cjs +1 -1
- package/dist/plugins/performance/index.d.ts +0 -1
- package/dist/plugins/performance/index.js +1 -1
- package/dist/plugins/performance/navigation-timing.cjs +1 -1
- package/dist/plugins/performance/navigation-timing.js +1 -1
- package/dist/plugins/performance/perf.cjs +1 -1
- package/dist/plugins/performance/perf.js +1 -1
- package/dist/plugins/performance/resource-element-fallback.cjs +1 -1
- package/dist/plugins/performance/resource-element-fallback.js +1 -1
- package/dist/plugins/performance/resource-timing.cjs +1 -1
- package/dist/plugins/performance/resource-timing.js +1 -1
- package/dist/plugins/screen-record/index.cjs +1 -1
- package/dist/plugins/screen-record/index.js +1 -1
- package/dist/plugins/screen-record/recorder.cjs +1 -1
- package/dist/plugins/screen-record/recorder.d.ts +1 -1
- package/dist/plugins/screen-record/recorder.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.d.ts +7 -80
- package/dist/react.js +1 -1
- package/dist/reporter/index.cjs +1 -1
- package/dist/reporter/index.js +1 -1
- package/dist/reporter/network-listener.cjs +1 -1
- package/dist/reporter/network-listener.js +1 -1
- package/dist/reporter/offline-cache.cjs +1 -1
- package/dist/reporter/offline-cache.js +1 -1
- package/dist/reporter/report-data-schema.cjs +1 -1
- package/dist/reporter/report-data-schema.js +1 -1
- package/dist/reporter/report-data.cjs +1 -1
- package/dist/reporter/report-data.js +1 -1
- package/dist/reporter/server-recovery.cjs +1 -1
- package/dist/reporter/server-recovery.js +1 -1
- package/dist/reporter/transports.cjs +1 -1
- package/dist/reporter/transports.js +1 -1
- package/dist/source-map/source-map.cjs +1 -0
- package/dist/source-map/source-map.js +1 -0
- package/dist/source-map/vite.cjs +1 -0
- package/dist/source-map/vite.js +1 -0
- package/dist/source-map/webpack.cjs +1 -0
- package/dist/source-map/webpack.js +1 -0
- package/dist/types/common.d.ts +10 -11
- package/dist/types/enums.cjs +1 -1
- package/dist/types/enums.d.ts +1 -45
- package/dist/types/enums.js +1 -1
- package/dist/types/options.d.ts +9 -13
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.ts +0 -3
- package/dist/types/plugin.js +1 -1
- package/dist/utils/click-data.cjs +1 -1
- package/dist/utils/click-data.js +1 -1
- package/dist/utils/data-structures.cjs +1 -1
- package/dist/utils/data-structures.js +1 -1
- package/dist/utils/dom2str.cjs +1 -0
- package/dist/utils/dom2str.js +1 -0
- package/dist/utils/get-base-data.cjs +1 -1
- package/dist/utils/get-base-data.js +1 -1
- package/dist/utils/logger.cjs +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/noop.cjs +1 -0
- package/dist/utils/noop.js +1 -0
- package/dist/utils/sentry.cjs +1 -1
- package/dist/utils/sentry.js +1 -1
- package/dist/utils/session.cjs +1 -1
- package/dist/utils/session.js +1 -1
- package/dist/utils/throttle.cjs +1 -1
- package/dist/utils/throttle.js +1 -1
- package/dist/utils/transform-http-data.cjs +1 -1
- package/dist/utils/transform-http-data.js +1 -1
- package/dist/utils/uuid.cjs +1 -0
- package/dist/utils/uuid.js +1 -0
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +22 -26
- package/dist/core/ip.cjs +0 -1
- package/dist/core/ip.d.ts +0 -24
- package/dist/core/ip.js +0 -1
- package/dist/reporter/batch.cjs +0 -1
- package/dist/reporter/batch.js +0 -1
- package/dist/sourcemap/sourcemap.cjs +0 -1
- package/dist/sourcemap/sourcemap.js +0 -1
- package/dist/sourcemap/vite.cjs +0 -1
- package/dist/sourcemap/vite.js +0 -1
- package/dist/sourcemap/webpack.cjs +0 -1
- package/dist/sourcemap/webpack.js +0 -1
- package/dist/utils/base64.cjs +0 -1
- package/dist/utils/base64.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import s from"../../reporter/index.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import{
|
|
1
|
+
import{EventType as e}from"../../types/enums.js";import{SentryPlugin as r}from"../../types/plugin.js";import s from"../../reporter/index.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import{noop as o}from"../../utils/noop.js";import"../../utils/logger.js";import{getNavigationTimingData as i}from"./navigation-timing.js";import{getWebVitals as n}from"./perf.js";import{supportsPerformanceEntryType as a}from"./performance-observer-support.js";import{observeResourceElementFallback as p}from"./resource-element-fallback.js";import{observeResourceTimings as m,getInitialResourceListData as c}from"./resource-timing.js";class l extends r{cleanups=[];init(){this.cleanups.push(this.startWebVitals()),this.cleanups.push(this.observeLongTasks()),this.cleanups.push(m(e=>this.report(e))),this.cleanups.push(p(e=>this.report(e))),this.cleanups.push(this.onPageReady(()=>{this.reportPageLoadTimings()})),this.reportMemory()}destroy(){this.cleanups.toReversed().forEach(e=>{e()}),this.cleanups=[]}report(e){s.send(e)}startWebVitals(){try{return n(e=>{this.report(e)})}catch{return o}}observeLongTasks(){if(!a("longtask"))return o;const r=new globalThis.PerformanceObserver(r=>{const s={...t(),name:"LongTask",type:e.Performance,longTasks:r.getEntries()};this.report(s)});return r.observe({entryTypes:["longtask"]}),()=>{r.disconnect()}}onPageReady(e){if("complete"===document.readyState)return queueMicrotask(e),o;const r=()=>{e()};return globalThis.addEventListener("load",r,{once:!0}),()=>{globalThis.removeEventListener("load",r)}}reportPageLoadTimings(){const e=i();e&&this.report(e),this.report(c())}async reportMemory(){if("performance"in globalThis&&"measureUserAgentSpecificMemory"in globalThis.performance&&"function"==typeof globalThis.performance.measureUserAgentSpecificMemory){const r={...t(),name:"Memory",type:e.Performance,message:"performance.measureUserAgentSpecificMemory",memory:await globalThis.performance.measureUserAgentSpecificMemory()};this.report(r)}}}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("../../types/enums.cjs");require("../../constants/index.cjs");var e=require("../../utils/get-base-data.cjs");function n(t,e){return Math.max(0,Math.round(t-e))}function r(t,e){const r=t.fetchStart;return{paintTime:e>0?n(e,r):0,domInteractive:n(t.domInteractive,r),domContentLoaded:n(t.domContentLoadedEventEnd,r),loadEvent:n(t.loadEventStart,r),firstByte:n(t.responseStart,r),dnsLookup:n(t.domainLookupEnd,t.domainLookupStart),tcpConnection:n(t.connectEnd,t.connectStart),tlsHandshake:n(t.connectEnd,t.secureConnectionStart),timeToFirstByte:n(t.responseStart,t.requestStart),contentTransfer:n(t.responseEnd,t.responseStart),domProcessing:n(t.domInteractive,t.responseEnd),resourceLoad:n(t.loadEventStart,t.domContentLoadedEventEnd),redirect:n(t.redirectEnd,t.redirectStart),unloadTime:n(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs"),exports.getNavigationTimingData=function(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const n=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return n?{...e.default(),type:t.EventType.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.Status.OK,extra:r(n,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null};
|
|
1
|
+
"use strict";var t=require("../../types/enums.cjs");require("../../constants/index.cjs");var e=require("../../utils/get-base-data.cjs");function n(t,e){return Math.max(0,Math.round(t-e))}function r(t,e){const r=t.fetchStart;return{paintTime:e>0?n(e,r):0,domInteractive:n(t.domInteractive,r),domContentLoaded:n(t.domContentLoadedEventEnd,r),loadEvent:n(t.loadEventStart,r),firstByte:n(t.responseStart,r),dnsLookup:n(t.domainLookupEnd,t.domainLookupStart),tcpConnection:n(t.connectEnd,t.connectStart),tlsHandshake:n(t.connectEnd,t.secureConnectionStart),timeToFirstByte:n(t.responseStart,t.requestStart),contentTransfer:n(t.responseEnd,t.responseStart),domProcessing:n(t.domInteractive,t.responseEnd),resourceLoad:n(t.loadEventStart,t.domContentLoadedEventEnd),redirect:n(t.redirectEnd,t.redirectStart),unloadTime:n(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs"),require("../../utils/logger.cjs"),exports.getNavigationTimingData=function(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const n=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return n?{...e.default(),type:t.EventType.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.Status.OK,extra:r(n,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Status as t,EventType as n}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";function o(t,n){return Math.max(0,Math.round(t-n))}function r(t,n){const e=t.fetchStart;return{paintTime:n>0?o(n,e):0,domInteractive:o(t.domInteractive,e),domContentLoaded:o(t.domContentLoadedEventEnd,e),loadEvent:o(t.loadEventStart,e),firstByte:o(t.responseStart,e),dnsLookup:o(t.domainLookupEnd,t.domainLookupStart),tcpConnection:o(t.connectEnd,t.connectStart),tlsHandshake:o(t.connectEnd,t.secureConnectionStart),timeToFirstByte:o(t.responseStart,t.requestStart),contentTransfer:o(t.responseEnd,t.responseStart),domProcessing:o(t.domInteractive,t.responseEnd),resourceLoad:o(t.loadEventStart,t.domContentLoadedEventEnd),redirect:o(t.redirectEnd,t.redirectStart),unloadTime:o(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}function a(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const o=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return o?{...e(),type:n.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.OK,extra:r(o,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null}export{a as getNavigationTimingData};
|
|
1
|
+
import{Status as t,EventType as n}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import"../../utils/logger.js";function o(t,n){return Math.max(0,Math.round(t-n))}function r(t,n){const e=t.fetchStart;return{paintTime:n>0?o(n,e):0,domInteractive:o(t.domInteractive,e),domContentLoaded:o(t.domContentLoadedEventEnd,e),loadEvent:o(t.loadEventStart,e),firstByte:o(t.responseStart,e),dnsLookup:o(t.domainLookupEnd,t.domainLookupStart),tcpConnection:o(t.connectEnd,t.connectStart),tlsHandshake:o(t.connectEnd,t.secureConnectionStart),timeToFirstByte:o(t.responseStart,t.requestStart),contentTransfer:o(t.responseEnd,t.responseStart),domProcessing:o(t.domInteractive,t.responseEnd),resourceLoad:o(t.loadEventStart,t.domContentLoadedEventEnd),redirect:o(t.redirectEnd,t.redirectStart),unloadTime:o(t.unloadEventEnd,t.unloadEventStart),triggerPageUrl:location.href}}function a(){if(!("performance"in globalThis)||"function"!=typeof globalThis.performance.getEntriesByType)return null;const o=function(){const t=globalThis.performance.getEntriesByType("navigation")[0];return t&&function(t){return"navigation"===t.entryType&&"fetchStart"in t}(t)?t:null}();return o?{...e(),type:n.Performance,name:"NavigationTiming",message:"Page navigation timing",status:t.OK,extra:r(o,globalThis.performance.getEntriesByType("paint").at(-1)?.startTime??0)}:null}export{a as getNavigationTimingData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../types/enums.cjs"),t=require("web-vitals");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs");var s=require("../../utils/metric2perf-data.cjs"),
|
|
1
|
+
"use strict";var e=require("../../types/enums.cjs"),t=require("web-vitals");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs");require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs");var s=require("../../utils/metric2perf-data.cjs"),n=require("../../utils/logger.cjs"),i=require("./first-screen-paint.cjs");exports.getWebVitals=function(u){n.sentryLogger.info("Starting web vitals monitoring...");const a=e=>{n.sentryLogger.success(`Metric: ${e.name}`,e,function(e){if("value"in e&&"number"==typeof e.value)return Math.round(e.value)}(e)),u(e)};return t.onLCP(e=>{a(s.default(e))}),t.onFCP(e=>{a(s.default(e))}),t.onCLS(e=>{a(s.default(e))}),t.onINP(e=>{a(s.default(e))}),t.onTTFB(e=>{a(s.default(e))}),i.getFirstScreenPaint(t=>{const s={...r.default(),name:"FSP",value:t,type:e.EventType.Performance,message:"First screen paint"};a(s)})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventType as t}from"../../types/enums.js";import{onLCP as
|
|
1
|
+
import{EventType as t}from"../../types/enums.js";import{onLCP as r,onFCP as e,onCLS as s,onINP as i,onTTFB as o}from"web-vitals";import"../../constants/index.js";import n from"../../utils/get-base-data.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import m from"../../utils/metric2perf-data.js";import{sentryLogger as a}from"../../utils/logger.js";import{getFirstScreenPaint as p}from"./first-screen-paint.js";function u(u){a.info("Starting web vitals monitoring...");const f=t=>{a.success(`Metric: ${t.name}`,t,function(t){if("value"in t&&"number"==typeof t.value)return Math.round(t.value)}(t)),u(t)};return r(t=>{f(m(t))}),e(t=>{f(m(t))}),s(t=>{f(m(t))}),i(t=>{f(m(t))}),o(t=>{f(m(t))}),p(r=>{const e={...n(),name:"FSP",value:r,type:t.Performance,message:"First screen paint"};f(e)})}export{u as getWebVitals};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("../../constants/index.cjs"),require("../../types/enums.cjs");var e=require("../../utils/
|
|
1
|
+
"use strict";require("../../constants/index.cjs"),require("../../types/enums.cjs"),require("../../utils/sentry.cjs"),require("../../utils/is-type.cjs");var e=require("../../utils/noop.cjs");require("../../utils/logger.cjs");var r=require("./resource-timing.cjs"),n=require("./performance-observer-support.cjs");const t=new Set(["IMG","SCRIPT","LINK"]);exports.observeResourceElementFallback=function(o){if(n.supportsPerformanceEntryType("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return e.noop;const s=[],i=new Set,c=e=>{const n=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(e);if(!n||i.has(n)||r.isSdkReportUrl(n))return;i.add(n);const t=function(e){return r.getResourceList().filter(r=>r.name===e).at(-1)??null}(n)??function(e,r){const n="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:r,startTime:n,responseEnd:n,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(n,e.tagName.toLowerCase());o(r.createResourceTimingData(t))},a=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&t.has(e.tagName)})(e)&&(e=>{const r=()=>{c(e)};e.addEventListener("load",r,{once:!0}),e.addEventListener("error",r,{once:!0}),s.push({element:e,eventName:"load",listener:r}),s.push({element:e,eventName:"error",listener:r})})(e)})})});return a.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{a.disconnect(),s.forEach(({element:e,eventName:r,listener:n})=>{e.removeEventListener(r,n)})}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../constants/index.js";import"../../types/enums.js";import
|
|
1
|
+
import"../../constants/index.js";import"../../types/enums.js";import"../../utils/sentry.js";import"../../utils/is-type.js";import{noop as e}from"../../utils/noop.js";import"../../utils/logger.js";import{isSdkReportUrl as t,createResourceTimingData as n,getResourceList as r}from"./resource-timing.js";import{supportsPerformanceEntryType as o}from"./performance-observer-support.js";const s=new Set(["IMG","SCRIPT","LINK"]);function i(i){if(o("resource")||!("MutationObserver"in globalThis)||"function"!=typeof globalThis.MutationObserver)return e;const a=[],c=new Set,m=e=>{const o=function(e){return e instanceof HTMLImageElement?e.currentSrc||e.src:e instanceof HTMLScriptElement?e.src:e.href}(e);if(!o||c.has(o)||t(o))return;c.add(o);const s=function(e){return r().filter(t=>t.name===e).at(-1)??null}(o)??function(e,t){const n="performance"in globalThis?Math.round(globalThis.performance.now()):Date.now();return{name:e,initiatorType:t,startTime:n,responseEnd:n,duration:0,transferSize:0,encodedBodySize:0,decodedBodySize:0,fromCache:!1}}(o,e.tagName.toLowerCase());i(n(s))},u=new globalThis.MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{(function(e){return e instanceof HTMLElement&&s.has(e.tagName)})(e)&&(e=>{const t=()=>{m(e)};e.addEventListener("load",t,{once:!0}),e.addEventListener("error",t,{once:!0}),a.push({element:e,eventName:"load",listener:t}),a.push({element:e,eventName:"error",listener:t})})(e)})})});return u.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{u.disconnect(),a.forEach(({element:e,eventName:t,listener:n})=>{e.removeEventListener(t,n)})}}export{i as observeResourceElementFallback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("./performance-observer-support.cjs");const
|
|
1
|
+
"use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("../../utils/noop.cjs");require("../../utils/logger.cjs");var s=require("./performance-observer-support.cjs");const o=new Set(["fetch","xmlhttprequest","beacon"]);function i(e){return"resource"===e.entryType&&"initiatorType"in e}function u(e){return""!==t.default.options.dsn&&e.includes(t.default.options.dsn)}function a(e){return!o.has(e.initiatorType)&&!u(e.name)}function c(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:d(e)}}function p(t){return{...r.default(),type:e.EventType.Performance,name:"ResourceTiming",message:t.name,status:e.Status.OK,value:t.duration,extra:{resource:t}}}function d(e){return 0===e.transferSize||0===e.encodedBodySize}function f(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(i).filter(a).map(c):[]}exports.createResourceTimingData=p,exports.getInitialResourceListData=function(){return{...r.default(),name:"ResourceList",type:e.EventType.Performance,status:e.Status.OK,resourceList:f()}},exports.getResourceList=f,exports.isSdkReportUrl=u,exports.observeResourceTimings=function(e){if(!s.supportsPerformanceEntryType("resource"))return n.noop;const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(i).filter(a).map(c).forEach(r=>{e(p(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Status as e,EventType as r}from"../../types/enums.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import n from"../../utils/sentry.js";import"../../utils/is-type.js";import{
|
|
1
|
+
import{Status as e,EventType as r}from"../../types/enums.js";import"../../constants/index.js";import t from"../../utils/get-base-data.js";import n from"../../utils/sentry.js";import"../../utils/is-type.js";import{noop as o}from"../../utils/noop.js";import"../../utils/logger.js";import{supportsPerformanceEntryType as i}from"./performance-observer-support.js";const s=new Set(["fetch","xmlhttprequest","beacon"]);function a(e){return"resource"===e.entryType&&"initiatorType"in e}function u(e){return""!==n.options.dsn&&e.includes(n.options.dsn)}function c(e){return!s.has(e.initiatorType)&&!u(e.name)}function p(e){return{name:e.name,initiatorType:e.initiatorType,startTime:Math.round(e.startTime),responseEnd:Math.round(e.responseEnd),duration:Math.round(e.duration),transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,fromCache:f(e)}}function m(n){return{...t(),type:r.Performance,name:"ResourceTiming",message:n.name,status:e.OK,value:n.duration,extra:{resource:n}}}function f(e){return 0===e.transferSize||0===e.encodedBodySize}function d(){return"performance"in globalThis&&"function"==typeof globalThis.performance.getEntriesByType?globalThis.performance.getEntriesByType("resource").filter(a).filter(c).map(p):[]}function y(){return{...t(),name:"ResourceList",type:r.Performance,status:e.OK,resourceList:d()}}function l(e){if(!i("resource"))return o;const r=new globalThis.PerformanceObserver(r=>{r.getEntries().filter(a).filter(c).map(p).forEach(r=>{e(m(r))})});return r.observe({entryTypes:["resource"]}),()=>{r.disconnect()}}export{m as createResourceTimingData,y as getInitialResourceListData,d as getResourceList,u as isSdkReportUrl,l as observeResourceTimings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0})
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("../../types/enums.cjs");var e=require("../../types/plugin.cjs"),r=require("../../constants/index.cjs"),s=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs"),require("../../utils/logger.cjs");var t=require("../../reporter/index.cjs"),n=require("./recorder.cjs");class i extends e.SentryPlugin{durationMs;eventTypes;cleanup=null;constructor(e={}){super(),this.durationMs=e.durationMs??r.DEFAULT_OPTIONS.screenRecordDurationMs,this.eventTypes=[...e.eventTypes??r.DEFAULT_OPTIONS.screenRecordEventTypes]}init(){s.default.setOptions({screenRecordEventTypes:[...this.eventTypes],screenRecordDurationMs:this.durationMs}),n.recorder(t.default).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}exports.unzipScreenRecord=n.unzipScreenRecord,exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../../types/enums.js";import{SentryPlugin as e}from"../../types/plugin.js";import{DEFAULT_OPTIONS as s}from"../../constants/index.js";import t from"../../utils/sentry.js";import"../../utils/is-type.js";import"../../utils/logger.js";import r from"../../reporter/index.js";import{recorder as n}from"./recorder.js";export{unzipScreenRecord}from"./recorder.js";class o extends e{durationMs;eventTypes;cleanup=null;constructor(e={}){super(),this.durationMs=e.durationMs??s.screenRecordDurationMs,this.eventTypes=[...e.eventTypes??s.screenRecordEventTypes]}init(){t.setOptions({screenRecordEventTypes:[...this.eventTypes],screenRecordDurationMs:this.durationMs}),n(r).then(e=>{this.cleanup=e})}destroy(){this.cleanup?.(),this.cleanup=null}}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("../../utils/
|
|
1
|
+
"use strict";var e=require("../../types/enums.cjs");require("../../constants/index.cjs");var r=require("../../utils/get-base-data.cjs"),t=require("../../utils/sentry.cjs");require("../../utils/is-type.cjs");var n=require("../../utils/noop.cjs"),o=require("../../utils/logger.cjs"),s=require("zod");let c=null;const i=s.z.looseObject({timestamp:s.z.number()});function u(e){if(!e||!c)return"";const r=JSON.stringify(e);return function(e){let r="";for(let t=0;t<e.length;t+=32768)r+=String.fromCharCode(...e.subarray(t,t+32768));return btoa(r)}(c.gzip(r))}exports.recorder=async function(s){o.sentryLogger.info("Initializing web recorder...");try{const[{record:a},d]=await Promise.all([import("@rrweb/record"),import("pako")]);c=d.default;const l=[],p=e=>{const r=e-t.default.options.screenRecordDurationMs;for(;l.length>0&&l[0].timestamp<r;)l.shift()},f=a({emit(n){const c=i.safeParse(n);if(c.success&&(l.push(c.data),p(c.data.timestamp),t.default.shouldScreenRecord&&l.length>0)){const n={...r.default(),name:"ScreenRecord",type:e.EventType.ScreenRecord,event:u(l),eventCount:l.length};o.sentryLogger.success("Screen record window packaged and sent",{eventCount:n.eventCount}),s.send(n),t.default.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:t.default.options.screenRecordDurationMs});return"function"==typeof f?f:n.noop}catch(e){return o.sentryLogger.error("Failed to load web recorder",e),n.noop}},exports.unzipScreenRecord=async function(e){if(!e)return null;const r=(c??(await(import("pako"))).default).ungzip(function(e){const r=atob(e);return Uint8Array.from(r,e=>e.charCodeAt(0))}(e),{to:"string"});return JSON.parse(r)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventType as t}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import r from"../../utils/sentry.js";import"../../utils/is-type.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as
|
|
1
|
+
import{EventType as t}from"../../types/enums.js";import"../../constants/index.js";import e from"../../utils/get-base-data.js";import r from"../../utils/sentry.js";import"../../utils/is-type.js";import{noop as o}from"../../utils/noop.js";import{sentryLogger as n}from"../../utils/logger.js";import{z as s}from"zod";let i=null;const c=s.looseObject({timestamp:s.number()});async function a(s){n.info("Initializing web recorder...");try{const[{record:a},m]=await Promise.all([import("@rrweb/record"),import("pako")]);i=m.default;const d=[],p=t=>{const e=t-r.options.screenRecordDurationMs;for(;d.length>0&&d[0].timestamp<e;)d.shift()},l=a({emit(o){const i=c.safeParse(o);if(i.success&&(d.push(i.data),p(i.data.timestamp),r.shouldScreenRecord&&d.length>0)){const o={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:u(d),eventCount:d.length};n.success("Screen record window packaged and sent",{eventCount:o.eventCount}),s.send(o),r.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:r.options.screenRecordDurationMs});return"function"==typeof l?l:o}catch(t){return n.error("Failed to load web recorder",t),o}}function u(t){if(!t||!i)return"";const e=JSON.stringify(t);return function(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}(i.gzip(e))}async function m(t){if(!t)return null;const e=(i??(await(import("pako"))).default).ungzip(function(t){const e=atob(t);return Uint8Array.from(e,t=>t.charCodeAt(0))}(t),{to:"string"});return JSON.parse(e)}export{a as recorder,m as unzipScreenRecord};
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("react"),e=require("./types/enums.cjs"),t=require("./core/framework-error.cjs");class o extends r.Component{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),t.reportFrameworkError({type:e.EventType.React,error:r,context:o})}render(){const{error:r,errorInfo:e}=this.state;if(r){const{fallback:t}=this.props;return"function"==typeof t?t(r,e):t??null}return this.props.children??null}}exports.ReactErrorBoundary=o;
|
|
1
|
+
"use strict";var r=require("react"),e=require("./types/enums.cjs"),t=require("./core/framework-error.cjs");class o extends r.Component{static displayName="ReactErrorBoundary";state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),t.reportFrameworkError({type:e.EventType.React,error:r,context:o})}render(){const{error:r,errorInfo:e}=this.state;if(r){const{fallback:t}=this.props;return"function"==typeof t?t(r,e):t??null}return this.props.children??null}}exports.ReactErrorBoundary=o;
|
package/dist/react.d.ts
CHANGED
|
@@ -22,101 +22,28 @@ import { Component, ReactNode, ErrorInfo } from 'react';
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Props for the {@link ReactErrorBoundary} component.
|
|
27
|
-
*
|
|
28
|
-
* The boundary renders `children` normally. When a descendant throws during
|
|
29
|
-
* rendering, it switches to rendering {@link fallback} and reports the error
|
|
30
|
-
* to the Sentry SDK.
|
|
31
|
-
*/
|
|
32
25
|
interface ReactErrorBoundaryProps {
|
|
33
|
-
/**
|
|
34
|
-
* The subtree to render when no error has occurred. When an error is
|
|
35
|
-
* caught, this is replaced by {@link fallback}.
|
|
36
|
-
*/
|
|
37
26
|
readonly children?: ReactNode;
|
|
38
27
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @remarks
|
|
45
|
-
* The render function may be invoked twice during an error cycle:
|
|
46
|
-
* 1. First, right after `getDerivedStateFromError` runs in the render
|
|
47
|
-
* phase — at this point `errorInfo` is still `undefined` because React
|
|
48
|
-
* only delivers {@link ErrorInfo} in `componentDidCatch` (commit phase).
|
|
49
|
-
* 2. Again after `componentDidCatch` merges `errorInfo` into state.
|
|
50
|
-
*
|
|
51
|
-
* Therefore `errorInfo` is typed as optional. Guard against `undefined` if
|
|
52
|
-
* your fallback relies on `componentStack`.
|
|
53
|
-
*
|
|
54
|
-
* @param error - The Error thrown by the descendant component. Always
|
|
55
|
-
* defined when the fallback is invoked, because the boundary only enters
|
|
56
|
-
* the error state when an Error is present.
|
|
57
|
-
* @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`.
|
|
58
|
-
* `undefined` on the first render after the error is caught.
|
|
59
|
-
* @returns The fallback React subtree to render.
|
|
28
|
+
* Error UI. A render function may be called once with `errorInfo`
|
|
29
|
+
* undefined (the fallback renders from `getDerivedStateFromError` before
|
|
30
|
+
* React delivers `ErrorInfo` in `componentDidCatch`) and again once it is
|
|
31
|
+
* available.
|
|
60
32
|
*/
|
|
61
33
|
readonly fallback?: ReactNode | ((error: Error, errorInfo?: ErrorInfo) => ReactNode);
|
|
62
34
|
}
|
|
63
|
-
/** Internal state tracking the caught error and React component-stack info. */
|
|
64
35
|
interface ReactErrorBoundaryState {
|
|
65
36
|
readonly error?: Error;
|
|
66
37
|
readonly errorInfo?: ErrorInfo;
|
|
67
38
|
}
|
|
68
39
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```tsx
|
|
73
|
-
* <ReactErrorBoundary fallback={<div>Something went wrong</div>}>
|
|
74
|
-
* <Page />
|
|
75
|
-
* </ReactErrorBoundary>
|
|
76
|
-
* ```
|
|
40
|
+
* React Error Boundary that renders `fallback` and reports the caught error
|
|
41
|
+
* to the SDK as an `EventType.React` event.
|
|
77
42
|
*/
|
|
78
43
|
declare class ReactErrorBoundary extends Component<ReactErrorBoundaryProps, ReactErrorBoundaryState> {
|
|
44
|
+
static displayName: string;
|
|
79
45
|
state: ReactErrorBoundaryState;
|
|
80
|
-
/**
|
|
81
|
-
* Called by React during the **render phase** when a descendant throws.
|
|
82
|
-
*
|
|
83
|
-
* This is a pure static method — it must not access `this` or cause side
|
|
84
|
-
* effects. Its sole responsibility is to return the next state so React can
|
|
85
|
-
* immediately re-render the boundary and show the fallback UI without
|
|
86
|
-
* waiting for the commit phase.
|
|
87
|
-
*
|
|
88
|
-
* Only `error` is available here; React does not deliver {@link ErrorInfo}
|
|
89
|
-
* until {@link componentDidCatch} runs (commit phase), so `errorInfo` is
|
|
90
|
-
* left `undefined` at this point.
|
|
91
|
-
*
|
|
92
|
-
* This method is **not redundant** with {@link componentDidCatch}. It
|
|
93
|
-
* triggers the fallback render synchronously in the render phase; without
|
|
94
|
-
* it the fallback would not appear until after commit.
|
|
95
|
-
*
|
|
96
|
-
* @param error - The Error thrown by the descendant component.
|
|
97
|
-
* @returns The next state, setting `error` so the boundary renders the
|
|
98
|
-
* fallback.
|
|
99
|
-
*/
|
|
100
46
|
static getDerivedStateFromError(error: Error): ReactErrorBoundaryState;
|
|
101
|
-
/**
|
|
102
|
-
* Called by React during the **commit phase** (after the DOM has been
|
|
103
|
-
* updated) when a descendant throws.
|
|
104
|
-
*
|
|
105
|
-
* This is where side effects belong. It performs two duties:
|
|
106
|
-
* 1. Merges `errorInfo` (React's component-stack trace) into state so the
|
|
107
|
-
* fallback render function can access it. `error` is also set again —
|
|
108
|
-
* it is already present from
|
|
109
|
-
* {@link getDerivedStateFromError | getDerivedStateFromError} but is
|
|
110
|
-
* included for a single atomic state update.
|
|
111
|
-
* 2. Reports the error to the Sentry SDK as a `React` event via
|
|
112
|
-
* {@link reportFrameworkError}.
|
|
113
|
-
*
|
|
114
|
-
* @param error - The Error thrown by the descendant component.
|
|
115
|
-
* @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`:
|
|
116
|
-
* a string describing the component tree from the throwing component up to
|
|
117
|
-
* this boundary. Useful for locating where in the component hierarchy the
|
|
118
|
-
* error originated.
|
|
119
|
-
*/
|
|
120
47
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
121
48
|
render(): ReactNode;
|
|
122
49
|
}
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as r}from"react";import{EventType as t}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";class o extends r{state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),e({type:t.React,error:r,context:o})}render(){const{error:r,errorInfo:t}=this.state;if(r){const{fallback:e}=this.props;return"function"==typeof e?e(r,t):e??null}return this.props.children??null}}export{o as ReactErrorBoundary};
|
|
1
|
+
import{Component as r}from"react";import{EventType as t}from"./types/enums.js";import{reportFrameworkError as e}from"./core/framework-error.js";class o extends r{static displayName="ReactErrorBoundary";state={};static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,o){this.setState({error:r,errorInfo:o}),e({type:t.React,error:r,context:o})}render(){const{error:r,errorInfo:t}=this.state;if(r){const{fallback:e}=this.props;return"function"==typeof e?e(r,t):e??null}return this.props.children??null}}export{o as ReactErrorBoundary};
|
package/dist/reporter/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0})
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/uuid.cjs"),t=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var s=require("../utils/logger.cjs"),i=require("./flush-scheduler.cjs"),r=require("./network-listener.cjs"),h=require("./offline-cache.cjs"),n=require("./promise.cjs"),u=require("./report-data.cjs"),o=require("./send-preflight.cjs"),l=require("./server-recovery.cjs"),a=require("./transports.cjs");class c{id=e.generateUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;hasPersistedCache=!1;removeNetworkListener;constructor(){this.removeNetworkListener=r.initNetworkListener({setOnline:e=>{this.isOnline=e},flush:()=>this.flush()}),this.loadOfflineCache()}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.removeNetworkListener(),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...h.loadOfflineCache()),this.events=this.events.slice(-t.default.options.maxQueueLength)}saveOfflineCache(){h.saveOfflineCache(this.events),this.hasPersistedCache=!0}clearPersistedCache(){this.hasPersistedCache&&(h.clearOfflineCache(),this.hasPersistedCache=!1)}handleServerError(){this.retryTimer=l.scheduleServerRecovery(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();const e=this.takeBatch(),i=n.isPromise(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const r=performance.now(),h=this.sendBatch(i);if(!(n.isPromise(h)?await h:h))return this.events=[...i,...this.events].slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();this.clearPersistedCache(),t.default.options.afterSend?.(i),s.sentryLogger.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-r))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const e=t.default.options.cacheMaxLength,s=this.events.slice(0,e);return this.events=this.events.slice(e),u.applyBeforePushHook(s)}sendBatch(e){const t=JSON.stringify(e),s=a.getBodyByteLength(t)<=a.MAX_KEEPALIVE_BYTES;return!(!s||!a.sendBeacon(t))||a.reportByFetch(t,s,()=>this.handleServerError())}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=i.scheduleFlush(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,r=!1){const h=t.default.options;if(!o.shouldQueuePayload(e))return;const l=u.runBeforeReportHook(this.id,e),a=n.isPromise(l)?await l:l;if(a){if(s.sentryLogger.info(`Type: ${e.type}`,a),this.events.push(a),!this.isOnline)return this.events=this.events.slice(-h.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),r||this.events.length>=h.cacheMaxLength?await this.flush():this.timeoutID=i.scheduleFlush(this.timeoutID,h.cacheWaitingTime,()=>this.flush())}}}let f=null;var d=new Proxy({},{get(e,t){f??=new c;const s=Reflect.get(f,t,f);return"function"==typeof s?s.bind(f):s}});exports.DataReporter=c,exports.default=d,exports.resetReporter=function(){f?.dispose(),f=null};
|
package/dist/reporter/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import{generateUUID as e}from"../utils/uuid.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as s}from"../utils/logger.js";import{scheduleFlush as i}from"./flush-scheduler.js";import{initNetworkListener as h}from"./network-listener.js";import{loadOfflineCache as n,saveOfflineCache as r,clearOfflineCache as o}from"./offline-cache.js";import{isPromise as l}from"./promise.js";import{applyBeforePushHook as a,runBeforeReportHook as u}from"./report-data.js";import{shouldQueuePayload as c}from"./send-preflight.js";import{scheduleServerRecovery as f}from"./server-recovery.js";import{getBodyByteLength as m,MAX_KEEPALIVE_BYTES as p,sendBeacon as d,reportByFetch as v}from"./transports.js";class g{id=e();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;hasPersistedCache=!1;removeNetworkListener;constructor(){this.removeNetworkListener=h({setOnline:e=>{this.isOnline=e},flush:()=>this.flush()}),this.loadOfflineCache()}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.removeNetworkListener(),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...n()),this.events=this.events.slice(-t.options.maxQueueLength)}saveOfflineCache(){r(this.events),this.hasPersistedCache=!0}clearPersistedCache(){this.hasPersistedCache&&(o(),this.hasPersistedCache=!1)}handleServerError(){this.retryTimer=f(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},flush:()=>this.flush()})}async flush(){if(0!==this.events.length&&!this.isFlushing){this.isFlushing=!0;try{if(!this.isOnline)return this.events=this.events.slice(-t.options.maxQueueLength),void this.saveOfflineCache();const e=this.takeBatch(),i=l(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const h=performance.now(),n=this.sendBatch(i);if(!(l(n)?await n:n))return this.events=[...i,...this.events].slice(-t.options.maxQueueLength),void this.saveOfflineCache();this.clearPersistedCache(),t.options.afterSend?.(i),s.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-h))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const e=t.options.cacheMaxLength,s=this.events.slice(0,e);return this.events=this.events.slice(e),a(s)}sendBatch(e){const t=JSON.stringify(e),s=m(t)<=p;return!(!s||!d(t))||v(t,s,()=>this.handleServerError())}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=i(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,h=!1){const n=t.options;if(!c(e))return;const r=u(this.id,e),o=l(r)?await r:r;if(o){if(s.info(`Type: ${e.type}`,o),this.events.push(o),!this.isOnline)return this.events=this.events.slice(-n.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),h||this.events.length>=n.cacheMaxLength?await this.flush():this.timeoutID=i(this.timeoutID,n.cacheWaitingTime,()=>this.flush())}}}let y=null;function O(){y?.dispose(),y=null}var j=new Proxy({},{get(e,t){y??=new g;const s=Reflect.get(y,t,y);return"function"==typeof s?s.bind(y):s}});export{g as DataReporter,j as default,O as resetReporter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs"),require("../utils/sentry.cjs"),require("../utils/is-type.cjs");var e=require("../utils/logger.cjs");exports.initNetworkListener=function(n){n.setOnline(!1!==navigator.onLine)
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs"),require("../utils/sentry.cjs"),require("../utils/is-type.cjs");var e=require("../utils/logger.cjs");exports.initNetworkListener=function(n){n.setOnline(!1!==navigator.onLine);const i=()=>{n.setOnline(!0),e.sentryLogger.info("Network is back online, flushing cache"),n.flush()},s=()=>{n.setOnline(!1),e.sentryLogger.info("Network is offline, caching events")};return globalThis.addEventListener("online",i),globalThis.addEventListener("offline",s),()=>{globalThis.removeEventListener("online",i),globalThis.removeEventListener("offline",s)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as e}from"../utils/logger.js";function n(n){n.setOnline(!1!==navigator.onLine);const i=()=>{n.setOnline(!0),e.info("Network is back online, flushing cache"),n.flush()},t=()=>{n.setOnline(!1),e.info("Network is offline, caching events")};return globalThis.addEventListener("online",i),globalThis.addEventListener("offline",t),()=>{globalThis.removeEventListener("online",i),globalThis.removeEventListener("offline",t)}}export{n as initNetworkListener};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs"),r=require("./report-data-schema.cjs");exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const a=JSON.parse(t),
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs"),r=require("./report-data-schema.cjs");exports.clearOfflineCache=function(){try{localStorage.removeItem(e.default.options.offlineCacheKey)}catch{t.sentryLogger.error("Failed to clear offline cache")}},exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const a=JSON.parse(t),o=r.reportDataListSchema.safeParse(a);return o.success?(localStorage.removeItem(e.default.options.offlineCacheKey),o.data.slice(-e.default.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.default.options.offlineCacheKey),[]}},exports.saveOfflineCache=function(r){try{localStorage.setItem(e.default.options.offlineCacheKey,JSON.stringify(r.slice(-e.default.options.maxQueueLength)))}catch{t.sentryLogger.error("Failed to save offline cache")}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as o}from"../utils/logger.js";import{reportDataListSchema as t}from"./report-data-schema.js";function r(){try{const o=localStorage.getItem(e.options.offlineCacheKey);if(!o)return[];const r=JSON.parse(o),s=t.safeParse(r);return s.success?(localStorage.removeItem(e.options.offlineCacheKey),s.data.slice(-e.options.maxQueueLength)):[]}catch{return localStorage.removeItem(e.options.offlineCacheKey),[]}}function s(t){try{localStorage.setItem(e.options.offlineCacheKey,JSON.stringify(t.slice(-e.options.maxQueueLength)))}catch{o.error("Failed to save offline cache")}}function a(){try{localStorage.removeItem(e.options.offlineCacheKey)}catch{o.error("Failed to clear offline cache")}}export{a as clearOfflineCache,r as loadOfflineCache,s as saveOfflineCache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),
|
|
1
|
+
"use strict";var e=require("zod"),t=require("../types/enums.cjs");const r=e.z.object({browserName:e.z.string(),browserVersion:e.z.string(),osName:e.z.string(),osVersion:e.z.string(),userAgent:e.z.string(),deviceType:e.z.string(),deviceModel:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.enum(t.EventType),name:e.z.string(),time:e.z.string(),timestamp:e.z.number(),message:e.z.string(),status:e.z.enum(t.Status),url:e.z.string(),userId:e.z.string(),anonymousId:e.z.string(),visitorId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),breadcrumbs:e.z.array(e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.reportDataListSchema=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{Status as
|
|
1
|
+
import{z as e}from"zod";import{Status as t,EventType as r}from"../types/enums.js";const s=e.object({browserName:e.string(),browserVersion:e.string(),osName:e.string(),osVersion:e.string(),userAgent:e.string(),deviceType:e.string(),deviceModel:e.string(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.enum(r),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.enum(t),url:e.string(),userId:e.string(),anonymousId:e.string(),visitorId:e.string(),projectId:e.string(),sdkVersion:e.string(),breadcrumbs:e.array(e.custom(e=>"object"==typeof e&&null!==e,"Expected a breadcrumb item object")).optional(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),o=e.array(n);export{o as reportDataListSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../constants/index.cjs")
|
|
1
|
+
"use strict";var e=require("../constants/index.cjs"),t=require("../core/breadcrumb.cjs"),r=require("../types/enums.cjs"),o=require("../utils/sentry.cjs");require("../utils/is-type.cjs"),require("../utils/logger.cjs");var n=require("./promise.cjs");const s=new Set([r.EventType.Error,r.EventType.UnhandledRejection,r.EventType.Resource,r.EventType.Vue,r.EventType.React,r.EventType.OtherFrameworks]);function u(e){return!1===e?null:e}function i(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(e){const t=o.default.options.beforeSendBatch?o.default.options.beforeSendBatch(e):e;return n.isPromise(t)?t.then(i):i(t)},exports.runBeforeReportHook=function(r,i){const a=function(r,n){const{type:u,name:i,time:a,timestamp:d,message:c,status:p}=n,f={type:u,name:i,time:a,timestamp:d,message:c,status:p,id:r,url:location.href,userId:o.default.options.userId,anonymousId:o.default.options.anonymousId,visitorId:o.default.options.visitorId,projectId:o.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:o.default.deviceInfo,payload:n};return s.has(u)&&(f.breadcrumbs=t.default.dump()),f}(r,i);if(!o.default.options.beforeSend)return a;const d=o.default.options.beforeSend(a);return n.isPromise(d)?d.then(u):u(d)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SDK_VERSION as
|
|
1
|
+
import{SDK_VERSION as o}from"../constants/index.js";import t from"../core/breadcrumb.js";import{EventType as e}from"../types/enums.js";import n from"../utils/sentry.js";import"../utils/is-type.js";import"../utils/logger.js";import{isPromise as r}from"./promise.js";const s=new Set([e.Error,e.UnhandledRejection,e.Resource,e.Vue,e.React,e.OtherFrameworks]);function i(e,i){const u=function(e,r){const{type:i,name:m,time:u,timestamp:p,message:c,status:d}=r,a={type:i,name:m,time:u,timestamp:p,message:c,status:d,id:e,url:location.href,userId:n.options.userId,anonymousId:n.options.anonymousId,visitorId:n.options.visitorId,projectId:n.options.projectId,sdkVersion:o,deviceInfo:n.deviceInfo,payload:r};return s.has(i)&&(a.breadcrumbs=t.dump()),a}(e,i);if(!n.options.beforeSend)return u;const p=n.options.beforeSend(u);return r(p)?p.then(m):m(p)}function m(o){return!1===o?null:o}function u(o){const t=n.options.beforeSendBatch?n.options.beforeSendBatch(o):o;return r(t)?t.then(p):p(t)}function p(o){return!1===o?[]:[...o]}export{u as applyBeforePushHook,i as runBeforeReportHook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var r=require("../utils/logger.cjs"),t=require("./timer.cjs");function s(i,n){n.setOnline(!1),i&&clearTimeout(i);const
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var r=require("../utils/logger.cjs"),t=require("./timer.cjs");function s(i,n){n.setOnline(!1),i&&clearTimeout(i);const u=setTimeout(()=>{!function(t){fetch(e.default.options.dsn,{method:"HEAD"}).then(e=>{e.ok?(t.setOnline(!0),r.sentryLogger.info("Server is back available, flushing cache"),t.flush()):s(void 0,t)}).catch(()=>{s(void 0,t)})}(n)},e.default.options.retryIntervalMilliseconds);return t.unrefTimer(u),n.setRetryTimer(u),u}exports.scheduleServerRecovery=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as e}from"../utils/logger.js";import{unrefTimer as i}from"./timer.js";function o
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as e}from"../utils/logger.js";import{unrefTimer as i}from"./timer.js";function s(o,n){n.setOnline(!1),o&&clearTimeout(o);const r=setTimeout(()=>{!function(i){fetch(t.options.dsn,{method:"HEAD"}).then(t=>{t.ok?(i.setOnline(!0),e.info("Server is back available, flushing cache"),i.flush()):s(void 0,i)}).catch(()=>{s(void 0,i)})}(n)},t.options.retryIntervalMilliseconds);return i(r),n.setRetryTimer(r),r}export{s as scheduleServerRecovery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs");exports.
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs");require("../utils/is-type.cjs");var t=require("../utils/logger.cjs");exports.MAX_KEEPALIVE_BYTES=61440,exports.getBodyByteLength=function(e){return(new TextEncoder).encode(e).byteLength},exports.reportByFetch=async function(n,r,o){try{const t=await fetch(e.default.options.dsn,{method:"POST",body:n,headers:{"Content-Type":"application/json"},keepalive:r});return t.ok||o(),t.ok}catch(e){return t.sentryLogger.error("Fetch report failed",e),o(),!1}},exports.sendBeacon=function(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(e.default.options.dsn,t)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../constants/index.js";import"../types/enums.js";import
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import"../utils/is-type.js";import{sentryLogger as n}from"../utils/logger.js";const e=61440;function o(t){return(new TextEncoder).encode(t).byteLength}function r(n){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(t.options.dsn,n)}async function s(e,o,r){try{const n=await fetch(t.options.dsn,{method:"POST",body:e,headers:{"Content-Type":"application/json"},keepalive:o});return n.ok||r(),n.ok}catch(t){return n.error("Fetch report failed",t),r(),!1}}export{e as MAX_KEEPALIVE_BYTES,o as getBodyByteLength,s as reportByFetch,r as sendBeacon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=require("source-map"),t=require("zod");const e=t.z.object({version:t.z.union([t.z.number(),t.z.string()]),sources:t.z.array(t.z.string().nullable()),names:t.z.array(t.z.string()),mappings:t.z.string()}),r=t.z.looseObject({type:t.z.string().optional(),name:t.z.string().optional(),payload:t.z.looseObject({line:t.z.number().optional(),column:t.z.number().optional(),extra:t.z.unknown().optional(),stack:t.z.unknown().optional()}).optional()}),s=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,o=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=s.exec(e)??o.exec(e);if(!n)continue;const[,r,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};r&&(u.func=r),t.push(u)}return t}async function c(t,r){const s={resolved:!1,...r};try{const o=await t(r.url);return e.safeParse(o).success?await n.SourceMapConsumer.with(JSON.stringify(o),null,n=>{const t=n.originalPositionFor({line:r.line,column:Math.max(0,r.column-1)});if(null===t.source||null===t.line)return s;const e=n.sourceContentFor(t.source,!0),o={...s,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(o.originalColumn=t.column),null!==t.name&&(o.name=t.name),e&&(o.snippet=function(n,t){const e=n.split("\n"),r=Math.max(1,t-3),s=Math.min(e.length,t+3),o=[];for(let n=r;n<=s;n++)o.push({line:n,code:e[n-1]??"",highlight:n===t});return o}(e,t.line)),o}):s}catch{return s}}async function i(n,t){const e=a(t),r=[];for(const t of e)r.push(await c(n,t));return r}const u=t.z.looseObject({stack:t.z.string().optional()});async function l(n,t){const e=r.safeParse(t);if(!e.success)return t;const s=e.data,o=s.payload;if(!o)return t;const a=[];if("Error"===s.type&&"string"==typeof s.name&&"number"==typeof o.line&&"number"==typeof o.column)a.push(await c(n,{url:s.name,line:o.line,column:o.column}));else if("string"==typeof o.extra&&(l=o.extra,/(^|\n)\s*at .+:\d+:\d+/.test(l)||/@.+:\d+:\d+/.test(l)))a.push(...await i(n,o.extra));else if("React"===s.type||"Vue"===s.type||"OtherFrameworks"===s.type){const t=function(n){if("string"==typeof n.stack)return n.stack;const t=u.safeParse(n.extra);return t.success&&"string"==typeof t.data.stack?t.data.stack:null}(o);t&&a.push(...await i(n,t))}var l;return 0===a.length?t:{...s,sourcemap:{frames:a}}}exports.enrichReportData=async function(n,t){if(!Array.isArray(t))return t;const e=[];for(const r of t)e.push(await l(n,r));return e},exports.parseStack=a,exports.resolveFrame=c,exports.resolveStack=i,exports.splitScriptUrl=function(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SourceMapConsumer as n}from"source-map";import{z as t}from"zod";const e=t.object({version:t.union([t.number(),t.string()]),sources:t.array(t.string().nullable()),names:t.array(t.string()),mappings:t.string()}),r=t.looseObject({type:t.string().optional(),name:t.string().optional(),payload:t.looseObject({line:t.number().optional(),column:t.number().optional(),extra:t.unknown().optional(),stack:t.unknown().optional()}).optional()}),o=/^\s*at (?:(.+?)\s+)?\(?(\S+?):(\d+):(\d+)\)?\s*$/,s=/^\s*(?:(.*?)@)?(\S+?):(\d+):(\d+)\s*$/;function a(n){const t=[];for(const e of n.split("\n")){if(t.length>=30)break;const n=o.exec(e)??s.exec(e);if(!n)continue;const[,r,a,c,i]=n;if(!a||!c||!i)continue;const u={url:a,line:Number.parseInt(c,10),column:Number.parseInt(i,10)};r&&(u.func=r),t.push(u)}return t}function c(n){try{const t=new URL(n);return{pathname:t.pathname,search:t.search}}catch{const t=n.search(/[?#]/);return-1!==t?{pathname:n.slice(0,t),search:n.slice(t)}:{pathname:n,search:""}}}async function i(t,r){const o={resolved:!1,...r};try{const s=await t(r.url);return e.safeParse(s).success?await n.with(JSON.stringify(s),null,n=>{const t=n.originalPositionFor({line:r.line,column:Math.max(0,r.column-1)});if(null===t.source||null===t.line)return o;const e=n.sourceContentFor(t.source,!0),s={...o,resolved:!0,source:t.source,originalLine:t.line};return null!==t.column&&(s.originalColumn=t.column),null!==t.name&&(s.name=t.name),e&&(s.snippet=function(n,t){const e=n.split("\n"),r=Math.max(1,t-3),o=Math.min(e.length,t+3),s=[];for(let n=r;n<=o;n++)s.push({line:n,code:e[n-1]??"",highlight:n===t});return s}(e,t.line)),s}):o}catch{return o}}async function u(n,t){const e=a(t),r=[];for(const t of e)r.push(await i(n,t));return r}const l=t.looseObject({stack:t.string().optional()});async function p(n,t){const e=r.safeParse(t);if(!e.success)return t;const o=e.data,s=o.payload;if(!s)return t;const a=[];if("Error"===o.type&&"string"==typeof o.name&&"number"==typeof s.line&&"number"==typeof s.column)a.push(await i(n,{url:o.name,line:s.line,column:s.column}));else if("string"==typeof s.extra&&(c=s.extra,/(^|\n)\s*at .+:\d+:\d+/.test(c)||/@.+:\d+:\d+/.test(c)))a.push(...await u(n,s.extra));else if("React"===o.type||"Vue"===o.type||"OtherFrameworks"===o.type){const t=function(n){if("string"==typeof n.stack)return n.stack;const t=l.safeParse(n.extra);return t.success&&"string"==typeof t.data.stack?t.data.stack:null}(s);t&&a.push(...await u(n,t))}var c;return 0===a.length?t:{...o,sourcemap:{frames:a}}}async function f(n,t){if(!Array.isArray(t))return t;const e=[];for(const r of t)e.push(await p(n,r));return e}export{f as enrichReportData,a as parseStack,i as resolveFrame,u as resolveStack,c as splitScriptUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=require("./source-map.cjs");exports.enrichReportData=async function(t,e){return r.enrichReportData(function(t){return async e=>{const{pathname:a,search:n}=r.splitScriptUrl(e),u=await t.moduleGraph.getModuleByUrl(a+n)??await t.moduleGraph.getModuleByUrl(a);return u?.transformResult?.map??null}}(t),e)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{enrichReportData as r,splitScriptUrl as a}from"./source-map.js";async function t(t,e){return r(function(r){return async t=>{const{pathname:e,search:n}=a(t),o=await r.moduleGraph.getModuleByUrl(e+n)??await r.moduleGraph.getModuleByUrl(e);return o?.transformResult?.map??null}}(t),e)}export{t as enrichReportData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("./source-map.cjs");function e(t){return t.replace(/\\/g,"/").replace(/^\/+/,"")}exports.enrichReportData=t.enrichReportData,exports.createAssetMapStore=function(){const r=new Map;return{put:(t,n)=>{const a=e(t);a.endsWith(".map")&&r.set(a,n)},loadMap:async n=>{const{pathname:a}=t.splitScriptUrl(n),p=e(a);if(!p)return null;let s=r.get(`${p}.map`);if(void 0===s){const t=`${p.split("/").pop()}.map`;for(const[e,n]of r)if(e===t||e.endsWith(`/${t}`)){s=n;break}}if(void 0===s)return null;try{return JSON.parse(s)}catch{return null}}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{splitScriptUrl as t}from"./source-map.js";export{enrichReportData}from"./source-map.js";function r(t){return t.replace(/\\/g,"/").replace(/^\/+/,"")}function e(){const e=new Map;return{put:(t,n)=>{const o=r(t);o.endsWith(".map")&&e.set(o,n)},loadMap:async n=>{const{pathname:o}=t(n),p=r(o);if(!p)return null;let a=e.get(`${p}.map`);if(void 0===a){const t=`${p.split("/").pop()}.map`;for(const[r,n]of e)if(r===t||r.endsWith(`/${t}`)){a=n;break}}if(void 0===a)return null;try{return JSON.parse(a)}catch{return null}}}}export{e as createAssetMapStore};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventType, Status,
|
|
1
|
+
import { EventType, Status, BreadcrumbType } from './enums.js';
|
|
2
2
|
import { Metric } from 'web-vitals';
|
|
3
3
|
import { IOptions } from './options.js';
|
|
4
4
|
|
|
@@ -29,7 +29,6 @@ interface ISentry {
|
|
|
29
29
|
has(value: string): boolean;
|
|
30
30
|
add(value: string): void;
|
|
31
31
|
};
|
|
32
|
-
whiteScreenTimer: ReturnType<typeof setInterval> | null;
|
|
33
32
|
options: IOptions;
|
|
34
33
|
shouldScreenRecord: boolean;
|
|
35
34
|
deviceInfo: IDeviceInfo;
|
|
@@ -46,7 +45,6 @@ interface IDeviceInfo {
|
|
|
46
45
|
userAgent: string;
|
|
47
46
|
deviceType: string;
|
|
48
47
|
deviceModel: string;
|
|
49
|
-
fingerprint: string;
|
|
50
48
|
language: string;
|
|
51
49
|
screenResolution: string;
|
|
52
50
|
}
|
|
@@ -62,7 +60,7 @@ interface IReportPayload {
|
|
|
62
60
|
status: Status;
|
|
63
61
|
}
|
|
64
62
|
interface IHttpData extends IReportPayload {
|
|
65
|
-
method:
|
|
63
|
+
method: string;
|
|
66
64
|
api: string;
|
|
67
65
|
elapsedTime: number;
|
|
68
66
|
statusCode: number;
|
|
@@ -106,10 +104,10 @@ type IPerformanceData = IPerformanceMetricData | IPerformanceResourceListData |
|
|
|
106
104
|
interface ICodeError extends IReportPayload {
|
|
107
105
|
line: number;
|
|
108
106
|
column: number;
|
|
107
|
+
extra?: string;
|
|
109
108
|
}
|
|
110
109
|
interface IScreenRecordData extends IReportPayload {
|
|
111
110
|
event: string;
|
|
112
|
-
events?: string;
|
|
113
111
|
eventCount?: number;
|
|
114
112
|
}
|
|
115
113
|
interface IExposureData extends IReportPayload {
|
|
@@ -127,7 +125,7 @@ interface IRouteData extends IReportPayload {
|
|
|
127
125
|
to: string;
|
|
128
126
|
}
|
|
129
127
|
type IBaseDataWithEvent = IReportPayload & {
|
|
130
|
-
extra:
|
|
128
|
+
extra: unknown;
|
|
131
129
|
};
|
|
132
130
|
type TReportPayload = IBaseDataWithEvent | IHttpData | IResourceError | IPerformanceData | ICodeError | IExposureData | IScreenRecordData | IRouteData | IBatchErrorData;
|
|
133
131
|
interface IBatchErrorData extends IReportPayload {
|
|
@@ -135,19 +133,21 @@ interface IBatchErrorData extends IReportPayload {
|
|
|
135
133
|
batchErrorLength: number;
|
|
136
134
|
batchErrorLastHappenTime: number;
|
|
137
135
|
}
|
|
138
|
-
type TOnReportWhiteScreenData = (data:
|
|
136
|
+
type TOnReportWhiteScreenData = (data: IBaseDataWithEvent) => void;
|
|
139
137
|
type TOnReportPerformanceData = (data: IPerformanceData) => void;
|
|
140
138
|
interface IReportData<T extends TReportPayload = TReportPayload> extends IReportPayload {
|
|
141
139
|
url: string;
|
|
142
140
|
userId: string;
|
|
141
|
+
anonymousId: string;
|
|
142
|
+
visitorId: string;
|
|
143
143
|
projectId: string;
|
|
144
144
|
sdkVersion: string;
|
|
145
|
-
breadcrumbs?: IBreadcrumbItem[];
|
|
145
|
+
breadcrumbs?: IBreadcrumbItem[] | undefined;
|
|
146
146
|
deviceInfo: IDeviceInfo;
|
|
147
147
|
payload: T;
|
|
148
148
|
}
|
|
149
149
|
interface IDataReporter {
|
|
150
|
-
send(payload: TReportPayload): Promise<void>;
|
|
150
|
+
send(payload: TReportPayload, immediate?: boolean): Promise<void>;
|
|
151
151
|
flushOfflineCache(): Promise<void>;
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
@@ -163,6 +163,5 @@ interface IExtendedErrorEvent extends Event {
|
|
|
163
163
|
localName: string;
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
type TUnknownError = IExtendedErrorEvent | Error /** React */ | unknown;
|
|
167
166
|
|
|
168
|
-
export type { IBaseDataWithEvent, IBatchErrorData, IBreadcrumbItem, ICodeError, IDataReporter, IDeviceInfo, IExposureData, IExtendedErrorEvent, IHttpData, IPerformanceData, IPerformanceResourceTiming, IReportData, IReportPayload, IResourceError, IRouteData, IScreenRecordData, ISentry, TOnReportPerformanceData, TOnReportWhiteScreenData, TReportPayload
|
|
167
|
+
export type { IBaseDataWithEvent, IBatchErrorData, IBreadcrumbItem, ICodeError, IDataReporter, IDeviceInfo, IExposureData, IExtendedErrorEvent, IHttpData, IPerformanceData, IPerformanceResourceTiming, IReportData, IReportPayload, IResourceError, IRouteData, IScreenRecordData, ISentry, TOnReportPerformanceData, TOnReportWhiteScreenData, TReportPayload };
|
package/dist/types/enums.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,
|
|
1
|
+
"use strict";var e,r,t;exports.BreadcrumbType=void 0,(e=exports.BreadcrumbType||(exports.BreadcrumbType={})).Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom",exports.Status=void 0,(r=exports.Status||(exports.Status={})).Error="Error",r.OK="OK",exports.EventType=void 0,(t=exports.EventType||(exports.EventType={})).Xhr="XMLHttpRequest",t.Fetch="fetch",t.Click="Click",t.HashChange="Event hashchange",t.History="History",t.Resource="Resource",t.UnhandledRejection="Event unhandledrejection",t.Error="Error",t.Vue="Vue",t.React="React",t.OtherFrameworks="OtherFrameworks",t.Performance="Performance",t.ScreenRecord="ScreenRecord",t.Exposure="Exposure",t.WhiteScreen="WhiteScreen",t.Custom="Custom",t.PV="PV";
|