echoapi-converter 0.0.31 → 0.0.33
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 +18 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var lodash = require('lodash');
|
|
6
6
|
var ATools = require('apipost-tools');
|
|
7
|
+
require('url-parse');
|
|
7
8
|
var MockSchema = require('apipost-mock-schema');
|
|
8
9
|
var axios = require('axios');
|
|
9
10
|
var SwaggerClient = require('swagger-client');
|
|
10
|
-
require('url-parse');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -4229,6 +4229,17 @@ class InsomniaToApipost {
|
|
|
4229
4229
|
},
|
|
4230
4230
|
];
|
|
4231
4231
|
}
|
|
4232
|
+
if (item === null || item === void 0 ? void 0 : item.afterResponseScript) {
|
|
4233
|
+
request["post_tasks"] = [
|
|
4234
|
+
{
|
|
4235
|
+
type: "customScript",
|
|
4236
|
+
enabled: 1,
|
|
4237
|
+
name: "Script",
|
|
4238
|
+
id: ATools.snowflakeId(),
|
|
4239
|
+
data: (item === null || item === void 0 ? void 0 : item.afterResponseScript) || "",
|
|
4240
|
+
},
|
|
4241
|
+
];
|
|
4242
|
+
}
|
|
4232
4243
|
if ((authentication === null || authentication === void 0 ? void 0 : authentication.type) === "apikey") {
|
|
4233
4244
|
request.auth["type"] = "kv";
|
|
4234
4245
|
request.auth["kv"] = {
|
|
@@ -4241,12 +4252,12 @@ class InsomniaToApipost {
|
|
|
4241
4252
|
request.auth["type"] = "basic";
|
|
4242
4253
|
request.auth["basic"] = {
|
|
4243
4254
|
username: (authentication === null || authentication === void 0 ? void 0 : authentication.username) || "",
|
|
4244
|
-
password: (authentication === null || authentication === void 0 ? void 0 : authentication.
|
|
4255
|
+
password: (authentication === null || authentication === void 0 ? void 0 : authentication.password) || "",
|
|
4245
4256
|
};
|
|
4246
4257
|
}
|
|
4247
4258
|
else if ((authentication === null || authentication === void 0 ? void 0 : authentication.type) === "digest") {
|
|
4248
4259
|
request.auth["type"] = "digest";
|
|
4249
|
-
request.auth["digest"] = Object.assign(Object.assign({}, request.auth.digest), { username: (authentication === null || authentication === void 0 ? void 0 : authentication.username) || "", password: (authentication === null || authentication === void 0 ? void 0 : authentication.
|
|
4260
|
+
request.auth["digest"] = Object.assign(Object.assign({}, request.auth.digest), { username: (authentication === null || authentication === void 0 ? void 0 : authentication.username) || "", password: (authentication === null || authentication === void 0 ? void 0 : authentication.password) || "" });
|
|
4250
4261
|
}
|
|
4251
4262
|
else if ((authentication === null || authentication === void 0 ? void 0 : authentication.type) === "oauth1") {
|
|
4252
4263
|
request.auth["type"] = "oauth1";
|
|
@@ -4260,7 +4271,7 @@ class InsomniaToApipost {
|
|
|
4260
4271
|
}
|
|
4261
4272
|
else if ((authentication === null || authentication === void 0 ? void 0 : authentication.type) === "ntlm") {
|
|
4262
4273
|
request.auth["type"] = "ntlm";
|
|
4263
|
-
request.auth["ntlm"] = Object.assign(Object.assign({}, request.auth.ntlm), { username: (authentication === null || authentication === void 0 ? void 0 : authentication.username) || "", password: (authentication === null || authentication === void 0 ? void 0 : authentication.
|
|
4274
|
+
request.auth["ntlm"] = Object.assign(Object.assign({}, request.auth.ntlm), { username: (authentication === null || authentication === void 0 ? void 0 : authentication.username) || "", password: (authentication === null || authentication === void 0 ? void 0 : authentication.password) || "" });
|
|
4264
4275
|
}
|
|
4265
4276
|
else if ((authentication === null || authentication === void 0 ? void 0 : authentication.type) === "iam") {
|
|
4266
4277
|
request.auth["type"] = "awsv4";
|
|
@@ -4346,6 +4357,7 @@ class InsomniaToApipost {
|
|
|
4346
4357
|
project_id: this.project.project_id || "",
|
|
4347
4358
|
target_id: ATools.snowflakeId(),
|
|
4348
4359
|
parent_id: ((_a = this.foldersMap) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.parentId]) || "0",
|
|
4360
|
+
description: (item === null || item === void 0 ? void 0 : item.description) || '',
|
|
4349
4361
|
target_type: "websocket2",
|
|
4350
4362
|
name: (item === null || item === void 0 ? void 0 : item.name) || "New Websocket",
|
|
4351
4363
|
sort: 0,
|
|
@@ -4526,7 +4538,7 @@ class InsomniaToApipost {
|
|
|
4526
4538
|
}
|
|
4527
4539
|
completionApis(resources) {
|
|
4528
4540
|
return resources === null || resources === void 0 ? void 0 : resources.reduce((pre, item) => {
|
|
4529
|
-
var _a;
|
|
4541
|
+
var _a, _b;
|
|
4530
4542
|
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)) {
|
|
4531
4543
|
pre.push({
|
|
4532
4544
|
target_id: this.foldersMap[item === null || item === void 0 ? void 0 : item._id] || ATools.snowflakeId(),
|
|
@@ -4551,6 +4563,7 @@ class InsomniaToApipost {
|
|
|
4551
4563
|
}
|
|
4552
4564
|
else {
|
|
4553
4565
|
const target = this.completionApiTarget(item);
|
|
4566
|
+
target.url = genUrlByQuery(lodash.cloneDeep(target.url), (_b = target.request.query) === null || _b === void 0 ? void 0 : _b.parameter);
|
|
4554
4567
|
pre.push(target);
|
|
4555
4568
|
}
|
|
4556
4569
|
}
|