jason-trace-log 0.0.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/LICENSE +7 -0
- package/README.md +50 -0
- package/dist/lib/baseTrace.js +405 -0
- package/dist/lib/baseTrace.js.map +1 -0
- package/dist/lib/constants.js +26 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/core/fetch.js +138 -0
- package/dist/lib/core/fetch.js.map +1 -0
- package/dist/lib/core/fingerprint.js +66 -0
- package/dist/lib/core/fingerprint.js.map +1 -0
- package/dist/lib/core/interface.js +3 -0
- package/dist/lib/core/interface.js.map +1 -0
- package/dist/lib/core/request.js +26 -0
- package/dist/lib/core/request.js.map +1 -0
- package/dist/lib/core/send.js +176 -0
- package/dist/lib/core/send.js.map +1 -0
- package/dist/lib/core/util.js +186 -0
- package/dist/lib/core/util.js.map +1 -0
- package/dist/lib/core/webvitals.js +63 -0
- package/dist/lib/core/webvitals.js.map +1 -0
- package/dist/lib/index.js +19 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/trace.js +27 -0
- package/dist/lib/trace.js.map +1 -0
- package/dist/lib/typings/common.js +131 -0
- package/dist/lib/typings/common.js.map +1 -0
- package/dist/trace-log.esm.js +1391 -0
- package/dist/trace-log.esm.js.map +1 -0
- package/dist/trace-log.umd.js +1400 -0
- package/dist/trace-log.umd.js.map +1 -0
- package/dist/trace-sdk.esm.js +1391 -0
- package/dist/trace-sdk.esm.js.map +1 -0
- package/dist/trace-sdk.umd.js +1401 -0
- package/dist/trace-sdk.umd.js.map +1 -0
- package/dist/types/baseTrace.d.ts +58 -0
- package/dist/types/constants.d.ts +12 -0
- package/dist/types/core/fetch.d.ts +21 -0
- package/dist/types/core/fingerprint.d.ts +14 -0
- package/dist/types/core/interface.d.ts +10 -0
- package/dist/types/core/request.d.ts +3 -0
- package/dist/types/core/send.d.ts +84 -0
- package/dist/types/core/util.d.ts +19 -0
- package/dist/types/core/webvitals.d.ts +8 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/trace.d.ts +3 -0
- package/dist/types/typings/common.d.ts +84 -0
- package/package.json +140 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BreadcrumbTypes, TraceDataSeverity, TraceDataTypes, BreadcrumbsCategorys, TraceLevelType, TraceTypes } from "../typings/common";
|
|
2
|
+
export declare const getTimestamp: () => number;
|
|
3
|
+
export declare const getFetchStatusLevel: (status: number) => TraceDataSeverity;
|
|
4
|
+
export declare const isResourceTarget: (target: HTMLElement) => target is HTMLScriptElement | HTMLLinkElement | HTMLImageElement | HTMLVideoElement | HTMLAudioElement;
|
|
5
|
+
/**
|
|
6
|
+
* 根据字符串生成hashcode
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @param {string} str
|
|
10
|
+
* @return {*} {number} 可为正数和负数
|
|
11
|
+
*/
|
|
12
|
+
export declare function hashCode(str: string): number;
|
|
13
|
+
export declare function dataTypes2BreadcrumbsType(data: TraceDataTypes): BreadcrumbTypes.ROUTE | BreadcrumbTypes.CONSOLE | BreadcrumbTypes.FETCH | BreadcrumbTypes.UNHANDLEDREJECTION | BreadcrumbTypes.RESOURCE | BreadcrumbTypes.CODE_ERROR | BreadcrumbTypes.CUSTOMER;
|
|
14
|
+
export declare function dataCategory2BreadcrumbsCategory(data: TraceDataTypes): BreadcrumbsCategorys.Http | BreadcrumbsCategorys.Debug | BreadcrumbsCategorys.Exception | BreadcrumbsCategorys.Lifecycle;
|
|
15
|
+
export declare function getTraceDataLevel(level: TraceDataSeverity): TraceLevelType;
|
|
16
|
+
export declare function getTraceDataType(type: TraceDataTypes): TraceTypes.EVENT | TraceTypes.PERF | TraceTypes.RESOURCE | TraceTypes.FETCH | TraceTypes.CODE_ERROR | TraceTypes.CUSTOMER;
|
|
17
|
+
export declare function getPerfLevel(data: TracePerf): TraceLevelType.Info;
|
|
18
|
+
export declare function uuid(): string;
|
|
19
|
+
export declare function safeStringify(obj: object): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function generateUniqueId(): string;
|
|
2
|
+
export declare function mapMetric(metric: any): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
[metric.name]: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const onVitals: (saveMetric: any) => void;
|
|
7
|
+
declare const _default: {};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export declare enum TraceDataSeverity {
|
|
2
|
+
Else = "else",
|
|
3
|
+
Error = "error",
|
|
4
|
+
Warning = "warning",
|
|
5
|
+
Info = "info",
|
|
6
|
+
Debug = "debug",
|
|
7
|
+
/** 上报的错误等级 */
|
|
8
|
+
Low = "low",
|
|
9
|
+
Normal = "normal",
|
|
10
|
+
High = "high",
|
|
11
|
+
Critical = "critical"
|
|
12
|
+
}
|
|
13
|
+
export declare enum TraceTypes {
|
|
14
|
+
PAGE_VIEW = "PageView",
|
|
15
|
+
EVENT = "EVENT",
|
|
16
|
+
PERF = "Perf",
|
|
17
|
+
RESOURCE = "Resource",
|
|
18
|
+
ACTION = "Action",
|
|
19
|
+
FETCH = "Fetch",
|
|
20
|
+
CODE_ERROR = "CodeError",
|
|
21
|
+
CONSOLE = "Console",
|
|
22
|
+
CUSTOMER = "Customer"
|
|
23
|
+
}
|
|
24
|
+
export declare enum TraceClientTypes {
|
|
25
|
+
ANDROID_H5 = "android",
|
|
26
|
+
IOS_H5 = "ios",
|
|
27
|
+
PC_H5 = "pc",
|
|
28
|
+
BROWSER_H5 = "browser"
|
|
29
|
+
}
|
|
30
|
+
export declare enum BrowserType {
|
|
31
|
+
MOBILE = "mobile",
|
|
32
|
+
PC = "pc",
|
|
33
|
+
WEBVIEW = "webview",
|
|
34
|
+
MINI_PROGRAM = "miniProgram"
|
|
35
|
+
}
|
|
36
|
+
export declare enum TraceLevelType {
|
|
37
|
+
Error = "error",
|
|
38
|
+
Warn = "warn",
|
|
39
|
+
Info = "info",
|
|
40
|
+
Debug = "debug"
|
|
41
|
+
}
|
|
42
|
+
export declare enum BreadcrumbTypes {
|
|
43
|
+
ROUTE = "Route",
|
|
44
|
+
CLICK = "UI.Click",
|
|
45
|
+
CONSOLE = "Console",
|
|
46
|
+
FETCH = "Fetch",
|
|
47
|
+
UNHANDLEDREJECTION = "Unhandledrejection",
|
|
48
|
+
RESOURCE = "Resource",
|
|
49
|
+
CODE_ERROR = "Code Error",
|
|
50
|
+
CUSTOMER = "Customer"
|
|
51
|
+
}
|
|
52
|
+
export declare enum TraceDataTypes {
|
|
53
|
+
UNKNOWN = "UNKNOWN",
|
|
54
|
+
UNKNOWN_FUNCTION = "UNKNOWN_FUNCTION",
|
|
55
|
+
JAVASCRIPT = "JAVASCRIPT",
|
|
56
|
+
LOG = "LOG",
|
|
57
|
+
HTTP = "HTTP",
|
|
58
|
+
VUE = "VUE",
|
|
59
|
+
REACT = "REACT",
|
|
60
|
+
RESOURCE = "RESOURCE",
|
|
61
|
+
PROMISE = "PROMISE",
|
|
62
|
+
ROUTE = "ROUTE",
|
|
63
|
+
PERF = "PERF"
|
|
64
|
+
}
|
|
65
|
+
export declare enum BreadcrumbsCategorys {
|
|
66
|
+
Http = "http",
|
|
67
|
+
User = "user",
|
|
68
|
+
Debug = "debug",
|
|
69
|
+
Exception = "exception",
|
|
70
|
+
Lifecycle = "lifecycle"
|
|
71
|
+
}
|
|
72
|
+
export declare enum TraceBaseDataName {
|
|
73
|
+
Fetch = "Fetch",
|
|
74
|
+
TypeError = "TypeError",
|
|
75
|
+
Unhandledrejection = "Unhandledrejection",
|
|
76
|
+
Log = "Log",
|
|
77
|
+
Perf = "Perf",
|
|
78
|
+
Resource = "Resource"
|
|
79
|
+
}
|
|
80
|
+
export declare enum SendMethod {
|
|
81
|
+
IMG = "img",
|
|
82
|
+
BEACON = "beacon",
|
|
83
|
+
LTS = "lts"
|
|
84
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jason-trace-log",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"main": "dist/trace-log.umd.js",
|
|
7
|
+
"module": "dist/trace-log.esm.js",
|
|
8
|
+
"types": "dist/types/index.d.ts",
|
|
9
|
+
"typings": "dist/types/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"author": "jason",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": ""
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=6.0.0"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
|
|
24
|
+
"prebuild": "rimraf dist",
|
|
25
|
+
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
|
|
26
|
+
"build:js": "tsc --module commonjs && rollup -c rollup.config.ts",
|
|
27
|
+
"build:cjs": "rollup -c rollup.config.ts",
|
|
28
|
+
"start": "rollup -c rollup.config.ts -w",
|
|
29
|
+
"test": "jest --coverage",
|
|
30
|
+
"test:watch": "jest --coverage --watch",
|
|
31
|
+
"test:prod": "npm run lint && npm run test -- --no-cache",
|
|
32
|
+
"deploy-docs": "ts-node tools/gh-pages-publish",
|
|
33
|
+
"report-coverage": "cat ./coverage/lcov.info | coveralls",
|
|
34
|
+
"commit": "git-cz",
|
|
35
|
+
"semantic-release": "semantic-release",
|
|
36
|
+
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
|
|
37
|
+
"precommit": "lint-staged",
|
|
38
|
+
"travis-deploy-once": "travis-deploy-once",
|
|
39
|
+
"examples": "cross-env NODE_ENV=demo node ./examples/server/index.js"
|
|
40
|
+
},
|
|
41
|
+
"lint-staged": {
|
|
42
|
+
"{src,test}/**/*.ts": [
|
|
43
|
+
"prettier --write",
|
|
44
|
+
"git add"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"config": {
|
|
48
|
+
"commitizen": {
|
|
49
|
+
"path": "node_modules/cz-conventional-changelog"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"jest": {
|
|
53
|
+
"transform": {
|
|
54
|
+
".(ts|tsx)": "ts-jest"
|
|
55
|
+
},
|
|
56
|
+
"testEnvironment": "node",
|
|
57
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
58
|
+
"moduleFileExtensions": [
|
|
59
|
+
"ts",
|
|
60
|
+
"tsx",
|
|
61
|
+
"js"
|
|
62
|
+
],
|
|
63
|
+
"coveragePathIgnorePatterns": [
|
|
64
|
+
"/node_modules/",
|
|
65
|
+
"/test/"
|
|
66
|
+
],
|
|
67
|
+
"coverageThreshold": {
|
|
68
|
+
"global": {
|
|
69
|
+
"branches": 90,
|
|
70
|
+
"functions": 95,
|
|
71
|
+
"lines": 95,
|
|
72
|
+
"statements": 95
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"collectCoverageFrom": [
|
|
76
|
+
"src/*.{js,ts}"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"prettier": {
|
|
80
|
+
"semi": false,
|
|
81
|
+
"singleQuote": true
|
|
82
|
+
},
|
|
83
|
+
"commitlint": {
|
|
84
|
+
"extends": [
|
|
85
|
+
"@commitlint/config-conventional"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@commitlint/cli": "^7.1.2",
|
|
90
|
+
"@commitlint/config-conventional": "^7.1.2",
|
|
91
|
+
"@types/jest": "^23.3.2",
|
|
92
|
+
"@types/node": "^10.11.0",
|
|
93
|
+
"colors": "^1.3.2",
|
|
94
|
+
"commitizen": "^3.0.0",
|
|
95
|
+
"coveralls": "^3.0.2",
|
|
96
|
+
"cross-env": "^5.2.0",
|
|
97
|
+
"cz-conventional-changelog": "^2.1.0",
|
|
98
|
+
"husky": "^1.0.1",
|
|
99
|
+
"jest": "^23.6.0",
|
|
100
|
+
"jest-config": "^23.6.0",
|
|
101
|
+
"lint-staged": "^8.0.0",
|
|
102
|
+
"lodash.camelcase": "^4.3.0",
|
|
103
|
+
"prettier": "^1.14.3",
|
|
104
|
+
"prompt": "^1.0.0",
|
|
105
|
+
"replace-in-file": "^3.4.2",
|
|
106
|
+
"rimraf": "^2.6.2",
|
|
107
|
+
"rollup": "^0.67.0",
|
|
108
|
+
"rollup-plugin-commonjs": "^9.1.8",
|
|
109
|
+
"rollup-plugin-json": "^3.1.0",
|
|
110
|
+
"rollup-plugin-node-resolve": "^3.4.0",
|
|
111
|
+
"rollup-plugin-sourcemaps": "^0.4.2",
|
|
112
|
+
"rollup-plugin-typescript2": "^0.18.0",
|
|
113
|
+
"semantic-release": "^15.9.16",
|
|
114
|
+
"shelljs": "^0.8.3",
|
|
115
|
+
"travis-deploy-once": "^5.0.9",
|
|
116
|
+
"ts-jest": "^23.10.2",
|
|
117
|
+
"ts-node": "^7.0.1",
|
|
118
|
+
"tslib": "^2.8.1",
|
|
119
|
+
"tslint": "^5.11.0",
|
|
120
|
+
"tslint-config-prettier": "^1.15.0",
|
|
121
|
+
"tslint-config-standard": "^8.0.1",
|
|
122
|
+
"typedoc": "^0.25.12",
|
|
123
|
+
"typescript": "^5.4.3"
|
|
124
|
+
},
|
|
125
|
+
"dependencies": {
|
|
126
|
+
"@types/express": "^4.17.21",
|
|
127
|
+
"@types/lodash": "^4.17.0",
|
|
128
|
+
"express": "^4.22.1",
|
|
129
|
+
"js-base64": "^3.7.7",
|
|
130
|
+
"lts-web-sdk": "^1.0.0",
|
|
131
|
+
"open": "^10.1.0",
|
|
132
|
+
"web-vitals": "^3.5.2",
|
|
133
|
+
"web-vitals-reporter": "^1.0.0"
|
|
134
|
+
},
|
|
135
|
+
"volta": {
|
|
136
|
+
"node": "22.12.0",
|
|
137
|
+
"yarn": "1.22.21",
|
|
138
|
+
"pnpm": "8.15.7"
|
|
139
|
+
}
|
|
140
|
+
}
|