@swifty.js/sentry 0.0.1
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 +785 -0
- package/dist/constants/index.cjs +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/core/api.cjs +1 -0
- package/dist/core/api.d.ts +27 -0
- package/dist/core/api.js +1 -0
- package/dist/core/breadcrumb.cjs +1 -0
- package/dist/core/breadcrumb.js +1 -0
- package/dist/core/bus.cjs +1 -0
- package/dist/core/bus.js +1 -0
- package/dist/core/decorate-http-publish.cjs +1 -0
- package/dist/core/decorate-http-publish.js +1 -0
- package/dist/core/decorate-publish.cjs +1 -0
- package/dist/core/decorate-publish.js +1 -0
- package/dist/core/decorate-route-publish.cjs +1 -0
- package/dist/core/decorate-route-publish.js +1 -0
- package/dist/core/framework-error.cjs +1 -0
- package/dist/core/framework-error.js +1 -0
- package/dist/core/handle-code-error.cjs +1 -0
- package/dist/core/handle-code-error.js +1 -0
- package/dist/core/handle-error.cjs +1 -0
- package/dist/core/handle-error.js +1 -0
- package/dist/core/handle-events.cjs +1 -0
- package/dist/core/handle-events.js +1 -0
- package/dist/core/handle-http.cjs +1 -0
- package/dist/core/handle-http.js +1 -0
- package/dist/core/handle-route.cjs +1 -0
- package/dist/core/handle-route.js +1 -0
- package/dist/core/identity.cjs +1 -0
- package/dist/core/identity.d.ts +11 -0
- package/dist/core/identity.js +1 -0
- package/dist/core/ip.cjs +1 -0
- package/dist/core/ip.d.ts +3 -0
- package/dist/core/ip.js +1 -0
- package/dist/core/options-schema.cjs +1 -0
- package/dist/core/options-schema.d.ts +52 -0
- package/dist/core/options-schema.js +1 -0
- package/dist/core/plugin-registry.cjs +1 -0
- package/dist/core/plugin-registry.js +1 -0
- package/dist/core/pv-lifecycle.cjs +1 -0
- package/dist/core/pv-lifecycle.js +1 -0
- package/dist/core/sdk-lifecycle.cjs +1 -0
- package/dist/core/sdk-lifecycle.d.ts +9 -0
- package/dist/core/sdk-lifecycle.js +1 -0
- package/dist/core/setup.cjs +1 -0
- package/dist/core/setup.js +1 -0
- package/dist/core/white-screen.cjs +1 -0
- package/dist/core/white-screen.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -0
- package/dist/package.json.cjs +1 -0
- package/dist/package.json.js +1 -0
- package/dist/plugins/exposure/index.cjs +1 -0
- package/dist/plugins/exposure/index.d.ts +23 -0
- package/dist/plugins/exposure/index.js +1 -0
- package/dist/plugins/index.cjs +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/performance/first-screen-paint.cjs +1 -0
- package/dist/plugins/performance/first-screen-paint.js +1 -0
- package/dist/plugins/performance/index.cjs +1 -0
- package/dist/plugins/performance/index.d.ts +16 -0
- package/dist/plugins/performance/index.js +1 -0
- package/dist/plugins/performance/navigation-timing.cjs +1 -0
- package/dist/plugins/performance/navigation-timing.js +1 -0
- package/dist/plugins/performance/perf.cjs +1 -0
- package/dist/plugins/performance/perf.js +1 -0
- package/dist/plugins/performance/performance-observer-support.cjs +1 -0
- package/dist/plugins/performance/performance-observer-support.js +1 -0
- package/dist/plugins/performance/resource-element-fallback.cjs +1 -0
- package/dist/plugins/performance/resource-element-fallback.js +1 -0
- package/dist/plugins/performance/resource-timing.cjs +1 -0
- package/dist/plugins/performance/resource-timing.js +1 -0
- package/dist/plugins/screen-record/index.cjs +1 -0
- package/dist/plugins/screen-record/index.d.ts +18 -0
- package/dist/plugins/screen-record/index.js +1 -0
- package/dist/plugins/screen-record/recorder.cjs +1 -0
- package/dist/plugins/screen-record/recorder.d.ts +3 -0
- package/dist/plugins/screen-record/recorder.js +1 -0
- package/dist/react.cjs +1 -0
- package/dist/react.d.ts +103 -0
- package/dist/react.js +1 -0
- package/dist/reporter/batch.cjs +1 -0
- package/dist/reporter/batch.js +1 -0
- package/dist/reporter/flush-scheduler.cjs +1 -0
- package/dist/reporter/flush-scheduler.js +1 -0
- package/dist/reporter/index.cjs +1 -0
- package/dist/reporter/index.js +1 -0
- package/dist/reporter/network-listener.cjs +1 -0
- package/dist/reporter/network-listener.js +1 -0
- package/dist/reporter/offline-cache.cjs +1 -0
- package/dist/reporter/offline-cache.js +1 -0
- package/dist/reporter/promise.cjs +1 -0
- package/dist/reporter/promise.js +1 -0
- package/dist/reporter/report-data-schema.cjs +1 -0
- package/dist/reporter/report-data-schema.js +1 -0
- package/dist/reporter/report-data.cjs +1 -0
- package/dist/reporter/report-data.js +1 -0
- package/dist/reporter/send-preflight.cjs +1 -0
- package/dist/reporter/send-preflight.js +1 -0
- package/dist/reporter/server-recovery.cjs +1 -0
- package/dist/reporter/server-recovery.js +1 -0
- package/dist/reporter/timer.cjs +1 -0
- package/dist/reporter/timer.js +1 -0
- package/dist/reporter/transports.cjs +1 -0
- package/dist/reporter/transports.js +1 -0
- package/dist/types/common.d.ts +140 -0
- package/dist/types/enums.cjs +1 -0
- package/dist/types/enums.d.ts +77 -0
- package/dist/types/enums.js +1 -0
- package/dist/types/handlers.d.ts +11 -0
- package/dist/types/options.d.ts +51 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.ts +15 -0
- package/dist/types/plugin.js +1 -0
- package/dist/utils/base64.cjs +1 -0
- package/dist/utils/base64.js +1 -0
- package/dist/utils/click-data.cjs +1 -0
- package/dist/utils/click-data.js +1 -0
- package/dist/utils/data-structures.cjs +1 -0
- package/dist/utils/data-structures.js +1 -0
- package/dist/utils/decorate-prop.cjs +1 -0
- package/dist/utils/decorate-prop.d.ts +3 -0
- package/dist/utils/decorate-prop.js +1 -0
- package/dist/utils/event2breadcrumb.cjs +1 -0
- package/dist/utils/event2breadcrumb.js +1 -0
- package/dist/utils/get-base-data.cjs +1 -0
- package/dist/utils/get-base-data.js +1 -0
- package/dist/utils/get-css-selectors.cjs +1 -0
- package/dist/utils/get-css-selectors.js +1 -0
- package/dist/utils/is-excluded-api.cjs +1 -0
- package/dist/utils/is-excluded-api.js +1 -0
- package/dist/utils/is-ignored-error.cjs +1 -0
- package/dist/utils/is-ignored-error.js +1 -0
- package/dist/utils/is-type.cjs +1 -0
- package/dist/utils/is-type.js +1 -0
- package/dist/utils/logger.cjs +1 -0
- package/dist/utils/logger.js +1 -0
- package/dist/utils/metric2perf-data.cjs +1 -0
- package/dist/utils/metric2perf-data.js +1 -0
- package/dist/utils/sentry.cjs +1 -0
- package/dist/utils/sentry.js +1 -0
- package/dist/utils/server-timing.cjs +1 -0
- package/dist/utils/server-timing.js +1 -0
- package/dist/utils/session.cjs +1 -0
- package/dist/utils/session.js +1 -0
- package/dist/utils/throttle.cjs +1 -0
- package/dist/utils/throttle.js +1 -0
- package/dist/utils/transform-http-data.cjs +1 -0
- package/dist/utils/transform-http-data.js +1 -0
- package/dist/vite.cjs +1 -0
- package/dist/vite.d.ts +11 -0
- package/dist/vite.js +1 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.d.ts +5 -0
- package/dist/vue.js +1 -0
- package/dist/webpack.cjs +1 -0
- package/dist/webpack.d.ts +55 -0
- package/dist/webpack.js +1 -0
- package/package.json +128 -0
|
@@ -0,0 +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"),n=require("../../utils/logger.cjs"),o=require("zod");let s=null;const c=o.z.object({timestamp:o.z.number()}).passthrough();function i(){}function u(e,r){const n=r-t.default.options.screenRecordDurationMs;return e.filter(e=>e.timestamp>=n)}function a(e){if(!e||!s)return"";const r=JSON.stringify(e);return function(e){let r="";return e.forEach(e=>{r+=String.fromCharCode(e)}),btoa(r)}(s.gzip(r))}exports.recorder=async function(o){n.sentryLogger.info("Initializing web recorder...");try{const[{record:d},l]=await Promise.all([import("@rrweb/record"),import("pako")]);s=l.default;let f=[];const p=d({emit(s,i){const d=c.safeParse(s);if(d.success&&(f=u([...f,d.data],d.data.timestamp),i&&(f=u(f,d.data.timestamp)),t.default.shouldScreenRecord&&f.length>0)){const s={...r.default(),name:"ScreenRecord",type:e.EventType.ScreenRecord,event:a(f),eventCount:f.length};n.sentryLogger.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),t.default.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:t.default.options.screenRecordDurationMs});return"function"==typeof p?p:i}catch(e){return n.sentryLogger.error("Failed to load web recorder",e),i}},exports.unzipScreenRecord=function(e){if(!e||!s)return null;const r=s.ungzip(function(e){const r=atob(e);return Uint8Array.from(r,e=>e.charCodeAt(0))}(e),{to:"string"});return JSON.parse(r)},exports.zip=a;
|
|
@@ -0,0 +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{sentryLogger as n}from"../../utils/logger.js";import{z as o}from"zod";let s=null;const c=o.object({timestamp:o.number()}).passthrough();function i(){}function a(t,e){const n=e-r.options.screenRecordDurationMs;return t.filter(t=>t.timestamp>=n)}async function u(o){n.info("Initializing web recorder...");try{const[{record:u},m]=await Promise.all([import("@rrweb/record"),import("pako")]);s=m.default;let f=[];const p=u({emit(s,i){const u=c.safeParse(s);if(u.success&&(f=a([...f,u.data],u.data.timestamp),i&&(f=a(f,u.data.timestamp)),r.shouldScreenRecord&&f.length>0)){const s={...e(),name:"ScreenRecord",type:t.ScreenRecord,event:d(f),eventCount:f.length};n.success("Screen record window packaged and sent",{eventCount:s.eventCount}),o.send(s),r.shouldScreenRecord=!1}},recordCanvas:!0,checkoutEveryNms:r.options.screenRecordDurationMs});return"function"==typeof p?p:i}catch(t){return n.error("Failed to load web recorder",t),i}}function d(t){if(!t||!s)return"";const e=JSON.stringify(t);return function(t){let e="";return t.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e)}(s.gzip(e))}function m(t){if(!t||!s)return null;const e=s.ungzip(function(t){const e=atob(t);return Uint8Array.from(e,t=>t.charCodeAt(0))}(t),{to:"string"});return JSON.parse(e)}export{u as recorder,m as unzipScreenRecord,d as zip};
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +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;
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props for the {@link ReactErrorBoundary} component.
|
|
5
|
+
*
|
|
6
|
+
* The boundary renders `children` normally. When a descendant throws during
|
|
7
|
+
* rendering, it switches to rendering {@link fallback} and reports the error
|
|
8
|
+
* to the Sentry SDK.
|
|
9
|
+
*/
|
|
10
|
+
interface ReactErrorBoundaryProps {
|
|
11
|
+
/**
|
|
12
|
+
* The subtree to render when no error has occurred. When an error is
|
|
13
|
+
* caught, this is replaced by {@link fallback}.
|
|
14
|
+
*/
|
|
15
|
+
readonly children?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The UI to display when a descendant throws.
|
|
18
|
+
*
|
|
19
|
+
* Can be a static `ReactNode` (no access to the error) or a render function
|
|
20
|
+
* that receives the caught error and React's component-stack info.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The render function may be invoked twice during an error cycle:
|
|
24
|
+
* 1. First, right after `getDerivedStateFromError` runs in the render
|
|
25
|
+
* phase — at this point `errorInfo` is still `undefined` because React
|
|
26
|
+
* only delivers {@link ErrorInfo} in `componentDidCatch` (commit phase).
|
|
27
|
+
* 2. Again after `componentDidCatch` merges `errorInfo` into state.
|
|
28
|
+
*
|
|
29
|
+
* Therefore `errorInfo` is typed as optional. Guard against `undefined` if
|
|
30
|
+
* your fallback relies on `componentStack`.
|
|
31
|
+
*
|
|
32
|
+
* @param error - The Error thrown by the descendant component. Always
|
|
33
|
+
* defined when the fallback is invoked, because the boundary only enters
|
|
34
|
+
* the error state when an Error is present.
|
|
35
|
+
* @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`.
|
|
36
|
+
* `undefined` on the first render after the error is caught.
|
|
37
|
+
* @returns The fallback React subtree to render.
|
|
38
|
+
*/
|
|
39
|
+
readonly fallback?: ReactNode | ((error: Error, errorInfo?: ErrorInfo) => ReactNode);
|
|
40
|
+
}
|
|
41
|
+
/** Internal state tracking the caught error and React component-stack info. */
|
|
42
|
+
interface ReactErrorBoundaryState {
|
|
43
|
+
readonly error?: Error;
|
|
44
|
+
readonly errorInfo?: ErrorInfo;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A React Error Boundary that reports caught errors to the Sentry SDK.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <ReactErrorBoundary fallback={<div>Something went wrong</div>}>
|
|
52
|
+
* <Page />
|
|
53
|
+
* </ReactErrorBoundary>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare class ReactErrorBoundary extends Component<ReactErrorBoundaryProps, ReactErrorBoundaryState> {
|
|
57
|
+
state: ReactErrorBoundaryState;
|
|
58
|
+
/**
|
|
59
|
+
* Called by React during the **render phase** when a descendant throws.
|
|
60
|
+
*
|
|
61
|
+
* This is a pure static method — it must not access `this` or cause side
|
|
62
|
+
* effects. Its sole responsibility is to return the next state so React can
|
|
63
|
+
* immediately re-render the boundary and show the fallback UI without
|
|
64
|
+
* waiting for the commit phase.
|
|
65
|
+
*
|
|
66
|
+
* Only `error` is available here; React does not deliver {@link ErrorInfo}
|
|
67
|
+
* until {@link componentDidCatch} runs (commit phase), so `errorInfo` is
|
|
68
|
+
* left `undefined` at this point.
|
|
69
|
+
*
|
|
70
|
+
* This method is **not redundant** with {@link componentDidCatch}. It
|
|
71
|
+
* triggers the fallback render synchronously in the render phase; without
|
|
72
|
+
* it the fallback would not appear until after commit.
|
|
73
|
+
*
|
|
74
|
+
* @param error - The Error thrown by the descendant component.
|
|
75
|
+
* @returns The next state, setting `error` so the boundary renders the
|
|
76
|
+
* fallback.
|
|
77
|
+
*/
|
|
78
|
+
static getDerivedStateFromError(error: Error): ReactErrorBoundaryState;
|
|
79
|
+
/**
|
|
80
|
+
* Called by React during the **commit phase** (after the DOM has been
|
|
81
|
+
* updated) when a descendant throws.
|
|
82
|
+
*
|
|
83
|
+
* This is where side effects belong. It performs two duties:
|
|
84
|
+
* 1. Merges `errorInfo` (React's component-stack trace) into state so the
|
|
85
|
+
* fallback render function can access it. `error` is also set again —
|
|
86
|
+
* it is already present from
|
|
87
|
+
* {@link getDerivedStateFromError | getDerivedStateFromError} but is
|
|
88
|
+
* included for a single atomic state update.
|
|
89
|
+
* 2. Reports the error to the Sentry SDK as a `React` event via
|
|
90
|
+
* {@link reportFrameworkError}.
|
|
91
|
+
*
|
|
92
|
+
* @param error - The Error thrown by the descendant component.
|
|
93
|
+
* @param errorInfo - React's {@link ErrorInfo}, containing `componentStack`:
|
|
94
|
+
* a string describing the component tree from the throwing component up to
|
|
95
|
+
* this boundary. Useful for locating where in the component hierarchy the
|
|
96
|
+
* error originated.
|
|
97
|
+
*/
|
|
98
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
99
|
+
render(): ReactNode;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { ReactErrorBoundary };
|
|
103
|
+
export type { ReactErrorBoundaryProps };
|
package/dist/react.js
ADDED
|
@@ -0,0 +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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),s=require("./promise.cjs");function t(e){return!1===e?[]:[...e]}exports.applyBeforePushHook=function(r){const n=e.default.options.beforePushEventList?e.default.options.beforePushEventList(r):r;return s.isPromise(n)?n.then(t):t(n)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import{isPromise as o}from"./promise.js";function s(s){const e=t.options.beforePushEventList?t.options.beforePushEventList(s):s;return o(e)?e.then(n):n(e)}function n(t){return!1===t?[]:[...t]}export{s as applyBeforePushHook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./timer.cjs");exports.scheduleFlush=function(r,t,u){r&&clearTimeout(r);const s=setTimeout(()=>{u()},t);return e.unrefTimer(s),s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{unrefTimer as t}from"./timer.js";function e(e,o,r){e&&clearTimeout(e);const i=setTimeout(()=>{r()},o);return t(i),i}export{e as scheduleFlush};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../utils/data-structures.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs"),s=require("../utils/logger.cjs"),i=require("./batch.cjs"),n=require("./flush-scheduler.cjs"),r=require("./network-listener.cjs"),h=require("./offline-cache.cjs"),u=require("./promise.cjs"),a=require("./report-data.cjs"),l=require("./send-preflight.cjs"),c=require("./server-recovery.cjs"),o=require("./transports.cjs");class f{cbQueue=new e.CallbackQueue;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#e=null;constructor(){r.initNetworkListener({setOnline:e=>{this.isOnline=e},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#e||(this.#e=new f),this.#e}static reset(){this.#e&&this.#e.dispose(),this.#e=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),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)}handleServerError(){this.retryTimer=c.scheduleServerRecovery(this.retryTimer,{setOnline:e=>{this.isOnline=e},setRetryTimer:e=>{this.retryTimer=e},loadOfflineCache:()=>this.loadOfflineCache(),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=u.isPromise(e)?await e:e;if(0===i.length)return void this.scheduleNextFlush();const n=performance.now(),r=this.sendBatch(i);if(!(u.isPromise(r)?await r:r))return this.events=[...i,...this.events].slice(-t.default.options.maxQueueLength),void this.saveOfflineCache();t.default.options.afterSendData?.(i),s.sentryLogger.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-n))}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),i.applyBeforePushHook(s)}sendBatch(e){return!(o.isObjectOverSizeLimit(e,60)||!o.sendBeacon(e))||(t.default.options.useImageReport&&!o.isObjectOverSizeLimit(e,2)?(o.reportByImage(e,this.cbQueue),!0):o.reportByFetch(e,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=n.scheduleFlush(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(e,i=!1){const r=t.default.options;if(!l.shouldQueuePayload(e))return;const h=a.runBeforeReportHook(this.id,e),c=u.isPromise(h)?await h:h;if(c){if(s.sentryLogger.info(`Type: ${e.type}`,c),this.events.push(c),!this.isOnline)return this.events=this.events.slice(-r.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=r.cacheMaxLength?await this.flush():this.timeoutID=n.scheduleFlush(this.timeoutID,r.cacheWaitingTime,()=>this.flush())}}}let d=null;var v=new Proxy({},{get(e,t){const s=(d||(d=f.instance),d),i=Reflect.get(s,t,s);return"function"==typeof i?i.bind(s):i}});exports.DataReporter=f,exports.default=v,exports.resetReporter=function(){d&&(f.reset(),d=null)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CallbackQueue as t}from"../utils/data-structures.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as s}from"../utils/logger.js";import{applyBeforePushHook as i}from"./batch.js";import{scheduleFlush as n}from"./flush-scheduler.js";import{initNetworkListener as h}from"./network-listener.js";import{loadOfflineCache as r,saveOfflineCache as o}from"./offline-cache.js";import{isPromise as a}from"./promise.js";import{runBeforeReportHook as l}from"./report-data.js";import{shouldQueuePayload as u}from"./send-preflight.js";import{scheduleServerRecovery as c}from"./server-recovery.js";import{isObjectOverSizeLimit as f,sendBeacon as m,reportByImage as p,reportByFetch as d}from"./transports.js";class v{cbQueue=new t;id=crypto.randomUUID();events=[];timeoutID;retryTimer;isOnline=!0;isFlushing=!1;static#t=null;constructor(){h({setOnline:t=>{this.isOnline=t},loadOfflineCache:()=>this.loadOfflineCache(),flush:()=>this.flush()})}static get instance(){return this.#t||(this.#t=new v),this.#t}static reset(){this.#t&&this.#t.dispose(),this.#t=null}dispose(){this.timeoutID&&clearTimeout(this.timeoutID),this.retryTimer&&clearTimeout(this.retryTimer),this.events=[],this.isFlushing=!1}loadOfflineCache(){this.events.unshift(...r()),this.events=this.events.slice(-e.options.maxQueueLength)}saveOfflineCache(){o(this.events)}handleServerError(){this.retryTimer=c(this.retryTimer,{setOnline:t=>{this.isOnline=t},setRetryTimer:t=>{this.retryTimer=t},loadOfflineCache:()=>this.loadOfflineCache(),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(-e.options.maxQueueLength),void this.saveOfflineCache();const t=this.takeBatch(),i=a(t)?await t:t;if(0===i.length)return void this.scheduleNextFlush();const n=performance.now(),h=this.sendBatch(i);if(!(a(h)?await h:h))return this.events=[...i,...this.events].slice(-e.options.maxQueueLength),void this.saveOfflineCache();e.options.afterSendData?.(i),s.success("Batch report queued or sent",{count:i.length},Math.round(performance.now()-n))}finally{this.isFlushing=!1}this.scheduleNextFlush()}}takeBatch(){const t=e.options.cacheMaxLength,s=this.events.slice(0,t);return this.events=this.events.slice(t),i(s)}sendBatch(t){return!(f(t,60)||!m(t))||(e.options.useImageReport&&!f(t,2)?(p(t,this.cbQueue),!0):d(t,()=>this.handleServerError()))}scheduleNextFlush(){0!==this.events.length&&(this.timeoutID=n(this.timeoutID,100,()=>this.flush()))}async flushOfflineCache(){this.loadOfflineCache(),await this.flush()}async send(t,i=!1){const h=e.options;if(!u(t))return;const r=l(this.id,t),o=a(r)?await r:r;if(o){if(s.info(`Type: ${t.type}`,o),this.events.push(o),!this.isOnline)return this.events=this.events.slice(-h.maxQueueLength),void this.saveOfflineCache();this.timeoutID&&clearTimeout(this.timeoutID),i||this.events.length>=h.cacheMaxLength?await this.flush():this.timeoutID=n(this.timeoutID,h.cacheWaitingTime,()=>this.flush())}}}let g=null;function y(){g&&(v.reset(),g=null)}var O=new Proxy({},{get(t,e){const s=(g||(g=v.instance),g),i=Reflect.get(s,e,s);return"function"==typeof i?i.bind(s):i}});export{v as DataReporter,O as default,y as resetReporter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs"),require("../utils/sentry.cjs");var e=require("../utils/logger.cjs");exports.initNetworkListener=function(n){n.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{n.setOnline(!0),e.sentryLogger.info("Network is back online, flushing cache"),n.loadOfflineCache(),n.flush()}),globalThis.addEventListener("offline",()=>{n.setOnline(!1),e.sentryLogger.info("Network is offline, caching events")})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import"../utils/sentry.js";import{sentryLogger as n}from"../utils/logger.js";function e(e){e.setOnline(!1!==navigator.onLine),globalThis.addEventListener("online",()=>{e.setOnline(!0),n.info("Network is back online, flushing cache"),e.loadOfflineCache(),e.flush()}),globalThis.addEventListener("offline",()=>{e.setOnline(!1),n.info("Network is offline, caching events")})}export{e as initNetworkListener};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs"),a=require("./report-data-schema.cjs");exports.loadOfflineCache=function(){try{const t=localStorage.getItem(e.default.options.offlineCacheKey);if(!t)return[];const r=JSON.parse(t),o=a.reportDataListSchema.safeParse(r);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(a){try{localStorage.setItem(e.default.options.offlineCacheKey,JSON.stringify(a.slice(-e.default.options.maxQueueLength)))}catch{t.sentryLogger.error("Failed to save offline cache")}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";import{reportDataListSchema as o}from"./report-data-schema.js";function r(){try{const t=localStorage.getItem(e.options.offlineCacheKey);if(!t)return[];const r=JSON.parse(t),s=o.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(o){try{localStorage.setItem(e.options.offlineCacheKey,JSON.stringify(o.slice(-e.options.maxQueueLength)))}catch{t.error("Failed to save offline cache")}}export{r as loadOfflineCache,s as saveOfflineCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.isPromise=function(t){return t instanceof Promise||null!==t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){return n instanceof Promise||null!==n&&"object"==typeof n&&"then"in n&&"function"==typeof n.then}export{n as isPromise};
|
|
@@ -0,0 +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(),fingerprint:e.z.string(),language:e.z.string(),screenResolution:e.z.string()}),s=e.z.object({id:e.z.string(),type:e.z.nativeEnum(t.EventType),name:e.z.string(),time:e.z.string(),timestamp:e.z.number(),message:e.z.string(),status:e.z.nativeEnum(t.Status),url:e.z.string(),userId:e.z.string(),projectId:e.z.string(),sdkVersion:e.z.string(),deviceInfo:r,payload:e.z.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),n=e.z.array(s);exports.deviceInfoSchema=r,exports.reportDataListSchema=n,exports.reportDataSchema=s;
|
|
@@ -0,0 +1 @@
|
|
|
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(),fingerprint:e.string(),language:e.string(),screenResolution:e.string()}),n=e.object({id:e.string(),type:e.nativeEnum(r),name:e.string(),time:e.string(),timestamp:e.number(),message:e.string(),status:e.nativeEnum(t),url:e.string(),userId:e.string(),projectId:e.string(),sdkVersion:e.string(),deviceInfo:s,payload:e.custom(e=>"object"==typeof e&&null!==e,"Expected a report payload object")}),i=e.array(n);export{s as deviceInfoSchema,i as reportDataListSchema,n as reportDataSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../constants/index.cjs");require("../types/enums.cjs");var t=require("../utils/sentry.cjs"),o=require("./promise.cjs");function r(o,r){const{type:s,name:n,time:a,timestamp:i,message:u,status:p}=r;return{type:s,name:n,time:a,timestamp:i,message:u,status:p,id:o,url:location.href,userId:t.default.options.userId,projectId:t.default.options.projectId,sdkVersion:e.SDK_VERSION,deviceInfo:t.default.deviceInfo,payload:r}}function s(e){return!1===e?null:e}exports.payloadToReportData=r,exports.runBeforeReportHook=function(e,n){const a=r(e,n);if(!t.default.options.onBeforeReportData)return a;const i=t.default.options.onBeforeReportData(a);return o.isPromise(i)?i.then(s):s(i)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SDK_VERSION as t}from"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{isPromise as o}from"./promise.js";function n(o,n){const{type:s,name:r,time:i,timestamp:p,message:m,status:a}=n;return{type:s,name:r,time:i,timestamp:p,message:m,status:a,id:o,url:location.href,userId:e.options.userId,projectId:e.options.projectId,sdkVersion:t,deviceInfo:e.deviceInfo,payload:n}}function s(t,s){const i=n(t,s);if(!e.options.onBeforeReportData)return i;const p=e.options.onBeforeReportData(i);return o(p)?p.then(r):r(p)}function r(t){return!1===t?null:t}export{n as payloadToReportData,s as runBeforeReportHook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),r=require("../utils/logger.cjs");exports.shouldQueuePayload=function(s){const t=e.default.options;return""===t.dsn?(r.sentryLogger.error("DSN is empty, report cancelled",s),!1):Math.random()>t.tracesSampleRate?(r.sentryLogger.info(`Dropped by sample rate: ${s.type}`),!1):(t.screenRecordEventTypes.includes(s.type)&&(e.default.shouldScreenRecord=!0),!0)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import e from"../utils/sentry.js";import{sentryLogger as r}from"../utils/logger.js";function t(t){const o=e.options;return""===o.dsn?(r.error("DSN is empty, report cancelled",t),!1):Math.random()>o.tracesSampleRate?(r.info(`Dropped by sample rate: ${t.type}`),!1):(o.screenRecordEventTypes.includes(t.type)&&(e.shouldScreenRecord=!0),!0)}export{t as shouldQueuePayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),r=require("../utils/logger.cjs"),t=require("./timer.cjs");function s(i,n){n.setOnline(!1),i&&clearTimeout(i);const c=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.loadOfflineCache(),t.flush()):s(void 0,t)}).catch(()=>{s(void 0,t)})}(n)},e.default.options.retryIntervalMilliseconds);return t.unrefTimer(c),n.setRetryTimer(c),c}exports.scheduleServerRecovery=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import t from"../utils/sentry.js";import{sentryLogger as e}from"../utils/logger.js";import{unrefTimer as i}from"./timer.js";function o(s,n){n.setOnline(!1),s&&clearTimeout(s);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.loadOfflineCache(),i.flush()):o(void 0,i)}).catch(()=>{o(void 0,i)})}(n)},t.options.retryIntervalMilliseconds);return i(r),n.setRetryTimer(r),r}export{o as scheduleServerRecovery};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.unrefTimer=function(n){(function(n){return"object"==typeof n&&null!==n&&"unref"in n&&"function"==typeof n.unref})(n)&&n.unref()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){(function(n){return"object"==typeof n&&null!==n&&"unref"in n&&"function"==typeof n.unref})(n)&&n.unref()}export{n as unrefTimer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("../constants/index.cjs"),require("../types/enums.cjs");var e=require("../utils/sentry.cjs"),t=require("../utils/logger.cjs");exports.isObjectOverSizeLimit=function(e,t){const n=JSON.stringify(e);return(new TextEncoder).encode(n).byteLength>1024*t},exports.reportByFetch=async function(n,r){try{const t=await fetch(e.default.options.dsn,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||r(),t.ok}catch(e){return t.sentryLogger.error("Fetch report failed",e),r(),!1}},exports.reportByImage=function(t,n){const{dsn:r}=e.default.options;n.push(()=>{const e=new Image,n=r.includes("?")?"&":"?";e.src=`${r}${n}data=${encodeURIComponent(JSON.stringify(t))}`})},exports.sendBeacon=function(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(e.default.options.dsn,JSON.stringify(t))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/index.js";import"../types/enums.js";import n from"../utils/sentry.js";import{sentryLogger as t}from"../utils/logger.js";function e(n,t){const e=JSON.stringify(n);return(new TextEncoder).encode(e).byteLength>1024*t}function o(t){return!("undefined"==typeof navigator||!navigator.sendBeacon)&&navigator.sendBeacon(n.options.dsn,JSON.stringify(t))}async function r(e,o){try{const t=await fetch(n.options.dsn,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},keepalive:!0});return t.ok||o(),t.ok}catch(n){return t.error("Fetch report failed",n),o(),!1}}function s(t,e){const{dsn:o}=n.options;e.push(()=>{const n=new Image,e=o.includes("?")?"&":"?";n.src=`${o}${e}data=${encodeURIComponent(JSON.stringify(t))}`})}export{e as isObjectOverSizeLimit,r as reportByFetch,s as reportByImage,o as sendBeacon};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { EventType, Status, HttpMethod, BreadcrumbType } from './enums.js';
|
|
2
|
+
import { Metric } from 'web-vitals';
|
|
3
|
+
import { IOptions } from './options.js';
|
|
4
|
+
|
|
5
|
+
interface ISentry {
|
|
6
|
+
codeErrors: {
|
|
7
|
+
has(value: string): boolean;
|
|
8
|
+
add(value: string): void;
|
|
9
|
+
};
|
|
10
|
+
whiteScreenTimer: ReturnType<typeof setInterval> | null;
|
|
11
|
+
options: IOptions;
|
|
12
|
+
shouldScreenRecord: boolean;
|
|
13
|
+
deviceInfo: IDeviceInfo;
|
|
14
|
+
setOptions: (newOptions: Partial<IOptions>) => void;
|
|
15
|
+
}
|
|
16
|
+
interface IBreadcrumbItem extends IReportPayload {
|
|
17
|
+
userAction: BreadcrumbType;
|
|
18
|
+
}
|
|
19
|
+
interface IDeviceInfo {
|
|
20
|
+
browserName: string;
|
|
21
|
+
browserVersion: string;
|
|
22
|
+
osName: string;
|
|
23
|
+
osVersion: string;
|
|
24
|
+
userAgent: string;
|
|
25
|
+
deviceType: string;
|
|
26
|
+
deviceModel: string;
|
|
27
|
+
fingerprint: string;
|
|
28
|
+
language: string;
|
|
29
|
+
screenResolution: string;
|
|
30
|
+
}
|
|
31
|
+
interface IReportPayload {
|
|
32
|
+
id: string;
|
|
33
|
+
deviceId?: string;
|
|
34
|
+
sessionId?: string;
|
|
35
|
+
type: EventType;
|
|
36
|
+
name: string;
|
|
37
|
+
time: string;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
message: string;
|
|
40
|
+
status: Status;
|
|
41
|
+
}
|
|
42
|
+
interface IHttpData extends IReportPayload {
|
|
43
|
+
method: HttpMethod | string;
|
|
44
|
+
api: string;
|
|
45
|
+
elapsedTime: number;
|
|
46
|
+
statusCode: number;
|
|
47
|
+
requestData?: unknown;
|
|
48
|
+
responseData?: unknown;
|
|
49
|
+
serverTiming?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
interface IResourceError extends IReportPayload {
|
|
52
|
+
src: string;
|
|
53
|
+
href: string;
|
|
54
|
+
}
|
|
55
|
+
interface IPerformanceMetricData extends IReportPayload {
|
|
56
|
+
value: Metric["value"];
|
|
57
|
+
rating?: Metric["rating"];
|
|
58
|
+
}
|
|
59
|
+
interface IPerformanceResourceTiming {
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly initiatorType: string;
|
|
62
|
+
readonly startTime: number;
|
|
63
|
+
readonly responseEnd: number;
|
|
64
|
+
readonly duration: number;
|
|
65
|
+
readonly transferSize: number;
|
|
66
|
+
readonly encodedBodySize: number;
|
|
67
|
+
readonly decodedBodySize: number;
|
|
68
|
+
readonly fromCache: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface IPerformanceResourceListData extends IReportPayload {
|
|
71
|
+
resourceList: readonly IPerformanceResourceTiming[];
|
|
72
|
+
}
|
|
73
|
+
interface IPerformanceLongTaskData extends IReportPayload {
|
|
74
|
+
longTasks: PerformanceEntry[];
|
|
75
|
+
}
|
|
76
|
+
interface IPerformanceMemoryData extends IReportPayload {
|
|
77
|
+
memory: unknown;
|
|
78
|
+
}
|
|
79
|
+
interface IPerformanceExtraData extends IReportPayload {
|
|
80
|
+
extra: unknown;
|
|
81
|
+
value?: number;
|
|
82
|
+
}
|
|
83
|
+
type IPerformanceData = IPerformanceMetricData | IPerformanceResourceListData | IPerformanceLongTaskData | IPerformanceMemoryData | IPerformanceExtraData;
|
|
84
|
+
interface ICodeError extends IReportPayload {
|
|
85
|
+
line: number;
|
|
86
|
+
column: number;
|
|
87
|
+
}
|
|
88
|
+
interface IScreenRecordData extends IReportPayload {
|
|
89
|
+
event: string;
|
|
90
|
+
events?: string;
|
|
91
|
+
eventCount?: number;
|
|
92
|
+
}
|
|
93
|
+
interface IExposureData extends IReportPayload {
|
|
94
|
+
extra: {
|
|
95
|
+
readonly threshold: number;
|
|
96
|
+
readonly observeTime: number;
|
|
97
|
+
readonly showTime: number;
|
|
98
|
+
readonly showEndTime: number;
|
|
99
|
+
readonly duration: number;
|
|
100
|
+
readonly params: Readonly<Record<string, unknown>>;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
interface IRouteData extends IReportPayload {
|
|
104
|
+
from: string;
|
|
105
|
+
to: string;
|
|
106
|
+
}
|
|
107
|
+
type IBaseDataWithEvent = IReportPayload & {
|
|
108
|
+
extra: "WhiteScreen" | unknown;
|
|
109
|
+
};
|
|
110
|
+
type TReportPayload = IBaseDataWithEvent | IHttpData | IResourceError | IPerformanceData | ICodeError | IExposureData | IScreenRecordData | IRouteData | IBatchErrorData;
|
|
111
|
+
interface IBatchErrorData extends IReportPayload {
|
|
112
|
+
batchError: true;
|
|
113
|
+
batchErrorLength: number;
|
|
114
|
+
batchErrorLastHappenTime: number;
|
|
115
|
+
}
|
|
116
|
+
type TOnReportWhiteScreenData = (data: IReportPayload) => void;
|
|
117
|
+
type TOnReportPerformanceData = (data: IPerformanceData) => void;
|
|
118
|
+
interface IReportData<T extends TReportPayload = TReportPayload> extends IReportPayload {
|
|
119
|
+
url: string;
|
|
120
|
+
userId: string;
|
|
121
|
+
projectId: string;
|
|
122
|
+
sdkVersion: string;
|
|
123
|
+
breadcrumbs?: IBreadcrumbItem[];
|
|
124
|
+
deviceInfo: IDeviceInfo;
|
|
125
|
+
payload: T;
|
|
126
|
+
}
|
|
127
|
+
interface IDataReporter {
|
|
128
|
+
send(payload: TReportPayload): Promise<void>;
|
|
129
|
+
flushOfflineCache(): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
interface IExtendedErrorEvent extends ErrorEvent {
|
|
132
|
+
target: EventTarget & {
|
|
133
|
+
src: string;
|
|
134
|
+
href: string;
|
|
135
|
+
localName: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
type TUnknownError = IExtendedErrorEvent | Error /** React */ | unknown;
|
|
139
|
+
|
|
140
|
+
export type { IBaseDataWithEvent, IBatchErrorData, IBreadcrumbItem, ICodeError, IDataReporter, IDeviceInfo, IExposureData, IExtendedErrorEvent, IHttpData, IPerformanceData, IPerformanceResourceTiming, IReportData, IReportPayload, IResourceError, IRouteData, IScreenRecordData, ISentry, TOnReportPerformanceData, TOnReportWhiteScreenData, TReportPayload, TUnknownError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,t,o,r,a,n,s;exports.HttpStatus=void 0,(e=exports.HttpStatus||(exports.HttpStatus={})).OK="OK",e.BadRequest="Bad Request",e.Unauthorized="Unauthorized",e.Forbidden="Forbidden",e.NotFound="NotFound",e.Conflict="Conflict",e.PayloadTooLarge="Payload Too Large",e.TooManyRequests="Too Many Requests",e.InternalServerError="Internal Server Error",e.NotImplemented="Not Implemented",e.ServiceUnavailable="Service Unavailable",e.GatewayTimeout="Gateway Timeout",e.UnknownError="Unknown Error",exports.BreadcrumbType=void 0,(t=exports.BreadcrumbType||(exports.BreadcrumbType={})).Http="Http",t.Click="Click",t.Route="Route",t.Resource="Resource",t.CodeError="Code Error",t.Custom="Custom",exports.Status=void 0,(o=exports.Status||(exports.Status={})).Error="Error",o.OK="OK",exports.EventType=void 0,(r=exports.EventType||(exports.EventType={})).Xhr="XMLHttpRequest",r.Fetch="fetch",r.Click="Click",r.HashChange="Event hashchange",r.History="History",r.Resource="Resource",r.UnhandledRejection="Event unhandledrejection",r.Error="Error",r.Vue="Vue",r.React="React",r.Swifty="Swifty",r.Performance="Performance",r.ScreenRecord="ScreenRecord",r.Exposure="Exposure",r.WhiteScreen="WhiteScreen",r.Custom="Custom",r.PV="PV",exports.HttpType=void 0,(a=exports.HttpType||(exports.HttpType={})).Xhr="XMLHttpRequest",a.Fetch="fetch",exports.HttpStatusCode=void 0,(n=exports.HttpStatusCode||(exports.HttpStatusCode={}))[n.OK=200]="OK",n[n.BadRequest=400]="BadRequest",n[n.Unauthorized=401]="Unauthorized",n[n.Forbidden=403]="Forbidden",n[n.NotFound=404]="NotFound",n[n.Conflict=409]="Conflict",n[n.PayloadTooLarge=413]="PayloadTooLarge",n[n.TooManyRequests=429]="TooManyRequests",n[n.InternalServerError=500]="InternalServerError",n[n.NotImplemented=501]="NotImplemented",n[n.ServiceUnavailable=503]="ServiceUnavailable",n[n.GatewayTimeout=504]="GatewayTimeout",exports.HttpMethod=void 0,(s=exports.HttpMethod||(exports.HttpMethod={})).Get="GET",s.Head="HEAD",s.Post="POST",s.Put="PUT",s.Delete="DELETE",s.Connect="CONNECT",s.Options="OPTIONS",s.Trace="TRACE",s.Patch="PATCH";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare enum HttpStatus {
|
|
2
|
+
OK = "OK",// 200
|
|
3
|
+
BadRequest = "Bad Request",// 400
|
|
4
|
+
Unauthorized = "Unauthorized",// 401
|
|
5
|
+
Forbidden = "Forbidden",// 403
|
|
6
|
+
NotFound = "NotFound",// 404
|
|
7
|
+
Conflict = "Conflict",// 409
|
|
8
|
+
PayloadTooLarge = "Payload Too Large",// 413
|
|
9
|
+
TooManyRequests = "Too Many Requests",// 429
|
|
10
|
+
InternalServerError = "Internal Server Error",// 500
|
|
11
|
+
NotImplemented = "Not Implemented",// 501
|
|
12
|
+
ServiceUnavailable = "Service Unavailable",// 503
|
|
13
|
+
GatewayTimeout = "Gateway Timeout",// 504
|
|
14
|
+
UnknownError = "Unknown Error"
|
|
15
|
+
}
|
|
16
|
+
declare enum BreadcrumbType {
|
|
17
|
+
Http = "Http",
|
|
18
|
+
Click = "Click",
|
|
19
|
+
Route = "Route",
|
|
20
|
+
Resource = "Resource",
|
|
21
|
+
CodeError = "Code Error",
|
|
22
|
+
Custom = "Custom"
|
|
23
|
+
}
|
|
24
|
+
declare enum Status {
|
|
25
|
+
Error = "Error",
|
|
26
|
+
OK = "OK"
|
|
27
|
+
}
|
|
28
|
+
declare enum EventType {
|
|
29
|
+
Xhr = "XMLHttpRequest",
|
|
30
|
+
Fetch = "fetch",
|
|
31
|
+
Click = "Click",
|
|
32
|
+
HashChange = "Event hashchange",
|
|
33
|
+
History = "History",
|
|
34
|
+
Resource = "Resource",
|
|
35
|
+
UnhandledRejection = "Event unhandledrejection",
|
|
36
|
+
Error = "Error",
|
|
37
|
+
Vue = "Vue",
|
|
38
|
+
React = "React",
|
|
39
|
+
Swifty = "Swifty",
|
|
40
|
+
Performance = "Performance",
|
|
41
|
+
ScreenRecord = "ScreenRecord",
|
|
42
|
+
Exposure = "Exposure",
|
|
43
|
+
WhiteScreen = "WhiteScreen",
|
|
44
|
+
Custom = "Custom",
|
|
45
|
+
PV = "PV"
|
|
46
|
+
}
|
|
47
|
+
declare enum HttpType {
|
|
48
|
+
Xhr = "XMLHttpRequest",
|
|
49
|
+
Fetch = "fetch"
|
|
50
|
+
}
|
|
51
|
+
declare enum HttpStatusCode {
|
|
52
|
+
OK = 200,
|
|
53
|
+
BadRequest = 400,
|
|
54
|
+
Unauthorized = 401,
|
|
55
|
+
Forbidden = 403,
|
|
56
|
+
NotFound = 404,
|
|
57
|
+
Conflict = 409,
|
|
58
|
+
PayloadTooLarge = 413,
|
|
59
|
+
TooManyRequests = 429,
|
|
60
|
+
InternalServerError = 500,
|
|
61
|
+
NotImplemented = 501,
|
|
62
|
+
ServiceUnavailable = 503,
|
|
63
|
+
GatewayTimeout = 504
|
|
64
|
+
}
|
|
65
|
+
declare enum HttpMethod {
|
|
66
|
+
Get = "GET",
|
|
67
|
+
Head = "HEAD",
|
|
68
|
+
Post = "POST",
|
|
69
|
+
Put = "PUT",
|
|
70
|
+
Delete = "DELETE",
|
|
71
|
+
Connect = "CONNECT",
|
|
72
|
+
Options = "OPTIONS",
|
|
73
|
+
Trace = "TRACE",
|
|
74
|
+
Patch = "PATCH"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { BreadcrumbType, EventType, HttpMethod, HttpStatus, HttpStatusCode, HttpType, Status };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,o,r,t,n,a,u;!function(e){e.OK="OK",e.BadRequest="Bad Request",e.Unauthorized="Unauthorized",e.Forbidden="Forbidden",e.NotFound="NotFound",e.Conflict="Conflict",e.PayloadTooLarge="Payload Too Large",e.TooManyRequests="Too Many Requests",e.InternalServerError="Internal Server Error",e.NotImplemented="Not Implemented",e.ServiceUnavailable="Service Unavailable",e.GatewayTimeout="Gateway Timeout",e.UnknownError="Unknown Error"}(e||(e={})),function(e){e.Http="Http",e.Click="Click",e.Route="Route",e.Resource="Resource",e.CodeError="Code Error",e.Custom="Custom"}(o||(o={})),function(e){e.Error="Error",e.OK="OK"}(r||(r={})),function(e){e.Xhr="XMLHttpRequest",e.Fetch="fetch",e.Click="Click",e.HashChange="Event hashchange",e.History="History",e.Resource="Resource",e.UnhandledRejection="Event unhandledrejection",e.Error="Error",e.Vue="Vue",e.React="React",e.Swifty="Swifty",e.Performance="Performance",e.ScreenRecord="ScreenRecord",e.Exposure="Exposure",e.WhiteScreen="WhiteScreen",e.Custom="Custom",e.PV="PV"}(t||(t={})),function(e){e.Xhr="XMLHttpRequest",e.Fetch="fetch"}(n||(n={})),function(e){e[e.OK=200]="OK",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.Conflict=409]="Conflict",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"}(a||(a={})),function(e){e.Get="GET",e.Head="HEAD",e.Post="POST",e.Put="PUT",e.Delete="DELETE",e.Connect="CONNECT",e.Options="OPTIONS",e.Trace="TRACE",e.Patch="PATCH"}(u||(u={}));export{o as BreadcrumbType,t as EventType,u as HttpMethod,e as HttpStatus,a as HttpStatusCode,n as HttpType,r as Status};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TReportPayload } from './common.js';
|
|
2
|
+
import { EventType } from './enums.js';
|
|
3
|
+
import { Cleanup } from '../utils/decorate-prop.js';
|
|
4
|
+
|
|
5
|
+
type TEventHandler<T extends TReportPayload = TReportPayload> = {
|
|
6
|
+
handle(data: T): void;
|
|
7
|
+
}["handle"];
|
|
8
|
+
type IPub = (type: EventType, param: TReportPayload) => void;
|
|
9
|
+
type ISub = <T extends TReportPayload>(type: EventType, handler: TEventHandler<T>) => Cleanup;
|
|
10
|
+
|
|
11
|
+
export type { IPub, ISub, TEventHandler };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IReportData, IBreadcrumbItem } from './common.js';
|
|
2
|
+
import { EventType } from './enums.js';
|
|
3
|
+
|
|
4
|
+
type ReportDataHook = (data: IReportData) => Promise<IReportData | false> | IReportData | false;
|
|
5
|
+
type ReportBatchHook = (data: readonly IReportData[]) => Promise<readonly IReportData[] | false> | readonly IReportData[] | false;
|
|
6
|
+
type AfterSendDataHook = (data: readonly IReportData[]) => Promise<void> | void;
|
|
7
|
+
interface IOptions {
|
|
8
|
+
dsn: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
userId: string;
|
|
12
|
+
enableXhr: boolean;
|
|
13
|
+
enableFetch: boolean;
|
|
14
|
+
enableClick: boolean;
|
|
15
|
+
enableError: boolean;
|
|
16
|
+
enableUnhandledRejection: boolean;
|
|
17
|
+
enableHashChange: boolean;
|
|
18
|
+
enableHistory: boolean;
|
|
19
|
+
enablePerformance: boolean;
|
|
20
|
+
enableScreenRecord: boolean;
|
|
21
|
+
enableWhiteScreen: boolean;
|
|
22
|
+
enableFingerprint: boolean;
|
|
23
|
+
anonymousId: string;
|
|
24
|
+
visitorId: string;
|
|
25
|
+
useImageReport: boolean;
|
|
26
|
+
screenRecordDurationMs: number;
|
|
27
|
+
screenRecordEventTypes: EventType[];
|
|
28
|
+
hasSkeleton: boolean;
|
|
29
|
+
rootCssSelectors: string[];
|
|
30
|
+
clickThrottleDelay: number;
|
|
31
|
+
requestTimeoutMilliseconds: number;
|
|
32
|
+
maxBreadcrumbs: number;
|
|
33
|
+
repeatCodeError: boolean;
|
|
34
|
+
enableHttpPerformance: boolean;
|
|
35
|
+
ignoreErrors: (string | RegExp)[];
|
|
36
|
+
excludeApis: (string | RegExp)[];
|
|
37
|
+
onBeforePushBreadcrumb?: ((data: IBreadcrumbItem) => IBreadcrumbItem) | undefined;
|
|
38
|
+
cacheMaxLength: number;
|
|
39
|
+
cacheWaitingTime: number;
|
|
40
|
+
maxQueueLength: number;
|
|
41
|
+
retryIntervalMilliseconds: number;
|
|
42
|
+
onBeforeReportData?: ReportDataHook | undefined;
|
|
43
|
+
beforePushEventList?: ReportBatchHook | undefined;
|
|
44
|
+
afterSendData?: AfterSendDataHook | undefined;
|
|
45
|
+
offlineCacheKey: string;
|
|
46
|
+
tracesSampleRate: number;
|
|
47
|
+
handleHttpError?: (<T>(data: T) => boolean) | undefined;
|
|
48
|
+
debug: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { AfterSendDataHook, IOptions, ReportBatchHook, ReportDataHook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.SentryPlugin=class{type;constructor(t){this.type=t}};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EventType } from './enums.js';
|
|
2
|
+
import { IReportPayload } from './common.js';
|
|
3
|
+
|
|
4
|
+
type WithSentry<T, S extends IReportPayload = IReportPayload> = T & {
|
|
5
|
+
__sentry__: S;
|
|
6
|
+
};
|
|
7
|
+
declare abstract class SentryPlugin {
|
|
8
|
+
type: EventType;
|
|
9
|
+
constructor(type: EventType);
|
|
10
|
+
abstract init(): void;
|
|
11
|
+
destroy?(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { SentryPlugin };
|
|
15
|
+
export type { WithSentry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t{type;constructor(t){this.type=t}}export{t as SentryPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.base64v2=function(e){const r=(new TextEncoder).encode(e);let o="";for(const e of r)o+=String.fromCharCode(e);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){const o=(new TextEncoder).encode(e);let r="";for(const e of o)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export{e as base64v2};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t="s-swifty-",e=new Set(["view","msg","ev"]);function n(t){return t.hasAttribute("s-swifty-view")||t.hasAttribute("s-swifty-ev")||t.hasAttribute("s-swifty-msg")}function r(t){const e=(n=t)?n.getAttribute("s-swifty-msg")??n.title:"";var n;if(e)return e;const r=t.textContent?.trim();return r||t.getAttribute("aria-label")||t.tagName.toLowerCase()}function s(t,e){for(const n of t){const t=n.getAttribute(e);if(t)return t}return null}function i(t){const e=s(t,"s-swifty-ev");if(e)return e;const n=s(t,"title");if(n)return n;const r=s(t,"s-swifty-view");return r||(t[0]?.tagName.toLowerCase()??"unknown")}function o(n){const r=n.find(e=>Array.from(e.attributes).some(e=>e.name.startsWith(t)));return r?Array.from(r.attributes).reduce((n,r)=>{if(!r.name.startsWith(t))return n;const s=r.name.replace(t,"");return e.has(s)||(n[s]=r.value||null),n},{}):{}}function a(t){const e=[];let n=t;for(;n&&n!==document.body;)e.unshift(n.tagName.toLowerCase()),n=n.parentElement;return e.join(">")}exports.getDeclarativeClickData=function(t){const e=function(t){return t.composedPath().filter(t=>t instanceof HTMLElement)}(t),s=e.length>0?e:function(t){if(!(t instanceof HTMLElement))return[];const e=[];let n=t;for(;n;)e.push(n),n=n.parentElement;return e}(t.target),u=s.find(n);if(!u)return null;const c=t.target instanceof HTMLElement?t.target:u,{top:f,left:l}=c.getBoundingClientRect(),{scrollTop:m,scrollLeft:g}=document.documentElement;return{ev:i(s),msg:r(u),triggerPageUrl:location.href,x:l+g,y:f+m,params:o(s),elementPath:a(u).slice(-128),triggerTime:Date.now()}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t="s-swifty-",e=new Set(["view","msg","ev"]);function n(t){return t.hasAttribute("s-swifty-view")||t.hasAttribute("s-swifty-ev")||t.hasAttribute("s-swifty-msg")}function r(t){const e=(n=t)?n.getAttribute("s-swifty-msg")??n.title:"";var n;if(e)return e;const r=t.textContent?.trim();return r||t.getAttribute("aria-label")||t.tagName.toLowerCase()}function o(t,e){for(const n of t){const t=n.getAttribute(e);if(t)return t}return null}function s(t){const e=o(t,"s-swifty-ev");if(e)return e;const n=o(t,"title");if(n)return n;const r=o(t,"s-swifty-view");return r||(t[0]?.tagName.toLowerCase()??"unknown")}function i(n){const r=n.find(e=>Array.from(e.attributes).some(e=>e.name.startsWith(t)));return r?Array.from(r.attributes).reduce((n,r)=>{if(!r.name.startsWith(t))return n;const o=r.name.replace(t,"");return e.has(o)||(n[o]=r.value||null),n},{}):{}}function u(t){const e=[];let n=t;for(;n&&n!==document.body;)e.unshift(n.tagName.toLowerCase()),n=n.parentElement;return e.join(">")}function a(t){const e=function(t){return t.composedPath().filter(t=>t instanceof HTMLElement)}(t),o=e.length>0?e:function(t){if(!(t instanceof HTMLElement))return[];const e=[];let n=t;for(;n;)e.push(n),n=n.parentElement;return e}(t.target),a=o.find(n);if(!a)return null;const f=t.target instanceof HTMLElement?t.target:a,{top:c,left:l}=f.getBoundingClientRect(),{scrollTop:m,scrollLeft:g}=document.documentElement;return{ev:s(o),msg:r(a),triggerPageUrl:location.href,x:l+g,y:c+m,params:i(o),elementPath:u(a).slice(-128),triggerTime:Date.now()}}export{a as getDeclarativeClickData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("../constants/index.cjs");exports.BoundedSet=class{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}},exports.CallbackQueue=class{cbList=[];isFlushing=!1;push(t,s,...i){"function"==typeof t&&this.callByRequestIdleCallback(t,s,...i)}callByRequestIdleCallback(t,s,...i){this.cbList.push(t.bind(s,...i)),this.isFlushing||(this.isFlushing=!0,"function"==typeof requestIdleCallback?requestIdleCallback(()=>{this.flushFuncList()}):Promise.resolve().then(()=>{this.flushFuncList()}))}clear(){this.cbList=[],this.isFlushing=!1}flushFuncList(){const t=this.cbList;this.cbList=[],this.isFlushing=!1,t.forEach(t=>{t()})}},exports.MinHeap=class{capacity=t.MAX_BREADCRUMBS;heap=[];get size(){return this.heap.length}constructor(s=t.MAX_BREADCRUMBS,i=[]){if(this.capacity=s,this.heap=i.slice(0,s),this.buildHeap(),i.length>s){const t=i.slice(s);for(const s of t)s.timestamp>=this.heap[0].timestamp&&(this.heap[0]=s,this.heapifyDown(0))}}push(t){return this.size<this.capacity?(this.heap.push(t),this.heapifyUp(this.size-1),!0):t.timestamp>=this.heap[0].timestamp&&(this.heap[0]=t,this.heapifyDown(0),!0)}peek(){return this.heap[0]}heapifyUp(t){for(;t>0;){const s=Math.floor((t-1)/2);if(this.heap[s].timestamp<=this.heap[t].timestamp)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}heapifyDown(t){for(;;){let s=t;const i=2*t+1,e=2*t+2;if(i<this.size&&this.heap[i].timestamp<this.heap[s].timestamp&&(s=i),e<this.size&&this.heap[e].timestamp<this.heap[s].timestamp&&(s=e),s===t)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}buildHeap(){const t=this.size-1;for(let s=Math.floor((t-1)/2);s>=0;s--)this.heapifyDown(s)}dump(){return[...this.heap].sort((t,s)=>t.timestamp-s.timestamp)}clear(){this.heap=[]}pop(){if(0===this.size)return;const t=this.heap[0];return this.heap[0]=this.heap[this.size-1],this.heap.pop(),this.size>0&&this.heapifyDown(0),t}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_BREADCRUMBS as t}from"../constants/index.js";class s{capacity=t;heap=[];get size(){return this.heap.length}constructor(s=t,i=[]){if(this.capacity=s,this.heap=i.slice(0,s),this.buildHeap(),i.length>s){const t=i.slice(s);for(const s of t)s.timestamp>=this.heap[0].timestamp&&(this.heap[0]=s,this.heapifyDown(0))}}push(t){return this.size<this.capacity?(this.heap.push(t),this.heapifyUp(this.size-1),!0):t.timestamp>=this.heap[0].timestamp&&(this.heap[0]=t,this.heapifyDown(0),!0)}peek(){return this.heap[0]}heapifyUp(t){for(;t>0;){const s=Math.floor((t-1)/2);if(this.heap[s].timestamp<=this.heap[t].timestamp)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}heapifyDown(t){for(;;){let s=t;const i=2*t+1,h=2*t+2;if(i<this.size&&this.heap[i].timestamp<this.heap[s].timestamp&&(s=i),h<this.size&&this.heap[h].timestamp<this.heap[s].timestamp&&(s=h),s===t)break;[this.heap[t],this.heap[s]]=[this.heap[s],this.heap[t]],t=s}}buildHeap(){const t=this.size-1;for(let s=Math.floor((t-1)/2);s>=0;s--)this.heapifyDown(s)}dump(){return[...this.heap].sort((t,s)=>t.timestamp-s.timestamp)}clear(){this.heap=[]}pop(){if(0===this.size)return;const t=this.heap[0];return this.heap[0]=this.heap[this.size-1],this.heap.pop(),this.size>0&&this.heapifyDown(0),t}}class i{map=new Map;capacity;constructor(t){this.capacity=t}has(t){return this.map.has(t)}add(t){if(this.map.has(t)&&this.map.delete(t),this.map.set(t,!0),this.map.size>this.capacity){const t=this.map.keys().next().value;void 0!==t&&this.map.delete(t)}}clear(){this.map.clear()}}class h{cbList=[];isFlushing=!1;push(t,s,...i){"function"==typeof t&&this.callByRequestIdleCallback(t,s,...i)}callByRequestIdleCallback(t,s,...i){this.cbList.push(t.bind(s,...i)),this.isFlushing||(this.isFlushing=!0,"function"==typeof requestIdleCallback?requestIdleCallback(()=>{this.flushFuncList()}):Promise.resolve().then(()=>{this.flushFuncList()}))}clear(){this.cbList=[],this.isFlushing=!1}flushFuncList(){const t=this.cbList;this.cbList=[],this.isFlushing=!1,t.forEach(t=>{t()})}}export{i as BoundedSet,h as CallbackQueue,s as MinHeap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t,r){const o=e[t],s=r(o);return e[t]=s,()=>{e[t]=o}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,n,e){const o=t[n],r=e(o);return t[n]=r,()=>{t[n]=o}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs");exports.default=function(r){switch(r){case e.EventType.Xhr:case e.EventType.Fetch:return e.BreadcrumbType.Http;case e.EventType.Click:return e.BreadcrumbType.Click;case e.EventType.HashChange:case e.EventType.History:return e.BreadcrumbType.Route;case e.EventType.Resource:return e.BreadcrumbType.Resource;case e.EventType.UnhandledRejection:case e.EventType.Error:case e.EventType.Vue:case e.EventType.React:return e.BreadcrumbType.CodeError;case e.EventType.Performance:case e.EventType.ScreenRecord:case e.EventType.WhiteScreen:case e.EventType.Custom:default:return e.BreadcrumbType.Custom}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BreadcrumbType as e,EventType as r}from"../types/enums.js";function c(c){switch(c){case r.Xhr:case r.Fetch:return e.Http;case r.Click:return e.Click;case r.HashChange:case r.History:return e.Route;case r.Resource:return e.Resource;case r.UnhandledRejection:case r.Error:case r.Vue:case r.React:return e.CodeError;case r.Performance:case r.ScreenRecord:case r.WhiteScreen:case r.Custom:default:return e.Custom}}export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/enums.cjs"),t=require("./session.cjs");exports.default=function(){return{id:crypto.randomUUID?crypto.randomUUID():t.getDeviceId(),deviceId:t.getDeviceId(),sessionId:t.getSessionId(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.Status.OK,type:e.EventType.Custom}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventType as t,Status as e}from"../types/enums.js";import{getSessionId as s,getDeviceId as o}from"./session.js";function m(){return{id:crypto.randomUUID?crypto.randomUUID():o(),deviceId:o(),sessionId:s(),message:"",timestamp:Date.now(),time:(new Date).toISOString(),name:"",status:e.OK,type:t.Custom}}export{m as default};
|