echoapi-converter 0.0.39 → 0.0.41

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -250,6 +250,12 @@ const API_METHODS = [
250
250
  'PROPFIND',
251
251
  'VIEW',
252
252
  ];
253
+ const APIPOST_GRANT_TYPES = ['authorization_code', 'password_credentials', 'authorization_code_with_pkce'];
254
+ const THUNDER_CLIENT_GRANT_TYPES = {
255
+ "password": 'password_credentials',
256
+ "authorization_code": "authorization_code",
257
+ "authorization_code_with_pkce": "authorization_code_with_pkce"
258
+ };
253
259
 
254
260
  // @ts-nocheck
255
261
  const splicedPath = (name, version) => {
@@ -3876,6 +3882,7 @@ const completionPostmanTarget = (targetItem) => {
3876
3882
  };
3877
3883
  return {
3878
3884
  raw: (targetItem === null || targetItem === void 0 ? void 0 : targetItem.url) || '',
3885
+ host: [(targetItem === null || targetItem === void 0 ? void 0 : targetItem.url) || ''],
3879
3886
  query: getPostmanQuery((_b = (_a = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.parameter),
3880
3887
  variable: getPostmanVariable((_d = (_c = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _c === void 0 ? void 0 : _c.restful) === null || _d === void 0 ? void 0 : _d.parameter)
3881
3888
  };
@@ -5570,7 +5577,7 @@ class PostmanToApipost {
5570
5577
  addTokenTo: (authMap === null || authMap === void 0 ? void 0 : authMap.addTokenTo) || 'header',
5571
5578
  headerPrefix: (authMap === null || authMap === void 0 ? void 0 : authMap.headerPrefix) || 'Bearer',
5572
5579
  access_token: '',
5573
- grant_type: 'authorization_code',
5580
+ grant_type: APIPOST_GRANT_TYPES.includes(authMap === null || authMap === void 0 ? void 0 : authMap.grant_type) ? authMap === null || authMap === void 0 ? void 0 : authMap.grant_type : 'authorization_code',
5574
5581
  redirect_uri: (authMap === null || authMap === void 0 ? void 0 : authMap.redirect_uri) || '',
5575
5582
  authUrl: (authMap === null || authMap === void 0 ? void 0 : authMap.authUrl) || '',
5576
5583
  accessTokenUrl: (authMap === null || authMap === void 0 ? void 0 : authMap.accessTokenUrl) || '',
@@ -6537,7 +6544,7 @@ class ThunderToApipost {
6537
6544
  }
6538
6545
  // auth
6539
6546
  completionApiRequestAuth(auth) {
6540
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6547
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
6541
6548
  const customAuth = {};
6542
6549
  if ((auth === null || auth === void 0 ? void 0 : auth.type) === "bearer") {
6543
6550
  customAuth["type"] = "bearer";
@@ -6579,18 +6586,18 @@ class ThunderToApipost {
6579
6586
  addTokenTo: "header",
6580
6587
  headerPrefix: "Bearer",
6581
6588
  access_token: "",
6582
- grant_type: ((_m = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _m === void 0 ? void 0 : _m.grantType) || "authorization_code",
6583
- redirect_uri: ((_o = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _o === void 0 ? void 0 : _o.callbackUrl) || "",
6584
- authUrl: ((_p = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _p === void 0 ? void 0 : _p.authUrl) || "",
6585
- accessTokenUrl: ((_q = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _q === void 0 ? void 0 : _q.tokenUrl) || "",
6586
- clientId: ((_r = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _r === void 0 ? void 0 : _r.clientId) || "",
6587
- clientSecret: ((_s = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _s === void 0 ? void 0 : _s.clientSecret) || "",
6588
- username: ((_t = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _t === void 0 ? void 0 : _t.username) || "",
6589
- password: ((_u = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _u === void 0 ? void 0 : _u.password) || "",
6589
+ grant_type: THUNDER_CLIENT_GRANT_TYPES[(_m = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _m === void 0 ? void 0 : _m.grantType] ? THUNDER_CLIENT_GRANT_TYPES[(_o = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _o === void 0 ? void 0 : _o.grantType] : "authorization_code",
6590
+ redirect_uri: ((_p = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _p === void 0 ? void 0 : _p.callbackUrl) || "",
6591
+ authUrl: ((_q = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _q === void 0 ? void 0 : _q.authUrl) || "",
6592
+ accessTokenUrl: ((_r = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _r === void 0 ? void 0 : _r.tokenUrl) || "",
6593
+ clientId: ((_s = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _s === void 0 ? void 0 : _s.clientId) || "",
6594
+ clientSecret: ((_t = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _t === void 0 ? void 0 : _t.clientSecret) || "",
6595
+ username: ((_u = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _u === void 0 ? void 0 : _u.username) || "",
6596
+ password: ((_v = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _v === void 0 ? void 0 : _v.password) || "",
6590
6597
  challengeAlgorithm: "S256",
6591
6598
  code_verifier: "Bearer",
6592
- scope: ((_v = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _v === void 0 ? void 0 : _v.scope) || "",
6593
- state: ((_w = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _w === void 0 ? void 0 : _w.state) || "",
6599
+ scope: ((_w = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _w === void 0 ? void 0 : _w.scope) || "",
6600
+ state: ((_x = auth === null || auth === void 0 ? void 0 : auth.oauth2) === null || _x === void 0 ? void 0 : _x.state) || "",
6594
6601
  client_authentication: "header",
6595
6602
  refreshTokenUrl: "",
6596
6603
  authRequestParams: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [