docusaurus-theme-openapi-docs 1.4.2 → 1.4.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/lib/index.js +5 -8
- package/lib/markdown/createDescription.js +1 -2
- package/lib/markdown/schema.js +7 -42
- package/lib/markdown/utils.js +1 -7
- package/lib/theme/ApiDemoPanel/Accept/index.js +1 -10
- package/lib/theme/ApiDemoPanel/Accept/slice.js +1 -2
- package/lib/theme/ApiDemoPanel/Authorization/auth-types.js +7 -8
- package/lib/theme/ApiDemoPanel/Authorization/index.js +1 -19
- package/lib/theme/ApiDemoPanel/Authorization/slice.js +7 -21
- package/lib/theme/ApiDemoPanel/Body/index.js +14 -47
- package/lib/theme/ApiDemoPanel/Body/slice.js +1 -4
- package/lib/theme/ApiDemoPanel/CodeTabs/index.js +14 -46
- package/lib/theme/ApiDemoPanel/ContentType/index.js +1 -10
- package/lib/theme/ApiDemoPanel/ContentType/slice.js +1 -2
- package/lib/theme/ApiDemoPanel/Curl/index.js +9 -29
- package/lib/theme/ApiDemoPanel/Execute/index.js +6 -23
- package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +4 -27
- package/lib/theme/ApiDemoPanel/Export/index.js +1 -8
- package/lib/theme/ApiDemoPanel/FloatingButton/index.js +1 -5
- package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +1 -14
- package/lib/theme/ApiDemoPanel/FormItem/index.js +1 -5
- package/lib/theme/ApiDemoPanel/FormMultiSelect/index.js +1 -8
- package/lib/theme/ApiDemoPanel/FormSelect/index.js +1 -6
- package/lib/theme/ApiDemoPanel/FormTextInput/index.js +1 -6
- package/lib/theme/ApiDemoPanel/LiveEditor/index.js +3 -17
- package/lib/theme/ApiDemoPanel/MethodEndpoint/index.js +1 -12
- package/lib/theme/ApiDemoPanel/ParamOptions/index.js +20 -52
- package/lib/theme/ApiDemoPanel/ParamOptions/slice.js +1 -2
- package/lib/theme/ApiDemoPanel/Request/index.js +1 -15
- package/lib/theme/ApiDemoPanel/Response/index.js +1 -14
- package/lib/theme/ApiDemoPanel/Response/slice.js +1 -2
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -9
- package/lib/theme/ApiDemoPanel/Server/index.js +3 -27
- package/lib/theme/ApiDemoPanel/Server/slice.js +1 -3
- package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +11 -62
- package/lib/theme/ApiDemoPanel/index.js +2 -14
- package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +5 -11
- package/lib/theme/ApiDemoPanel/storage-utils.js +1 -7
- package/lib/theme/ApiItem/Layout/index.js +5 -22
- package/lib/theme/ApiItem/Layout/styles.module.css +0 -403
- package/lib/theme/ApiItem/hooks.js +1 -3
- package/lib/theme/ApiItem/index.js +14 -30
- package/lib/theme/ApiItem/store.js +1 -14
- package/lib/theme/ApiLogo/index.js +1 -4
- package/lib/theme/styles.css +428 -0
- package/lib/theme-classic.d.ts +5 -0
- package/lib-next/index.js +5 -3
- package/lib-next/markdown/createDescription.js +1 -1
- package/lib-next/markdown/schema.js +7 -35
- package/lib-next/markdown/utils.js +1 -4
- package/lib-next/theme/ApiDemoPanel/Accept/index.js +1 -4
- package/lib-next/theme/ApiDemoPanel/Accept/slice.js +1 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +7 -4
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +1 -8
- package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +12 -14
- package/lib-next/theme/ApiDemoPanel/Body/index.js +16 -34
- package/lib-next/theme/ApiDemoPanel/Body/slice.js +1 -2
- package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +12 -26
- package/lib-next/theme/ApiDemoPanel/ContentType/index.js +1 -4
- package/lib-next/theme/ApiDemoPanel/ContentType/slice.js +1 -0
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +11 -12
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +10 -13
- package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +4 -22
- package/lib-next/theme/ApiDemoPanel/Export/index.js +1 -5
- package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +1 -2
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +1 -7
- package/lib-next/theme/ApiDemoPanel/FormItem/index.js +1 -2
- package/lib-next/theme/ApiDemoPanel/FormMultiSelect/index.js +1 -5
- package/lib-next/theme/ApiDemoPanel/FormSelect/index.js +1 -3
- package/lib-next/theme/ApiDemoPanel/FormTextInput/index.js +1 -2
- package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +3 -6
- package/lib-next/theme/ApiDemoPanel/MethodEndpoint/index.js +1 -9
- package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +34 -29
- package/lib-next/theme/ApiDemoPanel/ParamOptions/slice.js +1 -0
- package/lib-next/theme/ApiDemoPanel/Request/index.js +1 -2
- package/lib-next/theme/ApiDemoPanel/Response/index.js +3 -9
- package/lib-next/theme/ApiDemoPanel/Response/slice.js +1 -0
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -5
- package/lib-next/theme/ApiDemoPanel/Server/index.js +3 -13
- package/lib-next/theme/ApiDemoPanel/Server/slice.js +1 -0
- package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +12 -49
- package/lib-next/theme/ApiDemoPanel/index.js +2 -4
- package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +5 -6
- package/lib-next/theme/ApiDemoPanel/storage-utils.js +1 -3
- package/lib-next/theme/ApiItem/Layout/index.js +8 -9
- package/lib-next/theme/ApiItem/Layout/styles.module.css +0 -403
- package/lib-next/theme/ApiItem/hooks.js +1 -0
- package/lib-next/theme/ApiItem/index.js +14 -13
- package/lib-next/theme/ApiItem/store.js +1 -0
- package/lib-next/theme/ApiLogo/index.js +1 -0
- package/lib-next/theme/styles.css +428 -0
- package/lib-next/theme-classic.d.ts +5 -0
- package/package.json +5 -5
- package/src/index.ts +5 -0
- package/src/theme/ApiDemoPanel/Execute/index.tsx +1 -0
- package/src/theme/ApiDemoPanel/index.tsx +1 -2
- package/src/theme/ApiItem/Layout/index.tsx +5 -6
- package/src/theme/ApiItem/Layout/styles.module.css +0 -403
- package/src/theme/ApiItem/index.tsx +5 -4
- package/src/theme/styles.css +428 -0
- package/src/theme-classic.d.ts +5 -0
- package/lib/theme/ApiDemoPanel/styles.module.css +0 -44
- package/lib/theme/ApiItem/Content/index.js +0 -65
- package/lib/theme/ApiItem/Footer/index.js +0 -78
- package/lib/theme/ApiItem/Footer/styles.module.css +0 -18
- package/lib/theme/ApiItem/Metadata/index.js +0 -32
- package/lib/theme/ApiItem/Paginator/index.js +0 -33
- package/lib/theme/ApiItem/TOC/Desktop/index.js +0 -31
- package/lib/theme/ApiItem/TOC/Mobile/index.js +0 -35
- package/lib/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
- package/lib-next/theme/ApiDemoPanel/styles.module.css +0 -44
- package/lib-next/theme/ApiItem/Content/index.js +0 -55
- package/lib-next/theme/ApiItem/Footer/index.js +0 -88
- package/lib-next/theme/ApiItem/Footer/styles.module.css +0 -18
- package/lib-next/theme/ApiItem/Metadata/index.js +0 -21
- package/lib-next/theme/ApiItem/Paginator/index.js +0 -19
- package/lib-next/theme/ApiItem/TOC/Desktop/index.js +0 -22
- package/lib-next/theme/ApiItem/TOC/Mobile/index.js +0 -24
- package/lib-next/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
- package/src/theme/ApiDemoPanel/styles.module.css +0 -44
- package/src/theme/ApiItem/Content/index.tsx +0 -57
- package/src/theme/ApiItem/Footer/index.tsx +0 -101
- package/src/theme/ApiItem/Footer/styles.module.css +0 -18
- package/src/theme/ApiItem/Metadata/index.tsx +0 -24
- package/src/theme/ApiItem/Paginator/index.tsx +0 -21
- package/src/theme/ApiItem/TOC/Desktop/index.tsx +0 -25
- package/src/theme/ApiItem/TOC/Mobile/index.tsx +0 -28
- package/src/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
|
@@ -4,63 +4,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _toolkit = require("@reduxjs/toolkit");
|
|
11
|
-
|
|
12
9
|
var _hooks = require("../../ApiItem/hooks");
|
|
13
|
-
|
|
14
10
|
var _FormItem = _interopRequireDefault(require("./../FormItem"));
|
|
15
|
-
|
|
16
11
|
var _FormMultiSelect = _interopRequireDefault(require("./../FormMultiSelect"));
|
|
17
|
-
|
|
18
12
|
var _FormSelect = _interopRequireDefault(require("./../FormSelect"));
|
|
19
|
-
|
|
20
13
|
var _FormTextInput = _interopRequireDefault(require("./../FormTextInput"));
|
|
21
|
-
|
|
22
14
|
var _slice = require("./slice");
|
|
23
|
-
|
|
24
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
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); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
/* ============================================================================
|
|
33
20
|
* Copyright (c) Palo Alto Networks
|
|
34
21
|
*
|
|
35
22
|
* This source code is licensed under the MIT license found in the
|
|
36
23
|
* LICENSE file in the root directory of this source tree.
|
|
37
24
|
* ========================================================================== */
|
|
25
|
+
|
|
38
26
|
function ParamOption({
|
|
39
27
|
param
|
|
40
28
|
}) {
|
|
41
29
|
var _param$schema, _param$schema$items, _param$schema2, _param$schema3, _param$schema4;
|
|
42
|
-
|
|
43
30
|
if (((_param$schema = param.schema) === null || _param$schema === void 0 ? void 0 : _param$schema.type) === "array" && (_param$schema$items = param.schema.items) !== null && _param$schema$items !== void 0 && _param$schema$items.enum) {
|
|
44
31
|
return <ParamMultiSelectFormItem param={param} />;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
33
|
if (((_param$schema2 = param.schema) === null || _param$schema2 === void 0 ? void 0 : _param$schema2.type) === "array") {
|
|
48
34
|
return <ParamArrayFormItem param={param} />;
|
|
49
35
|
}
|
|
50
|
-
|
|
51
36
|
if ((_param$schema3 = param.schema) !== null && _param$schema3 !== void 0 && _param$schema3.enum) {
|
|
52
37
|
return <ParamSelectFormItem param={param} />;
|
|
53
38
|
}
|
|
54
|
-
|
|
55
39
|
if (((_param$schema4 = param.schema) === null || _param$schema4 === void 0 ? void 0 : _param$schema4.type) === "boolean") {
|
|
56
40
|
return <ParamBooleanFormItem param={param} />;
|
|
57
|
-
}
|
|
58
|
-
// date-time, date, password
|
|
59
|
-
|
|
41
|
+
}
|
|
60
42
|
|
|
43
|
+
// integer, number, string, int32, int64, float, double, object, byte, binary,
|
|
44
|
+
// date-time, date, password
|
|
61
45
|
return <ParamTextFormItem param={param} />;
|
|
62
46
|
}
|
|
63
|
-
|
|
64
47
|
function ParamOptionWrapper({
|
|
65
48
|
param
|
|
66
49
|
}) {
|
|
@@ -68,7 +51,6 @@ function ParamOptionWrapper({
|
|
|
68
51
|
<ParamOption param={param} />
|
|
69
52
|
</_FormItem.default>;
|
|
70
53
|
}
|
|
71
|
-
|
|
72
54
|
function ParamOptions() {
|
|
73
55
|
const [showOptional, setShowOptional] = (0, _react.useState)(false);
|
|
74
56
|
const pathParams = (0, _hooks.useTypedSelector)(state => state.params.path);
|
|
@@ -79,14 +61,10 @@ function ParamOptions() {
|
|
|
79
61
|
const requiredParams = allParams.filter(p => p.required);
|
|
80
62
|
const optionalParams = allParams.filter(p => !p.required);
|
|
81
63
|
return <>
|
|
82
|
-
{
|
|
83
|
-
/* Required Parameters */
|
|
84
|
-
}
|
|
64
|
+
{/* Required Parameters */}
|
|
85
65
|
{requiredParams.map(param => <ParamOptionWrapper key={`${param.in}-${param.name}`} param={param} />)}
|
|
86
66
|
|
|
87
|
-
{
|
|
88
|
-
/* Optional Parameters */
|
|
89
|
-
}
|
|
67
|
+
{/* Optional Parameters */}
|
|
90
68
|
{optionalParams.length > 0 && <>
|
|
91
69
|
<button className={_stylesModule.default.showMoreButton} onClick={() => setShowOptional(prev => !prev)}>
|
|
92
70
|
<span style={{
|
|
@@ -115,66 +93,59 @@ function ParamOptions() {
|
|
|
115
93
|
</>}
|
|
116
94
|
</>;
|
|
117
95
|
}
|
|
118
|
-
|
|
119
96
|
function ArrayItem({
|
|
120
97
|
param,
|
|
121
98
|
onChange
|
|
122
99
|
}) {
|
|
123
100
|
var _param$schema5, _param$schema5$items;
|
|
124
|
-
|
|
125
101
|
if (((_param$schema5 = param.schema) === null || _param$schema5 === void 0 ? void 0 : (_param$schema5$items = _param$schema5.items) === null || _param$schema5$items === void 0 ? void 0 : _param$schema5$items.type) === "boolean") {
|
|
126
102
|
return <_FormSelect.default options={["---", "true", "false"]} onChange={e => {
|
|
127
103
|
const val = e.target.value;
|
|
128
104
|
onChange(val === "---" ? undefined : val);
|
|
129
105
|
}} />;
|
|
130
106
|
}
|
|
131
|
-
|
|
132
107
|
return <_FormTextInput.default placeholder={param.description || param.name} onChange={e => {
|
|
133
108
|
onChange(e.target.value);
|
|
134
109
|
}} />;
|
|
135
110
|
}
|
|
136
|
-
|
|
137
111
|
function ParamArrayFormItem({
|
|
138
112
|
param
|
|
139
113
|
}) {
|
|
140
114
|
const [items, setItems] = (0, _react.useState)([]);
|
|
141
115
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
142
|
-
|
|
143
116
|
function handleAddItem() {
|
|
144
117
|
setItems(i => [...i, {
|
|
145
118
|
id: (0, _toolkit.nanoid)()
|
|
146
119
|
}]);
|
|
147
120
|
}
|
|
148
|
-
|
|
149
121
|
(0, _react.useEffect)(() => {
|
|
150
122
|
const values = items.map(item => item.value).filter(item => !!item);
|
|
151
|
-
dispatch((0, _slice.setParam)({
|
|
123
|
+
dispatch((0, _slice.setParam)({
|
|
124
|
+
...param,
|
|
152
125
|
value: values.length > 0 ? values : undefined
|
|
153
|
-
}));
|
|
126
|
+
}));
|
|
127
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
154
128
|
}, [items]);
|
|
155
|
-
|
|
156
129
|
function handleDeleteItem(itemToDelete) {
|
|
157
130
|
return () => {
|
|
158
131
|
const newItems = items.filter(i => i.id !== itemToDelete.id);
|
|
159
132
|
setItems(newItems);
|
|
160
133
|
};
|
|
161
134
|
}
|
|
162
|
-
|
|
163
135
|
function handleChangeItem(itemToUpdate) {
|
|
164
136
|
return value => {
|
|
165
137
|
const newItems = items.map(i => {
|
|
166
138
|
if (i.id === itemToUpdate.id) {
|
|
167
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
...i,
|
|
168
141
|
value: value
|
|
169
142
|
};
|
|
170
143
|
}
|
|
171
|
-
|
|
172
144
|
return i;
|
|
173
145
|
});
|
|
174
146
|
setItems(newItems);
|
|
175
147
|
};
|
|
176
148
|
}
|
|
177
|
-
|
|
178
149
|
return <>
|
|
179
150
|
{items.map(item => <div key={item.id} style={{
|
|
180
151
|
display: "flex"
|
|
@@ -192,57 +163,54 @@ function ParamArrayFormItem({
|
|
|
192
163
|
</button>
|
|
193
164
|
</>;
|
|
194
165
|
}
|
|
195
|
-
|
|
196
166
|
function ParamSelectFormItem({
|
|
197
167
|
param
|
|
198
168
|
}) {
|
|
199
169
|
var _param$schema$enum, _param$schema6;
|
|
200
|
-
|
|
201
170
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
202
171
|
const options = (_param$schema$enum = (_param$schema6 = param.schema) === null || _param$schema6 === void 0 ? void 0 : _param$schema6.enum) !== null && _param$schema$enum !== void 0 ? _param$schema$enum : [];
|
|
203
172
|
return <_FormSelect.default options={["---", ...options]} onChange={e => {
|
|
204
173
|
const val = e.target.value;
|
|
205
|
-
dispatch((0, _slice.setParam)({
|
|
174
|
+
dispatch((0, _slice.setParam)({
|
|
175
|
+
...param,
|
|
206
176
|
value: val === "---" ? undefined : val
|
|
207
177
|
}));
|
|
208
178
|
}} />;
|
|
209
179
|
}
|
|
210
|
-
|
|
211
180
|
function ParamBooleanFormItem({
|
|
212
181
|
param
|
|
213
182
|
}) {
|
|
214
183
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
215
184
|
return <_FormSelect.default options={["---", "true", "false"]} onChange={e => {
|
|
216
185
|
const val = e.target.value;
|
|
217
|
-
dispatch((0, _slice.setParam)({
|
|
186
|
+
dispatch((0, _slice.setParam)({
|
|
187
|
+
...param,
|
|
218
188
|
value: val === "---" ? undefined : val
|
|
219
189
|
}));
|
|
220
190
|
}} />;
|
|
221
191
|
}
|
|
222
|
-
|
|
223
192
|
function ParamMultiSelectFormItem({
|
|
224
193
|
param
|
|
225
194
|
}) {
|
|
226
195
|
var _param$schema$items$e, _param$schema7, _param$schema7$items;
|
|
227
|
-
|
|
228
196
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
229
197
|
const options = (_param$schema$items$e = (_param$schema7 = param.schema) === null || _param$schema7 === void 0 ? void 0 : (_param$schema7$items = _param$schema7.items) === null || _param$schema7$items === void 0 ? void 0 : _param$schema7$items.enum) !== null && _param$schema$items$e !== void 0 ? _param$schema$items$e : [];
|
|
230
198
|
return <_FormMultiSelect.default options={options} onChange={e => {
|
|
231
199
|
const values = Array.prototype.filter.call(e.target.options, o => o.selected).map(o => o.value);
|
|
232
|
-
dispatch((0, _slice.setParam)({
|
|
200
|
+
dispatch((0, _slice.setParam)({
|
|
201
|
+
...param,
|
|
233
202
|
value: values.length > 0 ? values : undefined
|
|
234
203
|
}));
|
|
235
204
|
}} />;
|
|
236
205
|
}
|
|
237
|
-
|
|
238
206
|
function ParamTextFormItem({
|
|
239
207
|
param
|
|
240
208
|
}) {
|
|
241
209
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
242
|
-
return <_FormTextInput.default placeholder={param.description || param.name} onChange={e => dispatch((0, _slice.setParam)({
|
|
210
|
+
return <_FormTextInput.default placeholder={param.description || param.name} onChange={e => dispatch((0, _slice.setParam)({
|
|
211
|
+
...param,
|
|
243
212
|
value: e.target.value
|
|
244
213
|
}))} />;
|
|
245
214
|
}
|
|
246
|
-
|
|
247
215
|
var _default = ParamOptions;
|
|
248
216
|
exports.default = _default;
|
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.slice = exports.setParam = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
/* ============================================================================
|
|
11
9
|
* Copyright (c) Palo Alto Networks
|
|
12
10
|
*
|
|
13
11
|
* This source code is licensed under the MIT license found in the
|
|
14
12
|
* LICENSE file in the root directory of this source tree.
|
|
15
13
|
* ========================================================================== */
|
|
14
|
+
|
|
16
15
|
const initialState = {};
|
|
17
16
|
const slice = (0, _toolkit.createSlice)({
|
|
18
17
|
name: "params",
|
|
@@ -4,42 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _useDocusaurusContext = _interopRequireDefault(require("@docusaurus/useDocusaurusContext"));
|
|
11
|
-
|
|
12
9
|
var _postmanCollection = _interopRequireDefault(require("@paloaltonetworks/postman-collection"));
|
|
13
|
-
|
|
14
10
|
var _hooks = require("../../ApiItem/hooks");
|
|
15
|
-
|
|
16
11
|
var _Accept = _interopRequireDefault(require("../Accept"));
|
|
17
|
-
|
|
18
12
|
var _Authorization = _interopRequireDefault(require("../Authorization"));
|
|
19
|
-
|
|
20
13
|
var _Body = _interopRequireDefault(require("../Body"));
|
|
21
|
-
|
|
22
14
|
var _Execute = _interopRequireDefault(require("../Execute"));
|
|
23
|
-
|
|
24
15
|
var _ParamOptions = _interopRequireDefault(require("../ParamOptions"));
|
|
25
|
-
|
|
26
16
|
var _Server = _interopRequireDefault(require("../Server"));
|
|
27
|
-
|
|
28
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
19
|
/* ============================================================================
|
|
33
20
|
* Copyright (c) Palo Alto Networks
|
|
34
21
|
*
|
|
35
22
|
* This source code is licensed under the MIT license found in the
|
|
36
23
|
* LICENSE file in the root directory of this source tree.
|
|
37
24
|
* ========================================================================== */
|
|
25
|
+
|
|
38
26
|
function Request({
|
|
39
27
|
item
|
|
40
28
|
}) {
|
|
41
29
|
var _item$parameters;
|
|
42
|
-
|
|
43
30
|
const response = (0, _hooks.useTypedSelector)(state => state.response.value);
|
|
44
31
|
const {
|
|
45
32
|
siteConfig
|
|
@@ -76,6 +63,5 @@ function Request({
|
|
|
76
63
|
</details>
|
|
77
64
|
</div>;
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
var _default = Request;
|
|
81
67
|
exports.default = _default;
|
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _CodeBlock = _interopRequireDefault(require("@theme/CodeBlock"));
|
|
11
|
-
|
|
12
9
|
var _hooks = require("../../ApiItem/hooks");
|
|
13
|
-
|
|
14
10
|
var _slice = require("./slice");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
/* ============================================================================
|
|
19
13
|
* Copyright (c) Palo Alto Networks
|
|
20
14
|
*
|
|
21
15
|
* This source code is licensed under the MIT license found in the
|
|
22
16
|
* LICENSE file in the root directory of this source tree.
|
|
23
17
|
* ========================================================================== */
|
|
18
|
+
|
|
24
19
|
// TODO: We probably shouldn't attempt to format XML...
|
|
25
20
|
function formatXml(xml) {
|
|
26
21
|
const tab = " ";
|
|
@@ -31,9 +26,7 @@ function formatXml(xml) {
|
|
|
31
26
|
// decrease indent by one 'tab'
|
|
32
27
|
indent = indent.substring(tab.length);
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
formatted += indent + "<" + node + ">\r\n";
|
|
36
|
-
|
|
37
30
|
if (node.match(/^<?\w[^>]*[^/]$/)) {
|
|
38
31
|
// increase indent
|
|
39
32
|
indent += tab;
|
|
@@ -41,17 +34,13 @@ function formatXml(xml) {
|
|
|
41
34
|
});
|
|
42
35
|
return formatted.substring(1, formatted.length - 3);
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
function Response() {
|
|
46
38
|
const response = (0, _hooks.useTypedSelector)(state => state.response.value);
|
|
47
39
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
48
|
-
|
|
49
40
|
if (response === undefined) {
|
|
50
41
|
return null;
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
let prettyResponse = response;
|
|
54
|
-
|
|
55
44
|
try {
|
|
56
45
|
prettyResponse = JSON.stringify(JSON.parse(response), null, 2);
|
|
57
46
|
} catch {
|
|
@@ -59,7 +48,6 @@ function Response() {
|
|
|
59
48
|
prettyResponse = formatXml(response);
|
|
60
49
|
}
|
|
61
50
|
}
|
|
62
|
-
|
|
63
51
|
return <details className={`details__demo-panel`} open={true}>
|
|
64
52
|
<summary>
|
|
65
53
|
<div className={`details__response-summary`}>
|
|
@@ -74,6 +62,5 @@ function Response() {
|
|
|
74
62
|
</_CodeBlock.default>
|
|
75
63
|
</details>;
|
|
76
64
|
}
|
|
77
|
-
|
|
78
65
|
var _default = Response;
|
|
79
66
|
exports.default = _default;
|
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.slice = exports.setResponse = exports.default = exports.clearResponse = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
/* ============================================================================
|
|
11
9
|
* Copyright (c) Palo Alto Networks
|
|
12
10
|
*
|
|
13
11
|
* This source code is licensed under the MIT license found in the
|
|
14
12
|
* LICENSE file in the root directory of this source tree.
|
|
15
13
|
* ========================================================================== */
|
|
14
|
+
|
|
16
15
|
const initialState = {};
|
|
17
16
|
const slice = (0, _toolkit.createSlice)({
|
|
18
17
|
name: "response",
|
|
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Link = _interopRequireDefault(require("@docusaurus/Link"));
|
|
11
|
-
|
|
12
9
|
var _hooks = require("../../ApiItem/hooks");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
/* ============================================================================
|
|
17
12
|
* Copyright (c) Palo Alto Networks
|
|
18
13
|
*
|
|
19
14
|
* This source code is licensed under the MIT license found in the
|
|
20
15
|
* LICENSE file in the root directory of this source tree.
|
|
21
16
|
* ========================================================================== */
|
|
17
|
+
|
|
22
18
|
function SecuritySchemes(props) {
|
|
23
19
|
const options = (0, _hooks.useTypedSelector)(state => state.auth.options);
|
|
24
20
|
const selected = (0, _hooks.useTypedSelector)(state => state.auth.selected);
|
|
@@ -33,7 +29,6 @@ function SecuritySchemes(props) {
|
|
|
33
29
|
const isApiKey = auth.type === "apiKey";
|
|
34
30
|
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
35
31
|
const isOauth2 = auth.type === "oauth2";
|
|
36
|
-
|
|
37
32
|
if (isApiKey || isBearer) {
|
|
38
33
|
return <_react.default.Fragment key={auth.key}>
|
|
39
34
|
<pre style={{
|
|
@@ -49,7 +44,6 @@ function SecuritySchemes(props) {
|
|
|
49
44
|
</pre>
|
|
50
45
|
</_react.default.Fragment>;
|
|
51
46
|
}
|
|
52
|
-
|
|
53
47
|
if (isOauth2) {
|
|
54
48
|
return <_react.default.Fragment key={selected}>
|
|
55
49
|
<pre style={{
|
|
@@ -69,11 +63,9 @@ function SecuritySchemes(props) {
|
|
|
69
63
|
</pre>
|
|
70
64
|
</_react.default.Fragment>;
|
|
71
65
|
}
|
|
72
|
-
|
|
73
66
|
return undefined;
|
|
74
67
|
})}
|
|
75
68
|
</details>;
|
|
76
69
|
}
|
|
77
|
-
|
|
78
70
|
var _default = SecuritySchemes;
|
|
79
71
|
exports.default = _default;
|
|
@@ -4,79 +4,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _hooks = require("../../ApiItem/hooks");
|
|
11
|
-
|
|
12
9
|
var _FloatingButton = _interopRequireDefault(require("../FloatingButton"));
|
|
13
|
-
|
|
14
10
|
var _FormItem = _interopRequireDefault(require("./../FormItem"));
|
|
15
|
-
|
|
16
11
|
var _FormSelect = _interopRequireDefault(require("./../FormSelect"));
|
|
17
|
-
|
|
18
12
|
var _FormTextInput = _interopRequireDefault(require("./../FormTextInput"));
|
|
19
|
-
|
|
20
13
|
var _slice = require("./slice");
|
|
21
|
-
|
|
22
14
|
var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
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
17
|
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
18
|
/* ============================================================================
|
|
31
19
|
* Copyright (c) Palo Alto Networks
|
|
32
20
|
*
|
|
33
21
|
* This source code is licensed under the MIT license found in the
|
|
34
22
|
* LICENSE file in the root directory of this source tree.
|
|
35
23
|
* ========================================================================== */
|
|
24
|
+
|
|
36
25
|
function Server() {
|
|
37
26
|
const [isEditing, setIsEditing] = (0, _react.useState)(false);
|
|
38
27
|
const value = (0, _hooks.useTypedSelector)(state => state.server.value);
|
|
39
28
|
const options = (0, _hooks.useTypedSelector)(state => state.server.options);
|
|
40
29
|
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
41
|
-
|
|
42
30
|
if (options.length <= 0) {
|
|
43
31
|
return null;
|
|
44
32
|
}
|
|
45
|
-
|
|
46
33
|
if (options.length < 1 && (value === null || value === void 0 ? void 0 : value.variables) === undefined) {
|
|
47
34
|
return null;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
if (!value) {
|
|
51
37
|
const defaultOption = options[0];
|
|
52
38
|
dispatch((0, _slice.setServer)(JSON.stringify(defaultOption)));
|
|
53
|
-
}
|
|
54
|
-
|
|
39
|
+
}
|
|
55
40
|
|
|
41
|
+
// Default to first option when existing server state is mismatched
|
|
56
42
|
if (value) {
|
|
57
43
|
const urlExists = options.find(s => s.url === value.url);
|
|
58
|
-
|
|
59
44
|
if (!urlExists) {
|
|
60
45
|
const defaultOption = options[0];
|
|
61
46
|
dispatch((0, _slice.setServer)(JSON.stringify(defaultOption)));
|
|
62
47
|
}
|
|
63
48
|
}
|
|
64
|
-
|
|
65
49
|
if (!isEditing) {
|
|
66
50
|
let url = "";
|
|
67
|
-
|
|
68
51
|
if (value) {
|
|
69
52
|
url = value.url.replace(/\/$/, "");
|
|
70
|
-
|
|
71
53
|
if (value.variables) {
|
|
72
54
|
Object.keys(value.variables).forEach(variable => {
|
|
73
55
|
var _value$variables$vari, _value$variables;
|
|
74
|
-
|
|
75
56
|
url = url.replace(`{${variable}}`, (_value$variables$vari = (_value$variables = value.variables) === null || _value$variables === void 0 ? void 0 : _value$variables[variable].default) !== null && _value$variables$vari !== void 0 ? _value$variables$vari : "");
|
|
76
57
|
});
|
|
77
58
|
}
|
|
78
59
|
}
|
|
79
|
-
|
|
80
60
|
return <_FloatingButton.default onClick={() => setIsEditing(true)} label="Edit">
|
|
81
61
|
<_FormItem.default label="Base URL">
|
|
82
62
|
<pre style={{
|
|
@@ -88,7 +68,6 @@ function Server() {
|
|
|
88
68
|
</_FormItem.default>
|
|
89
69
|
</_FloatingButton.default>;
|
|
90
70
|
}
|
|
91
|
-
|
|
92
71
|
return <div className={_stylesModule.default.optionsPanel}>
|
|
93
72
|
<_FloatingButton.default onClick={() => setIsEditing(false)} label="Hide">
|
|
94
73
|
<_FormItem.default label="Base URL">
|
|
@@ -99,7 +78,6 @@ function Server() {
|
|
|
99
78
|
</_FormItem.default>
|
|
100
79
|
{(value === null || value === void 0 ? void 0 : value.variables) && Object.keys(value.variables).map(key => {
|
|
101
80
|
var _value$variables2, _value$variables3, _value$variables4;
|
|
102
|
-
|
|
103
81
|
if (((_value$variables2 = value.variables) === null || _value$variables2 === void 0 ? void 0 : _value$variables2[key].enum) !== undefined) {
|
|
104
82
|
return <_FormItem.default label={key}>
|
|
105
83
|
<_FormSelect.default options={value.variables[key].enum} onChange={e => {
|
|
@@ -110,7 +88,6 @@ function Server() {
|
|
|
110
88
|
}} value={value === null || value === void 0 ? void 0 : value.variables[key].default} />
|
|
111
89
|
</_FormItem.default>;
|
|
112
90
|
}
|
|
113
|
-
|
|
114
91
|
return <_FormItem.default label={key}>
|
|
115
92
|
<_FormTextInput.default placeholder={(_value$variables3 = value.variables) === null || _value$variables3 === void 0 ? void 0 : _value$variables3[key].default} onChange={e => {
|
|
116
93
|
dispatch((0, _slice.setServerVariable)(JSON.stringify({
|
|
@@ -123,6 +100,5 @@ function Server() {
|
|
|
123
100
|
</_FloatingButton.default>
|
|
124
101
|
</div>;
|
|
125
102
|
}
|
|
126
|
-
|
|
127
103
|
var _default = Server;
|
|
128
104
|
exports.default = _default;
|
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.slice = exports.setServerVariable = exports.setServer = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
/* ============================================================================
|
|
11
9
|
* Copyright (c) Palo Alto Networks
|
|
12
10
|
*
|
|
13
11
|
* This source code is licensed under the MIT license found in the
|
|
14
12
|
* LICENSE file in the root directory of this source tree.
|
|
15
13
|
* ========================================================================== */
|
|
14
|
+
|
|
16
15
|
const initialState = {};
|
|
17
16
|
const slice = (0, _toolkit.createSlice)({
|
|
18
17
|
name: "server",
|
|
@@ -23,7 +22,6 @@ const slice = (0, _toolkit.createSlice)({
|
|
|
23
22
|
},
|
|
24
23
|
setServerVariable: (state, action) => {
|
|
25
24
|
var _state$value;
|
|
26
|
-
|
|
27
25
|
if ((_state$value = state.value) !== null && _state$value !== void 0 && _state$value.variables) {
|
|
28
26
|
const parsedPayload = JSON.parse(action.payload);
|
|
29
27
|
state.value.variables[parsedPayload.key].default = parsedPayload.value;
|