@freelog/tools-lib 0.1.148 → 0.1.151
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/dist/service-API/collections.d.ts +1 -0
- package/dist/service-API/index.d.ts +2 -0
- package/dist/service-API/nodes.d.ts +9 -0
- package/dist/service-API/operation.d.ts +5 -0
- package/dist/service-API/presentables.d.ts +1 -0
- package/dist/service-API/recombinations/index.d.ts +2 -1
- package/dist/service-API/resources.d.ts +27 -1
- package/dist/service-API/storages.d.ts +3 -0
- package/dist/tools-lib.cjs.development.js +88 -12
- package/dist/tools-lib.cjs.development.js.map +1 -1
- package/dist/tools-lib.cjs.production.min.js +1 -1
- package/dist/tools-lib.cjs.production.min.js.map +1 -1
- package/dist/tools-lib.esm.js +88 -12
- package/dist/tools-lib.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/i18n/I18nNext.ts +155 -155
- package/src/service-API/collections.ts +1 -0
- package/src/service-API/index.ts +2 -0
- package/src/service-API/nodes.ts +81 -65
- package/src/service-API/operation.ts +14 -0
- package/src/service-API/presentables.ts +1 -0
- package/src/service-API/recombinations/index.ts +97 -92
- package/src/service-API/resources.ts +74 -1
- package/src/service-API/storages.ts +361 -358
- package/src/utils/axios.ts +141 -141
- package/src/utils/linkTo.ts +413 -413
- package/src/utils/regexp.ts +53 -52
|
@@ -1,92 +1,97 @@
|
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
state
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
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
|
+
resourceTypeCode: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function getFilesSha1Info({
|
|
18
|
+
sha1,
|
|
19
|
+
resourceTypeCode
|
|
20
|
+
}: GetFileInfosBySha1Params, cdPartially: (s: any[]) => void = () => undefined): Promise<{
|
|
21
|
+
error: string;
|
|
22
|
+
result: FileInfo[],
|
|
23
|
+
}> {
|
|
24
|
+
if (sha1.length === 0) {
|
|
25
|
+
return {
|
|
26
|
+
error: '',
|
|
27
|
+
result: [],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let delay: number = 500;
|
|
32
|
+
|
|
33
|
+
let needHandleSha1: string[] = [...sha1];
|
|
34
|
+
|
|
35
|
+
let allData: FileInfo[] = [];
|
|
36
|
+
|
|
37
|
+
while (true) {
|
|
38
|
+
// console.log(needHandleSha1.join(','), 'needHandleSha1.join()90ojlskdfjsdlk')
|
|
39
|
+
const {ret, errCode, data, msg}: any = await Storage.filesListInfo({
|
|
40
|
+
sha1: needHandleSha1.join(','),
|
|
41
|
+
resourceTypeCode: resourceTypeCode,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (ret !== 0 || errCode !== 0) {
|
|
45
|
+
console.log({
|
|
46
|
+
ret, errCode, data, msg
|
|
47
|
+
}, '09iowksdjaklfjs;oalijflskdjflsdkjflkj');
|
|
48
|
+
return {
|
|
49
|
+
error: msg,
|
|
50
|
+
result: allData,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
needHandleSha1 = data
|
|
55
|
+
.filter((d: any) => {
|
|
56
|
+
return d.metaAnalyzeStatus === 0 || d.metaAnalyzeStatus === 1;
|
|
57
|
+
})
|
|
58
|
+
.map((d: any) => {
|
|
59
|
+
return d.sha1;
|
|
60
|
+
});
|
|
61
|
+
const finishedInfo: FileInfo[] = data
|
|
62
|
+
.filter((d: any) => {
|
|
63
|
+
return d.metaAnalyzeStatus !== 0 && d.metaAnalyzeStatus !== 1;
|
|
64
|
+
})
|
|
65
|
+
.map((d: any) => {
|
|
66
|
+
let state: 'success' | 'fail' | 'nonentity' = 'fail';
|
|
67
|
+
if (!d.metaAnalyzeStatus) {
|
|
68
|
+
state = 'nonentity';
|
|
69
|
+
} else if (d.metaAnalyzeStatus === 2) {
|
|
70
|
+
state = 'success';
|
|
71
|
+
} else if (d.metaAnalyzeStatus === 3) {
|
|
72
|
+
state = 'fail';
|
|
73
|
+
}
|
|
74
|
+
// console.log(d, '90wieojiksdjf;lkasdjf;lksdjflksjdflkjsdlfkjsdlkj');
|
|
75
|
+
return {
|
|
76
|
+
sha1: d.sha1,
|
|
77
|
+
state,
|
|
78
|
+
info: d,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
cdPartially && cdPartially(finishedInfo);
|
|
82
|
+
allData = [
|
|
83
|
+
...allData,
|
|
84
|
+
...finishedInfo,
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
if (needHandleSha1.length === 0) {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
await Tool.promiseSleep(delay);
|
|
91
|
+
// delay += 500;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
error: '',
|
|
95
|
+
result: allData,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -33,7 +33,9 @@ interface IResourceInfo {
|
|
|
33
33
|
// 创建资源
|
|
34
34
|
export interface CreateParamsType {
|
|
35
35
|
name: string;
|
|
36
|
-
resourceType: string[]
|
|
36
|
+
// resourceType: string[]
|
|
37
|
+
resourceTypeCode: string;
|
|
38
|
+
resourceTypeName?: string;
|
|
37
39
|
policies?: any[];
|
|
38
40
|
coverImages?: string[];
|
|
39
41
|
intro?: string;
|
|
@@ -80,6 +82,7 @@ interface ListParamsType {
|
|
|
80
82
|
limit?: number;
|
|
81
83
|
keywords?: string;
|
|
82
84
|
resourceType?: string;
|
|
85
|
+
resourceTypeCode?: string;
|
|
83
86
|
omitResourceType?: string;
|
|
84
87
|
isSelf?: 0 | 1;
|
|
85
88
|
userId?: number;
|
|
@@ -93,6 +96,7 @@ interface ListParamsType {
|
|
|
93
96
|
tags?: string;
|
|
94
97
|
sort?: string;
|
|
95
98
|
// startResourceId?: string;
|
|
99
|
+
operationCategoryCode?: string;
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
// interface ListReturnType extends CommonReturn {
|
|
@@ -196,6 +200,7 @@ interface CreateVersionParamsType {
|
|
|
196
200
|
}[];
|
|
197
201
|
customPropertyDescriptors?: {
|
|
198
202
|
key: string;
|
|
203
|
+
name: string;
|
|
199
204
|
defaultValue: string;
|
|
200
205
|
type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
|
|
201
206
|
candidateItems?: string[];
|
|
@@ -290,6 +295,7 @@ interface UpdateResourceVersionInfoParamsType {
|
|
|
290
295
|
description?: string;
|
|
291
296
|
customPropertyDescriptors?: {
|
|
292
297
|
key: string;
|
|
298
|
+
name: string;
|
|
293
299
|
defaultValue: string;
|
|
294
300
|
type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
|
|
295
301
|
candidateItems?: string[];
|
|
@@ -543,3 +549,70 @@ export function availableTags({...params}: AvailableTagsParamsType) {
|
|
|
543
549
|
params: params,
|
|
544
550
|
});
|
|
545
551
|
}
|
|
552
|
+
|
|
553
|
+
// 列出资源类型分组排序
|
|
554
|
+
interface ResourceTypesParamsType {
|
|
555
|
+
codeOrName?: string;
|
|
556
|
+
category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export function resourceTypes({...params}: ResourceTypesParamsType = {}) {
|
|
560
|
+
return FUtil.Request({
|
|
561
|
+
method: 'GET',
|
|
562
|
+
url: `/v2/resources/types/listSimpleByGroup`,
|
|
563
|
+
params: params,
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// 简单根据父类型列出资源类型
|
|
568
|
+
interface ListSimpleByParentCodeParamsType {
|
|
569
|
+
parentCode: string;
|
|
570
|
+
name?: string;
|
|
571
|
+
category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export function ListSimpleByParentCode({...params}: ListSimpleByParentCodeParamsType) {
|
|
575
|
+
return FUtil.Request({
|
|
576
|
+
method: 'GET',
|
|
577
|
+
url: `/v2/resources/types/listSimpleByParentCode`,
|
|
578
|
+
params: params,
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// 根据编号取资源类型
|
|
583
|
+
interface GetResourceTypeInfoByCodeParamsType {
|
|
584
|
+
code: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export function getResourceTypeInfoByCode({...params}: GetResourceTypeInfoByCodeParamsType) {
|
|
588
|
+
return FUtil.Request({
|
|
589
|
+
method: 'GET',
|
|
590
|
+
url: `/v2/resources/types/getInfoByCode`,
|
|
591
|
+
params: params,
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
//
|
|
596
|
+
interface GetResourceAttrListSimple {
|
|
597
|
+
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export function getResourceAttrListSimple({...params}: GetResourceAttrListSimple) {
|
|
601
|
+
return FUtil.Request({
|
|
602
|
+
method: 'GET',
|
|
603
|
+
url: `/v2/resources/attrs/listSimple`,
|
|
604
|
+
params: params,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
interface ListSimple4RecentlySimple {
|
|
609
|
+
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export function listSimple4Recently({...params}: ListSimple4RecentlySimple = {}) {
|
|
613
|
+
return FUtil.Request({
|
|
614
|
+
method: 'GET',
|
|
615
|
+
url: `/v2/resources/types/listSimple4Recently`,
|
|
616
|
+
params: params,
|
|
617
|
+
});
|
|
618
|
+
}
|