@yysports/tools 2.2.7 → 3.0.2
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 +1 -6
- package/dist/Track/Beacon.d.ts +22 -3
- package/dist/Track/Beacon.js +93 -33
- package/dist/Track/Config.d.ts +4 -0
- package/dist/Track/Config.js +5 -1
- package/dist/Track/Listener.js +8 -4
- package/dist/Track/Log.d.ts +12 -2
- package/dist/Track/Log.js +71 -48
- package/dist/Track/Replay.d.ts +19 -2
- package/dist/Track/Replay.js +97 -48
- package/dist/Track/System.d.ts +3 -1
- package/dist/Track/System.js +8 -2
- package/dist/Track/envelope.d.ts +7 -0
- package/dist/Track/envelope.js +40 -0
- package/dist/Track/index.js +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/interfaces/protocol.d.ts +94 -0
- package/dist/interfaces/protocol.js +65 -0
- package/dist/interfaces/track.interface.d.ts +3 -8
- package/dist/interfaces/track.interface.js +3 -8
- package/lib/Track/Beacon.d.ts +22 -3
- package/lib/Track/Beacon.js +70 -28
- package/lib/Track/Config.d.ts +4 -0
- package/lib/Track/Config.js +5 -1
- package/lib/Track/Listener.js +7 -3
- package/lib/Track/Log.d.ts +12 -2
- package/lib/Track/Log.js +46 -35
- package/lib/Track/Replay.d.ts +19 -2
- package/lib/Track/Replay.js +53 -26
- package/lib/Track/System.d.ts +3 -1
- package/lib/Track/System.js +6 -2
- package/lib/Track/envelope.d.ts +7 -0
- package/lib/Track/envelope.js +76 -0
- package/lib/Track/index.js +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/interfaces/protocol.d.ts +94 -0
- package/lib/interfaces/protocol.js +66 -0
- package/lib/interfaces/track.interface.d.ts +3 -8
- package/lib/interfaces/track.interface.js +5 -9
- package/package.json +18 -18
- package/LICENSE +0 -21
package/lib/Track/Replay.js
CHANGED
|
@@ -32,51 +32,78 @@ __export(Replay_exports, {
|
|
|
32
32
|
default: () => Replay
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Replay_exports);
|
|
35
|
-
var import_record = require("@rrweb/record");
|
|
36
|
-
var import_rrweb_plugin_console_record = require("@rrweb/rrweb-plugin-console-record");
|
|
37
35
|
var import_Config = __toESM(require("./Config"));
|
|
38
36
|
var Replay = class {
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
/**
|
|
38
|
+
* 启动录制。
|
|
39
|
+
*
|
|
40
|
+
* rrweb(record 与 console 插件)改为动态 import:`enableReplay: false` 时完全不加载,
|
|
41
|
+
* 接入方的打包产物里也就不含 rrweb;开启回放时 rrweb 由接入方打包器拆成独立异步 chunk。
|
|
42
|
+
* 代价是启动异步化——加载完成前发生的错误不带回放(`snapshot()` 返回空数组,
|
|
43
|
+
* 错误本体的上报不受影响)。
|
|
44
|
+
*/
|
|
45
|
+
static async run() {
|
|
46
|
+
if (this._stop || this._loading || !import_Config.default.data.enableReplay) {
|
|
41
47
|
return;
|
|
42
48
|
}
|
|
49
|
+
this._loading = true;
|
|
43
50
|
try {
|
|
44
|
-
|
|
51
|
+
const [{ record: startRecord }, { getRecordConsolePlugin }] = await Promise.all([
|
|
52
|
+
import("@rrweb/record"),
|
|
53
|
+
import("@rrweb/rrweb-plugin-console-record")
|
|
54
|
+
]);
|
|
55
|
+
this._stop = startRecord({
|
|
45
56
|
emit: (e) => {
|
|
46
57
|
this._events.push(e);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this._events.splice(0, over);
|
|
58
|
+
this._bytes += JSON.stringify(e).length;
|
|
59
|
+
this.truncate();
|
|
50
60
|
},
|
|
61
|
+
// 输入掩码:password 类型强制掩码,防止敏感输入进入回放文件;
|
|
62
|
+
// 其余类型可由接入方通过 replayMaskTextClass 扩展
|
|
63
|
+
maskInputOptions: { password: true },
|
|
64
|
+
...import_Config.default.data.replayMaskTextClass ? { maskTextClass: import_Config.default.data.replayMaskTextClass } : {},
|
|
51
65
|
plugins: [
|
|
52
|
-
|
|
66
|
+
getRecordConsolePlugin({
|
|
53
67
|
level: ["log", "info", "warn", "error", "debug"]
|
|
54
68
|
})
|
|
55
69
|
]
|
|
56
70
|
});
|
|
57
71
|
} catch (err) {
|
|
58
72
|
this._stop = void 0;
|
|
73
|
+
} finally {
|
|
74
|
+
this._loading = false;
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
static
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
/** 截断到体积上限,保留最近片段 */
|
|
78
|
+
static truncate() {
|
|
79
|
+
const maxBytes = import_Config.default.data.replayMaxBytes ?? 1024 * 1024;
|
|
80
|
+
while (this._bytes > maxBytes && this._events.length > 1) {
|
|
81
|
+
const removed = this._events.shift();
|
|
82
|
+
this._bytes -= removed ? JSON.stringify(removed).length : 0;
|
|
66
83
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
}
|
|
85
|
+
/** 快照当前回放片段(不移除,待上报成功后 commitSnapshot) */
|
|
86
|
+
static snapshot() {
|
|
87
|
+
return this._stop ? [...this._events] : [];
|
|
88
|
+
}
|
|
89
|
+
/** 上报成功后移除已携带的事件,继续录制——不调用 stop,避免下一个错误重复携带上一段 */
|
|
90
|
+
static commitSnapshot(snapshot) {
|
|
91
|
+
if (!snapshot.length)
|
|
92
|
+
return;
|
|
93
|
+
const sent = new Set(snapshot);
|
|
94
|
+
this._events = this._events.filter((e) => {
|
|
95
|
+
if (sent.has(e)) {
|
|
96
|
+
this._bytes -= JSON.stringify(e).length;
|
|
97
|
+
return false;
|
|
75
98
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.
|
|
79
|
-
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
if (this._bytes < 0)
|
|
102
|
+
this._bytes = 0;
|
|
80
103
|
}
|
|
81
104
|
};
|
|
82
105
|
Replay._events = [];
|
|
106
|
+
// rrweb 异步加载中的标记:避免 init 被重复调用时启动两个录制实例
|
|
107
|
+
Replay._loading = false;
|
|
108
|
+
// 录制阶段的累计体积(近似值),达到 replayMaxBytes 后从最早事件开始截断
|
|
109
|
+
Replay._bytes = 0;
|
package/lib/Track/System.d.ts
CHANGED
package/lib/Track/System.js
CHANGED
|
@@ -24,9 +24,13 @@ __export(System_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(System_exports);
|
|
25
25
|
var import_Utils = require("../Utils");
|
|
26
26
|
var System = class {
|
|
27
|
+
/** 会话串,作为信封必填的 imei 上报(生成逻辑不变) */
|
|
28
|
+
static get imei() {
|
|
29
|
+
return this._imei;
|
|
30
|
+
}
|
|
27
31
|
static get profile() {
|
|
28
32
|
return {
|
|
29
|
-
|
|
33
|
+
imei: this._imei,
|
|
30
34
|
innerHeight: typeof window !== "undefined" ? window.innerHeight : 0,
|
|
31
35
|
innerWidth: typeof window !== "undefined" ? window.innerWidth : 0,
|
|
32
36
|
href: typeof location !== "undefined" ? location.href : "",
|
|
@@ -34,4 +38,4 @@ var System = class {
|
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
|
-
System.
|
|
41
|
+
System._imei = (0, import_Utils.generateRandomString)(6);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TrackV3Envelope, TrackV3Event } from '../interfaces/protocol';
|
|
2
|
+
/** 请求级公共段(信封):字段与实体属性同名(camelCase),每次请求仅一份 */
|
|
3
|
+
export declare function buildEnvelopeBase(): TrackV3Envelope;
|
|
4
|
+
/** 条级事件公共字段:href / 视口 / 毫秒时间戳在批量窗口内会变,逐条携带 */
|
|
5
|
+
export declare function buildEventBase(): Pick<TrackV3Event, 'systemTime' | 'href' | 'innerWidth' | 'innerHeight'>;
|
|
6
|
+
/** V3 上报地址:鉴权参数位统一走 URL query(sendBeacon 无法自定义 header) */
|
|
7
|
+
export declare function trackUrl(path: '/batch' | '/error'): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/Track/envelope.ts
|
|
30
|
+
var envelope_exports = {};
|
|
31
|
+
__export(envelope_exports, {
|
|
32
|
+
buildEnvelopeBase: () => buildEnvelopeBase,
|
|
33
|
+
buildEventBase: () => buildEventBase,
|
|
34
|
+
trackUrl: () => trackUrl
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(envelope_exports);
|
|
37
|
+
var import_package = __toESM(require("../../package.json"));
|
|
38
|
+
var import_Config = __toESM(require("./Config"));
|
|
39
|
+
var import_System = __toESM(require("./System"));
|
|
40
|
+
var import_User = __toESM(require("./User"));
|
|
41
|
+
function buildEnvelopeBase() {
|
|
42
|
+
const profile = import_User.default.profile;
|
|
43
|
+
return {
|
|
44
|
+
appId: import_Config.default.data.appId,
|
|
45
|
+
sdkVersion: import_package.default.version,
|
|
46
|
+
imei: import_System.default.imei,
|
|
47
|
+
...profile ? {
|
|
48
|
+
user: {
|
|
49
|
+
userId: profile.userId,
|
|
50
|
+
userName: profile.userName,
|
|
51
|
+
orgCode: profile.orgCode,
|
|
52
|
+
orgTitle: profile.orgTitle,
|
|
53
|
+
dataScopeZonePermissions: profile.dataScopeZonePermissions,
|
|
54
|
+
dataScopeRoles: profile.dataScopeRoles
|
|
55
|
+
}
|
|
56
|
+
} : {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function buildEventBase() {
|
|
60
|
+
return {
|
|
61
|
+
systemTime: Date.now(),
|
|
62
|
+
href: typeof location !== "undefined" ? location.href : "",
|
|
63
|
+
innerWidth: typeof window !== "undefined" ? window.innerWidth : 0,
|
|
64
|
+
innerHeight: typeof window !== "undefined" ? window.innerHeight : 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function trackUrl(path) {
|
|
68
|
+
const appId = encodeURIComponent(import_Config.default.data.appId);
|
|
69
|
+
return `${import_Config.default.data.domain}/pousheng-guard/api/track/v3${path}?appId=${appId}`;
|
|
70
|
+
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
buildEnvelopeBase,
|
|
74
|
+
buildEventBase,
|
|
75
|
+
trackUrl
|
|
76
|
+
});
|
package/lib/Track/index.js
CHANGED
|
@@ -59,8 +59,8 @@ var Track = class {
|
|
|
59
59
|
// 需要初始化执行的组件都需在这里初始化调用
|
|
60
60
|
static run() {
|
|
61
61
|
import_Listener.default.run();
|
|
62
|
-
import_Replay.default.run();
|
|
63
|
-
import_Beacon.default.
|
|
62
|
+
void import_Replay.default.run();
|
|
63
|
+
import_Beacon.default.start();
|
|
64
64
|
}
|
|
65
65
|
// 获取当前页面模块名称
|
|
66
66
|
static get module() {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -37,9 +37,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
37
37
|
var import_Track = __toESM(require("./Track"));
|
|
38
38
|
var Utils = __toESM(require("./Utils"));
|
|
39
39
|
__reExport(src_exports, require("./interfaces/track.interface"), module.exports);
|
|
40
|
+
__reExport(src_exports, require("./interfaces/protocol"), module.exports);
|
|
40
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
42
|
0 && (module.exports = {
|
|
42
43
|
Track,
|
|
43
44
|
Utils,
|
|
44
|
-
...require("./interfaces/track.interface")
|
|
45
|
+
...require("./interfaces/track.interface"),
|
|
46
|
+
...require("./interfaces/protocol")
|
|
45
47
|
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 探针上报协议(V3)的唯一真源:类型与限额常量,供 SDK / 服务端 / 管理端共同复用。
|
|
3
|
+
*
|
|
4
|
+
* 约束:本文件只放无运行时依赖的类型与常量,不得引入 class-validator / typeorm / nest
|
|
5
|
+
* 等框架依赖;服务端的校验装饰器与 ORM 实体各自保留,不在此定义。
|
|
6
|
+
* 协议字段统一 camelCase,与 guard_track 的实体属性同名;库列的 snake_case
|
|
7
|
+
* (如 appId → app_id)由服务端 ORM 命名策略负责,协议层不感知列名。
|
|
8
|
+
*/
|
|
9
|
+
/** 上报类型取值(与服务端 guard_track.type 枚举一致) */
|
|
10
|
+
export type TrackType = 'error' | 'visit' | 'event' | 'api';
|
|
11
|
+
/** 类型取值列表(服务端校验 / 管理端筛选用) */
|
|
12
|
+
export declare const TRACK_TYPE_VALUES: readonly TrackType[];
|
|
13
|
+
/** 类型展示标签(管理端表格、下拉用) */
|
|
14
|
+
export declare const TrackTypeLabel: Record<TrackType, string>;
|
|
15
|
+
/**
|
|
16
|
+
* 协议限额:服务端 DTO 校验与两侧截断共用同一份定义。
|
|
17
|
+
* 除 maxItems(协议约定)外,其余取值均对齐 guard_track 的列长,
|
|
18
|
+
* 不做无依据的额外限制——超长字段本身即会写入失败。
|
|
19
|
+
*/
|
|
20
|
+
export declare const TRACK_LIMITS: {
|
|
21
|
+
/** 单次批量 events[] 条数上限(SDK batchSize 与服务端 DTO 共用) */
|
|
22
|
+
readonly maxItems: 20;
|
|
23
|
+
/** 探针版本号,guard_conf.version varchar(20) */
|
|
24
|
+
readonly sdkVersion: 20;
|
|
25
|
+
/** 会话串,列默认 varchar(255) */
|
|
26
|
+
readonly imei: 255;
|
|
27
|
+
/** 页面 URL,varchar(1000) */
|
|
28
|
+
readonly href: 1000;
|
|
29
|
+
/** 内容类字段(content / module / user.*),列默认 varchar(255) */
|
|
30
|
+
readonly content: 255;
|
|
31
|
+
readonly module: 255;
|
|
32
|
+
/** 用户画像单个字段长度 */
|
|
33
|
+
readonly userField: 255;
|
|
34
|
+
/** 用户 UA,varchar(1000) */
|
|
35
|
+
readonly userAgent: 1000;
|
|
36
|
+
/** V3 通道整体 body 上限(含内嵌回放),main.ts 直接引用 */
|
|
37
|
+
readonly bodyBytes: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* 上报请求体 Content-Type:固定 text/plain(body 仍是 JSON 文本)。
|
|
41
|
+
* text/plain 属 CORS safelist,跨域不触发预检——sendBeacon / fetch 在页面卸载时
|
|
42
|
+
* 无需等待 OPTIONS 完成,避免「预检未及时返回」导致的丢数;服务端据此收原始文本再解析 JSON。
|
|
43
|
+
*/
|
|
44
|
+
export declare const TRACK_CONTENT_TYPE = "text/plain;charset=UTF-8";
|
|
45
|
+
/** 用户画像(请求级恒定);未登录时整段缺省 */
|
|
46
|
+
export interface TrackV3User {
|
|
47
|
+
userId?: string;
|
|
48
|
+
userName?: string;
|
|
49
|
+
orgCode?: string;
|
|
50
|
+
orgTitle?: string;
|
|
51
|
+
dataScopeZonePermissions?: string;
|
|
52
|
+
dataScopeRoles?: string;
|
|
53
|
+
}
|
|
54
|
+
/** 条级事件:href / 视口在一个批量窗口内会变,逐条携带 */
|
|
55
|
+
export interface TrackV3Event {
|
|
56
|
+
/** 毫秒时间戳 */
|
|
57
|
+
systemTime: number;
|
|
58
|
+
type: Exclude<TrackType, 'error'>;
|
|
59
|
+
href: string;
|
|
60
|
+
innerWidth: number;
|
|
61
|
+
innerHeight: number;
|
|
62
|
+
module?: string;
|
|
63
|
+
/** visit / event 使用 */
|
|
64
|
+
content?: string;
|
|
65
|
+
/** api 使用 */
|
|
66
|
+
log?: string;
|
|
67
|
+
}
|
|
68
|
+
/** 请求级公共段(信封):一个请求只带一份 */
|
|
69
|
+
export interface TrackV3Envelope {
|
|
70
|
+
appId: string;
|
|
71
|
+
sdkVersion: string;
|
|
72
|
+
/** 会话串,前端初始化时生成;与库列名 `imei` 一致 */
|
|
73
|
+
imei: string;
|
|
74
|
+
user?: TrackV3User;
|
|
75
|
+
}
|
|
76
|
+
/** 通道 1:批量日志 */
|
|
77
|
+
export interface TrackV3BatchPayload extends TrackV3Envelope {
|
|
78
|
+
events: TrackV3Event[];
|
|
79
|
+
}
|
|
80
|
+
/** 通道 2 的错误明细 */
|
|
81
|
+
export interface TrackV3ErrorDetail {
|
|
82
|
+
systemTime: number;
|
|
83
|
+
href: string;
|
|
84
|
+
innerWidth: number;
|
|
85
|
+
innerHeight: number;
|
|
86
|
+
message: string;
|
|
87
|
+
stack?: string;
|
|
88
|
+
module?: string;
|
|
89
|
+
}
|
|
90
|
+
/** 通道 2:单条错误,可内嵌 rrweb 回放事件 */
|
|
91
|
+
export interface TrackV3ErrorPayload extends TrackV3Envelope {
|
|
92
|
+
error: TrackV3ErrorDetail;
|
|
93
|
+
replay?: unknown[];
|
|
94
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/interfaces/protocol.ts
|
|
20
|
+
var protocol_exports = {};
|
|
21
|
+
__export(protocol_exports, {
|
|
22
|
+
TRACK_CONTENT_TYPE: () => TRACK_CONTENT_TYPE,
|
|
23
|
+
TRACK_LIMITS: () => TRACK_LIMITS,
|
|
24
|
+
TRACK_TYPE_VALUES: () => TRACK_TYPE_VALUES,
|
|
25
|
+
TrackTypeLabel: () => TrackTypeLabel
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(protocol_exports);
|
|
28
|
+
var TRACK_TYPE_VALUES = [
|
|
29
|
+
"error",
|
|
30
|
+
"visit",
|
|
31
|
+
"event",
|
|
32
|
+
"api"
|
|
33
|
+
];
|
|
34
|
+
var TrackTypeLabel = {
|
|
35
|
+
error: "错误信息",
|
|
36
|
+
visit: "页面访问",
|
|
37
|
+
event: "用户触发",
|
|
38
|
+
api: "接口触发"
|
|
39
|
+
};
|
|
40
|
+
var TRACK_LIMITS = {
|
|
41
|
+
/** 单次批量 events[] 条数上限(SDK batchSize 与服务端 DTO 共用) */
|
|
42
|
+
maxItems: 20,
|
|
43
|
+
/** 探针版本号,guard_conf.version varchar(20) */
|
|
44
|
+
sdkVersion: 20,
|
|
45
|
+
/** 会话串,列默认 varchar(255) */
|
|
46
|
+
imei: 255,
|
|
47
|
+
/** 页面 URL,varchar(1000) */
|
|
48
|
+
href: 1e3,
|
|
49
|
+
/** 内容类字段(content / module / user.*),列默认 varchar(255) */
|
|
50
|
+
content: 255,
|
|
51
|
+
module: 255,
|
|
52
|
+
/** 用户画像单个字段长度 */
|
|
53
|
+
userField: 255,
|
|
54
|
+
/** 用户 UA,varchar(1000) */
|
|
55
|
+
userAgent: 1e3,
|
|
56
|
+
/** V3 通道整体 body 上限(含内嵌回放),main.ts 直接引用 */
|
|
57
|
+
bodyBytes: 1024 * 1024
|
|
58
|
+
};
|
|
59
|
+
var TRACK_CONTENT_TYPE = "text/plain;charset=UTF-8";
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
TRACK_CONTENT_TYPE,
|
|
63
|
+
TRACK_LIMITS,
|
|
64
|
+
TRACK_TYPE_VALUES,
|
|
65
|
+
TrackTypeLabel
|
|
66
|
+
});
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
visit = "\u9875\u9762\u8BBF\u95EE",
|
|
4
|
-
event = "\u7528\u6237\u89E6\u53D1",
|
|
5
|
-
api = "\u63A5\u53E3\u89E6\u53D1"
|
|
6
|
-
}
|
|
7
|
-
export type TrackType = keyof typeof TrackTypeEnum;
|
|
1
|
+
export { TrackTypeLabel, TRACK_TYPE_VALUES } from './protocol';
|
|
2
|
+
export type { TrackType } from './protocol';
|
|
8
3
|
export interface UserProfile {
|
|
9
4
|
userId: string;
|
|
10
5
|
userName: string;
|
|
@@ -30,7 +25,7 @@ export interface AuthCenterUserProfile {
|
|
|
30
25
|
authLogMap?: Record<string, string>;
|
|
31
26
|
}
|
|
32
27
|
export interface SystemProfile {
|
|
33
|
-
|
|
28
|
+
imei: string;
|
|
34
29
|
innerHeight: number;
|
|
35
30
|
innerWidth: number;
|
|
36
31
|
href: string;
|
|
@@ -19,17 +19,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/interfaces/track.interface.ts
|
|
20
20
|
var track_interface_exports = {};
|
|
21
21
|
__export(track_interface_exports, {
|
|
22
|
-
|
|
22
|
+
TRACK_TYPE_VALUES: () => import_protocol.TRACK_TYPE_VALUES,
|
|
23
|
+
TrackTypeLabel: () => import_protocol.TrackTypeLabel
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(track_interface_exports);
|
|
25
|
-
var
|
|
26
|
-
TrackTypeEnum2["error"] = "错误信息";
|
|
27
|
-
TrackTypeEnum2["visit"] = "页面访问";
|
|
28
|
-
TrackTypeEnum2["event"] = "用户触发";
|
|
29
|
-
TrackTypeEnum2["api"] = "接口触发";
|
|
30
|
-
return TrackTypeEnum2;
|
|
31
|
-
})(TrackTypeEnum || {});
|
|
26
|
+
var import_protocol = require("./protocol");
|
|
32
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
28
|
0 && (module.exports = {
|
|
34
|
-
|
|
29
|
+
TRACK_TYPE_VALUES,
|
|
30
|
+
TrackTypeLabel
|
|
35
31
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yysports/tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "常用工具函数库",
|
|
5
5
|
"homepage": "https://git.pousheng.com/sport-service-department/pousheng-guard/yysports_tools#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://git.pousheng.com/sport-service-department/pousheng-guard/yysports_tools.git"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
13
|
+
"license": "UNLICENSED",
|
|
14
14
|
"author": "daiwenyu",
|
|
15
15
|
"main": "lib/index.js",
|
|
16
16
|
"module": "dist/index.js",
|
|
@@ -60,29 +60,29 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@babel/runtime": "^7.
|
|
64
|
-
"@rrweb/record": "2.
|
|
65
|
-
"@rrweb/rrweb-plugin-console-record": "2.
|
|
63
|
+
"@babel/runtime": "^7.29.7",
|
|
64
|
+
"@rrweb/record": "2.1.6",
|
|
65
|
+
"@rrweb/rrweb-plugin-console-record": "2.1.6",
|
|
66
66
|
"image-conversion": "^2.1.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@ant-design/pro-components": "^2.8.10",
|
|
70
|
-
"@commitlint/cli": "^20.
|
|
71
|
-
"@commitlint/config-conventional": "^20.
|
|
72
|
-
"@types/react": "^19.
|
|
73
|
-
"@types/react-dom": "^19.
|
|
74
|
-
"@umijs/lint": "^4.
|
|
75
|
-
"antd": "^6.
|
|
76
|
-
"dumi": "^2.4.
|
|
70
|
+
"@commitlint/cli": "^20.5.3",
|
|
71
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
72
|
+
"@types/react": "^19.3.0",
|
|
73
|
+
"@types/react-dom": "^19.3.0",
|
|
74
|
+
"@umijs/lint": "^4.7.19",
|
|
75
|
+
"antd": "^6.6.4",
|
|
76
|
+
"dumi": "^2.4.49",
|
|
77
77
|
"eslint": "^8.57.1",
|
|
78
|
-
"father": "^4.6.
|
|
78
|
+
"father": "^4.6.38",
|
|
79
79
|
"husky": "^9.1.7",
|
|
80
|
-
"lint-staged": "^16.
|
|
81
|
-
"prettier": "^3.
|
|
80
|
+
"lint-staged": "^16.4.0",
|
|
81
|
+
"prettier": "^3.9.8",
|
|
82
82
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
83
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
84
|
-
"react": "^19.
|
|
85
|
-
"react-dom": "^19.
|
|
83
|
+
"prettier-plugin-packagejson": "^2.5.22",
|
|
84
|
+
"react": "^19.3.0",
|
|
85
|
+
"react-dom": "^19.3.0",
|
|
86
86
|
"stylelint": "^16.26.1"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|