@wutiange/log-listener-plugin 2.0.1-alpha.2 → 2.0.1-alpha.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,13 +19,15 @@ const md5_1 = __importDefault(require("crypto-js/md5"));
19
19
  const DEFAULT_PORT = 27751;
20
20
  class Server {
21
21
  constructor(url, timeout = 30000) {
22
- this.baseUrlObj = {};
22
+ this.baseUrlArr = new Set();
23
+ this.urlsObj = new Map();
23
24
  this.baseData = {};
24
25
  this.innerBaseData = {};
25
26
  this.addUrlsListener = (onNewUrlCallback) => {
26
27
  this.urlsListener = onNewUrlCallback;
27
28
  };
28
29
  this.requestJoin = (url, token) => __awaiter(this, void 0, void 0, function* () {
30
+ var _a;
29
31
  const response = yield fetch(url, {
30
32
  method: "POST",
31
33
  headers: {
@@ -33,7 +35,7 @@ class Server {
33
35
  },
34
36
  body: JSON.stringify({
35
37
  token,
36
- model: this.innerBaseData.Model,
38
+ model: (_a = this.innerBaseData.Model) !== null && _a !== void 0 ? _a : `${this.innerBaseData.systemName}v${this.innerBaseData.osVersion}`,
37
39
  id: (0, md5_1.default)(JSON.stringify(this.innerBaseData)).toString(),
38
40
  }),
39
41
  });
@@ -64,15 +66,21 @@ class Server {
64
66
  (0, utils_1.sleep)(this.timeout, true),
65
67
  ]);
66
68
  });
67
- try {
68
- if (Object.keys(this.baseUrlObj).length === 0) {
69
- return;
70
- }
71
- yield Promise.all(this.getUrls().map((e) => __awaiter(this, void 0, void 0, function* () { return request(e, data); })));
72
- }
73
- catch (error) {
74
- logger_1.default.warn(common_1.LOG_KEY, "上报日志失败", error);
69
+ if (this.baseUrlArr.size === 0) {
70
+ return;
75
71
  }
72
+ this.baseUrlArr.forEach((e) => __awaiter(this, void 0, void 0, function* () {
73
+ var _a, _b;
74
+ try {
75
+ yield request(e, data);
76
+ }
77
+ catch (error) {
78
+ if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes("Network request failed")) || ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes("Timeout"))) {
79
+ return;
80
+ }
81
+ logger_1.default.warn(common_1.LOG_KEY, "上报日志失败", error);
82
+ }
83
+ }));
76
84
  });
77
85
  this.log = (data) => __awaiter(this, void 0, void 0, function* () {
78
86
  return this.send("log", data);
@@ -84,7 +92,7 @@ class Server {
84
92
  this.updateUrl(url);
85
93
  }
86
94
  else {
87
- this.setBaseUrlObj(url !== null && url !== void 0 ? url : {});
95
+ this.setBaseUrlArr(url !== null && url !== void 0 ? url : new Set());
88
96
  }
89
97
  this.timeout = timeout;
90
98
  this.innerBaseData = (0, common_1.getBaseData)();
@@ -103,22 +111,34 @@ class Server {
103
111
  var _a;
104
112
  try {
105
113
  const { path, token } = (_a = service.txt) !== null && _a !== void 0 ? _a : {};
106
- if (!(path && token) || this.baseUrlObj[token]) {
114
+ const url = `http://${service.host}:${service.port}`;
115
+ if (!(path && token) || this.baseUrlArr.has(url)) {
107
116
  return;
108
117
  }
109
- const url = `http://${service.host}:${service.port}`;
110
118
  if (!(yield this.requestJoin(`${url}${path}`, token))) {
111
119
  return;
112
120
  }
113
- this.baseUrlObj[token] = url;
121
+ this.baseUrlArr.add(url);
122
+ this.urlsObj.set(service.name, url);
114
123
  if (this.urlsListener) {
115
- this.urlsListener(this.getUrls(), this.baseUrlObj);
124
+ this.urlsListener(this.baseUrlArr);
116
125
  }
117
126
  }
118
127
  catch (error) {
119
128
  logger_1.default.warn(common_1.LOG_KEY, "加入日志系统失败---", error);
120
129
  }
121
130
  }));
131
+ zeroconf.on("remove", (name) => {
132
+ const currentUrl = this.urlsObj.get(name);
133
+ this.baseUrlArr.delete(currentUrl);
134
+ this.urlsObj.delete(name);
135
+ if (this.urlsListener) {
136
+ this.urlsListener(this.baseUrlArr);
137
+ }
138
+ });
139
+ zeroconf.on("error", (err) => {
140
+ logger_1.default.warn(common_1.LOG_KEY, "zeroconf出现错误", err);
141
+ });
122
142
  zeroconf.scan("http", "tcp");
123
143
  }
124
144
  catch (error) {
@@ -129,27 +149,28 @@ class Server {
129
149
  updateTimeout(timeout = 3000) {
130
150
  this.timeout = timeout;
131
151
  }
132
- getUrls() {
133
- return Object.values(this.baseUrlObj).map((e) => {
134
- if ((0, utils_1.hasPort)(e)) {
135
- return e;
136
- }
137
- return `${e}:${DEFAULT_PORT}`;
138
- });
139
- }
140
- updateUrl(url) {
152
+ updateUrl(url = '') {
141
153
  const tempUrl = url.includes("http") ? url : `http://${url}`;
142
154
  if (!url) {
143
- delete this.baseUrlObj["Default"];
155
+ const currentUrl = this.urlsObj.get("Default");
156
+ this.baseUrlArr.delete(currentUrl);
157
+ this.urlsObj.delete("Default");
158
+ }
159
+ else if (!(0, utils_1.hasPort)(tempUrl)) {
160
+ this.updateUrl(`${tempUrl}:${DEFAULT_PORT}`);
144
161
  }
145
162
  else {
146
- this.baseUrlObj["Default"] = tempUrl;
163
+ this.baseUrlArr.add(tempUrl);
164
+ this.urlsObj.set("Default", tempUrl);
147
165
  }
148
166
  }
149
- setBaseUrlObj(urlObj) {
150
- this.baseUrlObj = urlObj;
167
+ setBaseUrlArr(urlArr = new Set()) {
168
+ this.baseUrlArr = urlArr;
169
+ }
170
+ getBaseUrlArr() {
171
+ return this.baseUrlArr;
151
172
  }
152
- updateBaseData(data) {
173
+ updateBaseData(data = {}) {
153
174
  this.baseData = data;
154
175
  }
155
176
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server.js","sourceRoot":"","sources":["../../src/Server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mCAAyC;AAEzC,qCAA2D;AAC3D,sDAA8B;AAC9B,wDAAgC;AAGhC,MAAM,YAAY,GAAG,KAAK,CAAC;AAC3B,MAAM,MAAM;IAQV,YAAY,GAA0B,EAAE,UAAkB,KAAK;QAPvD,eAAU,GAAgB,IAAI,GAAG,EAAE,CAAC;QACpC,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;QAEzC,aAAQ,GAAwB,EAAE,CAAC;QAEnC,kBAAa,GAA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Aa,CAAC,OAAO,GAAG,IAAI;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAyCD,SAAS,CAAC,MAAc,EAAE;QACxB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,EAAE,CAAC;QAC7D,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC/C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;aAAM,IAAI,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,aAAa,CAAC,SAAsB,IAAI,GAAG,EAAE;QAC3C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IAC3B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,cAAc,CAAC,OAA4B,EAAE;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CASF;AAED,kBAAe,MAAM,CAAC"}
package/dist/src/utils.js CHANGED
@@ -44,14 +44,14 @@ function createClassWithErrorHandling(BaseClass) {
44
44
  const result = value.apply(this, args);
45
45
  if (result instanceof Promise) {
46
46
  return result.catch((error) => {
47
- console.error(`Error in ${String(prop)}:`, error);
47
+ logger_1.default.error(`Error in ${String(prop)}:`, error);
48
48
  throw error;
49
49
  });
50
50
  }
51
51
  return result;
52
52
  }
53
53
  catch (error) {
54
- console.error(`Error in ${String(prop)}:`, error);
54
+ logger_1.default.error(`Error in ${String(prop)}:`, error);
55
55
  throw error;
56
56
  }
57
57
  };
@@ -65,14 +65,14 @@ function createClassWithErrorHandling(BaseClass) {
65
65
  const result = value.apply(this, args);
66
66
  if (result instanceof Promise) {
67
67
  return result.catch((error) => {
68
- console.error(`Error in ${String(prop)}:`, error);
68
+ logger_1.default.error(`Error in ${String(prop)}:`, error);
69
69
  throw error;
70
70
  });
71
71
  }
72
72
  return result;
73
73
  }
74
74
  catch (error) {
75
- console.error(`Error in ${String(prop)}:`, error);
75
+ logger_1.default.error(`Error in ${String(prop)}:`, error);
76
76
  throw error;
77
77
  }
78
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;AAGA,sBAQC;AAGD,0BAkBC;AAKD,oEAmDC;AAGD,4CAkBC;AA7GD,0DAA4B;AAC5B,sDAA8B;AAE9B,SAAgB,KAAK,CAAC,EAAU,EAAE,WAAoB,KAAK;IACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;YACjC,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,wCAAwC;YAC7C,OAAO,EAAE,SAAS;SACnB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AAGD,SAAgB,OAAO,CAAC,GAAW;IAEjC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QAEH,MAAM,SA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EAAE,CAAC;IAC3C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,QAAQ,MAAM,CAAC;QAC9B,MAAM,IAAI,wBAAwB,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC;QAC5E,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,iBAAiB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;QAChE,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACxD,MAAM,IAAI,mBAAmB,KAAK,CAAC,MAAM,UAAU,CAAC;QACpD,MAAM,IAAI,GAAG,KAAK,MAAM,CAAC;IAC3B,CAAC;IACD,MAAM,IAAI,KAAK,QAAQ,QAAQ,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- import logPlugin from './src/logPlugin';
2
-
3
- export default logPlugin;
1
+ import logPlugin from './src/logPlugin';
2
+
3
+ export default logPlugin;
package/package.json CHANGED
@@ -1,59 +1,59 @@
1
- {
2
- "name": "@wutiange/log-listener-plugin",
3
- "version": "2.0.1-alpha.2",
4
- "description": "log-record 客户端对应的的插件\r\nLog-record client corresponding plugin",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "source": "index.ts",
8
- "react-native": "index.ts",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/wutiange/log-listener-plugin.git"
12
- },
13
- "author": "wutiange <wutiange20@qq,com>",
14
- "license": "MIT",
15
- "keywords": [
16
- "react-native",
17
- "log",
18
- "debugger",
19
- "charles"
20
- ],
21
- "private": false,
22
- "scripts": {
23
- "build": "npm run test && tsc",
24
- "dev": "ts-node ./index.ts",
25
- "publish-alpha": "npm publish --access public --tag alpha",
26
- "prepublishOnly": "npm run build",
27
- "test": "jest"
28
- },
29
- "devDependencies": {
30
- "@jest/globals": "^29.7.0",
31
- "@types/crypto-js": "^4.2.2",
32
- "@types/jest": "^29.5.12",
33
- "@types/react-native-zeroconf": "^0.13.1",
34
- "@types/url-parse": "^1.4.11",
35
- "jest": "^29.7.0",
36
- "ts-jest": "^29.1.2",
37
- "ts-node": "^10.9.2",
38
- "typescript": "^5.3.3"
39
- },
40
- "peerDependencies": {
41
- "react-native": "*",
42
- "react-native-device-info": "^14.0.0",
43
- "react-native-zeroconf": "^0.13.8",
44
- "@react-native-async-storage/async-storage": "*"
45
- },
46
- "files": [
47
- "package.json",
48
- "README.md",
49
- "LICENSE",
50
- "dist",
51
- "src",
52
- "index.ts",
53
- "tsconfig.json"
54
- ],
55
- "dependencies": {
56
- "crypto-js": "^4.2.0",
57
- "url-parse": "^1.5.10"
58
- }
59
- }
1
+ {
2
+ "name": "@wutiange/log-listener-plugin",
3
+ "version": "2.0.1-alpha.4",
4
+ "description": "log-record 客户端对应的的插件\r\nLog-record client corresponding plugin",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "source": "index.ts",
8
+ "react-native": "index.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/wutiange/log-listener-plugin.git"
12
+ },
13
+ "author": "wutiange <wutiange20@qq,com>",
14
+ "license": "MIT",
15
+ "keywords": [
16
+ "react-native",
17
+ "log",
18
+ "debugger",
19
+ "charles"
20
+ ],
21
+ "private": false,
22
+ "scripts": {
23
+ "build": "npm run test && tsc",
24
+ "dev": "ts-node ./index.ts",
25
+ "publish-alpha": "npm publish --access public --tag alpha",
26
+ "prepublishOnly": "npm run build",
27
+ "test": "jest"
28
+ },
29
+ "devDependencies": {
30
+ "@jest/globals": "^29.7.0",
31
+ "@types/crypto-js": "^4.2.2",
32
+ "@types/jest": "^29.5.12",
33
+ "@types/react-native-zeroconf": "^0.13.1",
34
+ "@types/url-parse": "^1.4.11",
35
+ "jest": "^29.7.0",
36
+ "ts-jest": "^29.1.2",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^5.3.3"
39
+ },
40
+ "peerDependencies": {
41
+ "react-native": "*",
42
+ "react-native-device-info": "^14.0.0",
43
+ "react-native-zeroconf": "^0.13.8",
44
+ "@react-native-async-storage/async-storage": "*"
45
+ },
46
+ "files": [
47
+ "package.json",
48
+ "README.md",
49
+ "LICENSE",
50
+ "dist",
51
+ "src",
52
+ "index.ts",
53
+ "tsconfig.json"
54
+ ],
55
+ "dependencies": {
56
+ "crypto-js": "^4.2.0",
57
+ "url-parse": "^1.5.10"
58
+ }
59
+ }