@freelog/tools-lib 0.1.75 → 0.1.78

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.
@@ -1,284 +1,282 @@
1
- import FUtil from '../utils';
2
-
3
- // 创建展品
4
- export interface CreatePresentableParamsType {
5
- nodeId: number;
6
- resourceId: string;
7
- version: string;
8
- resolveResources: {
9
- resourceId: string;
10
- contracts: {
11
- policyId: string;
12
- }[];
13
- }[];
14
- presentableName: string;
15
- tags?: string[];
16
- }
17
-
18
- export function createPresentable(params: CreatePresentableParamsType) {
19
- // return FUtil.Axios.post(`/v2/presentables`, params);
20
- return FUtil.Request({
21
- method: 'POST',
22
- url: `/v2/presentables`,
23
- data: params,
24
- });
25
- }
26
-
27
- // 更新展品
28
- interface UpdatePresentableParamsType {
29
- presentableId: string;
30
- presentableTitle?: string;
31
- tags?: string[];
32
- coverImages?: string[];
33
- addPolicies?: {
34
- policyName: string;
35
- policyText: string;
36
- status?: 0 | 1;
37
- }[];
38
- updatePolicies?: {
39
- policyId: string;
40
- status: 0 | 1;
41
- }[];
42
- resolveResources?: {
43
- resourceId: string;
44
- contracts: {
45
- policyId: string;
46
- }[];
47
- }[];
48
- }
49
-
50
- export function updatePresentable({presentableId, ...params}: UpdatePresentableParamsType) {
51
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}`, params);
52
- return FUtil.Request({
53
- method: 'PUT',
54
- url: `/v2/presentables/${presentableId}`,
55
- data: params,
56
- });
57
- }
58
-
59
- // 上下线presentable
60
- interface PresentablesOnlineParamsType {
61
- presentableId: string;
62
- onlineStatus: 0 | 1;
63
- }
64
-
65
- export function presentablesOnlineStatus({presentableId, ...params}: PresentablesOnlineParamsType) {
66
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/onlineStatus`, params);
67
- return FUtil.Request({
68
- method: 'PUT',
69
- url: `/v2/presentables/${presentableId}/onlineStatus`,
70
- data: params,
71
- });
72
- }
73
-
74
- // 查看展品详情
75
- interface PresentableDetailsParamsType1 {
76
- presentableId: string;
77
- projection?: string;
78
- isLoadVersionProperty?: 0 | 1;
79
- isLoadPolicyInfo?: 0 | 1;
80
- isLoadCustomPropertyDescriptors?: 0 | 1;
81
- }
82
-
83
- interface PresentableDetailsParamsType2 {
84
- nodeId: number;
85
- resourceId?: string;
86
- resourceName?: string;
87
- presentableName?: string;
88
- projection?: string;
89
- isLoadVersionProperty?: 0 | 1;
90
- isLoadPolicyInfo?: 0 | 1;
91
- isLoadCustomPropertyDescriptors?: 0 | 1;
92
- }
93
-
94
- export function presentableDetails(params: PresentableDetailsParamsType1 | PresentableDetailsParamsType2) {
95
- if ((params as PresentableDetailsParamsType2).nodeId) {
96
- // return FUtil.Axios.get(`/v2/presentables/detail`, {
97
- // params,
98
- // });
99
- return FUtil.Request({
100
- method: 'GET',
101
- url: `/v2/presentables/detail`,
102
- params: params,
103
- });
104
- }
105
- const {presentableId, ...p} = params as PresentableDetailsParamsType1;
106
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
107
- // params: p,
108
- // });
109
- return FUtil.Request({
110
- method: 'GET',
111
- url: `/v2/presentables/${presentableId}`,
112
- params: p,
113
- });
114
- }
115
-
116
- // 查询展品分页列表
117
- interface PresentablesParamsType {
118
- nodeId: number;
119
- skip?: number;
120
- limit?: number;
121
- resourceType?: string;
122
- omitResourceType?: string;
123
- onlineStatus?: number;
124
- tags?: string;
125
- projection?: string;
126
- keywords?: string;
127
- isLoadVersionProperty?: 0 | 1;
128
- isLoadPolicyInfo?: 0 | 1;
129
- }
130
-
131
- export function presentables(params: PresentablesParamsType) {
132
- // return FUtil.Axios.get(`/v2/presentables`, {
133
- // params,
134
- // });
135
- return FUtil.Request({
136
- method: 'GET',
137
- url: `/v2/presentables`,
138
- params: params,
139
- });
140
- }
141
-
142
- // 批量查询展品列表
143
- interface PresentableListParamsType {
144
- nodeId?: number;
145
- userId?: number;
146
- presentableIds?: string;
147
- resourceIds?: string;
148
- resourceNames?: string;
149
- isLoadVersionProperty?: 0 | 1;
150
- isLoadPolicyInfo?: 0 | 1;
151
- projection?: string;
152
- resolveResourceIds?: string;
153
- }
154
-
155
- export function presentableList(params: PresentableListParamsType) {
156
- // return FUtil.Axios.get(`/v2/presentables/list`, {
157
- // params,
158
- // });
159
- return FUtil.Request({
160
- method: 'GET',
161
- url: `/v2/presentables/list`,
162
- params: params,
163
- });
164
- }
165
-
166
- // 查看展品依赖树
167
- interface DependencyTreeParamsType {
168
- presentableId: string;
169
- maxDeep?: number;
170
- nid?: string;
171
- isContainRootNode?: boolean;
172
- version?: string;
173
- }
174
-
175
- export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
176
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
177
- return FUtil.Request({
178
- method: 'GET',
179
- url: `/v2/presentables/${presentableId}/dependencyTree`,
180
- params: params,
181
- });
182
- }
183
-
184
- // 查看展品关系树
185
- interface RelationTreeParamsType {
186
- presentableId: string;
187
- version?: string;
188
- }
189
-
190
- export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
191
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
192
- return FUtil.Request({
193
- method: 'GET',
194
- url: `/v2/presentables/${presentableId}/relationTree`,
195
- params: params,
196
- });
197
- }
198
-
199
- // 查看展品授权树
200
- interface AuthTreeParamsType {
201
- presentableId: string;
202
- maxDeep?: number;
203
- nid?: string;
204
- isContainRootNode?: boolean;
205
- version?: string;
206
- }
207
-
208
- export function authTree({presentableId, ...params}: AuthTreeParamsType) {
209
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
210
- return FUtil.Request({
211
- method: 'GET',
212
- url: `/v2/presentables/${presentableId}/authTree`,
213
- params: params,
214
- });
215
- }
216
-
217
- // 切换展品版本
218
- interface PresentablesVersionParamsType {
219
- presentableId: string;
220
- version: string;
221
- }
222
-
223
- export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
224
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
225
- return FUtil.Request({
226
- method: 'PUT',
227
- url: `/v2/presentables/${presentableId}/version`,
228
- data: params,
229
- });
230
- }
231
-
232
- // 设置展品自定义属性
233
- interface UpdateRewritePropertyParamsType {
234
- presentableId: string;
235
- rewriteProperty: {
236
- key: string;
237
- value: string;
238
- remark: string;
239
- }[];
240
- }
241
-
242
- export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
243
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
244
- return FUtil.Request({
245
- method: 'PUT',
246
- url: `/v2/presentables/${presentableId}/rewriteProperty`,
247
- data: params,
248
- });
249
- }
250
-
251
- // 批量获取展品授权结果
252
- interface BatchAuthParamsType {
253
- nodeId: number;
254
- authType: 1 | 2 | 3; // 1:节点侧授权 2:资源侧授权 3:节点+资源侧授权
255
- presentableIds: string;
256
- }
257
-
258
- export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
259
- // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
260
- // params,
261
- // });
262
- return FUtil.Request({
263
- method: 'GET',
264
- url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
265
- params: params,
266
- });
267
- }
268
-
269
- // 查看合约应用的展品列表
270
- interface ContractAppliedPresentableParamsType {
271
- nodeId: number;
272
- contractIds: string;
273
- }
274
-
275
- export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
276
- // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
277
- // params,
278
- // });
279
- return FUtil.Request({
280
- method: 'GET',
281
- url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
282
- params: params,
283
- });
284
- }
1
+ import FUtil from '../utils';
2
+
3
+ // 创建展品
4
+ export interface CreatePresentableParamsType {
5
+ nodeId: number;
6
+ resourceId: string;
7
+ version: string;
8
+ resolveResources: {
9
+ resourceId: string;
10
+ contracts: {
11
+ policyId: string;
12
+ }[];
13
+ }[];
14
+ presentableName: string;
15
+ tags?: string[];
16
+ }
17
+
18
+ export function createPresentable(params: CreatePresentableParamsType) {
19
+ // return FUtil.Axios.post(`/v2/presentables`, params);
20
+ return FUtil.Request({
21
+ method: 'POST',
22
+ url: `/v2/presentables`,
23
+ data: params,
24
+ });
25
+ }
26
+
27
+ // 更新展品
28
+ interface UpdatePresentableParamsType {
29
+ presentableId: string;
30
+ presentableTitle?: string;
31
+ tags?: string[];
32
+ coverImages?: string[];
33
+ addPolicies?: {
34
+ policyName: string;
35
+ policyText: string;
36
+ status?: 0 | 1;
37
+ }[];
38
+ updatePolicies?: {
39
+ policyId: string;
40
+ status: 0 | 1;
41
+ }[];
42
+ resolveResources?: {
43
+ resourceId: string;
44
+ contracts: {
45
+ policyId: string;
46
+ }[];
47
+ }[];
48
+ }
49
+
50
+ export function updatePresentable({presentableId, ...params}: UpdatePresentableParamsType) {
51
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}`, params);
52
+ return FUtil.Request({
53
+ method: 'PUT',
54
+ url: `/v2/presentables/${presentableId}`,
55
+ data: params,
56
+ });
57
+ }
58
+
59
+ // 上下线presentable
60
+ interface PresentablesOnlineParamsType {
61
+ presentableId: string;
62
+ onlineStatus: 0 | 1;
63
+ }
64
+
65
+ export function presentablesOnlineStatus({presentableId, ...params}: PresentablesOnlineParamsType) {
66
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/onlineStatus`, params);
67
+ return FUtil.Request({
68
+ method: 'PUT',
69
+ url: `/v2/presentables/${presentableId}/onlineStatus`,
70
+ data: params,
71
+ });
72
+ }
73
+
74
+ // 查看展品详情
75
+ interface PresentableDetailsParamsType1 {
76
+ presentableId: string;
77
+ projection?: string;
78
+ isLoadVersionProperty?: 0 | 1;
79
+ isLoadPolicyInfo?: 0 | 1;
80
+ isTranslate?: 0 | 1;
81
+ isLoadCustomPropertyDescriptors?: 0 | 1;
82
+ isLoadResourceDetailInfo?: 0 | 1;
83
+ isLoadResourceVersionInfo?: 0 | 1;
84
+ }
85
+
86
+ interface PresentableDetailsParamsType2 {
87
+ nodeId: number;
88
+ resourceId?: string;
89
+ resourceName?: string;
90
+ presentableName?: string;
91
+ projection?: string;
92
+ isLoadVersionProperty?: 0 | 1;
93
+ isLoadPolicyInfo?: 0 | 1;
94
+ isLoadCustomPropertyDescriptors?: 0 | 1;
95
+ }
96
+
97
+ export function presentableDetails(params: PresentableDetailsParamsType1 | PresentableDetailsParamsType2) {
98
+ if ((params as PresentableDetailsParamsType2).nodeId) {
99
+ // return FUtil.Axios.get(`/v2/presentables/detail`, {
100
+ // params,
101
+ // });
102
+ return FUtil.Request({
103
+ method: 'GET',
104
+ url: `/v2/presentables/detail`,
105
+ params: params,
106
+ });
107
+ }
108
+ const {presentableId, ...p} = params as PresentableDetailsParamsType1;
109
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
110
+ // params: p,
111
+ // });
112
+ return FUtil.Request({
113
+ method: 'GET',
114
+ url: `/v2/presentables/${presentableId}`,
115
+ params: p,
116
+ });
117
+ }
118
+
119
+ // 查询展品分页列表
120
+ interface PresentablesParamsType {
121
+ nodeId: number;
122
+ skip?: number;
123
+ limit?: number;
124
+ resourceType?: string;
125
+ omitResourceType?: string;
126
+ onlineStatus?: number;
127
+ tags?: string;
128
+ projection?: string;
129
+ keywords?: string;
130
+ isLoadVersionProperty?: 0 | 1;
131
+ isLoadPolicyInfo?: 0 | 1;
132
+ }
133
+
134
+ export function presentables(params: PresentablesParamsType) {
135
+ return FUtil.Request({
136
+ method: 'GET',
137
+ url: `/v2/presentables`,
138
+ params: params,
139
+ });
140
+ }
141
+
142
+ // 批量查询展品列表
143
+ interface PresentableListParamsType {
144
+ nodeId?: number;
145
+ userId?: number;
146
+ presentableIds?: string;
147
+ resourceIds?: string;
148
+ resourceNames?: string;
149
+ isLoadVersionProperty?: 0 | 1;
150
+ isLoadPolicyInfo?: 0 | 1;
151
+ isTranslate?: 0 | 1;
152
+ projection?: string;
153
+ resolveResourceIds?: string;
154
+ }
155
+
156
+ export function presentableList(params: PresentableListParamsType) {
157
+ return FUtil.Request({
158
+ method: 'GET',
159
+ url: `/v2/presentables/list`,
160
+ params: params,
161
+ });
162
+ }
163
+
164
+ // 查看展品依赖树
165
+ interface DependencyTreeParamsType {
166
+ presentableId: string;
167
+ maxDeep?: number;
168
+ nid?: string;
169
+ isContainRootNode?: boolean;
170
+ version?: string;
171
+ }
172
+
173
+ export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
174
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
175
+ return FUtil.Request({
176
+ method: 'GET',
177
+ url: `/v2/presentables/${presentableId}/dependencyTree`,
178
+ params: params,
179
+ });
180
+ }
181
+
182
+ // 查看展品关系树
183
+ interface RelationTreeParamsType {
184
+ presentableId: string;
185
+ version?: string;
186
+ }
187
+
188
+ export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
189
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
190
+ return FUtil.Request({
191
+ method: 'GET',
192
+ url: `/v2/presentables/${presentableId}/relationTree`,
193
+ params: params,
194
+ });
195
+ }
196
+
197
+ // 查看展品授权树
198
+ interface AuthTreeParamsType {
199
+ presentableId: string;
200
+ maxDeep?: number;
201
+ nid?: string;
202
+ isContainRootNode?: boolean;
203
+ version?: string;
204
+ }
205
+
206
+ export function authTree({presentableId, ...params}: AuthTreeParamsType) {
207
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
208
+ return FUtil.Request({
209
+ method: 'GET',
210
+ url: `/v2/presentables/${presentableId}/authTree`,
211
+ params: params,
212
+ });
213
+ }
214
+
215
+ // 切换展品版本
216
+ interface PresentablesVersionParamsType {
217
+ presentableId: string;
218
+ version: string;
219
+ }
220
+
221
+ export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
222
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
223
+ return FUtil.Request({
224
+ method: 'PUT',
225
+ url: `/v2/presentables/${presentableId}/version`,
226
+ data: params,
227
+ });
228
+ }
229
+
230
+ // 设置展品自定义属性
231
+ interface UpdateRewritePropertyParamsType {
232
+ presentableId: string;
233
+ rewriteProperty: {
234
+ key: string;
235
+ value: string;
236
+ remark: string;
237
+ }[];
238
+ }
239
+
240
+ export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
241
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
242
+ return FUtil.Request({
243
+ method: 'PUT',
244
+ url: `/v2/presentables/${presentableId}/rewriteProperty`,
245
+ data: params,
246
+ });
247
+ }
248
+
249
+ // 批量获取展品授权结果
250
+ interface BatchAuthParamsType {
251
+ nodeId: number;
252
+ authType: 1 | 2 | 3; // 1:节点侧授权 2:资源侧授权 3:节点+资源侧授权
253
+ presentableIds: string;
254
+ }
255
+
256
+ export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
257
+ // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
258
+ // params,
259
+ // });
260
+ return FUtil.Request({
261
+ method: 'GET',
262
+ url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
263
+ params: params,
264
+ });
265
+ }
266
+
267
+ // 查看合约应用的展品列表
268
+ interface ContractAppliedPresentableParamsType {
269
+ nodeId: number;
270
+ contractIds: string;
271
+ }
272
+
273
+ export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
274
+ // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
275
+ // params,
276
+ // });
277
+ return FUtil.Request({
278
+ method: 'GET',
279
+ url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
280
+ params: params,
281
+ });
282
+ }
@@ -11,7 +11,6 @@ export interface CreateParamsType {
11
11
  }
12
12
 
13
13
  export function create(params: CreateParamsType) {
14
- // return FUtil.Axios.post('/v2/resources', params)
15
14
  return FUtil.Request({
16
15
  method: 'POST',
17
16
  url: `/v2/resources`,
@@ -37,7 +36,6 @@ interface UpdateParamsType {
37
36
  }
38
37
 
39
38
  export function update(params: UpdateParamsType) {
40
- // return FUtil.Axios.put(`/v2/resources/${params.resourceId}`, params);
41
39
  return FUtil.Request({
42
40
  method: 'PUT',
43
41
  url: `/v2/resources/${params.resourceId}`,
@@ -61,9 +59,6 @@ interface ListParamsType {
61
59
  }
62
60
 
63
61
  export function list(params: ListParamsType) {
64
- // return FUtil.Axios.get('/v2/resources', {
65
- // params,
66
- // });
67
62
  return FUtil.Request({
68
63
  method: 'GET',
69
64
  url: `/v2/resources`,
@@ -75,14 +70,12 @@ export function list(params: ListParamsType) {
75
70
  interface InfoParamsType {
76
71
  resourceIdOrName: string;
77
72
  isLoadPolicyInfo?: 0 | 1;
73
+ isTranslate?: 0 | 1;
78
74
  isLoadLatestVersionInfo?: 0 | 1;
79
75
  projection?: string;
80
76
  }
81
77
 
82
78
  export function info({resourceIdOrName, ...params}: InfoParamsType) {
83
- // return FUtil.Axios.get(`/v2/resources/${encodeURIComponent(resourceIdOrName)}`, {
84
- // params: params,
85
- // });
86
79
  return FUtil.Request({
87
80
  method: 'GET',
88
81
  url: `/v2/resources/${encodeURIComponent(resourceIdOrName)}`,
@@ -95,14 +88,12 @@ interface BatchInfoParamsType {
95
88
  resourceIds?: string;
96
89
  resourceNames?: string;
97
90
  isLoadPolicyInfo?: 0 | 1;
91
+ isTranslate?: 0 | 1;
98
92
  isLoadLatestVersionInfo?: 0 | 1;
99
93
  projection?: string;
100
94
  }
101
95
 
102
96
  export function batchInfo(params: BatchInfoParamsType) {
103
- // return FUtil.Axios.get(`/v2/resources/list`, {
104
- // params: params,
105
- // });
106
97
  return FUtil.Request({
107
98
  method: 'GET',
108
99
  url: `/v2/resources/list`,
@@ -120,9 +111,6 @@ interface DependencyTreeParamsType {
120
111
  }
121
112
 
122
113
  export function dependencyTree({resourceId, ...params}: DependencyTreeParamsType) {
123
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/dependencyTree`, {
124
- // params: params,
125
- // });
126
114
  return FUtil.Request({
127
115
  method: 'GET',
128
116
  url: `/v2/resources/${resourceId}/dependencyTree`,
@@ -137,9 +125,6 @@ interface AuthTreeParamsType {
137
125
  }
138
126
 
139
127
  export function authTree({resourceId, ...params}: AuthTreeParamsType) {
140
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/authTree`, {
141
- // params: params,
142
- // });
143
128
  return FUtil.Request({
144
129
  method: 'GET',
145
130
  url: `/v2/resources/${resourceId}/authTree`,
@@ -198,13 +183,7 @@ interface ResourceVersionInfoParamsType2 {
198
183
  }
199
184
 
200
185
  export function resourceVersionInfo(params: ResourceVersionInfoParamsType1 | ResourceVersionInfoParamsType2) {
201
- // console.log('####!AAA');
202
186
  if ((params as ResourceVersionInfoParamsType1).version) {
203
- // return FUtil.Axios.get(`/v2/resources/${(params as ResourceVersionInfoParamsType1).resourceId}/versions/${(params as ResourceVersionInfoParamsType1).version}`, {
204
- // params: {
205
- // projection: params.projection,
206
- // }
207
- // });
208
187
  return FUtil.Request({
209
188
  method: 'GET',
210
189
  url: `/v2/resources/${(params as ResourceVersionInfoParamsType1).resourceId}/versions/${(params as ResourceVersionInfoParamsType1).version}`,
@@ -212,9 +191,6 @@ export function resourceVersionInfo(params: ResourceVersionInfoParamsType1 | Res
212
191
  });
213
192
  }
214
193
 
215
- // return FUtil.Axios.get(`/v2/resources/versions/detail`, {
216
- // params,
217
- // });
218
194
  return FUtil.Request({
219
195
  method: 'GET',
220
196
  url: `/v2/resources/versions/detail`,
@@ -1 +0,0 @@
1
- export declare type ContractStatus = 'active' | 'testActive' | 'inactive' | 'terminal';