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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +2 -2
  3. package/console.ts +21 -0
  4. package/dist/src/HTTPInterceptor.d.ts +48 -0
  5. package/dist/src/HTTPInterceptor.js +202 -0
  6. package/dist/src/HTTPInterceptor.js.map +1 -0
  7. package/dist/src/logPlugin.d.ts +19 -20
  8. package/dist/src/logPlugin.js +108 -122
  9. package/dist/src/logPlugin.js.map +1 -1
  10. package/fetch.ts +39 -0
  11. package/index.ts +3 -0
  12. package/package.json +49 -47
  13. package/src/HTTPInterceptor.ts +319 -0
  14. package/src/__tests__/console.test.ts +25 -25
  15. package/src/common.ts +4 -4
  16. package/src/logPlugin.ts +238 -229
  17. package/src/server.ts +66 -66
  18. package/src/utils.ts +47 -47
  19. package/dist/packages/network-logger/Logger.d.ts +0 -28
  20. package/dist/packages/network-logger/Logger.js +0 -192
  21. package/dist/packages/network-logger/Logger.js.map +0 -1
  22. package/dist/packages/network-logger/NetworkRequestInfo.d.ts +0 -37
  23. package/dist/packages/network-logger/NetworkRequestInfo.js +0 -151
  24. package/dist/packages/network-logger/NetworkRequestInfo.js.map +0 -1
  25. package/dist/packages/network-logger/constant.d.ts +0 -2
  26. package/dist/packages/network-logger/constant.js +0 -6
  27. package/dist/packages/network-logger/constant.js.map +0 -1
  28. package/dist/packages/network-logger/types.d.ts +0 -14
  29. package/dist/packages/network-logger/types.js +0 -3
  30. package/dist/packages/network-logger/types.js.map +0 -1
  31. package/dist/packages/network-logger/utils/debounce.d.ts +0 -2
  32. package/dist/packages/network-logger/utils/debounce.js +0 -20
  33. package/dist/packages/network-logger/utils/debounce.js.map +0 -1
  34. package/dist/packages/network-logger/utils/extractHost.d.ts +0 -2
  35. package/dist/packages/network-logger/utils/extractHost.js +0 -9
  36. package/dist/packages/network-logger/utils/extractHost.js.map +0 -1
  37. package/dist/packages/network-logger/utils/fromEntries.d.ts +0 -2
  38. package/dist/packages/network-logger/utils/fromEntries.js +0 -8
  39. package/dist/packages/network-logger/utils/fromEntries.js.map +0 -1
  40. package/dist/packages/network-logger/utils/logger.d.ts +0 -1
  41. package/dist/packages/network-logger/utils/logger.js +0 -6
  42. package/dist/packages/network-logger/utils/logger.js.map +0 -1
  43. package/dist/src/CompatibilityManager.d.ts +0 -27
  44. package/dist/src/CompatibilityManager.js +0 -82
  45. package/dist/src/CompatibilityManager.js.map +0 -1
  46. package/dist/src/console.d.ts +0 -1
  47. package/dist/src/console.js +0 -20
  48. package/dist/src/console.js.map +0 -1
  49. package/dist/src/fetch.d.ts +0 -1
  50. package/dist/src/fetch.js +0 -48
  51. package/dist/src/fetch.js.map +0 -1
  52. package/dist/src/index.d.ts +0 -2
  53. package/dist/src/index.js +0 -8
  54. package/dist/src/index.js.map +0 -1
  55. package/packages/network-logger/Logger.ts +0 -274
  56. package/packages/network-logger/NetworkRequestInfo.ts +0 -161
  57. package/packages/network-logger/constant.ts +0 -3
  58. package/packages/network-logger/types.ts +0 -36
  59. package/packages/network-logger/utils/debounce.ts +0 -21
  60. package/packages/network-logger/utils/extractHost.ts +0 -7
  61. package/packages/network-logger/utils/fromEntries.ts +0 -7
  62. package/packages/network-logger/utils/logger.ts +0 -2
  63. package/src/CompatibilityManager.ts +0 -71
package/src/utils.ts CHANGED
@@ -1,47 +1,47 @@
1
- export function sleep(ms: number, isReject: boolean = false) {
2
- return new Promise((resolve, reject) => {
3
- setTimeout(isReject ? () => reject({
4
- code: 11001,
5
- key: '@wutiange/log-listener-plugin%%timeout',
6
- msg: 'Timeout'
7
- }) : resolve, ms)
8
- })
9
- }
10
-
11
- export function extractDomain(url: string) {
12
- // 如果 url 是空的或不是字符串,直接返回
13
- if (!url || typeof url !== 'string') {
14
- return url;
15
- }
16
-
17
- // 使用正则表达式匹配 URL
18
- const match = url.match(/^(https?:\/\/)?([^/:]+)/i);
19
-
20
- // 如果没有匹配到,返回原始输入
21
- if (!match) {
22
- return url;
23
- }
24
-
25
- // 返回匹配到的域名部分
26
- return match[2];
27
- }
28
-
29
-
30
- export function hasPort(url: string) {
31
- // 如果 url 是空的或不是字符串,返回 false
32
- if (!url || typeof url !== 'string') {
33
- return false;
34
- }
35
-
36
- try {
37
- // 使用 URL 构造函数解析 URL
38
- const parsedUrl = new URL(url);
39
-
40
- // 检查 port 属性是否为空
41
- // 注意:如果使用默认端口(如 HTTP 的 80 或 HTTPS 的 443),port 会是空字符串
42
- return parsedUrl.port !== '';
43
- } catch (error) {
44
- // 如果 URL 无效,捕获错误并返回 false
45
- return false;
46
- }
47
- }
1
+ export function sleep(ms: number, isReject: boolean = false) {
2
+ return new Promise((resolve, reject) => {
3
+ setTimeout(isReject ? () => reject({
4
+ code: 11001,
5
+ key: '@wutiange/log-listener-plugin%%timeout',
6
+ msg: 'Timeout'
7
+ }) : resolve, ms)
8
+ })
9
+ }
10
+
11
+ export function extractDomain(url: string) {
12
+ // 如果 url 是空的或不是字符串,直接返回
13
+ if (!url || typeof url !== 'string') {
14
+ return url;
15
+ }
16
+
17
+ // 使用正则表达式匹配 URL
18
+ const match = url.match(/^(https?:\/\/)?([^/:]+)/i);
19
+
20
+ // 如果没有匹配到,返回原始输入
21
+ if (!match) {
22
+ return url;
23
+ }
24
+
25
+ // 返回匹配到的域名部分
26
+ return match[2];
27
+ }
28
+
29
+
30
+ export function hasPort(url: string) {
31
+ // 如果 url 是空的或不是字符串,返回 false
32
+ if (!url || typeof url !== 'string') {
33
+ return false;
34
+ }
35
+
36
+ try {
37
+ // 使用 URL 构造函数解析 URL
38
+ const parsedUrl = new URL(url);
39
+
40
+ // 检查 port 属性是否为空
41
+ // 注意:如果使用默认端口(如 HTTP 的 80 或 HTTPS 的 443),port 会是空字符串
42
+ return parsedUrl.port !== '';
43
+ } catch (error) {
44
+ // 如果 URL 无效,捕获错误并返回 false
45
+ return false;
46
+ }
47
+ }
@@ -1,28 +0,0 @@
1
- import NetworkRequestInfo from './NetworkRequestInfo';
2
- import type { StartNetworkLoggingOptions } from './types';
3
- export default class Logger {
4
- private requests;
5
- private xhrIdMap;
6
- private maxRequests;
7
- private refreshRate;
8
- private latestRequestUpdatedAt;
9
- private ignoredHosts;
10
- private ignoredUrls;
11
- private ignoredPatterns;
12
- enabled: boolean;
13
- paused: boolean;
14
- callback: (_: NetworkRequestInfo[]) => void;
15
- setCallback: (callback: any) => void;
16
- debouncedCallback: () => void;
17
- private getRequest;
18
- private updateRequest;
19
- private openCallback;
20
- private requestHeadersCallback;
21
- private headerReceivedCallback;
22
- private sendCallback;
23
- private responseCallback;
24
- enableXHRInterception: (options?: StartNetworkLoggingOptions) => void;
25
- getRequests: () => NetworkRequestInfo[];
26
- clearRequests: () => void;
27
- disableXHRInterception: () => void;
28
- }
@@ -1,192 +0,0 @@
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 XHRInterceptor_1 = __importDefault(require("react-native/Libraries/Network/XHRInterceptor"));
7
- const NetworkRequestInfo_1 = __importDefault(require("./NetworkRequestInfo"));
8
- const constant_1 = require("./constant");
9
- const extractHost_1 = __importDefault(require("./utils/extractHost"));
10
- const logger_1 = require("./utils/logger");
11
- const debounce_1 = __importDefault(require("./utils/debounce"));
12
- let nextXHRId = 0;
13
- class Logger {
14
- constructor() {
15
- this.requests = [];
16
- this.xhrIdMap = new Map();
17
- this.maxRequests = constant_1.LOGGER_MAX_REQUESTS;
18
- this.refreshRate = constant_1.LOGGER_REFRESH_RATE;
19
- this.latestRequestUpdatedAt = 0;
20
- this.enabled = false;
21
- this.paused = false;
22
- this.callback = (_) => null;
23
- this.setCallback = (callback) => {
24
- this.callback = callback;
25
- };
26
- this.debouncedCallback = (0, debounce_1.default)(() => {
27
- if (!this.latestRequestUpdatedAt ||
28
- this.requests.some(r => r.updatedAt > this.latestRequestUpdatedAt)) {
29
- this.latestRequestUpdatedAt = Date.now();
30
- this.callback([...this.requests]);
31
- }
32
- }, this.refreshRate);
33
- this.getRequest = (xhrIndex) => {
34
- if (xhrIndex === undefined) {
35
- return undefined;
36
- }
37
- if (!this.xhrIdMap.has(xhrIndex)) {
38
- return undefined;
39
- }
40
- const index = this.xhrIdMap.get(xhrIndex)();
41
- return this.requests[index];
42
- };
43
- this.updateRequest = (index, update) => {
44
- const networkInfo = this.getRequest(index);
45
- if (!networkInfo) {
46
- return;
47
- }
48
- networkInfo.update(update);
49
- };
50
- this.openCallback = (method, url, xhr) => {
51
- if (this.paused) {
52
- return;
53
- }
54
- if (this.ignoredHosts) {
55
- const host = (0, extractHost_1.default)(url);
56
- if (host && this.ignoredHosts.has(host)) {
57
- return;
58
- }
59
- }
60
- if (this.ignoredUrls && this.ignoredUrls.has(url)) {
61
- return;
62
- }
63
- if (this.ignoredPatterns) {
64
- if (this.ignoredPatterns.some(pattern => pattern.test(`${method} ${url}`))) {
65
- return;
66
- }
67
- }
68
- xhr._index = nextXHRId++;
69
- this.xhrIdMap.set(xhr._index, () => {
70
- return this.requests.findIndex(r => r.id === `${xhr._index}`);
71
- });
72
- const newRequest = new NetworkRequestInfo_1.default(`${xhr._index}`, 'XMLHttpRequest', method, url);
73
- if (this.requests.length >= this.maxRequests) {
74
- this.requests.pop();
75
- }
76
- this.requests.unshift(newRequest);
77
- };
78
- this.requestHeadersCallback = (header, value, xhr) => {
79
- const networkInfo = this.getRequest(xhr._index);
80
- if (!networkInfo) {
81
- return;
82
- }
83
- networkInfo.requestHeaders[header] = value;
84
- };
85
- this.headerReceivedCallback = (responseContentType, responseSize, responseHeaders, xhr) => {
86
- this.updateRequest(xhr._index, {
87
- responseContentType,
88
- responseSize,
89
- responseHeaders: xhr.responseHeaders,
90
- });
91
- };
92
- this.sendCallback = (data, xhr) => {
93
- this.updateRequest(xhr._index, {
94
- startTime: Date.now(),
95
- dataSent: data,
96
- });
97
- this.debouncedCallback();
98
- };
99
- this.responseCallback = (status, timeout, response, responseURL, responseType, xhr) => {
100
- this.updateRequest(xhr._index, {
101
- endTime: Date.now(),
102
- status,
103
- timeout,
104
- response,
105
- responseURL,
106
- responseType,
107
- });
108
- this.debouncedCallback();
109
- };
110
- this.enableXHRInterception = (options) => {
111
- if (this.enabled ||
112
- (XHRInterceptor_1.default.isInterceptorEnabled() && !(options === null || options === void 0 ? void 0 : options.forceEnable))) {
113
- if (!this.enabled) {
114
- (0, logger_1.warn)('network interceptor has not been enabled as another interceptor is already running (e.g. another debugging program). Use option `forceEnable: true` to override this behaviour.');
115
- }
116
- return;
117
- }
118
- if ((options === null || options === void 0 ? void 0 : options.maxRequests) !== undefined) {
119
- if (typeof options.maxRequests !== 'number' || options.maxRequests < 1) {
120
- (0, logger_1.warn)('maxRequests must be a number greater than 0. The logger has not been started.');
121
- return;
122
- }
123
- this.maxRequests = options.maxRequests;
124
- }
125
- if (options === null || options === void 0 ? void 0 : options.ignoredHosts) {
126
- if (!Array.isArray(options.ignoredHosts) ||
127
- typeof options.ignoredHosts[0] !== 'string') {
128
- (0, logger_1.warn)('ignoredHosts must be an array of strings. The logger has not been started.');
129
- return;
130
- }
131
- this.ignoredHosts = new Set(options.ignoredHosts);
132
- }
133
- if (options === null || options === void 0 ? void 0 : options.refreshRate) {
134
- if (typeof options.refreshRate !== 'number' || options.refreshRate < 1) {
135
- (0, logger_1.warn)('refreshRate must be a number greater than 0. The logger has not been started.');
136
- return;
137
- }
138
- this.refreshRate = options.refreshRate;
139
- }
140
- if (options === null || options === void 0 ? void 0 : options.ignoredPatterns) {
141
- this.ignoredPatterns = options.ignoredPatterns;
142
- }
143
- if (options === null || options === void 0 ? void 0 : options.ignoredUrls) {
144
- if (!Array.isArray(options.ignoredUrls) ||
145
- typeof options.ignoredUrls[0] !== 'string') {
146
- (0, logger_1.warn)('ignoredUrls must be an array of strings. The logger has not been started.');
147
- return;
148
- }
149
- this.ignoredUrls = new Set(options.ignoredUrls);
150
- }
151
- XHRInterceptor_1.default.setOpenCallback(this.openCallback);
152
- XHRInterceptor_1.default.setRequestHeaderCallback(this.requestHeadersCallback);
153
- XHRInterceptor_1.default.setHeaderReceivedCallback(this.headerReceivedCallback);
154
- XHRInterceptor_1.default.setSendCallback(this.sendCallback);
155
- XHRInterceptor_1.default.setResponseCallback(this.responseCallback);
156
- XHRInterceptor_1.default.enableInterception();
157
- this.enabled = true;
158
- };
159
- this.getRequests = () => {
160
- return this.requests;
161
- };
162
- this.clearRequests = () => {
163
- this.requests = [];
164
- this.latestRequestUpdatedAt = 0;
165
- this.debouncedCallback();
166
- };
167
- this.disableXHRInterception = () => {
168
- if (!this.enabled) {
169
- return;
170
- }
171
- this.clearRequests();
172
- nextXHRId = 0;
173
- this.enabled = false;
174
- this.paused = false;
175
- this.xhrIdMap.clear();
176
- this.maxRequests = constant_1.LOGGER_MAX_REQUESTS;
177
- this.refreshRate = constant_1.LOGGER_REFRESH_RATE;
178
- this.ignoredHosts = undefined;
179
- this.ignoredUrls = undefined;
180
- this.ignoredPatterns = undefined;
181
- const noop = () => null;
182
- XHRInterceptor_1.default.setOpenCallback(noop);
183
- XHRInterceptor_1.default.setRequestHeaderCallback(noop);
184
- XHRInterceptor_1.default.setHeaderReceivedCallback(noop);
185
- XHRInterceptor_1.default.setSendCallback(noop);
186
- XHRInterceptor_1.default.setResponseCallback(noop);
187
- XHRInterceptor_1.default.disableInterception();
188
- };
189
- }
190
- }
191
- exports.default = Logger;
192
- //# sourceMappingURL=Logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../packages/network-logger/Logger.ts"],"names":[],"mappings":";;;;;AACA,mGAA2E;AAC3E,8EAAsD;AAEtD,yCAAoE;AACpE,sEAA8C;AAC9C,2CAAoC;AACpC,gEAAwC;AAExC,IAAI,SAAS,GAAG,CAAC,CAAC;AAQlB,MAAqB,MAAM;IAA3B;QACU,aAAQ,GAAyB,EAAE,CAAC;QACpC,aAAQ,GAA8B,IAAI,GAAG,EAAE,CAA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o {
3
- id: string;
4
- type: string;
5
- url: string;
6
- method: RequestMethod;
7
- status: number;
8
- dataSent: string;
9
- responseContentType: string;
10
- responseSize: number;
11
- requestHeaders: Headers;
12
- responseHeaders: Headers;
13
- response: string;
14
- responseURL: string;
15
- responseType: string;
16
- timeout: number;
17
- closeReason: string;
18
- messages: string;
19
- serverClose: any;
20
- serverError: any;
21
- startTime: number;
22
- endTime: number;
23
- gqlOperation?: string;
24
- updatedAt: number;
25
- constructor(id: string, type: string, method: RequestMethod, url: string);
26
- get duration(): number;
27
- get curlRequest(): string;
28
- update(values: Partial<NetworkRequestInfo>): void;
29
- private escapeQuotes;
30
- private parseData;
31
- private stringifyFormat;
32
- toRow(): NetworkRequestInfoRow;
33
- getRequestBody(replaceEscaped?: boolean): string;
34
- private parseResponseBlob;
35
- getResponseBody(): Promise<string>;
36
- copy(): NetworkRequestInfo;
37
- }
@@ -1,151 +0,0 @@
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.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;QAC3D,WAAW,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACrC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,WAAW,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,WAAW,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"}
@@ -1,2 +0,0 @@
1
- export declare const LOGGER_MAX_REQUESTS: number;
2
- export declare const LOGGER_REFRESH_RATE: number;
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,14 +0,0 @@
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'>;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../packages/network-logger/types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- declare function debounce(func: Function, wait: number, immediate?: boolean): () => void;
2
- export default debounce;
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- declare const extractHost: (url: string) => string;
2
- export default extractHost;
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- declare const fromEntries: (arr: any[]) => any;
2
- export default fromEntries;
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- export declare const warn: (message: string) => void;
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}