@yysports/tools 3.2.0 → 3.4.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.
Files changed (64) hide show
  1. package/README.md +1 -3
  2. package/dist/Track/Beacon.d.ts +0 -18
  3. package/dist/Track/Beacon.js +3 -31
  4. package/dist/Track/Config.d.ts +0 -15
  5. package/dist/Track/Config.js +1 -11
  6. package/dist/Track/Device.d.ts +7 -0
  7. package/dist/Track/Device.js +55 -0
  8. package/dist/Track/Listener.d.ts +0 -11
  9. package/dist/Track/Listener.js +1 -26
  10. package/dist/Track/Log.d.ts +0 -23
  11. package/dist/Track/Log.js +18 -60
  12. package/dist/Track/System.d.ts +0 -1
  13. package/dist/Track/System.js +2 -3
  14. package/dist/Track/User.js +1 -1
  15. package/dist/Track/envelope.d.ts +0 -18
  16. package/dist/Track/envelope.js +6 -27
  17. package/dist/Track/index.js +3 -16
  18. package/dist/Utils/auth.d.ts +0 -7
  19. package/dist/Utils/auth.js +6 -17
  20. package/dist/Utils/common.d.ts +0 -16
  21. package/dist/Utils/common.js +0 -20
  22. package/dist/Utils/file.d.ts +0 -10
  23. package/dist/Utils/file.js +0 -14
  24. package/dist/Utils/route.d.ts +0 -6
  25. package/dist/Utils/route.js +0 -19
  26. package/dist/interfaces/protocol.d.ts +5 -54
  27. package/dist/interfaces/protocol.js +1 -56
  28. package/dist/interfaces/track.interface.js +1 -9
  29. package/lib/Track/Beacon.d.ts +0 -18
  30. package/lib/Track/Beacon.js +36 -79
  31. package/lib/Track/Config.d.ts +0 -15
  32. package/lib/Track/Config.js +20 -51
  33. package/lib/Track/Device.d.ts +7 -0
  34. package/lib/Track/Device.js +48 -0
  35. package/lib/Track/Listener.d.ts +0 -11
  36. package/lib/Track/Listener.js +31 -73
  37. package/lib/Track/Log.d.ts +0 -23
  38. package/lib/Track/Log.js +50 -114
  39. package/lib/Track/System.d.ts +0 -1
  40. package/lib/Track/System.js +13 -31
  41. package/lib/Track/User.js +12 -30
  42. package/lib/Track/envelope.d.ts +0 -18
  43. package/lib/Track/envelope.js +38 -78
  44. package/lib/Track/index.js +31 -63
  45. package/lib/Utils/auth.d.ts +0 -7
  46. package/lib/Utils/auth.js +24 -53
  47. package/lib/Utils/common.d.ts +0 -16
  48. package/lib/Utils/common.js +15 -40
  49. package/lib/Utils/file.d.ts +0 -10
  50. package/lib/Utils/file.js +21 -42
  51. package/lib/Utils/index.js +69 -31
  52. package/lib/Utils/route.d.ts +0 -6
  53. package/lib/Utils/route.js +25 -43
  54. package/lib/Utils/url.js +8 -29
  55. package/lib/Utils/wx.js +18 -35
  56. package/lib/index.js +41 -43
  57. package/lib/interfaces/protocol.d.ts +5 -54
  58. package/lib/interfaces/protocol.js +14 -56
  59. package/lib/interfaces/track.interface.js +15 -28
  60. package/package.json +7 -10
  61. package/dist/Track/Replay.d.ts +0 -93
  62. package/dist/Track/Replay.js +0 -447
  63. package/lib/Track/Replay.d.ts +0 -93
  64. package/lib/Track/Replay.js +0 -330
@@ -1,85 +1,46 @@
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);
1
+ "use strict";
28
2
 
29
- // src/Track/Beacon.ts
30
- var Beacon_exports = {};
31
- __export(Beacon_exports, {
32
- default: () => Beacon
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
33
6
  });
34
- module.exports = __toCommonJS(Beacon_exports);
35
- var import_protocol = require("../interfaces/protocol");
36
- var import_Config = __toESM(require("./Config"));
37
- var import_envelope = require("./envelope");
38
- var Beacon = class {
39
- /**
40
- * 启动定时 flush 与卸载兜底(Track.init 时调用,重复调用无副作用)。
41
- *
42
- * 兜底 flush 放在这里、不放 `Listener`:那会让「是否采集错误」与「通道能否送达」耦合,
43
- * 关掉 `autoReportError` 会连带丢掉所有不满一批的数据。
44
- *
45
- * `flushInterval` 只在首次创建定时器时读取,热更新重建留待 3.2.0(P1-6)。
46
- */
7
+ exports.default = void 0;
8
+ var _protocol = require("../interfaces/protocol");
9
+ var _Config = _interopRequireDefault(require("./Config"));
10
+ var _envelope = require("./envelope");
11
+ class Beacon {
12
+ static _queue = [];
13
+ static _timer = null;
47
14
  static start() {
48
- if (this._timer)
49
- return;
50
- this._timer = setInterval(
51
- () => this.flush(),
52
- import_Config.default.data.flushInterval ?? 1e4
53
- );
54
- if (typeof document === "undefined" || typeof window === "undefined") {
15
+ if (this._timer) return;
16
+ this._timer = setInterval(() => this.flush(), _Config.default.data.flushInterval ?? 10000);
17
+ if (typeof document === 'undefined' || typeof window === 'undefined') {
55
18
  return;
56
19
  }
57
- document.addEventListener("visibilitychange", () => {
58
- if (document.visibilityState === "hidden") {
20
+ document.addEventListener('visibilitychange', () => {
21
+ if (document.visibilityState === 'hidden') {
59
22
  this.flush();
60
23
  }
61
24
  });
62
- window.addEventListener("pagehide", () => {
25
+ window.addEventListener('pagehide', () => {
63
26
  this.flush();
64
27
  });
65
28
  }
66
- /** 入队,达到协议上限立即 flush */
67
29
  static push(event) {
68
- if (!import_Config.default.data.appId) {
69
- console.warn("[Track] 尚未调用 Track.init(appId 为空),该条上报已丢弃");
30
+ if (!_Config.default.data.appId) {
31
+ console.warn('[Track] 尚未调用 Track.init(appId 为空),该条上报已丢弃');
70
32
  return;
71
33
  }
72
34
  this._queue.push(event);
73
- if (this._queue.length >= import_protocol.TRACK_LIMITS.maxItems) {
35
+ if (this._queue.length >= _protocol.TRACK_LIMITS.maxItems) {
74
36
  this.flush();
75
37
  }
76
38
  }
77
- /** 按批发送并出队;发送失败同样出队(尽力而为,不驻留重试) */
78
39
  static flush() {
79
40
  while (this._queue.length > 0) {
80
- const batch = this._queue.slice(0, import_protocol.TRACK_LIMITS.maxItems);
41
+ const batch = this._queue.slice(0, _protocol.TRACK_LIMITS.maxItems);
81
42
  const payload = {
82
- ...(0, import_envelope.buildEnvelopeBase)(),
43
+ ...(0, _envelope.buildEnvelopeBase)(),
83
44
  events: batch
84
45
  };
85
46
  this.sendBatch(JSON.stringify(payload));
@@ -92,31 +53,27 @@ var Beacon = class {
92
53
  }
93
54
  }
94
55
  static trySendBeacon(payload) {
95
- if (typeof navigator === "undefined" || !navigator.sendBeacon)
96
- return false;
56
+ if (typeof navigator === 'undefined' || !navigator.sendBeacon) return false;
97
57
  try {
98
- return navigator.sendBeacon(
99
- (0, import_envelope.trackUrl)("/batch"),
100
- new Blob([payload], { type: import_protocol.TRACK_CONTENT_TYPE })
101
- );
58
+ return navigator.sendBeacon((0, _envelope.trackUrl)('/batch'), new Blob([payload], {
59
+ type: _protocol.TRACK_CONTENT_TYPE
60
+ }));
102
61
  } catch (error) {
103
62
  return false;
104
63
  }
105
64
  }
106
- /** fetch keepalive:无 sendBeacon 环境的主要通道,已发出即视为送达(不等响应、不阻塞队列) */
107
65
  static trySendKeepalive(payload) {
108
- if (typeof fetch !== "function")
109
- return;
66
+ if (typeof fetch !== 'function') return;
110
67
  try {
111
- void fetch((0, import_envelope.trackUrl)("/batch"), {
112
- method: "POST",
113
- headers: { "Content-Type": import_protocol.TRACK_CONTENT_TYPE },
68
+ void fetch((0, _envelope.trackUrl)('/batch'), {
69
+ method: 'POST',
70
+ headers: {
71
+ 'Content-Type': _protocol.TRACK_CONTENT_TYPE
72
+ },
114
73
  body: payload,
115
74
  keepalive: true
116
- }).catch(() => void 0);
117
- } catch (error) {
118
- }
75
+ }).catch(() => undefined);
76
+ } catch (error) {}
119
77
  }
120
- };
121
- Beacon._queue = [];
122
- Beacon._timer = null;
78
+ }
79
+ exports.default = Beacon;
@@ -1,28 +1,13 @@
1
1
  export interface IConfig {
2
2
  appId: string;
3
3
  domain: string;
4
- /**
5
- * 调用方应用自身的版本号(可选)。
6
- * 探针取不到宿主程序版本(`sdkVersion` 是探针自己的版本),只能由接入方显式传入;
7
- * 不传时服务端 `guard_track.app_version` 落 NULL,不影响上报。
8
- */
9
4
  appVersion?: string;
10
5
  autoReportError?: boolean;
11
- /**
12
- * 是否启用回放录制(默认 true)。
13
- * 回放体积 / 去重 / 掩码策略全部由 SDK 内部固定:这些参数只会「配错就崩」
14
- * (配大必然 413、配小频繁放弃),接入方只表达「要不要录」。
15
- */
16
- enableReplay?: boolean;
17
6
  flushInterval?: number;
18
7
  }
19
8
  export default class Config {
20
9
  private static _data;
21
10
  static validate(config: IConfig): void;
22
- /**
23
- * `0` / 非数字 / `null` 回落默认值,其余小于下限的收敛到下限。
24
- * `0` 按非法处理而非下限:`Number(null)` 也是 0,混在一起会让下限失去意义。
25
- */
26
11
  private static normalize;
27
12
  static get data(): IConfig;
28
13
  }
@@ -1,65 +1,34 @@
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);
1
+ "use strict";
18
2
 
19
- // src/Track/Config.ts
20
- var Config_exports = {};
21
- __export(Config_exports, {
22
- default: () => Config
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
23
5
  });
24
- module.exports = __toCommonJS(Config_exports);
25
- var _Config = class {
6
+ exports.default = void 0;
7
+ class Config {
8
+ static _data = {
9
+ appId: '',
10
+ domain: '',
11
+ autoReportError: true,
12
+ flushInterval: 10000
13
+ };
26
14
  static validate(config) {
27
- var _a, _b;
28
- if (!((_a = config.appId) == null ? void 0 : _a.trim())) {
29
- throw new Error("Config: appId is required");
15
+ if (!config.appId?.trim()) {
16
+ throw new Error('Config: appId is required');
30
17
  }
31
- if (!((_b = config.domain) == null ? void 0 : _b.trim())) {
32
- throw new Error("Config: domain is required");
18
+ if (!config.domain?.trim()) {
19
+ throw new Error('Config: domain is required');
33
20
  }
34
- const defined = Object.fromEntries(
35
- Object.entries(config).filter(([, value]) => value !== void 0)
36
- );
21
+ const defined = Object.fromEntries(Object.entries(config).filter(([, value]) => value !== undefined));
37
22
  Object.assign(this._data, defined);
38
- this._data.flushInterval = _Config.normalize(
39
- this._data.flushInterval,
40
- 1e4,
41
- 1e3
42
- );
23
+ this._data.flushInterval = Config.normalize(this._data.flushInterval, 10000, 1000);
43
24
  }
44
- /**
45
- * `0` / 非数字 / `null` 回落默认值,其余小于下限的收敛到下限。
46
- * `0` 按非法处理而非下限:`Number(null)` 也是 0,混在一起会让下限失去意义。
47
- */
48
25
  static normalize(value, fallback, min) {
49
26
  const num = Math.floor(Number(value));
50
- if (!Number.isFinite(num) || num <= 0)
51
- return fallback;
27
+ if (!Number.isFinite(num) || num <= 0) return fallback;
52
28
  return num < min ? min : num;
53
29
  }
54
30
  static get data() {
55
31
  return this._data;
56
32
  }
57
- };
58
- var Config = _Config;
59
- Config._data = {
60
- appId: "",
61
- domain: "",
62
- autoReportError: true,
63
- enableReplay: true,
64
- flushInterval: 1e4
65
- };
33
+ }
34
+ exports.default = Config;
@@ -0,0 +1,7 @@
1
+ import type { TrackV3Device } from '../interfaces/protocol';
2
+ export default class Device {
3
+ private static _device;
4
+ private static _requested;
5
+ static init(): void;
6
+ static get data(): TrackV3Device;
7
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function getUserAgentData() {
8
+ if (typeof navigator === 'undefined') return undefined;
9
+ const uaData = navigator.userAgentData;
10
+ if (!uaData || typeof uaData.getHighEntropyValues !== 'function') {
11
+ return undefined;
12
+ }
13
+ return uaData;
14
+ }
15
+ function toValue(value) {
16
+ return typeof value === 'string' && value !== '' ? value : undefined;
17
+ }
18
+ function pickDevice(values) {
19
+ const model = toValue(values?.model);
20
+ const platformVersion = toValue(values?.platformVersion);
21
+ return {
22
+ ...(model ? {
23
+ model
24
+ } : {}),
25
+ ...(platformVersion ? {
26
+ platformVersion
27
+ } : {})
28
+ };
29
+ }
30
+ class Device {
31
+ static _device = {};
32
+ static _requested = false;
33
+ static init() {
34
+ if (this._requested) return;
35
+ this._requested = true;
36
+ const uaData = getUserAgentData();
37
+ if (!uaData) return;
38
+ try {
39
+ void uaData.getHighEntropyValues(['model', 'platformVersion']).then(values => {
40
+ this._device = pickDevice(values);
41
+ }).catch(() => undefined);
42
+ } catch {}
43
+ }
44
+ static get data() {
45
+ return this._device;
46
+ }
47
+ }
48
+ exports.default = Device;
@@ -1,18 +1,7 @@
1
1
  export default class Listener {
2
2
  private static _loaded;
3
3
  private static _reporter;
4
- /**
5
- * 具名 handler:`removeEventListener` 必须拿到与注册时相同的函数引用,
6
- * 匿名函数会让 `stop()` 失效(`autoReportError` 从 true 改 false 后仍在采集)。
7
- */
8
4
  private static readonly _onError;
9
5
  static run(): void;
10
- /**
11
- * 停止自动上报,供 `init({ autoReportError: false })` 热关闭。
12
- *
13
- * 必须复位 `_loaded`:否则再次 `init({ autoReportError: true })` 时 `run()`
14
- * 直接命中幂等判断返回,监听再也装不回来。挂起的防抖定时器同样要清掉,
15
- * 否则关闭后仍会补报一条。
16
- */
17
6
  static stop(): void;
18
7
  }
@@ -1,90 +1,48 @@
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);
1
+ "use strict";
28
2
 
29
- // src/Track/Listener.ts
30
- var Listener_exports = {};
31
- __export(Listener_exports, {
32
- default: () => Listener
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
33
6
  });
34
- module.exports = __toCommonJS(Listener_exports);
35
- var import_Beacon = __toESM(require("./Beacon"));
36
- var import_Config = __toESM(require("./Config"));
37
- var import_Log = __toESM(require("./Log"));
7
+ exports.default = void 0;
8
+ var _Beacon = _interopRequireDefault(require("./Beacon"));
9
+ var _Config = _interopRequireDefault(require("./Config"));
10
+ var _Log = _interopRequireDefault(require("./Log"));
38
11
  function resolveErrorMessage(event) {
39
- var _a;
40
- const message = (_a = event.message) == null ? void 0 : _a.trim();
41
- if (message)
42
- return message;
12
+ const message = event.message?.trim();
13
+ if (message) return message;
43
14
  const target = event.target;
44
- const failedUrl = (target == null ? void 0 : target.src) ?? (target == null ? void 0 : target.href);
45
- return failedUrl ? `资源加载失败:${failedUrl}` : "";
15
+ const failedUrl = target?.src ?? target?.href;
16
+ return failedUrl ? `资源加载失败:${failedUrl}` : '';
46
17
  }
47
- var _Listener = class {
18
+ class Listener {
19
+ static _loaded = false;
20
+ static _reporter = null;
21
+ static _onError = event => {
22
+ if (Listener._reporter) {
23
+ clearTimeout(Listener._reporter);
24
+ }
25
+ Listener._reporter = setTimeout(() => {
26
+ _Beacon.default.flush();
27
+ _Log.default.errorLog(resolveErrorMessage(event), event.error?.stack);
28
+ Listener._reporter = null;
29
+ }, 1000);
30
+ };
48
31
  static run() {
49
- if (this._loaded || !import_Config.default.data.autoReportError) {
32
+ if (this._loaded || !_Config.default.data.autoReportError) {
50
33
  return;
51
34
  }
52
- window.addEventListener("error", this._onError, true);
35
+ window.addEventListener('error', this._onError, true);
53
36
  this._loaded = true;
54
37
  }
55
- /**
56
- * 停止自动上报,供 `init({ autoReportError: false })` 热关闭。
57
- *
58
- * 必须复位 `_loaded`:否则再次 `init({ autoReportError: true })` 时 `run()`
59
- * 直接命中幂等判断返回,监听再也装不回来。挂起的防抖定时器同样要清掉,
60
- * 否则关闭后仍会补报一条。
61
- */
62
38
  static stop() {
63
- if (!this._loaded)
64
- return;
65
- window.removeEventListener("error", this._onError, true);
39
+ if (!this._loaded) return;
40
+ window.removeEventListener('error', this._onError, true);
66
41
  if (this._reporter) {
67
42
  clearTimeout(this._reporter);
68
43
  this._reporter = null;
69
44
  }
70
45
  this._loaded = false;
71
46
  }
72
- };
73
- var Listener = _Listener;
74
- Listener._loaded = false;
75
- Listener._reporter = null;
76
- /**
77
- * 具名 handler:`removeEventListener` 必须拿到与注册时相同的函数引用,
78
- * 匿名函数会让 `stop()` 失效(`autoReportError` 从 true 改 false 后仍在采集)。
79
- */
80
- Listener._onError = (event) => {
81
- if (_Listener._reporter) {
82
- clearTimeout(_Listener._reporter);
83
- }
84
- _Listener._reporter = setTimeout(() => {
85
- var _a;
86
- import_Beacon.default.flush();
87
- import_Log.default.errorLog(resolveErrorMessage(event), (_a = event.error) == null ? void 0 : _a.stack);
88
- _Listener._reporter = null;
89
- }, 1e3);
90
- };
47
+ }
48
+ exports.default = Listener;
@@ -1,32 +1,9 @@
1
- /**
2
- * 日志上报入口。
3
- *
4
- * 配置语义:`autoReportError` 只控制是否自动监听 window.onerror(见 Listener);
5
- * 回放是否随错误一起上报只看 `enableReplay`(见 Replay.run)。
6
- */
7
1
  export default class Log {
8
2
  private static _module;
9
3
  static get module(): string;
10
- /**
11
- * 条级业务内容超列宽时丢弃该条。
12
- *
13
- * `content` 是接入方传入的业务内容:截断会改变语义、把「数据丢失」伪装成「数据完整」,
14
- * 故选择丢弃 + `console.warn`——联调期即可暴露,且不会让同批其他条一起被 400 拒掉。
15
- */
16
4
  private static isContentOverlong;
17
- /**
18
- * 页面上报。
19
- *
20
- * `module` 为空属调用误用(如路由工具返回 `undefined`):`_module` 会被后续事件复用,
21
- * 记成空串会让之后所有事件的归属一起变空,故丢弃并告警,与 `errorLog` 处理一致。
22
- */
23
5
  static visitLog(module?: string): void;
24
6
  static eventLog(content: string): void;
25
7
  static apiLog(log: string): void;
26
- /**
27
- * 错误 + 回放一次请求内嵌上报(通道 2)。
28
- * fetch 失败或页面卸载导致未送达时,用 sendBeacon 补发不含回放的纯错误:
29
- * 卸载场景 fetch 不可靠,至少保住错误本体,回放可接受丢失。
30
- */
31
8
  static errorLog(message: string, stack?: string): Promise<void>;
32
9
  }