@freelog/tools-lib 0.1.76 → 0.1.77

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,281 @@
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
+ projection?: string;
152
+ resolveResourceIds?: string;
153
+ }
154
+
155
+ export function presentableList(params: PresentableListParamsType) {
156
+ return FUtil.Request({
157
+ method: 'GET',
158
+ url: `/v2/presentables/list`,
159
+ params: params,
160
+ });
161
+ }
162
+
163
+ // 查看展品依赖树
164
+ interface DependencyTreeParamsType {
165
+ presentableId: string;
166
+ maxDeep?: number;
167
+ nid?: string;
168
+ isContainRootNode?: boolean;
169
+ version?: string;
170
+ }
171
+
172
+ export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
173
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
174
+ return FUtil.Request({
175
+ method: 'GET',
176
+ url: `/v2/presentables/${presentableId}/dependencyTree`,
177
+ params: params,
178
+ });
179
+ }
180
+
181
+ // 查看展品关系树
182
+ interface RelationTreeParamsType {
183
+ presentableId: string;
184
+ version?: string;
185
+ }
186
+
187
+ export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
188
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
189
+ return FUtil.Request({
190
+ method: 'GET',
191
+ url: `/v2/presentables/${presentableId}/relationTree`,
192
+ params: params,
193
+ });
194
+ }
195
+
196
+ // 查看展品授权树
197
+ interface AuthTreeParamsType {
198
+ presentableId: string;
199
+ maxDeep?: number;
200
+ nid?: string;
201
+ isContainRootNode?: boolean;
202
+ version?: string;
203
+ }
204
+
205
+ export function authTree({presentableId, ...params}: AuthTreeParamsType) {
206
+ // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
207
+ return FUtil.Request({
208
+ method: 'GET',
209
+ url: `/v2/presentables/${presentableId}/authTree`,
210
+ params: params,
211
+ });
212
+ }
213
+
214
+ // 切换展品版本
215
+ interface PresentablesVersionParamsType {
216
+ presentableId: string;
217
+ version: string;
218
+ }
219
+
220
+ export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
221
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
222
+ return FUtil.Request({
223
+ method: 'PUT',
224
+ url: `/v2/presentables/${presentableId}/version`,
225
+ data: params,
226
+ });
227
+ }
228
+
229
+ // 设置展品自定义属性
230
+ interface UpdateRewritePropertyParamsType {
231
+ presentableId: string;
232
+ rewriteProperty: {
233
+ key: string;
234
+ value: string;
235
+ remark: string;
236
+ }[];
237
+ }
238
+
239
+ export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
240
+ // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
241
+ return FUtil.Request({
242
+ method: 'PUT',
243
+ url: `/v2/presentables/${presentableId}/rewriteProperty`,
244
+ data: params,
245
+ });
246
+ }
247
+
248
+ // 批量获取展品授权结果
249
+ interface BatchAuthParamsType {
250
+ nodeId: number;
251
+ authType: 1 | 2 | 3; // 1:节点侧授权 2:资源侧授权 3:节点+资源侧授权
252
+ presentableIds: string;
253
+ }
254
+
255
+ export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
256
+ // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
257
+ // params,
258
+ // });
259
+ return FUtil.Request({
260
+ method: 'GET',
261
+ url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
262
+ params: params,
263
+ });
264
+ }
265
+
266
+ // 查看合约应用的展品列表
267
+ interface ContractAppliedPresentableParamsType {
268
+ nodeId: number;
269
+ contractIds: string;
270
+ }
271
+
272
+ export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
273
+ // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
274
+ // params,
275
+ // });
276
+ return FUtil.Request({
277
+ method: 'GET',
278
+ url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
279
+ params: params,
280
+ });
281
+ }
@@ -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)}`,
@@ -100,9 +93,6 @@ interface BatchInfoParamsType {
100
93
  }
101
94
 
102
95
  export function batchInfo(params: BatchInfoParamsType) {
103
- // return FUtil.Axios.get(`/v2/resources/list`, {
104
- // params: params,
105
- // });
106
96
  return FUtil.Request({
107
97
  method: 'GET',
108
98
  url: `/v2/resources/list`,
@@ -120,9 +110,6 @@ interface DependencyTreeParamsType {
120
110
  }
121
111
 
122
112
  export function dependencyTree({resourceId, ...params}: DependencyTreeParamsType) {
123
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/dependencyTree`, {
124
- // params: params,
125
- // });
126
113
  return FUtil.Request({
127
114
  method: 'GET',
128
115
  url: `/v2/resources/${resourceId}/dependencyTree`,
@@ -137,9 +124,6 @@ interface AuthTreeParamsType {
137
124
  }
138
125
 
139
126
  export function authTree({resourceId, ...params}: AuthTreeParamsType) {
140
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/authTree`, {
141
- // params: params,
142
- // });
143
127
  return FUtil.Request({
144
128
  method: 'GET',
145
129
  url: `/v2/resources/${resourceId}/authTree`,
@@ -198,13 +182,7 @@ interface ResourceVersionInfoParamsType2 {
198
182
  }
199
183
 
200
184
  export function resourceVersionInfo(params: ResourceVersionInfoParamsType1 | ResourceVersionInfoParamsType2) {
201
- // console.log('####!AAA');
202
185
  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
186
  return FUtil.Request({
209
187
  method: 'GET',
210
188
  url: `/v2/resources/${(params as ResourceVersionInfoParamsType1).resourceId}/versions/${(params as ResourceVersionInfoParamsType1).version}`,
@@ -212,9 +190,6 @@ export function resourceVersionInfo(params: ResourceVersionInfoParamsType1 | Res
212
190
  });
213
191
  }
214
192
 
215
- // return FUtil.Axios.get(`/v2/resources/versions/detail`, {
216
- // params,
217
- // });
218
193
  return FUtil.Request({
219
194
  method: 'GET',
220
195
  url: `/v2/resources/versions/detail`,