echoapi-converter 0.0.14 → 0.0.16
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/index.js +83 -388
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -224,15 +224,9 @@ const deepHandleModelRef = (modelObj, modelsObj, version) => {
|
|
|
224
224
|
for (const key in modelObj) {
|
|
225
225
|
if (lodash.has(modelObj, key)) {
|
|
226
226
|
const value = modelObj[key];
|
|
227
|
-
<<<<<<< HEAD
|
|
228
227
|
// 如果属性名为 "ECHOAPI_REFS"
|
|
229
|
-
if (key ===
|
|
230
|
-
const lonely = !lodash.has(modelObj, 'properties') || lodash.isEmpty(modelObj.properties);
|
|
231
|
-
=======
|
|
232
|
-
// 如果属性名为 "APIPOST_REFS"
|
|
233
|
-
if (key === "APIPOST_REFS") {
|
|
228
|
+
if (key === "ECHOAPI_REFS") {
|
|
234
229
|
const lonely = !lodash.has(modelObj, "properties") || lodash.isEmpty(modelObj.properties);
|
|
235
|
-
>>>>>>> main
|
|
236
230
|
if (lodash.isPlainObject(value) && !lodash.isEmpty(value)) {
|
|
237
231
|
const refArr = Object.keys(value);
|
|
238
232
|
let modelPath = "";
|
|
@@ -713,15 +707,9 @@ class ApipostToSwagger {
|
|
|
713
707
|
handleProject() {
|
|
714
708
|
const { name, intro } = this.apiToSwaggerOrigin.project || {};
|
|
715
709
|
this.apiToSwaggerResult.info = {
|
|
716
|
-
|
|
717
|
-
title: name || 'New Project',
|
|
718
|
-
description: intro || '',
|
|
719
|
-
version: '1.0.0',
|
|
720
|
-
=======
|
|
721
|
-
title: name || "新建项目",
|
|
710
|
+
title: name || "New Project",
|
|
722
711
|
description: intro || "",
|
|
723
712
|
version: "1.0.0",
|
|
724
|
-
>>>>>>> main
|
|
725
713
|
};
|
|
726
714
|
if (this.apiToSwaggerVersion == "2.0") {
|
|
727
715
|
this.apiToSwaggerResult.swagger = "2.0";
|
|
@@ -781,13 +769,8 @@ class ApipostToSwagger {
|
|
|
781
769
|
if (lodash.isArray(envs) && envs.length > 0) {
|
|
782
770
|
for (const env of envs) {
|
|
783
771
|
const servers = {
|
|
784
|
-
<<<<<<< HEAD
|
|
785
|
-
url: (env === null || env === void 0 ? void 0 : env.url) || '',
|
|
786
|
-
description: (env === null || env === void 0 ? void 0 : env.name) || 'New Environment',
|
|
787
|
-
=======
|
|
788
772
|
url: (env === null || env === void 0 ? void 0 : env.url) || "",
|
|
789
|
-
description: (env === null || env === void 0 ? void 0 : env.name) || "
|
|
790
|
-
>>>>>>> main
|
|
773
|
+
description: (env === null || env === void 0 ? void 0 : env.name) || "New Environment",
|
|
791
774
|
};
|
|
792
775
|
if (lodash.isPlainObject(env === null || env === void 0 ? void 0 : env.env_var_list)) {
|
|
793
776
|
servers.variables = {};
|
|
@@ -915,13 +898,8 @@ class ApipostToSwagger {
|
|
|
915
898
|
this.apiToSwaggerResult.tags = [];
|
|
916
899
|
}
|
|
917
900
|
this.apiToSwaggerResult.tags.push({
|
|
918
|
-
|
|
919
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
920
|
-
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
921
|
-
=======
|
|
922
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "新建目录",
|
|
901
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
923
902
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
924
|
-
>>>>>>> main
|
|
925
903
|
});
|
|
926
904
|
folderObj[item === null || item === void 0 ? void 0 : item.name] = item;
|
|
927
905
|
}
|
|
@@ -1380,14 +1358,9 @@ class SwaggerToApipost {
|
|
|
1380
1358
|
const that = this;
|
|
1381
1359
|
if (lodash.isArray(json === null || json === void 0 ? void 0 : json.tags)) {
|
|
1382
1360
|
json.tags.forEach((item) => {
|
|
1383
|
-
|
|
1384
|
-
const folder_name = (item === null || item === void 0 ? void 0 : item.name) || 'New Folder';
|
|
1385
|
-
if (!that.folderNames[folder_name] && !Object.keys(that.folders).includes(folder_name)) {
|
|
1386
|
-
=======
|
|
1387
|
-
const folder_name = (item === null || item === void 0 ? void 0 : item.name) || "新建目录";
|
|
1361
|
+
const folder_name = (item === null || item === void 0 ? void 0 : item.name) || "New Folder";
|
|
1388
1362
|
if (!that.folderNames[folder_name] &&
|
|
1389
1363
|
!Object.keys(that.folders).includes(folder_name)) {
|
|
1390
|
-
>>>>>>> main
|
|
1391
1364
|
that.apis.push(Object.assign(Object.assign({}, that.createNewFolder(folder_name, json.tags)), { sort: 1 }));
|
|
1392
1365
|
}
|
|
1393
1366
|
});
|
|
@@ -1429,15 +1402,9 @@ class SwaggerToApipost {
|
|
|
1429
1402
|
}
|
|
1430
1403
|
}
|
|
1431
1404
|
validate(json) {
|
|
1432
|
-
<<<<<<< HEAD
|
|
1433
|
-
if (lodash.has(json, 'swagger')) {
|
|
1434
|
-
if (json.swagger !== '2.0') {
|
|
1435
|
-
return throwResult$1('error', 'Non standard format Swagger file, please check and upload again');
|
|
1436
|
-
=======
|
|
1437
1405
|
if (lodash.has(json, "swagger")) {
|
|
1438
1406
|
if (json.swagger !== "2.0") {
|
|
1439
|
-
return throwResult$1("error", "
|
|
1440
|
-
>>>>>>> main
|
|
1407
|
+
return throwResult$1("error", "Non standard format Swagger file, please check and upload again");
|
|
1441
1408
|
}
|
|
1442
1409
|
else {
|
|
1443
1410
|
this.version = "2.0";
|
|
@@ -1446,25 +1413,15 @@ class SwaggerToApipost {
|
|
|
1446
1413
|
if (lodash.has(json, "openapi")) {
|
|
1447
1414
|
this.version = "3.0";
|
|
1448
1415
|
}
|
|
1449
|
-
<<<<<<< HEAD
|
|
1450
|
-
if (!lodash.has(json, 'swagger') && !lodash.has(json, 'openapi')) {
|
|
1451
|
-
return throwResult$1('error', 'Non standard format Swagger file, please check and upload again');
|
|
1452
|
-
=======
|
|
1453
1416
|
if (!lodash.has(json, "swagger") && !lodash.has(json, "openapi")) {
|
|
1454
|
-
return throwResult$1("error", "
|
|
1455
|
-
>>>>>>> main
|
|
1417
|
+
return throwResult$1("error", "Non standard format Swagger file, please check and upload again");
|
|
1456
1418
|
}
|
|
1457
1419
|
return throwResult$1("success", "");
|
|
1458
1420
|
}
|
|
1459
1421
|
handleInfo(json) {
|
|
1460
1422
|
var _a, _b;
|
|
1461
|
-
|
|
1462
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.title) || 'New Project';
|
|
1463
|
-
this.project.description = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
1464
|
-
=======
|
|
1465
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.title) || "新建项目";
|
|
1423
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.title) || "New Project";
|
|
1466
1424
|
this.project.description = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || "";
|
|
1467
|
-
>>>>>>> main
|
|
1468
1425
|
}
|
|
1469
1426
|
setBasePath(json) {
|
|
1470
1427
|
this.basePath = "";
|
|
@@ -1501,13 +1458,8 @@ class SwaggerToApipost {
|
|
|
1501
1458
|
return;
|
|
1502
1459
|
for (const server of servers) {
|
|
1503
1460
|
const newEnv = {
|
|
1504
|
-
|
|
1505
|
-
name: (server === null || server === void 0 ? void 0 : server.description) || (server === null || server === void 0 ? void 0 : server.url) || 'Unnamed environment',
|
|
1506
|
-
url: server.url || '',
|
|
1507
|
-
=======
|
|
1508
|
-
name: (server === null || server === void 0 ? void 0 : server.description) || (server === null || server === void 0 ? void 0 : server.url) || "未命名环境",
|
|
1461
|
+
name: (server === null || server === void 0 ? void 0 : server.description) || (server === null || server === void 0 ? void 0 : server.url) || "Unnamed environment",
|
|
1509
1462
|
url: server.url || "",
|
|
1510
|
-
>>>>>>> main
|
|
1511
1463
|
env_var_list: {},
|
|
1512
1464
|
};
|
|
1513
1465
|
if (lodash.has(server, "variables")) {
|
|
@@ -1534,16 +1486,11 @@ class SwaggerToApipost {
|
|
|
1534
1486
|
this.handleTags(lodash.uniq(swaggerApi.tags), tags);
|
|
1535
1487
|
}
|
|
1536
1488
|
const api = {
|
|
1537
|
-
<<<<<<< HEAD
|
|
1538
|
-
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
|
|
1539
|
-
target_type: 'api',
|
|
1540
|
-
=======
|
|
1541
1489
|
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) ||
|
|
1542
1490
|
(swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) ||
|
|
1543
1491
|
(swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) ||
|
|
1544
|
-
"
|
|
1492
|
+
"New HTTP",
|
|
1545
1493
|
target_type: "api",
|
|
1546
|
-
>>>>>>> main
|
|
1547
1494
|
tags: [],
|
|
1548
1495
|
url: url || "",
|
|
1549
1496
|
method: method.toUpperCase() || "GET",
|
|
@@ -1685,7 +1632,9 @@ class SwaggerToApipost {
|
|
|
1685
1632
|
request.body.raw_parameter = raw_parameter;
|
|
1686
1633
|
if (lodash.isEmpty(request.body.raw)) {
|
|
1687
1634
|
try {
|
|
1688
|
-
const myMockSchema = new MockSchema__default["default"]({
|
|
1635
|
+
const myMockSchema = new MockSchema__default["default"]({
|
|
1636
|
+
app: "echoapi",
|
|
1637
|
+
});
|
|
1689
1638
|
const schemaJson = yield myMockSchema.mock(bodyData.schema);
|
|
1690
1639
|
request.body.raw =
|
|
1691
1640
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -1991,14 +1940,10 @@ class SwaggerToApipost {
|
|
|
1991
1940
|
}
|
|
1992
1941
|
let api = {
|
|
1993
1942
|
// __originalOperationId swagger-client转换完后编码不支持中文
|
|
1994
|
-
<<<<<<< HEAD
|
|
1995
|
-
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
|
|
1996
|
-
=======
|
|
1997
1943
|
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) ||
|
|
1998
1944
|
(swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) ||
|
|
1999
1945
|
(swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) ||
|
|
2000
|
-
"
|
|
2001
|
-
>>>>>>> main
|
|
1946
|
+
"New HTTP",
|
|
2002
1947
|
tags: [],
|
|
2003
1948
|
target_type: "api",
|
|
2004
1949
|
url: url || "",
|
|
@@ -2143,7 +2088,9 @@ class SwaggerToApipost {
|
|
|
2143
2088
|
request.body.raw = transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || Raw_text;
|
|
2144
2089
|
if (lodash.isEmpty(request.body.raw)) {
|
|
2145
2090
|
try {
|
|
2146
|
-
const myMockSchema = new MockSchema__default["default"]({
|
|
2091
|
+
const myMockSchema = new MockSchema__default["default"]({
|
|
2092
|
+
app: "echoapi",
|
|
2093
|
+
});
|
|
2147
2094
|
const schemaJson = yield myMockSchema.mock(parameter.schema);
|
|
2148
2095
|
request.body.raw =
|
|
2149
2096
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -2448,13 +2395,8 @@ class SwaggerToApipost {
|
|
|
2448
2395
|
return validationResult;
|
|
2449
2396
|
}
|
|
2450
2397
|
catch (err) {
|
|
2451
|
-
<<<<<<< HEAD
|
|
2452
|
-
if ((err === null || err === void 0 ? void 0 : err.name) === 'AbortError') {
|
|
2453
|
-
return throwResult$1('error', 'The data is too large and the request has timed out.');
|
|
2454
|
-
=======
|
|
2455
2398
|
if ((err === null || err === void 0 ? void 0 : err.name) === "AbortError") {
|
|
2456
|
-
return throwResult$1("error", "
|
|
2457
|
-
>>>>>>> main
|
|
2399
|
+
return throwResult$1("error", "The data is too large and the request has timed out.");
|
|
2458
2400
|
}
|
|
2459
2401
|
return throwResult$1("error", String(err));
|
|
2460
2402
|
}
|
|
@@ -2520,13 +2462,8 @@ class ApidocToApipost {
|
|
|
2520
2462
|
this.foldersMap = {};
|
|
2521
2463
|
}
|
|
2522
2464
|
initProject(project_id) {
|
|
2523
|
-
|
|
2524
|
-
this.project.name = 'New project';
|
|
2525
|
-
this.project.intro = '';
|
|
2526
|
-
=======
|
|
2527
|
-
this.project.name = "新建项目";
|
|
2465
|
+
this.project.name = "New project";
|
|
2528
2466
|
this.project.intro = "";
|
|
2529
|
-
>>>>>>> main
|
|
2530
2467
|
this.project.project_id = project_id;
|
|
2531
2468
|
}
|
|
2532
2469
|
completionParameter(parameter) {
|
|
@@ -2678,13 +2615,8 @@ class ApidocToApipost {
|
|
|
2678
2615
|
code: "200",
|
|
2679
2616
|
content_type: "json",
|
|
2680
2617
|
is_default: 1,
|
|
2681
|
-
<<<<<<< HEAD
|
|
2682
|
-
mock: '',
|
|
2683
|
-
name: 'success',
|
|
2684
|
-
=======
|
|
2685
2618
|
mock: "",
|
|
2686
|
-
name: "
|
|
2687
|
-
>>>>>>> main
|
|
2619
|
+
name: "success",
|
|
2688
2620
|
schema: {
|
|
2689
2621
|
type: "object",
|
|
2690
2622
|
properties: {},
|
|
@@ -2700,13 +2632,8 @@ class ApidocToApipost {
|
|
|
2700
2632
|
code: "404",
|
|
2701
2633
|
content_type: "json",
|
|
2702
2634
|
is_default: -1,
|
|
2703
|
-
<<<<<<< HEAD
|
|
2704
|
-
mock: '',
|
|
2705
|
-
name: 'fail',
|
|
2706
|
-
=======
|
|
2707
2635
|
mock: "",
|
|
2708
|
-
name: "
|
|
2709
|
-
>>>>>>> main
|
|
2636
|
+
name: "fail",
|
|
2710
2637
|
schema: {
|
|
2711
2638
|
type: "object",
|
|
2712
2639
|
properties: {},
|
|
@@ -2732,17 +2659,10 @@ class ApidocToApipost {
|
|
|
2732
2659
|
this.foldersMap[item === null || item === void 0 ? void 0 : item.group] = id;
|
|
2733
2660
|
pre.push({
|
|
2734
2661
|
target_id: id,
|
|
2735
|
-
<<<<<<< HEAD
|
|
2736
|
-
project_id: this.project.project_id || '',
|
|
2737
|
-
parent_id: '0',
|
|
2738
|
-
target_type: 'folder',
|
|
2739
|
-
name: (item === null || item === void 0 ? void 0 : item.group) || 'New Folder',
|
|
2740
|
-
=======
|
|
2741
2662
|
project_id: this.project.project_id || "",
|
|
2742
2663
|
parent_id: "0",
|
|
2743
2664
|
target_type: "folder",
|
|
2744
|
-
name: (item === null || item === void 0 ? void 0 : item.group) || "
|
|
2745
|
-
>>>>>>> main
|
|
2665
|
+
name: (item === null || item === void 0 ? void 0 : item.group) || "New Folder",
|
|
2746
2666
|
version: 0,
|
|
2747
2667
|
sort: 0,
|
|
2748
2668
|
description: (item === null || item === void 0 ? void 0 : item.groupTitle) || "",
|
|
@@ -2755,17 +2675,10 @@ class ApidocToApipost {
|
|
|
2755
2675
|
}
|
|
2756
2676
|
pre.push({
|
|
2757
2677
|
target_id: ATools.snowflakeId(),
|
|
2758
|
-
<<<<<<< HEAD
|
|
2759
|
-
project_id: this.project.project_id || '',
|
|
2760
|
-
parent_id: id || '0',
|
|
2761
|
-
target_type: 'api',
|
|
2762
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || 'New HTTP',
|
|
2763
|
-
=======
|
|
2764
2678
|
project_id: this.project.project_id || "",
|
|
2765
2679
|
parent_id: id || "0",
|
|
2766
2680
|
target_type: "api",
|
|
2767
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || "
|
|
2768
|
-
>>>>>>> main
|
|
2681
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || "New HTTP",
|
|
2769
2682
|
version: 0,
|
|
2770
2683
|
sort: 0,
|
|
2771
2684
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -2890,11 +2803,7 @@ class ApifoxToApipost {
|
|
|
2890
2803
|
delete schema[key][e]["$ref"];
|
|
2891
2804
|
}
|
|
2892
2805
|
});
|
|
2893
|
-
|
|
2894
|
-
schema['ECHOAPI_REFS'] = schema[key];
|
|
2895
|
-
=======
|
|
2896
|
-
schema["APIPOST_REFS"] = schema[key];
|
|
2897
|
-
>>>>>>> main
|
|
2806
|
+
schema["ECHOAPI_REFS"] = schema[key];
|
|
2898
2807
|
delete schema[key];
|
|
2899
2808
|
}
|
|
2900
2809
|
if (key === "properties" &&
|
|
@@ -2908,13 +2817,8 @@ class ApifoxToApipost {
|
|
|
2908
2817
|
if (key === "items" && (schema === null || schema === void 0 ? void 0 : schema.type) === "array") {
|
|
2909
2818
|
schema[key] = this.recursionSchema(schema[key], modelsMap);
|
|
2910
2819
|
}
|
|
2911
|
-
<<<<<<< HEAD
|
|
2912
|
-
if (key === 'x-apifox-orders') {
|
|
2913
|
-
schema['ECHOAPI_ORDERS'] = schema[key];
|
|
2914
|
-
=======
|
|
2915
2820
|
if (key === "x-apifox-orders") {
|
|
2916
|
-
schema["
|
|
2917
|
-
>>>>>>> main
|
|
2821
|
+
schema["ECHOAPI_ORDERS"] = schema[key];
|
|
2918
2822
|
delete schema[key];
|
|
2919
2823
|
}
|
|
2920
2824
|
}
|
|
@@ -2999,13 +2903,8 @@ class ApifoxToApipost {
|
|
|
2999
2903
|
}
|
|
3000
2904
|
initProject(json, project_id) {
|
|
3001
2905
|
var _a, _b;
|
|
3002
|
-
|
|
3003
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || 'New Project';
|
|
3004
|
-
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
3005
|
-
=======
|
|
3006
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || "新建项目";
|
|
2906
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || "New Project";
|
|
3007
2907
|
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || "";
|
|
3008
|
-
>>>>>>> main
|
|
3009
2908
|
this.project.project_id = project_id;
|
|
3010
2909
|
}
|
|
3011
2910
|
completionParameter(parameter) {
|
|
@@ -3086,21 +2985,12 @@ class ApifoxToApipost {
|
|
|
3086
2985
|
this.global.servers = (_a = servers === null || servers === void 0 ? void 0 : servers.filter((item) => item === null || item === void 0 ? void 0 : item.id)) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
3087
2986
|
const server_id = ATools.snowflakeId();
|
|
3088
2987
|
this.serversMap[item.id] = {
|
|
3089
|
-
<<<<<<< HEAD
|
|
3090
|
-
server_id: (item === null || item === void 0 ? void 0 : item.id) === 'default' ? '1' : server_id,
|
|
3091
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
3092
|
-
};
|
|
3093
|
-
return {
|
|
3094
|
-
server_id: (item === null || item === void 0 ? void 0 : item.id) === 'default' ? '1' : server_id,
|
|
3095
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
3096
|
-
=======
|
|
3097
2988
|
server_id: (item === null || item === void 0 ? void 0 : item.id) === "default" ? "1" : server_id,
|
|
3098
|
-
name: (item === null || item === void 0 ? void 0 : item.name) ||
|
|
2989
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
3099
2990
|
};
|
|
3100
2991
|
return {
|
|
3101
2992
|
server_id: (item === null || item === void 0 ? void 0 : item.id) === "default" ? "1" : server_id,
|
|
3102
|
-
name: (item === null || item === void 0 ? void 0 : item.name) ||
|
|
3103
|
-
>>>>>>> main
|
|
2993
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
3104
2994
|
};
|
|
3105
2995
|
});
|
|
3106
2996
|
}
|
|
@@ -3197,19 +3087,11 @@ class ApifoxToApipost {
|
|
|
3197
3087
|
// 这是目录操作
|
|
3198
3088
|
const parent = {
|
|
3199
3089
|
model_id: ATools.snowflakeId(),
|
|
3200
|
-
<<<<<<< HEAD
|
|
3201
|
-
model_type: 'folder',
|
|
3202
|
-
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
3203
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.model_id) || '0',
|
|
3204
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
3205
|
-
display_name: (item === null || item === void 0 ? void 0 : item.displayName) || '',
|
|
3206
|
-
=======
|
|
3207
3090
|
model_type: "folder",
|
|
3208
3091
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
3209
3092
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.model_id) || "0",
|
|
3210
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
3093
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
3211
3094
|
display_name: (item === null || item === void 0 ? void 0 : item.displayName) || "",
|
|
3212
|
-
>>>>>>> main
|
|
3213
3095
|
sort: 1000,
|
|
3214
3096
|
};
|
|
3215
3097
|
pre.push(parent);
|
|
@@ -3223,11 +3105,7 @@ class ApifoxToApipost {
|
|
|
3223
3105
|
this.modelMap[item.id] = model_id;
|
|
3224
3106
|
}
|
|
3225
3107
|
pre.push({
|
|
3226
|
-
|
|
3227
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Schema',
|
|
3228
|
-
=======
|
|
3229
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "新建模型",
|
|
3230
|
-
>>>>>>> main
|
|
3108
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Schema",
|
|
3231
3109
|
model_id,
|
|
3232
3110
|
model_type: "model",
|
|
3233
3111
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -3268,13 +3146,8 @@ class ApifoxToApipost {
|
|
|
3268
3146
|
type: item === null || item === void 0 ? void 0 : item.type,
|
|
3269
3147
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3270
3148
|
id: ATools.snowflakeId(),
|
|
3271
|
-
|
|
3272
|
-
name: 'Script',
|
|
3273
|
-
data: (item === null || item === void 0 ? void 0 : item.data) || '',
|
|
3274
|
-
=======
|
|
3275
|
-
name: "自定义脚本",
|
|
3149
|
+
name: "Script",
|
|
3276
3150
|
data: (item === null || item === void 0 ? void 0 : item.data) || "",
|
|
3277
|
-
>>>>>>> main
|
|
3278
3151
|
});
|
|
3279
3152
|
}
|
|
3280
3153
|
if ((item === null || item === void 0 ? void 0 : item.type) === ApifoxTasksType.database) {
|
|
@@ -3282,11 +3155,7 @@ class ApifoxToApipost {
|
|
|
3282
3155
|
type: item === null || item === void 0 ? void 0 : item.type,
|
|
3283
3156
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3284
3157
|
id: ATools.snowflakeId(),
|
|
3285
|
-
|
|
3286
|
-
name: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.name) || 'Database',
|
|
3287
|
-
=======
|
|
3288
|
-
name: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.name) || "数据库名称",
|
|
3289
|
-
>>>>>>> main
|
|
3158
|
+
name: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.name) || "Database",
|
|
3290
3159
|
data: {
|
|
3291
3160
|
query: ((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.expression) || "",
|
|
3292
3161
|
isConsoleOutput: ((_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.printResults) ? 1 : -1,
|
|
@@ -3294,16 +3163,10 @@ class ApifoxToApipost {
|
|
|
3294
3163
|
variables: (_e = (_d = item === null || item === void 0 ? void 0 : item.data) === null || _d === void 0 ? void 0 : _d.extractors) === null || _e === void 0 ? void 0 : _e.reduce((pre, variablesItem) => {
|
|
3295
3164
|
if (item === null || item === void 0 ? void 0 : item.variableName) {
|
|
3296
3165
|
pre.push({
|
|
3297
|
-
|
|
3298
|
-
name: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableName) || 'Variable',
|
|
3299
|
-
type: (VARS_TYPE_MAP === null || VARS_TYPE_MAP === void 0 ? void 0 : VARS_TYPE_MAP[variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableType]) || 'variables',
|
|
3300
|
-
pattern: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.jsonPath) || '',
|
|
3301
|
-
=======
|
|
3302
|
-
name: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableName) || "变量",
|
|
3166
|
+
name: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableName) || "Variable",
|
|
3303
3167
|
type: (VARS_TYPE_MAP === null || VARS_TYPE_MAP === void 0 ? void 0 : VARS_TYPE_MAP[variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableType]) ||
|
|
3304
3168
|
"variables",
|
|
3305
3169
|
pattern: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.jsonPath) || "",
|
|
3306
|
-
>>>>>>> main
|
|
3307
3170
|
param_id: ATools.snowflakeId(),
|
|
3308
3171
|
});
|
|
3309
3172
|
}
|
|
@@ -3317,11 +3180,7 @@ class ApifoxToApipost {
|
|
|
3317
3180
|
type: "pickVars",
|
|
3318
3181
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3319
3182
|
id: ATools.snowflakeId(),
|
|
3320
|
-
|
|
3321
|
-
name: ((_f = item === null || item === void 0 ? void 0 : item.data) === null || _f === void 0 ? void 0 : _f.variableName) || 'Variable Name',
|
|
3322
|
-
=======
|
|
3323
|
-
name: ((_f = item === null || item === void 0 ? void 0 : item.data) === null || _f === void 0 ? void 0 : _f.variableName) || "变量名称",
|
|
3324
|
-
>>>>>>> main
|
|
3183
|
+
name: ((_f = item === null || item === void 0 ? void 0 : item.data) === null || _f === void 0 ? void 0 : _f.variableName) || "Variable Name",
|
|
3325
3184
|
data: {
|
|
3326
3185
|
source: (PICK_VARS_TYPES_MAP === null || PICK_VARS_TYPES_MAP === void 0 ? void 0 : PICK_VARS_TYPES_MAP[(_g = item === null || item === void 0 ? void 0 : item.data) === null || _g === void 0 ? void 0 : _g.subject]) || "responseJson",
|
|
3327
3186
|
variables: [],
|
|
@@ -3333,11 +3192,7 @@ class ApifoxToApipost {
|
|
|
3333
3192
|
type: "assert",
|
|
3334
3193
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3335
3194
|
id: ATools.snowflakeId(),
|
|
3336
|
-
|
|
3337
|
-
name: ((_h = item === null || item === void 0 ? void 0 : item.data) === null || _h === void 0 ? void 0 : _h.name) || 'Assertion',
|
|
3338
|
-
=======
|
|
3339
|
-
name: ((_h = item === null || item === void 0 ? void 0 : item.data) === null || _h === void 0 ? void 0 : _h.name) || "断言",
|
|
3340
|
-
>>>>>>> main
|
|
3195
|
+
name: ((_h = item === null || item === void 0 ? void 0 : item.data) === null || _h === void 0 ? void 0 : _h.name) || "Assertion",
|
|
3341
3196
|
data: {
|
|
3342
3197
|
type: ASSERT_TYPES_MAP[(_j = item === null || item === void 0 ? void 0 : item.data) === null || _j === void 0 ? void 0 : _j.subject] || "responseJson",
|
|
3343
3198
|
expression: {
|
|
@@ -3590,17 +3445,10 @@ class ApifoxToApipost {
|
|
|
3590
3445
|
}
|
|
3591
3446
|
return {
|
|
3592
3447
|
target_id,
|
|
3593
|
-
<<<<<<< HEAD
|
|
3594
|
-
project_id: this.project.project_id || '',
|
|
3595
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
3596
|
-
target_type: 'folder',
|
|
3597
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
3598
|
-
=======
|
|
3599
3448
|
project_id: this.project.project_id || "",
|
|
3600
3449
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
3601
3450
|
target_type: "folder",
|
|
3602
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
3603
|
-
>>>>>>> main
|
|
3451
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
3604
3452
|
version: 0,
|
|
3605
3453
|
sort: 0,
|
|
3606
3454
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -3656,22 +3504,14 @@ class ApifoxToApipost {
|
|
|
3656
3504
|
completionApiTarget(item, baseInfo, parentInfo) {
|
|
3657
3505
|
var _a;
|
|
3658
3506
|
const { api } = item || {};
|
|
3659
|
-
|
|
3660
|
-
return Object.assign(Object.assign({}, baseInfo), { parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0', target_type: 'api', name: (item === null || item === void 0 ? void 0 : item.name) || 'New HTTP', version: 0, sort: 0, description: (api === null || api === void 0 ? void 0 : api.description) || '', method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : 'GET', url: (api === null || api === void 0 ? void 0 : api.path) || '', mark_id: this.completionApiTargetMark(api === null || api === void 0 ? void 0 : api.status), protocol: 'http/1.1', request: this.completionApiRequest(Object.assign(Object.assign({}, api === null || api === void 0 ? void 0 : api.parameters), { preProcessors: api === null || api === void 0 ? void 0 : api.preProcessors, postProcessors: api === null || api === void 0 ? void 0 : api.postProcessors, auth: api === null || api === void 0 ? void 0 : api.auth }), api === null || api === void 0 ? void 0 : api.requestBody), response: this.completionApiResponse(api === null || api === void 0 ? void 0 : api.responses, api === null || api === void 0 ? void 0 : api.responseExamples), attribute_info: {}, tags: isArray(api === null || api === void 0 ? void 0 : api.tags) ? api === null || api === void 0 ? void 0 : api.tags : [], is_force: -1 });
|
|
3661
|
-
=======
|
|
3662
|
-
return Object.assign(Object.assign({}, baseInfo), { parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0", target_type: "api", name: (item === null || item === void 0 ? void 0 : item.name) || "新建接口", version: 0, sort: 0, description: (api === null || api === void 0 ? void 0 : api.description) || "", method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : "GET", url: (api === null || api === void 0 ? void 0 : api.path) || "", mark_id: this.completionApiTargetMark(api === null || api === void 0 ? void 0 : api.status), protocol: "http/1.1", request: this.completionApiRequest(Object.assign(Object.assign({}, api === null || api === void 0 ? void 0 : api.parameters), { preProcessors: api === null || api === void 0 ? void 0 : api.preProcessors, postProcessors: api === null || api === void 0 ? void 0 : api.postProcessors, auth: api === null || api === void 0 ? void 0 : api.auth }), api === null || api === void 0 ? void 0 : api.requestBody), response: this.completionApiResponse(api === null || api === void 0 ? void 0 : api.responses, api === null || api === void 0 ? void 0 : api.responseExamples), attribute_info: {}, tags: isArray(api === null || api === void 0 ? void 0 : api.tags) ? api === null || api === void 0 ? void 0 : api.tags : [], is_force: -1 });
|
|
3663
|
-
>>>>>>> main
|
|
3507
|
+
return Object.assign(Object.assign({}, baseInfo), { parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0", target_type: "api", name: (item === null || item === void 0 ? void 0 : item.name) || "New HTTP", version: 0, sort: 0, description: (api === null || api === void 0 ? void 0 : api.description) || "", method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : "GET", url: (api === null || api === void 0 ? void 0 : api.path) || "", mark_id: this.completionApiTargetMark(api === null || api === void 0 ? void 0 : api.status), protocol: "http/1.1", request: this.completionApiRequest(Object.assign(Object.assign({}, api === null || api === void 0 ? void 0 : api.parameters), { preProcessors: api === null || api === void 0 ? void 0 : api.preProcessors, postProcessors: api === null || api === void 0 ? void 0 : api.postProcessors, auth: api === null || api === void 0 ? void 0 : api.auth }), api === null || api === void 0 ? void 0 : api.requestBody), response: this.completionApiResponse(api === null || api === void 0 ? void 0 : api.responses, api === null || api === void 0 ? void 0 : api.responseExamples), attribute_info: {}, tags: isArray(api === null || api === void 0 ? void 0 : api.tags) ? api === null || api === void 0 ? void 0 : api.tags : [], is_force: -1 });
|
|
3664
3508
|
}
|
|
3665
3509
|
completionApiSample(item, baseInfo) {
|
|
3666
3510
|
const { api } = item || {};
|
|
3667
3511
|
const { cases } = api || {};
|
|
3668
3512
|
return cases === null || cases === void 0 ? void 0 : cases.map((caseItem) => {
|
|
3669
3513
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
3670
|
-
|
|
3671
|
-
return Object.assign(Object.assign({}, baseInfo), { created_at: 0, method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : 'GET', name: (caseItem === null || caseItem === void 0 ? void 0 : caseItem.name) || 'New Test Case', parent_id: '0', protocol: 'http/1.1', request: this.completionApiRequest({
|
|
3672
|
-
=======
|
|
3673
|
-
return Object.assign(Object.assign({}, baseInfo), { created_at: 0, method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : "GET", name: (caseItem === null || caseItem === void 0 ? void 0 : caseItem.name) || "新建用例", parent_id: "0", protocol: "http/1.1", request: this.completionApiRequest({
|
|
3674
|
-
>>>>>>> main
|
|
3514
|
+
return Object.assign(Object.assign({}, baseInfo), { created_at: 0, method: (api === null || api === void 0 ? void 0 : api.method) ? (_a = api === null || api === void 0 ? void 0 : api.method) === null || _a === void 0 ? void 0 : _a.toUpperCase() : "GET", name: (caseItem === null || caseItem === void 0 ? void 0 : caseItem.name) || "New Test Case", parent_id: "0", protocol: "http/1.1", request: this.completionApiRequest({
|
|
3675
3515
|
header: (_c = (((_b = caseItem === null || caseItem === void 0 ? void 0 : caseItem.parameters) === null || _b === void 0 ? void 0 : _b.header) || [])) === null || _c === void 0 ? void 0 : _c.concat(((_d = api === null || api === void 0 ? void 0 : api.parameters) === null || _d === void 0 ? void 0 : _d.header) || []),
|
|
3676
3516
|
query: (_f = (((_e = caseItem === null || caseItem === void 0 ? void 0 : caseItem.parameters) === null || _e === void 0 ? void 0 : _e.query) || [])) === null || _f === void 0 ? void 0 : _f.concat(((_g = api === null || api === void 0 ? void 0 : api.parameters) === null || _g === void 0 ? void 0 : _g.query) || []),
|
|
3677
3517
|
cookie: (_j = (((_h = caseItem === null || caseItem === void 0 ? void 0 : caseItem.parameters) === null || _h === void 0 ? void 0 : _h.cookie) || [])) === null || _j === void 0 ? void 0 : _j.concat(((_k = api === null || api === void 0 ? void 0 : api.parameters) === null || _k === void 0 ? void 0 : _k.cookie) || []),
|
|
@@ -3726,17 +3566,10 @@ class ApifoxToApipost {
|
|
|
3726
3566
|
if (lodash.has(this.foldersMap, docItem === null || docItem === void 0 ? void 0 : docItem.folderId)) {
|
|
3727
3567
|
preItems.push({
|
|
3728
3568
|
target_id: ATools.snowflakeId(),
|
|
3729
|
-
<<<<<<< HEAD
|
|
3730
|
-
project_id: this.project.project_id || '',
|
|
3731
|
-
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[docItem === null || docItem === void 0 ? void 0 : docItem.folderId]) || '0',
|
|
3732
|
-
target_type: 'doc',
|
|
3733
|
-
name: (docItem === null || docItem === void 0 ? void 0 : docItem.name) || 'New Markdown',
|
|
3734
|
-
=======
|
|
3735
3569
|
project_id: this.project.project_id || "",
|
|
3736
3570
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[docItem === null || docItem === void 0 ? void 0 : docItem.folderId]) || "0",
|
|
3737
3571
|
target_type: "doc",
|
|
3738
|
-
name: (docItem === null || docItem === void 0 ? void 0 : docItem.name) || "
|
|
3739
|
-
>>>>>>> main
|
|
3572
|
+
name: (docItem === null || docItem === void 0 ? void 0 : docItem.name) || "New Markdown",
|
|
3740
3573
|
version: 0,
|
|
3741
3574
|
sort: 0,
|
|
3742
3575
|
mark_id: "1",
|
|
@@ -3766,17 +3599,10 @@ class ApifoxToApipost {
|
|
|
3766
3599
|
var _a;
|
|
3767
3600
|
return {
|
|
3768
3601
|
target_id: ATools.snowflakeId(),
|
|
3769
|
-
<<<<<<< HEAD
|
|
3770
|
-
project_id: this.project.project_id || '',
|
|
3771
|
-
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.folderId]) || '0',
|
|
3772
|
-
target_type: 'socket',
|
|
3773
|
-
name: (tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.name) || 'New TCP Client',
|
|
3774
|
-
=======
|
|
3775
3602
|
project_id: this.project.project_id || "",
|
|
3776
3603
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.folderId]) || "0",
|
|
3777
3604
|
target_type: "socket",
|
|
3778
|
-
name: (tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.name) || "
|
|
3779
|
-
>>>>>>> main
|
|
3605
|
+
name: (tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.name) || "New TCP Client",
|
|
3780
3606
|
version: 0,
|
|
3781
3607
|
sort: 0,
|
|
3782
3608
|
method: "TCP",
|
|
@@ -3810,11 +3636,7 @@ class ApifoxToApipost {
|
|
|
3810
3636
|
completionTcpMethod(apis, parentInfo) {
|
|
3811
3637
|
if (isArray(apis) && apis.length) {
|
|
3812
3638
|
return apis === null || apis === void 0 ? void 0 : apis.reduce((pre, item) => {
|
|
3813
|
-
|
|
3814
|
-
pre.push(Object.assign(Object.assign({}, parentInfo), { target_id: ATools.snowflakeId(), project_id: this.project.project_id || '', target_type: 'socket_method', name: (item === null || item === void 0 ? void 0 : item.name) || 'New TCP Method', version: 0, sort: 0, method: 'TCP', url: '', mark_id: this.completionApiTargetMark(item === null || item === void 0 ? void 0 : item.status), description: (item === null || item === void 0 ? void 0 : item.description) || '', request: this.completionTcpMethodRequest(item === null || item === void 0 ? void 0 : item.parameter), response: this.completionApiResponse(item === null || item === void 0 ? void 0 : item.responses, item === null || item === void 0 ? void 0 : item.responseExamples), attribute_info: {}, tags: isArray(item === null || item === void 0 ? void 0 : item.tags) ? item === null || item === void 0 ? void 0 : item.tags : [], created_at: 0, updated_at: 0 }));
|
|
3815
|
-
=======
|
|
3816
|
-
pre.push(Object.assign(Object.assign({}, parentInfo), { target_id: ATools.snowflakeId(), project_id: this.project.project_id || "", target_type: "socket_method", name: (item === null || item === void 0 ? void 0 : item.name) || "新建TCP方法", version: 0, sort: 0, method: "TCP", url: "", mark_id: this.completionApiTargetMark(item === null || item === void 0 ? void 0 : item.status), description: (item === null || item === void 0 ? void 0 : item.description) || "", request: this.completionTcpMethodRequest(item === null || item === void 0 ? void 0 : item.parameter), response: this.completionApiResponse(item === null || item === void 0 ? void 0 : item.responses, item === null || item === void 0 ? void 0 : item.responseExamples), attribute_info: {}, tags: isArray(item === null || item === void 0 ? void 0 : item.tags) ? item === null || item === void 0 ? void 0 : item.tags : [], created_at: 0, updated_at: 0 }));
|
|
3817
|
-
>>>>>>> main
|
|
3639
|
+
pre.push(Object.assign(Object.assign({}, parentInfo), { target_id: ATools.snowflakeId(), project_id: this.project.project_id || "", target_type: "socket_method", name: (item === null || item === void 0 ? void 0 : item.name) || "New TCP Method", version: 0, sort: 0, method: "TCP", url: "", mark_id: this.completionApiTargetMark(item === null || item === void 0 ? void 0 : item.status), description: (item === null || item === void 0 ? void 0 : item.description) || "", request: this.completionTcpMethodRequest(item === null || item === void 0 ? void 0 : item.parameter), response: this.completionApiResponse(item === null || item === void 0 ? void 0 : item.responses, item === null || item === void 0 ? void 0 : item.responseExamples), attribute_info: {}, tags: isArray(item === null || item === void 0 ? void 0 : item.tags) ? item === null || item === void 0 ? void 0 : item.tags : [], created_at: 0, updated_at: 0 }));
|
|
3818
3640
|
return pre;
|
|
3819
3641
|
}, []);
|
|
3820
3642
|
}
|
|
@@ -4018,13 +3840,8 @@ class HarToApipost {
|
|
|
4018
3840
|
};
|
|
4019
3841
|
}
|
|
4020
3842
|
initProject(project_id) {
|
|
4021
|
-
|
|
4022
|
-
this.project.name = 'New Project';
|
|
4023
|
-
this.project.intro = '';
|
|
4024
|
-
=======
|
|
4025
|
-
this.project.name = "新建项目";
|
|
3843
|
+
this.project.name = "New Project";
|
|
4026
3844
|
this.project.intro = "";
|
|
4027
|
-
>>>>>>> main
|
|
4028
3845
|
this.project.project_id = project_id;
|
|
4029
3846
|
}
|
|
4030
3847
|
completionApiRequestParameter(headers) {
|
|
@@ -4098,13 +3915,8 @@ class HarToApipost {
|
|
|
4098
3915
|
code: "200",
|
|
4099
3916
|
content_type: "json",
|
|
4100
3917
|
is_default: 1,
|
|
4101
|
-
<<<<<<< HEAD
|
|
4102
|
-
mock: '',
|
|
4103
|
-
name: 'Success',
|
|
4104
|
-
=======
|
|
4105
3918
|
mock: "",
|
|
4106
|
-
name: "
|
|
4107
|
-
>>>>>>> main
|
|
3919
|
+
name: "Success",
|
|
4108
3920
|
schema: {
|
|
4109
3921
|
type: "object",
|
|
4110
3922
|
properties: {},
|
|
@@ -4120,13 +3932,8 @@ class HarToApipost {
|
|
|
4120
3932
|
code: "404",
|
|
4121
3933
|
content_type: "json",
|
|
4122
3934
|
is_default: -1,
|
|
4123
|
-
<<<<<<< HEAD
|
|
4124
|
-
mock: '',
|
|
4125
|
-
name: 'Failed',
|
|
4126
|
-
=======
|
|
4127
3935
|
mock: "",
|
|
4128
|
-
name: "
|
|
4129
|
-
>>>>>>> main
|
|
3936
|
+
name: "Failed",
|
|
4130
3937
|
schema: {
|
|
4131
3938
|
type: "object",
|
|
4132
3939
|
properties: {},
|
|
@@ -4150,17 +3957,10 @@ class HarToApipost {
|
|
|
4150
3957
|
(item === null || item === void 0 ? void 0 : item._resourceType) === "preflight") {
|
|
4151
3958
|
pre.push({
|
|
4152
3959
|
target_id: ATools.snowflakeId(),
|
|
4153
|
-
<<<<<<< HEAD
|
|
4154
|
-
project_id: this.project.project_id || '',
|
|
4155
|
-
parent_id: '0',
|
|
4156
|
-
target_type: 'api',
|
|
4157
|
-
name: url || 'New HTTP',
|
|
4158
|
-
=======
|
|
4159
3960
|
project_id: this.project.project_id || "",
|
|
4160
3961
|
parent_id: "0",
|
|
4161
3962
|
target_type: "api",
|
|
4162
|
-
name: url || "
|
|
4163
|
-
>>>>>>> main
|
|
3963
|
+
name: url || "New HTTP",
|
|
4164
3964
|
version: 0,
|
|
4165
3965
|
sort: 0,
|
|
4166
3966
|
description: "",
|
|
@@ -4253,15 +4053,9 @@ class InsomniaToApipost {
|
|
|
4253
4053
|
this.foldersMap = {};
|
|
4254
4054
|
}
|
|
4255
4055
|
initProject(resources, project_id) {
|
|
4256
|
-
<<<<<<< HEAD
|
|
4257
|
-
const projectInfo = resources === null || resources === void 0 ? void 0 : resources.find((e) => (e === null || e === void 0 ? void 0 : e._type) === 'workspace');
|
|
4258
|
-
this.project.name = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.name) || 'New Project';
|
|
4259
|
-
this.project.intro = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.description) || '';
|
|
4260
|
-
=======
|
|
4261
4056
|
const projectInfo = resources === null || resources === void 0 ? void 0 : resources.find((e) => (e === null || e === void 0 ? void 0 : e._type) === "workspace");
|
|
4262
|
-
this.project.name = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.name) || "
|
|
4057
|
+
this.project.name = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.name) || "New Project";
|
|
4263
4058
|
this.project.intro = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.description) || "";
|
|
4264
|
-
>>>>>>> main
|
|
4265
4059
|
this.project.project_id = project_id;
|
|
4266
4060
|
}
|
|
4267
4061
|
completionParameter(parameter) {
|
|
@@ -4326,11 +4120,7 @@ class InsomniaToApipost {
|
|
|
4326
4120
|
{
|
|
4327
4121
|
type: "customScript",
|
|
4328
4122
|
enabled: 1,
|
|
4329
|
-
|
|
4330
|
-
name: 'Script',
|
|
4331
|
-
=======
|
|
4332
|
-
name: "自定义脚本",
|
|
4333
|
-
>>>>>>> main
|
|
4123
|
+
name: "Script",
|
|
4334
4124
|
id: ATools.snowflakeId(),
|
|
4335
4125
|
data: (item === null || item === void 0 ? void 0 : item.preRequestScript) || "",
|
|
4336
4126
|
},
|
|
@@ -4420,15 +4210,9 @@ class InsomniaToApipost {
|
|
|
4420
4210
|
return {
|
|
4421
4211
|
project_id: this.project.project_id || "",
|
|
4422
4212
|
target_id: ATools.snowflakeId(),
|
|
4423
|
-
<<<<<<< HEAD
|
|
4424
|
-
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || '0',
|
|
4425
|
-
target_type: 'websocket',
|
|
4426
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Websocket',
|
|
4427
|
-
=======
|
|
4428
4213
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || "0",
|
|
4429
4214
|
target_type: "websocket",
|
|
4430
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
4431
|
-
>>>>>>> main
|
|
4215
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Websocket",
|
|
4432
4216
|
sort: 0,
|
|
4433
4217
|
version: 0,
|
|
4434
4218
|
mark_id: "1",
|
|
@@ -4455,17 +4239,10 @@ class InsomniaToApipost {
|
|
|
4455
4239
|
var _a, _b;
|
|
4456
4240
|
return {
|
|
4457
4241
|
target_id: ATools.snowflakeId(),
|
|
4458
|
-
<<<<<<< HEAD
|
|
4459
|
-
project_id: this.project.project_id || '',
|
|
4460
|
-
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || '0',
|
|
4461
|
-
target_type: 'api',
|
|
4462
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New HTTP',
|
|
4463
|
-
=======
|
|
4464
4242
|
project_id: this.project.project_id || "",
|
|
4465
4243
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || "0",
|
|
4466
4244
|
target_type: "api",
|
|
4467
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
4468
|
-
>>>>>>> main
|
|
4245
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New HTTP",
|
|
4469
4246
|
version: 0,
|
|
4470
4247
|
sort: 0,
|
|
4471
4248
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -4483,13 +4260,8 @@ class InsomniaToApipost {
|
|
|
4483
4260
|
code: "200",
|
|
4484
4261
|
content_type: "json",
|
|
4485
4262
|
is_default: 1,
|
|
4486
|
-
<<<<<<< HEAD
|
|
4487
|
-
mock: '',
|
|
4488
|
-
name: 'Success',
|
|
4489
|
-
=======
|
|
4490
4263
|
mock: "",
|
|
4491
|
-
name: "
|
|
4492
|
-
>>>>>>> main
|
|
4264
|
+
name: "Success",
|
|
4493
4265
|
schema: {
|
|
4494
4266
|
type: "object",
|
|
4495
4267
|
properties: {},
|
|
@@ -4505,13 +4277,8 @@ class InsomniaToApipost {
|
|
|
4505
4277
|
code: "404",
|
|
4506
4278
|
content_type: "json",
|
|
4507
4279
|
is_default: -1,
|
|
4508
|
-
<<<<<<< HEAD
|
|
4509
|
-
mock: '',
|
|
4510
|
-
name: 'Failed',
|
|
4511
|
-
=======
|
|
4512
4280
|
mock: "",
|
|
4513
|
-
name: "
|
|
4514
|
-
>>>>>>> main
|
|
4281
|
+
name: "Failed",
|
|
4515
4282
|
schema: {
|
|
4516
4283
|
type: "object",
|
|
4517
4284
|
properties: {},
|
|
@@ -4547,17 +4314,10 @@ class InsomniaToApipost {
|
|
|
4547
4314
|
if ((item === null || item === void 0 ? void 0 : item._type) === "request_group" && lodash.has(this.foldersMap, item === null || item === void 0 ? void 0 : item._id)) {
|
|
4548
4315
|
pre.push({
|
|
4549
4316
|
target_id: this.foldersMap[item === null || item === void 0 ? void 0 : item._id] || ATools.snowflakeId(),
|
|
4550
|
-
<<<<<<< HEAD
|
|
4551
|
-
project_id: this.project.project_id || '',
|
|
4552
|
-
parent_id: this.foldersMap[item === null || item === void 0 ? void 0 : item.parentId] || '0',
|
|
4553
|
-
target_type: 'folder',
|
|
4554
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
4555
|
-
=======
|
|
4556
4317
|
project_id: this.project.project_id || "",
|
|
4557
4318
|
parent_id: this.foldersMap[item === null || item === void 0 ? void 0 : item.parentId] || "0",
|
|
4558
4319
|
target_type: "folder",
|
|
4559
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
4560
|
-
>>>>>>> main
|
|
4320
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
4561
4321
|
version: 0,
|
|
4562
4322
|
sort: 0,
|
|
4563
4323
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -4858,11 +4618,7 @@ class PostmanToApipost {
|
|
|
4858
4618
|
{
|
|
4859
4619
|
type: "customScript",
|
|
4860
4620
|
enabled: 1,
|
|
4861
|
-
|
|
4862
|
-
name: 'Custom Script',
|
|
4863
|
-
=======
|
|
4864
|
-
name: "自定义脚本",
|
|
4865
|
-
>>>>>>> main
|
|
4621
|
+
name: "Custom Script",
|
|
4866
4622
|
id: ATools.snowflakeId(),
|
|
4867
4623
|
data: isArray((_c = prerequest === null || prerequest === void 0 ? void 0 : prerequest.script) === null || _c === void 0 ? void 0 : _c.exec)
|
|
4868
4624
|
? (_e = (_d = prerequest === null || prerequest === void 0 ? void 0 : prerequest.script) === null || _d === void 0 ? void 0 : _d.exec) === null || _e === void 0 ? void 0 : _e.join("\n")
|
|
@@ -4875,11 +4631,7 @@ class PostmanToApipost {
|
|
|
4875
4631
|
{
|
|
4876
4632
|
type: "customScript",
|
|
4877
4633
|
enabled: 1,
|
|
4878
|
-
|
|
4879
|
-
name: 'Custom Script',
|
|
4880
|
-
=======
|
|
4881
|
-
name: "自定义脚本",
|
|
4882
|
-
>>>>>>> main
|
|
4634
|
+
name: "Custom Script",
|
|
4883
4635
|
id: ATools.snowflakeId(),
|
|
4884
4636
|
data: isArray((_f = test === null || test === void 0 ? void 0 : test.script) === null || _f === void 0 ? void 0 : _f.exec)
|
|
4885
4637
|
? (_h = (_g = test === null || test === void 0 ? void 0 : test.script) === null || _g === void 0 ? void 0 : _g.exec) === null || _h === void 0 ? void 0 : _h.join("\n")
|
|
@@ -4913,17 +4665,10 @@ class PostmanToApipost {
|
|
|
4913
4665
|
completionApiFolder(item, parentInfo) {
|
|
4914
4666
|
return {
|
|
4915
4667
|
target_id: ATools.snowflakeId(),
|
|
4916
|
-
<<<<<<< HEAD
|
|
4917
|
-
project_id: this.project.project_id || '',
|
|
4918
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4919
|
-
target_type: 'folder',
|
|
4920
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
4921
|
-
=======
|
|
4922
4668
|
project_id: this.project.project_id || "",
|
|
4923
4669
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
4924
4670
|
target_type: "folder",
|
|
4925
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
4926
|
-
>>>>>>> main
|
|
4671
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
4927
4672
|
version: 0,
|
|
4928
4673
|
sort: 0,
|
|
4929
4674
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -4939,17 +4684,10 @@ class PostmanToApipost {
|
|
|
4939
4684
|
const { request } = item || {};
|
|
4940
4685
|
return {
|
|
4941
4686
|
target_id: ATools.snowflakeId(),
|
|
4942
|
-
<<<<<<< HEAD
|
|
4943
|
-
project_id: this.project.project_id || '',
|
|
4944
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4945
|
-
target_type: 'api',
|
|
4946
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New HTTP',
|
|
4947
|
-
=======
|
|
4948
4687
|
project_id: this.project.project_id || "",
|
|
4949
4688
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
4950
4689
|
target_type: "api",
|
|
4951
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
4952
|
-
>>>>>>> main
|
|
4690
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New HTTP",
|
|
4953
4691
|
version: 0,
|
|
4954
4692
|
sort: 0,
|
|
4955
4693
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -4970,13 +4708,8 @@ class PostmanToApipost {
|
|
|
4970
4708
|
code: "200",
|
|
4971
4709
|
content_type: "json",
|
|
4972
4710
|
is_default: 1,
|
|
4973
|
-
<<<<<<< HEAD
|
|
4974
|
-
mock: '',
|
|
4975
|
-
name: 'Success',
|
|
4976
|
-
=======
|
|
4977
4711
|
mock: "",
|
|
4978
|
-
name: "
|
|
4979
|
-
>>>>>>> main
|
|
4712
|
+
name: "Success",
|
|
4980
4713
|
schema: {
|
|
4981
4714
|
type: "object",
|
|
4982
4715
|
properties: {},
|
|
@@ -4992,13 +4725,8 @@ class PostmanToApipost {
|
|
|
4992
4725
|
code: "404",
|
|
4993
4726
|
content_type: "json",
|
|
4994
4727
|
is_default: -1,
|
|
4995
|
-
<<<<<<< HEAD
|
|
4996
|
-
mock: '',
|
|
4997
|
-
name: 'Failed',
|
|
4998
|
-
=======
|
|
4999
4728
|
mock: "",
|
|
5000
|
-
name: "
|
|
5001
|
-
>>>>>>> main
|
|
4729
|
+
name: "Failed",
|
|
5002
4730
|
schema: {
|
|
5003
4731
|
type: "object",
|
|
5004
4732
|
properties: {},
|
|
@@ -5041,13 +4769,8 @@ class PostmanToApipost {
|
|
|
5041
4769
|
}
|
|
5042
4770
|
initProject(json, project_id) {
|
|
5043
4771
|
var _a, _b;
|
|
5044
|
-
|
|
5045
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || 'New Project';
|
|
5046
|
-
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
5047
|
-
=======
|
|
5048
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || "新建项目";
|
|
4772
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || "New Project";
|
|
5049
4773
|
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || "";
|
|
5050
|
-
>>>>>>> main
|
|
5051
4774
|
this.project.project_id = project_id;
|
|
5052
4775
|
}
|
|
5053
4776
|
convert(json, project_id) {
|
|
@@ -5095,29 +4818,17 @@ class YapiToApipost {
|
|
|
5095
4818
|
};
|
|
5096
4819
|
}
|
|
5097
4820
|
initProject(project_id) {
|
|
5098
|
-
|
|
5099
|
-
this.project.name = 'New Project';
|
|
5100
|
-
this.project.intro = '';
|
|
5101
|
-
=======
|
|
5102
|
-
this.project.name = "新建项目";
|
|
4821
|
+
this.project.name = "New Project";
|
|
5103
4822
|
this.project.intro = "";
|
|
5104
|
-
>>>>>>> main
|
|
5105
4823
|
this.project.project_id = project_id;
|
|
5106
4824
|
}
|
|
5107
4825
|
completionApiFolder(item, parentInfo) {
|
|
5108
4826
|
return {
|
|
5109
4827
|
target_id: ATools.snowflakeId(),
|
|
5110
|
-
<<<<<<< HEAD
|
|
5111
|
-
project_id: this.project.project_id || '',
|
|
5112
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
5113
|
-
target_type: 'folder',
|
|
5114
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
5115
|
-
=======
|
|
5116
4828
|
project_id: this.project.project_id || "",
|
|
5117
4829
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
5118
4830
|
target_type: "folder",
|
|
5119
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
5120
|
-
>>>>>>> main
|
|
4831
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
5121
4832
|
version: 0,
|
|
5122
4833
|
sort: 0,
|
|
5123
4834
|
description: (item === null || item === void 0 ? void 0 : item.description) || "",
|
|
@@ -5254,13 +4965,8 @@ class YapiToApipost {
|
|
|
5254
4965
|
code: "200",
|
|
5255
4966
|
content_type: "json",
|
|
5256
4967
|
is_default: 1,
|
|
5257
|
-
<<<<<<< HEAD
|
|
5258
|
-
mock: '',
|
|
5259
|
-
name: 'Success',
|
|
5260
|
-
=======
|
|
5261
4968
|
mock: "",
|
|
5262
|
-
name: "
|
|
5263
|
-
>>>>>>> main
|
|
4969
|
+
name: "Success",
|
|
5264
4970
|
schema,
|
|
5265
4971
|
verify_type: "schema",
|
|
5266
4972
|
},
|
|
@@ -5273,13 +4979,8 @@ class YapiToApipost {
|
|
|
5273
4979
|
code: "404",
|
|
5274
4980
|
content_type: "json",
|
|
5275
4981
|
is_default: -1,
|
|
5276
|
-
<<<<<<< HEAD
|
|
5277
|
-
mock: '',
|
|
5278
|
-
name: 'Failed',
|
|
5279
|
-
=======
|
|
5280
4982
|
mock: "",
|
|
5281
|
-
name: "
|
|
5282
|
-
>>>>>>> main
|
|
4983
|
+
name: "Failed",
|
|
5283
4984
|
schema: {
|
|
5284
4985
|
type: "object",
|
|
5285
4986
|
properties: {},
|
|
@@ -5296,17 +4997,10 @@ class YapiToApipost {
|
|
|
5296
4997
|
var _a;
|
|
5297
4998
|
return {
|
|
5298
4999
|
target_id: ATools.snowflakeId(),
|
|
5299
|
-
<<<<<<< HEAD
|
|
5300
|
-
project_id: this.project.project_id || '',
|
|
5301
|
-
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
5302
|
-
target_type: 'api',
|
|
5303
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || 'New HTTP',
|
|
5304
|
-
=======
|
|
5305
5000
|
project_id: this.project.project_id || "",
|
|
5306
5001
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
5307
5002
|
target_type: "api",
|
|
5308
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || "
|
|
5309
|
-
>>>>>>> main
|
|
5003
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || "New HTTP",
|
|
5310
5004
|
version: 0,
|
|
5311
5005
|
sort: 0,
|
|
5312
5006
|
description: (item === null || item === void 0 ? void 0 : item.desc) || "",
|
|
@@ -5423,7 +5117,7 @@ class ThunderToApipost {
|
|
|
5423
5117
|
return {
|
|
5424
5118
|
type: "customScript",
|
|
5425
5119
|
id: ATools.snowflakeId(),
|
|
5426
|
-
name: "
|
|
5120
|
+
name: "Script",
|
|
5427
5121
|
enabled: 1,
|
|
5428
5122
|
data: `function isType(value, type) {
|
|
5429
5123
|
|
|
@@ -5472,7 +5166,7 @@ class ThunderToApipost {
|
|
|
5472
5166
|
return {
|
|
5473
5167
|
type: "customScript",
|
|
5474
5168
|
id: ATools.snowflakeId(),
|
|
5475
|
-
name: "
|
|
5169
|
+
name: "Script",
|
|
5476
5170
|
enabled: 1,
|
|
5477
5171
|
data: `function isJSON(str) {
|
|
5478
5172
|
try {
|
|
@@ -5492,7 +5186,7 @@ class ThunderToApipost {
|
|
|
5492
5186
|
return {
|
|
5493
5187
|
type: "customScript",
|
|
5494
5188
|
id: ATools.snowflakeId(),
|
|
5495
|
-
name: "
|
|
5189
|
+
name: "Script",
|
|
5496
5190
|
enabled: 1,
|
|
5497
5191
|
data: ` apt.test("${action}", function () {
|
|
5498
5192
|
${str}
|
|
@@ -5551,7 +5245,7 @@ class ThunderToApipost {
|
|
|
5551
5245
|
}
|
|
5552
5246
|
initProject(json, project_id) {
|
|
5553
5247
|
var _a;
|
|
5554
|
-
this.project.name = (json === null || json === void 0 ? void 0 : json.collectionName) || "
|
|
5248
|
+
this.project.name = (json === null || json === void 0 ? void 0 : json.collectionName) || "New Project";
|
|
5555
5249
|
this.project.intro = ((_a = json === null || json === void 0 ? void 0 : json.settings) === null || _a === void 0 ? void 0 : _a.docs) || "";
|
|
5556
5250
|
this.project.project_id = project_id;
|
|
5557
5251
|
}
|
|
@@ -5563,7 +5257,7 @@ class ThunderToApipost {
|
|
|
5563
5257
|
project_id: this.project.project_id || "",
|
|
5564
5258
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
5565
5259
|
target_type: "folder",
|
|
5566
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
5260
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New Folder",
|
|
5567
5261
|
version: 0,
|
|
5568
5262
|
sort: 0,
|
|
5569
5263
|
description: ((_a = item === null || item === void 0 ? void 0 : item.settings) === null || _a === void 0 ? void 0 : _a.docs) || "",
|
|
@@ -5640,7 +5334,7 @@ class ThunderToApipost {
|
|
|
5640
5334
|
type: "customScript",
|
|
5641
5335
|
enabled: 1,
|
|
5642
5336
|
data: lodash.join(script, "\n"),
|
|
5643
|
-
name: "
|
|
5337
|
+
name: "Script",
|
|
5644
5338
|
id: ATools.snowflakeId(),
|
|
5645
5339
|
},
|
|
5646
5340
|
];
|
|
@@ -5660,7 +5354,7 @@ class ThunderToApipost {
|
|
|
5660
5354
|
asserts.push({
|
|
5661
5355
|
type: "assert",
|
|
5662
5356
|
id: ATools.snowflakeId(),
|
|
5663
|
-
name: "
|
|
5357
|
+
name: "Assertion",
|
|
5664
5358
|
enabled: 1,
|
|
5665
5359
|
data: {
|
|
5666
5360
|
type: "responseCode",
|
|
@@ -5677,7 +5371,7 @@ class ThunderToApipost {
|
|
|
5677
5371
|
asserts.push({
|
|
5678
5372
|
type: "assert",
|
|
5679
5373
|
id: ATools.snowflakeId(),
|
|
5680
|
-
name: "
|
|
5374
|
+
name: "Assertion",
|
|
5681
5375
|
enabled: 1,
|
|
5682
5376
|
data: {
|
|
5683
5377
|
type: "responseText",
|
|
@@ -5693,7 +5387,7 @@ class ThunderToApipost {
|
|
|
5693
5387
|
asserts.push({
|
|
5694
5388
|
type: "assert",
|
|
5695
5389
|
id: ATools.snowflakeId(),
|
|
5696
|
-
name: "
|
|
5390
|
+
name: "Assertion",
|
|
5697
5391
|
enabled: 1,
|
|
5698
5392
|
data: {
|
|
5699
5393
|
type: "responseTime",
|
|
@@ -5709,7 +5403,7 @@ class ThunderToApipost {
|
|
|
5709
5403
|
asserts.push({
|
|
5710
5404
|
type: "assert",
|
|
5711
5405
|
id: ATools.snowflakeId(),
|
|
5712
|
-
name: "
|
|
5406
|
+
name: "Assertion",
|
|
5713
5407
|
enabled: 1,
|
|
5714
5408
|
data: {
|
|
5715
5409
|
type: "responseHeader",
|
|
@@ -5725,7 +5419,7 @@ class ThunderToApipost {
|
|
|
5725
5419
|
asserts.push({
|
|
5726
5420
|
type: "assert",
|
|
5727
5421
|
id: ATools.snowflakeId(),
|
|
5728
|
-
name: "
|
|
5422
|
+
name: "Assertion",
|
|
5729
5423
|
enabled: 1,
|
|
5730
5424
|
data: {
|
|
5731
5425
|
type: "responseHeader",
|
|
@@ -5741,7 +5435,7 @@ class ThunderToApipost {
|
|
|
5741
5435
|
asserts.push({
|
|
5742
5436
|
type: "assert",
|
|
5743
5437
|
id: ATools.snowflakeId(),
|
|
5744
|
-
name: "
|
|
5438
|
+
name: "Assertion",
|
|
5745
5439
|
enabled: 1,
|
|
5746
5440
|
data: {
|
|
5747
5441
|
type: "responseHeader",
|
|
@@ -5757,7 +5451,7 @@ class ThunderToApipost {
|
|
|
5757
5451
|
asserts.push({
|
|
5758
5452
|
type: "assert",
|
|
5759
5453
|
id: ATools.snowflakeId(),
|
|
5760
|
-
name: "
|
|
5454
|
+
name: "Assertion",
|
|
5761
5455
|
enabled: 1,
|
|
5762
5456
|
data: {
|
|
5763
5457
|
type: "responseHeader",
|
|
@@ -5773,7 +5467,7 @@ class ThunderToApipost {
|
|
|
5773
5467
|
asserts.push({
|
|
5774
5468
|
type: "assert",
|
|
5775
5469
|
id: ATools.snowflakeId(),
|
|
5776
|
-
name: "
|
|
5470
|
+
name: "Assertion",
|
|
5777
5471
|
enabled: 1,
|
|
5778
5472
|
data: {
|
|
5779
5473
|
type: "responseJson",
|
|
@@ -5789,7 +5483,7 @@ class ThunderToApipost {
|
|
|
5789
5483
|
asserts.push({
|
|
5790
5484
|
type: "pickVars",
|
|
5791
5485
|
id: ATools.snowflakeId(),
|
|
5792
|
-
name: "
|
|
5486
|
+
name: "Variable Name",
|
|
5793
5487
|
enabled: 1,
|
|
5794
5488
|
data: {
|
|
5795
5489
|
source: "responseJson",
|
|
@@ -5810,6 +5504,7 @@ class ThunderToApipost {
|
|
|
5810
5504
|
asserts.push(this.diyScript(test === null || test === void 0 ? void 0 : test.action, test));
|
|
5811
5505
|
}
|
|
5812
5506
|
});
|
|
5507
|
+
return asserts;
|
|
5813
5508
|
}
|
|
5814
5509
|
return [];
|
|
5815
5510
|
}
|
|
@@ -5882,7 +5577,7 @@ class ThunderToApipost {
|
|
|
5882
5577
|
project_id: this.project.project_id || "",
|
|
5883
5578
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || "0",
|
|
5884
5579
|
target_type: "api",
|
|
5885
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || "
|
|
5580
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || "New HTTP",
|
|
5886
5581
|
version: 0,
|
|
5887
5582
|
sort: 0,
|
|
5888
5583
|
description: (item === null || item === void 0 ? void 0 : item.docs) || "",
|
|
@@ -5901,7 +5596,7 @@ class ThunderToApipost {
|
|
|
5901
5596
|
content_type: "json",
|
|
5902
5597
|
is_default: 1,
|
|
5903
5598
|
mock: "",
|
|
5904
|
-
name: "
|
|
5599
|
+
name: "Success",
|
|
5905
5600
|
schema: {
|
|
5906
5601
|
type: "object",
|
|
5907
5602
|
properties: {},
|
|
@@ -5918,7 +5613,7 @@ class ThunderToApipost {
|
|
|
5918
5613
|
content_type: "json",
|
|
5919
5614
|
is_default: -1,
|
|
5920
5615
|
mock: "",
|
|
5921
|
-
name: "
|
|
5616
|
+
name: "Failed",
|
|
5922
5617
|
schema: {
|
|
5923
5618
|
type: "object",
|
|
5924
5619
|
properties: {},
|