@freelog/tools-lib 0.1.108 → 0.1.111

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.
@@ -1020,7 +1020,8 @@ var Regexp = {
1020
1020
  };
1021
1021
 
1022
1022
  var _excluded = ["resourceID"],
1023
- _excluded2 = ["nodeID", "showPage"];
1023
+ _excluded2 = ["nodeID", "showPage"],
1024
+ _excluded3 = ["nodeID", "showPage"];
1024
1025
  function home(_temp) {
1025
1026
  var _ref = _temp === void 0 ? {} : _temp;
1026
1027
 
@@ -1047,11 +1048,10 @@ function dashboard(_temp3) {
1047
1048
  return "/dashboard";
1048
1049
  }
1049
1050
  function market(_temp4) {
1050
- var _ref5 = _temp4 === void 0 ? {} : _temp4;
1051
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
1052
+ params = _extends({}, _ref5);
1051
1053
 
1052
- _objectDestructuringEmpty(_ref5);
1053
-
1054
- return "/market";
1054
+ return "/market" + handleQuery(params);
1055
1055
  }
1056
1056
  function exampleNodes(_temp5) {
1057
1057
  var _ref6 = _temp5 === void 0 ? {} : _temp5;
@@ -1112,8 +1112,14 @@ function nodeCreator(_temp9) {
1112
1112
  return "/node/creator";
1113
1113
  }
1114
1114
  function nodeManagement(_ref16) {
1115
- var nodeID = _ref16.nodeID;
1116
- return "/node/formal/" + nodeID;
1115
+ var nodeID = _ref16.nodeID,
1116
+ _ref16$showPage = _ref16.showPage,
1117
+ showPage = _ref16$showPage === void 0 ? 'exhibit' : _ref16$showPage,
1118
+ params = _objectWithoutPropertiesLoose(_ref16, _excluded2);
1119
+
1120
+ return "/node/formal/" + nodeID + handleQuery(_extends({
1121
+ showPage: showPage
1122
+ }, params));
1117
1123
  }
1118
1124
  function exhibitManagement(_ref17) {
1119
1125
  var exhibitID = _ref17.exhibitID;
@@ -1123,7 +1129,7 @@ function informNodeManagement(_ref18) {
1123
1129
  var nodeID = _ref18.nodeID,
1124
1130
  _ref18$showPage = _ref18.showPage,
1125
1131
  showPage = _ref18$showPage === void 0 ? 'exhibit' : _ref18$showPage,
1126
- params = _objectWithoutPropertiesLoose(_ref18, _excluded2);
1132
+ params = _objectWithoutPropertiesLoose(_ref18, _excluded3);
1127
1133
 
1128
1134
  return "/node/informal/" + nodeID + handleQuery(_extends({
1129
1135
  showPage: showPage
@@ -1386,7 +1392,7 @@ var Node = {
1386
1392
 
1387
1393
  var _excluded$1 = ["presentableId"],
1388
1394
  _excluded2$1 = ["presentableId"],
1389
- _excluded3 = ["presentableId"],
1395
+ _excluded3$1 = ["presentableId"],
1390
1396
  _excluded4 = ["presentableId"],
1391
1397
  _excluded5 = ["presentableId"],
1392
1398
  _excluded6 = ["presentableId"],
@@ -1437,7 +1443,7 @@ function presentableDetails(params) {
1437
1443
  }
1438
1444
 
1439
1445
  var presentableId = params.presentableId,
1440
- p = _objectWithoutPropertiesLoose(params, _excluded3); // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
1446
+ p = _objectWithoutPropertiesLoose(params, _excluded3$1); // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
1441
1447
  // params: p,
1442
1448
  // });
1443
1449
 
@@ -1563,7 +1569,7 @@ var Exhibit = {
1563
1569
 
1564
1570
  var _excluded$2 = ["bucketName"],
1565
1571
  _excluded2$2 = ["bucketName"],
1566
- _excluded3$1 = ["objectIdOrName"],
1572
+ _excluded3$2 = ["objectIdOrName"],
1567
1573
  _excluded4$1 = ["sha1"],
1568
1574
  _excluded5$1 = ["objectIdOrName"];
1569
1575
  function createBucket(params) {
@@ -1733,7 +1739,7 @@ function uploadImage(params, config) {
1733
1739
  }
1734
1740
  function updateObject(_ref5) {
1735
1741
  var objectIdOrName = _ref5.objectIdOrName,
1736
- params = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);
1742
+ params = _objectWithoutPropertiesLoose(_ref5, _excluded3$2);
1737
1743
 
1738
1744
  return FUtil.Request({
1739
1745
  method: 'PUT',
@@ -1868,7 +1874,7 @@ var Collection = {
1868
1874
 
1869
1875
  var _excluded$3 = ["resourceIdOrName"],
1870
1876
  _excluded2$3 = ["resourceId"],
1871
- _excluded3$2 = ["resourceId"],
1877
+ _excluded3$3 = ["resourceId"],
1872
1878
  _excluded4$2 = ["resourceId"],
1873
1879
  _excluded5$2 = ["resourceId", "version"],
1874
1880
  _excluded6$1 = ["fileSha1"],
@@ -1928,7 +1934,7 @@ function dependencyTree$1(_ref2) {
1928
1934
  }
1929
1935
  function authTree$1(_ref3) {
1930
1936
  var resourceId = _ref3.resourceId,
1931
- params = _objectWithoutPropertiesLoose(_ref3, _excluded3$2);
1937
+ params = _objectWithoutPropertiesLoose(_ref3, _excluded3$3);
1932
1938
 
1933
1939
  return FUtil.Request({
1934
1940
  method: 'GET',
@@ -2104,6 +2110,15 @@ function batchAuth$1(_ref13) {
2104
2110
  params: params
2105
2111
  });
2106
2112
  }
2113
+ function resourcesRecommend(_ref14) {
2114
+ var params = _extends({}, _ref14);
2115
+
2116
+ return FUtil.Request({
2117
+ method: 'GET',
2118
+ url: "/v2/resources/recommend?recommendType=2",
2119
+ params: params
2120
+ });
2121
+ }
2107
2122
 
2108
2123
  var Resource = {
2109
2124
  __proto__: null,
@@ -2130,7 +2145,8 @@ var Resource = {
2130
2145
  cycleDependencyCheck: cycleDependencyCheck$1,
2131
2146
  relationTree: relationTree$1,
2132
2147
  relationTreeAuth: relationTreeAuth,
2133
- batchAuth: batchAuth$1
2148
+ batchAuth: batchAuth$1,
2149
+ resourcesRecommend: resourcesRecommend
2134
2150
  };
2135
2151
 
2136
2152
  var _excluded$4 = ["loginName"];
@@ -2258,6 +2274,26 @@ function registerOrBind(params) {
2258
2274
  method: 'POST',
2259
2275
  url: "/v2/thirdParty/registerOrBind",
2260
2276
  data: params
2277
+ }, {
2278
+ noRedirect: true
2279
+ });
2280
+ }
2281
+ function thirdPartyUnbind(params) {
2282
+ return FUtil.Request({
2283
+ method: 'PUT',
2284
+ url: "/v2/thirdParty/unbind",
2285
+ data: params
2286
+ });
2287
+ }
2288
+ function thirdPartyList(params) {
2289
+ if (params === void 0) {
2290
+ params = {};
2291
+ }
2292
+
2293
+ return FUtil.Request({
2294
+ method: 'GET',
2295
+ url: "/v2/thirdParty/list",
2296
+ data: params
2261
2297
  });
2262
2298
  }
2263
2299
 
@@ -2275,12 +2311,14 @@ var User = {
2275
2311
  verifyLoginPassword: verifyLoginPassword,
2276
2312
  areasProvinces: areasProvinces,
2277
2313
  updateMobileOrEmail: updateMobileOrEmail,
2278
- registerOrBind: registerOrBind
2314
+ registerOrBind: registerOrBind,
2315
+ thirdPartyUnbind: thirdPartyUnbind,
2316
+ thirdPartyList: thirdPartyList
2279
2317
  };
2280
2318
 
2281
2319
  var _excluded$5 = ["nodeId"],
2282
2320
  _excluded2$4 = ["nodeId"],
2283
- _excluded3$3 = ["nodeId"],
2321
+ _excluded3$4 = ["nodeId"],
2284
2322
  _excluded4$3 = ["nodeId"],
2285
2323
  _excluded5$3 = ["nodeId"],
2286
2324
  _excluded6$2 = ["testResourceId"],
@@ -2311,7 +2349,7 @@ function createRules(_ref2) {
2311
2349
  }
2312
2350
  function batchTestResources(_ref3) {
2313
2351
  var nodeId = _ref3.nodeId,
2314
- params = _objectWithoutPropertiesLoose(_ref3, _excluded3$3);
2352
+ params = _objectWithoutPropertiesLoose(_ref3, _excluded3$4);
2315
2353
 
2316
2354
  return FUtil.Request({
2317
2355
  method: 'GET',
@@ -2743,33 +2781,193 @@ var I18n = {
2743
2781
  configsList: configsList
2744
2782
  };
2745
2783
 
2746
- function getFilesSha1Info(_x) {
2784
+ /**
2785
+ * 根据 File 获取 SHA1 Hash 字符串
2786
+ * @param file
2787
+ * @return {Promise<string>}
2788
+ */
2789
+
2790
+ function getSHA1Hash(file) {
2791
+ return new Promise(function (resolve) {
2792
+ var reader = new FileReader();
2793
+
2794
+ reader.onload = function () {
2795
+ var wordArray = lib.WordArray.create(reader.result);
2796
+ var hash = SHA1(wordArray).toString();
2797
+ resolve(hash);
2798
+ };
2799
+
2800
+ reader.readAsArrayBuffer(file);
2801
+ });
2802
+ }
2803
+ /**
2804
+ * 生成随机码
2805
+ */
2806
+
2807
+ function generateRandomCode(strLen) {
2808
+ if (strLen === void 0) {
2809
+ strLen = 5;
2810
+ }
2811
+
2812
+ var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
2813
+ var newStrArr = [];
2814
+
2815
+ for (var i = 0; i < strLen; i++) {
2816
+ newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
2817
+ }
2818
+
2819
+ return newStrArr.join('');
2820
+ }
2821
+ /**
2822
+ * 通过读取 cookies 获取用户 ID
2823
+ */
2824
+
2825
+ function getUserIDByCookies() {
2826
+ var uid = document.cookie.split('; ').find(function (co) {
2827
+ return co.startsWith('uid=');
2828
+ });
2829
+
2830
+ if (!uid) {
2831
+ return -1;
2832
+ }
2833
+
2834
+ return Number(uid.replace('uid=', ''));
2835
+ }
2836
+ function transformServerAPIContractState(_ref) {
2837
+ var status = _ref.status,
2838
+ authStatus = _ref.authStatus;
2839
+
2840
+ if (status === 0) {
2841
+ if (authStatus === 1 || authStatus === 3) {
2842
+ return 'active';
2843
+ }
2844
+
2845
+ if (authStatus === 2) {
2846
+ return 'testActive';
2847
+ }
2848
+
2849
+ if (authStatus === 128) {
2850
+ return 'inactive';
2851
+ }
2852
+ }
2853
+
2854
+ if (status === 1) {
2855
+ return 'terminal';
2856
+ }
2857
+
2858
+ return 'exception';
2859
+ }
2860
+ /**
2861
+ * 暂时休眠
2862
+ * @param ms 休眠时常(毫秒)
2863
+ */
2864
+
2865
+ function promiseSleep(ms) {
2866
+ if (ms === void 0) {
2867
+ ms = 300;
2868
+ }
2869
+
2870
+ return new Promise(function (resolve) {
2871
+ setTimeout(function () {
2872
+ resolve();
2873
+ }, ms);
2874
+ });
2875
+ }
2876
+
2877
+ var Tool = {
2878
+ __proto__: null,
2879
+ getSHA1Hash: getSHA1Hash,
2880
+ generateRandomCode: generateRandomCode,
2881
+ getUserIDByCookies: getUserIDByCookies,
2882
+ transformServerAPIContractState: transformServerAPIContractState,
2883
+ promiseSleep: promiseSleep
2884
+ };
2885
+
2886
+ function getFilesSha1Info(_x, _x2) {
2747
2887
  return _getFilesSha1Info.apply(this, arguments);
2748
2888
  }
2749
2889
 
2750
2890
  function _getFilesSha1Info() {
2751
- _getFilesSha1Info = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
2752
- var sha1, cdPartiallySuccess, cdPartiallyFail, _yield$Storage$filesL, data, all, success, fail;
2891
+ _getFilesSha1Info = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref, cdPartially) {
2892
+ var sha1, needHandleSha1, allData, _yield$Storage$filesL, data, finishedInfo;
2753
2893
 
2754
2894
  return runtime_1.wrap(function _callee$(_context) {
2755
2895
  while (1) {
2756
2896
  switch (_context.prev = _context.next) {
2757
2897
  case 0:
2758
- sha1 = _ref.sha1, cdPartiallySuccess = _ref.cdPartiallySuccess, cdPartiallyFail = _ref.cdPartiallyFail;
2759
- _context.next = 3;
2898
+ sha1 = _ref.sha1;
2899
+
2900
+ if (cdPartially === void 0) {
2901
+ cdPartially = function cdPartially() {
2902
+ return undefined;
2903
+ };
2904
+ }
2905
+
2906
+ if (!(sha1.length === 0)) {
2907
+ _context.next = 4;
2908
+ break;
2909
+ }
2910
+
2911
+ return _context.abrupt("return", []);
2912
+
2913
+ case 4:
2914
+ needHandleSha1 = [].concat(sha1);
2915
+ allData = [];
2916
+
2917
+ case 6:
2918
+
2919
+ _context.next = 9;
2760
2920
  return filesListInfo({
2761
- sha1: sha1
2921
+ sha1: needHandleSha1
2762
2922
  });
2763
2923
 
2764
- case 3:
2924
+ case 9:
2765
2925
  _yield$Storage$filesL = _context.sent;
2766
2926
  data = _yield$Storage$filesL.data;
2767
- all = [];
2768
- success = [];
2769
- fail = [];
2770
- console.log(data, all, success, fail, cdPartiallySuccess, cdPartiallyFail, '093oijsdlkfsjdl');
2927
+ needHandleSha1 = data.filter(function (d) {
2928
+ return d.metaAnalyzeStatus && d.metaAnalyzeStatus === 1;
2929
+ }).map(function (d) {
2930
+ return d.sha1;
2931
+ });
2932
+ finishedInfo = data.filter(function (d) {
2933
+ return !d.metaAnalyzeStatus || d.metaAnalyzeStatus !== 1;
2934
+ }).map(function (d) {
2935
+ var state = 'fail';
2936
+
2937
+ if (!d.metaAnalyzeStatus) {
2938
+ state = 'nonentity';
2939
+ } else if (d.metaAnalyzeStatus === 2) {
2940
+ state = 'success';
2941
+ }
2771
2942
 
2772
- case 9:
2943
+ return {
2944
+ sha1: d.sha1,
2945
+ state: state,
2946
+ info: d
2947
+ };
2948
+ });
2949
+ cdPartially && cdPartially(finishedInfo);
2950
+ allData = [].concat(allData, finishedInfo);
2951
+
2952
+ if (!(needHandleSha1.length === 0)) {
2953
+ _context.next = 17;
2954
+ break;
2955
+ }
2956
+
2957
+ return _context.abrupt("break", 21);
2958
+
2959
+ case 17:
2960
+ _context.next = 19;
2961
+ return promiseSleep(3000);
2962
+
2963
+ case 19:
2964
+ _context.next = 6;
2965
+ break;
2966
+
2967
+ case 21:
2968
+ return _context.abrupt("return", allData);
2969
+
2970
+ case 22:
2773
2971
  case "end":
2774
2972
  return _context.stop();
2775
2973
  }
@@ -2779,7 +2977,7 @@ function _getFilesSha1Info() {
2779
2977
  return _getFilesSha1Info.apply(this, arguments);
2780
2978
  }
2781
2979
 
2782
- var C = {
2980
+ var recombination = {
2783
2981
  __proto__: null,
2784
2982
  getFilesSha1Info: getFilesSha1Info
2785
2983
  };
@@ -2800,7 +2998,7 @@ var FServiceAPI = {
2800
2998
  TestQualification: TestQualification,
2801
2999
  Statistic: Statistic,
2802
3000
  I18n: I18n,
2803
- C: C
3001
+ recombination: recombination
2804
3002
  };
2805
3003
 
2806
3004
  var codeMessage = {
@@ -2958,91 +3156,6 @@ function _request() {
2958
3156
  return _request.apply(this, arguments);
2959
3157
  }
2960
3158
 
2961
- /**
2962
- * 根据 File 获取 SHA1 Hash 字符串
2963
- * @param file
2964
- * @return {Promise<string>}
2965
- */
2966
-
2967
- function getSHA1Hash(file) {
2968
- return new Promise(function (resolve) {
2969
- var reader = new FileReader();
2970
-
2971
- reader.onload = function () {
2972
- var wordArray = lib.WordArray.create(reader.result);
2973
- var hash = SHA1(wordArray).toString();
2974
- resolve(hash);
2975
- };
2976
-
2977
- reader.readAsArrayBuffer(file);
2978
- });
2979
- }
2980
- /**
2981
- * 生成随机码
2982
- */
2983
-
2984
- function generateRandomCode(strLen) {
2985
- if (strLen === void 0) {
2986
- strLen = 5;
2987
- }
2988
-
2989
- var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
2990
- var newStrArr = [];
2991
-
2992
- for (var i = 0; i < strLen; i++) {
2993
- newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
2994
- }
2995
-
2996
- return newStrArr.join('');
2997
- }
2998
- /**
2999
- * 通过读取 cookies 获取用户 ID
3000
- */
3001
-
3002
- function getUserIDByCookies() {
3003
- var uid = document.cookie.split('; ').find(function (co) {
3004
- return co.startsWith('uid=');
3005
- });
3006
-
3007
- if (!uid) {
3008
- return -1;
3009
- }
3010
-
3011
- return Number(uid.replace('uid=', ''));
3012
- }
3013
- function transformServerAPIContractState(_ref) {
3014
- var status = _ref.status,
3015
- authStatus = _ref.authStatus;
3016
-
3017
- if (status === 0) {
3018
- if (authStatus === 1 || authStatus === 3) {
3019
- return 'active';
3020
- }
3021
-
3022
- if (authStatus === 2) {
3023
- return 'testActive';
3024
- }
3025
-
3026
- if (authStatus === 128) {
3027
- return 'inactive';
3028
- }
3029
- }
3030
-
3031
- if (status === 1) {
3032
- return 'terminal';
3033
- }
3034
-
3035
- return 'exception';
3036
- }
3037
-
3038
- var Tool = {
3039
- __proto__: null,
3040
- getSHA1Hash: getSHA1Hash,
3041
- generateRandomCode: generateRandomCode,
3042
- getUserIDByCookies: getUserIDByCookies,
3043
- transformServerAPIContractState: transformServerAPIContractState
3044
- };
3045
-
3046
3159
  var FUtil = {
3047
3160
  Format: Format,
3048
3161
  Regexp: Regexp,