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

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,4 +33,5 @@ export default class NetworkRequestInfo {
33
33
  getRequestBody(replaceEscaped?: boolean): string;
34
34
  private parseResponseBlob;
35
35
  getResponseBody(): Promise<string>;
36
+ copy(): NetworkRequestInfo;
36
37
  }
@@ -124,6 +124,28 @@ class NetworkRequestInfo {
124
124
  return this.stringifyFormat(body);
125
125
  });
126
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
+ }
127
149
  }
128
150
  exports.default = NetworkRequestInfo;
129
151
  //# sourceMappingURL=NetworkRequestInfo.js.map
@@ -1 +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,GAAW;QAvBxE,OAAE,GAAG,EAAE,CAAC;QACR,SAAI,GAAG,E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;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"}
@@ -16,20 +16,28 @@ class CompatibilityManager {
16
16
  if (Object.keys(CompatibilityManager.requestInfoObj).length === 0) {
17
17
  CompatibilityManager.requestInfoObj = data.reduce((e, c) => {
18
18
  if (c.endTime) {
19
+ const startReq = c.copy();
20
+ startReq.endTime = 0;
21
+ tempWillSendArr.push(startReq, c);
19
22
  return e;
20
23
  }
24
+ tempWillSendArr.push(c);
21
25
  return Object.assign(Object.assign({}, e), { [c.id]: c });
22
26
  }, {});
23
- tempWillSendArr.concat(data);
24
27
  }
25
28
  else {
26
29
  data.forEach(e => {
27
30
  const tempObj = CompatibilityManager.requestInfoObj;
28
31
  if (!(e.id in tempObj)) {
29
- tempWillSendArr.push(e);
30
32
  if (!e.endTime) {
33
+ tempWillSendArr.push(e);
31
34
  CompatibilityManager.requestInfoObj[e.id] = e;
32
35
  }
36
+ else {
37
+ const startReq = e.copy();
38
+ startReq.endTime = 0;
39
+ tempWillSendArr.push(startReq, e);
40
+ }
33
41
  return;
34
42
  }
35
43
  if (e.id in tempObj && e.endTime) {
@@ -1 +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,GA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AAO,oBAAoB,CAAC,gBAAgB,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wutiange/log-listener-plugin",
3
- "version": "1.3.0-alpha.0",
3
+ "version": "1.3.0-alpha.1",
4
4
  "description": "这是log-record的插件,如果需要使用这个日志监听,那么就需要把这个插件安装到项目中",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -130,4 +130,32 @@ export default class NetworkRequestInfo {
130
130
 
131
131
  return this.stringifyFormat(body);
132
132
  }
133
+
134
+ public copy(): NetworkRequestInfo {
135
+ const newInstance = new NetworkRequestInfo(this.id, this.type, this.method, this.url);
136
+
137
+ // 复制基本类型属性
138
+ newInstance.status = this.status;
139
+ newInstance.dataSent = this.dataSent;
140
+ newInstance.responseContentType = this.responseContentType;
141
+ newInstance.responseSize = this.responseSize;
142
+ newInstance.response = this.response;
143
+ newInstance.responseURL = this.responseURL;
144
+ newInstance.responseType = this.responseType;
145
+ newInstance.timeout = this.timeout;
146
+ newInstance.closeReason = this.closeReason;
147
+ newInstance.messages = this.messages;
148
+ newInstance.serverClose = this.serverClose;
149
+ newInstance.serverError = this.serverError;
150
+ newInstance.startTime = this.startTime;
151
+ newInstance.endTime = this.endTime;
152
+ newInstance.gqlOperation = this.gqlOperation;
153
+ newInstance.updatedAt = this.updatedAt;
154
+
155
+ // 深拷贝对象类型属性
156
+ newInstance.requestHeaders = JSON.parse(JSON.stringify(this.requestHeaders));
157
+ newInstance.responseHeaders = JSON.parse(JSON.stringify(this.responseHeaders));
158
+
159
+ return newInstance;
160
+ }
133
161
  }
@@ -7,18 +7,25 @@ class CompatibilityManager {
7
7
  if (Object.keys(CompatibilityManager.requestInfoObj).length === 0) {
8
8
  CompatibilityManager.requestInfoObj = data.reduce((e, c) => {
9
9
  if (c.endTime) {
10
+ const startReq = c.copy()
11
+ startReq.endTime = 0;
12
+ tempWillSendArr.push(startReq, c)
10
13
  return e
11
14
  }
15
+ tempWillSendArr.push(c)
12
16
  return {...e, [c.id]: c}
13
17
  }, {})
14
- tempWillSendArr.concat(data)
15
18
  } else {
16
19
  data.forEach(e => {
17
20
  const tempObj = CompatibilityManager.requestInfoObj
18
21
  if (!(e.id in tempObj)) {
19
- tempWillSendArr.push(e)
20
22
  if (!e.endTime) {
23
+ tempWillSendArr.push(e)
21
24
  CompatibilityManager.requestInfoObj[e.id] = e
25
+ } else {
26
+ const startReq = e.copy()
27
+ startReq.endTime = 0;
28
+ tempWillSendArr.push(startReq, e)
22
29
  }
23
30
  return
24
31
  }