@freelog/tools-lib 0.1.130 → 0.1.133
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/activities.d.ts +6 -0
- package/dist/service-API/policies.d.ts +9 -0
- package/dist/service-API/recombinations/index.d.ts +4 -1
- package/dist/tools-lib.cjs.development.js +238 -197
- 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 +238 -197
- package/dist/tools-lib.esm.js.map +1 -1
- package/dist/utils/format.d.ts +0 -4
- package/package.json +2 -2
- package/src/service-API/activities.ts +15 -0
- package/src/service-API/policies.ts +30 -0
- package/src/service-API/recombinations/index.ts +27 -4
- package/src/utils/format.ts +44 -44
package/dist/utils/format.d.ts
CHANGED
|
@@ -18,10 +18,6 @@ export declare function completeUrlByDomain(domain: string): string;
|
|
|
18
18
|
* @param code 策略代码
|
|
19
19
|
* @param targetType 标的物类型
|
|
20
20
|
*/
|
|
21
|
-
export declare function policyCodeTranslationToText(code: string, targetType: string): Promise<{
|
|
22
|
-
error: string[] | null;
|
|
23
|
-
text?: string;
|
|
24
|
-
}>;
|
|
25
21
|
/**
|
|
26
22
|
* 将资源类型关键字数组,转换成标准展示文字
|
|
27
23
|
* @param arr 关键字数组
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freelog/tools-lib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.133",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"analyze": "size-limit --why",
|
|
22
22
|
"publish": "npm publish --access public"
|
|
23
23
|
},
|
|
24
|
-
"peerDependencies": {},
|
|
25
24
|
"husky": {
|
|
26
25
|
"hooks": {}
|
|
27
26
|
},
|
|
@@ -47,6 +46,7 @@
|
|
|
47
46
|
"@size-limit/preset-small-lib": "^4.11.0",
|
|
48
47
|
"@types/crypto-js": "^4.0.1",
|
|
49
48
|
"@types/js-cookie": "^3.0.2",
|
|
49
|
+
"@types/node": "^18.7.16",
|
|
50
50
|
"@types/nprogress": "^0.2.0",
|
|
51
51
|
"husky": "^6.0.0",
|
|
52
52
|
"size-limit": "^4.11.0",
|
|
@@ -214,3 +214,18 @@ export function listInviteFriendInfos(params: ListInviteFriendInfosParamsType) {
|
|
|
214
214
|
data: params,
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
// 获取奖励记录详情列表
|
|
219
|
+
interface GetRewardRecordInfosParamsType {
|
|
220
|
+
rewardGroupCode?: string;
|
|
221
|
+
rewardConfigCode?: string;
|
|
222
|
+
status?: 1 | 2 | 3; //奖励记录状态 1:未领取 2:可领取 3:已领取;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function getRewardRecordInfos(params: GetRewardRecordInfosParamsType) {
|
|
226
|
+
return FUtil.Request({
|
|
227
|
+
method: 'POST',
|
|
228
|
+
url: `/v2/activities/facade/getRewardRecordInfos`,
|
|
229
|
+
data: params,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// import {Base64} from 'js-base64';
|
|
1
2
|
import FUtil from '../utils';
|
|
2
3
|
|
|
3
4
|
// 批量获取授权策略列表
|
|
@@ -43,3 +44,32 @@ export function policyTemplates(params: PolicyTemplatesParamsType = {}) {
|
|
|
43
44
|
params: params,
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
// 模板策略翻译
|
|
49
|
+
interface PolicyTranslationParamsType {
|
|
50
|
+
contract: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function policyTranslation({contract}: PolicyTranslationParamsType) {
|
|
54
|
+
return FUtil.Request({
|
|
55
|
+
method: 'POST',
|
|
56
|
+
url: `/v2/translate/translate`,
|
|
57
|
+
data: {
|
|
58
|
+
contract: contract,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 模板策略翻译
|
|
64
|
+
interface PolicyTransferTranslationParamsType {
|
|
65
|
+
contract: string;
|
|
66
|
+
fsmTransfers: any;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function policyTransferTranslation(params: PolicyTransferTranslationParamsType) {
|
|
70
|
+
return FUtil.Request({
|
|
71
|
+
method: 'POST',
|
|
72
|
+
url: `/v2/translate/transfer`,
|
|
73
|
+
data: params,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -13,9 +13,15 @@ interface GetFileInfosBySha1Params {
|
|
|
13
13
|
sha1: string[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdPartially: (s: any[]) => void = () => undefined): Promise<
|
|
16
|
+
export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdPartially: (s: any[]) => void = () => undefined): Promise<{
|
|
17
|
+
error: string;
|
|
18
|
+
result: FileInfo[],
|
|
19
|
+
}> {
|
|
17
20
|
if (sha1.length === 0) {
|
|
18
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
error: '',
|
|
23
|
+
result: [],
|
|
24
|
+
};
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
let delay: number = 500;
|
|
@@ -26,9 +32,20 @@ export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdParti
|
|
|
26
32
|
|
|
27
33
|
while (true) {
|
|
28
34
|
// console.log(needHandleSha1.join(','), 'needHandleSha1.join()90ojlskdfjsdlk')
|
|
29
|
-
const {data} = await Storage.filesListInfo({
|
|
35
|
+
const {ret, errCode, data, msg}: any = await Storage.filesListInfo({
|
|
30
36
|
sha1: needHandleSha1.join(','),
|
|
31
37
|
});
|
|
38
|
+
|
|
39
|
+
if (ret !== 0 || errCode !== 0) {
|
|
40
|
+
console.log({
|
|
41
|
+
ret, errCode, data, msg
|
|
42
|
+
}, '09iowksdjaklfjs;oalijflskdjflsdkjflkj');
|
|
43
|
+
return {
|
|
44
|
+
error: msg,
|
|
45
|
+
result: allData,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
needHandleSha1 = data
|
|
33
50
|
.filter((d: any) => {
|
|
34
51
|
return d.metaAnalyzeStatus && d.metaAnalyzeStatus === 1;
|
|
@@ -46,7 +63,10 @@ export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdParti
|
|
|
46
63
|
state = 'nonentity';
|
|
47
64
|
} else if (d.metaAnalyzeStatus === 2) {
|
|
48
65
|
state = 'success';
|
|
66
|
+
} else if (d.metaAnalyzeStatus === 3) {
|
|
67
|
+
state = 'fail';
|
|
49
68
|
}
|
|
69
|
+
console.log(d, '90wieojiksdjf;lkasdjf;lksdjflksjdflkjsdlfkjsdlkj');
|
|
50
70
|
return {
|
|
51
71
|
sha1: d.sha1,
|
|
52
72
|
state,
|
|
@@ -65,5 +85,8 @@ export async function getFilesSha1Info({sha1}: GetFileInfosBySha1Params, cdParti
|
|
|
65
85
|
await Tool.promiseSleep(delay);
|
|
66
86
|
// delay += 500;
|
|
67
87
|
}
|
|
68
|
-
return
|
|
88
|
+
return {
|
|
89
|
+
error: '',
|
|
90
|
+
result: allData,
|
|
91
|
+
};
|
|
69
92
|
}
|
package/src/utils/format.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
-
import {report} from '@freelog/resource-policy-lang/dist';
|
|
3
|
-
import {ContractEntity} from '@freelog/resource-policy-lang/dist/tools/ContractTool';
|
|
2
|
+
// import {report} from '@freelog/resource-policy-lang/dist';
|
|
3
|
+
// import {ContractEntity} from '@freelog/resource-policy-lang/dist/tools/ContractTool';
|
|
4
4
|
|
|
5
|
-
const {compile} = require('@freelog/resource-policy-lang');
|
|
5
|
+
// const {compile} = require('@freelog/resource-policy-lang');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 将对应的字节数,转换为易读单位数量
|
|
@@ -46,47 +46,47 @@ export function completeUrlByDomain(domain: string): string {
|
|
|
46
46
|
* @param code 策略代码
|
|
47
47
|
* @param targetType 标的物类型
|
|
48
48
|
*/
|
|
49
|
-
export async function policyCodeTranslationToText(code: string, targetType: string): Promise<{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
49
|
+
// export async function policyCodeTranslationToText(code: string, targetType: string): Promise<{
|
|
50
|
+
// error: string[] | null;
|
|
51
|
+
// text?: string;
|
|
52
|
+
// }> {
|
|
53
|
+
// try {
|
|
54
|
+
// const result = await compile(
|
|
55
|
+
// code,
|
|
56
|
+
// targetType,
|
|
57
|
+
// completeUrlByDomain('qi'),
|
|
58
|
+
// window.location.origin.endsWith('.freelog.com') ? 'prod' : 'dev',
|
|
59
|
+
// );
|
|
60
|
+
// const contract: ContractEntity = {
|
|
61
|
+
// audiences: result.state_machine.audiences,
|
|
62
|
+
// fsmStates: Object.entries<any>(result.state_machine.states)
|
|
63
|
+
// .map((st) => {
|
|
64
|
+
// return {
|
|
65
|
+
// name: st[0],
|
|
66
|
+
// serviceStates: st[1].serviceStates,
|
|
67
|
+
// events: st[1].transitions.map((ts: any) => {
|
|
68
|
+
//
|
|
69
|
+
// return {
|
|
70
|
+
// id: ts.code,
|
|
71
|
+
// name: ts.name,
|
|
72
|
+
// args: ts.args,
|
|
73
|
+
// state: ts.toState,
|
|
74
|
+
// };
|
|
75
|
+
// }),
|
|
76
|
+
// };
|
|
77
|
+
// }),
|
|
78
|
+
// };
|
|
79
|
+
// const rrr = report(contract);
|
|
80
|
+
// return {
|
|
81
|
+
// error: null,
|
|
82
|
+
// text: rrr.audienceInfos[0].content + rrr.content,
|
|
83
|
+
// };
|
|
84
|
+
// } catch (err) {
|
|
85
|
+
// return {
|
|
86
|
+
// error: [err.message],
|
|
87
|
+
// };
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
/**
|