echoapi-converter 0.0.2 → 0.0.4
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/README.md +1 -1
- package/dist/index.js +73 -66
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# echoapi-converter
|
|
2
|
-
EchoAPI
|
|
2
|
+
EchoAPI format conversion, including swagger, echo format, and posman format
|
package/dist/index.js
CHANGED
|
@@ -443,6 +443,13 @@ const throwResult$1 = (status, message, data = '') => {
|
|
|
443
443
|
data
|
|
444
444
|
};
|
|
445
445
|
};
|
|
446
|
+
const transExample = (example) => {
|
|
447
|
+
if (lodash.isString(example))
|
|
448
|
+
return example;
|
|
449
|
+
if (lodash.isNumber(example))
|
|
450
|
+
return String(example);
|
|
451
|
+
return example;
|
|
452
|
+
};
|
|
446
453
|
const getBeautifulRaw = (raw) => {
|
|
447
454
|
var _a;
|
|
448
455
|
try {
|
|
@@ -655,7 +662,7 @@ class ApipostToSwagger {
|
|
|
655
662
|
handleProject() {
|
|
656
663
|
const { name, intro } = this.apiToSwaggerOrigin.project || {};
|
|
657
664
|
this.apiToSwaggerResult.info = {
|
|
658
|
-
title: name || '
|
|
665
|
+
title: name || 'New Project',
|
|
659
666
|
description: intro || '',
|
|
660
667
|
version: '1.0.0',
|
|
661
668
|
};
|
|
@@ -718,7 +725,7 @@ class ApipostToSwagger {
|
|
|
718
725
|
for (const env of envs) {
|
|
719
726
|
const servers = {
|
|
720
727
|
url: (env === null || env === void 0 ? void 0 : env.url) || '',
|
|
721
|
-
description: (env === null || env === void 0 ? void 0 : env.name) || '
|
|
728
|
+
description: (env === null || env === void 0 ? void 0 : env.name) || 'New Environment',
|
|
722
729
|
};
|
|
723
730
|
if (lodash.isPlainObject(env === null || env === void 0 ? void 0 : env.env_var_list)) {
|
|
724
731
|
servers.variables = {};
|
|
@@ -846,7 +853,7 @@ class ApipostToSwagger {
|
|
|
846
853
|
this.apiToSwaggerResult.tags = [];
|
|
847
854
|
}
|
|
848
855
|
this.apiToSwaggerResult.tags.push({
|
|
849
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
856
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
850
857
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
851
858
|
});
|
|
852
859
|
folderObj[item === null || item === void 0 ? void 0 : item.name] = item;
|
|
@@ -1149,7 +1156,7 @@ const escapeRegExp = (str) => {
|
|
|
1149
1156
|
const createNewModelData2 = (item, model_name) => {
|
|
1150
1157
|
var model = {
|
|
1151
1158
|
model_id: `#/definitions/${model_name}`,
|
|
1152
|
-
name: model_name || '
|
|
1159
|
+
name: model_name || 'New Schema',
|
|
1153
1160
|
displayName: model_name || '',
|
|
1154
1161
|
model_type: 'model',
|
|
1155
1162
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -1164,7 +1171,7 @@ const createNewModelData2 = (item, model_name) => {
|
|
|
1164
1171
|
const createDataModelNewFolder = (folder_name) => {
|
|
1165
1172
|
var newFolder = {
|
|
1166
1173
|
'model_id': '',
|
|
1167
|
-
'name': folder_name || '
|
|
1174
|
+
'name': folder_name || 'New Folder',
|
|
1168
1175
|
'model_type': 'folder',
|
|
1169
1176
|
'description': folder_name || '',
|
|
1170
1177
|
'children': [],
|
|
@@ -1174,7 +1181,7 @@ const createDataModelNewFolder = (folder_name) => {
|
|
|
1174
1181
|
const createNewModelData = (item, key, folder_name) => {
|
|
1175
1182
|
var model = {
|
|
1176
1183
|
model_id: `#/components/${folder_name}/${key}`,
|
|
1177
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || key || '
|
|
1184
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || key || 'New Schema',
|
|
1178
1185
|
displayName: (item === null || item === void 0 ? void 0 : item.title) || '',
|
|
1179
1186
|
model_type: 'model',
|
|
1180
1187
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -1303,7 +1310,7 @@ class SwaggerToApipost {
|
|
|
1303
1310
|
const that = this;
|
|
1304
1311
|
if (lodash.isArray(json === null || json === void 0 ? void 0 : json.tags)) {
|
|
1305
1312
|
json.tags.forEach((item) => {
|
|
1306
|
-
const folder_name = (item === null || item === void 0 ? void 0 : item.name) || '
|
|
1313
|
+
const folder_name = (item === null || item === void 0 ? void 0 : item.name) || 'New Folder';
|
|
1307
1314
|
if (!that.folderNames[folder_name] && !Object.keys(that.folders).includes(folder_name)) {
|
|
1308
1315
|
that.apis.push(Object.assign(Object.assign({}, that.createNewFolder(folder_name, json.tags)), { sort: 1 }));
|
|
1309
1316
|
}
|
|
@@ -1348,7 +1355,7 @@ class SwaggerToApipost {
|
|
|
1348
1355
|
validate(json) {
|
|
1349
1356
|
if (lodash.has(json, 'swagger')) {
|
|
1350
1357
|
if (json.swagger !== '2.0') {
|
|
1351
|
-
return throwResult$1('error', '
|
|
1358
|
+
return throwResult$1('error', 'Non standard format Swagger file, please check and upload again');
|
|
1352
1359
|
}
|
|
1353
1360
|
else {
|
|
1354
1361
|
this.version = '2.0';
|
|
@@ -1358,13 +1365,13 @@ class SwaggerToApipost {
|
|
|
1358
1365
|
this.version = '3.0';
|
|
1359
1366
|
}
|
|
1360
1367
|
if (!lodash.has(json, 'swagger') && !lodash.has(json, 'openapi')) {
|
|
1361
|
-
return throwResult$1('error', '
|
|
1368
|
+
return throwResult$1('error', 'Non standard format Swagger file, please check and upload again');
|
|
1362
1369
|
}
|
|
1363
1370
|
return throwResult$1('success', '');
|
|
1364
1371
|
}
|
|
1365
1372
|
handleInfo(json) {
|
|
1366
1373
|
var _a, _b;
|
|
1367
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.title) || '
|
|
1374
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.title) || 'New Project';
|
|
1368
1375
|
this.project.description = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
1369
1376
|
}
|
|
1370
1377
|
setBasePath(json) {
|
|
@@ -1402,7 +1409,7 @@ class SwaggerToApipost {
|
|
|
1402
1409
|
return;
|
|
1403
1410
|
for (const server of servers) {
|
|
1404
1411
|
const newEnv = {
|
|
1405
|
-
name: (server === null || server === void 0 ? void 0 : server.description) || (server === null || server === void 0 ? void 0 : server.url) || '
|
|
1412
|
+
name: (server === null || server === void 0 ? void 0 : server.description) || (server === null || server === void 0 ? void 0 : server.url) || 'Unnamed environment',
|
|
1406
1413
|
url: server.url || '',
|
|
1407
1414
|
env_var_list: {},
|
|
1408
1415
|
};
|
|
@@ -1430,7 +1437,7 @@ class SwaggerToApipost {
|
|
|
1430
1437
|
this.handleTags(swaggerApi.tags, tags);
|
|
1431
1438
|
}
|
|
1432
1439
|
const api = {
|
|
1433
|
-
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || '
|
|
1440
|
+
name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
|
|
1434
1441
|
target_type: 'api',
|
|
1435
1442
|
tags: [],
|
|
1436
1443
|
url: url || '',
|
|
@@ -1459,7 +1466,7 @@ class SwaggerToApipost {
|
|
|
1459
1466
|
request.query.parameter.push({
|
|
1460
1467
|
is_checked: 1, // 是否选择
|
|
1461
1468
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1462
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_a = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _a === void 0 ? void 0 : _a.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1469
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_a = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _a === void 0 ? void 0 : _a.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1463
1470
|
not_null: (parameter === null || parameter === void 0 ? void 0 : parameter.required) ? 1 : -1, // 是否为空
|
|
1464
1471
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1465
1472
|
field_type: getFidldType((_b = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _b === void 0 ? void 0 : _b.type), // 类型
|
|
@@ -1476,7 +1483,7 @@ class SwaggerToApipost {
|
|
|
1476
1483
|
request.header.parameter.push({
|
|
1477
1484
|
is_checked: 1, // 是否选择
|
|
1478
1485
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1479
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_c = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _c === void 0 ? void 0 : _c.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1486
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_c = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _c === void 0 ? void 0 : _c.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1480
1487
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
1481
1488
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1482
1489
|
field_type: getFidldType((_d = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _d === void 0 ? void 0 : _d.type), // 类型
|
|
@@ -1493,7 +1500,7 @@ class SwaggerToApipost {
|
|
|
1493
1500
|
request.restful.parameter.push({
|
|
1494
1501
|
is_checked: 1, // 是否选择
|
|
1495
1502
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1496
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_e = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _e === void 0 ? void 0 : _e.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1503
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_e = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _e === void 0 ? void 0 : _e.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1497
1504
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
1498
1505
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1499
1506
|
field_type: getFidldType((_f = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _f === void 0 ? void 0 : _f.type), // 类型
|
|
@@ -1532,7 +1539,7 @@ class SwaggerToApipost {
|
|
|
1532
1539
|
request.body.parameter.push({
|
|
1533
1540
|
is_checked: 1,
|
|
1534
1541
|
key: key || '',
|
|
1535
|
-
value: (item === null || item === void 0 ? void 0 : item.example) || '',
|
|
1542
|
+
value: transExample(item === null || item === void 0 ? void 0 : item.example) || '',
|
|
1536
1543
|
not_null: (item === null || item === void 0 ? void 0 : item.required) ? 1 : -1,
|
|
1537
1544
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
1538
1545
|
field_type: lodash.has(item, 'type')
|
|
@@ -1927,7 +1934,7 @@ class SwaggerToApipost {
|
|
|
1927
1934
|
request.query.parameter.push({
|
|
1928
1935
|
is_checked: 1, // 是否选择
|
|
1929
1936
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1930
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_a = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _a === void 0 ? void 0 : _a.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1937
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_a = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _a === void 0 ? void 0 : _a.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1931
1938
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
1932
1939
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1933
1940
|
field_type: getFidldType(parameter === null || parameter === void 0 ? void 0 : parameter.type), // 类型
|
|
@@ -1944,7 +1951,7 @@ class SwaggerToApipost {
|
|
|
1944
1951
|
request.header.parameter.push({
|
|
1945
1952
|
is_checked: 1, // 是否选择
|
|
1946
1953
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1947
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_b = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _b === void 0 ? void 0 : _b.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1954
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_b = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _b === void 0 ? void 0 : _b.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1948
1955
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
1949
1956
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1950
1957
|
field_type: getFidldType(parameter === null || parameter === void 0 ? void 0 : parameter.type), // 类型
|
|
@@ -1961,7 +1968,7 @@ class SwaggerToApipost {
|
|
|
1961
1968
|
request.restful.parameter.push({
|
|
1962
1969
|
is_checked: 1, // 是否选择
|
|
1963
1970
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
1964
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_c = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _c === void 0 ? void 0 : _c.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1971
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_c = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _c === void 0 ? void 0 : _c.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
1965
1972
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
1966
1973
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
1967
1974
|
field_type: getFidldType(parameter === null || parameter === void 0 ? void 0 : parameter.type), // 类型
|
|
@@ -1976,7 +1983,7 @@ class SwaggerToApipost {
|
|
|
1976
1983
|
const Raw = handleBodyJsonSchema(parameter.schema, raw_parameter);
|
|
1977
1984
|
const originRaw = lodash.isPlainObject(Raw) || Array.isArray(Raw) ? JSON.stringify(Raw) : Raw;
|
|
1978
1985
|
const Raw_text = this.getBeautifulRaw(originRaw);
|
|
1979
|
-
request.body.raw = (parameter === null || parameter === void 0 ? void 0 : parameter.example) || Raw_text;
|
|
1986
|
+
request.body.raw = transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || Raw_text;
|
|
1980
1987
|
if (lodash.isEmpty(request.body.raw)) {
|
|
1981
1988
|
try {
|
|
1982
1989
|
const myMockSchema = new MockSchema__default["default"]();
|
|
@@ -2002,7 +2009,7 @@ class SwaggerToApipost {
|
|
|
2002
2009
|
request.body.parameter.push({
|
|
2003
2010
|
is_checked: 1, // 是否选择
|
|
2004
2011
|
key: (parameter === null || parameter === void 0 ? void 0 : parameter.name) || '', //参数名
|
|
2005
|
-
value: (parameter === null || parameter === void 0 ? void 0 : parameter.example) || ((_f = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _f === void 0 ? void 0 : _f.example) || (parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
2012
|
+
value: transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || transExample((_f = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _f === void 0 ? void 0 : _f.example) || transExample(parameter === null || parameter === void 0 ? void 0 : parameter.default) || '', //参数值
|
|
2006
2013
|
not_null: parameter.required ? 1 : -1, // 是否为空
|
|
2007
2014
|
description: (parameter === null || parameter === void 0 ? void 0 : parameter.description) || '', // 参数描述
|
|
2008
2015
|
field_type: getFidldType(((_g = parameter === null || parameter === void 0 ? void 0 : parameter.schema) === null || _g === void 0 ? void 0 : _g.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type)), // 类型
|
|
@@ -2270,7 +2277,7 @@ class SwaggerToApipost {
|
|
|
2270
2277
|
}
|
|
2271
2278
|
catch (err) {
|
|
2272
2279
|
if ((err === null || err === void 0 ? void 0 : err.name) === 'AbortError') {
|
|
2273
|
-
return throwResult$1('error', '
|
|
2280
|
+
return throwResult$1('error', 'The data is too large and the request has timed out.');
|
|
2274
2281
|
}
|
|
2275
2282
|
return throwResult$1('error', String(err));
|
|
2276
2283
|
}
|
|
@@ -2335,7 +2342,7 @@ class ApidocToApipost {
|
|
|
2335
2342
|
this.foldersMap = {};
|
|
2336
2343
|
}
|
|
2337
2344
|
initProject(project_id) {
|
|
2338
|
-
this.project.name = '
|
|
2345
|
+
this.project.name = 'New project';
|
|
2339
2346
|
this.project.intro = '';
|
|
2340
2347
|
this.project.project_id = project_id;
|
|
2341
2348
|
}
|
|
@@ -2485,7 +2492,7 @@ class ApidocToApipost {
|
|
|
2485
2492
|
content_type: 'json',
|
|
2486
2493
|
is_default: 1,
|
|
2487
2494
|
mock: '',
|
|
2488
|
-
name: '
|
|
2495
|
+
name: 'success',
|
|
2489
2496
|
schema: {
|
|
2490
2497
|
type: 'object',
|
|
2491
2498
|
properties: {},
|
|
@@ -2502,7 +2509,7 @@ class ApidocToApipost {
|
|
|
2502
2509
|
content_type: 'json',
|
|
2503
2510
|
is_default: -1,
|
|
2504
2511
|
mock: '',
|
|
2505
|
-
name: '
|
|
2512
|
+
name: 'fail',
|
|
2506
2513
|
schema: {
|
|
2507
2514
|
type: 'object',
|
|
2508
2515
|
properties: {},
|
|
@@ -2531,7 +2538,7 @@ class ApidocToApipost {
|
|
|
2531
2538
|
project_id: this.project.project_id || '',
|
|
2532
2539
|
parent_id: '0',
|
|
2533
2540
|
target_type: 'folder',
|
|
2534
|
-
name: (item === null || item === void 0 ? void 0 : item.group) || '
|
|
2541
|
+
name: (item === null || item === void 0 ? void 0 : item.group) || 'New Folder',
|
|
2535
2542
|
version: 0,
|
|
2536
2543
|
sort: 0,
|
|
2537
2544
|
description: (item === null || item === void 0 ? void 0 : item.groupTitle) || '',
|
|
@@ -2547,7 +2554,7 @@ class ApidocToApipost {
|
|
|
2547
2554
|
project_id: this.project.project_id || '',
|
|
2548
2555
|
parent_id: id || '0',
|
|
2549
2556
|
target_type: 'api',
|
|
2550
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || '
|
|
2557
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || 'New HTTP',
|
|
2551
2558
|
version: 0,
|
|
2552
2559
|
sort: 0,
|
|
2553
2560
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -2769,7 +2776,7 @@ class ApifoxToApipost {
|
|
|
2769
2776
|
}
|
|
2770
2777
|
initProject(json, project_id) {
|
|
2771
2778
|
var _a, _b;
|
|
2772
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || '
|
|
2779
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || 'New Project';
|
|
2773
2780
|
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
2774
2781
|
this.project.project_id = project_id;
|
|
2775
2782
|
}
|
|
@@ -2846,11 +2853,11 @@ class ApifoxToApipost {
|
|
|
2846
2853
|
const server_id = ATools.snowflakeId();
|
|
2847
2854
|
this.serversMap[item.id] = {
|
|
2848
2855
|
server_id: (item === null || item === void 0 ? void 0 : item.id) === 'default' ? '1' : server_id,
|
|
2849
|
-
name: (item === null || item === void 0 ? void 0 : item.name) ||
|
|
2856
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
2850
2857
|
};
|
|
2851
2858
|
return {
|
|
2852
2859
|
server_id: (item === null || item === void 0 ? void 0 : item.id) === 'default' ? '1' : server_id,
|
|
2853
|
-
name: (item === null || item === void 0 ? void 0 : item.name) ||
|
|
2860
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || `Server${server_id}`,
|
|
2854
2861
|
};
|
|
2855
2862
|
});
|
|
2856
2863
|
}
|
|
@@ -2948,7 +2955,7 @@ class ApifoxToApipost {
|
|
|
2948
2955
|
model_type: 'folder',
|
|
2949
2956
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
2950
2957
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.model_id) || '0',
|
|
2951
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
2958
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
2952
2959
|
display_name: (item === null || item === void 0 ? void 0 : item.displayName) || '',
|
|
2953
2960
|
sort: 1000,
|
|
2954
2961
|
};
|
|
@@ -2963,7 +2970,7 @@ class ApifoxToApipost {
|
|
|
2963
2970
|
this.modelMap[item.id] = model_id;
|
|
2964
2971
|
}
|
|
2965
2972
|
pre.push({
|
|
2966
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
2973
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Schema',
|
|
2967
2974
|
model_id,
|
|
2968
2975
|
model_type: 'model',
|
|
2969
2976
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -3001,7 +3008,7 @@ class ApifoxToApipost {
|
|
|
3001
3008
|
type: item === null || item === void 0 ? void 0 : item.type,
|
|
3002
3009
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3003
3010
|
id: ATools.snowflakeId(),
|
|
3004
|
-
name: '
|
|
3011
|
+
name: 'Script',
|
|
3005
3012
|
data: (item === null || item === void 0 ? void 0 : item.data) || '',
|
|
3006
3013
|
});
|
|
3007
3014
|
}
|
|
@@ -3010,7 +3017,7 @@ class ApifoxToApipost {
|
|
|
3010
3017
|
type: item === null || item === void 0 ? void 0 : item.type,
|
|
3011
3018
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3012
3019
|
id: ATools.snowflakeId(),
|
|
3013
|
-
name: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.name) || '
|
|
3020
|
+
name: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.name) || 'Database',
|
|
3014
3021
|
data: {
|
|
3015
3022
|
query: ((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.expression) || '',
|
|
3016
3023
|
isConsoleOutput: ((_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.printResults) ? 1 : -1,
|
|
@@ -3018,7 +3025,7 @@ class ApifoxToApipost {
|
|
|
3018
3025
|
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) => {
|
|
3019
3026
|
if (item === null || item === void 0 ? void 0 : item.variableName) {
|
|
3020
3027
|
pre.push({
|
|
3021
|
-
name: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableName) || '
|
|
3028
|
+
name: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.variableName) || 'Variable',
|
|
3022
3029
|
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',
|
|
3023
3030
|
pattern: (variablesItem === null || variablesItem === void 0 ? void 0 : variablesItem.jsonPath) || '',
|
|
3024
3031
|
param_id: ATools.snowflakeId(),
|
|
@@ -3034,7 +3041,7 @@ class ApifoxToApipost {
|
|
|
3034
3041
|
type: 'pickVars',
|
|
3035
3042
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3036
3043
|
id: ATools.snowflakeId(),
|
|
3037
|
-
name: ((_f = item === null || item === void 0 ? void 0 : item.data) === null || _f === void 0 ? void 0 : _f.variableName) || '
|
|
3044
|
+
name: ((_f = item === null || item === void 0 ? void 0 : item.data) === null || _f === void 0 ? void 0 : _f.variableName) || 'Variable Name',
|
|
3038
3045
|
data: {
|
|
3039
3046
|
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',
|
|
3040
3047
|
variables: [],
|
|
@@ -3046,7 +3053,7 @@ class ApifoxToApipost {
|
|
|
3046
3053
|
type: 'assert',
|
|
3047
3054
|
enabled: (item === null || item === void 0 ? void 0 : item.enable) ? 1 : -1,
|
|
3048
3055
|
id: ATools.snowflakeId(),
|
|
3049
|
-
name: ((_h = item === null || item === void 0 ? void 0 : item.data) === null || _h === void 0 ? void 0 : _h.name) || '
|
|
3056
|
+
name: ((_h = item === null || item === void 0 ? void 0 : item.data) === null || _h === void 0 ? void 0 : _h.name) || 'Assertion',
|
|
3050
3057
|
data: {
|
|
3051
3058
|
type: ASSERT_TYPES_MAP[(_j = item === null || item === void 0 ? void 0 : item.data) === null || _j === void 0 ? void 0 : _j.subject] || 'responseJson',
|
|
3052
3059
|
expression: {
|
|
@@ -3298,7 +3305,7 @@ class ApifoxToApipost {
|
|
|
3298
3305
|
project_id: this.project.project_id || '',
|
|
3299
3306
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
3300
3307
|
target_type: 'folder',
|
|
3301
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
3308
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
3302
3309
|
version: 0,
|
|
3303
3310
|
sort: 0,
|
|
3304
3311
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -3352,14 +3359,14 @@ class ApifoxToApipost {
|
|
|
3352
3359
|
completionApiTarget(item, baseInfo, parentInfo) {
|
|
3353
3360
|
var _a;
|
|
3354
3361
|
const { api } = item || {};
|
|
3355
|
-
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) || '
|
|
3362
|
+
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 });
|
|
3356
3363
|
}
|
|
3357
3364
|
completionApiSample(item, baseInfo) {
|
|
3358
3365
|
const { api } = item || {};
|
|
3359
3366
|
const { cases } = api || {};
|
|
3360
3367
|
return cases === null || cases === void 0 ? void 0 : cases.map((caseItem) => {
|
|
3361
3368
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
3362
|
-
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) || '
|
|
3369
|
+
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({
|
|
3363
3370
|
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) || []),
|
|
3364
3371
|
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) || []),
|
|
3365
3372
|
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) || []),
|
|
@@ -3417,7 +3424,7 @@ class ApifoxToApipost {
|
|
|
3417
3424
|
project_id: this.project.project_id || '',
|
|
3418
3425
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[docItem === null || docItem === void 0 ? void 0 : docItem.folderId]) || '0',
|
|
3419
3426
|
target_type: 'doc',
|
|
3420
|
-
name: (docItem === null || docItem === void 0 ? void 0 : docItem.name) || '
|
|
3427
|
+
name: (docItem === null || docItem === void 0 ? void 0 : docItem.name) || 'New Markdown',
|
|
3421
3428
|
version: 0,
|
|
3422
3429
|
sort: 0,
|
|
3423
3430
|
mark_id: '1',
|
|
@@ -3450,7 +3457,7 @@ class ApifoxToApipost {
|
|
|
3450
3457
|
project_id: this.project.project_id || '',
|
|
3451
3458
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.folderId]) || '0',
|
|
3452
3459
|
target_type: 'socket',
|
|
3453
|
-
name: (tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.name) || '
|
|
3460
|
+
name: (tcpClientItem === null || tcpClientItem === void 0 ? void 0 : tcpClientItem.name) || 'New TCP Client',
|
|
3454
3461
|
version: 0,
|
|
3455
3462
|
sort: 0,
|
|
3456
3463
|
method: 'TCP',
|
|
@@ -3484,7 +3491,7 @@ class ApifoxToApipost {
|
|
|
3484
3491
|
completionTcpMethod(apis, parentInfo) {
|
|
3485
3492
|
if (isArray(apis) && apis.length) {
|
|
3486
3493
|
return apis === null || apis === void 0 ? void 0 : apis.reduce((pre, item) => {
|
|
3487
|
-
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) || '
|
|
3494
|
+
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 }));
|
|
3488
3495
|
return pre;
|
|
3489
3496
|
}, []);
|
|
3490
3497
|
}
|
|
@@ -3686,7 +3693,7 @@ class HarToApipost {
|
|
|
3686
3693
|
};
|
|
3687
3694
|
}
|
|
3688
3695
|
initProject(project_id) {
|
|
3689
|
-
this.project.name = '
|
|
3696
|
+
this.project.name = 'New Project';
|
|
3690
3697
|
this.project.intro = '';
|
|
3691
3698
|
this.project.project_id = project_id;
|
|
3692
3699
|
}
|
|
@@ -3762,7 +3769,7 @@ class HarToApipost {
|
|
|
3762
3769
|
content_type: 'json',
|
|
3763
3770
|
is_default: 1,
|
|
3764
3771
|
mock: '',
|
|
3765
|
-
name: '
|
|
3772
|
+
name: 'Success',
|
|
3766
3773
|
schema: {
|
|
3767
3774
|
type: 'object',
|
|
3768
3775
|
properties: {},
|
|
@@ -3779,7 +3786,7 @@ class HarToApipost {
|
|
|
3779
3786
|
content_type: 'json',
|
|
3780
3787
|
is_default: -1,
|
|
3781
3788
|
mock: '',
|
|
3782
|
-
name: '
|
|
3789
|
+
name: 'Failed',
|
|
3783
3790
|
schema: {
|
|
3784
3791
|
type: 'object',
|
|
3785
3792
|
properties: {},
|
|
@@ -3805,7 +3812,7 @@ class HarToApipost {
|
|
|
3805
3812
|
project_id: this.project.project_id || '',
|
|
3806
3813
|
parent_id: '0',
|
|
3807
3814
|
target_type: 'api',
|
|
3808
|
-
name: url || '
|
|
3815
|
+
name: url || 'New HTTP',
|
|
3809
3816
|
version: 0,
|
|
3810
3817
|
sort: 0,
|
|
3811
3818
|
description: '',
|
|
@@ -3898,7 +3905,7 @@ class InsomniaToApipost {
|
|
|
3898
3905
|
}
|
|
3899
3906
|
initProject(resources, project_id) {
|
|
3900
3907
|
const projectInfo = resources === null || resources === void 0 ? void 0 : resources.find((e) => (e === null || e === void 0 ? void 0 : e._type) === 'workspace');
|
|
3901
|
-
this.project.name = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.name) || '
|
|
3908
|
+
this.project.name = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.name) || 'New Project';
|
|
3902
3909
|
this.project.intro = (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.description) || '';
|
|
3903
3910
|
this.project.project_id = project_id;
|
|
3904
3911
|
}
|
|
@@ -3964,7 +3971,7 @@ class InsomniaToApipost {
|
|
|
3964
3971
|
{
|
|
3965
3972
|
type: 'customScript',
|
|
3966
3973
|
enabled: 1,
|
|
3967
|
-
name: '
|
|
3974
|
+
name: 'Script',
|
|
3968
3975
|
id: ATools.snowflakeId(),
|
|
3969
3976
|
data: (item === null || item === void 0 ? void 0 : item.preRequestScript) || '',
|
|
3970
3977
|
},
|
|
@@ -4051,7 +4058,7 @@ class InsomniaToApipost {
|
|
|
4051
4058
|
target_id: ATools.snowflakeId(),
|
|
4052
4059
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || '0',
|
|
4053
4060
|
target_type: 'websocket',
|
|
4054
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4061
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Websocket',
|
|
4055
4062
|
sort: 0,
|
|
4056
4063
|
version: 0,
|
|
4057
4064
|
mark_id: '1',
|
|
@@ -4081,7 +4088,7 @@ class InsomniaToApipost {
|
|
|
4081
4088
|
project_id: this.project.project_id || '',
|
|
4082
4089
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || '0',
|
|
4083
4090
|
target_type: 'api',
|
|
4084
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4091
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New HTTP',
|
|
4085
4092
|
version: 0,
|
|
4086
4093
|
sort: 0,
|
|
4087
4094
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -4100,7 +4107,7 @@ class InsomniaToApipost {
|
|
|
4100
4107
|
content_type: 'json',
|
|
4101
4108
|
is_default: 1,
|
|
4102
4109
|
mock: '',
|
|
4103
|
-
name: '
|
|
4110
|
+
name: 'Success',
|
|
4104
4111
|
schema: {
|
|
4105
4112
|
type: 'object',
|
|
4106
4113
|
properties: {},
|
|
@@ -4117,7 +4124,7 @@ class InsomniaToApipost {
|
|
|
4117
4124
|
content_type: 'json',
|
|
4118
4125
|
is_default: -1,
|
|
4119
4126
|
mock: '',
|
|
4120
|
-
name: '
|
|
4127
|
+
name: 'Failed',
|
|
4121
4128
|
schema: {
|
|
4122
4129
|
type: 'object',
|
|
4123
4130
|
properties: {},
|
|
@@ -4142,7 +4149,7 @@ class InsomniaToApipost {
|
|
|
4142
4149
|
project_id: this.project.project_id || '',
|
|
4143
4150
|
parent_id: this.foldersMap[item === null || item === void 0 ? void 0 : item.parentId] || '0',
|
|
4144
4151
|
target_type: 'folder',
|
|
4145
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4152
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
4146
4153
|
version: 0,
|
|
4147
4154
|
sort: 0,
|
|
4148
4155
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -4442,7 +4449,7 @@ class PostmanToApipost {
|
|
|
4442
4449
|
{
|
|
4443
4450
|
type: 'customScript',
|
|
4444
4451
|
enabled: 1,
|
|
4445
|
-
name: '
|
|
4452
|
+
name: 'Custom Script',
|
|
4446
4453
|
id: ATools.snowflakeId(),
|
|
4447
4454
|
data: isArray((_c = prerequest === null || prerequest === void 0 ? void 0 : prerequest.script) === null || _c === void 0 ? void 0 : _c.exec) ? (_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') : '',
|
|
4448
4455
|
},
|
|
@@ -4453,7 +4460,7 @@ class PostmanToApipost {
|
|
|
4453
4460
|
{
|
|
4454
4461
|
type: 'customScript',
|
|
4455
4462
|
enabled: 1,
|
|
4456
|
-
name: '
|
|
4463
|
+
name: 'Custom Script',
|
|
4457
4464
|
id: ATools.snowflakeId(),
|
|
4458
4465
|
data: isArray((_f = test === null || test === void 0 ? void 0 : test.script) === null || _f === void 0 ? void 0 : _f.exec) ? (_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') : '',
|
|
4459
4466
|
},
|
|
@@ -4488,7 +4495,7 @@ class PostmanToApipost {
|
|
|
4488
4495
|
project_id: this.project.project_id || '',
|
|
4489
4496
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4490
4497
|
target_type: 'folder',
|
|
4491
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4498
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
4492
4499
|
version: 0,
|
|
4493
4500
|
sort: 0,
|
|
4494
4501
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -4507,7 +4514,7 @@ class PostmanToApipost {
|
|
|
4507
4514
|
project_id: this.project.project_id || '',
|
|
4508
4515
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4509
4516
|
target_type: 'api',
|
|
4510
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4517
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New HTTP',
|
|
4511
4518
|
version: 0,
|
|
4512
4519
|
sort: 0,
|
|
4513
4520
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -4526,7 +4533,7 @@ class PostmanToApipost {
|
|
|
4526
4533
|
content_type: 'json',
|
|
4527
4534
|
is_default: 1,
|
|
4528
4535
|
mock: '',
|
|
4529
|
-
name: '
|
|
4536
|
+
name: 'Success',
|
|
4530
4537
|
schema: {
|
|
4531
4538
|
type: 'object',
|
|
4532
4539
|
properties: {},
|
|
@@ -4543,7 +4550,7 @@ class PostmanToApipost {
|
|
|
4543
4550
|
content_type: 'json',
|
|
4544
4551
|
is_default: -1,
|
|
4545
4552
|
mock: '',
|
|
4546
|
-
name: '
|
|
4553
|
+
name: 'Failed',
|
|
4547
4554
|
schema: {
|
|
4548
4555
|
type: 'object',
|
|
4549
4556
|
properties: {},
|
|
@@ -4586,7 +4593,7 @@ class PostmanToApipost {
|
|
|
4586
4593
|
}
|
|
4587
4594
|
initProject(json, project_id) {
|
|
4588
4595
|
var _a, _b;
|
|
4589
|
-
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || '
|
|
4596
|
+
this.project.name = ((_a = json === null || json === void 0 ? void 0 : json.info) === null || _a === void 0 ? void 0 : _a.name) || 'New Project';
|
|
4590
4597
|
this.project.intro = ((_b = json === null || json === void 0 ? void 0 : json.info) === null || _b === void 0 ? void 0 : _b.description) || '';
|
|
4591
4598
|
this.project.project_id = project_id;
|
|
4592
4599
|
}
|
|
@@ -4634,7 +4641,7 @@ class YapiToApipost {
|
|
|
4634
4641
|
};
|
|
4635
4642
|
}
|
|
4636
4643
|
initProject(project_id) {
|
|
4637
|
-
this.project.name = '
|
|
4644
|
+
this.project.name = 'New Project';
|
|
4638
4645
|
this.project.intro = '';
|
|
4639
4646
|
this.project.project_id = project_id;
|
|
4640
4647
|
}
|
|
@@ -4644,7 +4651,7 @@ class YapiToApipost {
|
|
|
4644
4651
|
project_id: this.project.project_id || '',
|
|
4645
4652
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4646
4653
|
target_type: 'folder',
|
|
4647
|
-
name: (item === null || item === void 0 ? void 0 : item.name) || '
|
|
4654
|
+
name: (item === null || item === void 0 ? void 0 : item.name) || 'New Folder',
|
|
4648
4655
|
version: 0,
|
|
4649
4656
|
sort: 0,
|
|
4650
4657
|
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
@@ -4782,7 +4789,7 @@ class YapiToApipost {
|
|
|
4782
4789
|
content_type: 'json',
|
|
4783
4790
|
is_default: 1,
|
|
4784
4791
|
mock: '',
|
|
4785
|
-
name: '
|
|
4792
|
+
name: 'Success',
|
|
4786
4793
|
schema,
|
|
4787
4794
|
verify_type: 'schema',
|
|
4788
4795
|
},
|
|
@@ -4796,7 +4803,7 @@ class YapiToApipost {
|
|
|
4796
4803
|
content_type: 'json',
|
|
4797
4804
|
is_default: -1,
|
|
4798
4805
|
mock: '',
|
|
4799
|
-
name: '
|
|
4806
|
+
name: 'Failed',
|
|
4800
4807
|
schema: {
|
|
4801
4808
|
type: 'object',
|
|
4802
4809
|
properties: {},
|
|
@@ -4816,7 +4823,7 @@ class YapiToApipost {
|
|
|
4816
4823
|
project_id: this.project.project_id || '',
|
|
4817
4824
|
parent_id: (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.target_id) || '0',
|
|
4818
4825
|
target_type: 'api',
|
|
4819
|
-
name: (item === null || item === void 0 ? void 0 : item.title) || '
|
|
4826
|
+
name: (item === null || item === void 0 ? void 0 : item.title) || 'New HTTP',
|
|
4820
4827
|
version: 0,
|
|
4821
4828
|
sort: 0,
|
|
4822
4829
|
description: (item === null || item === void 0 ? void 0 : item.desc) || '',
|