@camunda8/docusaurus-theme-openapi-docs 4.5.1
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/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 +154 -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 +7 -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 +201 -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 +394 -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 +11 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +435 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +133 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +283 -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 +178 -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 +49 -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 +11 -0
- package/lib/theme/ApiExplorer/FormTextInput/index.js +80 -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 +176 -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 +230 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +71 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +97 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +72 -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 +233 -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 +443 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
- package/lib/theme/ApiExplorer/Request/makeRequest.js +223 -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 +207 -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 +519 -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 +213 -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 +511 -0
- package/lib/theme/ApiExplorer/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/index.js +107 -0
- package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +19 -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 +58 -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 +275 -0
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/lib/theme/CodeSamples/index.d.ts +8 -0
- package/lib/theme/CodeSamples/index.js +27 -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 +93 -0
- package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/lib/theme/ParamsItem/index.d.ts +22 -0
- package/lib/theme/ParamsItem/index.js +281 -0
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +208 -0
- package/lib/theme/ResponseExamples/index.d.ts +18 -0
- package/lib/theme/ResponseExamples/index.js +213 -0
- package/lib/theme/ResponseHeaders/index.d.ts +13 -0
- package/lib/theme/ResponseHeaders/index.js +39 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +165 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +853 -0
- package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +314 -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 +90 -0
- package/lib/theme/styles.scss +215 -0
- package/lib/theme/translationIds.d.ts +83 -0
- package/lib/theme/translationIds.js +106 -0
- package/lib/types.d.ts +46 -0
- package/lib/types.js +8 -0
- package/package.json +85 -0
- package/src/index.ts +85 -0
- package/src/markdown/createDescription.ts +13 -0
- package/src/markdown/schema.ts +186 -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 +83 -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 +199 -0
- package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
- package/src/theme/ApiExplorer/Body/index.tsx +388 -0
- package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -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 +383 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +139 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +261 -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 +124 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
- package/src/theme/ApiExplorer/FormItem/index.tsx +40 -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 +89 -0
- package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +122 -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 +185 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +72 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +94 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +74 -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 +154 -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 +352 -0
- package/src/theme/ApiExplorer/Request/makeRequest.ts +255 -0
- package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
- package/src/theme/ApiExplorer/Response/index.tsx +173 -0
- package/src/theme/ApiExplorer/Response/slice.ts +52 -0
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +375 -0
- package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
- package/src/theme/ApiExplorer/Server/index.tsx +138 -0
- package/src/theme/ApiExplorer/Server/slice.ts +39 -0
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +524 -0
- package/src/theme/ApiExplorer/index.tsx +52 -0
- package/src/theme/ApiExplorer/persistanceMiddleware.ts +73 -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 +243 -0
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/src/theme/CodeSamples/index.tsx +26 -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.d.ts +8 -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 +90 -0
- package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
- package/src/theme/ParamsItem/index.tsx +246 -0
- package/src/theme/RequestSchema/index.tsx +172 -0
- package/src/theme/ResponseExamples/index.tsx +209 -0
- package/src/theme/ResponseHeaders/index.tsx +49 -0
- package/src/theme/ResponseSchema/index.tsx +150 -0
- package/src/theme/Schema/index.tsx +938 -0
- package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
- package/src/theme/SchemaItem/index.tsx +273 -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 +83 -0
- package/src/theme/styles.scss +215 -0
- package/src/theme/translationIds.ts +103 -0
- package/src/theme-classic.d.ts +80 -0
- package/src/theme-openapi.d.ts +20 -0
- package/src/types.ts +72 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,375 @@
|
|
|
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 { translate } from "@docusaurus/Translate";
|
|
11
|
+
import { OPENAPI_SECURITY_SCHEMES } from "@theme/translationIds";
|
|
12
|
+
|
|
13
|
+
import Link from "@docusaurus/Link";
|
|
14
|
+
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
15
|
+
|
|
16
|
+
function SecuritySchemes(props: any) {
|
|
17
|
+
const options = useTypedSelector((state: any) => state.auth.options);
|
|
18
|
+
const selected = useTypedSelector((state: any) => state.auth.selected);
|
|
19
|
+
const infoAuthPath = `/${props.infoPath}#authentication`;
|
|
20
|
+
|
|
21
|
+
if (selected === undefined) return null;
|
|
22
|
+
|
|
23
|
+
if (options[selected]?.[0]?.type === undefined) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const selectedAuth = options[selected];
|
|
28
|
+
|
|
29
|
+
const keyTranslations: Record<string, { id: string; message: string }> = {
|
|
30
|
+
description: {
|
|
31
|
+
id: OPENAPI_SECURITY_SCHEMES.DESCRIPTION,
|
|
32
|
+
message: "description:",
|
|
33
|
+
},
|
|
34
|
+
scheme: {
|
|
35
|
+
id: OPENAPI_SECURITY_SCHEMES.SCHEME,
|
|
36
|
+
message: "scheme:",
|
|
37
|
+
},
|
|
38
|
+
bearerFormat: {
|
|
39
|
+
id: OPENAPI_SECURITY_SCHEMES.BEARER_FORMAT,
|
|
40
|
+
message: "bearerFormat:",
|
|
41
|
+
},
|
|
42
|
+
openIdConnectUrl: {
|
|
43
|
+
id: OPENAPI_SECURITY_SCHEMES.OPEN_ID_CONNECT_URL,
|
|
44
|
+
message: "openIdConnectUrl:",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const renderRest = (rest: Record<string, any>) =>
|
|
49
|
+
Object.keys(rest).map((k) => {
|
|
50
|
+
const translation = keyTranslations[k];
|
|
51
|
+
const label = translation
|
|
52
|
+
? translate({ id: translation.id, message: translation.message })
|
|
53
|
+
: `${k}:`;
|
|
54
|
+
return (
|
|
55
|
+
<span key={k}>
|
|
56
|
+
<strong>{label} </strong>
|
|
57
|
+
{typeof rest[k] === "object"
|
|
58
|
+
? JSON.stringify(rest[k], null, 2)
|
|
59
|
+
: String(rest[k])}
|
|
60
|
+
</span>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
return (
|
|
64
|
+
<details className="openapi-security__details" open={false}>
|
|
65
|
+
<summary className="openapi-security__summary-container">
|
|
66
|
+
<h4 className="openapi-security__summary-header">
|
|
67
|
+
Authorization: {selectedAuth[0].name ?? selectedAuth[0].type}
|
|
68
|
+
</h4>
|
|
69
|
+
</summary>
|
|
70
|
+
{selectedAuth.map((auth: any) => {
|
|
71
|
+
const isHttp = auth.type === "http";
|
|
72
|
+
const isApiKey = auth.type === "apiKey";
|
|
73
|
+
const isOauth2 = auth.type === "oauth2";
|
|
74
|
+
const isOpenId = auth.type === "openIdConnect";
|
|
75
|
+
|
|
76
|
+
if (isHttp) {
|
|
77
|
+
if (auth.scheme === "bearer") {
|
|
78
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
79
|
+
return (
|
|
80
|
+
<React.Fragment key={auth.key}>
|
|
81
|
+
<pre
|
|
82
|
+
style={{
|
|
83
|
+
display: "flex",
|
|
84
|
+
flexDirection: "column",
|
|
85
|
+
background: "var(--openapi-card-background-color)",
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<span>
|
|
89
|
+
<strong>
|
|
90
|
+
{translate({
|
|
91
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
92
|
+
message: "name:",
|
|
93
|
+
})}
|
|
94
|
+
</strong>{" "}
|
|
95
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
96
|
+
</span>
|
|
97
|
+
<span>
|
|
98
|
+
<strong>
|
|
99
|
+
{translate({
|
|
100
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
101
|
+
message: "type:",
|
|
102
|
+
})}
|
|
103
|
+
</strong>{" "}
|
|
104
|
+
{type}
|
|
105
|
+
</span>
|
|
106
|
+
{scopes && scopes.length > 0 && (
|
|
107
|
+
<span>
|
|
108
|
+
<strong>
|
|
109
|
+
{translate({
|
|
110
|
+
id: OPENAPI_SECURITY_SCHEMES.SCOPES,
|
|
111
|
+
message: "scopes:",
|
|
112
|
+
})}
|
|
113
|
+
</strong>{" "}
|
|
114
|
+
<code>
|
|
115
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
116
|
+
</code>
|
|
117
|
+
</span>
|
|
118
|
+
)}
|
|
119
|
+
{renderRest(rest)}
|
|
120
|
+
</pre>
|
|
121
|
+
</React.Fragment>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
if (auth.scheme === "basic") {
|
|
125
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
126
|
+
return (
|
|
127
|
+
<React.Fragment key={auth.key}>
|
|
128
|
+
<pre
|
|
129
|
+
style={{
|
|
130
|
+
display: "flex",
|
|
131
|
+
flexDirection: "column",
|
|
132
|
+
background: "var(--openapi-card-background-color)",
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<span>
|
|
136
|
+
<strong>
|
|
137
|
+
{translate({
|
|
138
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
139
|
+
message: "name:",
|
|
140
|
+
})}
|
|
141
|
+
</strong>{" "}
|
|
142
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
143
|
+
</span>
|
|
144
|
+
<span>
|
|
145
|
+
<strong>
|
|
146
|
+
{translate({
|
|
147
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
148
|
+
message: "type:",
|
|
149
|
+
})}
|
|
150
|
+
</strong>{" "}
|
|
151
|
+
{type}
|
|
152
|
+
</span>
|
|
153
|
+
{scopes && scopes.length > 0 && (
|
|
154
|
+
<span>
|
|
155
|
+
<strong>
|
|
156
|
+
{translate({
|
|
157
|
+
id: OPENAPI_SECURITY_SCHEMES.SCOPES,
|
|
158
|
+
message: "scopes:",
|
|
159
|
+
})}
|
|
160
|
+
</strong>{" "}
|
|
161
|
+
<code>
|
|
162
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
163
|
+
</code>
|
|
164
|
+
</span>
|
|
165
|
+
)}
|
|
166
|
+
{renderRest(rest)}
|
|
167
|
+
</pre>
|
|
168
|
+
</React.Fragment>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
return (
|
|
172
|
+
<React.Fragment key={auth.key}>
|
|
173
|
+
<pre
|
|
174
|
+
style={{
|
|
175
|
+
display: "flex",
|
|
176
|
+
flexDirection: "column",
|
|
177
|
+
background: "var(--openapi-card-background-color)",
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
<span>
|
|
181
|
+
<strong>
|
|
182
|
+
{translate({
|
|
183
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
184
|
+
message: "name:",
|
|
185
|
+
})}
|
|
186
|
+
</strong>{" "}
|
|
187
|
+
<Link to={infoAuthPath}>{auth.name ?? auth.key}</Link>
|
|
188
|
+
</span>
|
|
189
|
+
<span>
|
|
190
|
+
<strong>
|
|
191
|
+
{translate({
|
|
192
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
193
|
+
message: "type:",
|
|
194
|
+
})}
|
|
195
|
+
</strong>{" "}
|
|
196
|
+
{auth.type}
|
|
197
|
+
</span>
|
|
198
|
+
<span>
|
|
199
|
+
<strong>
|
|
200
|
+
{translate({
|
|
201
|
+
id: OPENAPI_SECURITY_SCHEMES.IN,
|
|
202
|
+
message: "in:",
|
|
203
|
+
})}
|
|
204
|
+
</strong>{" "}
|
|
205
|
+
{auth.in}
|
|
206
|
+
</span>
|
|
207
|
+
</pre>
|
|
208
|
+
</React.Fragment>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (isApiKey) {
|
|
213
|
+
const { name, key, type, scopes, ...rest } = auth;
|
|
214
|
+
return (
|
|
215
|
+
<React.Fragment key={auth.key}>
|
|
216
|
+
<pre
|
|
217
|
+
style={{
|
|
218
|
+
display: "flex",
|
|
219
|
+
flexDirection: "column",
|
|
220
|
+
background: "var(--openapi-card-background-color)",
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<span>
|
|
224
|
+
<strong>
|
|
225
|
+
{translate({
|
|
226
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
227
|
+
message: "name:",
|
|
228
|
+
})}
|
|
229
|
+
</strong>{" "}
|
|
230
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
231
|
+
</span>
|
|
232
|
+
<span>
|
|
233
|
+
<strong>
|
|
234
|
+
{translate({
|
|
235
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
236
|
+
message: "type:",
|
|
237
|
+
})}
|
|
238
|
+
</strong>{" "}
|
|
239
|
+
{type}
|
|
240
|
+
</span>
|
|
241
|
+
{scopes && scopes.length > 0 && (
|
|
242
|
+
<span>
|
|
243
|
+
<strong>
|
|
244
|
+
{translate({
|
|
245
|
+
id: OPENAPI_SECURITY_SCHEMES.SCOPES,
|
|
246
|
+
message: "scopes:",
|
|
247
|
+
})}
|
|
248
|
+
</strong>{" "}
|
|
249
|
+
<code>
|
|
250
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
251
|
+
</code>
|
|
252
|
+
</span>
|
|
253
|
+
)}
|
|
254
|
+
{renderRest(rest)}
|
|
255
|
+
</pre>
|
|
256
|
+
</React.Fragment>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (isOauth2) {
|
|
261
|
+
const { name, key, type, scopes, flows, ...rest } = auth;
|
|
262
|
+
return (
|
|
263
|
+
<React.Fragment key={selected}>
|
|
264
|
+
<pre
|
|
265
|
+
style={{
|
|
266
|
+
display: "flex",
|
|
267
|
+
flexDirection: "column",
|
|
268
|
+
background: "var(--openapi-card-background-color)",
|
|
269
|
+
}}
|
|
270
|
+
>
|
|
271
|
+
<span>
|
|
272
|
+
<strong>
|
|
273
|
+
{translate({
|
|
274
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
275
|
+
message: "name:",
|
|
276
|
+
})}
|
|
277
|
+
</strong>{" "}
|
|
278
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
279
|
+
</span>
|
|
280
|
+
<span>
|
|
281
|
+
<strong>
|
|
282
|
+
{translate({
|
|
283
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
284
|
+
message: "type:",
|
|
285
|
+
})}
|
|
286
|
+
</strong>{" "}
|
|
287
|
+
{type}
|
|
288
|
+
</span>
|
|
289
|
+
{scopes && scopes.length > 0 && (
|
|
290
|
+
<span>
|
|
291
|
+
<strong>
|
|
292
|
+
{translate({
|
|
293
|
+
id: OPENAPI_SECURITY_SCHEMES.SCOPES,
|
|
294
|
+
message: "scopes:",
|
|
295
|
+
})}
|
|
296
|
+
</strong>{" "}
|
|
297
|
+
<code>
|
|
298
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
299
|
+
</code>
|
|
300
|
+
</span>
|
|
301
|
+
)}
|
|
302
|
+
{renderRest(rest)}
|
|
303
|
+
{flows && (
|
|
304
|
+
<span>
|
|
305
|
+
<code>
|
|
306
|
+
<strong>
|
|
307
|
+
{translate({
|
|
308
|
+
id: OPENAPI_SECURITY_SCHEMES.FLOWS,
|
|
309
|
+
message: "flows:",
|
|
310
|
+
})}
|
|
311
|
+
</strong>{" "}
|
|
312
|
+
{JSON.stringify(flows, null, 2)}
|
|
313
|
+
</code>
|
|
314
|
+
</span>
|
|
315
|
+
)}
|
|
316
|
+
</pre>
|
|
317
|
+
</React.Fragment>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (isOpenId) {
|
|
322
|
+
const { name, key, scopes, type, ...rest } = auth;
|
|
323
|
+
return (
|
|
324
|
+
<React.Fragment key={auth.key}>
|
|
325
|
+
<pre
|
|
326
|
+
style={{
|
|
327
|
+
display: "flex",
|
|
328
|
+
flexDirection: "column",
|
|
329
|
+
background: "var(--openapi-card-background-color)",
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<span>
|
|
333
|
+
<strong>
|
|
334
|
+
{translate({
|
|
335
|
+
id: OPENAPI_SECURITY_SCHEMES.NAME,
|
|
336
|
+
message: "name:",
|
|
337
|
+
})}
|
|
338
|
+
</strong>{" "}
|
|
339
|
+
<Link to={infoAuthPath}>{name ?? key}</Link>
|
|
340
|
+
</span>
|
|
341
|
+
<span>
|
|
342
|
+
<strong>
|
|
343
|
+
{translate({
|
|
344
|
+
id: OPENAPI_SECURITY_SCHEMES.TYPE,
|
|
345
|
+
message: "type:",
|
|
346
|
+
})}
|
|
347
|
+
</strong>{" "}
|
|
348
|
+
{type}
|
|
349
|
+
</span>
|
|
350
|
+
{scopes && scopes.length > 0 && (
|
|
351
|
+
<span>
|
|
352
|
+
<strong>
|
|
353
|
+
{translate({
|
|
354
|
+
id: OPENAPI_SECURITY_SCHEMES.SCOPES,
|
|
355
|
+
message: "scopes:",
|
|
356
|
+
})}
|
|
357
|
+
</strong>{" "}
|
|
358
|
+
<code>
|
|
359
|
+
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
|
360
|
+
</code>
|
|
361
|
+
</span>
|
|
362
|
+
)}
|
|
363
|
+
{renderRest(rest)}
|
|
364
|
+
</pre>
|
|
365
|
+
</React.Fragment>
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return undefined;
|
|
370
|
+
})}
|
|
371
|
+
</details>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export default SecuritySchemes;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.openapi-explorer__server-container {
|
|
2
|
+
background: var(--openapi-card-background-color);
|
|
3
|
+
border-radius: var(--openapi-card-border-radius);
|
|
4
|
+
color: var(--ifm-pre-color);
|
|
5
|
+
line-height: var(--ifm-pre-line-height);
|
|
6
|
+
margin-bottom: var(--ifm-spacing-vertical);
|
|
7
|
+
margin-top: 0;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
|
|
10
|
+
/* hack for view calculation when monaco is hidden */
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
&:empty {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.openapi-explorer__server-url {
|
|
19
|
+
font-size: var(--openapi-explorer-font-size-input);
|
|
20
|
+
font-family: var(--ifm-font-family-monospace);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.openapi-explorer__server-description {
|
|
24
|
+
padding-left: 0.5rem;
|
|
25
|
+
font-weight: var(--ifm-font-weight-bold);
|
|
26
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
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, { useState } from "react";
|
|
9
|
+
|
|
10
|
+
import { translate } from "@docusaurus/Translate";
|
|
11
|
+
import FloatingButton from "@theme/ApiExplorer/FloatingButton";
|
|
12
|
+
import FormItem from "@theme/ApiExplorer/FormItem";
|
|
13
|
+
import FormSelect from "@theme/ApiExplorer/FormSelect";
|
|
14
|
+
import FormTextInput from "@theme/ApiExplorer/FormTextInput";
|
|
15
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
16
|
+
import { OPENAPI_SERVER } from "@theme/translationIds";
|
|
17
|
+
|
|
18
|
+
import { setServer, setServerVariable } from "./slice";
|
|
19
|
+
|
|
20
|
+
function Server() {
|
|
21
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
22
|
+
const value = useTypedSelector((state: any) => state.server.value);
|
|
23
|
+
const options = useTypedSelector((state: any) => state.server.options);
|
|
24
|
+
const dispatch = useTypedDispatch();
|
|
25
|
+
|
|
26
|
+
if (options.length <= 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (options.length < 1 && value?.variables === undefined) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!value) {
|
|
35
|
+
const defaultOption = options[0];
|
|
36
|
+
dispatch(setServer(JSON.stringify(defaultOption)));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Default to first option when existing server state is mismatched
|
|
40
|
+
if (value) {
|
|
41
|
+
const urlExists = options.find((s: any) => s.url === value.url);
|
|
42
|
+
if (!urlExists) {
|
|
43
|
+
const defaultOption = options[0];
|
|
44
|
+
dispatch(setServer(JSON.stringify(defaultOption)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!isEditing) {
|
|
49
|
+
let url = "";
|
|
50
|
+
if (value) {
|
|
51
|
+
url = value.url.replace(/\/$/, "");
|
|
52
|
+
if (value.variables) {
|
|
53
|
+
Object.keys(value.variables).forEach((variable) => {
|
|
54
|
+
url = url.replace(
|
|
55
|
+
`{${variable}}`,
|
|
56
|
+
value.variables?.[variable].default ?? ""
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<FloatingButton
|
|
63
|
+
onClick={() => setIsEditing(true)}
|
|
64
|
+
label={translate({ id: OPENAPI_SERVER.EDIT_BUTTON, message: "Edit" })}
|
|
65
|
+
>
|
|
66
|
+
<FormItem>
|
|
67
|
+
<span className="openapi-explorer__server-url" title={url}>
|
|
68
|
+
{url}
|
|
69
|
+
</span>
|
|
70
|
+
</FormItem>
|
|
71
|
+
</FloatingButton>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return (
|
|
75
|
+
<div className="openapi-explorer__server-container">
|
|
76
|
+
<FloatingButton
|
|
77
|
+
onClick={() => setIsEditing(false)}
|
|
78
|
+
label={translate({ id: OPENAPI_SERVER.HIDE_BUTTON, message: "Hide" })}
|
|
79
|
+
>
|
|
80
|
+
<FormItem>
|
|
81
|
+
<FormSelect
|
|
82
|
+
options={options.map((s: any) => s.url)}
|
|
83
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
84
|
+
dispatch(
|
|
85
|
+
setServer(
|
|
86
|
+
JSON.stringify(
|
|
87
|
+
options.filter((s: any) => s.url === e.target.value)[0]
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
}}
|
|
92
|
+
value={value?.url}
|
|
93
|
+
/>
|
|
94
|
+
<small className="openapi-explorer__server-description">
|
|
95
|
+
{value?.description}
|
|
96
|
+
</small>
|
|
97
|
+
</FormItem>
|
|
98
|
+
{value?.variables &&
|
|
99
|
+
Object.keys(value.variables).map((key) => {
|
|
100
|
+
if (value.variables?.[key].enum !== undefined) {
|
|
101
|
+
return (
|
|
102
|
+
<FormItem label={key}>
|
|
103
|
+
<FormSelect
|
|
104
|
+
options={value.variables[key].enum}
|
|
105
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
106
|
+
dispatch(
|
|
107
|
+
setServerVariable(
|
|
108
|
+
JSON.stringify({ key, value: e.target.value })
|
|
109
|
+
)
|
|
110
|
+
);
|
|
111
|
+
}}
|
|
112
|
+
value={value?.variables[key].default}
|
|
113
|
+
/>
|
|
114
|
+
</FormItem>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return (
|
|
118
|
+
<FormItem label={key}>
|
|
119
|
+
<FormTextInput
|
|
120
|
+
placeholder={value.variables?.[key].default}
|
|
121
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
122
|
+
dispatch(
|
|
123
|
+
setServerVariable(
|
|
124
|
+
JSON.stringify({ key, value: e.target.value })
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
}}
|
|
128
|
+
value={value?.variables?.[key].default}
|
|
129
|
+
/>
|
|
130
|
+
</FormItem>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
133
|
+
</FloatingButton>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default Server;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { ServerObject } from "@camunda8/docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
10
|
+
// TODO: we might want to export this
|
|
11
|
+
|
|
12
|
+
export interface State {
|
|
13
|
+
value?: ServerObject;
|
|
14
|
+
options: ServerObject[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const initialState: State = {} as any;
|
|
18
|
+
|
|
19
|
+
export const slice = createSlice({
|
|
20
|
+
name: "server",
|
|
21
|
+
initialState,
|
|
22
|
+
reducers: {
|
|
23
|
+
setServer: (state, action: PayloadAction<string>) => {
|
|
24
|
+
state.value = state.options.find(
|
|
25
|
+
(s) => s.url === JSON.parse(action.payload).url
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
setServerVariable: (state, action: PayloadAction<string>) => {
|
|
29
|
+
if (state.value?.variables) {
|
|
30
|
+
const parsedPayload = JSON.parse(action.payload);
|
|
31
|
+
state.value.variables[parsedPayload.key].default = parsedPayload.value;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const { setServer, setServerVariable } = slice.actions;
|
|
38
|
+
|
|
39
|
+
export default slice.reducer;
|