@wutiange/log-listener-plugin 1.3.2 → 2.0.1-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/README.md +130 -24
  2. package/dist/src/HTTPInterceptor.d.ts +1 -0
  3. package/dist/src/HTTPInterceptor.js +12 -9
  4. package/dist/src/HTTPInterceptor.js.map +1 -1
  5. package/dist/src/Server.d.ts +13 -6
  6. package/dist/src/Server.js +119 -41
  7. package/dist/src/Server.js.map +1 -1
  8. package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js +0 -1
  9. package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js.map +1 -1
  10. package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js +0 -1
  11. package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js.map +1 -1
  12. package/dist/src/__tests__/Server.test.js +89 -114
  13. package/dist/src/__tests__/Server.test.js.map +1 -1
  14. package/dist/src/common.d.ts +19 -10
  15. package/dist/src/common.js +63 -4
  16. package/dist/src/common.js.map +1 -1
  17. package/dist/src/logPlugin.d.ts +12 -9
  18. package/dist/src/logPlugin.js +87 -82
  19. package/dist/src/logPlugin.js.map +1 -1
  20. package/dist/src/logger.d.ts +6 -0
  21. package/dist/src/logger.js +16 -0
  22. package/dist/src/logger.js.map +1 -0
  23. package/dist/src/utils.js +12 -7
  24. package/dist/src/utils.js.map +1 -1
  25. package/index.ts +3 -0
  26. package/package.json +18 -12
  27. package/src/HTTPInterceptor.ts +339 -0
  28. package/src/Server.ts +166 -0
  29. package/src/__mocks__/react-native/Libraries/Blob/FileReader.js +45 -0
  30. package/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js +39 -0
  31. package/src/__tests__/HTTPInterceptor.test.ts +322 -0
  32. package/src/__tests__/Server.test.ts +175 -0
  33. package/src/__tests__/utils.test.ts +113 -0
  34. package/src/common.ts +70 -0
  35. package/src/logPlugin.ts +224 -0
  36. package/src/logger.ts +15 -0
  37. package/src/utils.ts +112 -0
  38. package/tsconfig.json +27 -0
@@ -14,141 +14,116 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const Server_1 = __importDefault(require("../Server"));
16
16
  const utils_1 = require("../utils");
17
- jest.mock('../utils', () => ({
18
- hasPort: jest.fn(),
19
- sleep: jest.fn().mockImplementation(() => new Promise(() => { })),
20
- }));
21
- jest.mock('../common', () => ({
22
- tempFetch: jest.fn(),
23
- }));
24
- class MockResponse {
25
- constructor(body) {
26
- this.body = body;
27
- }
28
- text() {
29
- return Promise.resolve(this.body);
30
- }
31
- static [Symbol.hasInstance](instance) {
32
- return instance && typeof instance.text === 'function';
33
- }
34
- }
35
- global.Response = MockResponse;
17
+ jest.mock('../utils', () => {
18
+ const actual = jest.requireActual('../utils');
19
+ return Object.assign(Object.assign({}, actual), { sleep: jest.fn() });
20
+ });
21
+ jest.mock('react-native-zeroconf', () => undefined, { virtual: true });
22
+ global.fetch = jest.fn();
36
23
  describe('Server', () => {
37
24
  let server;
38
- const mockUrl = 'http://example.com';
39
- const mockTimeout = 5000;
40
25
  beforeEach(() => {
41
- server = new Server_1.default(mockUrl, mockTimeout);
42
26
  jest.clearAllMocks();
27
+ global.fetch.mockReset();
43
28
  });
44
- describe('constructor', () => {
45
- it('should initialize with correct url and timeout', () => {
46
- expect(server['baseUrl']).toBe(mockUrl);
47
- expect(server['timeout']).toBe(mockTimeout);
48
- });
49
- it('should use default timeout if not provided', () => {
50
- const defaultServer = new Server_1.default(mockUrl);
51
- expect(defaultServer['timeout']).toBe(3000);
29
+ describe('Constructor and URL Management', () => {
30
+ it('should initialize with default values', () => {
31
+ server = new Server_1.default();
32
+ expect(server.getUrls()).toEqual([]);
52
33
  });
53
- });
54
- describe('updateTimeout', () => {
55
- it('should update the timeout', () => {
56
- server.updateTimeout(10000);
57
- expect(server['timeout']).toBe(10000);
34
+ it('should initialize with custom URL', () => {
35
+ server = new Server_1.default('localhost:8080');
36
+ expect(server.getUrls()).toEqual(['http://localhost:8080']);
58
37
  });
59
- it('should use default timeout if not provided', () => {
60
- server.updateTimeout();
61
- expect(server['timeout']).toBe(3000);
38
+ it('should handle URLs with and without http prefix', () => {
39
+ server = new Server_1.default();
40
+ server.updateUrl('localhost:8080');
41
+ expect(server.getUrls()).toEqual(['http://localhost:8080']);
42
+ server.updateUrl('http://localhost:8080');
43
+ expect(server.getUrls()).toEqual(['http://localhost:8080']);
62
44
  });
63
45
  });
64
- describe('getPort', () => {
65
- it('should return empty string if url has port', () => {
66
- utils_1.hasPort.mockReturnValue(true);
67
- expect(server['getPort']()).toBe('');
46
+ describe('ZeroConf Handling', () => {
47
+ it('should handle case when zeroconf is not available', () => {
48
+ server = new Server_1.default();
49
+ const mockListener = jest.fn();
50
+ server.addUrlsListener(mockListener);
51
+ expect(mockListener).not.toHaveBeenCalled();
68
52
  });
69
- it('should return default port if url has no port', () => {
70
- utils_1.hasPort.mockReturnValue(false);
71
- expect(server['getPort']()).toBe(27751);
53
+ it('should handle case when zeroconf is available', () => {
54
+ const mockZeroconfInstance = {
55
+ on: jest.fn(),
56
+ scan: jest.fn()
57
+ };
58
+ jest.doMock('react-native-zeroconf', () => ({
59
+ __esModule: true,
60
+ default: jest.fn(() => mockZeroconfInstance)
61
+ }), { virtual: true });
62
+ server = new Server_1.default();
63
+ const mockListener = jest.fn();
64
+ server.addUrlsListener(mockListener);
65
+ expect(mockListener).not.toHaveBeenCalled();
72
66
  });
73
67
  });
74
- describe('getUrl', () => {
75
- it('should return correct url with port', () => {
76
- utils_1.hasPort.mockReturnValue(false);
77
- expect(server.getUrl()).toBe(`${mockUrl}:27751`);
78
- });
79
- it('should return correct url without port', () => {
80
- utils_1.hasPort.mockReturnValue(true);
81
- expect(server.getUrl()).toBe(`${mockUrl}:`);
68
+ describe('Data Sending', () => {
69
+ beforeEach(() => {
70
+ server = new Server_1.default('localhost:8080');
71
+ global.fetch.mockImplementation(() => Promise.resolve({ ok: true }));
82
72
  });
83
- });
84
- describe('send', () => {
85
- const mockPath = 'test';
86
- const mockData = { key: 'value' };
87
- const mockResponse = new MockResponse('success');
88
- it('should return null if baseUrl is empty', () => __awaiter(void 0, void 0, void 0, function* () {
89
- server.updateUrl('');
90
- const result = yield server['send'](mockPath, mockData);
91
- expect(result).toBeNull();
92
- }));
93
- it('should return response text on successful fetch', () => __awaiter(void 0, void 0, void 0, function* () {
94
- const common = require('../common');
95
- const mockResponseText = 'success';
96
- const mockResponseObject = new MockResponse(mockResponseText);
97
- common.tempFetch.mockResolvedValue(mockResponseObject);
98
- const result = yield server['send'](mockPath, mockData);
99
- expect(result).toBe(mockResponseText);
100
- expect(common.tempFetch).toHaveBeenCalledWith(`${server.getUrl()}/${mockPath}`, expect.objectContaining({
73
+ it('should send log data', () => __awaiter(void 0, void 0, void 0, function* () {
74
+ const testData = { message: 'test log' };
75
+ yield server.log(testData);
76
+ expect(global.fetch).toHaveBeenCalledWith('http://localhost:8080/log', expect.objectContaining({
101
77
  method: 'POST',
102
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
103
- body: JSON.stringify(mockData),
78
+ headers: {
79
+ 'Content-Type': 'application/json;charset=utf-8'
80
+ },
81
+ body: expect.any(String)
104
82
  }));
105
83
  }));
106
- it('should return null on timeout', () => __awaiter(void 0, void 0, void 0, function* () {
107
- const common = require('../common');
108
- common.tempFetch.mockImplementation(() => new Promise(() => { }));
109
- utils_1.sleep.mockResolvedValue(true);
110
- const result = yield server['send'](mockPath, mockData);
111
- expect(result).toBeNull();
112
- }));
113
- it('should handle Error objects in JSON stringification', () => __awaiter(void 0, void 0, void 0, function* () {
114
- const common = require('../common');
115
- common.tempFetch.mockResolvedValue(mockResponse);
116
- const dataWithError = { error: new Error('Test error') };
117
- yield server['send'](mockPath, dataWithError);
118
- expect(common.tempFetch).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
119
- body: expect.stringContaining('Error: Test error'),
84
+ it('should send network data', () => __awaiter(void 0, void 0, void 0, function* () {
85
+ const testData = { url: 'test.com' };
86
+ yield server.network(testData);
87
+ expect(global.fetch).toHaveBeenCalledWith('http://localhost:8080/network', expect.objectContaining({
88
+ method: 'POST',
89
+ headers: {
90
+ 'Content-Type': 'application/json;charset=utf-8'
91
+ },
92
+ body: expect.any(String)
120
93
  }));
121
94
  }));
122
- it('should return null on fetch error', () => __awaiter(void 0, void 0, void 0, function* () {
123
- const common = require('../common');
124
- common.tempFetch.mockRejectedValue(new Error('Fetch error'));
125
- const result = yield server['send'](mockPath, mockData);
126
- expect(result).toBeNull();
95
+ it('should handle timeout', () => __awaiter(void 0, void 0, void 0, function* () {
96
+ server.updateTimeout(100);
97
+ utils_1.sleep.mockImplementation(() => Promise.reject(new Error('Timeout')));
98
+ const testData = { message: 'test' };
99
+ yield server.log(testData);
100
+ expect(global.fetch).toHaveBeenCalled();
101
+ expect(utils_1.sleep).toHaveBeenCalledWith(100, true);
127
102
  }));
128
- });
129
- describe('updateUrl', () => {
130
- it('should update the baseUrl', () => {
131
- const newUrl = 'http://newexample.com';
132
- server.updateUrl(newUrl);
133
- expect(server['baseUrl']).toBe(newUrl);
134
- });
135
- });
136
- describe('log', () => {
137
- it('should call send with correct path and data', () => __awaiter(void 0, void 0, void 0, function* () {
138
- const sendSpy = jest.spyOn(server, 'send').mockResolvedValue('log result');
139
- const logData = { message: 'Test log' };
140
- const result = yield server.log(logData);
141
- expect(sendSpy).toHaveBeenCalledWith('log', logData);
142
- expect(result).toBe('log result');
103
+ it('should handle errors and send error data', () => __awaiter(void 0, void 0, void 0, function* () {
104
+ global.fetch.mockImplementation(() => Promise.reject(new Error('Network error')));
105
+ const testData = { message: 'test' };
106
+ yield server.log(testData);
107
+ expect(global.fetch).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
108
+ body: expect.stringContaining('log-plugin-internal-error')
109
+ }));
110
+ const lastCall = global.fetch.mock.calls[global.fetch.mock.calls.length - 1];
111
+ const body = JSON.parse(lastCall[1].body);
112
+ expect(body).toMatchObject({
113
+ tag: 'log-plugin-internal-error',
114
+ level: 'error'
115
+ });
143
116
  }));
144
117
  });
145
- describe('network', () => {
146
- it('should call send with correct path and data', () => __awaiter(void 0, void 0, void 0, function* () {
147
- const sendSpy = jest.spyOn(server, 'send').mockResolvedValue('network result');
148
- const networkData = { url: 'http://test.com', status: 200 };
149
- const result = yield server.network(networkData);
150
- expect(sendSpy).toHaveBeenCalledWith('network', networkData);
151
- expect(result).toBe('network result');
118
+ describe('Base Data Management', () => {
119
+ it('should update base data', () => __awaiter(void 0, void 0, void 0, function* () {
120
+ server = new Server_1.default('localhost:8080');
121
+ const baseData = { userId: '123' };
122
+ server.updateBaseData(baseData);
123
+ yield server.log({ message: 'test' });
124
+ expect(global.fetch).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
125
+ body: expect.stringContaining('"userId":"123"')
126
+ }));
152
127
  }));
153
128
  });
154
129
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Server.test.js","sourceRoot":"","sources":["../../../src/__tests__/Server.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAA+B;AAC/B,oCAA0C;AAG1C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;IAClB,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;CACjE,CAAC,CAAC,CAAC;AAGJ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;CACrB,CAAC,CAAC,CAAC;AAGJ,MAAM,YAAY;IAGhB,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAA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,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;aAChD,CAAC,CACH,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,11 +1,20 @@
1
- export declare const log: {
2
- (...data: any[]): void;
3
- (message?: any, ...optionalParams: any[]): void;
4
- }, warn: {
5
- (...data: any[]): void;
6
- (message?: any, ...optionalParams: any[]): void;
7
- }, error: {
8
- (...data: any[]): void;
9
- (message?: any, ...optionalParams: any[]): void;
1
+ export declare const URLS_KEY = "log-listener-plugin-urls$$key";
2
+ export declare const DEFAULT_TIMEOUT = 3000;
3
+ export declare const LOG_KEY = "[@wutiange/log-listener-plugin \u65E5\u5FD7]";
4
+ export declare enum Level {
5
+ LOG = "log",
6
+ WARN = "warn",
7
+ ERROR = "error"
8
+ }
9
+ export declare enum Tag {
10
+ LOG_PLUGIN_INTERNAL_ERROR = "log-plugin-internal-error",
11
+ DEFAULT = "default"
12
+ }
13
+ export declare const getBaseData: () => Record<string, string>;
14
+ export declare const getDefaultStorage: () => Storage;
15
+ export declare const getErrMsg: (error: any) => {
16
+ message: string[];
17
+ tag: Tag;
18
+ level: Level;
19
+ createTime: number;
10
20
  };
11
- export declare const tempFetch: typeof fetch;
@@ -1,7 +1,66 @@
1
1
  "use strict";
2
- var _a;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
3
5
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.tempFetch = exports.error = exports.warn = exports.log = void 0;
5
- _a = [console.log, console.warn, console.error], exports.log = _a[0], exports.warn = _a[1], exports.error = _a[2];
6
- exports.tempFetch = global.fetch;
6
+ exports.getErrMsg = exports.getDefaultStorage = exports.getBaseData = exports.Tag = exports.Level = exports.LOG_KEY = exports.DEFAULT_TIMEOUT = exports.URLS_KEY = void 0;
7
+ const logger_1 = __importDefault(require("./logger"));
8
+ exports.URLS_KEY = 'log-listener-plugin-urls$$key';
9
+ exports.DEFAULT_TIMEOUT = 3000;
10
+ exports.LOG_KEY = '[@wutiange/log-listener-plugin 日志]';
11
+ var Level;
12
+ (function (Level) {
13
+ Level["LOG"] = "log";
14
+ Level["WARN"] = "warn";
15
+ Level["ERROR"] = "error";
16
+ })(Level || (exports.Level = Level = {}));
17
+ var Tag;
18
+ (function (Tag) {
19
+ Tag["LOG_PLUGIN_INTERNAL_ERROR"] = "log-plugin-internal-error";
20
+ Tag["DEFAULT"] = "default";
21
+ })(Tag || (exports.Tag = Tag = {}));
22
+ const getDefaultDeviceINfo = () => {
23
+ try {
24
+ const { Platform } = require('react-native');
25
+ return Object.assign({ SystemName: Platform.OS, Version: Platform.Version }, Platform.constants);
26
+ }
27
+ catch (error) {
28
+ logger_1.default.warn(exports.LOG_KEY, '这个插件只能在 react-native 中使用');
29
+ return {};
30
+ }
31
+ };
32
+ const getBaseData = () => {
33
+ var _a;
34
+ try {
35
+ const DeviceInfo = (_a = require("react-native-device-info")) === null || _a === void 0 ? void 0 : _a.default;
36
+ return Object.assign({ Brand: DeviceInfo.getBrand(), Model: DeviceInfo.getModel(), AppVersion: DeviceInfo.getVersion(), Carrier: DeviceInfo.getCarrierSync(), Manufacturer: DeviceInfo.getManufacturerSync(), SystemName: DeviceInfo.getSystemName() }, getDefaultDeviceINfo());
37
+ }
38
+ catch (error) {
39
+ return getDefaultDeviceINfo();
40
+ }
41
+ };
42
+ exports.getBaseData = getBaseData;
43
+ const getDefaultStorage = () => {
44
+ var _a;
45
+ try {
46
+ const AsyncStorage = (_a = require("@react-native-async-storage/async-storage")) === null || _a === void 0 ? void 0 : _a.default;
47
+ return AsyncStorage;
48
+ }
49
+ catch (error) {
50
+ return null;
51
+ }
52
+ };
53
+ exports.getDefaultStorage = getDefaultStorage;
54
+ const getErrMsg = (error) => {
55
+ var _a;
56
+ return {
57
+ message: [
58
+ `${(_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error}--->这是@wutiange/log-listener-plugin内部错误,请提issue反馈,issue地址:https://github.com/wutiange/log-listener-plugin/issues`,
59
+ ],
60
+ tag: Tag.LOG_PLUGIN_INTERNAL_ERROR,
61
+ level: Level.ERROR,
62
+ createTime: Date.now(),
63
+ };
64
+ };
65
+ exports.getErrMsg = getErrMsg;
7
66
  //# sourceMappingURL=common.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAEjB,QAAA,QAAQ,GAAG,+BAA+B,CAAA;AAC1C,QAAA,eAAe,GAAG,IAAI,CAAA;AACtB,QAAA,OAAO,GAAG,oCAAoC,CAAA;AAC3D,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,oBAAW,CAAA;IACX,sBAAa,CAAA;IACb,wBAAe,CAAA;AACjB,CAAC,EAJW,KAAK,qBAAL,KAAK,QAIhB;AAED,IAAY,GAGX;AAHD,WAAY,GAAG;IACb,8DAAuD,CAAA;IACvD,0BAAmB,CAAA;AACrB,CAAC,EAHW,GAAG,mBAAH,GAAG,QAGd;AAED,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,IAAI,CAAC;QACH,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;QAC1C,uBACE,UAAU,EAAE,QAAQ,CAAC,EAAE,EACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,IACtB,QAAQ,CAAC,SAAS,EACtB;IACH,CAAC;IAAC,OAAO,KAAK,EA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G,EAAE;KACvB,CAAA;AACH,CAAC,CAAA;AAXY,QAAA,SAAS,aAWrB"}
@@ -1,13 +1,23 @@
1
+ type Options = {
2
+ storage?: Storage;
3
+ timeout?: number;
4
+ testUrl?: string;
5
+ isAuto?: boolean;
6
+ baseData?: Record<string, any>;
7
+ };
1
8
  declare class LogPlugin {
2
9
  private server;
3
- private baseData;
4
10
  private timeout;
5
- private host;
6
11
  private isAuto;
12
+ private storage;
13
+ constructor();
14
+ private init;
15
+ config: ({ storage, timeout, testUrl, isAuto, baseData }: Options) => void;
7
16
  auto: () => void;
8
17
  unAuto: () => void;
9
18
  startRecordLog: () => void;
10
19
  stopRecordLog: () => void;
20
+ private handleIgnoredUrls;
11
21
  startRecordNetwork: () => void;
12
22
  setBaseUrl: (url: string) => void;
13
23
  setTimeout: (timeout: number) => void;
@@ -18,13 +28,6 @@ declare class LogPlugin {
18
28
  log: (...data: any[]) => void;
19
29
  warn: (...data: any[]) => void;
20
30
  error: (...data: any[]) => void;
21
- uniqueReq: (uniqueId: string | undefined, input: RequestInfo | URL, init?: RequestInit) => Promise<string>;
22
- private _res;
23
- resTimeout: (uniqueId: string) => Promise<string>;
24
- resResponseError: (uniqueId: string) => Promise<string>;
25
- uniqueRes: (uniqueId: string, response?: Response) => Promise<string>;
26
- req: (input: RequestInfo | URL, init?: RequestInit) => Promise<string>;
27
- res: (id: number, response?: Response) => Promise<string>;
28
31
  }
29
32
  declare const SafeLogPlugin: typeof LogPlugin;
30
33
  declare const logPlugin: LogPlugin;