@freelog/tools-lib 0.1.152 → 0.1.154

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.
@@ -8,10 +8,13 @@ declare class I18nNext {
8
8
  private _taskQueue;
9
9
  private _currentLanguage;
10
10
  constructor();
11
- ready(this: I18nNext): Promise<unknown>;
11
+ ready(this: I18nNext): Promise<void>;
12
12
  t(this: I18nNext, key: string, options?: {
13
13
  [key: string]: any;
14
14
  }): string;
15
+ tJSXElement(this: I18nNext, key: string, options?: {
16
+ [key: string]: any;
17
+ }): string | JSX.Element | JSX.Element[];
15
18
  changeLanguage(this: I18nNext, lng: LanguageKeyType): void;
16
19
  getAllLanguage(this: I18nNext): typeof allLanguage;
17
20
  getCurrentLanguage(this: I18nNext): LanguageKeyType;
@@ -8,6 +8,7 @@ interface CollectionResourcesParamsType {
8
8
  keywords?: string;
9
9
  resourceType?: string;
10
10
  resourceTypeCode?: string;
11
+ resourceTypeCategory?: 1 | 2;
11
12
  omitResourceType?: string;
12
13
  resourceStatus?: 0 | 1 | 2 | 4;
13
14
  }
@@ -60,6 +60,7 @@ interface ListParamsType {
60
60
  keywords?: string;
61
61
  resourceType?: string;
62
62
  resourceTypeCode?: string;
63
+ resourceTypeCategory?: 1 | 2;
63
64
  omitResourceType?: string;
64
65
  isSelf?: 0 | 1;
65
66
  userId?: number;
@@ -140,6 +141,10 @@ interface CreateVersionParamsType {
140
141
  policyId: string;
141
142
  }[];
142
143
  }[];
144
+ inputAttrs: {
145
+ key: string;
146
+ value: string;
147
+ }[];
143
148
  }
144
149
  export declare function createVersion({ resourceId, ...params }: CreateVersionParamsType): Promise<any>;
145
150
  interface ResourceVersionInfo1ParamsType {
@@ -181,6 +186,10 @@ interface UpdateResourceVersionInfoParamsType {
181
186
  policyId: string;
182
187
  }[];
183
188
  }[];
189
+ inputAttrs: {
190
+ key: string;
191
+ value: string;
192
+ }[];
184
193
  }
185
194
  export declare function updateResourceVersionInfo(params: UpdateResourceVersionInfoParamsType): Promise<any>;
186
195
  interface SaveVersionsDraftParamsType {
@@ -294,10 +303,14 @@ interface GetResourceTypeInfoByCodeParamsType {
294
303
  code: string;
295
304
  }
296
305
  export declare function getResourceTypeInfoByCode({ ...params }: GetResourceTypeInfoByCodeParamsType): Promise<any>;
297
- interface GetResourceAttrListSimple {
306
+ interface GetResourceAttrListSimpleParamsType {
307
+ }
308
+ export declare function getResourceAttrListSimple({ ...params }: GetResourceAttrListSimpleParamsType): Promise<any>;
309
+ interface ListSimple4RecentlyParamsType {
298
310
  }
299
- export declare function getResourceAttrListSimple({ ...params }: GetResourceAttrListSimple): Promise<any>;
300
- interface ListSimple4RecentlySimple {
311
+ export declare function listSimple4Recently({ ...params }?: ListSimple4RecentlyParamsType): Promise<any>;
312
+ interface GetAttrsInfoByKeyParamsType {
313
+ key: string;
301
314
  }
302
- export declare function listSimple4Recently({ ...params }?: ListSimple4RecentlySimple): Promise<any>;
315
+ export declare function getAttrsInfoByKey({ ...params }: GetAttrsInfoByKeyParamsType): Promise<any>;
303
316
  export {};
@@ -8,8 +8,10 @@ var moment = _interopDefault(require('moment'));
8
8
  var querystring = require('querystring');
9
9
  var axios = _interopDefault(require('axios'));
10
10
  var CryptoJS = require('crypto-js');
11
+ var React = require('react');
11
12
  var i18next = _interopDefault(require('i18next'));
12
13
  var Cookies = _interopDefault(require('js-cookie'));
14
+ var htmlReactParser = _interopDefault(require('html-react-parser'));
13
15
 
14
16
  // import {ContractEntity} from '@freelog/resource-policy-lang/dist/tools/ContractTool';
15
17
  // const {compile} = require('@freelog/resource-policy-lang');
@@ -158,7 +160,11 @@ var MAX_2_DECIMAL_POSITIVE_NUMBER = /*#__PURE__*/new RegExp(/^\d+(\.\d{0,2})?$/)
158
160
 
159
161
  var BUCKET_NAME = /*#__PURE__*/new RegExp(/^([a-z0-9][a-z0-9-]{0,61})?[a-z0-9]$/); // JS变量名称
160
162
 
161
- var JS_VARIABLE_NAME = /*#__PURE__*/new RegExp(/^[A-Za-z$_][\w$_]*$/);
163
+ var JS_VARIABLE_NAME = /*#__PURE__*/new RegExp(/^[A-Za-z$_][\w$_]*$/); // 日期
164
+
165
+ var DATE = /*#__PURE__*/new RegExp(/(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/); // 日期时间
166
+
167
+ var DATE_TIME = /*#__PURE__*/new RegExp(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
162
168
 
163
169
  var Regexp = {
164
170
  __proto__: null,
@@ -177,7 +183,9 @@ var Regexp = {
177
183
  POSITIVE_INTEGER: POSITIVE_INTEGER,
178
184
  MAX_2_DECIMAL_POSITIVE_NUMBER: MAX_2_DECIMAL_POSITIVE_NUMBER,
179
185
  BUCKET_NAME: BUCKET_NAME,
180
- JS_VARIABLE_NAME: JS_VARIABLE_NAME
186
+ JS_VARIABLE_NAME: JS_VARIABLE_NAME,
187
+ DATE: DATE,
188
+ DATE_TIME: DATE_TIME
181
189
  };
182
190
 
183
191
  function _regeneratorRuntime() {
@@ -601,7 +609,8 @@ var _excluded = ["resourceID"],
601
609
  _excluded2 = ["nodeID", "showPage"],
602
610
  _excluded3 = ["nodeID", "showPage"],
603
611
  _excluded4 = ["goTo"],
604
- _excluded5 = ["goTo"];
612
+ _excluded5 = ["goTo"],
613
+ _excluded6 = ["goTo", "returnUrl"];
605
614
  function home(_temp) {
606
615
  var _ref = _temp === void 0 ? {} : _temp;
607
616
 
@@ -783,84 +792,101 @@ function resourceFreeze(_ref29) {
783
792
  var resourceID = _ref29.resourceID;
784
793
  return "/result/resource/freeze/" + resourceID;
785
794
  }
795
+ function globalSearch(_ref30) {
796
+ var search = _ref30.search;
797
+ return "/search" + handleQuery({
798
+ search: search
799
+ });
800
+ }
786
801
  function login(_temp13) {
787
- var _ref30 = _temp13 === void 0 ? {} : _temp13,
788
- goTo = _ref30.goTo;
802
+ var _ref31 = _temp13 === void 0 ? {} : _temp13,
803
+ goTo = _ref31.goTo;
789
804
 
790
805
  return "/login" + handleQuery({
791
806
  goTo: goTo ? encodeURIComponent(goTo) : undefined
792
807
  });
793
808
  }
794
809
  function logon(_temp14) {
795
- var _ref31 = _temp14 === void 0 ? {} : _temp14,
796
- goTo = _ref31.goTo,
797
- params = _objectWithoutPropertiesLoose(_ref31, _excluded5);
810
+ var _ref32 = _temp14 === void 0 ? {} : _temp14,
811
+ goTo = _ref32.goTo,
812
+ params = _objectWithoutPropertiesLoose(_ref32, _excluded5);
798
813
 
799
814
  return "/logon" + handleQuery(_extends({
800
815
  goTo: goTo ? encodeURIComponent(goTo) : undefined
801
816
  }, params));
802
817
  }
803
- function retrieveUserPassword(_temp15) {
804
- var _ref32 = _temp15 === void 0 ? {} : _temp15,
805
- goTo = _ref32.goTo;
818
+ function bind(_temp15) {
819
+ var _ref33 = _temp15 === void 0 ? {} : _temp15,
820
+ goTo = _ref33.goTo,
821
+ returnUrl = _ref33.returnUrl,
822
+ params = _objectWithoutPropertiesLoose(_ref33, _excluded6);
823
+
824
+ return "/bind" + handleQuery(_extends({
825
+ goTo: goTo ? encodeURIComponent(goTo) : undefined,
826
+ returnUrl: returnUrl ? encodeURIComponent(returnUrl) : undefined
827
+ }, params));
828
+ }
829
+ function retrieveUserPassword(_temp16) {
830
+ var _ref34 = _temp16 === void 0 ? {} : _temp16,
831
+ goTo = _ref34.goTo;
806
832
 
807
833
  return "/retrieve" + handleQuery({
808
834
  goTo: goTo ? encodeURIComponent(goTo) : undefined
809
835
  });
810
836
  }
811
- function retrievePayPassword(_temp16) {
812
- var _ref33 = _temp16 === void 0 ? {} : _temp16;
837
+ function retrievePayPassword(_temp17) {
838
+ var _ref35 = _temp17 === void 0 ? {} : _temp17;
813
839
 
814
- _objectDestructuringEmpty(_ref33);
840
+ _objectDestructuringEmpty(_ref35);
815
841
 
816
842
  return "/retrievePayPassword";
817
843
  }
818
- function userFreeze(_temp17) {
819
- var _ref34 = _temp17 === void 0 ? {} : _temp17;
844
+ function userFreeze(_temp18) {
845
+ var _ref36 = _temp18 === void 0 ? {} : _temp18;
820
846
 
821
- _objectDestructuringEmpty(_ref34);
847
+ _objectDestructuringEmpty(_ref36);
822
848
 
823
849
  return "/freeze";
824
850
  }
825
- function wallet(_temp18) {
826
- var _ref35 = _temp18 === void 0 ? {} : _temp18;
851
+ function wallet(_temp19) {
852
+ var _ref37 = _temp19 === void 0 ? {} : _temp19;
827
853
 
828
- _objectDestructuringEmpty(_ref35);
854
+ _objectDestructuringEmpty(_ref37);
829
855
 
830
856
  return "/logged/wallet";
831
857
  }
832
- function reward(_temp19) {
833
- var _ref36 = _temp19 === void 0 ? {} : _temp19;
858
+ function reward(_temp20) {
859
+ var _ref38 = _temp20 === void 0 ? {} : _temp20;
834
860
 
835
- _objectDestructuringEmpty(_ref36);
861
+ _objectDestructuringEmpty(_ref38);
836
862
 
837
863
  return "/logged/reward";
838
864
  }
839
- function contract(_temp20) {
840
- var _ref37 = _temp20 === void 0 ? {} : _temp20;
865
+ function contract(_temp21) {
866
+ var _ref39 = _temp21 === void 0 ? {} : _temp21;
841
867
 
842
- _objectDestructuringEmpty(_ref37);
868
+ _objectDestructuringEmpty(_ref39);
843
869
 
844
870
  return "/logged/contract";
845
871
  }
846
- function setting(_temp21) {
847
- var _ref38 = _temp21 === void 0 ? {} : _temp21;
872
+ function setting(_temp22) {
873
+ var _ref40 = _temp22 === void 0 ? {} : _temp22;
848
874
 
849
- _objectDestructuringEmpty(_ref38);
875
+ _objectDestructuringEmpty(_ref40);
850
876
 
851
877
  return "/logged/setting";
852
878
  }
853
- function binding(_temp22) {
854
- var _ref39 = _temp22 === void 0 ? {} : _temp22;
879
+ function binding(_temp23) {
880
+ var _ref41 = _temp23 === void 0 ? {} : _temp23;
855
881
 
856
- _objectDestructuringEmpty(_ref39);
882
+ _objectDestructuringEmpty(_ref41);
857
883
 
858
884
  return "/logged/binding";
859
885
  }
860
- function resultBindingSuccess(_temp23) {
861
- var _ref40 = _temp23 === void 0 ? {} : _temp23;
886
+ function resultBindingSuccess(_temp24) {
887
+ var _ref42 = _temp24 === void 0 ? {} : _temp24;
862
888
 
863
- _objectDestructuringEmpty(_ref40);
889
+ _objectDestructuringEmpty(_ref42);
864
890
 
865
891
  return "/result/binding";
866
892
  }
@@ -914,8 +940,10 @@ var LinkTo = {
914
940
  exception403: exception403,
915
941
  nodeFreeze: nodeFreeze,
916
942
  resourceFreeze: resourceFreeze,
943
+ globalSearch: globalSearch,
917
944
  login: login,
918
945
  logon: logon,
946
+ bind: bind,
919
947
  retrieveUserPassword: retrieveUserPassword,
920
948
  retrievePayPassword: retrievePayPassword,
921
949
  userFreeze: userFreeze,
@@ -1030,7 +1058,7 @@ var _excluded$1 = ["presentableId"],
1030
1058
  _excluded3$1 = ["presentableId"],
1031
1059
  _excluded4$1 = ["presentableId"],
1032
1060
  _excluded5$1 = ["presentableId"],
1033
- _excluded6 = ["presentableId"],
1061
+ _excluded6$1 = ["presentableId"],
1034
1062
  _excluded7 = ["presentableId"],
1035
1063
  _excluded8 = ["presentableId"],
1036
1064
  _excluded9 = ["nodeId"],
@@ -1127,7 +1155,7 @@ function relationTree(_ref4) {
1127
1155
  }
1128
1156
  function authTree(_ref5) {
1129
1157
  var presentableId = _ref5.presentableId,
1130
- params = _objectWithoutPropertiesLoose(_ref5, _excluded6);
1158
+ params = _objectWithoutPropertiesLoose(_ref5, _excluded6$1);
1131
1159
 
1132
1160
  // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
1133
1161
  return FUtil.Request({
@@ -1462,9 +1490,6 @@ function collectResource(params) {
1462
1490
  });
1463
1491
  }
1464
1492
  function collectionResources(params) {
1465
- // return FUtil.Axios.get('/v2/collections/resources', {
1466
- // params
1467
- // });
1468
1493
  return FUtil.Request({
1469
1494
  method: 'GET',
1470
1495
  url: "/v2/collections/resources",
@@ -1512,7 +1537,7 @@ var _excluded$3 = ["resourceIdOrName"],
1512
1537
  _excluded3$3 = ["resourceId"],
1513
1538
  _excluded4$3 = ["resourceId"],
1514
1539
  _excluded5$3 = ["resourceId", "version"],
1515
- _excluded6$1 = ["fileSha1"],
1540
+ _excluded6$2 = ["fileSha1"],
1516
1541
  _excluded7$1 = ["fileSha1"],
1517
1542
  _excluded8$1 = ["resourceId"],
1518
1543
  _excluded9$1 = ["resourceId"],
@@ -1611,7 +1636,7 @@ function resourceVersionInfo2(params) {
1611
1636
  }
1612
1637
  function getResourceVersionBySha1(_ref6) {
1613
1638
  var fileSha1 = _ref6.fileSha1,
1614
- params = _objectWithoutPropertiesLoose(_ref6, _excluded6$1);
1639
+ params = _objectWithoutPropertiesLoose(_ref6, _excluded6$2);
1615
1640
 
1616
1641
  // return FUtil.Axios.get(`/v2/resources/files/${fileSha1}/versions`, {
1617
1642
  // params,
@@ -1822,6 +1847,15 @@ function listSimple4Recently(_temp2) {
1822
1847
  params: params
1823
1848
  });
1824
1849
  }
1850
+ function getAttrsInfoByKey(_ref22) {
1851
+ var params = _extends({}, _ref22);
1852
+
1853
+ return FUtil.Request({
1854
+ method: 'GET',
1855
+ url: "/v2/resources/attrs/getInfoByKey",
1856
+ params: params
1857
+ });
1858
+ }
1825
1859
 
1826
1860
  var Resource = {
1827
1861
  __proto__: null,
@@ -1856,7 +1890,8 @@ var Resource = {
1856
1890
  ListSimpleByParentCode: ListSimpleByParentCode,
1857
1891
  getResourceTypeInfoByCode: getResourceTypeInfoByCode,
1858
1892
  getResourceAttrListSimple: getResourceAttrListSimple,
1859
- listSimple4Recently: listSimple4Recently
1893
+ listSimple4Recently: listSimple4Recently,
1894
+ getAttrsInfoByKey: getAttrsInfoByKey
1860
1895
  };
1861
1896
 
1862
1897
  var _excluded$4 = ["loginName"];
@@ -2069,7 +2104,7 @@ var _excluded$5 = ["nodeId"],
2069
2104
  _excluded3$4 = ["nodeId"],
2070
2105
  _excluded4$4 = ["nodeId"],
2071
2106
  _excluded5$4 = ["nodeId"],
2072
- _excluded6$2 = ["testResourceId"],
2107
+ _excluded6$3 = ["testResourceId"],
2073
2108
  _excluded7$2 = ["testResourceId"],
2074
2109
  _excluded8$2 = ["nodeId"],
2075
2110
  _excluded9$2 = ["nodeId"],
@@ -2134,7 +2169,7 @@ function testNodeRules(_ref6) {
2134
2169
  }
2135
2170
  function updateTestResourceContracts(_ref7) {
2136
2171
  var testResourceId = _ref7.testResourceId,
2137
- params = _objectWithoutPropertiesLoose(_ref7, _excluded6$2);
2172
+ params = _objectWithoutPropertiesLoose(_ref7, _excluded6$3);
2138
2173
 
2139
2174
  // return FUtil.Axios.put(`/v2/testNodes/testResources/${testResourceId}`, params);
2140
2175
  return FUtil.Request({
@@ -3227,6 +3262,30 @@ function _request() {
3227
3262
  return _request.apply(this, arguments);
3228
3263
  }
3229
3264
 
3265
+ function useGetState(initVal) {
3266
+ var _React$useState = React.useState(initVal),
3267
+ state = _React$useState[0],
3268
+ setState = _React$useState[1];
3269
+
3270
+ var ref = React.useRef(initVal);
3271
+
3272
+ function setStateCopy(newVal) {
3273
+ ref.current = newVal;
3274
+ setState(newVal);
3275
+ }
3276
+
3277
+ function getState() {
3278
+ return ref.current;
3279
+ }
3280
+
3281
+ return [state, setStateCopy, getState];
3282
+ }
3283
+
3284
+ var Hook = {
3285
+ __proto__: null,
3286
+ useGetState: useGetState
3287
+ };
3288
+
3230
3289
  var FUtil = {
3231
3290
  Format: Format,
3232
3291
  Regexp: Regexp,
@@ -3234,7 +3293,8 @@ var FUtil = {
3234
3293
  Predefined: Predefined,
3235
3294
  Axios: axios,
3236
3295
  Request: request,
3237
- Tool: Tool
3296
+ Tool: Tool,
3297
+ Hook: Hook
3238
3298
  };
3239
3299
 
3240
3300
  var ossJsonUrl = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs/i18n.json';
@@ -3352,6 +3412,10 @@ var I18nNext = /*#__PURE__*/function () {
3352
3412
  return i18next.t(key.trim(), options);
3353
3413
  };
3354
3414
 
3415
+ _proto.tJSXElement = function tJSXElement(key, options) {
3416
+ return htmlReactParser(i18next.t(key.trim(), options));
3417
+ };
3418
+
3355
3419
  _proto.changeLanguage = function changeLanguage(lng) {
3356
3420
  // return i18next.changeLanguage(lng);
3357
3421
  // window.localStorage.setItem(localStorage_i18nextLng_key, lng)