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,9 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
+
|
|
7
8
|
import sdk from "@paloaltonetworks/postman-collection";
|
|
8
9
|
import cloneDeep from "lodash/cloneDeep";
|
|
9
|
-
|
|
10
10
|
function setQueryParams(postman, queryParams) {
|
|
11
11
|
postman.url.query.clear();
|
|
12
12
|
const qp = queryParams
|
|
@@ -14,14 +14,14 @@ function setQueryParams(postman, queryParams) {
|
|
|
14
14
|
if (!param.value) {
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
if (Array.isArray(param.value)) {
|
|
19
18
|
return new sdk.QueryParam({
|
|
20
19
|
key: param.name,
|
|
21
20
|
value: param.value.join(","),
|
|
22
21
|
});
|
|
23
|
-
}
|
|
22
|
+
}
|
|
24
23
|
|
|
24
|
+
// Parameter allows empty value: "/hello?extended"
|
|
25
25
|
if (param.allowEmptyValue) {
|
|
26
26
|
if (param.value === "true") {
|
|
27
27
|
return new sdk.QueryParam({
|
|
@@ -29,22 +29,18 @@ function setQueryParams(postman, queryParams) {
|
|
|
29
29
|
value: null,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
return undefined;
|
|
34
33
|
}
|
|
35
|
-
|
|
36
34
|
return new sdk.QueryParam({
|
|
37
35
|
key: param.name,
|
|
38
36
|
value: param.value,
|
|
39
37
|
});
|
|
40
38
|
})
|
|
41
39
|
.filter((item) => item !== undefined);
|
|
42
|
-
|
|
43
40
|
if (qp.length > 0) {
|
|
44
41
|
postman.addQueryParams(qp);
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
function setPathParams(postman, queryParams) {
|
|
49
45
|
const source = queryParams.map((param) => {
|
|
50
46
|
return new sdk.Variable({
|
|
@@ -54,7 +50,6 @@ function setPathParams(postman, queryParams) {
|
|
|
54
50
|
});
|
|
55
51
|
postman.url.variables.assimilate(source, false);
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
function buildCookie(cookieParams) {
|
|
59
54
|
const cookies = cookieParams
|
|
60
55
|
.map((param) => {
|
|
@@ -67,31 +62,26 @@ function buildCookie(cookieParams) {
|
|
|
67
62
|
value: param.value,
|
|
68
63
|
});
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
return undefined;
|
|
72
66
|
})
|
|
73
67
|
.filter((item) => item !== undefined);
|
|
74
68
|
const list = new sdk.CookieList(null, cookies);
|
|
75
69
|
return list.toString();
|
|
76
70
|
}
|
|
77
|
-
|
|
78
71
|
function setHeaders(postman, contentType, accept, cookie, headerParams, other) {
|
|
79
72
|
postman.headers.clear();
|
|
80
|
-
|
|
81
73
|
if (contentType) {
|
|
82
74
|
postman.addHeader({
|
|
83
75
|
key: "Content-Type",
|
|
84
76
|
value: contentType,
|
|
85
77
|
});
|
|
86
78
|
}
|
|
87
|
-
|
|
88
79
|
if (accept) {
|
|
89
80
|
postman.addHeader({
|
|
90
81
|
key: "Accept",
|
|
91
82
|
value: accept,
|
|
92
83
|
});
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
headerParams.forEach((param) => {
|
|
96
86
|
if (param.value && !Array.isArray(param.value)) {
|
|
97
87
|
postman.addHeader({
|
|
@@ -103,25 +93,23 @@ function setHeaders(postman, contentType, accept, cookie, headerParams, other) {
|
|
|
103
93
|
other.forEach((header) => {
|
|
104
94
|
postman.addHeader(header);
|
|
105
95
|
});
|
|
106
|
-
|
|
107
96
|
if (cookie) {
|
|
108
97
|
postman.addHeader({
|
|
109
98
|
key: "Cookie",
|
|
110
99
|
value: cookie,
|
|
111
100
|
});
|
|
112
101
|
}
|
|
113
|
-
}
|
|
102
|
+
}
|
|
114
103
|
|
|
104
|
+
// TODO: this is all a bit hacky
|
|
115
105
|
function setBody(clonedPostman, body) {
|
|
116
106
|
if (clonedPostman.body === undefined) {
|
|
117
107
|
return;
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
if (body.type === "empty") {
|
|
121
110
|
clonedPostman.body = undefined;
|
|
122
111
|
return;
|
|
123
112
|
}
|
|
124
|
-
|
|
125
113
|
if (body.type === "raw" && body.content?.type === "file") {
|
|
126
114
|
// treat it like file.
|
|
127
115
|
clonedPostman.body.mode = "file";
|
|
@@ -130,7 +118,6 @@ function setBody(clonedPostman, body) {
|
|
|
130
118
|
};
|
|
131
119
|
return;
|
|
132
120
|
}
|
|
133
|
-
|
|
134
121
|
switch (clonedPostman.body.mode) {
|
|
135
122
|
case "raw": {
|
|
136
123
|
// check file even though it should already be set from above
|
|
@@ -138,21 +125,17 @@ function setBody(clonedPostman, body) {
|
|
|
138
125
|
clonedPostman.body = undefined;
|
|
139
126
|
return;
|
|
140
127
|
}
|
|
141
|
-
|
|
142
128
|
clonedPostman.body.raw = body.content?.value ?? "";
|
|
143
129
|
return;
|
|
144
130
|
}
|
|
145
|
-
|
|
146
131
|
case "formdata": {
|
|
147
132
|
clonedPostman.body.formdata?.clear();
|
|
148
|
-
|
|
149
133
|
if (body.type !== "form") {
|
|
150
134
|
// treat it like raw.
|
|
151
135
|
clonedPostman.body.mode = "raw";
|
|
152
136
|
clonedPostman.body.raw = `${body.content?.value}`;
|
|
153
137
|
return;
|
|
154
138
|
}
|
|
155
|
-
|
|
156
139
|
const params = Object.entries(body.content)
|
|
157
140
|
.filter((entry) => !!entry[1])
|
|
158
141
|
.map(([key, content]) => {
|
|
@@ -162,7 +145,6 @@ function setBody(clonedPostman, body) {
|
|
|
162
145
|
...content,
|
|
163
146
|
});
|
|
164
147
|
}
|
|
165
|
-
|
|
166
148
|
return new sdk.FormParam({
|
|
167
149
|
key: key,
|
|
168
150
|
value: content.value,
|
|
@@ -171,17 +153,14 @@ function setBody(clonedPostman, body) {
|
|
|
171
153
|
clonedPostman.body.formdata?.assimilate(params, false);
|
|
172
154
|
return;
|
|
173
155
|
}
|
|
174
|
-
|
|
175
156
|
case "urlencoded": {
|
|
176
157
|
clonedPostman.body.urlencoded?.clear();
|
|
177
|
-
|
|
178
158
|
if (body.type !== "form") {
|
|
179
159
|
// treat it like raw.
|
|
180
160
|
clonedPostman.body.mode = "raw";
|
|
181
161
|
clonedPostman.body.raw = `${body.content?.value}`;
|
|
182
162
|
return;
|
|
183
163
|
}
|
|
184
|
-
|
|
185
164
|
const params = Object.entries(body.content)
|
|
186
165
|
.filter((entry) => !!entry[1])
|
|
187
166
|
.map(([key, content]) => {
|
|
@@ -191,18 +170,18 @@ function setBody(clonedPostman, body) {
|
|
|
191
170
|
value: content.value,
|
|
192
171
|
});
|
|
193
172
|
}
|
|
194
|
-
|
|
195
173
|
return undefined;
|
|
196
174
|
})
|
|
197
175
|
.filter((item) => item !== undefined);
|
|
198
176
|
clonedPostman.body.urlencoded?.assimilate(params, false);
|
|
199
177
|
return;
|
|
200
178
|
}
|
|
201
|
-
|
|
202
179
|
default:
|
|
203
180
|
return;
|
|
204
181
|
}
|
|
205
|
-
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// TODO: finish these types
|
|
206
185
|
|
|
207
186
|
function buildPostmanRequest(
|
|
208
187
|
postman,
|
|
@@ -221,35 +200,28 @@ function buildPostmanRequest(
|
|
|
221
200
|
const clonedPostman = cloneDeep(postman);
|
|
222
201
|
clonedPostman.url.protocol = undefined;
|
|
223
202
|
clonedPostman.url.host = [window.location.origin];
|
|
224
|
-
|
|
225
203
|
if (server) {
|
|
226
204
|
let url = server.url.replace(/\/$/, "");
|
|
227
205
|
const variables = server.variables;
|
|
228
|
-
|
|
229
206
|
if (variables) {
|
|
230
207
|
Object.keys(variables).forEach((variable) => {
|
|
231
208
|
url = url.replace(`{${variable}}`, variables[variable].default);
|
|
232
209
|
});
|
|
233
210
|
}
|
|
234
|
-
|
|
235
211
|
clonedPostman.url.host = [url];
|
|
236
212
|
}
|
|
237
|
-
|
|
238
213
|
setQueryParams(clonedPostman, queryParams);
|
|
239
214
|
setPathParams(clonedPostman, pathParams);
|
|
240
215
|
const cookie = buildCookie(cookieParams);
|
|
241
216
|
let otherHeaders = [];
|
|
242
217
|
let selectedAuth = [];
|
|
243
|
-
|
|
244
218
|
if (auth.selected !== undefined) {
|
|
245
219
|
selectedAuth = auth.options[auth.selected];
|
|
246
220
|
}
|
|
247
|
-
|
|
248
221
|
for (const a of selectedAuth) {
|
|
249
222
|
// Bearer Auth
|
|
250
223
|
if (a.type === "http" && a.scheme === "bearer") {
|
|
251
224
|
const { token } = auth.data[a.key];
|
|
252
|
-
|
|
253
225
|
if (token === undefined) {
|
|
254
226
|
otherHeaders.push({
|
|
255
227
|
key: "Authorization",
|
|
@@ -257,21 +229,17 @@ function buildPostmanRequest(
|
|
|
257
229
|
});
|
|
258
230
|
continue;
|
|
259
231
|
}
|
|
260
|
-
|
|
261
232
|
otherHeaders.push({
|
|
262
233
|
key: "Authorization",
|
|
263
234
|
value: `Bearer ${token}`,
|
|
264
235
|
});
|
|
265
236
|
continue;
|
|
266
237
|
}
|
|
267
|
-
|
|
268
238
|
if (a.type === "oauth2") {
|
|
269
239
|
let token;
|
|
270
|
-
|
|
271
240
|
if (auth.data[a.key]) {
|
|
272
241
|
token = auth.data[a.key].token;
|
|
273
242
|
}
|
|
274
|
-
|
|
275
243
|
if (token === undefined) {
|
|
276
244
|
otherHeaders.push({
|
|
277
245
|
key: "Authorization",
|
|
@@ -279,31 +247,29 @@ function buildPostmanRequest(
|
|
|
279
247
|
});
|
|
280
248
|
continue;
|
|
281
249
|
}
|
|
282
|
-
|
|
283
250
|
otherHeaders.push({
|
|
284
251
|
key: "Authorization",
|
|
285
252
|
value: `Bearer ${token}`,
|
|
286
253
|
});
|
|
287
254
|
continue;
|
|
288
|
-
}
|
|
255
|
+
}
|
|
289
256
|
|
|
257
|
+
// Basic Auth
|
|
290
258
|
if (a.type === "http" && a.scheme === "basic") {
|
|
291
259
|
const { username, password } = auth.data[a.key];
|
|
292
|
-
|
|
293
260
|
if (username === undefined || password === undefined) {
|
|
294
261
|
continue;
|
|
295
262
|
}
|
|
296
|
-
|
|
297
263
|
otherHeaders.push({
|
|
298
264
|
key: "Authorization",
|
|
299
265
|
value: `Basic ${window.btoa(`${username}:${password}`)}`,
|
|
300
266
|
});
|
|
301
267
|
continue;
|
|
302
|
-
}
|
|
268
|
+
}
|
|
303
269
|
|
|
270
|
+
// API Key
|
|
304
271
|
if (a.type === "apiKey" && a.in === "header") {
|
|
305
272
|
const { apiKey } = auth.data[a.key];
|
|
306
|
-
|
|
307
273
|
if (apiKey === undefined) {
|
|
308
274
|
otherHeaders.push({
|
|
309
275
|
key: a.name,
|
|
@@ -311,7 +277,6 @@ function buildPostmanRequest(
|
|
|
311
277
|
});
|
|
312
278
|
continue;
|
|
313
279
|
}
|
|
314
|
-
|
|
315
280
|
otherHeaders.push({
|
|
316
281
|
key: a.name,
|
|
317
282
|
value: apiKey,
|
|
@@ -319,7 +284,6 @@ function buildPostmanRequest(
|
|
|
319
284
|
continue;
|
|
320
285
|
}
|
|
321
286
|
}
|
|
322
|
-
|
|
323
287
|
setHeaders(
|
|
324
288
|
clonedPostman,
|
|
325
289
|
contentType,
|
|
@@ -331,5 +295,4 @@ function buildPostmanRequest(
|
|
|
331
295
|
setBody(clonedPostman, body);
|
|
332
296
|
return clonedPostman;
|
|
333
297
|
}
|
|
334
|
-
|
|
335
298
|
export default buildPostmanRequest;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
+
|
|
7
8
|
import React from "react";
|
|
8
9
|
import sdk from "@paloaltonetworks/postman-collection";
|
|
9
10
|
import Curl from "./Curl";
|
|
@@ -11,13 +12,11 @@ import MethodEndpoint from "./MethodEndpoint";
|
|
|
11
12
|
import Request from "./Request";
|
|
12
13
|
import Response from "./Response";
|
|
13
14
|
import SecuritySchemes from "./SecuritySchemes";
|
|
14
|
-
import styles from "./styles.module.css";
|
|
15
|
-
|
|
16
15
|
function ApiDemoPanel({ item, infoPath }) {
|
|
17
16
|
const postman = new sdk.Request(item.postman);
|
|
18
17
|
const { path, method } = item;
|
|
19
18
|
return (
|
|
20
|
-
<div
|
|
19
|
+
<div>
|
|
21
20
|
<MethodEndpoint method={method} path={path} />
|
|
22
21
|
<SecuritySchemes infoPath={infoPath} />
|
|
23
22
|
<Request item={item} />
|
|
@@ -26,5 +25,4 @@ function ApiDemoPanel({ item, infoPath }) {
|
|
|
26
25
|
</div>
|
|
27
26
|
);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
export default ApiDemoPanel;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
+
|
|
7
8
|
import { setAuthData, setSelectedAuth } from "./Authorization/slice";
|
|
8
9
|
import { createStorage, hashArray } from "./storage-utils";
|
|
9
10
|
export function createPersistanceMiddleware(options) {
|
|
@@ -11,7 +12,6 @@ export function createPersistanceMiddleware(options) {
|
|
|
11
12
|
const result = next(action);
|
|
12
13
|
const state = storeAPI.getState();
|
|
13
14
|
const storage = createStorage("sessionStorage");
|
|
14
|
-
|
|
15
15
|
if (action.type === setAuthData.type) {
|
|
16
16
|
for (const [key, value] of Object.entries(state.auth.data)) {
|
|
17
17
|
if (Object.values(value).filter(Boolean).length > 0) {
|
|
@@ -21,7 +21,6 @@ export function createPersistanceMiddleware(options) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
25
24
|
if (action.type === setSelectedAuth.type) {
|
|
26
25
|
if (state.auth.selected) {
|
|
27
26
|
storage.setItem(
|
|
@@ -29,10 +28,13 @@ export function createPersistanceMiddleware(options) {
|
|
|
29
28
|
state.auth.selected
|
|
30
29
|
);
|
|
31
30
|
}
|
|
32
|
-
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// TODO: determine way to rehydrate without flashing
|
|
33
34
|
// if (action.type === "contentType/setContentType") {
|
|
34
35
|
// storage.setItem("contentType", action.payload);
|
|
35
36
|
// }
|
|
37
|
+
|
|
36
38
|
// if (action.type === "accept/setAccept") {
|
|
37
39
|
// storage.setItem("accept", action.payload);
|
|
38
40
|
// }
|
|
@@ -40,7 +42,6 @@ export function createPersistanceMiddleware(options) {
|
|
|
40
42
|
if (action.type === "server/setServer") {
|
|
41
43
|
storage.setItem("server", action.payload);
|
|
42
44
|
}
|
|
43
|
-
|
|
44
45
|
if (action.type === "server/setServerVariable") {
|
|
45
46
|
const server = storage.getItem("server") ?? "{}";
|
|
46
47
|
const variables = JSON.parse(action.payload);
|
|
@@ -48,9 +49,7 @@ export function createPersistanceMiddleware(options) {
|
|
|
48
49
|
serverObject.variables[variables.key].default = variables.value;
|
|
49
50
|
storage.setItem("server", JSON.stringify(serverObject));
|
|
50
51
|
}
|
|
51
|
-
|
|
52
52
|
return result;
|
|
53
53
|
};
|
|
54
|
-
|
|
55
54
|
return persistanceMiddleware;
|
|
56
55
|
}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
+
|
|
7
8
|
import crypto from "crypto-js";
|
|
8
9
|
export function hashArray(arr) {
|
|
9
10
|
function hash(message) {
|
|
10
11
|
return crypto.SHA1(message).toString();
|
|
11
12
|
}
|
|
12
|
-
|
|
13
13
|
const hashed = arr.map((item) => hash(item));
|
|
14
14
|
hashed.sort();
|
|
15
15
|
const res = hashed.join();
|
|
@@ -26,10 +26,8 @@ export function createStorage(persistance) {
|
|
|
26
26
|
length: 0,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
|
|
30
29
|
if (persistance === "sessionStorage") {
|
|
31
30
|
return sessionStorage;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
return localStorage;
|
|
35
33
|
}
|
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { useWindowSize } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
7
|
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { useWindowSize } from "@docusaurus/theme-common";
|
|
10
10
|
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
11
|
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
12
|
+
import DocItemContent from "@theme/DocItem/Content";
|
|
13
|
+
import DocItemFooter from "@theme/DocItem/Footer";
|
|
14
|
+
import DocItemPaginator from "@theme/DocItem/Paginator";
|
|
15
|
+
import DocItemTOCDesktop from "@theme/DocItem/TOC/Desktop";
|
|
16
|
+
import DocItemTOCMobile from "@theme/DocItem/TOC/Mobile";
|
|
12
17
|
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
13
18
|
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
14
19
|
import clsx from "clsx";
|
|
15
|
-
import DocItemContent from "../Content";
|
|
16
|
-
import DocItemFooter from "../Footer";
|
|
17
|
-
import DocItemPaginator from "../Paginator";
|
|
18
|
-
import DocItemTOCDesktop from "../TOC/Desktop";
|
|
19
|
-
import DocItemTOCMobile from "../TOC/Mobile";
|
|
20
20
|
import styles from "./styles.module.css";
|
|
21
|
+
|
|
21
22
|
/**
|
|
22
23
|
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
25
|
function useDocTOC() {
|
|
26
26
|
const { frontMatter, toc } = useDoc();
|
|
27
27
|
const windowSize = useWindowSize();
|
|
@@ -38,7 +38,6 @@ function useDocTOC() {
|
|
|
38
38
|
desktop,
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
|
|
42
41
|
export default function DocItemLayout({ children }) {
|
|
43
42
|
const docTOC = useDocTOC();
|
|
44
43
|
const {
|