@freelog/tools-lib 0.1.107 → 0.1.110

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.
@@ -13,6 +13,7 @@ import * as Activity from './activities';
13
13
  import * as TestQualification from './testQualifications';
14
14
  import * as Statistic from './statistics';
15
15
  import * as I18n from './i18n';
16
+ import * as recombination from './recombinations';
16
17
  declare const FServiceAPI: {
17
18
  Node: typeof Node;
18
19
  Exhibit: typeof Exhibit;
@@ -29,5 +30,6 @@ declare const FServiceAPI: {
29
30
  TestQualification: typeof TestQualification;
30
31
  Statistic: typeof Statistic;
31
32
  I18n: typeof I18n;
33
+ recombination: typeof recombination;
32
34
  };
33
35
  export default FServiceAPI;
@@ -0,0 +1,12 @@
1
+ interface FileInfo {
2
+ sha1: string;
3
+ state: 'success' | 'fail' | 'nonentity';
4
+ info: {
5
+ [key: string]: any;
6
+ };
7
+ }
8
+ interface GetFileInfosBySha1Params {
9
+ sha1: string[];
10
+ }
11
+ export declare function getFilesSha1Info({ sha1 }: GetFileInfosBySha1Params, cdPartially?: (s: any[]) => void): Promise<FileInfo[]>;
12
+ export {};
@@ -15,7 +15,7 @@ interface IResourceInfo {
15
15
  }[];
16
16
  resourceId: string;
17
17
  resourceName: string;
18
- resourceType: string;
18
+ resourceType: string[];
19
19
  resourceVersions: {
20
20
  createDate: string;
21
21
  version: string;
@@ -117,4 +117,8 @@ interface ClearUserNodeDataParamsType {
117
117
  nodeDomains?: string[];
118
118
  }
119
119
  export declare function clearUserNodeData({ ...params }: ClearUserNodeDataParamsType): Promise<any>;
120
+ interface FilesListInfoParamsType {
121
+ sha1: string[];
122
+ }
123
+ export declare function filesListInfo({ ...params }: FilesListInfoParamsType): Promise<any>;
120
124
  export {};
@@ -62,4 +62,10 @@ interface UpdateMobileOrEmailParamsType {
62
62
  newLoginName: string;
63
63
  }
64
64
  export declare function updateMobileOrEmail(params: UpdateMobileOrEmailParamsType): Promise<any>;
65
+ interface RegisterOrBindParamsType {
66
+ loginName: string;
67
+ password: string;
68
+ identityId: string;
69
+ }
70
+ export declare function registerOrBind(params: RegisterOrBindParamsType): Promise<any>;
65
71
  export {};
@@ -1026,7 +1026,8 @@ var Regexp = {
1026
1026
  };
1027
1027
 
1028
1028
  var _excluded = ["resourceID"],
1029
- _excluded2 = ["nodeID", "showPage"];
1029
+ _excluded2 = ["nodeID", "showPage"],
1030
+ _excluded3 = ["nodeID", "showPage"];
1030
1031
  function home(_temp) {
1031
1032
  var _ref = _temp === void 0 ? {} : _temp;
1032
1033
 
@@ -1053,11 +1054,12 @@ function dashboard(_temp3) {
1053
1054
  return "/dashboard";
1054
1055
  }
1055
1056
  function market(_temp4) {
1056
- var _ref5 = _temp4 === void 0 ? {} : _temp4;
1057
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
1058
+ query = _ref5.query;
1057
1059
 
1058
- _objectDestructuringEmpty(_ref5);
1059
-
1060
- return "/market";
1060
+ return "/market" + handleQuery({
1061
+ query: query
1062
+ });
1061
1063
  }
1062
1064
  function exampleNodes(_temp5) {
1063
1065
  var _ref6 = _temp5 === void 0 ? {} : _temp5;
@@ -1118,8 +1120,14 @@ function nodeCreator(_temp9) {
1118
1120
  return "/node/creator";
1119
1121
  }
1120
1122
  function nodeManagement(_ref16) {
1121
- var nodeID = _ref16.nodeID;
1122
- return "/node/formal/" + nodeID;
1123
+ var nodeID = _ref16.nodeID,
1124
+ _ref16$showPage = _ref16.showPage,
1125
+ showPage = _ref16$showPage === void 0 ? 'exhibit' : _ref16$showPage,
1126
+ params = _objectWithoutPropertiesLoose(_ref16, _excluded2);
1127
+
1128
+ return "/node/formal/" + nodeID + handleQuery(_extends({
1129
+ showPage: showPage
1130
+ }, params));
1123
1131
  }
1124
1132
  function exhibitManagement(_ref17) {
1125
1133
  var exhibitID = _ref17.exhibitID;
@@ -1129,7 +1137,7 @@ function informNodeManagement(_ref18) {
1129
1137
  var nodeID = _ref18.nodeID,
1130
1138
  _ref18$showPage = _ref18.showPage,
1131
1139
  showPage = _ref18$showPage === void 0 ? 'exhibit' : _ref18$showPage,
1132
- params = _objectWithoutPropertiesLoose(_ref18, _excluded2);
1140
+ params = _objectWithoutPropertiesLoose(_ref18, _excluded3);
1133
1141
 
1134
1142
  return "/node/informal/" + nodeID + handleQuery(_extends({
1135
1143
  showPage: showPage
@@ -1392,7 +1400,7 @@ var Node = {
1392
1400
 
1393
1401
  var _excluded$1 = ["presentableId"],
1394
1402
  _excluded2$1 = ["presentableId"],
1395
- _excluded3 = ["presentableId"],
1403
+ _excluded3$1 = ["presentableId"],
1396
1404
  _excluded4 = ["presentableId"],
1397
1405
  _excluded5 = ["presentableId"],
1398
1406
  _excluded6 = ["presentableId"],
@@ -1443,7 +1451,7 @@ function presentableDetails(params) {
1443
1451
  }
1444
1452
 
1445
1453
  var presentableId = params.presentableId,
1446
- p = _objectWithoutPropertiesLoose(params, _excluded3); // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
1454
+ p = _objectWithoutPropertiesLoose(params, _excluded3$1); // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
1447
1455
  // params: p,
1448
1456
  // });
1449
1457
 
@@ -1569,7 +1577,7 @@ var Exhibit = {
1569
1577
 
1570
1578
  var _excluded$2 = ["bucketName"],
1571
1579
  _excluded2$2 = ["bucketName"],
1572
- _excluded3$1 = ["objectIdOrName"],
1580
+ _excluded3$2 = ["objectIdOrName"],
1573
1581
  _excluded4$1 = ["sha1"],
1574
1582
  _excluded5$1 = ["objectIdOrName"];
1575
1583
  function createBucket(params) {
@@ -1739,7 +1747,7 @@ function uploadImage(params, config) {
1739
1747
  }
1740
1748
  function updateObject(_ref5) {
1741
1749
  var objectIdOrName = _ref5.objectIdOrName,
1742
- params = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);
1750
+ params = _objectWithoutPropertiesLoose(_ref5, _excluded3$2);
1743
1751
 
1744
1752
  return FUtil.Request({
1745
1753
  method: 'PUT',
@@ -1783,6 +1791,15 @@ function clearUserNodeData(_ref8) {
1783
1791
  data: params
1784
1792
  });
1785
1793
  }
1794
+ function filesListInfo(_ref9) {
1795
+ var params = _extends({}, _ref9);
1796
+
1797
+ return FUtil.Request({
1798
+ method: 'GET',
1799
+ url: "/v2/storages/files/list/info",
1800
+ params: params
1801
+ });
1802
+ }
1786
1803
 
1787
1804
  var Storage = {
1788
1805
  __proto__: null,
@@ -1805,7 +1822,8 @@ var Storage = {
1805
1822
  batchObjectList: batchObjectList,
1806
1823
  fileProperty: fileProperty,
1807
1824
  cycleDependencyCheck: cycleDependencyCheck,
1808
- clearUserNodeData: clearUserNodeData
1825
+ clearUserNodeData: clearUserNodeData,
1826
+ filesListInfo: filesListInfo
1809
1827
  };
1810
1828
 
1811
1829
  function collectResource(params) {
@@ -1864,7 +1882,7 @@ var Collection = {
1864
1882
 
1865
1883
  var _excluded$3 = ["resourceIdOrName"],
1866
1884
  _excluded2$3 = ["resourceId"],
1867
- _excluded3$2 = ["resourceId"],
1885
+ _excluded3$3 = ["resourceId"],
1868
1886
  _excluded4$2 = ["resourceId"],
1869
1887
  _excluded5$2 = ["resourceId", "version"],
1870
1888
  _excluded6$1 = ["fileSha1"],
@@ -1924,7 +1942,7 @@ function dependencyTree$1(_ref2) {
1924
1942
  }
1925
1943
  function authTree$1(_ref3) {
1926
1944
  var resourceId = _ref3.resourceId,
1927
- params = _objectWithoutPropertiesLoose(_ref3, _excluded3$2);
1945
+ params = _objectWithoutPropertiesLoose(_ref3, _excluded3$3);
1928
1946
 
1929
1947
  return FUtil.Request({
1930
1948
  method: 'GET',
@@ -2249,6 +2267,15 @@ function updateMobileOrEmail(params) {
2249
2267
  data: params
2250
2268
  });
2251
2269
  }
2270
+ function registerOrBind(params) {
2271
+ return FUtil.Request({
2272
+ method: 'POST',
2273
+ url: "/v2/thirdParty/registerOrBind",
2274
+ data: params
2275
+ }, {
2276
+ noRedirect: true
2277
+ });
2278
+ }
2252
2279
 
2253
2280
  var User = {
2254
2281
  __proto__: null,
@@ -2263,12 +2290,13 @@ var User = {
2263
2290
  updateDetailInfo: updateDetailInfo,
2264
2291
  verifyLoginPassword: verifyLoginPassword,
2265
2292
  areasProvinces: areasProvinces,
2266
- updateMobileOrEmail: updateMobileOrEmail
2293
+ updateMobileOrEmail: updateMobileOrEmail,
2294
+ registerOrBind: registerOrBind
2267
2295
  };
2268
2296
 
2269
2297
  var _excluded$5 = ["nodeId"],
2270
2298
  _excluded2$4 = ["nodeId"],
2271
- _excluded3$3 = ["nodeId"],
2299
+ _excluded3$4 = ["nodeId"],
2272
2300
  _excluded4$3 = ["nodeId"],
2273
2301
  _excluded5$3 = ["nodeId"],
2274
2302
  _excluded6$2 = ["testResourceId"],
@@ -2299,7 +2327,7 @@ function createRules(_ref2) {
2299
2327
  }
2300
2328
  function batchTestResources(_ref3) {
2301
2329
  var nodeId = _ref3.nodeId,
2302
- params = _objectWithoutPropertiesLoose(_ref3, _excluded3$3);
2330
+ params = _objectWithoutPropertiesLoose(_ref3, _excluded3$4);
2303
2331
 
2304
2332
  return FUtil.Request({
2305
2333
  method: 'GET',
@@ -2731,6 +2759,207 @@ var I18n = {
2731
2759
  configsList: configsList
2732
2760
  };
2733
2761
 
2762
+ /**
2763
+ * 根据 File 获取 SHA1 Hash 字符串
2764
+ * @param file
2765
+ * @return {Promise<string>}
2766
+ */
2767
+
2768
+ function getSHA1Hash(file) {
2769
+ return new Promise(function (resolve) {
2770
+ var reader = new FileReader();
2771
+
2772
+ reader.onload = function () {
2773
+ var wordArray = CryptoJS.lib.WordArray.create(reader.result);
2774
+ var hash = CryptoJS.SHA1(wordArray).toString();
2775
+ resolve(hash);
2776
+ };
2777
+
2778
+ reader.readAsArrayBuffer(file);
2779
+ });
2780
+ }
2781
+ /**
2782
+ * 生成随机码
2783
+ */
2784
+
2785
+ function generateRandomCode(strLen) {
2786
+ if (strLen === void 0) {
2787
+ strLen = 5;
2788
+ }
2789
+
2790
+ var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
2791
+ var newStrArr = [];
2792
+
2793
+ for (var i = 0; i < strLen; i++) {
2794
+ newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
2795
+ }
2796
+
2797
+ return newStrArr.join('');
2798
+ }
2799
+ /**
2800
+ * 通过读取 cookies 获取用户 ID
2801
+ */
2802
+
2803
+ function getUserIDByCookies() {
2804
+ var uid = document.cookie.split('; ').find(function (co) {
2805
+ return co.startsWith('uid=');
2806
+ });
2807
+
2808
+ if (!uid) {
2809
+ return -1;
2810
+ }
2811
+
2812
+ return Number(uid.replace('uid=', ''));
2813
+ }
2814
+ function transformServerAPIContractState(_ref) {
2815
+ var status = _ref.status,
2816
+ authStatus = _ref.authStatus;
2817
+
2818
+ if (status === 0) {
2819
+ if (authStatus === 1 || authStatus === 3) {
2820
+ return 'active';
2821
+ }
2822
+
2823
+ if (authStatus === 2) {
2824
+ return 'testActive';
2825
+ }
2826
+
2827
+ if (authStatus === 128) {
2828
+ return 'inactive';
2829
+ }
2830
+ }
2831
+
2832
+ if (status === 1) {
2833
+ return 'terminal';
2834
+ }
2835
+
2836
+ return 'exception';
2837
+ }
2838
+ /**
2839
+ * 暂时休眠
2840
+ * @param ms 休眠时常(毫秒)
2841
+ */
2842
+
2843
+ function promiseSleep(ms) {
2844
+ if (ms === void 0) {
2845
+ ms = 300;
2846
+ }
2847
+
2848
+ return new Promise(function (resolve) {
2849
+ setTimeout(function () {
2850
+ resolve();
2851
+ }, ms);
2852
+ });
2853
+ }
2854
+
2855
+ var Tool = {
2856
+ __proto__: null,
2857
+ getSHA1Hash: getSHA1Hash,
2858
+ generateRandomCode: generateRandomCode,
2859
+ getUserIDByCookies: getUserIDByCookies,
2860
+ transformServerAPIContractState: transformServerAPIContractState,
2861
+ promiseSleep: promiseSleep
2862
+ };
2863
+
2864
+ function getFilesSha1Info(_x, _x2) {
2865
+ return _getFilesSha1Info.apply(this, arguments);
2866
+ }
2867
+
2868
+ function _getFilesSha1Info() {
2869
+ _getFilesSha1Info = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref, cdPartially) {
2870
+ var sha1, needHandleSha1, allData, _yield$Storage$filesL, data, finishedInfo;
2871
+
2872
+ return runtime_1.wrap(function _callee$(_context) {
2873
+ while (1) {
2874
+ switch (_context.prev = _context.next) {
2875
+ case 0:
2876
+ sha1 = _ref.sha1;
2877
+
2878
+ if (cdPartially === void 0) {
2879
+ cdPartially = function cdPartially() {
2880
+ return undefined;
2881
+ };
2882
+ }
2883
+
2884
+ if (!(sha1.length === 0)) {
2885
+ _context.next = 4;
2886
+ break;
2887
+ }
2888
+
2889
+ return _context.abrupt("return", []);
2890
+
2891
+ case 4:
2892
+ needHandleSha1 = [].concat(sha1);
2893
+ allData = [];
2894
+
2895
+ case 6:
2896
+
2897
+ _context.next = 9;
2898
+ return filesListInfo({
2899
+ sha1: needHandleSha1
2900
+ });
2901
+
2902
+ case 9:
2903
+ _yield$Storage$filesL = _context.sent;
2904
+ data = _yield$Storage$filesL.data;
2905
+ needHandleSha1 = data.filter(function (d) {
2906
+ return d.metaAnalyzeStatus && d.metaAnalyzeStatus === 1;
2907
+ }).map(function (d) {
2908
+ return d.sha1;
2909
+ });
2910
+ finishedInfo = data.filter(function (d) {
2911
+ return !d.metaAnalyzeStatus || d.metaAnalyzeStatus !== 1;
2912
+ }).map(function (d) {
2913
+ var state = 'fail';
2914
+
2915
+ if (!d.metaAnalyzeStatus) {
2916
+ state = 'nonentity';
2917
+ } else if (d.metaAnalyzeStatus === 2) {
2918
+ state = 'success';
2919
+ }
2920
+
2921
+ return {
2922
+ sha1: d.sha1,
2923
+ state: state,
2924
+ info: d
2925
+ };
2926
+ });
2927
+ cdPartially && cdPartially(finishedInfo);
2928
+ allData = [].concat(allData, finishedInfo);
2929
+
2930
+ if (!(needHandleSha1.length === 0)) {
2931
+ _context.next = 17;
2932
+ break;
2933
+ }
2934
+
2935
+ return _context.abrupt("break", 21);
2936
+
2937
+ case 17:
2938
+ _context.next = 19;
2939
+ return promiseSleep(3000);
2940
+
2941
+ case 19:
2942
+ _context.next = 6;
2943
+ break;
2944
+
2945
+ case 21:
2946
+ return _context.abrupt("return", allData);
2947
+
2948
+ case 22:
2949
+ case "end":
2950
+ return _context.stop();
2951
+ }
2952
+ }
2953
+ }, _callee);
2954
+ }));
2955
+ return _getFilesSha1Info.apply(this, arguments);
2956
+ }
2957
+
2958
+ var recombination = {
2959
+ __proto__: null,
2960
+ getFilesSha1Info: getFilesSha1Info
2961
+ };
2962
+
2734
2963
  var FServiceAPI = {
2735
2964
  Node: Node,
2736
2965
  Exhibit: Exhibit,
@@ -2746,7 +2975,8 @@ var FServiceAPI = {
2746
2975
  Activity: Activity,
2747
2976
  TestQualification: TestQualification,
2748
2977
  Statistic: Statistic,
2749
- I18n: I18n
2978
+ I18n: I18n,
2979
+ recombination: recombination
2750
2980
  };
2751
2981
 
2752
2982
  var codeMessage = {
@@ -2904,91 +3134,6 @@ function _request() {
2904
3134
  return _request.apply(this, arguments);
2905
3135
  }
2906
3136
 
2907
- /**
2908
- * 根据 File 获取 SHA1 Hash 字符串
2909
- * @param file
2910
- * @return {Promise<string>}
2911
- */
2912
-
2913
- function getSHA1Hash(file) {
2914
- return new Promise(function (resolve) {
2915
- var reader = new FileReader();
2916
-
2917
- reader.onload = function () {
2918
- var wordArray = CryptoJS.lib.WordArray.create(reader.result);
2919
- var hash = CryptoJS.SHA1(wordArray).toString();
2920
- resolve(hash);
2921
- };
2922
-
2923
- reader.readAsArrayBuffer(file);
2924
- });
2925
- }
2926
- /**
2927
- * 生成随机码
2928
- */
2929
-
2930
- function generateRandomCode(strLen) {
2931
- if (strLen === void 0) {
2932
- strLen = 5;
2933
- }
2934
-
2935
- var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
2936
- var newStrArr = [];
2937
-
2938
- for (var i = 0; i < strLen; i++) {
2939
- newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
2940
- }
2941
-
2942
- return newStrArr.join('');
2943
- }
2944
- /**
2945
- * 通过读取 cookies 获取用户 ID
2946
- */
2947
-
2948
- function getUserIDByCookies() {
2949
- var uid = document.cookie.split('; ').find(function (co) {
2950
- return co.startsWith('uid=');
2951
- });
2952
-
2953
- if (!uid) {
2954
- return -1;
2955
- }
2956
-
2957
- return Number(uid.replace('uid=', ''));
2958
- }
2959
- function transformServerAPIContractState(_ref) {
2960
- var status = _ref.status,
2961
- authStatus = _ref.authStatus;
2962
-
2963
- if (status === 0) {
2964
- if (authStatus === 1 || authStatus === 3) {
2965
- return 'active';
2966
- }
2967
-
2968
- if (authStatus === 2) {
2969
- return 'testActive';
2970
- }
2971
-
2972
- if (authStatus === 128) {
2973
- return 'inactive';
2974
- }
2975
- }
2976
-
2977
- if (status === 1) {
2978
- return 'terminal';
2979
- }
2980
-
2981
- return 'exception';
2982
- }
2983
-
2984
- var Tool = {
2985
- __proto__: null,
2986
- getSHA1Hash: getSHA1Hash,
2987
- generateRandomCode: generateRandomCode,
2988
- getUserIDByCookies: getUserIDByCookies,
2989
- transformServerAPIContractState: transformServerAPIContractState
2990
- };
2991
-
2992
3137
  var FUtil = {
2993
3138
  Format: Format,
2994
3139
  Regexp: Regexp,