docusaurus-theme-openapi-docs 0.0.0-1000
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/LICENSE +21 -0
- package/babel.config.js +35 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +81 -0
- package/lib/markdown/createDescription.d.ts +1 -0
- package/lib/markdown/createDescription.js +15 -0
- package/lib/markdown/schema.d.ts +3 -0
- package/lib/markdown/schema.js +149 -0
- package/lib/markdown/utils.d.ts +10 -0
- package/lib/markdown/utils.js +49 -0
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Accept/index.js +38 -0
- package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
- package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
- package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
- package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Authorization/index.js +160 -0
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
- package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
- package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/Body/index.js +381 -0
- package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
- package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
- package/lib/theme/ApiExplorer/Body/slice.js +97 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +389 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +95 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +271 -0
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
- package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
- package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
- package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Export/index.js +57 -0
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
- package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +173 -0
- package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/FormItem/index.js +44 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
- package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
- package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +73 -0
- package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/LiveEditor/index.js +168 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
- package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +220 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +63 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +89 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +63 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.js +223 -0
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
- package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
- package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/Request/index.js +396 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.js +222 -0
- package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/Response/index.js +193 -0
- package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/Response/slice.js +51 -0
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +380 -0
- package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/Server/index.js +199 -0
- package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
- package/lib/theme/ApiExplorer/Server/slice.js +33 -0
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +465 -0
- package/lib/theme/ApiExplorer/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/index.js +41 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +3 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
- package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
- package/lib/theme/ApiExplorer/storage-utils.js +41 -0
- package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
- package/lib/theme/ApiItem/Layout/index.js +121 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
- package/lib/theme/ApiItem/hooks.d.ts +12 -0
- package/lib/theme/ApiItem/hooks.js +13 -0
- package/lib/theme/ApiItem/index.d.ts +2 -0
- package/lib/theme/ApiItem/index.js +238 -0
- package/lib/theme/ApiItem/store.d.ts +46 -0
- package/lib/theme/ApiItem/store.js +53 -0
- package/lib/theme/ApiLogo/index.d.ts +2 -0
- package/lib/theme/ApiLogo/index.js +51 -0
- package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +270 -0
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +258 -0
- package/lib/theme/Markdown/Details/_Details.scss +122 -0
- package/lib/theme/Markdown/index.js +179 -0
- package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +286 -0
- package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +248 -0
- package/lib/theme/ParamsDetails/index.d.ts +6 -0
- package/lib/theme/ParamsDetails/index.js +85 -0
- package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/lib/theme/ParamsItem/index.d.ts +25 -0
- package/lib/theme/ParamsItem/index.js +218 -0
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +194 -0
- package/lib/theme/ResponseExamples/index.d.ts +18 -0
- package/lib/theme/ResponseExamples/index.js +193 -0
- package/lib/theme/ResponseHeaders/index.d.ts +13 -0
- package/lib/theme/ResponseHeaders/index.js +39 -0
- package/lib/theme/ResponseSamples/_ResponseSamples.scss +3 -0
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +27 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +159 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +885 -0
- package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +213 -0
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +255 -0
- package/lib/theme/SkeletonLoader/index.d.ts +6 -0
- package/lib/theme/SkeletonLoader/index.js +20 -0
- package/lib/theme/StatusCodes/index.d.ts +9 -0
- package/lib/theme/StatusCodes/index.js +81 -0
- package/lib/theme/styles.scss +212 -0
- package/lib/types.d.ts +157 -0
- package/lib/types.js +8 -0
- package/package.json +83 -0
- package/src/index.ts +85 -0
- package/src/markdown/createDescription.ts +13 -0
- package/src/markdown/schema.ts +181 -0
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +59 -0
- package/src/plugin-content-docs.d.ts +20 -0
- package/src/postman-code-generators.d.ts +9 -0
- package/src/react-magic-dropzone.d.ts +9 -0
- package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
- package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +79 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
- package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
- package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
- package/src/theme/ApiExplorer/Authorization/index.tsx +158 -0
- package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
- package/src/theme/ApiExplorer/Body/index.tsx +376 -0
- package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
- package/src/theme/ApiExplorer/Body/slice.ts +133 -0
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +338 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +96 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +501 -0
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +248 -0
- package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
- package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
- package/src/theme/ApiExplorer/Export/index.tsx +47 -0
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
- package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
- package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +119 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/src/theme/ApiExplorer/FormItem/index.tsx +33 -0
- package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
- package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
- package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
- package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
- package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +80 -0
- package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +114 -0
- package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +175 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +64 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +86 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +65 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +146 -0
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
- package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
- package/src/theme/ApiExplorer/Request/index.tsx +309 -0
- package/src/theme/ApiExplorer/Request/makeRequest.ts +254 -0
- package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/src/theme/ApiExplorer/Response/index.tsx +157 -0
- package/src/theme/ApiExplorer/Response/slice.ts +52 -0
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +287 -0
- package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/src/theme/ApiExplorer/Server/index.tsx +130 -0
- package/src/theme/ApiExplorer/Server/slice.ts +39 -0
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +526 -0
- package/src/theme/ApiExplorer/index.tsx +41 -0
- package/src/theme/ApiExplorer/persistanceMiddleware.ts +71 -0
- package/src/theme/ApiExplorer/postman-collection.d.ts +10 -0
- package/src/theme/ApiExplorer/react-modal.d.ts +8 -0
- package/src/theme/ApiExplorer/storage-utils.ts +39 -0
- package/src/theme/ApiItem/Layout/index.tsx +85 -0
- package/src/theme/ApiItem/Layout/styles.module.css +17 -0
- package/src/theme/ApiItem/hooks.ts +13 -0
- package/src/theme/ApiItem/index.tsx +222 -0
- package/src/theme/ApiItem/store.ts +51 -0
- package/src/theme/ApiLogo/index.tsx +52 -0
- package/src/theme/ApiTabs/_ApiTabs.scss +142 -0
- package/src/theme/ApiTabs/index.tsx +238 -0
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
- package/src/theme/DiscriminatorTabs/index.tsx +229 -0
- package/src/theme/Markdown/Details/_Details.scss +122 -0
- package/src/theme/Markdown/index.js +179 -0
- package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
- package/src/theme/MimeTabs/index.tsx +257 -0
- package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
- package/src/theme/OperationTabs/index.tsx +220 -0
- package/src/theme/ParamsDetails/index.tsx +81 -0
- package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/src/theme/ParamsItem/index.tsx +205 -0
- package/src/theme/RequestSchema/index.tsx +157 -0
- package/src/theme/ResponseExamples/index.tsx +192 -0
- package/src/theme/ResponseHeaders/index.tsx +49 -0
- package/src/theme/ResponseSamples/_ResponseSamples.scss +3 -0
- package/src/theme/ResponseSamples/index.tsx +31 -0
- package/src/theme/ResponseSchema/index.tsx +144 -0
- package/src/theme/Schema/index.tsx +939 -0
- package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/src/theme/SchemaItem/index.tsx +198 -0
- package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
- package/src/theme/SchemaTabs/index.tsx +224 -0
- package/src/theme/SkeletonLoader/index.tsx +18 -0
- package/src/theme/StatusCodes/index.tsx +72 -0
- package/src/theme/styles.scss +212 -0
- package/src/theme-classic.d.ts +80 -0
- package/src/theme-openapi.d.ts +288 -0
- package/src/theme-translations.d.ts +9 -0
- package/src/types.ts +182 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React, { isValidElement, ReactNode } from "react";
|
|
9
|
+
|
|
10
|
+
import { CodeBlockProps } from "@docusaurus/theme-common/internal";
|
|
11
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
12
|
+
import ElementContent from "@theme/ApiExplorer/ApiCodeBlock/Content/Element";
|
|
13
|
+
import StringContent from "@theme/ApiExplorer/ApiCodeBlock/Content/String";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Best attempt to make the children a plain string so it is copyable. If there
|
|
17
|
+
* are react elements, we will not be able to copy the content, and it will
|
|
18
|
+
* return `children` as-is; otherwise, it concatenates the string children
|
|
19
|
+
* together.
|
|
20
|
+
*/
|
|
21
|
+
function maybeStringifyChildren(children: ReactNode): ReactNode {
|
|
22
|
+
if (React.Children.toArray(children).some((el) => isValidElement(el))) {
|
|
23
|
+
return children;
|
|
24
|
+
}
|
|
25
|
+
// The children is now guaranteed to be one/more plain strings
|
|
26
|
+
return Array.isArray(children) ? children.join("") : (children as string);
|
|
27
|
+
}
|
|
28
|
+
export default function ApiCodeBlock({
|
|
29
|
+
children: rawChildren,
|
|
30
|
+
...props
|
|
31
|
+
}: CodeBlockProps) {
|
|
32
|
+
// The Prism theme on SSR is always the default theme but the site theme can
|
|
33
|
+
// be in a different mode. React hydration doesn't update DOM styles that come
|
|
34
|
+
// from SSR. Hence force a re-render after mounting to apply the current
|
|
35
|
+
// relevant styles.
|
|
36
|
+
const isBrowser = useIsBrowser();
|
|
37
|
+
const children = maybeStringifyChildren(rawChildren);
|
|
38
|
+
const CodeBlockComp =
|
|
39
|
+
typeof children === "string" ? StringContent : ElementContent;
|
|
40
|
+
return (
|
|
41
|
+
<CodeBlockComp key={String(isBrowser)} {...props}>
|
|
42
|
+
{children as string}
|
|
43
|
+
</CodeBlockComp>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
export function getAuthDataKeys(security: { [key: string]: any }) {
|
|
9
|
+
// Bearer Auth
|
|
10
|
+
if (security.type === "http" && security.scheme === "bearer") {
|
|
11
|
+
return ["token"];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (security.type === "oauth2") {
|
|
15
|
+
return ["token"];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Basic Auth
|
|
19
|
+
if (security.type === "http" && security.scheme === "basic") {
|
|
20
|
+
return ["username", "password"];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// API Auth
|
|
24
|
+
if (security.type === "apiKey") {
|
|
25
|
+
return ["apiKey"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// none
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import FormItem from "@theme/ApiExplorer/FormItem";
|
|
11
|
+
import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
12
|
+
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
13
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
14
|
+
|
|
15
|
+
import { setAuthData, setSelectedAuth } from "./slice";
|
|
16
|
+
|
|
17
|
+
function Authorization() {
|
|
18
|
+
const data = useTypedSelector((state: any) => state.auth.data);
|
|
19
|
+
const options = useTypedSelector((state: any) => state.auth.options);
|
|
20
|
+
const selected = useTypedSelector((state: any) => state.auth.selected);
|
|
21
|
+
|
|
22
|
+
const dispatch = useTypedDispatch();
|
|
23
|
+
|
|
24
|
+
if (selected === undefined) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const selectedAuth = options[selected];
|
|
29
|
+
|
|
30
|
+
const optionKeys = Object.keys(options);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div>
|
|
34
|
+
{optionKeys.length > 1 && (
|
|
35
|
+
<FormItem label="Security Scheme">
|
|
36
|
+
<FormSelect
|
|
37
|
+
options={optionKeys}
|
|
38
|
+
value={selected}
|
|
39
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
40
|
+
dispatch(setSelectedAuth(e.target.value));
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
</FormItem>
|
|
44
|
+
)}
|
|
45
|
+
{selectedAuth.map((a: any) => {
|
|
46
|
+
if (a.type === "http" && a.scheme === "bearer") {
|
|
47
|
+
return (
|
|
48
|
+
<FormItem label="Bearer Token" key={a.key + "-bearer"}>
|
|
49
|
+
<FormTextInput
|
|
50
|
+
placeholder="Bearer Token"
|
|
51
|
+
password
|
|
52
|
+
value={data[a.key].token ?? ""}
|
|
53
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
54
|
+
const value = e.target.value;
|
|
55
|
+
dispatch(
|
|
56
|
+
setAuthData({
|
|
57
|
+
scheme: a.key,
|
|
58
|
+
key: "token",
|
|
59
|
+
value: value ? value : undefined,
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
</FormItem>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (a.type === "oauth2") {
|
|
69
|
+
return (
|
|
70
|
+
<FormItem label="Bearer Token" key={a.key + "-oauth2"}>
|
|
71
|
+
<FormTextInput
|
|
72
|
+
placeholder="Bearer Token"
|
|
73
|
+
password
|
|
74
|
+
value={data[a.key].token ?? ""}
|
|
75
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
76
|
+
const value = e.target.value;
|
|
77
|
+
dispatch(
|
|
78
|
+
setAuthData({
|
|
79
|
+
scheme: a.key,
|
|
80
|
+
key: "token",
|
|
81
|
+
value: value ? value : undefined,
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
</FormItem>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (a.type === "http" && a.scheme === "basic") {
|
|
91
|
+
return (
|
|
92
|
+
<React.Fragment key={a.key + "-basic"}>
|
|
93
|
+
<FormItem label="Username">
|
|
94
|
+
<FormTextInput
|
|
95
|
+
placeholder="Username"
|
|
96
|
+
value={data[a.key].username ?? ""}
|
|
97
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
98
|
+
const value = e.target.value;
|
|
99
|
+
dispatch(
|
|
100
|
+
setAuthData({
|
|
101
|
+
scheme: a.key,
|
|
102
|
+
key: "username",
|
|
103
|
+
value: value ? value : undefined,
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</FormItem>
|
|
109
|
+
<FormItem label="Password">
|
|
110
|
+
<FormTextInput
|
|
111
|
+
placeholder="Password"
|
|
112
|
+
password
|
|
113
|
+
value={data[a.key].password ?? ""}
|
|
114
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
115
|
+
const value = e.target.value;
|
|
116
|
+
dispatch(
|
|
117
|
+
setAuthData({
|
|
118
|
+
scheme: a.key,
|
|
119
|
+
key: "password",
|
|
120
|
+
value: value ? value : undefined,
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
</FormItem>
|
|
126
|
+
</React.Fragment>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (a.type === "apiKey") {
|
|
131
|
+
return (
|
|
132
|
+
<FormItem label={`${a.key}`} key={a.key + "-apikey"}>
|
|
133
|
+
<FormTextInput
|
|
134
|
+
placeholder={`${a.key}`}
|
|
135
|
+
password
|
|
136
|
+
value={data[a.key].apiKey ?? ""}
|
|
137
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
138
|
+
const value = e.target.value;
|
|
139
|
+
dispatch(
|
|
140
|
+
setAuthData({
|
|
141
|
+
scheme: a.key,
|
|
142
|
+
key: "apiKey",
|
|
143
|
+
value: value ? value : undefined,
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
</FormItem>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return null;
|
|
153
|
+
})}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default Authorization;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
9
|
+
import { createStorage, hashArray } from "@theme/ApiExplorer/storage-utils";
|
|
10
|
+
import {
|
|
11
|
+
SecurityRequirementObject,
|
|
12
|
+
SecuritySchemeObject,
|
|
13
|
+
} from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
14
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
15
|
+
import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
|
|
16
|
+
|
|
17
|
+
import { getAuthDataKeys } from "./auth-types";
|
|
18
|
+
|
|
19
|
+
// The global definitions
|
|
20
|
+
// "securitySchemes": {
|
|
21
|
+
// "BearerAuth": { "type": "http", "scheme": "BeAreR" },
|
|
22
|
+
// "BasicAuth": { "type": "http", "scheme": "basic" }
|
|
23
|
+
// },
|
|
24
|
+
|
|
25
|
+
// The operation level requirements
|
|
26
|
+
// "security": [
|
|
27
|
+
// { "BearerAuth": [] },
|
|
28
|
+
// { "BearerAuth": [], "BasicAuth": [] }
|
|
29
|
+
// ],
|
|
30
|
+
|
|
31
|
+
// SLICE_STATE
|
|
32
|
+
// data:
|
|
33
|
+
// BearerAuth:
|
|
34
|
+
// token=xxx
|
|
35
|
+
// BasicAuth:
|
|
36
|
+
// username=xxx
|
|
37
|
+
// password=xxx
|
|
38
|
+
//
|
|
39
|
+
// options:
|
|
40
|
+
// "BearerAuth": [{ key: "BearerAuth", scopes: [], ...rest }]
|
|
41
|
+
// "BearerAuth and BasicAuth": [{ key: "BearerAuth", scopes: [], ...rest }, { key: "BasicAuth", scopes: [], ...rest }]
|
|
42
|
+
//
|
|
43
|
+
// selected: "BearerAuth and BasicAuth"
|
|
44
|
+
|
|
45
|
+
// LOCAL_STORAGE
|
|
46
|
+
// hash(SLICE_STATE.options) -> "BearerAuth and BasicAuth"
|
|
47
|
+
// BearerAuth -> { token: xxx }
|
|
48
|
+
// BasicAuth -> { username: xxx, password: xxx }
|
|
49
|
+
|
|
50
|
+
export function createAuth({
|
|
51
|
+
security,
|
|
52
|
+
securitySchemes,
|
|
53
|
+
options: opts,
|
|
54
|
+
}: {
|
|
55
|
+
security?: SecurityRequirementObject[];
|
|
56
|
+
securitySchemes?: {
|
|
57
|
+
[key: string]: SecuritySchemeObject;
|
|
58
|
+
};
|
|
59
|
+
options?: ThemeConfig["api"];
|
|
60
|
+
}): AuthState {
|
|
61
|
+
const storage = createStorage("sessionStorage");
|
|
62
|
+
|
|
63
|
+
let data: AuthState["data"] = {};
|
|
64
|
+
let options: AuthState["options"] = {};
|
|
65
|
+
|
|
66
|
+
for (const option of security ?? []) {
|
|
67
|
+
const id = Object.keys(option).join(" and ");
|
|
68
|
+
for (const [schemeID, scopes] of Object.entries(option)) {
|
|
69
|
+
const scheme = securitySchemes?.[schemeID];
|
|
70
|
+
if (scheme) {
|
|
71
|
+
if (options[id] === undefined) {
|
|
72
|
+
options[id] = [];
|
|
73
|
+
}
|
|
74
|
+
const dataKeys = getAuthDataKeys(scheme);
|
|
75
|
+
for (const key of dataKeys) {
|
|
76
|
+
if (data[schemeID] === undefined) {
|
|
77
|
+
data[schemeID] = {};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let persisted = undefined;
|
|
81
|
+
try {
|
|
82
|
+
persisted = JSON.parse(storage.getItem(schemeID) ?? "")[key];
|
|
83
|
+
} catch {}
|
|
84
|
+
|
|
85
|
+
data[schemeID][key] = persisted;
|
|
86
|
+
}
|
|
87
|
+
options[id].push({
|
|
88
|
+
...scheme,
|
|
89
|
+
key: schemeID,
|
|
90
|
+
scopes,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let persisted = undefined;
|
|
97
|
+
try {
|
|
98
|
+
persisted = storage.getItem(hashArray(Object.keys(options))) ?? undefined;
|
|
99
|
+
} catch {}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
data,
|
|
103
|
+
options,
|
|
104
|
+
selected: persisted ?? Object.keys(options)[0],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type Scheme = {
|
|
109
|
+
key: string;
|
|
110
|
+
scopes: string[];
|
|
111
|
+
} & SecuritySchemeObject;
|
|
112
|
+
|
|
113
|
+
export interface AuthState {
|
|
114
|
+
data: {
|
|
115
|
+
[scheme: string]: {
|
|
116
|
+
[key: string]: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
options: {
|
|
120
|
+
[key: string]: Scheme[];
|
|
121
|
+
};
|
|
122
|
+
selected?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const initialState: AuthState = {} as any;
|
|
126
|
+
|
|
127
|
+
export const slice = createSlice({
|
|
128
|
+
name: "auth",
|
|
129
|
+
initialState,
|
|
130
|
+
reducers: {
|
|
131
|
+
setAuthData: (
|
|
132
|
+
state,
|
|
133
|
+
action: PayloadAction<{ scheme: string; key: string; value?: string }>
|
|
134
|
+
) => {
|
|
135
|
+
const { scheme, key, value } = action.payload;
|
|
136
|
+
state.data[scheme][key] = value;
|
|
137
|
+
},
|
|
138
|
+
setSelectedAuth: (state, action: PayloadAction<string>) => {
|
|
139
|
+
state.selected = action.payload;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export const { setAuthData, setSelectedAuth } = slice.actions;
|
|
145
|
+
|
|
146
|
+
export default slice.reducer;
|