@tmsfe/tms-core 0.0.91 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -6,7 +6,12 @@ const maxArrLen = 10;
6
6
  const maxStrLen = 200;
7
7
  const maxFieldLen = 20;
8
8
 
9
- function isBasicsType(obj: any): { isBasics: boolean, value: any } {
9
+ // 字符串字段白名单,白名单内的字段不截断
10
+ const fieldWhiteList = [
11
+ 'tmapExtra', // 手图跳过来时附加的加密数据,用于分析用户操作路径,奉刚要求字段不能截断
12
+ ];
13
+
14
+ function isBasicsType(obj: any, isConstraintLen = true): { isBasics: boolean, value: any } {
10
15
  const type = typeof obj;
11
16
  if (obj === null || obj === undefined
12
17
  || type === 'number' || type === 'boolean' || type === 'bigint') {
@@ -19,7 +24,7 @@ function isBasicsType(obj: any): { isBasics: boolean, value: any } {
19
24
  return { isBasics: true, value: '' };
20
25
  }
21
26
 
22
- const value = obj.substring(0, maxStrLen);
27
+ const value = isConstraintLen ? obj.substring(0, maxStrLen) : obj;
23
28
  return { isBasics: true, value };
24
29
  }
25
30
  if (type === 'function' || type === 'symbol') {
@@ -61,7 +66,11 @@ function deepClone(obj: any, depth = 0, maxDepth = 5): any {
61
66
  continue;
62
67
  }
63
68
  const value = obj[name];
64
- const res1 = isBasicsType(value);
69
+ const isConstraintLen = !fieldWhiteList.includes(name);
70
+ if (!isConstraintLen) {
71
+ debugger
72
+ }
73
+ const res1 = isBasicsType(value, isConstraintLen);
65
74
  if (res1.isBasics) {
66
75
  // @ts-ignore
67
76
  newObj[name] = res1.value;
@@ -18,8 +18,11 @@ function proxyNavigateApi(api: string): void {
18
18
  const { url = '' } = args[0] || {};
19
19
  const [path, params = ''] = url.split('?');
20
20
  const data = {};
21
- params.split('&').map((str: string) => {
22
- let [key, value = ''] = str.split('=');
21
+ params.split('&').forEach((str: string) => {
22
+ const [key, val] = str.split('=');
23
+ let value = val || '';
24
+ // 简单判断是否encodeURIComponent字段,如果时的话则抛弃掉
25
+ // 因为在后端会被decode导致反序列化时语法错误
23
26
  if (value.indexOf('%') !== -1) {
24
27
  value = '';
25
28
  }