docusaurus-theme-openapi-docs 0.0.0-346 → 0.0.0-350
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/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +21 -3
- package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +5 -1
- package/lib/theme/ApiItem/styles.module.css +4 -0
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +26 -3
- package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +5 -1
- package/lib-next/theme/ApiItem/styles.module.css +4 -0
- package/package.json +3 -3
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +26 -3
- package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +5 -1
- package/src/theme/ApiItem/styles.module.css +4 -0
- package/lib/theme/ApiDemoPanel/Authorization/index.js +0 -174
- package/lib/theme/ApiDemoPanel/Execute/index.js +0 -85
- package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +0 -200
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +0 -203
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +0 -73
- package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +0 -181
- package/src/theme/ApiDemoPanel/Authorization/index.tsx +0 -211
- package/src/theme/ApiDemoPanel/Execute/index.tsx +0 -87
- package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +0 -182
- package/yarn-error.log +0 -15035
|
@@ -26,9 +26,13 @@ function SecuritySchemes() {
|
|
|
26
26
|
marginBottom: "var(--ifm-table-cell-padding)"
|
|
27
27
|
}}>
|
|
28
28
|
{selectedAuth.map(auth => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const isApiKey = auth.type === "apiKey";
|
|
30
|
+
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
31
|
+
const isClientCredentials = auth.type === "oauth2" && auth.key === "ClientCredentials";
|
|
32
|
+
|
|
33
|
+
if (isApiKey || isBearer) {
|
|
34
|
+
return <_react.default.Fragment key={selected}>
|
|
35
|
+
<b>Authorization: {auth.key}</b>
|
|
32
36
|
<pre style={{
|
|
33
37
|
display: "flex",
|
|
34
38
|
flexDirection: "column",
|
|
@@ -42,6 +46,20 @@ function SecuritySchemes() {
|
|
|
42
46
|
</_react.default.Fragment>;
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
if (isClientCredentials) {
|
|
50
|
+
return <_react.default.Fragment key={selected}>
|
|
51
|
+
<b>Authorization: {auth.key}</b>
|
|
52
|
+
<pre style={{
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
background: "var(--openapi-card-background-color)",
|
|
56
|
+
borderRadius: "var(--openapi-card-border-radius)"
|
|
57
|
+
}}>
|
|
58
|
+
<span>type: {auth.type}</span>
|
|
59
|
+
</pre>
|
|
60
|
+
</_react.default.Fragment>;
|
|
61
|
+
}
|
|
62
|
+
|
|
45
63
|
return null;
|
|
46
64
|
})}
|
|
47
65
|
</div>;
|
|
@@ -269,6 +269,10 @@ function buildPostmanRequest(postman, {
|
|
|
269
269
|
} = auth.data[a.key];
|
|
270
270
|
|
|
271
271
|
if (token === undefined) {
|
|
272
|
+
otherHeaders.push({
|
|
273
|
+
key: "Authorization",
|
|
274
|
+
value: "Bearer <TOKEN>"
|
|
275
|
+
});
|
|
272
276
|
continue;
|
|
273
277
|
}
|
|
274
278
|
|
|
@@ -306,7 +310,7 @@ function buildPostmanRequest(postman, {
|
|
|
306
310
|
if (apikey === undefined) {
|
|
307
311
|
otherHeaders.push({
|
|
308
312
|
key: a.name,
|
|
309
|
-
value: "API_KEY_VALUE"
|
|
313
|
+
value: "<API_KEY_VALUE>"
|
|
310
314
|
});
|
|
311
315
|
continue;
|
|
312
316
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--openapi-required: var(--ifm-color-danger);
|
|
3
|
+
--openapi-code-blue: var(--ifm-color-info);
|
|
4
|
+
--openapi-code-red: var(--ifm-color-danger);
|
|
5
|
+
--openapi-code-orange: var(--ifm-color-warning);
|
|
6
|
+
--openapi-code-green: var(--ifm-color-success);
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.apiItemContainer article > *:first-child,
|
|
@@ -19,10 +19,15 @@ function SecuritySchemes() {
|
|
|
19
19
|
}}
|
|
20
20
|
>
|
|
21
21
|
{selectedAuth.map((auth) => {
|
|
22
|
-
|
|
22
|
+
const isApiKey = auth.type === "apiKey";
|
|
23
|
+
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
24
|
+
const isClientCredentials =
|
|
25
|
+
auth.type === "oauth2" && auth.key === "ClientCredentials";
|
|
26
|
+
|
|
27
|
+
if (isApiKey || isBearer) {
|
|
23
28
|
return (
|
|
24
|
-
<React.Fragment key={selected
|
|
25
|
-
<b>Authorization: {auth.
|
|
29
|
+
<React.Fragment key={selected}>
|
|
30
|
+
<b>Authorization: {auth.key}</b>
|
|
26
31
|
<pre
|
|
27
32
|
style={{
|
|
28
33
|
display: "flex",
|
|
@@ -39,6 +44,24 @@ function SecuritySchemes() {
|
|
|
39
44
|
);
|
|
40
45
|
}
|
|
41
46
|
|
|
47
|
+
if (isClientCredentials) {
|
|
48
|
+
return (
|
|
49
|
+
<React.Fragment key={selected}>
|
|
50
|
+
<b>Authorization: {auth.key}</b>
|
|
51
|
+
<pre
|
|
52
|
+
style={{
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
background: "var(--openapi-card-background-color)",
|
|
56
|
+
borderRadius: "var(--openapi-card-border-radius)",
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<span>type: {auth.type}</span>
|
|
60
|
+
</pre>
|
|
61
|
+
</React.Fragment>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
42
65
|
return null;
|
|
43
66
|
})}
|
|
44
67
|
</div>
|
|
@@ -251,6 +251,10 @@ function buildPostmanRequest(
|
|
|
251
251
|
const { token } = auth.data[a.key];
|
|
252
252
|
|
|
253
253
|
if (token === undefined) {
|
|
254
|
+
otherHeaders.push({
|
|
255
|
+
key: "Authorization",
|
|
256
|
+
value: "Bearer <TOKEN>",
|
|
257
|
+
});
|
|
254
258
|
continue;
|
|
255
259
|
}
|
|
256
260
|
|
|
@@ -281,7 +285,7 @@ function buildPostmanRequest(
|
|
|
281
285
|
if (apikey === undefined) {
|
|
282
286
|
otherHeaders.push({
|
|
283
287
|
key: a.name,
|
|
284
|
-
value: "API_KEY_VALUE",
|
|
288
|
+
value: "<API_KEY_VALUE>",
|
|
285
289
|
});
|
|
286
290
|
continue;
|
|
287
291
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--openapi-required: var(--ifm-color-danger);
|
|
3
|
+
--openapi-code-blue: var(--ifm-color-info);
|
|
4
|
+
--openapi-code-red: var(--ifm-color-danger);
|
|
5
|
+
--openapi-code-orange: var(--ifm-color-warning);
|
|
6
|
+
--openapi-code-green: var(--ifm-color-success);
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.apiItemContainer article > *:first-child,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-350",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"buffer": "^6.0.3",
|
|
52
52
|
"clsx": "^1.1.1",
|
|
53
53
|
"crypto-js": "^4.1.1",
|
|
54
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
54
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-350",
|
|
55
55
|
"immer": "^9.0.7",
|
|
56
56
|
"lodash": "^4.17.20",
|
|
57
57
|
"monaco-editor": "^0.31.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=14"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "c66039acf120aeef0024c18d5ca0d842f38b32a6"
|
|
74
74
|
}
|
|
@@ -20,10 +20,15 @@ function SecuritySchemes() {
|
|
|
20
20
|
return (
|
|
21
21
|
<div style={{ marginBottom: "var(--ifm-table-cell-padding)" }}>
|
|
22
22
|
{selectedAuth.map((auth) => {
|
|
23
|
-
|
|
23
|
+
const isApiKey = auth.type === "apiKey";
|
|
24
|
+
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
25
|
+
const isClientCredentials =
|
|
26
|
+
auth.type === "oauth2" && auth.key === "ClientCredentials";
|
|
27
|
+
|
|
28
|
+
if (isApiKey || isBearer) {
|
|
24
29
|
return (
|
|
25
|
-
<React.Fragment key={selected
|
|
26
|
-
<b>Authorization: {auth.
|
|
30
|
+
<React.Fragment key={selected}>
|
|
31
|
+
<b>Authorization: {auth.key}</b>
|
|
27
32
|
<pre
|
|
28
33
|
style={{
|
|
29
34
|
display: "flex",
|
|
@@ -40,6 +45,24 @@ function SecuritySchemes() {
|
|
|
40
45
|
);
|
|
41
46
|
}
|
|
42
47
|
|
|
48
|
+
if (isClientCredentials) {
|
|
49
|
+
return (
|
|
50
|
+
<React.Fragment key={selected}>
|
|
51
|
+
<b>Authorization: {auth.key}</b>
|
|
52
|
+
<pre
|
|
53
|
+
style={{
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
background: "var(--openapi-card-background-color)",
|
|
57
|
+
borderRadius: "var(--openapi-card-border-radius)",
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<span>type: {auth.type}</span>
|
|
61
|
+
</pre>
|
|
62
|
+
</React.Fragment>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
43
66
|
return null;
|
|
44
67
|
})}
|
|
45
68
|
</div>
|
|
@@ -248,6 +248,10 @@ function buildPostmanRequest(
|
|
|
248
248
|
if (a.type === "http" && a.scheme === "bearer") {
|
|
249
249
|
const { token } = auth.data[a.key];
|
|
250
250
|
if (token === undefined) {
|
|
251
|
+
otherHeaders.push({
|
|
252
|
+
key: "Authorization",
|
|
253
|
+
value: "Bearer <TOKEN>",
|
|
254
|
+
});
|
|
251
255
|
continue;
|
|
252
256
|
}
|
|
253
257
|
otherHeaders.push({
|
|
@@ -276,7 +280,7 @@ function buildPostmanRequest(
|
|
|
276
280
|
if (apikey === undefined) {
|
|
277
281
|
otherHeaders.push({
|
|
278
282
|
key: a.name,
|
|
279
|
-
value: "API_KEY_VALUE",
|
|
283
|
+
value: "<API_KEY_VALUE>",
|
|
280
284
|
});
|
|
281
285
|
continue;
|
|
282
286
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--openapi-required: var(--ifm-color-danger);
|
|
3
|
+
--openapi-code-blue: var(--ifm-color-info);
|
|
4
|
+
--openapi-code-red: var(--ifm-color-danger);
|
|
5
|
+
--openapi-code-orange: var(--ifm-color-warning);
|
|
6
|
+
--openapi-code-green: var(--ifm-color-success);
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.apiItemContainer article > *:first-child,
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
-
|
|
12
|
-
var _FormItem = _interopRequireDefault(require("../FormItem"));
|
|
13
|
-
|
|
14
|
-
var _FormSelect = _interopRequireDefault(require("../FormSelect"));
|
|
15
|
-
|
|
16
|
-
var _FormTextInput = _interopRequireDefault(require("../FormTextInput"));
|
|
17
|
-
|
|
18
|
-
var _hooks = require("../hooks");
|
|
19
|
-
|
|
20
|
-
var _stylesModule = _interopRequireDefault(require("../styles.module.css"));
|
|
21
|
-
|
|
22
|
-
var _slice = require("./slice");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
|
-
/* ============================================================================
|
|
31
|
-
* Copyright (c) Palo Alto Networks
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
* ========================================================================== */
|
|
36
|
-
function LockButton({
|
|
37
|
-
mode,
|
|
38
|
-
children,
|
|
39
|
-
style,
|
|
40
|
-
...rest
|
|
41
|
-
}) {
|
|
42
|
-
return <button className={(0, _clsx.default)("button", "button--primary", {
|
|
43
|
-
"button--outline": mode !== "locked"
|
|
44
|
-
})} style={{
|
|
45
|
-
marginLeft: "auto",
|
|
46
|
-
display: "flex",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
marginBottom: "var(--ifm-spacing-vertical)",
|
|
49
|
-
...style
|
|
50
|
-
}} {...rest}>
|
|
51
|
-
<span>{children}</span>
|
|
52
|
-
|
|
53
|
-
<svg style={{
|
|
54
|
-
marginLeft: "12px",
|
|
55
|
-
width: "18px",
|
|
56
|
-
height: "18px",
|
|
57
|
-
fill: "currentColor"
|
|
58
|
-
}} viewBox="0 0 20 20" id={mode}>
|
|
59
|
-
{mode === "locked" ? <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"></path> : <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>}
|
|
60
|
-
</svg>
|
|
61
|
-
</button>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function validateData(selectedAuth, data) {
|
|
65
|
-
for (const scheme of selectedAuth) {
|
|
66
|
-
if (data[scheme.key] === undefined) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const hasMissingKeys = Object.values(data[scheme.key]).includes(undefined);
|
|
71
|
-
|
|
72
|
-
if (hasMissingKeys) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function Authorization() {
|
|
81
|
-
const [editing, setEditing] = (0, _react.useState)(false);
|
|
82
|
-
const data = (0, _hooks.useTypedSelector)(state => state.auth.data);
|
|
83
|
-
const options = (0, _hooks.useTypedSelector)(state => state.auth.options);
|
|
84
|
-
const selected = (0, _hooks.useTypedSelector)(state => state.auth.selected);
|
|
85
|
-
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
86
|
-
|
|
87
|
-
if (selected === undefined) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const selectedAuth = options[selected];
|
|
92
|
-
const authenticated = validateData(selectedAuth, data);
|
|
93
|
-
const optionKeys = Object.keys(options);
|
|
94
|
-
|
|
95
|
-
if (editing) {
|
|
96
|
-
return <div className={_stylesModule.default.optionsPanel}>
|
|
97
|
-
{optionKeys.length > 1 && <_FormItem.default label="Security Scheme">
|
|
98
|
-
<_FormSelect.default options={optionKeys} value={selected} onChange={e => {
|
|
99
|
-
dispatch((0, _slice.setSelectedAuth)(e.target.value));
|
|
100
|
-
}} />
|
|
101
|
-
</_FormItem.default>}
|
|
102
|
-
{selectedAuth.map(a => {
|
|
103
|
-
if (a.type === "http" && a.scheme === "bearer") {
|
|
104
|
-
var _data$a$key$token;
|
|
105
|
-
|
|
106
|
-
return <_FormItem.default label="Bearer Token" key={selected + "-bearer"}>
|
|
107
|
-
<_FormTextInput.default placeholder="Bearer Token" value={(_data$a$key$token = data[a.key].token) !== null && _data$a$key$token !== void 0 ? _data$a$key$token : ""} onChange={e => {
|
|
108
|
-
const value = e.target.value.trim();
|
|
109
|
-
dispatch((0, _slice.setAuthData)({
|
|
110
|
-
scheme: a.key,
|
|
111
|
-
key: "token",
|
|
112
|
-
value: value ? value : undefined
|
|
113
|
-
}));
|
|
114
|
-
}} />
|
|
115
|
-
</_FormItem.default>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (a.type === "http" && a.scheme === "basic") {
|
|
119
|
-
var _data$a$key$username, _data$a$key$password;
|
|
120
|
-
|
|
121
|
-
return <_react.default.Fragment key={selected + "-basic"}>
|
|
122
|
-
<_FormItem.default label="Username">
|
|
123
|
-
<_FormTextInput.default placeholder="Username" value={(_data$a$key$username = data[a.key].username) !== null && _data$a$key$username !== void 0 ? _data$a$key$username : ""} onChange={e => {
|
|
124
|
-
const value = e.target.value.trim();
|
|
125
|
-
dispatch((0, _slice.setAuthData)({
|
|
126
|
-
scheme: a.key,
|
|
127
|
-
key: "username",
|
|
128
|
-
value: value ? value : undefined
|
|
129
|
-
}));
|
|
130
|
-
}} />
|
|
131
|
-
</_FormItem.default>
|
|
132
|
-
<_FormItem.default label="Password">
|
|
133
|
-
<_FormTextInput.default placeholder="Password" password value={(_data$a$key$password = data[a.key].password) !== null && _data$a$key$password !== void 0 ? _data$a$key$password : ""} onChange={e => {
|
|
134
|
-
const value = e.target.value.trim();
|
|
135
|
-
dispatch((0, _slice.setAuthData)({
|
|
136
|
-
scheme: a.key,
|
|
137
|
-
key: "password",
|
|
138
|
-
value: value ? value : undefined
|
|
139
|
-
}));
|
|
140
|
-
}} />
|
|
141
|
-
</_FormItem.default>
|
|
142
|
-
</_react.default.Fragment>;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return null;
|
|
146
|
-
})}
|
|
147
|
-
<LockButton mode="unlocked" style={{
|
|
148
|
-
marginTop: "var(--ifm-spacing-vertical)",
|
|
149
|
-
marginBottom: 0
|
|
150
|
-
}} onClick={() => {
|
|
151
|
-
setEditing(false);
|
|
152
|
-
}}>
|
|
153
|
-
Save
|
|
154
|
-
</LockButton>
|
|
155
|
-
</div>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (authenticated) {
|
|
159
|
-
return <LockButton mode="locked" onClick={() => {
|
|
160
|
-
setEditing(true);
|
|
161
|
-
}}>
|
|
162
|
-
Authorized
|
|
163
|
-
</LockButton>;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return <LockButton mode="unlocked" onClick={() => {
|
|
167
|
-
setEditing(true);
|
|
168
|
-
}}>
|
|
169
|
-
Authorize
|
|
170
|
-
</LockButton>;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var _default = Authorization;
|
|
174
|
-
exports.default = _default;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _hooks = require("../hooks");
|
|
11
|
-
|
|
12
|
-
var _slice = require("../Response/slice");
|
|
13
|
-
|
|
14
|
-
var _buildPostmanRequest = _interopRequireDefault(require("./../buildPostmanRequest"));
|
|
15
|
-
|
|
16
|
-
var _makeRequest = _interopRequireDefault(require("./makeRequest"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
/* ============================================================================
|
|
21
|
-
* Copyright (c) Palo Alto Networks
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
* ========================================================================== */
|
|
26
|
-
function validateRequest(params) {
|
|
27
|
-
for (let paramList of Object.values(params)) {
|
|
28
|
-
for (let param of paramList) {
|
|
29
|
-
if (param.required && !param.value) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function Execute({
|
|
39
|
-
postman,
|
|
40
|
-
proxy
|
|
41
|
-
}) {
|
|
42
|
-
const pathParams = (0, _hooks.useTypedSelector)(state => state.params.path);
|
|
43
|
-
const queryParams = (0, _hooks.useTypedSelector)(state => state.params.query);
|
|
44
|
-
const cookieParams = (0, _hooks.useTypedSelector)(state => state.params.cookie);
|
|
45
|
-
const headerParams = (0, _hooks.useTypedSelector)(state => state.params.header);
|
|
46
|
-
const contentType = (0, _hooks.useTypedSelector)(state => state.contentType.value);
|
|
47
|
-
const body = (0, _hooks.useTypedSelector)(state => state.body);
|
|
48
|
-
const accept = (0, _hooks.useTypedSelector)(state => state.accept.value);
|
|
49
|
-
const server = (0, _hooks.useTypedSelector)(state => state.server.value);
|
|
50
|
-
const params = (0, _hooks.useTypedSelector)(state => state.params);
|
|
51
|
-
const auth = (0, _hooks.useTypedSelector)(state => state.auth);
|
|
52
|
-
const isValidRequest = validateRequest(params);
|
|
53
|
-
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
54
|
-
const postmanRequest = (0, _buildPostmanRequest.default)(postman, {
|
|
55
|
-
queryParams,
|
|
56
|
-
pathParams,
|
|
57
|
-
cookieParams,
|
|
58
|
-
contentType,
|
|
59
|
-
accept,
|
|
60
|
-
headerParams,
|
|
61
|
-
body,
|
|
62
|
-
server,
|
|
63
|
-
auth
|
|
64
|
-
});
|
|
65
|
-
return <button className="button button--block button--primary" style={{
|
|
66
|
-
height: "48px",
|
|
67
|
-
marginBottom: "var(--ifm-spacing-vertical)"
|
|
68
|
-
}} disabled={!isValidRequest} onClick={async () => {
|
|
69
|
-
dispatch((0, _slice.setResponse)("loading..."));
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
const res = await (0, _makeRequest.default)(postmanRequest, proxy, body);
|
|
73
|
-
dispatch((0, _slice.setResponse)(res));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
var _e$message;
|
|
76
|
-
|
|
77
|
-
dispatch((0, _slice.setResponse)((_e$message = e.message) !== null && _e$message !== void 0 ? _e$message : "Error fetching."));
|
|
78
|
-
}
|
|
79
|
-
}}>
|
|
80
|
-
Execute
|
|
81
|
-
</button>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var _default = Execute;
|
|
85
|
-
exports.default = _default;
|