@freelog/tools-lib 0.1.65 → 0.1.69
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/informalNodes.d.ts +5 -0
- package/dist/tools-lib.cjs.development.js +88 -46
- 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 -46
- package/dist/tools-lib.esm.js.map +1 -1
- package/dist/utils/axios.d.ts +0 -3
- package/dist/utils/linkTo.d.ts +8 -4
- package/package.json +1 -1
- package/src/service-API/informalNodes.ts +14 -3
- package/src/utils/axios.ts +132 -149
- package/src/utils/linkTo.ts +14 -10
|
@@ -78,6 +78,11 @@ interface RulesRematchParamsType {
|
|
|
78
78
|
nodeId: number;
|
|
79
79
|
}
|
|
80
80
|
export declare function rulesRematch({ nodeId, ...params }: RulesRematchParamsType): Promise<any>;
|
|
81
|
+
interface RulesPreExecutionParamsType {
|
|
82
|
+
nodeId: number;
|
|
83
|
+
testRuleText: string;
|
|
84
|
+
}
|
|
85
|
+
export declare function rulesPreExecution({ nodeId, ...params }: RulesPreExecutionParamsType): Promise<any>;
|
|
81
86
|
interface BatchGetAuthsParamsType {
|
|
82
87
|
nodeId: number;
|
|
83
88
|
exhibitIds: string;
|
|
@@ -1021,7 +1021,6 @@ function resourceDetails(_ref2) {
|
|
|
1021
1021
|
var resourceID = _ref2.resourceID,
|
|
1022
1022
|
params = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
1023
1023
|
|
|
1024
|
-
// return `/resource/${resourceID}`;
|
|
1025
1024
|
return "/resource/details/" + resourceID + handleQuery(params);
|
|
1026
1025
|
}
|
|
1027
1026
|
function resourceCreator(_temp2) {
|
|
@@ -1111,11 +1110,14 @@ function resourceVersionCreateSuccess(_ref18) {
|
|
|
1111
1110
|
version = _ref18.version;
|
|
1112
1111
|
return "/result/resource/version/create/success/" + resourceID + "/" + version;
|
|
1113
1112
|
}
|
|
1113
|
+
function nodeCreateSuccess(_ref19) {
|
|
1114
|
+
var nodeID = _ref19.nodeID;
|
|
1115
|
+
return "/result/node/create/success/" + nodeID;
|
|
1116
|
+
}
|
|
1114
1117
|
function exception403(_temp7) {
|
|
1115
|
-
var
|
|
1116
|
-
params = _extends({},
|
|
1118
|
+
var _ref20 = _temp7 === void 0 ? {} : _temp7,
|
|
1119
|
+
params = _extends({}, _ref20);
|
|
1117
1120
|
|
|
1118
|
-
// console.log(from, 'exception403!!!!!!!!');
|
|
1119
1121
|
var fromUrl = params.from || '';
|
|
1120
1122
|
|
|
1121
1123
|
if (!fromUrl) {
|
|
@@ -1123,32 +1125,31 @@ function exception403(_temp7) {
|
|
|
1123
1125
|
href = _window$location.href,
|
|
1124
1126
|
origin = _window$location.origin;
|
|
1125
1127
|
fromUrl = href.replace(origin, '');
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
+
}
|
|
1128
1129
|
|
|
1129
1130
|
return "/exception/403" + handleQuery({
|
|
1130
1131
|
from: fromUrl
|
|
1131
1132
|
});
|
|
1132
1133
|
}
|
|
1133
1134
|
function login(_temp8) {
|
|
1134
|
-
var
|
|
1135
|
-
goTo =
|
|
1135
|
+
var _ref21 = _temp8 === void 0 ? {} : _temp8,
|
|
1136
|
+
goTo = _ref21.goTo;
|
|
1136
1137
|
|
|
1137
1138
|
return "/login" + handleQuery({
|
|
1138
1139
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
1139
1140
|
});
|
|
1140
1141
|
}
|
|
1141
1142
|
function logon(_temp9) {
|
|
1142
|
-
var
|
|
1143
|
-
goTo =
|
|
1143
|
+
var _ref22 = _temp9 === void 0 ? {} : _temp9,
|
|
1144
|
+
goTo = _ref22.goTo;
|
|
1144
1145
|
|
|
1145
1146
|
return "/logon" + handleQuery({
|
|
1146
1147
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
1147
1148
|
});
|
|
1148
1149
|
}
|
|
1149
1150
|
function retrieveUserPassword(_temp10) {
|
|
1150
|
-
var
|
|
1151
|
-
goTo =
|
|
1151
|
+
var _ref23 = _temp10 === void 0 ? {} : _temp10,
|
|
1152
|
+
goTo = _ref23.goTo;
|
|
1152
1153
|
|
|
1153
1154
|
return "/retrieve" + handleQuery({
|
|
1154
1155
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
@@ -1215,6 +1216,7 @@ var LinkTo = {
|
|
|
1215
1216
|
objectDetails: objectDetails,
|
|
1216
1217
|
resourceCreateSuccess: resourceCreateSuccess,
|
|
1217
1218
|
resourceVersionCreateSuccess: resourceVersionCreateSuccess,
|
|
1219
|
+
nodeCreateSuccess: nodeCreateSuccess,
|
|
1218
1220
|
exception403: exception403,
|
|
1219
1221
|
login: login,
|
|
1220
1222
|
logon: logon,
|
|
@@ -1274,23 +1276,23 @@ var Predefined = {
|
|
|
1274
1276
|
get EnumContractStatus () { return EnumContractStatus; }
|
|
1275
1277
|
};
|
|
1276
1278
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
// export let apiHost: string = '';
|
|
1279
|
+
var codeMessage = {
|
|
1280
|
+
200: '服务器成功返回请求的数据。',
|
|
1281
|
+
201: '新建或修改数据成功。',
|
|
1282
|
+
202: '一个请求已经进入后台排队(异步任务)。',
|
|
1283
|
+
204: '删除数据成功。',
|
|
1284
|
+
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
1285
|
+
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
1286
|
+
403: '用户得到授权,但是访问是被禁止的。',
|
|
1287
|
+
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
1288
|
+
406: '请求的格式不可得。',
|
|
1289
|
+
410: '请求的资源被永久删除,且不会再得到的。',
|
|
1290
|
+
422: '当创建一个对象时,发生一个验证错误。',
|
|
1291
|
+
500: '服务器发生错误,请检查服务器。',
|
|
1292
|
+
502: '网关错误。',
|
|
1293
|
+
503: '服务不可用,服务器暂时过载或维护。',
|
|
1294
|
+
504: '网关超时。'
|
|
1295
|
+
}; // export let apiHost: string = '';
|
|
1294
1296
|
|
|
1295
1297
|
if (window.location.hostname.includes('.com')) {
|
|
1296
1298
|
// apiHost = `${window.location.protocol}//qi.${(window.location.host.match(/(?<=\.).*/) || [''])[0]}`;
|
|
@@ -1321,28 +1323,59 @@ if (window.location.hostname.includes('.com')) {
|
|
|
1321
1323
|
// };
|
|
1322
1324
|
//
|
|
1323
1325
|
// // Add a request interceptor
|
|
1324
|
-
// axios.interceptors.request.use(function (config) {
|
|
1325
|
-
// // Do something before request is sent
|
|
1326
|
-
// NProgress.start();
|
|
1327
|
-
// return config;
|
|
1328
|
-
// }, function (error) {
|
|
1329
|
-
// // Do something with request error
|
|
1330
|
-
// NProgress.done();
|
|
1331
|
-
// return Promise.reject(error);
|
|
1332
|
-
// });
|
|
1333
1326
|
|
|
1334
1327
|
|
|
1335
1328
|
axios.interceptors.request.use(function (config) {
|
|
1336
|
-
|
|
1329
|
+
// Do something before request is sent
|
|
1330
|
+
NProgress.start();
|
|
1337
1331
|
return config;
|
|
1338
1332
|
}, function (error) {
|
|
1333
|
+
// Do something with request error
|
|
1339
1334
|
NProgress.done();
|
|
1340
1335
|
return Promise.reject(error);
|
|
1341
1336
|
});
|
|
1342
|
-
|
|
1337
|
+
/**
|
|
1338
|
+
* 配置request请求时的默认参数
|
|
1339
|
+
*/
|
|
1340
|
+
|
|
1341
|
+
axios.interceptors.response.use(function (response) {
|
|
1342
|
+
var _headers$contentDisp;
|
|
1343
|
+
|
|
1344
|
+
// Do something with response data
|
|
1345
|
+
// console.log(response, 'response!!!!!!');
|
|
1343
1346
|
NProgress.done();
|
|
1344
|
-
|
|
1347
|
+
|
|
1348
|
+
if (response.status !== 200) {
|
|
1349
|
+
var error = {
|
|
1350
|
+
description: codeMessage[response.status],
|
|
1351
|
+
message: response.status
|
|
1352
|
+
}; // notification.error(error);
|
|
1353
|
+
|
|
1354
|
+
throw new Error(JSON.stringify(error));
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
var data = response.data,
|
|
1358
|
+
headers = response.headers;
|
|
1359
|
+
|
|
1360
|
+
if ((_headers$contentDisp = headers['content-disposition']) != null && _headers$contentDisp.includes('attachment;')) {
|
|
1361
|
+
// downloadFile(response);
|
|
1362
|
+
return;
|
|
1363
|
+
} // console.log(data, 'data2390jasdflkf');
|
|
1364
|
+
// if ((data.errcode === undefined
|
|
1365
|
+
// ? (data.errCode !== 0 && data.errCode !== 2)
|
|
1366
|
+
// : (data.errcode !== 0 && data.errcode !== 2))
|
|
1367
|
+
// || data.ret !== 0) {
|
|
1368
|
+
//
|
|
1369
|
+
// // notification.error({
|
|
1370
|
+
// // message: data.msg,
|
|
1371
|
+
// // });
|
|
1372
|
+
// throw new Error(JSON.stringify(data));
|
|
1373
|
+
// }
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
return data;
|
|
1345
1377
|
}, function (error) {
|
|
1378
|
+
// Do something with response error
|
|
1346
1379
|
NProgress.done();
|
|
1347
1380
|
return Promise.reject(error);
|
|
1348
1381
|
});
|
|
@@ -2412,7 +2445,8 @@ var _excluded$5 = ["nodeId"],
|
|
|
2412
2445
|
_excluded7$2 = ["testResourceId"],
|
|
2413
2446
|
_excluded8$2 = ["nodeId"],
|
|
2414
2447
|
_excluded9$2 = ["nodeId"],
|
|
2415
|
-
_excluded10$2 = ["nodeId"]
|
|
2448
|
+
_excluded10$2 = ["nodeId"],
|
|
2449
|
+
_excluded11$1 = ["nodeId"];
|
|
2416
2450
|
function testResources(_ref) {
|
|
2417
2451
|
var nodeId = _ref.nodeId,
|
|
2418
2452
|
params = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
@@ -2534,21 +2568,28 @@ function rulesRematch(_ref13) {
|
|
|
2534
2568
|
var nodeId = _ref13.nodeId,
|
|
2535
2569
|
params = _objectWithoutPropertiesLoose(_ref13, _excluded9$2);
|
|
2536
2570
|
|
|
2537
|
-
// return FUtil.Axios.post(`/v2/testNodes/${nodeId}/rules/rematch`, params);
|
|
2538
2571
|
return FUtil.Request({
|
|
2539
2572
|
method: 'POST',
|
|
2540
2573
|
url: "/v2/testNodes/" + nodeId + "/rules/rematch",
|
|
2541
2574
|
data: params
|
|
2542
2575
|
});
|
|
2543
2576
|
}
|
|
2544
|
-
function
|
|
2577
|
+
function rulesPreExecution(_ref14) {
|
|
2545
2578
|
var nodeId = _ref14.nodeId,
|
|
2546
2579
|
params = _objectWithoutPropertiesLoose(_ref14, _excluded10$2);
|
|
2547
2580
|
|
|
2548
|
-
|
|
2581
|
+
return FUtil.Request({
|
|
2582
|
+
method: 'POST',
|
|
2583
|
+
url: "/v2/testNodes/" + nodeId + "/rules/preExecution",
|
|
2584
|
+
data: params
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
function batchGetAuths(_ref15) {
|
|
2588
|
+
var nodeId = _ref15.nodeId,
|
|
2589
|
+
params = _objectWithoutPropertiesLoose(_ref15, _excluded11$1);
|
|
2590
|
+
|
|
2549
2591
|
return FUtil.Request({
|
|
2550
2592
|
method: 'GET',
|
|
2551
|
-
// url: `/v2/auths/testResources/nodes/${nodeId}/result`,
|
|
2552
2593
|
url: "/v2/auths/exhibits/" + nodeId + "/test/batchAuth/results",
|
|
2553
2594
|
params: params
|
|
2554
2595
|
});
|
|
@@ -2569,6 +2610,7 @@ var InformalNode = {
|
|
|
2569
2610
|
testResourceDetails: testResourceDetails,
|
|
2570
2611
|
searchTestResourcesByDependency: searchTestResourcesByDependency,
|
|
2571
2612
|
rulesRematch: rulesRematch,
|
|
2613
|
+
rulesPreExecution: rulesPreExecution,
|
|
2572
2614
|
batchGetAuths: batchGetAuths
|
|
2573
2615
|
};
|
|
2574
2616
|
|