openapi-explorer 2.2.701 → 2.2.703
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/browser/openapi-explorer.min.js +2 -2
- package/dist/es/components/api-request.js +45 -21
- package/dist/es/components/api-response.js +4 -4
- package/dist/es/components/request-form-table.js +4 -4
- package/dist/es/components/schema-table.js +4 -4
- package/dist/es/components/schema-tree.js +4 -4
- package/dist/es/templates/components-template.js +2 -2
- package/dist/es/templates/endpoint-template.js +3 -3
- package/dist/es/templates/expanded-endpoint-template.js +3 -3
- package/dist/es/templates/overview-template.js +2 -2
- package/dist/es/templates/security-scheme-template.js +2 -2
- package/dist/es/templates/server-template.js +2 -2
- package/dist/es/utils/common-utils.js +33 -0
- package/dist/lib/components/api-request.js +45 -21
- package/dist/lib/components/api-response.js +4 -4
- package/dist/lib/components/request-form-table.js +4 -4
- package/dist/lib/components/schema-table.js +4 -4
- package/dist/lib/components/schema-tree.js +4 -4
- package/dist/lib/templates/components-template.js +2 -2
- package/dist/lib/templates/endpoint-template.js +7 -7
- package/dist/lib/templates/expanded-endpoint-template.js +3 -3
- package/dist/lib/templates/overview-template.js +2 -2
- package/dist/lib/templates/security-scheme-template.js +2 -2
- package/dist/lib/templates/server-template.js +2 -2
- package/dist/lib/utils/common-utils.js +36 -0
- package/package.json +1 -1
@@ -4,10 +4,10 @@ exports.__esModule = true;
|
|
4
4
|
exports.default = overviewTemplate;
|
5
5
|
var _lit = require("lit");
|
6
6
|
var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
7
|
-
var
|
7
|
+
var _commonUtils = require("../utils/common-utils");
|
8
8
|
var _index = require("../languages/index.js");
|
9
9
|
/* eslint-disable indent */
|
10
10
|
function overviewTemplate() {
|
11
|
-
return (0, _lit.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _lit.html)` <slot name="overview-header"></slot> <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _lit.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _lit.html)`<span>${this.resolvedSpec.info.contact.name || (0, _index.getI18nText)('overview.email')}: <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a> </span>` : ''} ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url ? (0, _lit.html)`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''} ${this.resolvedSpec.info.license ? (0, _lit.html)`<span>License: ${this.resolvedSpec.info.license.url ? (0, _lit.html)`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''} ${this.resolvedSpec.info.termsOfService ? (0, _lit.html)`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">${(0, _index.getI18nText)('overview.terms-of-service')}</a></span>` : ''} </div> </slot> <slot name="overview-body"></slot> <slot name="overview-api-description"> ${this.resolvedSpec.info.description ? (0, _lit.html)`${(0, _unsafeHtml.unsafeHTML)(`<div class="m-markdown regular-font section-padding">${(0,
|
11
|
+
return (0, _lit.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _lit.html)` <slot name="overview-header"></slot> <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _lit.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _lit.html)`<span>${this.resolvedSpec.info.contact.name || (0, _index.getI18nText)('overview.email')}: <a href="mailto:${(0, _commonUtils.getSanitizedEmail)(this.resolvedSpec.info.contact.email)}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a> </span>` : ''} ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url ? (0, _lit.html)`<span>URL: <a href="${(0, _commonUtils.getSanitizedUrl)(this.resolvedSpec.info.contact.url)}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''} ${this.resolvedSpec.info.license ? (0, _lit.html)`<span>License: ${this.resolvedSpec.info.license.url ? (0, _lit.html)`<a href="${(0, _commonUtils.getSanitizedUrl)(this.resolvedSpec.info.license.url)}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''} ${this.resolvedSpec.info.termsOfService ? (0, _lit.html)`<span><a href="${(0, _commonUtils.getSanitizedUrl)(this.resolvedSpec.info.termsOfService)}" part="anchor anchor-overview">${(0, _index.getI18nText)('overview.terms-of-service')}</a></span>` : ''} </div> </slot> <slot name="overview-body"></slot> <slot name="overview-api-description"> ${this.resolvedSpec.info.description ? (0, _lit.html)`${(0, _unsafeHtml.unsafeHTML)(`<div class="m-markdown regular-font section-padding">${(0, _commonUtils.toMarkdown)(this.resolvedSpec.info.description)}</div>`)}` : ''} </slot> <slot name="overview-footer"></slot> ` : ''} </section> `;
|
12
12
|
}
|
13
13
|
/* eslint-enable indent */
|
@@ -6,7 +6,7 @@ exports.default = securitySchemeTemplate;
|
|
6
6
|
exports.pathSecurityTemplate = pathSecurityTemplate;
|
7
7
|
var _lit = require("lit");
|
8
8
|
var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
9
|
-
var
|
9
|
+
var _commonUtils = require("../utils/common-utils");
|
10
10
|
var _base64url = _interopRequireDefault(require("base64url"));
|
11
11
|
var _index = require("../languages/index.js");
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -300,7 +300,7 @@ function securitySchemeTemplate() {
|
|
300
300
|
const providedApiKeys = schemes.filter(v => v.finalKeyValue);
|
301
301
|
return (0, _lit.html)` <section id="auth" part="section-auth" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="authentication"> <div class="section-padding"> <slot name="authentication-header"> <div class="sub-title regular-font">${(0, _index.getI18nText)('headers.authentication')}</div> </slot> <div class="small-font-size" style="display:flex;align-items:center;min-height:40px"> ${providedApiKeys.length > 0 ? (0, _lit.html)` <div class="blue-text"> ${providedApiKeys.length} API key applied </div> <div style="flex:1"></div> <button class="m-btn thin-border" part="btn btn-outline" @click="${() => {
|
302
302
|
onClearAllApiKeys.call(this);
|
303
|
-
}}">CLEAR ALL API KEYS</button>` : (0, _lit.html)`<div class="red-text">${(0, _index.getI18nText)('authentication.no-api-key-applied')}</div>`} </div> ${schemes.length > 0 ? (0, _lit.html)` <table role="presentation" class="m-table" style="width:100%"> ${schemes.map(v => (0, _lit.html)` <tr> <td colspan="1" style="max-width:500px;overflow-wrap:break-word"> <div style="min-height:24px;display:flex;flex-direction:column;justify-content:center;align-items:center"> <div style="display:flex;justify-content:center"> <span style="font-weight:700">${getTypeDisplayHeader(v)}</span> </div> </div> ${v.description ? (0, _lit.html)` <div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0,
|
303
|
+
}}">CLEAR ALL API KEYS</button>` : (0, _lit.html)`<div class="red-text">${(0, _index.getI18nText)('authentication.no-api-key-applied')}</div>`} </div> ${schemes.length > 0 ? (0, _lit.html)` <table role="presentation" class="m-table" style="width:100%"> ${schemes.map(v => (0, _lit.html)` <tr> <td colspan="1" style="max-width:500px;overflow-wrap:break-word"> <div style="min-height:24px;display:flex;flex-direction:column;justify-content:center;align-items:center"> <div style="display:flex;justify-content:center"> <span style="font-weight:700">${getTypeDisplayHeader(v)}</span> </div> </div> ${v.description ? (0, _lit.html)` <div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(v.description || ''))} </div>` : ''} </td> <td colspan="3">${renderSecurityScheme.call(this, v)}</td> </tr>`)} </table>` : ''} <slot name="authentication-footer"></slot> </div> </slot> </section> `;
|
304
304
|
}
|
305
305
|
function getOauthScopeTemplate(rawScopes) {
|
306
306
|
const scopes = Array.isArray(rawScopes) ? rawScopes.map(s => s === null || s === void 0 ? void 0 : s.trim()).filter(s => s) : [];
|
@@ -3,7 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = serverTemplate;
|
5
5
|
var _lit = require("lit");
|
6
|
-
var
|
6
|
+
var _commonUtils = require("../utils/common-utils");
|
7
7
|
var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
8
8
|
var _index = require("../languages/index.js");
|
9
9
|
function onApiServerChange(e, server) {
|
@@ -30,7 +30,7 @@ function serverVarsTemplate() {
|
|
30
30
|
onApiServerVarChange.call(this, e, this.selectedServer);
|
31
31
|
}}"> ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? (0, _lit.html)` <option selected="selected" label="${e[1]}" value="${e[1]}">` : (0, _lit.html)` <option label="${e[1]}" value="${e[1]}">`)} </select>` : (0, _lit.html)` <input type="text" part="textbox textbox-server-var" spellcheck="false" data-var="${kv[0]}" value="${kv[1].default}" @input="${e => {
|
32
32
|
onApiServerVarChange.call(this, e, this.selectedServer);
|
33
|
-
}}">`} </td> </tr> ${kv[1].description ? (0, _lit.html)`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${(0, _unsafeHtml.unsafeHTML)((0,
|
33
|
+
}}">`} </td> </tr> ${kv[1].description ? (0, _lit.html)`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${(0, _unsafeHtml.unsafeHTML)((0, _commonUtils.toMarkdown)(kv[1].description))} </span></td></tr>` : ''} `)} </table> ` : '';
|
34
34
|
}
|
35
35
|
function serverTemplate() {
|
36
36
|
var _this$selectedServer2;
|
@@ -7,10 +7,14 @@ exports.copyToClipboard = copyToClipboard;
|
|
7
7
|
exports.debounce = debounce;
|
8
8
|
exports.getBaseUrlFromUrl = getBaseUrlFromUrl;
|
9
9
|
exports.getCurrentElement = getCurrentElement;
|
10
|
+
exports.getSanitizedEmail = getSanitizedEmail;
|
11
|
+
exports.getSanitizedUrl = getSanitizedUrl;
|
10
12
|
exports.invalidCharsRegEx = void 0;
|
11
13
|
exports.pathIsInSearch = pathIsInSearch;
|
12
14
|
exports.replaceState = replaceState;
|
13
15
|
exports.sleep = sleep;
|
16
|
+
exports.toMarkdown = toMarkdown;
|
17
|
+
var _marked = require("marked");
|
14
18
|
var _index = require("../languages/index.js");
|
15
19
|
/* For Delayed Event Handler Execution */
|
16
20
|
function debounce(fn, delay) {
|
@@ -143,4 +147,36 @@ function replaceState(rawElementId) {
|
|
143
147
|
query.delete('route');
|
144
148
|
const newQuery = query.toString().length > 1 ? `${query.toString()}&route=${elementId}` : `route=${elementId}`;
|
145
149
|
window.history.replaceState(null, null, `#${currentNavigationHashPart}?${newQuery}`);
|
150
|
+
}
|
151
|
+
function toMarkdown(markdownStringRaw) {
|
152
|
+
const sanitizedMarkdownString = (markdownStringRaw || ''
|
153
|
+
// Convert scripts tags to correct markdown format
|
154
|
+
).replace(/[<]script[^>]*>/gi, '<div>```').replace(/[<][/]script/gi, '```</div')
|
155
|
+
// Remove unnecessary attributes from img tag
|
156
|
+
.replace(/onerror=/ig, 'attribute');
|
157
|
+
const markdownResult = (0, _marked.marked)(sanitizedMarkdownString || '');
|
158
|
+
return markdownResult;
|
159
|
+
}
|
160
|
+
function getSanitizedUrl(urlString) {
|
161
|
+
if (!urlString) {
|
162
|
+
return '';
|
163
|
+
}
|
164
|
+
try {
|
165
|
+
// eslint-disable-next-line no-new
|
166
|
+
const url = new URL(urlString);
|
167
|
+
return url.protocol === 'http' || url.protocol === 'https' ? url : '';
|
168
|
+
} catch (error) {
|
169
|
+
return '';
|
170
|
+
}
|
171
|
+
}
|
172
|
+
function getSanitizedEmail(emailRaw) {
|
173
|
+
if (!emailRaw) {
|
174
|
+
return '';
|
175
|
+
}
|
176
|
+
|
177
|
+
// eslint-disable-next-line max-len, no-control-regex
|
178
|
+
if (emailRaw.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)) {
|
179
|
+
return emailRaw;
|
180
|
+
}
|
181
|
+
return '';
|
146
182
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.703",
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
5
5
|
"author": "Authress Developers <developers@authress.io>",
|
6
6
|
"type": "module",
|