@mintlify/msft-sdk 1.1.23 → 1.1.24
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/dist/api-playground/ApiPlayground/Request/BodySection.js +65 -0
- package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +33 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +201 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +147 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +31 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/index.js +44 -0
- package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +94 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +91 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +63 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +34 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +110 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +88 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +55 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +68 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +45 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +7 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +45 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +54 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +15 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js +14 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +12 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +20 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +21 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +93 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/index.js +80 -0
- package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +24 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +45 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js +18 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +40 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +44 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +45 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +39 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +129 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +60 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js +16 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +29 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +20 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +163 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +59 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js +50 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js +40 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +27 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +53 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground/ApiPlayground/index.js +68 -0
- package/dist/api-playground/ApiPlayground/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +51 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +20 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +19 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +29 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +6 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +13 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/Description.js +13 -0
- package/dist/api-playground/EndpointFields/components/Description.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +20 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +36 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +44 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -0
- package/dist/api-playground/EndpointFields/index.js +7 -0
- package/dist/api-playground/EndpointFields/index.js.map +1 -0
- package/dist/api-playground-2/Api.js +13 -0
- package/dist/api-playground-2/Api.js.map +1 -0
- package/dist/api-playground-2/ApiExamples.js +19 -18
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/ApiFields.js +253 -0
- package/dist/api-playground-2/ApiFields.js.map +1 -0
- package/dist/api-playground-2/EndpointHeader.js +52 -0
- package/dist/api-playground-2/EndpointHeader.js.map +1 -0
- package/dist/api-playground-2/OperationPage.js +101 -0
- package/dist/api-playground-2/OperationPage.js.map +1 -0
- package/dist/api-playground-2/Playground.js +136 -0
- package/dist/api-playground-2/Playground.js.map +1 -0
- package/dist/api-playground-2/SchemaPage.js +14 -0
- package/dist/api-playground-2/SchemaPage.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +16 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +21 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +57 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +122 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +75 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +253 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +28 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +101 -114
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Request/BodySection.js +41 -0
- package/dist/api-playground-2/components/Request/BodySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js +66 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js +36 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js +55 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/ServerSection.js +33 -0
- package/dist/api-playground-2/components/Request/ServerSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +55 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +48 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +43 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +127 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js +15 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +46 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +104 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +77 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +54 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +44 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +29 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground-2/components/TypeDropdown.js +48 -0
- package/dist/api-playground-2/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground-2/constants/index.js +6 -4
- package/dist/api-playground-2/constants/index.js.map +1 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +11 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -0
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +6 -6
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippet.js +187 -36
- package/dist/api-playground-2/generators/generateSnippet.js.map +1 -1
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +14 -0
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js +101 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +156 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +57 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/processExamples.js +41 -8
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +107 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/utils.js +195 -43
- package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
- package/dist/api-playground-2/types/index.js +118 -0
- package/dist/api-playground-2/types/index.js.map +1 -0
- package/dist/common/guards.js +32 -6
- package/dist/common/guards.js.map +1 -1
- package/dist/common/potentiallyParseOpenApiString.js +25 -0
- package/dist/common/potentiallyParseOpenApiString.js.map +1 -0
- package/dist/common/replaceSlashIndex.js +7 -0
- package/dist/common/replaceSlashIndex.js.map +1 -0
- package/dist/common/slugToTitle.js +11 -0
- package/dist/common/slugToTitle.js.map +1 -0
- package/dist/components/Api/Expandable.js +119 -0
- package/dist/components/Api/Expandable.js.map +1 -0
- package/dist/components/Api/Markdown.js +66 -0
- package/dist/components/Api/Markdown.js.map +1 -0
- package/dist/components/Api/Param.js +191 -0
- package/dist/components/Api/Param.js.map +1 -0
- package/dist/components/content-components/code-block.js +68 -61
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/code-group.js +36 -25
- package/dist/components/content-components/code-group.js.map +1 -1
- package/dist/components/content-components/getNodeText.js +5 -0
- package/dist/components/content-components/getNodeText.js.map +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/zIndex.js +7 -0
- package/dist/constants/zIndex.js.map +1 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js +18 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js.map +1 -0
- package/dist/contexts/ConfigContext.js +2 -3
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/contexts/EndpointLocationContext.js +18 -0
- package/dist/contexts/EndpointLocationContext.js.map +1 -0
- package/dist/contexts/MDXContentContext.js +19 -0
- package/dist/contexts/MDXContentContext.js.map +1 -0
- package/dist/env.js +6 -1
- package/dist/env.js.map +1 -1
- package/dist/hooks/useApiPlaygroundInputs.js +7 -0
- package/dist/hooks/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +40 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +1 -0
- package/dist/hooks/useBaseUrlOptions.js +19 -0
- package/dist/hooks/useBaseUrlOptions.js.map +1 -0
- package/dist/hooks/useCheckHash.js +18 -0
- package/dist/hooks/useCheckHash.js.map +1 -0
- package/dist/hooks/useComponentSchemas.js +10 -0
- package/dist/hooks/useComponentSchemas.js.map +1 -0
- package/dist/hooks/useCurrentPath.js +17 -0
- package/dist/hooks/useCurrentPath.js.map +1 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useExpandableMemory.js +46 -0
- package/dist/hooks/useExpandableMemory.js.map +1 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js +12 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js.map +1 -0
- package/dist/hooks/useGenerateNextItems.js +12 -0
- package/dist/hooks/useGenerateNextItems.js.map +1 -0
- package/dist/hooks/useGenerateNextProperties.js +12 -0
- package/dist/hooks/useGenerateNextProperties.js.map +1 -0
- package/dist/hooks/useKeyboardShortcut.js +26 -0
- package/dist/hooks/useKeyboardShortcut.js.map +1 -0
- package/dist/hooks/useMDXContent.js +7 -0
- package/dist/hooks/useMDXContent.js.map +1 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +10 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js +43 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/index.js +66 -0
- package/dist/hooks/usePrefilledInputs/index.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +30 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -0
- package/dist/hooks/useSecurityOption.js +11 -0
- package/dist/hooks/useSecurityOption.js.map +1 -0
- package/dist/hooks/useSendPlaygroundRequest.js +146 -15
- package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
- package/dist/hooks/useSetDefaultValue.js +64 -0
- package/dist/hooks/useSetDefaultValue.js.map +1 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +143 -108
- package/dist/index.js.map +1 -1
- package/dist/openapi/filterEnums.js +21 -0
- package/dist/openapi/filterEnums.js.map +1 -0
- package/dist/openapi/generateNextAdditionalProperties.js +8 -0
- package/dist/openapi/generateNextAdditionalProperties.js.map +1 -0
- package/dist/openapi/generateNextItems.js +8 -0
- package/dist/openapi/generateNextItems.js.map +1 -0
- package/dist/openapi/generateNextProperties.js +24 -0
- package/dist/openapi/generateNextProperties.js.map +1 -0
- package/dist/openapi/generateOptionLabels.js +21 -0
- package/dist/openapi/generateOptionLabels.js.map +1 -0
- package/dist/openapi/generateSimpleLabels.js +5 -0
- package/dist/openapi/generateSimpleLabels.js.map +1 -0
- package/dist/openapi/generateTypeStringFromSchema.js +34 -0
- package/dist/openapi/generateTypeStringFromSchema.js.map +1 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js +19 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js.map +1 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js +22 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js +7 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js +7 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js.map +1 -0
- package/dist/utils/api-playground/defaults.js +16 -0
- package/dist/utils/api-playground/defaults.js.map +1 -0
- package/dist/utils/api-playground/paramFieldDefaults.js +11 -0
- package/dist/utils/api-playground/paramFieldDefaults.js.map +1 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +5 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +1 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js +6 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js.map +1 -0
- package/dist/utils/containsMarkdownTable.js +5 -0
- package/dist/utils/containsMarkdownTable.js.map +1 -0
- package/dist/utils/copyToClipboard.js +12 -0
- package/dist/utils/copyToClipboard.js.map +1 -0
- package/dist/utils/decodeSlug.js +8 -0
- package/dist/utils/decodeSlug.js.map +1 -0
- package/dist/utils/flattenObject.js +11 -0
- package/dist/utils/flattenObject.js.map +1 -0
- package/dist/utils/formatJSON.js +39 -0
- package/dist/utils/formatJSON.js.map +1 -0
- package/dist/utils/optionallyAddLeadingSlash.js +7 -0
- package/dist/utils/optionallyAddLeadingSlash.js.map +1 -0
- package/dist/utils/scrollElementIntoView.js +21 -0
- package/dist/utils/scrollElementIntoView.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useMemo as u } from "react";
|
|
3
|
+
import { InputSectionContainer as x } from "../components/InputSectionContainer.js";
|
|
4
|
+
import { TypeDropdown as T } from "../components/TypeDropdown.js";
|
|
5
|
+
import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
|
|
6
|
+
import { Tabs as S } from "../../../components/content-components/tabs/tabs.js";
|
|
7
|
+
import { Tab as I } from "../../../components/content-components/tabs/tab.js";
|
|
8
|
+
const k = ({ body: d, value: o, setValue: n }) => {
|
|
9
|
+
const [y, f] = a(0), [m, h] = a(0), r = u(() => Object.entries(d), [d]), s = r[m] ?? r[0];
|
|
10
|
+
if (s === void 0) return null;
|
|
11
|
+
const [b, { schemaArray: i }] = s;
|
|
12
|
+
return /* @__PURE__ */ t(
|
|
13
|
+
x,
|
|
14
|
+
{
|
|
15
|
+
name: "Body",
|
|
16
|
+
rightElement: r.length > 1 && /* @__PURE__ */ t("div", { onClick: (e) => e.stopPropagation(), className: "mint:text-xs mint:font-mono", children: /* @__PURE__ */ t(
|
|
17
|
+
T,
|
|
18
|
+
{
|
|
19
|
+
options: r.map(([e, c]) => ({
|
|
20
|
+
label: e,
|
|
21
|
+
schema: c
|
|
22
|
+
})),
|
|
23
|
+
selectedIndex: m,
|
|
24
|
+
onSelectOption: (e) => {
|
|
25
|
+
h(e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
children: i.length > 1 ? /* @__PURE__ */ t(
|
|
30
|
+
S,
|
|
31
|
+
{
|
|
32
|
+
defaultTab: y,
|
|
33
|
+
onClickTab: (e) => f(e),
|
|
34
|
+
className: "mint:mb-0!",
|
|
35
|
+
children: i.map((e, c) => {
|
|
36
|
+
const p = e.title ?? `Option ${c + 1}`;
|
|
37
|
+
return /* @__PURE__ */ t(I, { title: p, children: /* @__PURE__ */ t(
|
|
38
|
+
l,
|
|
39
|
+
{
|
|
40
|
+
schemaArray: [e],
|
|
41
|
+
value: o,
|
|
42
|
+
setValue: n,
|
|
43
|
+
clearValue: o === void 0 ? void 0 : () => n(void 0),
|
|
44
|
+
isBody: !0
|
|
45
|
+
}
|
|
46
|
+
) }, p);
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
) : /* @__PURE__ */ t(
|
|
50
|
+
l,
|
|
51
|
+
{
|
|
52
|
+
schemaArray: i,
|
|
53
|
+
value: o,
|
|
54
|
+
setValue: n,
|
|
55
|
+
clearValue: o === void 0 ? void 0 : () => n(void 0),
|
|
56
|
+
isBody: !0
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
k as BodySection
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=BodySection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodySection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/BodySection.tsx"],"sourcesContent":["'use client';\n\nimport { BodySchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport { SetStateAction, useMemo, useState } from 'react';\n\nimport { Tab, Tabs } from '@/components/content-components/tabs';\nimport { NoAnyDataSchema } from '@/hooks/usePlaygroundSchemaOptions';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { TypeDropdown } from '../components/TypeDropdown';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype BodySectionParams = {\n body: BodySchema;\n value: unknown;\n setValue: (value: unknown) => void;\n};\n\nexport const BodySection = ({ body, value, setValue }: BodySectionParams) => {\n const [selectedSchemaArrayIndex, setSelectedSchemaArrayIndex] = useState(0);\n const [selectedContentTypeIndex, setSelectedContentTypeIndex] = useState(0);\n\n const bodyArray = useMemo(() => {\n return Object.entries(body);\n }, [body]);\n\n const contentTypeAndContent = bodyArray[selectedContentTypeIndex] ?? bodyArray[0];\n if (contentTypeAndContent === undefined) return null;\n\n const [_contentType, { schemaArray }] = contentTypeAndContent;\n\n return (\n <InputSectionContainer\n name=\"Body\"\n rightElement={\n bodyArray.length > 1 && (\n <div onClick={(e) => e.stopPropagation()} className=\"mint:text-xs mint:font-mono\">\n <TypeDropdown\n options={bodyArray.map(([label, schema]) => ({\n label,\n schema: schema as unknown as NoAnyDataSchema,\n }))}\n selectedIndex={selectedContentTypeIndex}\n onSelectOption={(index) => {\n setSelectedContentTypeIndex(index);\n }}\n />\n </div>\n )\n }\n >\n {schemaArray.length > 1 ? (\n <Tabs\n defaultTab={selectedSchemaArrayIndex}\n onClickTab={(index: SetStateAction<number>) => setSelectedSchemaArrayIndex(index)}\n className=\"mint:mb-0!\"\n >\n {schemaArray.map((schema, index) => {\n const title = schema.title ?? `Option ${index + 1}`;\n return (\n <Tab key={title} title={title}>\n <RecursiveInput\n schemaArray={[schema] as DataSchemaArray | IncrementalDataSchemaArray}\n value={value}\n setValue={setValue}\n clearValue={value === undefined ? undefined : () => setValue(undefined)}\n isBody\n />\n </Tab>\n );\n })}\n </Tabs>\n ) : (\n <RecursiveInput\n schemaArray={schemaArray}\n value={value}\n setValue={setValue}\n clearValue={value === undefined ? undefined : () => setValue(undefined)}\n isBody\n />\n )}\n </InputSectionContainer>\n );\n};\n"],"names":["BodySection","body","value","setValue","selectedSchemaArrayIndex","setSelectedSchemaArrayIndex","useState","selectedContentTypeIndex","setSelectedContentTypeIndex","bodyArray","useMemo","contentTypeAndContent","_contentType","schemaArray","jsx","InputSectionContainer","TypeDropdown","label","schema","index","Tabs","title","Tab","RecursiveInput"],"mappings":";;;;;;;AAkBO,MAAMA,IAAc,CAAC,EAAE,MAAAC,GAAM,OAAAC,GAAO,UAAAC,QAAkC;AAC3E,QAAM,CAACC,GAA0BC,CAA2B,IAAIC,EAAS,CAAC,GACpE,CAACC,GAA0BC,CAA2B,IAAIF,EAAS,CAAC,GAEpEG,IAAYC,EAAQ,MACjB,OAAO,QAAQT,CAAI,GACzB,CAACA,CAAI,CAAC,GAEHU,I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ACA,UAAAC;AAAA,UACA,YAAYD,MAAU,SAAY,SAAY,MAAMC,EAAS,MAAS;AAAA,UACtE,QAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IACR;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { InputSectionContainer as h } from "../components/InputSectionContainer.js";
|
|
4
|
+
import { RecursiveInput as j } from "./inputs/RecursiveInput.js";
|
|
5
|
+
const P = ({ name: d, parameters: c, value: t, setValue: o }) => {
|
|
6
|
+
const s = p(() => Object.entries(c).map(([e, r]) => {
|
|
7
|
+
const i = t[e], m = (n) => {
|
|
8
|
+
const l = { ...t };
|
|
9
|
+
l[e] = n, o(l);
|
|
10
|
+
}, f = i === void 0 ? void 0 : () => {
|
|
11
|
+
const n = { ...t };
|
|
12
|
+
delete n[e], o(n);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ u(
|
|
15
|
+
j,
|
|
16
|
+
{
|
|
17
|
+
name: e,
|
|
18
|
+
schemaArray: r.schema,
|
|
19
|
+
style: r.style,
|
|
20
|
+
explode: r.explode,
|
|
21
|
+
value: i,
|
|
22
|
+
setValue: m,
|
|
23
|
+
clearValue: f
|
|
24
|
+
},
|
|
25
|
+
e
|
|
26
|
+
);
|
|
27
|
+
}), [c, o, t]);
|
|
28
|
+
return s.length === 0 ? null : /* @__PURE__ */ u(h, { name: d, children: s });
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
P as ParameterSection
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ParameterSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterSection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/ParameterSection.tsx"],"sourcesContent":["'use client';\n\nimport { ParameterGroup } from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype ParameterSectionParams = {\n name: string;\n parameters: ParameterGroup;\n value: Record<string, unknown>;\n setValue: (value: Record<string, unknown>) => void;\n};\n\nexport const ParameterSection = ({ name, parameters, value, setValue }: ParameterSectionParams) => {\n const inputs = useMemo(() => {\n return Object.entries(parameters).map(([paramName, parameter]) => {\n const paramValue = value[paramName];\n const setParamValue = (newParamValue: unknown) => {\n const newObj = { ...value };\n newObj[paramName] = newParamValue;\n setValue(newObj);\n };\n\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = { ...value };\n delete newObj[paramName];\n setValue(newObj);\n };\n\n return (\n <RecursiveInput\n key={paramName}\n name={paramName}\n schemaArray={parameter.schema}\n style={parameter.style}\n explode={parameter.explode}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n });\n }, [parameters, setValue, value]);\n\n if (inputs.length === 0) {\n return null;\n }\n\n return <InputSectionContainer name={name}>{inputs}</InputSectionContainer>;\n};\n"],"names":["ParameterSection","name","parameters","value","setValue","inputs","useMemo","paramName","parameter","paramValue","setParamValue","newParamValue","newObj","clearParamValue","jsx","RecursiveInput","InputSectionContainer"],"mappings":";;;;AAeO,MAAMA,IAAmB,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,OAAAC,GAAO,UAAAC,QAAuC;AACjG,QAAMC,IAASC,EAAQ,MACd,OAAO,QAAQJ,CAAU,EAAE,IAAI,CAAC,CAACK,GAAWC,CAAS,MAAM;AAChE,UAAMC,IAAaN,EAAMI,CAAS,GAC5BG,IAAgB,CAACC,MAA2B;AAChD,YAAMC,IAAS,EAAE,GAAGT,EAAA;AACpB,MAAAS,EAAOL,CAAS,IAAII,GACpBP,EAASQ,CAAM;AAAA,IACjB,GAEMC,IACJJ,MAAe,SACX,SACA,MAAM;AACJ,YAAMG,IAAS,EAAE,GAAGT,EAAA;AACpB,aAAOS,EAAOL,CAAS,GACvBH,EAASQ,CAAM;AAAA,IACjB;AAEN,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,MAAMR;AAAA,QACN,aAAaC,EAAU;AAAA,QACvB,OAAOA,EAAU;AAAA,QACjB,SAASA,EAAU;AAAA,QACnB,OAAOC;AAAA,QACP,UAAUC;AAAA,QACV,YAAYG;AAAA,MAAA;AAAA,MAPPN;AAAA,IAAA;AAAA,EAUX,CAAC,GACA,CAACL,GAAYE,GAAUD,CAAK,CAAC;AAEhC,SAAIE,EAAO,WAAW,IACb,OAGF,gBAAAS,EAACE,GAAA,EAAsB,MAAAf,GAAa,UAAAI,EAAA,CAAO;AACpD;"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useContext as C, useEffect as B } from "react";
|
|
3
|
+
import { DescriptionWithoutHeaders as J } from "../../EndpointFields/components/Description.js";
|
|
4
|
+
import { useApiPlaygroundPrefillExamples as H } from "../../../hooks/useApiPlaygroundPrefillExamples.js";
|
|
5
|
+
import { useMDXContent as I } from "../../../hooks/useMDXContent.js";
|
|
6
|
+
import { parseAuthInputsFromUserInfo as R } from "../../../hooks/usePrefilledInputs/index.js";
|
|
7
|
+
import { useSecurityOption as G } from "../../../hooks/useSecurityOption.js";
|
|
8
|
+
import { getDefaultsFromParameterGroup as U, getDefaultFromSchema as W } from "../../../utils/api-playground/defaults.js";
|
|
9
|
+
import { paramFieldDefaults as w } from "../../../utils/api-playground/paramFieldDefaults.js";
|
|
10
|
+
import { getFilteredSecurityOptions as Q } from "../../../utils/api-reference/getFilteredSecurityOptions.js";
|
|
11
|
+
import "@mintlify/validation";
|
|
12
|
+
import { cn as X } from "../../../utils/cn.js";
|
|
13
|
+
import { ApiPlaygroundContext as z } from "../ApiPlaygroundContext.js";
|
|
14
|
+
import { Response as P } from "../Response/index.js";
|
|
15
|
+
import { EndpointsMenu as K } from "../components/EndpointsMenu.js";
|
|
16
|
+
import { PathHeader as L, SendPill as T } from "../components/PathHeader.js";
|
|
17
|
+
import { PlaygroundModalWrapper as Y } from "../components/PlaygroundModalWrapper.js";
|
|
18
|
+
import { BodySection as Z } from "./BodySection.js";
|
|
19
|
+
import { ParameterSection as y } from "./ParameterSection.js";
|
|
20
|
+
import { SecuritySection as _ } from "./SecuritySection.js";
|
|
21
|
+
import { ServerSection as $ } from "./ServerSection.js";
|
|
22
|
+
import { ApiExamples as ee } from "../../../api-playground-2/ApiExamples.js";
|
|
23
|
+
function Ne({
|
|
24
|
+
endpoint: t,
|
|
25
|
+
inputs: a,
|
|
26
|
+
setInputs: m
|
|
27
|
+
}) {
|
|
28
|
+
var k;
|
|
29
|
+
const [{ pageMetadata: b }] = I(), [v, j] = V(0), { prefillExamplesEnabled: f, generatedRequestExampleData: p } = H(), S = G(t.request.security), {
|
|
30
|
+
isSending: A,
|
|
31
|
+
selectedBaseUrlIndex: E,
|
|
32
|
+
isPlaygroundExpanded: g,
|
|
33
|
+
setIsPlaygroundExpanded: D,
|
|
34
|
+
sendRequest: F,
|
|
35
|
+
result: l,
|
|
36
|
+
selectedExampleIndex: d
|
|
37
|
+
} = C(z), h = (k = t.servers) == null ? void 0 : k[E], q = Q(t), M = q[v], n = h == null ? void 0 : h.variables;
|
|
38
|
+
return B(() => {
|
|
39
|
+
var N;
|
|
40
|
+
if (!g) return;
|
|
41
|
+
const e = f ? p[d ?? 0] : JSON.parse(JSON.stringify(a));
|
|
42
|
+
if (n) {
|
|
43
|
+
const i = {};
|
|
44
|
+
Object.entries(n).forEach(([o, c]) => {
|
|
45
|
+
e.server[o] === void 0 && (i[o] = String(c.default));
|
|
46
|
+
}), e.server = { ...e.server, ...i };
|
|
47
|
+
}
|
|
48
|
+
[
|
|
49
|
+
["header", t.request.parameters.header],
|
|
50
|
+
["path", t.request.parameters.path],
|
|
51
|
+
["query", t.request.parameters.query],
|
|
52
|
+
["cookie", t.request.parameters.cookie]
|
|
53
|
+
].forEach(([i, o]) => {
|
|
54
|
+
var O;
|
|
55
|
+
const c = f ? (O = p[d ?? 0]) == null ? void 0 : O[i] : U(o);
|
|
56
|
+
e[i] = {
|
|
57
|
+
...c,
|
|
58
|
+
...w[i],
|
|
59
|
+
...e[i]
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const x = R(
|
|
63
|
+
S
|
|
64
|
+
);
|
|
65
|
+
e.query = { ...e.query, ...x.query }, e.header = { ...e.header, ...x.header }, e.cookie = { ...e.cookie, ...x.cookie };
|
|
66
|
+
const u = Object.values(t.request.body)[0];
|
|
67
|
+
if (u != null && u.schemaArray.length) {
|
|
68
|
+
const i = f ? (N = p[d ?? 0]) == null ? void 0 : N.body : W(u.schemaArray[0]), o = w.body;
|
|
69
|
+
if (typeof i == "object" && i !== null)
|
|
70
|
+
e.body = Object.assign(
|
|
71
|
+
{},
|
|
72
|
+
i,
|
|
73
|
+
o,
|
|
74
|
+
typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {}
|
|
75
|
+
);
|
|
76
|
+
else if (Object.keys(o).length) {
|
|
77
|
+
const c = typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {};
|
|
78
|
+
e.body = { ...o, ...c };
|
|
79
|
+
} else e.body === void 0 && i !== void 0 && (e.body = i);
|
|
80
|
+
}
|
|
81
|
+
JSON.stringify(e) !== JSON.stringify(a) && m(e);
|
|
82
|
+
}, [g, t, d, S]), /* @__PURE__ */ s(
|
|
83
|
+
Y,
|
|
84
|
+
{
|
|
85
|
+
isPlaygroundExpanded: g,
|
|
86
|
+
setIsPlaygroundExpanded: D,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ s("div", { className: "mint:flex mint:items-center mint:justify-between mint:gap-x-2", children: [
|
|
89
|
+
/* @__PURE__ */ r(K, { endpoint: t }),
|
|
90
|
+
/* @__PURE__ */ r(L, { endpoint: t, hasGrayBackground: !0, display: "interactive" }),
|
|
91
|
+
/* @__PURE__ */ r(
|
|
92
|
+
T,
|
|
93
|
+
{
|
|
94
|
+
label: "Send",
|
|
95
|
+
method: t.method,
|
|
96
|
+
isSending: A,
|
|
97
|
+
onClick: F,
|
|
98
|
+
className: "mint:w-20"
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ s("div", { className: "mint:grid mint:grid-cols-1 mint:lg:grid-cols-5 mint:gap-x-8 mint:gap-y-6 mint:mt-5 mint:relative", children: [
|
|
103
|
+
/* @__PURE__ */ s("div", { className: "mint:col-span-1 mint:lg:col-span-3", children: [
|
|
104
|
+
/* @__PURE__ */ s("div", { className: "mint:space-y-1 mint:min-w-full mint:w-full mint:max-w-full mint:overflow-hidden", children: [
|
|
105
|
+
/* @__PURE__ */ r("div", { className: "mint:text-base mint:font-medium mint:text-gray-900 mint:dark:text-white mint:max-w-full", children: t.title }),
|
|
106
|
+
/* @__PURE__ */ r("div", { className: "mint:flex mint:items-start mint:gap-x-12 mint:justify-between mint:max-w-full! mint:overflow-x-auto", children: b.description && /* @__PURE__ */ r(
|
|
107
|
+
J,
|
|
108
|
+
{
|
|
109
|
+
markdown: b.description,
|
|
110
|
+
className: "mint:text-sm mint:text-gray-500 mint:dark:text-gray-400"
|
|
111
|
+
}
|
|
112
|
+
) })
|
|
113
|
+
] }),
|
|
114
|
+
l && /* @__PURE__ */ r(P, { result: l, className: "mint:mt-6 mint:block mint:lg:hidden" }),
|
|
115
|
+
/* @__PURE__ */ s("div", { className: "mint:space-y-2 mint:mt-6", children: [
|
|
116
|
+
n && Object.keys(n).length > 0 && /* @__PURE__ */ r(
|
|
117
|
+
$,
|
|
118
|
+
{
|
|
119
|
+
variables: n,
|
|
120
|
+
value: a.server,
|
|
121
|
+
setValue: (e) => m({ ...a, server: e })
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
M && /* @__PURE__ */ r(
|
|
125
|
+
_,
|
|
126
|
+
{
|
|
127
|
+
inputs: a,
|
|
128
|
+
setInputs: m,
|
|
129
|
+
securityOptions: q,
|
|
130
|
+
selectedSecurityOptionIndex: v,
|
|
131
|
+
setSelectedSecurityOptionIndex: j
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ r(
|
|
135
|
+
y,
|
|
136
|
+
{
|
|
137
|
+
name: "Header",
|
|
138
|
+
value: a.header,
|
|
139
|
+
setValue: (e) => m({ ...a, header: e }),
|
|
140
|
+
parameters: t.request.parameters.header
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ r(
|
|
144
|
+
y,
|
|
145
|
+
{
|
|
146
|
+
name: "Cookie",
|
|
147
|
+
value: a.cookie,
|
|
148
|
+
setValue: (e) => m({ ...a, cookie: e }),
|
|
149
|
+
parameters: t.request.parameters.cookie
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ r(
|
|
153
|
+
y,
|
|
154
|
+
{
|
|
155
|
+
name: "Path",
|
|
156
|
+
value: a.path,
|
|
157
|
+
setValue: (e) => m({ ...a, path: e }),
|
|
158
|
+
parameters: t.request.parameters.path
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ r(
|
|
162
|
+
y,
|
|
163
|
+
{
|
|
164
|
+
name: "Query",
|
|
165
|
+
value: a.query,
|
|
166
|
+
setValue: (e) => m({ ...a, query: e }),
|
|
167
|
+
parameters: t.request.parameters.query
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ r(
|
|
171
|
+
Z,
|
|
172
|
+
{
|
|
173
|
+
value: a.body,
|
|
174
|
+
setValue: (e) => m({ ...a, body: e }),
|
|
175
|
+
body: t.request.body
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] })
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ s(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
className: X(
|
|
184
|
+
"mint:p-px mint:col-span-1 mint:lg:col-span-2 mint:lg:space-y-6 mint:lg:flex mint:lg:sticky mint:lg:top-0 mint:lg:self-start mint:lg:h-[calc(100vh-5.5rem)]",
|
|
185
|
+
l && "mint:lg:flex-col mint:overflow-y-auto mint:lg:-top-12 mint:lg:h-screen"
|
|
186
|
+
),
|
|
187
|
+
children: [
|
|
188
|
+
l && /* @__PURE__ */ r(P, { result: l, className: "mint:hidden mint:lg:block mint:min-h-fit" }),
|
|
189
|
+
/* @__PURE__ */ r(ee, { isModal: !0, "data-testid": "api-playground-request-example", className: "mint:xl:w-full" })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
Ne as PlaygroundModal
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=PlaygroundModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaygroundModal.js","sources":["../../../../src/api-playground/ApiPlayground/Request/PlaygroundModal.tsx"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundInputs, Endpoint } from '@mintlify/validation';\nimport { useContext, useState, useEffect } from 'react';\n\nimport { DescriptionWithoutHeaders } from '@/api-playground/EndpointFields/components/Description';\nimport { useApiPlaygroundPrefillExamples } from '@/hooks/useApiPlaygroundPrefillExamples';\nimport { useMDXContent } from '@/hooks/useMDXContent';\nimport { parseAuthInputsFromUserInfo } from '@/hooks/usePrefilledInputs';\nimport { useSecurityOption } from '@/hooks/useSecurityOption';\nimport {\n getDefaultsFromParameterGroup,\n getDefaultFromSchema,\n} from '@/utils/api-playground/defaults';\nimport { paramFieldDefaults } from '@/utils/api-playground/paramFieldDefaults';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { ApiPlaygroundContext } from '../ApiPlaygroundContext';\nimport { Response } from '../Response';\nimport { EndpointsMenu } from '../components/EndpointsMenu';\nimport { PathHeader, SendPill } from '../components/PathHeader';\nimport { PlaygroundModalWrapper } from '../components/PlaygroundModalWrapper';\nimport { BodySection } from './BodySection';\nimport { ParameterSection } from './ParameterSection';\nimport { SecuritySection } from './SecuritySection';\nimport { ServerSection } from './ServerSection';\nimport ApiExamples from '@/api-playground-2/ApiExamples';\n\nexport function PlaygroundModal({\n endpoint,\n inputs,\n setInputs,\n}: {\n endpoint: Endpoint;\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n}) {\n const [{ pageMetadata }] = useMDXContent();\n const [selectedSecurityOptionIndex, setSelectedSecurityOptionIndex] = useState(0);\n const { prefillExamplesEnabled, generatedRequestExampleData } = useApiPlaygroundPrefillExamples();\n const securityOption = useSecurityOption(endpoint.request.security);\n\n const {\n isSending,\n selectedBaseUrlIndex,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded,\n sendRequest,\n result,\n selectedExampleIndex,\n } = useContext(ApiPlaygroundContext);\n const server = endpoint.servers?.[selectedBaseUrlIndex];\n\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n const selectedSecurityOption = filteredSecurityOptions[selectedSecurityOptionIndex];\n\n const variables = server?.variables;\n\n useEffect(() => {\n if (!isPlaygroundExpanded) return;\n\n const nextInputs: ApiPlaygroundInputs = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]\n : JSON.parse(JSON.stringify(inputs));\n\n if (variables) {\n const serverDefaults: Record<string, string> = {};\n Object.entries(variables).forEach(([k, v]) => {\n if (nextInputs.server[k] === undefined) {\n serverDefaults[k] = String(v.default);\n }\n });\n nextInputs.server = { ...nextInputs.server, ...serverDefaults };\n }\n\n const paramSections: Array<\n ['header' | 'path' | 'query' | 'cookie', typeof endpoint.request.parameters.header]\n > = [\n ['header', endpoint.request.parameters.header],\n ['path', endpoint.request.parameters.path],\n ['query', endpoint.request.parameters.query],\n ['cookie', endpoint.request.parameters.cookie],\n ];\n\n paramSections.forEach(([section, group]) => {\n const spec = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]?.[section]\n : getDefaultsFromParameterGroup(group);\n\n nextInputs[section] = {\n ...spec,\n ...paramFieldDefaults[section],\n ...nextInputs[section],\n };\n });\n\n const userInfoAuthInputs = parseAuthInputsFromUserInfo(\n securityOption,\n undefined\n );\n\n nextInputs.query = { ...nextInputs.query, ...userInfoAuthInputs.query };\n nextInputs.header = { ...nextInputs.header, ...userInfoAuthInputs.header };\n nextInputs.cookie = { ...nextInputs.cookie, ...userInfoAuthInputs.cookie };\n\n const bodyEntry = Object.values(endpoint.request.body)[0];\n if (bodyEntry?.schemaArray.length) {\n const bodyDefaultFromSpec = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]?.body\n : getDefaultFromSchema(bodyEntry.schemaArray[0]);\n\n const bodyDefaultsFromParamField: Record<string, unknown> = paramFieldDefaults.body;\n\n if (typeof bodyDefaultFromSpec === 'object' && bodyDefaultFromSpec !== null) {\n nextInputs.body = Object.assign(\n {},\n bodyDefaultFromSpec,\n bodyDefaultsFromParamField,\n typeof nextInputs.body === 'object' &&\n nextInputs.body !== null &&\n !Array.isArray(nextInputs.body)\n ? nextInputs.body\n : {}\n );\n } else if (Object.keys(bodyDefaultsFromParamField).length) {\n const existingBody =\n typeof nextInputs.body === 'object' &&\n nextInputs.body !== null &&\n !Array.isArray(nextInputs.body)\n ? nextInputs.body\n : {};\n nextInputs.body = { ...bodyDefaultsFromParamField, ...existingBody };\n } else if (nextInputs.body === undefined && bodyDefaultFromSpec !== undefined) {\n nextInputs.body = bodyDefaultFromSpec;\n }\n }\n\n if (JSON.stringify(nextInputs) !== JSON.stringify(inputs)) {\n setInputs(nextInputs);\n }\n }, [isPlaygroundExpanded, endpoint, selectedExampleIndex, securityOption]);\n\n return (\n <PlaygroundModalWrapper\n isPlaygroundExpanded={isPlaygroundExpanded}\n setIsPlaygroundExpanded={setIsPlaygroundExpanded}\n >\n <div className=\"mint:flex mint:items-center mint:justify-between mint:gap-x-2\">\n <EndpointsMenu endpoint={endpoint} />\n <PathHeader endpoint={endpoint} hasGrayBackground display=\"interactive\" />\n <SendPill\n label=\"Send\"\n method={endpoint.method}\n isSending={isSending}\n onClick={sendRequest}\n className=\"mint:w-20\"\n />\n </div>\n <div className=\"mint:grid mint:grid-cols-1 mint:lg:grid-cols-5 mint:gap-x-8 mint:gap-y-6 mint:mt-5 mint:relative\">\n <div className=\"mint:col-span-1 mint:lg:col-span-3\">\n <div className=\"mint:space-y-1 mint:min-w-full mint:w-full mint:max-w-full mint:overflow-hidden\">\n <div className=\"mint:text-base mint:font-medium mint:text-gray-900 mint:dark:text-white mint:max-w-full\">\n {endpoint.title}\n </div>\n <div className=\"mint:flex mint:items-start mint:gap-x-12 mint:justify-between mint:max-w-full! mint:overflow-x-auto\">\n {pageMetadata.description && (\n <DescriptionWithoutHeaders\n markdown={pageMetadata.description}\n className=\"mint:text-sm mint:text-gray-500 mint:dark:text-gray-400\"\n />\n )}\n </div>\n </div>\n {result && <Response result={result} className=\"mint:mt-6 mint:block mint:lg:hidden\" />}\n <div className=\"mint:space-y-2 mint:mt-6\">\n {variables && Object.keys(variables).length > 0 && (\n <ServerSection\n variables={variables}\n value={inputs.server}\n setValue={(server) => setInputs({ ...inputs, server })}\n />\n )}\n {selectedSecurityOption && (\n <SecuritySection\n inputs={inputs}\n setInputs={setInputs}\n securityOptions={filteredSecurityOptions}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n setSelectedSecurityOptionIndex={setSelectedSecurityOptionIndex}\n />\n )}\n <ParameterSection\n name=\"Header\"\n value={inputs.header}\n setValue={(header) => setInputs({ ...inputs, header })}\n parameters={endpoint.request.parameters.header}\n />\n <ParameterSection\n name=\"Cookie\"\n value={inputs.cookie}\n setValue={(cookie) => setInputs({ ...inputs, cookie })}\n parameters={endpoint.request.parameters.cookie}\n />\n <ParameterSection\n name=\"Path\"\n value={inputs.path}\n setValue={(path) => setInputs({ ...inputs, path })}\n parameters={endpoint.request.parameters.path}\n />\n <ParameterSection\n name=\"Query\"\n value={inputs.query}\n setValue={(query) => setInputs({ ...inputs, query })}\n parameters={endpoint.request.parameters.query}\n />\n <BodySection\n value={inputs.body}\n setValue={(body) => setInputs({ ...inputs, body })}\n body={endpoint.request.body}\n />\n </div>\n </div>\n <div\n className={cn(\n 'mint:p-px mint:col-span-1 mint:lg:col-span-2 mint:lg:space-y-6 mint:lg:flex mint:lg:sticky mint:lg:top-0 mint:lg:self-start mint:lg:h-[calc(100vh-5.5rem)]',\n result && 'mint:lg:flex-col mint:overflow-y-auto mint:lg:-top-12 mint:lg:h-screen'\n )}\n >\n {result && <Response result={result} className=\"mint:hidden mint:lg:block mint:min-h-fit\" />}\n <ApiExamples isModal data-testid=\"api-playground-request-example\" className=\"mint:xl:w-full\" />\n </div>\n </div>\n </PlaygroundModalWrapper>\n );\n}\n"],"names":["PlaygroundModal","endpoint","inputs","setInputs","pageMetadata","useMDXContent","selectedSecurityOptionIndex","setSelectedSecurityOptionIndex","useState","prefillExamplesEnabled","generatedRequestExampleData","useApiPlaygroundPrefillExamples","securityOption","useSecurityOption","isSending","selectedBaseUrlIndex","isPlaygroundExpanded","setIsPlaygroundExpanded","sendRequest","result","selectedExampleIndex","useContext","ApiPlaygroundContext","server","_a","filteredSecurityOptions","getFilteredSecurityOptions","selectedSecurityOption","variables","useEffect","nextInputs","serverDefaults","k","v","section","group","spec","getDefaultsFromParameterGroup","paramFieldDefaults","userInfoAuthInputs","parseAuthInputsFromUserInfo","bodyEntry","bodyDefaultFromSpec","getDefaultFromSchema","bodyDefaultsFromParamField","existingBody","jsxs","PlaygroundModalWrapper","jsx","EndpointsMenu","PathHeader","SendPill","DescriptionWithoutHeaders","Response","ServerSection","SecuritySection","ParameterSection","header","cookie","path","query","BodySection","body","cn","ApiExamples"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BO,SAASA,GAAgB;AAAA,E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A;AAAA,cAAA;AAAA,cAE1C,gBAAA+C;AAAA,gBAACQ;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,OAAOtD,EAAO;AAAA,kBACd,UAAU,CAAC0D,MAAUzD,EAAU,EAAE,GAAGD,GAAQ,OAAA0D,GAAO;AAAA,kBACnD,YAAY3D,EAAS,QAAQ,WAAW;AAAA,gBAAA;AAAA,cAAA;AAAA,cAE1C,gBAAA+C;AAAA,gBAACa;AAAA,gBAAA;AAAA,kBACC,OAAO3D,EAAO;AAAA,kBACd,UAAU,CAAC4D,MAAS3D,EAAU,EAAE,GAAGD,GAAQ,MAAA4D,GAAM;AAAA,kBACjD,MAAM7D,EAAS,QAAQ;AAAA,gBAAA;AAAA,cAAA;AAAA,YACzB,EAAA,CACF;AAAA,UAAA,GACF;AAAA,UACA,gBAAA6C;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWiB;AAAA,gBACT;AAAA,gBACA5C,KAAU;AAAA,cAAA;AAAA,cAGX,UAAA;AAAA,gBAAAA,KAAU,gBAAA6B,EAACK,GAAA,EAAS,QAAAlC,GAAgB,WAAU,4CAA2C;AAAA,kCACzF6C,IAAA,EAAY,SAAO,IAAC,eAAY,kCAAiC,WAAU,iBAAA,CAAiB;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC/F,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as y } from "react";
|
|
3
|
+
import "@mintlify/validation";
|
|
4
|
+
import { cn as b } from "../../../utils/cn.js";
|
|
5
|
+
import { InputSectionContainer as g } from "../components/InputSectionContainer.js";
|
|
6
|
+
import { TypeDropdown as w } from "../components/TypeDropdown.js";
|
|
7
|
+
import { RecursiveInput as P } from "./inputs/RecursiveInput.js";
|
|
8
|
+
const B = "Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.", S = "Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.", V = "The access token received from the authorization server in the OAuth 2.0 flow.", M = ({
|
|
9
|
+
inputs: e,
|
|
10
|
+
setInputs: t,
|
|
11
|
+
securityOptions: o,
|
|
12
|
+
selectedSecurityOptionIndex: s,
|
|
13
|
+
setSelectedSecurityOptionIndex: c
|
|
14
|
+
}) => {
|
|
15
|
+
const n = o[s], h = y(() => n ? ["header", "query", "cookie"].flatMap(
|
|
16
|
+
(r) => Object.entries(n.parameters[r]).map(([i, f]) => {
|
|
17
|
+
const {
|
|
18
|
+
schemaArray: p,
|
|
19
|
+
transform: l,
|
|
20
|
+
value: u
|
|
21
|
+
} = j(f, e[r][i]);
|
|
22
|
+
return /* @__PURE__ */ d(
|
|
23
|
+
P,
|
|
24
|
+
{
|
|
25
|
+
name: i,
|
|
26
|
+
schemaArray: p,
|
|
27
|
+
value: u,
|
|
28
|
+
setValue: (a) => {
|
|
29
|
+
const m = {
|
|
30
|
+
...e,
|
|
31
|
+
[r]: { ...e[r] }
|
|
32
|
+
};
|
|
33
|
+
m[r][i] = l(a), t(m);
|
|
34
|
+
},
|
|
35
|
+
clearValue: u === void 0 ? void 0 : () => {
|
|
36
|
+
const a = {
|
|
37
|
+
...e,
|
|
38
|
+
[r]: { ...e[r] }
|
|
39
|
+
};
|
|
40
|
+
delete a[r][i], t(a);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
`${r}:${i}`
|
|
44
|
+
);
|
|
45
|
+
})
|
|
46
|
+
) : null, [n, t, e]);
|
|
47
|
+
return /* @__PURE__ */ d(
|
|
48
|
+
g,
|
|
49
|
+
{
|
|
50
|
+
name: "Authorization",
|
|
51
|
+
rightElement: /* @__PURE__ */ d(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
onClick: (r) => r.stopPropagation(),
|
|
55
|
+
className: b("mint:text-xs mint:font-mono", o.length <= 1 && "mint:hidden"),
|
|
56
|
+
children: /* @__PURE__ */ d(
|
|
57
|
+
w,
|
|
58
|
+
{
|
|
59
|
+
options: o.map((r) => ({
|
|
60
|
+
label: r.title,
|
|
61
|
+
schema: r
|
|
62
|
+
})),
|
|
63
|
+
selectedIndex: s,
|
|
64
|
+
onSelectOption: (r) => {
|
|
65
|
+
c(r);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
children: h
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}, j = (e, t) => ({
|
|
75
|
+
schemaArray: x(e),
|
|
76
|
+
transform: A(e),
|
|
77
|
+
value: q(e, t)
|
|
78
|
+
}), x = (e) => {
|
|
79
|
+
const t = k(e);
|
|
80
|
+
switch (e.type) {
|
|
81
|
+
case "apiKey":
|
|
82
|
+
return [
|
|
83
|
+
{
|
|
84
|
+
type: "string",
|
|
85
|
+
required: !0,
|
|
86
|
+
description: t,
|
|
87
|
+
default: e["x-default"]
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
case "http":
|
|
91
|
+
return e.scheme === "basic" ? [
|
|
92
|
+
{
|
|
93
|
+
type: "object",
|
|
94
|
+
required: !0,
|
|
95
|
+
description: t,
|
|
96
|
+
properties: {
|
|
97
|
+
username: [{ type: "string" }],
|
|
98
|
+
password: [{ type: "string" }]
|
|
99
|
+
},
|
|
100
|
+
additionalProperties: !1,
|
|
101
|
+
default: e["x-default"]
|
|
102
|
+
}
|
|
103
|
+
] : [
|
|
104
|
+
{
|
|
105
|
+
type: "string",
|
|
106
|
+
required: !0,
|
|
107
|
+
format: "bearer",
|
|
108
|
+
description: t,
|
|
109
|
+
default: e["x-default"]
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
case "oauth2":
|
|
113
|
+
return [
|
|
114
|
+
{
|
|
115
|
+
type: "string",
|
|
116
|
+
required: !0,
|
|
117
|
+
format: "bearer",
|
|
118
|
+
description: t
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
}, k = (e) => {
|
|
123
|
+
switch (e.type) {
|
|
124
|
+
case "apiKey":
|
|
125
|
+
return e.description;
|
|
126
|
+
case "http":
|
|
127
|
+
return e.description ?? (e.scheme === "basic" ? B : S);
|
|
128
|
+
case "oauth2":
|
|
129
|
+
return e.description ?? V;
|
|
130
|
+
}
|
|
131
|
+
}, q = (e, t) => {
|
|
132
|
+
if (e.type !== "http" || e.scheme !== "basic" || typeof t != "string" || !t.startsWith("Basic "))
|
|
133
|
+
return t;
|
|
134
|
+
const o = t.slice(6), s = Buffer.from(o, "base64").toString("utf-8"), [c, n] = s.split(":");
|
|
135
|
+
return { username: c, password: n };
|
|
136
|
+
}, A = (e) => e.type !== "http" || e.scheme !== "basic" ? (t) => t : (t) => {
|
|
137
|
+
const o = t && typeof t == "object" && "username" in t ? t.username : void 0, s = t && typeof t == "object" && "password" in t ? t.password : void 0, c = `${o ?? ""}:${s ?? ""}`;
|
|
138
|
+
return `Basic ${Buffer.from(c).toString("base64")}`;
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
M as SecuritySection,
|
|
142
|
+
B as basicDescription,
|
|
143
|
+
S as bearerDescription,
|
|
144
|
+
k as getDescriptionForSecurityParameter,
|
|
145
|
+
V as oauth2Description
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=SecuritySection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecuritySection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/SecuritySection.tsx"],"sourcesContent":["'use client';\n\nimport {\n ApiPlaygroundInputs,\n DataSchemaArray,\n SecurityOption,\n SecurityParameterSchema,\n} from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { NoAnyDataSchema } from '@/hooks/usePlaygroundSchemaOptions';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { TypeDropdown } from '../components/TypeDropdown';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\nexport const basicDescription =\n 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.';\nexport const bearerDescription =\n 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.';\nexport const oauth2Description =\n 'The access token received from the authorization server in the OAuth 2.0 flow.';\n\ntype SecuritySectionParams = {\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n securityOptions: SecurityOption[];\n selectedSecurityOptionIndex: number;\n setSelectedSecurityOptionIndex: (index: number) => void;\n};\n\nexport const SecuritySection = ({\n inputs,\n setInputs,\n securityOptions,\n selectedSecurityOptionIndex,\n setSelectedSecurityOptionIndex,\n}: SecuritySectionParams) => {\n const selectedSecurityOption = securityOptions[selectedSecurityOptionIndex];\n\n const parameters = useMemo(() => {\n if (!selectedSecurityOption) return null;\n\n return (['header', 'query', 'cookie'] as const).flatMap((location) =>\n Object.entries(selectedSecurityOption.parameters[location]).map(([name, parameter]) => {\n const {\n schemaArray,\n transform,\n value: paramValue,\n } = getPropsForParameter(parameter, inputs[location][name]);\n\n const setParamValue = (paramValue: unknown) => {\n const newObj = {\n ...inputs,\n [location]: { ...inputs[location] },\n };\n newObj[location][name] = transform(paramValue);\n setInputs(newObj);\n };\n\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = {\n ...inputs,\n [location]: { ...inputs[location] },\n };\n delete newObj[location][name];\n setInputs(newObj);\n };\n\n return (\n <RecursiveInput\n name={name}\n key={`${location}:${name}`}\n schemaArray={schemaArray}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n })\n );\n }, [selectedSecurityOption, setInputs, inputs]);\n\n return (\n <InputSectionContainer\n name=\"Authorization\"\n rightElement={\n <div\n onClick={(e) => e.stopPropagation()}\n className={cn('mint:text-xs mint:font-mono', securityOptions.length <= 1 && 'mint:hidden')}\n >\n <TypeDropdown\n options={securityOptions.map((option) => ({\n label: option.title,\n \n schema: option as unknown as NoAnyDataSchema,\n }))}\n selectedIndex={selectedSecurityOptionIndex}\n onSelectOption={(index) => {\n setSelectedSecurityOptionIndex(index);\n }}\n />\n </div>\n }\n >\n {parameters}\n </InputSectionContainer>\n );\n};\n\nconst getPropsForParameter = (parameter: SecurityParameterSchema, value: unknown) => {\n return {\n schemaArray: getSchemaArrayForParameter(parameter),\n transform: getTransformForParameter(parameter),\n value: parseValueForParameter(parameter, value),\n };\n};\n\nconst getSchemaArrayForParameter = (parameter: SecurityParameterSchema): DataSchemaArray => {\n const description = getDescriptionForSecurityParameter(parameter);\n switch (parameter.type) {\n case 'apiKey':\n return [\n {\n type: 'string',\n required: true,\n description,\n \n default: parameter['x-default' as never],\n },\n ];\n case 'http':\n return parameter.scheme === 'basic'\n ? [\n {\n type: 'object',\n required: true,\n description,\n properties: {\n username: [{ type: 'string' }],\n password: [{ type: 'string' }],\n },\n additionalProperties: false,\n \n default: parameter['x-default' as never],\n },\n ]\n : [\n {\n type: 'string',\n required: true,\n format: 'bearer',\n description,\n \n default: parameter['x-default' as never],\n },\n ];\n case 'oauth2':\n return [\n {\n type: 'string',\n required: true,\n format: 'bearer',\n description,\n },\n ];\n }\n};\n\nexport const getDescriptionForSecurityParameter = (\n parameter: SecurityParameterSchema\n): string | undefined => {\n switch (parameter.type) {\n case 'apiKey':\n return parameter.description;\n case 'http':\n return (\n parameter.description ??\n (parameter.scheme === 'basic' ? basicDescription : bearerDescription)\n );\n case 'oauth2':\n return parameter.description ?? oauth2Description;\n }\n};\n\nconst parseValueForParameter = (parameter: SecurityParameterSchema, value: unknown) => {\n if (\n parameter.type !== 'http' ||\n parameter.scheme !== 'basic' ||\n typeof value !== 'string' ||\n !value.startsWith('Basic ')\n )\n return value;\n\n const encoded = value.slice('Basic '.length);\n const decoded = Buffer.from(encoded, 'base64').toString('utf-8');\n const [username, password] = decoded.split(':');\n return { username, password };\n};\n\nconst getTransformForParameter = (parameter: SecurityParameterSchema) => {\n if (parameter.type !== 'http' || parameter.scheme !== 'basic') {\n return (value: unknown) => value;\n }\n\n return (value: unknown) => {\n const username =\n value && typeof value === 'object' && 'username' in value ? value['username'] : undefined;\n const password =\n value && typeof value === 'object' && 'password' in value ? value['password'] : undefined;\n const unencoded = `${username ?? ''}:${password ?? ''}`;\n const encoded = Buffer.from(unencoded).toString('base64');\n return `Basic ${encoded}`;\n };\n};\n"],"names":["basicDescription","bearerDescription","oauth2Description","SecuritySection","inputs","setInputs","securityOptions","selectedSecurityOptionIndex","setSelectedSecurityOptionIndex","selectedSecurityOption","parameters","useMemo","location","name","parameter","schemaArray","transform","paramValue","getPropsForParameter","jsx","RecursiveInput","newObj","InputSectionContainer","e","cn","TypeDropdown","option","index","value","getSchemaArrayForParameter","getTransformForParameter","parseValueForParameter","description","getDescriptionForSecurityParameter","encoded","decoded","username","password","unencoded"],"mappings":";;;;;;;AAiBO,MAAMA,IACX,8IACWC,IACX,kGACWC,IACX,kFAUWC,IAAkB,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,gCAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAyBH,EAAgBC,CAA2B,GAEpEG,IAAaC,EAAQ,MACpBF,IAEG,CAAC,UAAU,SAAS,QAAQ,EAAY;AAAA,IAAQ,CAACG,MACvD,OAAO,QAAQH,EAAuB,WAAWG,CAAQ,CAAC,EAAE,IAAI,CAAC,CAACC,GAAMC,CAAS,MAAM;AACrF,YAAM;AAAA,QACJ,aAAAC;AAAA,QACA,WAAAC;AAAA,QACA,OAAOC;AAAA,MAAA,IACLC,EAAqBJ,GAAWV,EAAOQ,CAAQ,EAAEC,CAAI,CAAC;AAuB1D,aACE,gBAAAM;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAAP;AAAA,UAEA,aAAAE;AAAA,UACA,OAAOE;AAAA,UACP,UA3BkB,CAACA,MAAwB;AAC7C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WAAW,WACrB,OAAOc,KAAU,YACjB,CAACA,EAAM,WAAW,QAAQ;AAE1B,WAAOA;AAET,QAAMM,IAAUN,EAAM,MAAM,CAAe,GACrCO,IAAU,OAAO,KAAKD,GAAS,QAAQ,EAAE,SAAS,OAAO,GACzD,CAACE,GAAUC,CAAQ,IAAIF,EAAQ,MAAM,GAAG;AAC9C,SAAO,EAAE,UAAAC,GAAU,UAAAC,EAAA;AACrB,GAEMP,IAA2B,CAAChB,MAC5BA,EAAU,SAAS,UAAUA,EAAU,WAAW,UAC7C,CAACc,MAAmBA,IAGtB,CAACA,MAAmB;AACzB,QAAMQ,IACJR,KAAS,OAAOA,KAAU,YAAY,cAAcA,IAAQA,EAAM,WAAc,QAC5ES,IACJT,KAAS,OAAOA,KAAU,YAAY,cAAcA,IAAQA,EAAM,WAAc,QAC5EU,IAAY,GAAGF,KAAY,EAAE,IAAIC,KAAY,EAAE;AAErD,SAAO,SADS,OAAO,KAAKC,CAAS,EAAE,SAAS,QAAQ,CACjC;AACzB;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import { InputSectionContainer as p } from "../components/InputSectionContainer.js";
|
|
4
|
+
import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
|
|
5
|
+
const O = ({ variables: o, value: e, setValue: n }) => {
|
|
6
|
+
const i = u(() => Object.entries(o).map(([r, s]) => {
|
|
7
|
+
const a = e[r];
|
|
8
|
+
return /* @__PURE__ */ c(
|
|
9
|
+
l,
|
|
10
|
+
{
|
|
11
|
+
name: r,
|
|
12
|
+
schemaArray: [s],
|
|
13
|
+
value: a,
|
|
14
|
+
setValue: (t) => {
|
|
15
|
+
const m = { ...e };
|
|
16
|
+
m[r] = String(t), n(m);
|
|
17
|
+
},
|
|
18
|
+
clearValue: a === void 0 ? void 0 : () => {
|
|
19
|
+
const t = { ...e };
|
|
20
|
+
delete t[r], n(t);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
r
|
|
24
|
+
);
|
|
25
|
+
}), [o, n, e]);
|
|
26
|
+
return /* @__PURE__ */ c(p, { name: "Server", children: i });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
O as ServerSection
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ServerSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerSection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/ServerSection.tsx"],"sourcesContent":["'use client';\n\nimport { Server } from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype ServerSectionProps = {\n variables: NonNullable<Server['variables']>;\n value: Record<string, string>;\n setValue: (value: Record<string, string>) => void;\n};\n\nexport const ServerSection = ({ variables, value, setValue }: ServerSectionProps) => {\n const inputs = useMemo(() => {\n return Object.entries(variables).map(([key, schema]) => {\n const paramValue = value[key];\n const setParamValue = (newParamValue: unknown) => {\n const newObj = { ...value };\n newObj[key] = String(newParamValue);\n setValue(newObj);\n };\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = { ...value };\n delete newObj[key];\n setValue(newObj);\n };\n\n return (\n <RecursiveInput\n key={key}\n name={key}\n schemaArray={[schema]}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n });\n }, [variables, setValue, value]);\n\n return <InputSectionContainer name=\"Server\">{inputs}</InputSectionContainer>;\n};\n"],"names":["ServerSection","variables","value","setValue","inputs","useMemo","key","schema","paramValue","jsx","RecursiveInput","newParamValue","newObj","InputSectionContainer"],"mappings":";;;;AAcO,MAAMA,IAAgB,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,UAAAC,QAAmC;AACnF,QAAMC,IAASC,EAAQ,MACd,OAAO,QAAQJ,CAAS,EAAE,IAAI,CAAC,CAACK,GAAKC,CAAM,MAAM;AACtD,UAAMC,IAAaN,EAAMI,CAAG;AAe5B,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,MAAMJ;AAAA,QACN,aAAa,CAACC,CAAM;AAAA,QACpB,OAAOC;AAAA,QACP,UApBkB,CAACG,MAA2B;AAChD,gBAAMC,IAAS,EAAE,GAAGV,EAAA;AACpB,UAAAU,EAAON,CAAG,IAAI,OAAOK,CAAa,GAClCR,EAASS,CAAM;AAAA,QACjB;AAAA,QAiBI,YAfFJ,MAAe,SACX,SACA,MAAM;AACJ,gBAAMI,IAAS,EAAE,GAAGV,EAAA;AACpB,iBAAOU,EAAON,CAAG,GACjBH,EAASS,CAAM;AAAA,QACjB;AAAA,MASU;AAAA,MALPN;AAAA,IAAA;AAAA,EAQX,CAAC,GACA,CAACL,GAAWE,GAAUD,CAAK,CAAC;AAE/B,SAAO,gBAAAO,EAACI,GAAA,EAAsB,MAAK,UAAU,UAAAT,GAAO;AACtD;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as d } from "react";
|
|
3
|
+
import { usePrefilledInputs as f } from "../../../hooks/usePrefilledInputs/index.js";
|
|
4
|
+
import { useSecurityOption as a } from "../../../hooks/useSecurityOption.js";
|
|
5
|
+
import p from "../../../components/Api/ErrorBoundary.js";
|
|
6
|
+
import "@mintlify/validation";
|
|
7
|
+
import { cn as x } from "../../../utils/cn.js";
|
|
8
|
+
import { ApiPlaygroundContext as b } from "../ApiPlaygroundContext.js";
|
|
9
|
+
import { EndpointHeader as g } from "../components/PathHeader.js";
|
|
10
|
+
import { PlaygroundModal as k } from "./PlaygroundModal.js";
|
|
11
|
+
const U = ({ endpoint: r, inputs: i, setInputs: m, display: n }) => {
|
|
12
|
+
var l;
|
|
13
|
+
const { selectedBaseUrlIndex: s, setIsPlaygroundExpanded: o } = d(b), t = (l = r.servers) == null ? void 0 : l[s], u = a(r.request.security);
|
|
14
|
+
return f({
|
|
15
|
+
inputs: i,
|
|
16
|
+
setInputs: m,
|
|
17
|
+
baseUrl: t == null ? void 0 : t.url,
|
|
18
|
+
securityOption: u,
|
|
19
|
+
userInfoInputs: void 0
|
|
20
|
+
}), /* @__PURE__ */ e(p, { children: /* @__PURE__ */ c(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: x(
|
|
24
|
+
"mint:flex mint:w-full mint:flex-col mint:bg-background-light mint:dark:bg-background-dark mint:border-standard mint:rounded-2xl",
|
|
25
|
+
n === "simple" ? "mint:p-1" : "mint:p-1.5"
|
|
26
|
+
),
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ e(
|
|
29
|
+
g,
|
|
30
|
+
{
|
|
31
|
+
endpoint: r,
|
|
32
|
+
display: n,
|
|
33
|
+
onClickInteractive: () => o == null ? void 0 : o(!0)
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ e(k, { endpoint: r, inputs: i, setInputs: m })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
) });
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
U as Request
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/api-playground/ApiPlayground/Request/index.tsx"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { ApiPlaygroundInputs, Endpoint } from '@mintlify/validation';\nimport { useContext } from 'react';\n\nimport { usePrefilledInputs } from '@/hooks/usePrefilledInputs';\nimport { useSecurityOption } from '@/hooks/useSecurityOption';\nimport ErrorBoundary from '@/components/Api/ErrorBoundary';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { ApiPlaygroundContext } from '../ApiPlaygroundContext';\nimport { EndpointHeader } from '../components/PathHeader';\nimport { PlaygroundModal } from './PlaygroundModal';\n\ntype RequestParams = {\n endpoint: Endpoint;\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n display: ApiPlaygroundDisplayType;\n};\n\nexport const Request = ({ endpoint, inputs, setInputs, display }: RequestParams) => {\n const { selectedBaseUrlIndex, setIsPlaygroundExpanded } = useContext(ApiPlaygroundContext);\n const server = endpoint.servers?.[selectedBaseUrlIndex];\n\n const securityOption = useSecurityOption(endpoint.request.security);\n usePrefilledInputs({\n inputs,\n setInputs,\n baseUrl: server?.url,\n securityOption,\n userInfoInputs: undefined,\n });\n\n return (\n <ErrorBoundary>\n <div\n className={cn(\n 'mint:flex mint:w-full mint:flex-col mint:bg-background-light mint:dark:bg-background-dark mint:border-standard mint:rounded-2xl',\n display === 'simple' ? 'mint:p-1' : 'mint:p-1.5'\n )}\n >\n <EndpointHeader\n endpoint={endpoint}\n display={display}\n onClickInteractive={() => setIsPlaygroundExpanded?.(true)}\n />\n <PlaygroundModal endpoint={endpoint} inputs={inputs} setInputs={setInputs} />\n </div>\n </ErrorBoundary>\n );\n};\n"],"names":["Request","endpoint","inputs","setInputs","display","selectedBaseUrlIndex","setIsPlaygroundExpanded","useContext","ApiPlaygroundContext","server","_a","securityOption","useSecurityOption","usePrefilledInputs","ErrorBoundary","jsxs","cn","jsx","EndpointHeader","PlaygroundModal"],"mappings":";;;;;;;;;;AAsBO,MAAMA,IAAU,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,WAAAC,GAAW,SAAAC,QAA6B;;AAClF,QAAM,EAAE,sBAAAC,GAAsB,yBAAAC,MAA4BC,EAAWC,CAAoB,GACnFC,KAASC,IAAAT,EAAS,YAAT,gBAAAS,EAAmBL,IAE5BM,IAAiBC,EAAkBX,EAAS,QAAQ,QAAQ;AAClE,SAAAY,EAAmB;AAAA,IACjB,QAAAX;AAAA,IACA,WAAAC;AAAA,IACA,SAASM,KAAA,gBAAAA,EAAQ;AAAA,IACjB,gBAAAE;AAAA,IACA,gBAAgB;AAAA,EAAA,CACjB,qBAGEG,GAAA,EACC,UAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAZ,MAAY,WAAW,aAAa;AAAA,MAAA;AAAA,MAGtC,UAAA;AAAA,QAAA,gBAAAa;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UAAAjB;AAAA,YACA,SAAAG;AAAA,YACA,oBAAoB,MAAME,KAAA,gBAAAA,EAA0B;AAAA,UAAI;AAAA,QAAA;AAAA,QAE1D,gBAAAW,EAACE,GAAA,EAAgB,UAAAlB,GAAoB,QAAAC,GAAgB,WAAAC,EAAA,CAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAE/E;AAEJ;"}
|