@freelog/tools-lib 0.1.128 → 0.1.132

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.
Files changed (39) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +103 -103
  3. package/dist/service-API/activities.d.ts +12 -0
  4. package/dist/service-API/contracts.d.ts +8 -0
  5. package/dist/service-API/index.d.ts +2 -0
  6. package/dist/service-API/policies.d.ts +12 -0
  7. package/dist/tools-lib.cjs.development.js +350 -686
  8. package/dist/tools-lib.cjs.development.js.map +1 -1
  9. package/dist/tools-lib.cjs.production.min.js +1 -1
  10. package/dist/tools-lib.cjs.production.min.js.map +1 -1
  11. package/dist/tools-lib.esm.js +350 -686
  12. package/dist/tools-lib.esm.js.map +1 -1
  13. package/package.json +66 -66
  14. package/src/i18n/I18nNext.ts +154 -154
  15. package/src/i18n/index.ts +7 -7
  16. package/src/index.ts +9 -9
  17. package/src/service-API/activities.ts +231 -201
  18. package/src/service-API/captcha.ts +30 -30
  19. package/src/service-API/collections.ts +81 -81
  20. package/src/service-API/contracts.ts +101 -84
  21. package/src/service-API/events.ts +18 -18
  22. package/src/service-API/i18n.ts +35 -35
  23. package/src/service-API/index.ts +39 -37
  24. package/src/service-API/informalNodes.ts +238 -238
  25. package/src/service-API/nodes.ts +65 -65
  26. package/src/service-API/policies.ts +72 -39
  27. package/src/service-API/presentables.ts +287 -287
  28. package/src/service-API/recombinations/index.ts +69 -69
  29. package/src/service-API/statistics.ts +20 -20
  30. package/src/service-API/storages.ts +358 -358
  31. package/src/service-API/testQualifications.ts +109 -109
  32. package/src/service-API/tools/index.ts +10 -10
  33. package/src/service-API/transactions.ts +109 -109
  34. package/src/service-API/user.ts +270 -270
  35. package/src/utils/axios.ts +145 -145
  36. package/src/utils/format.ts +98 -98
  37. package/src/utils/index.ts +20 -20
  38. package/src/utils/predefined.ts +37 -37
  39. package/src/utils/regexp.ts +52 -52
@@ -1,69 +1,69 @@
1
- import * as Tool from '../../utils/tools';
2
- import * as Storage from '../storages';
3
-
4
- interface FileInfo {
5
- sha1: string;
6
- state: 'success' | 'fail' | 'nonentity';
7
- info: {
8
- [key: string]: any;
9
- }
10
- }
11
-
12
- interface GetFileInfosBySha1Params {
13
- sha1: string[];
14
- }
15
-
16
- export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdPartially: (s: any[]) => void = () => undefined): Promise<FileInfo[]> {
17
- if (sha1.length === 0) {
18
- return [];
19
- }
20
-
21
- let delay: number = 500;
22
-
23
- let needHandleSha1: string[] = [...sha1];
24
-
25
- let allData: FileInfo[] = [];
26
-
27
- while (true) {
28
- // console.log(needHandleSha1.join(','), 'needHandleSha1.join()90ojlskdfjsdlk')
29
- const {data} = await Storage.filesListInfo({
30
- sha1: needHandleSha1.join(','),
31
- });
32
- needHandleSha1 = data
33
- .filter((d: any) => {
34
- return d.metaAnalyzeStatus && d.metaAnalyzeStatus === 1;
35
- })
36
- .map((d: any) => {
37
- return d.sha1;
38
- });
39
- const finishedInfo: FileInfo[] = data
40
- .filter((d: any) => {
41
- return !d.metaAnalyzeStatus || d.metaAnalyzeStatus !== 1;
42
- })
43
- .map((d: any) => {
44
- let state: 'success' | 'fail' | 'nonentity' = 'fail';
45
- if (!d.metaAnalyzeStatus) {
46
- state = 'nonentity';
47
- } else if (d.metaAnalyzeStatus === 2) {
48
- state = 'success';
49
- }
50
- return {
51
- sha1: d.sha1,
52
- state,
53
- info: d,
54
- };
55
- });
56
- cdPartially && cdPartially(finishedInfo);
57
- allData = [
58
- ...allData,
59
- ...finishedInfo,
60
- ];
61
-
62
- if (needHandleSha1.length === 0) {
63
- break;
64
- }
65
- await Tool.promiseSleep(delay);
66
- // delay += 500;
67
- }
68
- return allData;
69
- }
1
+ import * as Tool from '../../utils/tools';
2
+ import * as Storage from '../storages';
3
+
4
+ interface FileInfo {
5
+ sha1: string;
6
+ state: 'success' | 'fail' | 'nonentity';
7
+ info: {
8
+ [key: string]: any;
9
+ }
10
+ }
11
+
12
+ interface GetFileInfosBySha1Params {
13
+ sha1: string[];
14
+ }
15
+
16
+ export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdPartially: (s: any[]) => void = () => undefined): Promise<FileInfo[]> {
17
+ if (sha1.length === 0) {
18
+ return [];
19
+ }
20
+
21
+ let delay: number = 500;
22
+
23
+ let needHandleSha1: string[] = [...sha1];
24
+
25
+ let allData: FileInfo[] = [];
26
+
27
+ while (true) {
28
+ // console.log(needHandleSha1.join(','), 'needHandleSha1.join()90ojlskdfjsdlk')
29
+ const {data} = await Storage.filesListInfo({
30
+ sha1: needHandleSha1.join(','),
31
+ });
32
+ needHandleSha1 = data
33
+ .filter((d: any) => {
34
+ return d.metaAnalyzeStatus && d.metaAnalyzeStatus === 1;
35
+ })
36
+ .map((d: any) => {
37
+ return d.sha1;
38
+ });
39
+ const finishedInfo: FileInfo[] = data
40
+ .filter((d: any) => {
41
+ return !d.metaAnalyzeStatus || d.metaAnalyzeStatus !== 1;
42
+ })
43
+ .map((d: any) => {
44
+ let state: 'success' | 'fail' | 'nonentity' = 'fail';
45
+ if (!d.metaAnalyzeStatus) {
46
+ state = 'nonentity';
47
+ } else if (d.metaAnalyzeStatus === 2) {
48
+ state = 'success';
49
+ }
50
+ return {
51
+ sha1: d.sha1,
52
+ state,
53
+ info: d,
54
+ };
55
+ });
56
+ cdPartially && cdPartially(finishedInfo);
57
+ allData = [
58
+ ...allData,
59
+ ...finishedInfo,
60
+ ];
61
+
62
+ if (needHandleSha1.length === 0) {
63
+ break;
64
+ }
65
+ await Tool.promiseSleep(delay);
66
+ // delay += 500;
67
+ }
68
+ return allData;
69
+ }
@@ -1,20 +1,20 @@
1
- import FUtil from '../utils';
2
- // import {AxiosRequestConfig, Canceler} from 'axios';
3
-
4
- // 查询通用交易统计信息
5
- export interface TransactionsCommonParamsType {
6
- ownerId: string | number;
7
- ownerType?: 1 | 2;
8
- objectId?: string;
9
- objectType?: 2 | 3;
10
- beginDate?: string;
11
- endDate?: string;
12
- }
13
-
14
- export function transactionsCommon(params: TransactionsCommonParamsType) {
15
- return FUtil.Request({
16
- method: 'GET',
17
- url: `/v2/statistics/transactions/common`,
18
- params: params,
19
- });
20
- }
1
+ import FUtil from '../utils';
2
+ // import {AxiosRequestConfig, Canceler} from 'axios';
3
+
4
+ // 查询通用交易统计信息
5
+ export interface TransactionsCommonParamsType {
6
+ ownerId: string | number;
7
+ ownerType?: 1 | 2;
8
+ objectId?: string;
9
+ objectType?: 2 | 3;
10
+ beginDate?: string;
11
+ endDate?: string;
12
+ }
13
+
14
+ export function transactionsCommon(params: TransactionsCommonParamsType) {
15
+ return FUtil.Request({
16
+ method: 'GET',
17
+ url: `/v2/statistics/transactions/common`,
18
+ params: params,
19
+ });
20
+ }