@wutiange/log-listener-plugin 1.2.3 → 1.3.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/dist/console.js +14 -15
  2. package/dist/console.js.map +1 -1
  3. package/dist/fetch.js +28 -28
  4. package/dist/fetch.js.map +1 -1
  5. package/dist/index.d.ts +2 -23
  6. package/dist/index.js +2 -117
  7. package/dist/index.js.map +1 -1
  8. package/dist/packages/network-logger/Logger.d.ts +28 -0
  9. package/dist/packages/network-logger/Logger.js +192 -0
  10. package/dist/packages/network-logger/Logger.js.map +1 -0
  11. package/dist/packages/network-logger/NetworkRequestInfo.d.ts +37 -0
  12. package/dist/packages/network-logger/NetworkRequestInfo.js +151 -0
  13. package/dist/packages/network-logger/NetworkRequestInfo.js.map +1 -0
  14. package/dist/packages/network-logger/constant.d.ts +2 -0
  15. package/dist/packages/network-logger/constant.js +6 -0
  16. package/dist/packages/network-logger/constant.js.map +1 -0
  17. package/dist/packages/network-logger/types.d.ts +14 -0
  18. package/dist/packages/network-logger/types.js +3 -0
  19. package/dist/packages/network-logger/types.js.map +1 -0
  20. package/dist/packages/network-logger/utils/debounce.d.ts +2 -0
  21. package/dist/packages/network-logger/utils/debounce.js +20 -0
  22. package/dist/packages/network-logger/utils/debounce.js.map +1 -0
  23. package/dist/packages/network-logger/utils/extractHost.d.ts +2 -0
  24. package/dist/packages/network-logger/utils/extractHost.js +9 -0
  25. package/dist/packages/network-logger/utils/extractHost.js.map +1 -0
  26. package/dist/packages/network-logger/utils/fromEntries.d.ts +2 -0
  27. package/dist/packages/network-logger/utils/fromEntries.js +8 -0
  28. package/dist/packages/network-logger/utils/fromEntries.js.map +1 -0
  29. package/dist/packages/network-logger/utils/logger.d.ts +1 -0
  30. package/dist/packages/network-logger/utils/logger.js +6 -0
  31. package/dist/packages/network-logger/utils/logger.js.map +1 -0
  32. package/dist/src/CompatibilityManager.d.ts +27 -0
  33. package/dist/src/CompatibilityManager.js +82 -0
  34. package/dist/src/CompatibilityManager.js.map +1 -0
  35. package/dist/src/__tests__/console.test.d.ts +1 -0
  36. package/dist/{__tests__ → src/__tests__}/console.test.js +2 -2
  37. package/dist/src/__tests__/console.test.js.map +1 -0
  38. package/dist/src/common.js.map +1 -0
  39. package/dist/src/console.d.ts +1 -0
  40. package/dist/src/console.js +20 -0
  41. package/dist/src/console.js.map +1 -0
  42. package/dist/src/fetch.d.ts +1 -0
  43. package/dist/src/fetch.js +48 -0
  44. package/dist/src/fetch.js.map +1 -0
  45. package/dist/src/index.d.ts +2 -0
  46. package/dist/src/index.js +8 -0
  47. package/dist/src/index.js.map +1 -0
  48. package/dist/src/logPlugin.d.ts +32 -0
  49. package/dist/src/logPlugin.js +187 -0
  50. package/dist/src/logPlugin.js.map +1 -0
  51. package/dist/{server.d.ts → src/server.d.ts} +1 -1
  52. package/dist/{server.js → src/server.js} +14 -8
  53. package/dist/src/server.js.map +1 -0
  54. package/dist/src/utils.d.ts +3 -0
  55. package/dist/src/utils.js +38 -0
  56. package/dist/src/utils.js.map +1 -0
  57. package/package.json +13 -5
  58. package/packages/network-logger/Logger.ts +274 -0
  59. package/packages/network-logger/NetworkRequestInfo.ts +161 -0
  60. package/packages/network-logger/constant.ts +3 -0
  61. package/packages/network-logger/types.ts +36 -0
  62. package/packages/network-logger/utils/debounce.ts +21 -0
  63. package/packages/network-logger/utils/extractHost.ts +7 -0
  64. package/packages/network-logger/utils/fromEntries.ts +7 -0
  65. package/packages/network-logger/utils/logger.ts +2 -0
  66. package/src/CompatibilityManager.ts +71 -0
  67. package/src/__tests__/console.test.ts +2 -2
  68. package/src/common.ts +2 -3
  69. package/src/logPlugin.ts +229 -0
  70. package/src/server.ts +28 -23
  71. package/src/utils.ts +38 -0
  72. package/dist/__tests__/console.test.d.ts +0 -1
  73. package/dist/__tests__/console.test.js.map +0 -1
  74. package/dist/common.js.map +0 -1
  75. package/dist/server.js.map +0 -1
  76. package/dist/utils.d.ts +0 -1
  77. package/dist/utils.js +0 -14
  78. package/dist/utils.js.map +0 -1
  79. package/src/console.ts +0 -19
  80. package/src/fetch.ts +0 -35
  81. package/src/index.ts +0 -131
  82. /package/dist/{common.d.ts → src/common.d.ts} +0 -0
  83. /package/dist/{common.js → src/common.js} +0 -0
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const FileReader_1 = __importDefault(require("react-native/Libraries/Blob/FileReader"));
16
+ const fromEntries_1 = __importDefault(require("./utils/fromEntries"));
17
+ class NetworkRequestInfo {
18
+ constructor(id, type, method, url) {
19
+ this.id = '';
20
+ this.type = '';
21
+ this.url = '';
22
+ this.status = -1;
23
+ this.dataSent = '';
24
+ this.responseContentType = '';
25
+ this.responseSize = 0;
26
+ this.requestHeaders = {};
27
+ this.responseHeaders = {};
28
+ this.response = '';
29
+ this.responseURL = '';
30
+ this.responseType = '';
31
+ this.timeout = 0;
32
+ this.closeReason = '';
33
+ this.messages = '';
34
+ this.serverClose = undefined;
35
+ this.serverError = undefined;
36
+ this.startTime = 0;
37
+ this.endTime = 0;
38
+ this.updatedAt = 0;
39
+ this.id = id;
40
+ this.type = type;
41
+ this.method = method;
42
+ this.url = url;
43
+ this.updatedAt = Date.now();
44
+ }
45
+ get duration() {
46
+ return this.endTime - this.startTime;
47
+ }
48
+ get curlRequest() {
49
+ let headersPart = this.requestHeaders &&
50
+ Object.entries(this.requestHeaders)
51
+ .map(([key, value]) => `'${key}: ${this.escapeQuotes(value)}'`)
52
+ .join(' -H ');
53
+ headersPart = headersPart ? `-H ${headersPart}` : '';
54
+ const body = this.dataSent && this.escapeQuotes(this.dataSent);
55
+ const methodPart = this.method !== 'GET' ? `-X${this.method.toUpperCase()}` : '';
56
+ const bodyPart = body ? `-d '${body}'` : '';
57
+ const parts = ['curl', methodPart, headersPart, bodyPart, `'${this.url}'`];
58
+ return parts.filter(Boolean).join(' ');
59
+ }
60
+ update(values) {
61
+ Object.assign(this, values);
62
+ if (values.dataSent) {
63
+ const data = this.parseData(values.dataSent);
64
+ this.gqlOperation = data === null || data === void 0 ? void 0 : data.operationName;
65
+ }
66
+ this.updatedAt = Date.now();
67
+ }
68
+ escapeQuotes(value) {
69
+ var _a;
70
+ return (_a = value.replace) === null || _a === void 0 ? void 0 : _a.call(value, /'/g, "\\'");
71
+ }
72
+ parseData(data) {
73
+ var _a;
74
+ try {
75
+ if ((_a = data === null || data === void 0 ? void 0 : data._parts) === null || _a === void 0 ? void 0 : _a.length) {
76
+ return (0, fromEntries_1.default)(data === null || data === void 0 ? void 0 : data._parts);
77
+ }
78
+ return JSON.parse(data);
79
+ }
80
+ catch (e) {
81
+ return { data };
82
+ }
83
+ }
84
+ stringifyFormat(data) {
85
+ return JSON.stringify(this.parseData(data), null, 2);
86
+ }
87
+ toRow() {
88
+ return {
89
+ url: this.url,
90
+ gqlOperation: this.gqlOperation,
91
+ id: this.id,
92
+ method: this.method,
93
+ status: this.status,
94
+ duration: this.duration,
95
+ startTime: this.startTime,
96
+ };
97
+ }
98
+ getRequestBody(replaceEscaped = false) {
99
+ const body = this.stringifyFormat(this.dataSent);
100
+ if (replaceEscaped) {
101
+ return body.replace(/\\n/g, '\n').replace(/\\"/g, '"');
102
+ }
103
+ return body;
104
+ }
105
+ parseResponseBlob() {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ const blobReader = new FileReader_1.default();
108
+ blobReader.readAsText(this.response);
109
+ return yield new Promise((resolve, reject) => {
110
+ const handleError = () => reject(blobReader.error);
111
+ blobReader.addEventListener('load', () => {
112
+ resolve(blobReader.result);
113
+ });
114
+ blobReader.addEventListener('error', handleError);
115
+ blobReader.addEventListener('abort', handleError);
116
+ });
117
+ });
118
+ }
119
+ getResponseBody() {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ const body = yield (this.responseType !== 'blob'
122
+ ? this.response
123
+ : this.parseResponseBlob());
124
+ return this.stringifyFormat(body);
125
+ });
126
+ }
127
+ copy() {
128
+ const newInstance = new NetworkRequestInfo(this.id, this.type, this.method, this.url);
129
+ newInstance.status = this.status;
130
+ newInstance.dataSent = this.dataSent;
131
+ newInstance.responseContentType = this.responseContentType;
132
+ newInstance.responseSize = this.responseSize;
133
+ newInstance.response = this.response;
134
+ newInstance.responseURL = this.responseURL;
135
+ newInstance.responseType = this.responseType;
136
+ newInstance.timeout = this.timeout;
137
+ newInstance.closeReason = this.closeReason;
138
+ newInstance.messages = this.messages;
139
+ newInstance.serverClose = this.serverClose;
140
+ newInstance.serverError = this.serverError;
141
+ newInstance.startTime = this.startTime;
142
+ newInstance.endTime = this.endTime;
143
+ newInstance.gqlOperation = this.gqlOperation;
144
+ newInstance.updatedAt = this.updatedAt;
145
+ newInstance.requestHeaders = JSON.parse(JSON.stringify(this.requestHeaders));
146
+ newInstance.responseHeaders = JSON.parse(JSON.stringify(this.responseHeaders));
147
+ return newInstance;
148
+ }
149
+ }
150
+ exports.default = NetworkRequestInfo;
151
+ //# sourceMappingURL=NetworkRequestInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkRequestInfo.js","sourceRoot":"","sources":["../../../packages/network-logger/NetworkRequestInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,wFAAoE;AAEpE,sEAA8C;AAE9C,MAAqB,kBAAkB;IAwBrC,YAAY,EAAU,EAAE,IAAY,EAAE,MAAqB,EAAE,GAA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AW,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QACnC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACrC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACvC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QACnC,WAAW,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAGvC,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;QAC7E,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAE/E,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AA3JD,qCA2JC"}
@@ -0,0 +1,2 @@
1
+ export declare const LOGGER_MAX_REQUESTS: number;
2
+ export declare const LOGGER_REFRESH_RATE: number;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOGGER_REFRESH_RATE = exports.LOGGER_MAX_REQUESTS = void 0;
4
+ exports.LOGGER_MAX_REQUESTS = 500;
5
+ exports.LOGGER_REFRESH_RATE = 50;
6
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../packages/network-logger/constant.ts"],"names":[],"mappings":";;;AACa,QAAA,mBAAmB,GAAW,GAAG,CAAC;AAClC,QAAA,mBAAmB,GAAW,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import NetworkRequestInfo from './NetworkRequestInfo';
2
+ export type Headers = {
3
+ [header: string]: string;
4
+ };
5
+ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
6
+ export type StartNetworkLoggingOptions = {
7
+ maxRequests?: number;
8
+ ignoredHosts?: string[];
9
+ ignoredUrls?: string[];
10
+ ignoredPatterns?: RegExp[];
11
+ forceEnable?: boolean;
12
+ refreshRate?: number;
13
+ };
14
+ export type NetworkRequestInfoRow = Pick<NetworkRequestInfo, 'url' | 'gqlOperation' | 'id' | 'method' | 'status' | 'duration' | 'startTime'>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../packages/network-logger/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ declare function debounce(func: Function, wait: number, immediate?: boolean): () => void;
2
+ export default debounce;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function debounce(func, wait, immediate = false) {
4
+ let timeout;
5
+ return function () {
6
+ const args = arguments;
7
+ clearTimeout(timeout);
8
+ if (immediate && !timeout) {
9
+ func.apply(this, args);
10
+ }
11
+ timeout = setTimeout(function () {
12
+ timeout = undefined;
13
+ if (!immediate) {
14
+ func.apply(this, args);
15
+ }
16
+ }, wait);
17
+ };
18
+ }
19
+ exports.default = debounce;
20
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../../../packages/network-logger/utils/debounce.ts"],"names":[],"mappings":";;AACA,SAAS,QAAQ,CAAC,IAAc,EAAE,IAAY,EAAE,YAAqB,KAAK;IACxE,IAAI,OAAkD,CAAC;IACvD,OAAO;QACL,MAAM,IAAI,GAAG,SAAS,CAAC;QACvB,YAAY,CAAC,OAAO,CAAC,CAAC;QAEtB,IAAI,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,GAAG,UAAU,CAAC;YACnB,OAAO,GAAG,SAAS,CAAC;YAEpB,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const extractHost: (url: string) => string;
2
+ export default extractHost;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const extractHost = (url) => {
4
+ var _a, _b;
5
+ const host = ((_b = (_a = url.split('//')[1]) === null || _a === void 0 ? void 0 : _a.split(':')[0]) === null || _b === void 0 ? void 0 : _b.split('/')[0]) || undefined;
6
+ return host;
7
+ };
8
+ exports.default = extractHost;
9
+ //# sourceMappingURL=extractHost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractHost.js","sourceRoot":"","sources":["../../../../packages/network-logger/utils/extractHost.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;;IAClC,MAAM,IAAI,GAAG,CAAA,MAAA,MAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,KAAI,SAAS,CAAC;IAE3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const fromEntries: (arr: any[]) => any;
2
+ export default fromEntries;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fromEntries = (arr) => arr.reduce((acc, [k, v]) => {
4
+ acc[k] = v;
5
+ return acc;
6
+ }, {});
7
+ exports.default = fromEntries;
8
+ //# sourceMappingURL=fromEntries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromEntries.js","sourceRoot":"","sources":["../../../../packages/network-logger/utils/fromEntries.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW,GAAG,CAAC,GAAU,EAAE,EAAE,CACjC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;IACzB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAE,CAAC,CAAC;AAET,kBAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const warn: (message: string) => void;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.warn = void 0;
4
+ const warn = (message) => console.warn(`react-native-network-logger: ${message}`);
5
+ exports.warn = warn;
6
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../packages/network-logger/utils/logger.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE,CACtC,OAAO,CAAC,IAAI,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;AAD7C,QAAA,IAAI,QACyC"}
@@ -0,0 +1,27 @@
1
+ import NetworkRequestInfo from "../packages/network-logger/NetworkRequestInfo";
2
+ declare class CompatibilityManager {
3
+ private static requestInfoObj;
4
+ static interceptionToNetwork(data: NetworkRequestInfo[]): Promise<({
5
+ headers: import("../packages/network-logger/types").Headers;
6
+ body: string;
7
+ requestId: string;
8
+ statusCode: number;
9
+ endTime: number;
10
+ url?: undefined;
11
+ id?: undefined;
12
+ method?: undefined;
13
+ createTime?: undefined;
14
+ } | {
15
+ url: string;
16
+ id: string;
17
+ method: import("../packages/network-logger/types").RequestMethod;
18
+ headers: import("../packages/network-logger/types").Headers;
19
+ body: string;
20
+ createTime: number;
21
+ requestId?: undefined;
22
+ statusCode?: undefined;
23
+ endTime?: undefined;
24
+ })[]>;
25
+ private static asyncSwapSendArr;
26
+ }
27
+ export default CompatibilityManager;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ class CompatibilityManager {
13
+ static interceptionToNetwork(data) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const tempWillSendArr = [];
16
+ if (Object.keys(CompatibilityManager.requestInfoObj).length === 0) {
17
+ CompatibilityManager.requestInfoObj = data.reduce((e, c) => {
18
+ if (c.endTime) {
19
+ const startReq = c.copy();
20
+ startReq.endTime = 0;
21
+ tempWillSendArr.push(startReq, c);
22
+ return e;
23
+ }
24
+ tempWillSendArr.push(c);
25
+ return Object.assign(Object.assign({}, e), { [c.id]: c });
26
+ }, {});
27
+ }
28
+ else {
29
+ data.forEach(e => {
30
+ const tempObj = CompatibilityManager.requestInfoObj;
31
+ if (!(e.id in tempObj)) {
32
+ if (!e.endTime) {
33
+ tempWillSendArr.push(e);
34
+ CompatibilityManager.requestInfoObj[e.id] = e;
35
+ }
36
+ else {
37
+ const startReq = e.copy();
38
+ startReq.endTime = 0;
39
+ tempWillSendArr.push(startReq, e);
40
+ }
41
+ return;
42
+ }
43
+ if (e.id in tempObj && e.endTime) {
44
+ tempWillSendArr.push(e);
45
+ delete CompatibilityManager.requestInfoObj[e.id];
46
+ return;
47
+ }
48
+ });
49
+ }
50
+ return CompatibilityManager.asyncSwapSendArr(tempWillSendArr);
51
+ });
52
+ }
53
+ static asyncSwapSendArr(data) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const asyncTempArr = yield Promise.all(data.map((e) => __awaiter(this, void 0, void 0, function* () {
56
+ if (e.endTime) {
57
+ return {
58
+ headers: e.responseHeaders,
59
+ body: yield e.getResponseBody(),
60
+ requestId: e.id,
61
+ statusCode: e.status,
62
+ endTime: e.endTime,
63
+ };
64
+ }
65
+ else {
66
+ return {
67
+ url: e.url,
68
+ id: e.id,
69
+ method: e.method,
70
+ headers: e.requestHeaders,
71
+ body: e.getRequestBody(),
72
+ createTime: e.startTime,
73
+ };
74
+ }
75
+ })));
76
+ return asyncTempArr;
77
+ });
78
+ }
79
+ }
80
+ CompatibilityManager.requestInfoObj = {};
81
+ exports.default = CompatibilityManager;
82
+ //# sourceMappingURL=CompatibilityManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompatibilityManager.js","sourceRoot":"","sources":["../../src/CompatibilityManager.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,oBAAoB;IAExB,MAAM,CAAO,qBAAqB,CAAC,IAA0B;;YAC3D,MAAM,eAAe,GAAyB,EAAE,CAAA;YAChD,IAAI,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClE,oBAAoB,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;oBACzD,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;wBACd,MAAM,QA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AgB,CAAC,eAAe,CAAC,CAAA;QAC/D,CAAC;KAAA;IAEO,MAAM,CAAO,gBAAgB,CAAC,IAA0B;;YAC9D,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAO,CAAC,EAAE,EAAE;gBAC1D,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;oBACd,OAAO;wBACL,OAAO,EAAE,CAAC,CAAC,eAAe;wBAC1B,IAAI,EAAE,MAAM,CAAC,CAAC,eAAe,EAAE;wBAC/B,SAAS,EAAE,CAAC,CAAC,EAAE;wBACf,UAAU,EAAE,CAAC,CAAC,MAAM;wBACpB,OAAO,EAAE,CAAC,CAAC,OAAO;qBACnB,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,GAAG,EAAE,CAAC,CAAC,GAAG;wBACV,EAAE,EAAE,CAAC,CAAC,EAAE;wBACR,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,OAAO,EAAE,CAAC,CAAC,cAAc;wBACzB,IAAI,EAAE,CAAC,CAAC,cAAc,EAAE;wBACxB,UAAU,EAAE,CAAC,CAAC,SAAS;qBACxB,CAAC;gBACJ,CAAC;YACH,CAAC,CAAA,CAAC,CAAC,CAAC;YAEJ,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;;AA/Dc,mCAAc,GAAuC,EAAE,CAAA;AAmExE,kBAAe,oBAAoB,CAAA"}
@@ -0,0 +1 @@
1
+ import '../../console';
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- require("../console");
7
- const index_1 = __importDefault(require("../index"));
6
+ require("../../console");
7
+ const index_1 = __importDefault(require("../../index"));
8
8
  describe("重写日志", () => {
9
9
  it("log 没有提前设置 url", () => {
10
10
  console.log("log 是否正常打印");
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.test.js","sourceRoot":"","sources":["../../../src/__tests__/console.test.ts"],"names":[],"mappings":";;;;;AAAA,yBAAsB;AACtB,wDAAgC;AAChC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACd,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAC3B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACf,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAC7B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":";;;;AAAa,KAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAA9D,WAAG,UAAE,YAAI,UAAE,aAAK,SAA+C;AAGhE,QAAA,SAAS,GAAG,MAAM,CAAC,KAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const index_1 = __importDefault(require("./index"));
7
+ const common = require('./common');
8
+ console.log = (...data) => {
9
+ index_1.default.log(...data);
10
+ common.log(...data);
11
+ };
12
+ console.warn = (...data) => {
13
+ index_1.default.warn(...data);
14
+ common.warn(...data);
15
+ };
16
+ console.error = (...data) => {
17
+ index_1.default.error(...data);
18
+ common.error(...data);
19
+ };
20
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/console.ts"],"names":[],"mappings":";;;;;AAKA,oDAA6B;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IAC/B,eAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACpB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IAChC,eAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACjC,eAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACtB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const index_1 = __importDefault(require("./index"));
16
+ const utils_1 = require("./utils");
17
+ const common = require('./common');
18
+ global.fetch = (input, init) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const uniqueId = (Date.now() + Math.random()).toString(16);
20
+ index_1.default.uniqueReq(uniqueId, input, init);
21
+ let isFetchFinished = false;
22
+ let isTimeout = false;
23
+ const timeout = index_1.default.getTimeout();
24
+ if (timeout !== null) {
25
+ (0, utils_1.sleep)(timeout).then(() => {
26
+ if (!isFetchFinished) {
27
+ isTimeout = true;
28
+ index_1.default.resTimeout(uniqueId);
29
+ }
30
+ });
31
+ }
32
+ try {
33
+ const response = yield common.tempFetch(input, init);
34
+ isFetchFinished = true;
35
+ if (response instanceof Response && !isTimeout) {
36
+ index_1.default.uniqueRes(uniqueId, response.clone());
37
+ }
38
+ return response;
39
+ }
40
+ catch (error) {
41
+ isFetchFinished = true;
42
+ if (!isTimeout) {
43
+ index_1.default.resResponseError(uniqueId);
44
+ }
45
+ throw new Error(error);
46
+ }
47
+ });
48
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/f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,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;AACH,CAAC,CAAA,CAAC"}
@@ -0,0 +1,2 @@
1
+ import logPlugin from './logPlugin';
2
+ export default logPlugin;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const logPlugin_1 = __importDefault(require("./logPlugin"));
7
+ exports.default = logPlugin_1.default;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AAEpC,kBAAe,mBAAS,CAAC"}
@@ -0,0 +1,32 @@
1
+ declare class LogPlugin {
2
+ private server;
3
+ private baseData;
4
+ private timeout;
5
+ private networkLogger;
6
+ private host;
7
+ private isAuto;
8
+ auto(): void;
9
+ unAuto(): void;
10
+ startRecordLog(): void;
11
+ stopRecordLog(): void;
12
+ startRecordNetwork(): void;
13
+ setBaseUrl(url: string): void;
14
+ setTimeout(timeout: number): void;
15
+ getTimeout(): number;
16
+ setBaseData(data?: Record<string, any>): void;
17
+ private _log;
18
+ tag(tag: string, ...data: any[]): void;
19
+ log(...data: any[]): void;
20
+ warn(...data: any[]): void;
21
+ error(...data: any[]): void;
22
+ uniqueReq(uniqueId: string | undefined, input: RequestInfo | URL, init?: RequestInit): Promise<string>;
23
+ private _res;
24
+ resTimeout(uniqueId: string): Promise<string>;
25
+ resResponseError(uniqueId: string): Promise<string>;
26
+ uniqueRes(uniqueId: string, response?: Response): Promise<string>;
27
+ req(input: RequestInfo | URL, init?: RequestInit): Promise<string>;
28
+ res(id: number, response?: Response): Promise<string>;
29
+ }
30
+ declare const logPlugin: LogPlugin;
31
+ export { LogPlugin };
32
+ export default logPlugin;