@jerry_aurora/sky-monitor-sdk 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +355 -0
- package/dist/chunk-2EV6VMEO.js +2 -0
- package/dist/chunk-2EV6VMEO.js.map +1 -0
- package/dist/chunk-2R7LNQYV.js +4 -0
- package/dist/chunk-2R7LNQYV.js.map +1 -0
- package/dist/chunk-4DK7RV2K.js +2 -0
- package/dist/chunk-4DK7RV2K.js.map +1 -0
- package/dist/chunk-4GL6IXHZ.cjs +2 -0
- package/dist/chunk-4GL6IXHZ.cjs.map +1 -0
- package/dist/chunk-4K5NIPXS.cjs +2 -0
- package/dist/chunk-4K5NIPXS.cjs.map +1 -0
- package/dist/chunk-5RS6LIZN.js +2 -0
- package/dist/chunk-5RS6LIZN.js.map +1 -0
- package/dist/chunk-5VYMD33V.cjs +2 -0
- package/dist/chunk-5VYMD33V.cjs.map +1 -0
- package/dist/chunk-647GK2XE.js +2 -0
- package/dist/chunk-647GK2XE.js.map +1 -0
- package/dist/chunk-6KJXTS2V.js +2 -0
- package/dist/chunk-6KJXTS2V.js.map +1 -0
- package/dist/chunk-6YTKBMJD.cjs +2 -0
- package/dist/chunk-6YTKBMJD.cjs.map +1 -0
- package/dist/chunk-ACIPNVBT.cjs +2 -0
- package/dist/chunk-ACIPNVBT.cjs.map +1 -0
- package/dist/chunk-BEGDR54W.js +2 -0
- package/dist/chunk-BEGDR54W.js.map +1 -0
- package/dist/chunk-BVOILM65.cjs +2 -0
- package/dist/chunk-BVOILM65.cjs.map +1 -0
- package/dist/chunk-FBQC6XIY.cjs +2 -0
- package/dist/chunk-FBQC6XIY.cjs.map +1 -0
- package/dist/chunk-GBREIA45.js +2 -0
- package/dist/chunk-GBREIA45.js.map +1 -0
- package/dist/chunk-GU7O5MWM.js +2 -0
- package/dist/chunk-GU7O5MWM.js.map +1 -0
- package/dist/chunk-JMHMJVBJ.cjs +2 -0
- package/dist/chunk-JMHMJVBJ.cjs.map +1 -0
- package/dist/chunk-LAATIQ3Y.cjs +2 -0
- package/dist/chunk-LAATIQ3Y.cjs.map +1 -0
- package/dist/chunk-LFJTX6FJ.cjs +2 -0
- package/dist/chunk-LFJTX6FJ.cjs.map +1 -0
- package/dist/chunk-LKBNR7RI.js +2 -0
- package/dist/chunk-LKBNR7RI.js.map +1 -0
- package/dist/chunk-NM4RALDJ.cjs +2 -0
- package/dist/chunk-NM4RALDJ.cjs.map +1 -0
- package/dist/chunk-O32X45L3.js +2 -0
- package/dist/chunk-O32X45L3.js.map +1 -0
- package/dist/chunk-S3ROE6GJ.js +2 -0
- package/dist/chunk-S3ROE6GJ.js.map +1 -0
- package/dist/chunk-SNOBW3V4.js +2 -0
- package/dist/chunk-SNOBW3V4.js.map +1 -0
- package/dist/chunk-XOLMXHFL.js +2 -0
- package/dist/chunk-XOLMXHFL.js.map +1 -0
- package/dist/chunk-Y2IWAJSY.cjs +4 -0
- package/dist/chunk-Y2IWAJSY.cjs.map +1 -0
- package/dist/chunk-Y46XWPAC.cjs +2 -0
- package/dist/chunk-Y46XWPAC.cjs.map +1 -0
- package/dist/chunk-ZIKPTR2L.cjs +2 -0
- package/dist/chunk-ZIKPTR2L.cjs.map +1 -0
- package/dist/index-Bh5S5dim.d.ts +203 -0
- package/dist/index-D6soZ1u6.d.cts +203 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms/browser.cjs +2 -0
- package/dist/platforms/browser.cjs.map +1 -0
- package/dist/platforms/browser.d.cts +10 -0
- package/dist/platforms/browser.d.ts +10 -0
- package/dist/platforms/browser.js +2 -0
- package/dist/platforms/browser.js.map +1 -0
- package/dist/plugins/dedupe.cjs +2 -0
- package/dist/plugins/dedupe.cjs.map +1 -0
- package/dist/plugins/dedupe.d.cts +39 -0
- package/dist/plugins/dedupe.d.ts +39 -0
- package/dist/plugins/dedupe.js +2 -0
- package/dist/plugins/dedupe.js.map +1 -0
- package/dist/plugins/error.cjs +2 -0
- package/dist/plugins/error.cjs.map +1 -0
- package/dist/plugins/error.d.cts +51 -0
- package/dist/plugins/error.d.ts +51 -0
- package/dist/plugins/error.js +2 -0
- package/dist/plugins/error.js.map +1 -0
- package/dist/plugins/fetch.cjs +2 -0
- package/dist/plugins/fetch.cjs.map +1 -0
- package/dist/plugins/fetch.d.cts +35 -0
- package/dist/plugins/fetch.d.ts +35 -0
- package/dist/plugins/fetch.js +2 -0
- package/dist/plugins/fetch.js.map +1 -0
- package/dist/plugins/offline-queue.cjs +2 -0
- package/dist/plugins/offline-queue.cjs.map +1 -0
- package/dist/plugins/offline-queue.d.cts +93 -0
- package/dist/plugins/offline-queue.d.ts +93 -0
- package/dist/plugins/offline-queue.js +2 -0
- package/dist/plugins/offline-queue.js.map +1 -0
- package/dist/plugins/performance.cjs +2 -0
- package/dist/plugins/performance.cjs.map +1 -0
- package/dist/plugins/performance.d.cts +31 -0
- package/dist/plugins/performance.d.ts +31 -0
- package/dist/plugins/performance.js +2 -0
- package/dist/plugins/performance.js.map +1 -0
- package/dist/plugins/replay.cjs +77 -0
- package/dist/plugins/replay.cjs.map +1 -0
- package/dist/plugins/replay.js +77 -0
- package/dist/plugins/replay.js.map +1 -0
- package/dist/plugins/sampling.cjs +2 -0
- package/dist/plugins/sampling.cjs.map +1 -0
- package/dist/plugins/sampling.d.cts +56 -0
- package/dist/plugins/sampling.d.ts +56 -0
- package/dist/plugins/sampling.js +2 -0
- package/dist/plugins/sampling.js.map +1 -0
- package/dist/plugins/session.cjs +2 -0
- package/dist/plugins/session.cjs.map +1 -0
- package/dist/plugins/session.d.cts +74 -0
- package/dist/plugins/session.d.ts +74 -0
- package/dist/plugins/session.js +2 -0
- package/dist/plugins/session.js.map +1 -0
- package/dist/plugins/trace.cjs +2 -0
- package/dist/plugins/trace.cjs.map +1 -0
- package/dist/plugins/trace.d.cts +125 -0
- package/dist/plugins/trace.d.ts +125 -0
- package/dist/plugins/trace.js +2 -0
- package/dist/plugins/trace.js.map +1 -0
- package/dist/plugins/transport.cjs +2 -0
- package/dist/plugins/transport.cjs.map +1 -0
- package/dist/plugins/transport.d.cts +231 -0
- package/dist/plugins/transport.d.ts +231 -0
- package/dist/plugins/transport.js +2 -0
- package/dist/plugins/transport.js.map +1 -0
- package/dist/plugins/xhr.cjs +2 -0
- package/dist/plugins/xhr.cjs.map +1 -0
- package/dist/plugins/xhr.d.cts +35 -0
- package/dist/plugins/xhr.d.ts +35 -0
- package/dist/plugins/xhr.js +2 -0
- package/dist/plugins/xhr.js.map +1 -0
- package/dist/presets.cjs +2 -0
- package/dist/presets.cjs.map +1 -0
- package/dist/presets.d.cts +45 -0
- package/dist/presets.d.ts +45 -0
- package/dist/presets.js +2 -0
- package/dist/presets.js.map +1 -0
- package/dist/sky-monitor-replay.umd.js +77 -0
- package/dist/sky-monitor-replay.umd.js.map +1 -0
- package/dist/sky-monitor.umd.js +4 -0
- package/dist/sky-monitor.umd.js.map +1 -0
- package/dist/types-BGUJGEpp.d.cts +90 -0
- package/dist/types-BGUJGEpp.d.ts +90 -0
- package/package.json +122 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { B as BrowserStorage, d as BrowserTransport, b as Monitor, M as MonitorConfig, R as ReplayPluginOptions, c as createMonitor, a as createMonitorWithPreset } from './index-D6soZ1u6.cjs';
|
|
2
|
+
export { D as DEFAULT_CRITICAL_TYPES, E as EventPriority, I as IMonitor, c as IStorage, d as ITransport, b as MonitorContext, a as MonitorEvent, M as MonitorOptions, P as Plugin, e as PrioritizedEvent, T as TransportMode } from './types-BGUJGEpp.cjs';
|
|
3
|
+
export { MonitorPreset, PRESETS, PluginName, PresetConfig, getPreset, mergePreset } from './presets.cjs';
|
|
4
|
+
export { ImageLoadResult, Phase, ToolResult, Trace, TraceOptions, TraceOptionsExtended, TracePlugin, TraceState } from './plugins/trace.cjs';
|
|
5
|
+
export { Session, SessionPlugin, SessionStats } from './plugins/session.cjs';
|
|
6
|
+
export { SamplingMode, SamplingPlugin, SamplingPluginOptions, TypeRates } from './plugins/sampling.cjs';
|
|
7
|
+
export { DedupePlugin, DedupePluginOptions } from './plugins/dedupe.cjs';
|
|
8
|
+
export { FetchPlugin, FetchPluginOptions } from './plugins/fetch.cjs';
|
|
9
|
+
export { XHRPlugin, XHRPluginOptions } from './plugins/xhr.cjs';
|
|
10
|
+
export { ErrorPlugin, ErrorPluginOptions } from './plugins/error.cjs';
|
|
11
|
+
export { PerformancePlugin } from './plugins/performance.cjs';
|
|
12
|
+
export { TransportPlugin, TransportPluginOptions } from './plugins/transport.cjs';
|
|
13
|
+
export { OfflineQueuePlugin, OfflineQueuePluginOptions } from './plugins/offline-queue.cjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 生成 Trace ID
|
|
17
|
+
*/
|
|
18
|
+
declare function generateTraceId(): string;
|
|
19
|
+
/**
|
|
20
|
+
* 生成 Session ID
|
|
21
|
+
*/
|
|
22
|
+
declare function generateSessionId(): string;
|
|
23
|
+
/**
|
|
24
|
+
* 生成 Event ID
|
|
25
|
+
*/
|
|
26
|
+
declare function generateEventId(): string;
|
|
27
|
+
/**
|
|
28
|
+
* 生成 Tool Call ID
|
|
29
|
+
*/
|
|
30
|
+
declare function generateToolCallId(): string;
|
|
31
|
+
|
|
32
|
+
export { generateEventId, generateSessionId, generateToolCallId, generateTraceId };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { B as BrowserStorage, d as BrowserTransport, b as Monitor, M as MonitorConfig, R as ReplayPluginOptions, c as createMonitor, a as createMonitorWithPreset } from './index-Bh5S5dim.js';
|
|
2
|
+
export { D as DEFAULT_CRITICAL_TYPES, E as EventPriority, I as IMonitor, c as IStorage, d as ITransport, b as MonitorContext, a as MonitorEvent, M as MonitorOptions, P as Plugin, e as PrioritizedEvent, T as TransportMode } from './types-BGUJGEpp.js';
|
|
3
|
+
export { MonitorPreset, PRESETS, PluginName, PresetConfig, getPreset, mergePreset } from './presets.js';
|
|
4
|
+
export { ImageLoadResult, Phase, ToolResult, Trace, TraceOptions, TraceOptionsExtended, TracePlugin, TraceState } from './plugins/trace.js';
|
|
5
|
+
export { Session, SessionPlugin, SessionStats } from './plugins/session.js';
|
|
6
|
+
export { SamplingMode, SamplingPlugin, SamplingPluginOptions, TypeRates } from './plugins/sampling.js';
|
|
7
|
+
export { DedupePlugin, DedupePluginOptions } from './plugins/dedupe.js';
|
|
8
|
+
export { FetchPlugin, FetchPluginOptions } from './plugins/fetch.js';
|
|
9
|
+
export { XHRPlugin, XHRPluginOptions } from './plugins/xhr.js';
|
|
10
|
+
export { ErrorPlugin, ErrorPluginOptions } from './plugins/error.js';
|
|
11
|
+
export { PerformancePlugin } from './plugins/performance.js';
|
|
12
|
+
export { TransportPlugin, TransportPluginOptions } from './plugins/transport.js';
|
|
13
|
+
export { OfflineQueuePlugin, OfflineQueuePluginOptions } from './plugins/offline-queue.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 生成 Trace ID
|
|
17
|
+
*/
|
|
18
|
+
declare function generateTraceId(): string;
|
|
19
|
+
/**
|
|
20
|
+
* 生成 Session ID
|
|
21
|
+
*/
|
|
22
|
+
declare function generateSessionId(): string;
|
|
23
|
+
/**
|
|
24
|
+
* 生成 Event ID
|
|
25
|
+
*/
|
|
26
|
+
declare function generateEventId(): string;
|
|
27
|
+
/**
|
|
28
|
+
* 生成 Tool Call ID
|
|
29
|
+
*/
|
|
30
|
+
declare function generateToolCallId(): string;
|
|
31
|
+
|
|
32
|
+
export { generateEventId, generateSessionId, generateToolCallId, generateTraceId };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{a as Monitor,b as createMonitor,c as createMonitorWithPreset}from'./chunk-GU7O5MWM.js';export{a as PerformancePlugin}from'./chunk-SNOBW3V4.js';export{a as BrowserTransport,d as TransportPlugin}from'./chunk-O32X45L3.js';export{a as BrowserStorage,b as OfflineQueuePlugin}from'./chunk-2EV6VMEO.js';import'./chunk-4DK7RV2K.js';export{a as PRESETS,b as getPreset,c as mergePreset}from'./chunk-GBREIA45.js';export{a as Trace,b as TracePlugin}from'./chunk-S3ROE6GJ.js';export{a as Session,b as SessionPlugin}from'./chunk-6KJXTS2V.js';export{c as generateEventId,b as generateSessionId,d as generateToolCallId,a as generateTraceId}from'./chunk-647GK2XE.js';export{a as SamplingPlugin}from'./chunk-5RS6LIZN.js';export{a as DedupePlugin}from'./chunk-XOLMXHFL.js';export{a as FetchPlugin}from'./chunk-BEGDR54W.js';export{a as XHRPlugin}from'./chunk-LKBNR7RI.js';export{a as ErrorPlugin}from'./chunk-2R7LNQYV.js';var S=["js_error","promise_error","resource_error"];export{S as DEFAULT_CRITICAL_TYPES};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts"],"names":["DEFAULT_CRITICAL_TYPES"],"mappings":"64BAsCO,IAAMA,CAAAA,CAAyB,CACpC,UAAA,CACA,eAAA,CACA,gBACF","file":"index.js","sourcesContent":["/**\n * Sky Monitor SDK 核心类型定义\n */\n\n// ============ 平台适配器接口 ============\n\n/** 存储适配器接口 */\nexport interface IStorage {\n save(event: MonitorEvent): Promise<void>\n getAll(): Promise<MonitorEvent[]>\n clear(): Promise<void>\n}\n\n/** 传输适配器接口 */\nexport interface ITransport {\n send(events: MonitorEvent[]): Promise<boolean>\n sendBeacon?(events: MonitorEvent[]): boolean\n}\n\n// ============ 传输层类型 ============\n\n/** 发送模式 */\nexport type TransportMode = 'immediate' | 'batch' | 'throttle'\n\n/** 事件优先级 */\nexport type EventPriority = 'high' | 'normal' | 'low'\n\n/** 带优先级的事件 */\nexport interface PrioritizedEvent {\n /** 原始事件 */\n event: MonitorEvent\n /** 优先级 */\n priority: EventPriority\n /** 重试次数 */\n retryCount: number\n}\n\n/** 默认高优先级事件类型 */\nexport const DEFAULT_CRITICAL_TYPES = [\n 'js_error',\n 'promise_error',\n 'resource_error',\n] as const\n\n// ============ 核心类型 ============\n\n/** SDK 配置选项 */\nexport interface MonitorOptions {\n /** 应用标识 */\n appId: string\n /** 调试模式 */\n debug?: boolean\n /** 存储适配器(可选,默认使用平台适配器) */\n storage?: IStorage\n /** 传输适配器(可选,默认使用平台适配器) */\n transport?: ITransport\n}\n\n/** 标准化监控事件 */\nexport interface MonitorEvent {\n /** 事件唯一 ID */\n id: string\n /** 事件类型 */\n type: string\n /** 时间戳 */\n timestamp: number\n /** 事件数据 */\n data: Record<string, unknown>\n /** 上下文信息 */\n context: Record<string, unknown>\n}\n\n/** 上下文类型 */\nexport type MonitorContext = Record<string, unknown>\n\n// ============ 插件系统类型 ============\n\n/** 前向声明 Monitor 类型(避免循环依赖) */\nexport interface IMonitor {\n track(type: string, data?: Record<string, unknown>): void\n setContext(ctx: MonitorContext): void\n hasPlugin(name: string): boolean\n getContext(): MonitorContext\n getOptions(): MonitorOptions\n}\n\n/**\n * 插件接口\n * 所有插件必须实现此接口\n */\nexport interface Plugin {\n /** 插件名称(唯一标识) */\n name: string\n\n /** 优先级,数字越小越先执行,默认 100 */\n priority?: number\n\n /**\n * 插件初始化,只执行一次\n * @param monitor - Monitor 实例\n */\n setupOnce?(monitor: IMonitor): void\n\n /**\n * 事件处理管道\n * @param event - 待处理事件\n * @returns 处理后的事件,返回 null 则丢弃\n */\n processEvent?(event: MonitorEvent): MonitorEvent | null\n\n /**\n * 插件销毁,清理资源\n */\n teardown?(): void\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkLFJTX6FJ_cjs=require('../chunk-LFJTX6FJ.cjs');require('../chunk-FBQC6XIY.cjs');var chunkJMHMJVBJ_cjs=require('../chunk-JMHMJVBJ.cjs'),chunkNM4RALDJ_cjs=require('../chunk-NM4RALDJ.cjs');require('../chunk-BVOILM65.cjs'),require('../chunk-ZIKPTR2L.cjs'),require('../chunk-6YTKBMJD.cjs'),require('../chunk-Y46XWPAC.cjs'),require('../chunk-ACIPNVBT.cjs'),require('../chunk-4K5NIPXS.cjs'),require('../chunk-4GL6IXHZ.cjs'),require('../chunk-LAATIQ3Y.cjs'),require('../chunk-Y2IWAJSY.cjs');Object.defineProperty(exports,"createBrowserMonitor",{enumerable:true,get:function(){return chunkLFJTX6FJ_cjs.b}});Object.defineProperty(exports,"createMonitorWithPreset",{enumerable:true,get:function(){return chunkLFJTX6FJ_cjs.c}});Object.defineProperty(exports,"BrowserTransport",{enumerable:true,get:function(){return chunkJMHMJVBJ_cjs.a}});Object.defineProperty(exports,"BrowserStorage",{enumerable:true,get:function(){return chunkNM4RALDJ_cjs.a}});//# sourceMappingURL=browser.cjs.map
|
|
2
|
+
//# sourceMappingURL=browser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"browser.cjs"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { B as BrowserStorage, d as BrowserTransport, M as MonitorConfig, c as createBrowserMonitor, a as createMonitorWithPreset } from '../index-D6soZ1u6.cjs';
|
|
2
|
+
import '../types-BGUJGEpp.cjs';
|
|
3
|
+
import '../presets.cjs';
|
|
4
|
+
import '../plugins/transport.cjs';
|
|
5
|
+
import '../plugins/offline-queue.cjs';
|
|
6
|
+
import '../plugins/error.cjs';
|
|
7
|
+
import '../plugins/fetch.cjs';
|
|
8
|
+
import '../plugins/xhr.cjs';
|
|
9
|
+
import '../plugins/dedupe.cjs';
|
|
10
|
+
import '../plugins/sampling.cjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { B as BrowserStorage, d as BrowserTransport, M as MonitorConfig, c as createBrowserMonitor, a as createMonitorWithPreset } from '../index-Bh5S5dim.js';
|
|
2
|
+
import '../types-BGUJGEpp.js';
|
|
3
|
+
import '../presets.js';
|
|
4
|
+
import '../plugins/transport.js';
|
|
5
|
+
import '../plugins/offline-queue.js';
|
|
6
|
+
import '../plugins/error.js';
|
|
7
|
+
import '../plugins/fetch.js';
|
|
8
|
+
import '../plugins/xhr.js';
|
|
9
|
+
import '../plugins/dedupe.js';
|
|
10
|
+
import '../plugins/sampling.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{b as createBrowserMonitor,c as createMonitorWithPreset}from'../chunk-GU7O5MWM.js';import'../chunk-SNOBW3V4.js';export{a as BrowserTransport}from'../chunk-O32X45L3.js';export{a as BrowserStorage}from'../chunk-2EV6VMEO.js';import'../chunk-4DK7RV2K.js';import'../chunk-GBREIA45.js';import'../chunk-6KJXTS2V.js';import'../chunk-647GK2XE.js';import'../chunk-5RS6LIZN.js';import'../chunk-XOLMXHFL.js';import'../chunk-BEGDR54W.js';import'../chunk-LKBNR7RI.js';import'../chunk-2R7LNQYV.js';//# sourceMappingURL=browser.js.map
|
|
2
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"browser.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"dedupe.cjs"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { P as Plugin, a as MonitorEvent } from '../types-BGUJGEpp.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dedupe 插件 - 事件去重
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface DedupePluginOptions {
|
|
8
|
+
/** 去重窗口(毫秒),默认 5000 */
|
|
9
|
+
windowMs?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 去重插件
|
|
13
|
+
* 基于事件指纹在时间窗口内去重
|
|
14
|
+
*/
|
|
15
|
+
declare class DedupePlugin implements Plugin {
|
|
16
|
+
name: string;
|
|
17
|
+
priority: number;
|
|
18
|
+
private _windowMs;
|
|
19
|
+
private _seen;
|
|
20
|
+
constructor(options?: DedupePluginOptions);
|
|
21
|
+
/**
|
|
22
|
+
* 事件处理:按指纹去重
|
|
23
|
+
*/
|
|
24
|
+
processEvent(event: MonitorEvent): MonitorEvent | null;
|
|
25
|
+
/**
|
|
26
|
+
* 生成事件指纹
|
|
27
|
+
*/
|
|
28
|
+
private _getFingerprint;
|
|
29
|
+
/**
|
|
30
|
+
* 简单 hash 函数
|
|
31
|
+
*/
|
|
32
|
+
private _hash;
|
|
33
|
+
/**
|
|
34
|
+
* 清理过期指纹
|
|
35
|
+
*/
|
|
36
|
+
private _cleanup;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { DedupePlugin, type DedupePluginOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { P as Plugin, a as MonitorEvent } from '../types-BGUJGEpp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dedupe 插件 - 事件去重
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface DedupePluginOptions {
|
|
8
|
+
/** 去重窗口(毫秒),默认 5000 */
|
|
9
|
+
windowMs?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 去重插件
|
|
13
|
+
* 基于事件指纹在时间窗口内去重
|
|
14
|
+
*/
|
|
15
|
+
declare class DedupePlugin implements Plugin {
|
|
16
|
+
name: string;
|
|
17
|
+
priority: number;
|
|
18
|
+
private _windowMs;
|
|
19
|
+
private _seen;
|
|
20
|
+
constructor(options?: DedupePluginOptions);
|
|
21
|
+
/**
|
|
22
|
+
* 事件处理:按指纹去重
|
|
23
|
+
*/
|
|
24
|
+
processEvent(event: MonitorEvent): MonitorEvent | null;
|
|
25
|
+
/**
|
|
26
|
+
* 生成事件指纹
|
|
27
|
+
*/
|
|
28
|
+
private _getFingerprint;
|
|
29
|
+
/**
|
|
30
|
+
* 简单 hash 函数
|
|
31
|
+
*/
|
|
32
|
+
private _hash;
|
|
33
|
+
/**
|
|
34
|
+
* 清理过期指纹
|
|
35
|
+
*/
|
|
36
|
+
private _cleanup;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { DedupePlugin, type DedupePluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"dedupe.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"error.cjs"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { P as Plugin, I as IMonitor } from '../types-BGUJGEpp.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error 插件 - JS 异常捕获
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface ErrorPluginOptions {
|
|
8
|
+
/** 是否劫持 console.error,默认 false */
|
|
9
|
+
captureConsoleError?: boolean;
|
|
10
|
+
/** 去重窗口(毫秒),默认 5000 */
|
|
11
|
+
dedupeWindow?: number;
|
|
12
|
+
/** 忽略的错误消息正则 */
|
|
13
|
+
ignoreErrors?: RegExp[];
|
|
14
|
+
/** 忽略的脚本 URL 正则 */
|
|
15
|
+
ignoreUrls?: RegExp[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error 插件
|
|
19
|
+
* 捕获 JS 运行时错误、Promise 错误、资源加载失败
|
|
20
|
+
*/
|
|
21
|
+
declare class ErrorPlugin implements Plugin {
|
|
22
|
+
name: string;
|
|
23
|
+
priority: number;
|
|
24
|
+
private _monitor;
|
|
25
|
+
private _options;
|
|
26
|
+
private _seen;
|
|
27
|
+
private _platformAdapter;
|
|
28
|
+
constructor(options?: ErrorPluginOptions);
|
|
29
|
+
/**
|
|
30
|
+
* 插件初始化
|
|
31
|
+
*/
|
|
32
|
+
setupOnce(monitor: IMonitor): void;
|
|
33
|
+
/**
|
|
34
|
+
* 插件销毁
|
|
35
|
+
*/
|
|
36
|
+
teardown(): void;
|
|
37
|
+
private _handleJSError;
|
|
38
|
+
private _handlePromiseError;
|
|
39
|
+
private _handleResourceError;
|
|
40
|
+
private _handleConsoleError;
|
|
41
|
+
private _isCrossOriginError;
|
|
42
|
+
private _parseStack;
|
|
43
|
+
private _shouldIgnore;
|
|
44
|
+
private _getFingerprint;
|
|
45
|
+
private _hash;
|
|
46
|
+
private _isDuplicate;
|
|
47
|
+
private _cleanup;
|
|
48
|
+
private _getResourceType;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { ErrorPlugin, type ErrorPluginOptions };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { P as Plugin, I as IMonitor } from '../types-BGUJGEpp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error 插件 - JS 异常捕获
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface ErrorPluginOptions {
|
|
8
|
+
/** 是否劫持 console.error,默认 false */
|
|
9
|
+
captureConsoleError?: boolean;
|
|
10
|
+
/** 去重窗口(毫秒),默认 5000 */
|
|
11
|
+
dedupeWindow?: number;
|
|
12
|
+
/** 忽略的错误消息正则 */
|
|
13
|
+
ignoreErrors?: RegExp[];
|
|
14
|
+
/** 忽略的脚本 URL 正则 */
|
|
15
|
+
ignoreUrls?: RegExp[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error 插件
|
|
19
|
+
* 捕获 JS 运行时错误、Promise 错误、资源加载失败
|
|
20
|
+
*/
|
|
21
|
+
declare class ErrorPlugin implements Plugin {
|
|
22
|
+
name: string;
|
|
23
|
+
priority: number;
|
|
24
|
+
private _monitor;
|
|
25
|
+
private _options;
|
|
26
|
+
private _seen;
|
|
27
|
+
private _platformAdapter;
|
|
28
|
+
constructor(options?: ErrorPluginOptions);
|
|
29
|
+
/**
|
|
30
|
+
* 插件初始化
|
|
31
|
+
*/
|
|
32
|
+
setupOnce(monitor: IMonitor): void;
|
|
33
|
+
/**
|
|
34
|
+
* 插件销毁
|
|
35
|
+
*/
|
|
36
|
+
teardown(): void;
|
|
37
|
+
private _handleJSError;
|
|
38
|
+
private _handlePromiseError;
|
|
39
|
+
private _handleResourceError;
|
|
40
|
+
private _handleConsoleError;
|
|
41
|
+
private _isCrossOriginError;
|
|
42
|
+
private _parseStack;
|
|
43
|
+
private _shouldIgnore;
|
|
44
|
+
private _getFingerprint;
|
|
45
|
+
private _hash;
|
|
46
|
+
private _isDuplicate;
|
|
47
|
+
private _cleanup;
|
|
48
|
+
private _getResourceType;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { ErrorPlugin, type ErrorPluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"error.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"fetch.cjs"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { P as Plugin, I as IMonitor } from '../types-BGUJGEpp.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetch 插件 - 拦截 fetch 请求
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface FetchPluginOptions {
|
|
8
|
+
/** 包含的 URL 正则(白名单) */
|
|
9
|
+
includeUrls?: RegExp[];
|
|
10
|
+
/** 排除的 URL 正则(黑名单) */
|
|
11
|
+
excludeUrls?: RegExp[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetch 插件
|
|
15
|
+
* 包装模式拦截 fetch,保留原始引用
|
|
16
|
+
*/
|
|
17
|
+
declare class FetchPlugin implements Plugin {
|
|
18
|
+
name: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
private _monitor;
|
|
21
|
+
private _options;
|
|
22
|
+
private _platformAdapter;
|
|
23
|
+
constructor(options?: FetchPluginOptions);
|
|
24
|
+
/**
|
|
25
|
+
* 插件初始化
|
|
26
|
+
*/
|
|
27
|
+
setupOnce(monitor: IMonitor): void;
|
|
28
|
+
/**
|
|
29
|
+
* 插件销毁
|
|
30
|
+
*/
|
|
31
|
+
teardown(): void;
|
|
32
|
+
private _shouldIgnore;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { FetchPlugin, type FetchPluginOptions };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { P as Plugin, I as IMonitor } from '../types-BGUJGEpp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetch 插件 - 拦截 fetch 请求
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface FetchPluginOptions {
|
|
8
|
+
/** 包含的 URL 正则(白名单) */
|
|
9
|
+
includeUrls?: RegExp[];
|
|
10
|
+
/** 排除的 URL 正则(黑名单) */
|
|
11
|
+
excludeUrls?: RegExp[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetch 插件
|
|
15
|
+
* 包装模式拦截 fetch,保留原始引用
|
|
16
|
+
*/
|
|
17
|
+
declare class FetchPlugin implements Plugin {
|
|
18
|
+
name: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
private _monitor;
|
|
21
|
+
private _options;
|
|
22
|
+
private _platformAdapter;
|
|
23
|
+
constructor(options?: FetchPluginOptions);
|
|
24
|
+
/**
|
|
25
|
+
* 插件初始化
|
|
26
|
+
*/
|
|
27
|
+
setupOnce(monitor: IMonitor): void;
|
|
28
|
+
/**
|
|
29
|
+
* 插件销毁
|
|
30
|
+
*/
|
|
31
|
+
teardown(): void;
|
|
32
|
+
private _shouldIgnore;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { FetchPlugin, type FetchPluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"fetch.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkNM4RALDJ_cjs=require('../chunk-NM4RALDJ.cjs');require('../chunk-BVOILM65.cjs');Object.defineProperty(exports,"OfflineQueuePlugin",{enumerable:true,get:function(){return chunkNM4RALDJ_cjs.b}});//# sourceMappingURL=offline-queue.cjs.map
|
|
2
|
+
//# sourceMappingURL=offline-queue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"offline-queue.cjs"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { a as MonitorEvent, c as IStorage, P as Plugin, I as IMonitor } from '../types-BGUJGEpp.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Coordinator - 插件协调器
|
|
5
|
+
*
|
|
6
|
+
* 解决插件之间的双向依赖问题:
|
|
7
|
+
* - TransportPlugin 和 OfflineQueuePlugin 的协调
|
|
8
|
+
* - 统一管理插件间的通信
|
|
9
|
+
*
|
|
10
|
+
* 设计原则:
|
|
11
|
+
* - 插件不直接相互引用
|
|
12
|
+
* - 通过协调器进行通信
|
|
13
|
+
* - 单向依赖:Plugin → Coordinator
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 离线队列接口
|
|
18
|
+
*/
|
|
19
|
+
interface IOfflineQueue {
|
|
20
|
+
/** 保存事件到离线队列 */
|
|
21
|
+
saveEvents(events: MonitorEvent[]): Promise<void>;
|
|
22
|
+
/** 手动触发重传 */
|
|
23
|
+
flush(): Promise<boolean>;
|
|
24
|
+
/** 获取离线事件数量 */
|
|
25
|
+
getCount(): Promise<number>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* OfflineQueue 插件 - 离线队列
|
|
30
|
+
*
|
|
31
|
+
* 修复版本:
|
|
32
|
+
* - 正确的重传逻辑
|
|
33
|
+
* - 通过协调器与 TransportPlugin 通信
|
|
34
|
+
* - 发送成功后才清理
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
interface OfflineQueuePluginOptions {
|
|
38
|
+
/** 存储适配器(可选,默认使用 BrowserStorage) */
|
|
39
|
+
storage?: IStorage;
|
|
40
|
+
/** 最大重试次数,默认 3 */
|
|
41
|
+
maxRetries?: number;
|
|
42
|
+
/** 重试间隔(毫秒),默认 10000 */
|
|
43
|
+
retryInterval?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* OfflineQueue 插件
|
|
47
|
+
* IndexedDB 离线队列,网络恢复后自动重传
|
|
48
|
+
*/
|
|
49
|
+
declare class OfflineQueuePlugin implements Plugin, IOfflineQueue {
|
|
50
|
+
name: string;
|
|
51
|
+
priority: number;
|
|
52
|
+
private _storage;
|
|
53
|
+
private _maxRetries;
|
|
54
|
+
private _retryInterval;
|
|
55
|
+
private _retryCount;
|
|
56
|
+
private _isSending;
|
|
57
|
+
private _platformAdapter;
|
|
58
|
+
constructor(options?: OfflineQueuePluginOptions);
|
|
59
|
+
/**
|
|
60
|
+
* 插件初始化
|
|
61
|
+
*/
|
|
62
|
+
setupOnce(_monitor: IMonitor): void;
|
|
63
|
+
/**
|
|
64
|
+
* 事件处理:存入离线队列
|
|
65
|
+
*/
|
|
66
|
+
processEvent(event: MonitorEvent): MonitorEvent;
|
|
67
|
+
/**
|
|
68
|
+
* 批量保存事件到离线队列
|
|
69
|
+
*/
|
|
70
|
+
saveEvents(events: MonitorEvent[]): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* 插件销毁
|
|
73
|
+
*/
|
|
74
|
+
teardown(): void;
|
|
75
|
+
/**
|
|
76
|
+
* 网络恢复时重置重试计数并立即重传
|
|
77
|
+
*/
|
|
78
|
+
private _onOnline;
|
|
79
|
+
/**
|
|
80
|
+
* 重传离线事件(通过协调器发送)
|
|
81
|
+
*/
|
|
82
|
+
private _retry;
|
|
83
|
+
/**
|
|
84
|
+
* 手动触发重传
|
|
85
|
+
*/
|
|
86
|
+
flush(): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* 获取离线事件数量
|
|
89
|
+
*/
|
|
90
|
+
getCount(): Promise<number>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { OfflineQueuePlugin, type OfflineQueuePluginOptions };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { a as MonitorEvent, c as IStorage, P as Plugin, I as IMonitor } from '../types-BGUJGEpp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Coordinator - 插件协调器
|
|
5
|
+
*
|
|
6
|
+
* 解决插件之间的双向依赖问题:
|
|
7
|
+
* - TransportPlugin 和 OfflineQueuePlugin 的协调
|
|
8
|
+
* - 统一管理插件间的通信
|
|
9
|
+
*
|
|
10
|
+
* 设计原则:
|
|
11
|
+
* - 插件不直接相互引用
|
|
12
|
+
* - 通过协调器进行通信
|
|
13
|
+
* - 单向依赖:Plugin → Coordinator
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 离线队列接口
|
|
18
|
+
*/
|
|
19
|
+
interface IOfflineQueue {
|
|
20
|
+
/** 保存事件到离线队列 */
|
|
21
|
+
saveEvents(events: MonitorEvent[]): Promise<void>;
|
|
22
|
+
/** 手动触发重传 */
|
|
23
|
+
flush(): Promise<boolean>;
|
|
24
|
+
/** 获取离线事件数量 */
|
|
25
|
+
getCount(): Promise<number>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* OfflineQueue 插件 - 离线队列
|
|
30
|
+
*
|
|
31
|
+
* 修复版本:
|
|
32
|
+
* - 正确的重传逻辑
|
|
33
|
+
* - 通过协调器与 TransportPlugin 通信
|
|
34
|
+
* - 发送成功后才清理
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
interface OfflineQueuePluginOptions {
|
|
38
|
+
/** 存储适配器(可选,默认使用 BrowserStorage) */
|
|
39
|
+
storage?: IStorage;
|
|
40
|
+
/** 最大重试次数,默认 3 */
|
|
41
|
+
maxRetries?: number;
|
|
42
|
+
/** 重试间隔(毫秒),默认 10000 */
|
|
43
|
+
retryInterval?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* OfflineQueue 插件
|
|
47
|
+
* IndexedDB 离线队列,网络恢复后自动重传
|
|
48
|
+
*/
|
|
49
|
+
declare class OfflineQueuePlugin implements Plugin, IOfflineQueue {
|
|
50
|
+
name: string;
|
|
51
|
+
priority: number;
|
|
52
|
+
private _storage;
|
|
53
|
+
private _maxRetries;
|
|
54
|
+
private _retryInterval;
|
|
55
|
+
private _retryCount;
|
|
56
|
+
private _isSending;
|
|
57
|
+
private _platformAdapter;
|
|
58
|
+
constructor(options?: OfflineQueuePluginOptions);
|
|
59
|
+
/**
|
|
60
|
+
* 插件初始化
|
|
61
|
+
*/
|
|
62
|
+
setupOnce(_monitor: IMonitor): void;
|
|
63
|
+
/**
|
|
64
|
+
* 事件处理:存入离线队列
|
|
65
|
+
*/
|
|
66
|
+
processEvent(event: MonitorEvent): MonitorEvent;
|
|
67
|
+
/**
|
|
68
|
+
* 批量保存事件到离线队列
|
|
69
|
+
*/
|
|
70
|
+
saveEvents(events: MonitorEvent[]): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* 插件销毁
|
|
73
|
+
*/
|
|
74
|
+
teardown(): void;
|
|
75
|
+
/**
|
|
76
|
+
* 网络恢复时重置重试计数并立即重传
|
|
77
|
+
*/
|
|
78
|
+
private _onOnline;
|
|
79
|
+
/**
|
|
80
|
+
* 重传离线事件(通过协调器发送)
|
|
81
|
+
*/
|
|
82
|
+
private _retry;
|
|
83
|
+
/**
|
|
84
|
+
* 手动触发重传
|
|
85
|
+
*/
|
|
86
|
+
flush(): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* 获取离线事件数量
|
|
89
|
+
*/
|
|
90
|
+
getCount(): Promise<number>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { OfflineQueuePlugin, type OfflineQueuePluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"offline-queue.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"performance.cjs"}
|