@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
package/dist/tools-lib.esm.js
CHANGED
|
@@ -1015,7 +1015,6 @@ function resourceDetails(_ref2) {
|
|
|
1015
1015
|
var resourceID = _ref2.resourceID,
|
|
1016
1016
|
params = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
1017
1017
|
|
|
1018
|
-
// return `/resource/${resourceID}`;
|
|
1019
1018
|
return "/resource/details/" + resourceID + handleQuery(params);
|
|
1020
1019
|
}
|
|
1021
1020
|
function resourceCreator(_temp2) {
|
|
@@ -1105,11 +1104,14 @@ function resourceVersionCreateSuccess(_ref18) {
|
|
|
1105
1104
|
version = _ref18.version;
|
|
1106
1105
|
return "/result/resource/version/create/success/" + resourceID + "/" + version;
|
|
1107
1106
|
}
|
|
1107
|
+
function nodeCreateSuccess(_ref19) {
|
|
1108
|
+
var nodeID = _ref19.nodeID;
|
|
1109
|
+
return "/result/node/create/success/" + nodeID;
|
|
1110
|
+
}
|
|
1108
1111
|
function exception403(_temp7) {
|
|
1109
|
-
var
|
|
1110
|
-
params = _extends({},
|
|
1112
|
+
var _ref20 = _temp7 === void 0 ? {} : _temp7,
|
|
1113
|
+
params = _extends({}, _ref20);
|
|
1111
1114
|
|
|
1112
|
-
// console.log(from, 'exception403!!!!!!!!');
|
|
1113
1115
|
var fromUrl = params.from || '';
|
|
1114
1116
|
|
|
1115
1117
|
if (!fromUrl) {
|
|
@@ -1117,32 +1119,31 @@ function exception403(_temp7) {
|
|
|
1117
1119
|
href = _window$location.href,
|
|
1118
1120
|
origin = _window$location.origin;
|
|
1119
1121
|
fromUrl = href.replace(origin, '');
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
+
}
|
|
1122
1123
|
|
|
1123
1124
|
return "/exception/403" + handleQuery({
|
|
1124
1125
|
from: fromUrl
|
|
1125
1126
|
});
|
|
1126
1127
|
}
|
|
1127
1128
|
function login(_temp8) {
|
|
1128
|
-
var
|
|
1129
|
-
goTo =
|
|
1129
|
+
var _ref21 = _temp8 === void 0 ? {} : _temp8,
|
|
1130
|
+
goTo = _ref21.goTo;
|
|
1130
1131
|
|
|
1131
1132
|
return "/login" + handleQuery({
|
|
1132
1133
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
1133
1134
|
});
|
|
1134
1135
|
}
|
|
1135
1136
|
function logon(_temp9) {
|
|
1136
|
-
var
|
|
1137
|
-
goTo =
|
|
1137
|
+
var _ref22 = _temp9 === void 0 ? {} : _temp9,
|
|
1138
|
+
goTo = _ref22.goTo;
|
|
1138
1139
|
|
|
1139
1140
|
return "/logon" + handleQuery({
|
|
1140
1141
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
1141
1142
|
});
|
|
1142
1143
|
}
|
|
1143
1144
|
function retrieveUserPassword(_temp10) {
|
|
1144
|
-
var
|
|
1145
|
-
goTo =
|
|
1145
|
+
var _ref23 = _temp10 === void 0 ? {} : _temp10,
|
|
1146
|
+
goTo = _ref23.goTo;
|
|
1146
1147
|
|
|
1147
1148
|
return "/retrieve" + handleQuery({
|
|
1148
1149
|
goTo: goTo ? encodeURIComponent(goTo) : undefined
|
|
@@ -1209,6 +1210,7 @@ var LinkTo = {
|
|
|
1209
1210
|
objectDetails: objectDetails,
|
|
1210
1211
|
resourceCreateSuccess: resourceCreateSuccess,
|
|
1211
1212
|
resourceVersionCreateSuccess: resourceVersionCreateSuccess,
|
|
1213
|
+
nodeCreateSuccess: nodeCreateSuccess,
|
|
1212
1214
|
exception403: exception403,
|
|
1213
1215
|
login: login,
|
|
1214
1216
|
logon: logon,
|
|
@@ -1268,23 +1270,23 @@ var Predefined = {
|
|
|
1268
1270
|
get EnumContractStatus () { return EnumContractStatus; }
|
|
1269
1271
|
};
|
|
1270
1272
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
// export let apiHost: string = '';
|
|
1273
|
+
var codeMessage = {
|
|
1274
|
+
200: '服务器成功返回请求的数据。',
|
|
1275
|
+
201: '新建或修改数据成功。',
|
|
1276
|
+
202: '一个请求已经进入后台排队(异步任务)。',
|
|
1277
|
+
204: '删除数据成功。',
|
|
1278
|
+
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
1279
|
+
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
1280
|
+
403: '用户得到授权,但是访问是被禁止的。',
|
|
1281
|
+
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
1282
|
+
406: '请求的格式不可得。',
|
|
1283
|
+
410: '请求的资源被永久删除,且不会再得到的。',
|
|
1284
|
+
422: '当创建一个对象时,发生一个验证错误。',
|
|
1285
|
+
500: '服务器发生错误,请检查服务器。',
|
|
1286
|
+
502: '网关错误。',
|
|
1287
|
+
503: '服务不可用,服务器暂时过载或维护。',
|
|
1288
|
+
504: '网关超时。'
|
|
1289
|
+
}; // export let apiHost: string = '';
|
|
1288
1290
|
|
|
1289
1291
|
if (window.location.hostname.includes('.com')) {
|
|
1290
1292
|
// apiHost = `${window.location.protocol}//qi.${(window.location.host.match(/(?<=\.).*/) || [''])[0]}`;
|
|
@@ -1315,28 +1317,59 @@ if (window.location.hostname.includes('.com')) {
|
|
|
1315
1317
|
// };
|
|
1316
1318
|
//
|
|
1317
1319
|
// // Add a request interceptor
|
|
1318
|
-
// axios.interceptors.request.use(function (config) {
|
|
1319
|
-
// // Do something before request is sent
|
|
1320
|
-
// NProgress.start();
|
|
1321
|
-
// return config;
|
|
1322
|
-
// }, function (error) {
|
|
1323
|
-
// // Do something with request error
|
|
1324
|
-
// NProgress.done();
|
|
1325
|
-
// return Promise.reject(error);
|
|
1326
|
-
// });
|
|
1327
1320
|
|
|
1328
1321
|
|
|
1329
1322
|
axios.interceptors.request.use(function (config) {
|
|
1330
|
-
|
|
1323
|
+
// Do something before request is sent
|
|
1324
|
+
NProgress.start();
|
|
1331
1325
|
return config;
|
|
1332
1326
|
}, function (error) {
|
|
1327
|
+
// Do something with request error
|
|
1333
1328
|
NProgress.done();
|
|
1334
1329
|
return Promise.reject(error);
|
|
1335
1330
|
});
|
|
1336
|
-
|
|
1331
|
+
/**
|
|
1332
|
+
* 配置request请求时的默认参数
|
|
1333
|
+
*/
|
|
1334
|
+
|
|
1335
|
+
axios.interceptors.response.use(function (response) {
|
|
1336
|
+
var _headers$contentDisp;
|
|
1337
|
+
|
|
1338
|
+
// Do something with response data
|
|
1339
|
+
// console.log(response, 'response!!!!!!');
|
|
1337
1340
|
NProgress.done();
|
|
1338
|
-
|
|
1341
|
+
|
|
1342
|
+
if (response.status !== 200) {
|
|
1343
|
+
var error = {
|
|
1344
|
+
description: codeMessage[response.status],
|
|
1345
|
+
message: response.status
|
|
1346
|
+
}; // notification.error(error);
|
|
1347
|
+
|
|
1348
|
+
throw new Error(JSON.stringify(error));
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
var data = response.data,
|
|
1352
|
+
headers = response.headers;
|
|
1353
|
+
|
|
1354
|
+
if ((_headers$contentDisp = headers['content-disposition']) != null && _headers$contentDisp.includes('attachment;')) {
|
|
1355
|
+
// downloadFile(response);
|
|
1356
|
+
return;
|
|
1357
|
+
} // console.log(data, 'data2390jasdflkf');
|
|
1358
|
+
// if ((data.errcode === undefined
|
|
1359
|
+
// ? (data.errCode !== 0 && data.errCode !== 2)
|
|
1360
|
+
// : (data.errcode !== 0 && data.errcode !== 2))
|
|
1361
|
+
// || data.ret !== 0) {
|
|
1362
|
+
//
|
|
1363
|
+
// // notification.error({
|
|
1364
|
+
// // message: data.msg,
|
|
1365
|
+
// // });
|
|
1366
|
+
// throw new Error(JSON.stringify(data));
|
|
1367
|
+
// }
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
return data;
|
|
1339
1371
|
}, function (error) {
|
|
1372
|
+
// Do something with response error
|
|
1340
1373
|
NProgress.done();
|
|
1341
1374
|
return Promise.reject(error);
|
|
1342
1375
|
});
|
|
@@ -2406,7 +2439,8 @@ var _excluded$5 = ["nodeId"],
|
|
|
2406
2439
|
_excluded7$2 = ["testResourceId"],
|
|
2407
2440
|
_excluded8$2 = ["nodeId"],
|
|
2408
2441
|
_excluded9$2 = ["nodeId"],
|
|
2409
|
-
_excluded10$2 = ["nodeId"]
|
|
2442
|
+
_excluded10$2 = ["nodeId"],
|
|
2443
|
+
_excluded11$1 = ["nodeId"];
|
|
2410
2444
|
function testResources(_ref) {
|
|
2411
2445
|
var nodeId = _ref.nodeId,
|
|
2412
2446
|
params = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
@@ -2528,21 +2562,28 @@ function rulesRematch(_ref13) {
|
|
|
2528
2562
|
var nodeId = _ref13.nodeId,
|
|
2529
2563
|
params = _objectWithoutPropertiesLoose(_ref13, _excluded9$2);
|
|
2530
2564
|
|
|
2531
|
-
// return FUtil.Axios.post(`/v2/testNodes/${nodeId}/rules/rematch`, params);
|
|
2532
2565
|
return FUtil.Request({
|
|
2533
2566
|
method: 'POST',
|
|
2534
2567
|
url: "/v2/testNodes/" + nodeId + "/rules/rematch",
|
|
2535
2568
|
data: params
|
|
2536
2569
|
});
|
|
2537
2570
|
}
|
|
2538
|
-
function
|
|
2571
|
+
function rulesPreExecution(_ref14) {
|
|
2539
2572
|
var nodeId = _ref14.nodeId,
|
|
2540
2573
|
params = _objectWithoutPropertiesLoose(_ref14, _excluded10$2);
|
|
2541
2574
|
|
|
2542
|
-
|
|
2575
|
+
return FUtil.Request({
|
|
2576
|
+
method: 'POST',
|
|
2577
|
+
url: "/v2/testNodes/" + nodeId + "/rules/preExecution",
|
|
2578
|
+
data: params
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
function batchGetAuths(_ref15) {
|
|
2582
|
+
var nodeId = _ref15.nodeId,
|
|
2583
|
+
params = _objectWithoutPropertiesLoose(_ref15, _excluded11$1);
|
|
2584
|
+
|
|
2543
2585
|
return FUtil.Request({
|
|
2544
2586
|
method: 'GET',
|
|
2545
|
-
// url: `/v2/auths/testResources/nodes/${nodeId}/result`,
|
|
2546
2587
|
url: "/v2/auths/exhibits/" + nodeId + "/test/batchAuth/results",
|
|
2547
2588
|
params: params
|
|
2548
2589
|
});
|
|
@@ -2563,6 +2604,7 @@ var InformalNode = {
|
|
|
2563
2604
|
testResourceDetails: testResourceDetails,
|
|
2564
2605
|
searchTestResourcesByDependency: searchTestResourcesByDependency,
|
|
2565
2606
|
rulesRematch: rulesRematch,
|
|
2607
|
+
rulesPreExecution: rulesPreExecution,
|
|
2566
2608
|
batchGetAuths: batchGetAuths
|
|
2567
2609
|
};
|
|
2568
2610
|
|