@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,57 @@
|
|
|
1
|
+
import { toShikiLang as w } from "../../constants/snippetPresets.js";
|
|
2
|
+
import { mdxCodeExampleToExamples as f, getFirstWebhookExample as B } from "./processExamples.js";
|
|
3
|
+
import { getDocsJsonSecurityOptions as F } from "./processSecurityOptions.js";
|
|
4
|
+
import { generatePrefillRequestData as J } from "./utils.js";
|
|
5
|
+
const R = (a) => {
|
|
6
|
+
var p;
|
|
7
|
+
const t = ((p = a.servers) == null ? void 0 : p.map((e) => e.url)) ?? [];
|
|
8
|
+
let r;
|
|
9
|
+
return t.length > 1, r = t[0], {
|
|
10
|
+
path: a.path,
|
|
11
|
+
method: a.method,
|
|
12
|
+
title: a.title ?? "",
|
|
13
|
+
description: a.description ?? "",
|
|
14
|
+
type: a.type ?? "path",
|
|
15
|
+
baseUrl: r,
|
|
16
|
+
baseUrlOptions: t,
|
|
17
|
+
deprecated: a.deprecated
|
|
18
|
+
};
|
|
19
|
+
}, G = ({
|
|
20
|
+
pageMetadata: a,
|
|
21
|
+
apiReferenceData2: t,
|
|
22
|
+
mdxExtracts: r,
|
|
23
|
+
docsConfig: p
|
|
24
|
+
}) => {
|
|
25
|
+
var y, h, b, q, U, O, E, S, T, v, x, P, k, d, A, D;
|
|
26
|
+
const e = t ?? { operation: void 0 };
|
|
27
|
+
if (!t && (r != null && r.endpoint) && (e.operation = R(r.endpoint)), a.description && e.operation && (e.operation.description = a.description), !e.operation)
|
|
28
|
+
return e;
|
|
29
|
+
const l = (h = (y = p == null ? void 0 : p.api) == null ? void 0 : y.mdx) == null ? void 0 : h.server, i = (q = (b = p == null ? void 0 : p.api) == null ? void 0 : b.mdx) == null ? void 0 : q.auth, s = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0;
|
|
30
|
+
if (typeof l == "string" && !s ? e.operation.baseUrl = l : Array.isArray(l) && !s && (l.length > 1 ? e.operation.baseUrlOptions = l : e.operation.baseUrl = l[0]), i && Object.keys(((U = e.dependencies) == null ? void 0 : U.security) ?? {}).length === 0) {
|
|
31
|
+
const o = F({
|
|
32
|
+
method: i.method,
|
|
33
|
+
name: i.name
|
|
34
|
+
});
|
|
35
|
+
o && (e.dependencies || (e.dependencies = {
|
|
36
|
+
servers: {},
|
|
37
|
+
security: {}
|
|
38
|
+
}), e.dependencies.security = { ...o });
|
|
39
|
+
}
|
|
40
|
+
const n = (O = r == null ? void 0 : r.codeExamples) == null ? void 0 : O.request, m = (E = r == null ? void 0 : r.codeExamples) == null ? void 0 : E.response;
|
|
41
|
+
if (n)
|
|
42
|
+
e.operation.requestExamples = f(n), e.operation.requestExampleType = "mdx";
|
|
43
|
+
else if (e.operation.type === "webhook")
|
|
44
|
+
e.operation.requestExamples = B(e), e.operation.requestExampleType = "webhook";
|
|
45
|
+
else if (e.operation.codeSamples && e.operation.codeSamples.length > 0) {
|
|
46
|
+
const o = (v = (T = (S = p == null ? void 0 : p.api) == null ? void 0 : S.examples) == null ? void 0 : T.languages) == null ? void 0 : v.map(w);
|
|
47
|
+
e.operation.requestExampleType = "codeSamples", e.operation.requestExampleLanguages = o, e.operation.requiredOnlyExamples = ((P = (x = p == null ? void 0 : p.api) == null ? void 0 : x.examples) == null ? void 0 : P.defaults) === "required";
|
|
48
|
+
} else
|
|
49
|
+
e.operation.requestExampleType = "generated";
|
|
50
|
+
m ? (e.operation.responseExamples = f(m), e.operation.responseExampleType = "mdx") : e.operation.responseExampleType = "generated";
|
|
51
|
+
const L = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0, u = ((d = (k = p == null ? void 0 : p.api) == null ? void 0 : k.examples) == null ? void 0 : d.prefill) && L;
|
|
52
|
+
return u && (e.operation.prefillPlaygroundWithExample = !!u, e.operation.prefillPlaygroundExamples = J(e)), ((D = (A = p == null ? void 0 : p.api) == null ? void 0 : A.playground) == null ? void 0 : D.proxy) === !1 && (e.operation.disableProxy = !0), e;
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
G as addApiReferenceDataFromMdxAndDocsConfig
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=addApiReferenceDataFromMdxAndDocsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addApiReferenceDataFromMdxAndDocsConfig.js","sources":["../../../src/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.ts"],"sourcesContent":["import type { MdxExtracts } from '@mintlify/common';\nimport { PageMetaTags } from '@mintlify/models';\nimport { DocsConfig, Endpoint } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2, OperationV2 } from '@/api-playground-2/types';\nimport { toShikiLang } from '@/constants/snippetPresets';\n\nimport { getFirstWebhookExample, mdxCodeExampleToExamples } from './processExamples';\nimport { getDocsJsonSecurityOptions } from './processSecurityOptions';\nimport { generatePrefillRequestData } from './utils';\n\nconst mapEndpointToOperationV2 = (endpoint: Endpoint): OperationV2 => {\n const baseUrlOptions = endpoint.servers?.map((server) => server.url) ?? [];\n let baseUrl: string | undefined = undefined;\n if (baseUrlOptions.length > 1) {\n baseUrl = baseUrlOptions[0];\n } else {\n baseUrl = baseUrlOptions[0];\n }\n // ignore security options added from mdx endpoint, they are just copied from docs.json\n\n return {\n path: endpoint.path,\n method: endpoint.method,\n title: endpoint.title ?? '',\n description: endpoint.description ?? '',\n type: endpoint.type ?? 'path',\n baseUrl,\n baseUrlOptions,\n deprecated: endpoint.deprecated,\n };\n};\n\nexport const addApiReferenceDataFromMdxAndDocsConfig = ({\n pageMetadata,\n apiReferenceData2,\n mdxExtracts,\n docsConfig,\n}: {\n pageMetadata: PageMetaTags;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n mdxExtracts: MdxExtracts | undefined;\n docsConfig: DocsConfig | undefined;\n}): ApiReferenceDataV2 => {\n const apiReferenceData: ApiReferenceDataV2 = apiReferenceData2 ?? { operation: undefined };\n\n // if apiReferenceData2 is undefined, we need to add the operation from mdxExtracts\n if (!apiReferenceData2 && mdxExtracts?.endpoint) {\n apiReferenceData.operation = mapEndpointToOperationV2(mdxExtracts.endpoint);\n }\n\n // If we have a description from the frontmatter, use it instead of the OpenAPI description\n if (pageMetadata.description && apiReferenceData.operation) {\n apiReferenceData.operation.description = pageMetadata.description;\n }\n\n // now we should have a valid operationV2 either built by apiReferenceData from page props or just created from mdxExtracts\n // if there isn't, something went wrong and ngmi, operation remains undefined\n if (!apiReferenceData.operation) {\n return apiReferenceData;\n }\n\n // add docsConfig data to operation (either built by apiReferenceData from page props or just created from mdxExtracts)\n const configUrlOrUrls = docsConfig?.api?.mdx?.server;\n const configSecurity = docsConfig?.api?.mdx?.auth;\n\n // openapi servers > mdx servers > docs.json servers\n const alreadyHasServers =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n\n if (typeof configUrlOrUrls === 'string' && !alreadyHasServers) {\n apiReferenceData.operation.baseUrl = configUrlOrUrls;\n } else if (Array.isArray(configUrlOrUrls) && !alreadyHasServers) {\n if (configUrlOrUrls.length > 1) {\n apiReferenceData.operation.baseUrlOptions = configUrlOrUrls;\n } else {\n apiReferenceData.operation.baseUrl = configUrlOrUrls[0];\n }\n }\n\n if (configSecurity && Object.keys(apiReferenceData.dependencies?.security ?? {}).length === 0) {\n const docsJsonSecurityOptions = getDocsJsonSecurityOptions({\n method: configSecurity.method,\n name: configSecurity.name,\n });\n if (docsJsonSecurityOptions) {\n if (!apiReferenceData.dependencies) {\n apiReferenceData.dependencies = {\n servers: {},\n security: {},\n };\n }\n apiReferenceData.dependencies.security = { ...docsJsonSecurityOptions };\n }\n }\n\n const requestExamples = mdxExtracts?.codeExamples?.request;\n const responseExamples = mdxExtracts?.codeExamples?.response;\n\n // for examples, mdx > webhook example > codeSamples > generated\n if (requestExamples) {\n apiReferenceData.operation.requestExamples = mdxCodeExampleToExamples(requestExamples);\n apiReferenceData.operation.requestExampleType = 'mdx';\n } else {\n if (apiReferenceData.operation.type === 'webhook') {\n apiReferenceData.operation.requestExamples = getFirstWebhookExample(apiReferenceData);\n apiReferenceData.operation.requestExampleType = 'webhook';\n } else if (\n apiReferenceData.operation.codeSamples &&\n apiReferenceData.operation.codeSamples.length > 0\n ) {\n const requestExampleLanguages = docsConfig?.api?.examples?.languages?.map(toShikiLang);\n apiReferenceData.operation.requestExampleType = 'codeSamples';\n apiReferenceData.operation.requestExampleLanguages = requestExampleLanguages;\n apiReferenceData.operation.requiredOnlyExamples =\n docsConfig?.api?.examples?.defaults === 'required';\n } else {\n apiReferenceData.operation.requestExampleType = 'generated';\n }\n }\n\n if (responseExamples) {\n apiReferenceData.operation.responseExamples = mdxCodeExampleToExamples(responseExamples);\n apiReferenceData.operation.responseExampleType = 'mdx';\n } else {\n apiReferenceData.operation.responseExampleType = 'generated';\n }\n\n const hasBaseUrl =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n const prefillExamplesEnabled = docsConfig?.api?.examples?.prefill && hasBaseUrl;\n if (prefillExamplesEnabled) {\n apiReferenceData.operation.prefillPlaygroundWithExample = Boolean(prefillExamplesEnabled);\n apiReferenceData.operation.prefillPlaygroundExamples =\n generatePrefillRequestData(apiReferenceData);\n }\n\n const disableProxy = docsConfig?.api?.playground?.proxy === false;\n if (disableProxy) {\n apiReferenceData.operation.disableProxy = true;\n }\n\n return apiReferenceData;\n};\n"],"names":["mapEndpointToOperationV2","endpoint","baseUrlOptions","_a","server","baseUrl","addApiReferenceDataFromMdxAndDocsConfig","pageMetadata","apiReferenceData2","mdxExtracts","docsConfig","apiReferenceData","configUrlOrUrls","_b","configSecurity","_d","_c","alreadyHasServers","_e","docsJsonSecurityOptions","getDocsJsonSecurityOptions","requestExamples","_f","responseExamples","_g","mdxCodeExampleToExamples","getFirstWebhookExample","requestExampleLanguages","_j","_i","_h","toShikiLang","_l","_k","hasBaseUrl","prefillExamplesEnabled","_n","_m","generatePrefillRequestData","_p","_o"],"mappings":";;;;AAWA,MAAMA,IAA2B,CAACC,MAAoC;;AACpE,QAAMC,MAAiBC,IAAAF,EAAS,YAAT,gBAAAE,EAAkB,IAAI,CAACC,MAAWA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AS,GACrFwB,MAAyBC,KAAAC,IAAA3B,KAAA,gBAAAA,EAAY,QAAZ,gBAAA2B,EAAiB,aAAjB,gBAAAD,EAA2B,YAAWF;AACrE,SAAIC,MACFxB,EAAiB,UAAU,+BAA+B,EAAQwB,GAClExB,EAAiB,UAAU,4BACzB2B,EAA2B3B,CAAgB,MAG1B4B,KAAAC,IAAA9B,KAAA,gBAAAA,EAAY,QAAZ,gBAAA8B,EAAiB,eAAjB,gBAAAD,EAA6B,WAAU,OAE1D5B,EAAiB,UAAU,eAAe,KAGrCA;AACT;"}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
import "html-react-parser";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import p from "html-react-parser";
|
|
2
|
+
function m(s, t) {
|
|
3
|
+
const e = /language-(\w+)/.exec(s ?? "");
|
|
4
|
+
return e ? e[1] ?? "text" : t ?? "text";
|
|
5
|
+
}
|
|
6
|
+
const i = (s) => {
|
|
7
|
+
var o, n;
|
|
8
|
+
const t = [], e = (o = s.attributes) == null ? void 0 : o.some(
|
|
9
|
+
(a) => a.name === "dropdown" && a.value !== "false"
|
|
10
|
+
);
|
|
11
|
+
return (n = s.children) == null || n.map((a) => {
|
|
12
|
+
const r = p(a.html ?? ""), l = typeof r == "object" && !Array.isArray(r) && r.type === "pre" ? r.props.language ?? m(r.props.className, a.filename) : void 0;
|
|
13
|
+
t.push({
|
|
14
|
+
dropdown: e,
|
|
15
|
+
language: l,
|
|
16
|
+
code: r,
|
|
17
|
+
filename: a.filename
|
|
18
|
+
});
|
|
19
|
+
}), t;
|
|
20
|
+
}, u = (s) => {
|
|
21
|
+
const t = Object.keys(s)[0];
|
|
22
|
+
if (t) {
|
|
23
|
+
const e = s[t], n = Object.values((e == null ? void 0 : e.examples) ?? {})[0];
|
|
24
|
+
if (n && "value" in n)
|
|
25
|
+
return n.value;
|
|
8
26
|
}
|
|
27
|
+
}, x = (s) => {
|
|
28
|
+
var e, o;
|
|
29
|
+
const t = [];
|
|
30
|
+
if ((o = (e = s.dependencies) == null ? void 0 : e.requestBody) != null && o.content) {
|
|
31
|
+
const n = u(s.dependencies.requestBody.content);
|
|
32
|
+
n && t.push({
|
|
33
|
+
language: "json",
|
|
34
|
+
filename: "Example Request Body",
|
|
35
|
+
code: JSON.stringify(n.value, null, 2)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
9
39
|
};
|
|
10
40
|
export {
|
|
11
|
-
|
|
41
|
+
u as getFirstExampleValue,
|
|
42
|
+
x as getFirstWebhookExample,
|
|
43
|
+
m as getLanguageFromClassName,
|
|
44
|
+
i as mdxCodeExampleToExamples
|
|
12
45
|
};
|
|
13
46
|
//# sourceMappingURL=processExamples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample"],"mappings":";
|
|
1
|
+
{"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getLanguageFromClassName","className","fallback","match","mdxCodeExampleToExamples","mdxCodeExampleData","examples","dropdown","_a","attr","_b","child","jsx","parse","lang","getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample","getFirstWebhookExample","apiReferenceData","requestExamples"],"mappings":";AAaO,SAASA,EAAyBC,GAA+BC,GAA2B;AACjG,QAAMC,IAAQ,iBAAiB,KAAKF,KAAa,EAAE;AACnD,SAAOE,IAAQA,EAAM,CAAC,KAAK,SAASD,KAAY;AAClD;AAEO,MAAME,IAA2B,CAACC,MAA0D;;AACjG,QAAMC,IAA0B,CAAA,GAC1BC,KAAWC,IAAAH,EAAmB,eAAnB,gBAAAG,EAA+B;AAAA,IAC9C,CAACC,MAASA,EAAK,SAAS,cAAcA,EAAK,UAAU;AAAA;AAEvD,UAAAC,IAAAL,EAAmB,aAAnB,QAAAK,EAA6B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{
|
|
9
|
+
case "basic":
|
|
10
|
+
t = {
|
|
11
|
+
[r]: {
|
|
12
|
+
Authorization: {
|
|
13
|
+
type: "http",
|
|
14
|
+
scheme: "basic",
|
|
15
|
+
description: "Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`."
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
break;
|
|
20
|
+
case "bearer":
|
|
21
|
+
t = {
|
|
22
|
+
[r]: {
|
|
23
|
+
Authorization: {
|
|
24
|
+
type: "http",
|
|
25
|
+
scheme: "bearer",
|
|
26
|
+
description: "Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token."
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
break;
|
|
31
|
+
case "key":
|
|
32
|
+
t = {
|
|
33
|
+
[r]: {
|
|
34
|
+
Key: {
|
|
35
|
+
name: i ?? "Key",
|
|
36
|
+
type: "apiKey",
|
|
37
|
+
in: "header"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
}, b = (e) => {
|
|
45
|
+
var t;
|
|
46
|
+
const i = ((t = e.dependencies) == null ? void 0 : t.security) ?? {};
|
|
47
|
+
if (Object.keys(i).length === 0) return [];
|
|
48
|
+
const r = [];
|
|
49
|
+
return Object.entries(i).forEach(
|
|
50
|
+
([y, a]) => {
|
|
51
|
+
const s = Object.values(a)[0];
|
|
52
|
+
if (s && c.includes(s.type)) {
|
|
53
|
+
const o = h(s);
|
|
54
|
+
o && r.push({ scheme: s, schema: o });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
), r;
|
|
58
|
+
}, u = "Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.", d = "Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.", p = "The access token received from the authorization server in the OAuth 2.0 flow.", h = (e) => {
|
|
59
|
+
switch (e.type) {
|
|
60
|
+
case "apiKey":
|
|
61
|
+
return {
|
|
62
|
+
title: e.name,
|
|
63
|
+
type: "string",
|
|
64
|
+
description: e.description,
|
|
65
|
+
isRequired: !0,
|
|
66
|
+
default: e["x-default"]
|
|
67
|
+
};
|
|
68
|
+
case "http":
|
|
69
|
+
return e.scheme === "basic" ? {
|
|
70
|
+
title: "Basic Auth",
|
|
71
|
+
type: "object",
|
|
72
|
+
description: e.description ?? u,
|
|
73
|
+
isRequired: !0,
|
|
74
|
+
properties: {
|
|
75
|
+
username: { type: "string" },
|
|
76
|
+
password: { type: "string" }
|
|
77
|
+
},
|
|
78
|
+
additionalProperties: !1,
|
|
79
|
+
default: e["x-default"]
|
|
80
|
+
} : {
|
|
81
|
+
title: "Bearer Auth",
|
|
82
|
+
type: "string",
|
|
83
|
+
isRequired: !0,
|
|
84
|
+
description: e.description ?? d,
|
|
85
|
+
format: "bearer",
|
|
86
|
+
default: e["x-default"]
|
|
87
|
+
};
|
|
88
|
+
case "oauth2":
|
|
89
|
+
return {
|
|
90
|
+
title: "OAuth2 Auth",
|
|
91
|
+
type: "string",
|
|
92
|
+
isRequired: !0,
|
|
93
|
+
description: e.description ?? p,
|
|
94
|
+
format: "bearer"
|
|
95
|
+
};
|
|
96
|
+
default:
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
u as basicDescription,
|
|
102
|
+
d as bearerDescription,
|
|
103
|
+
l as getDocsJsonSecurityOptions,
|
|
104
|
+
p as oauth2Description,
|
|
105
|
+
b as processSecurityOptions
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=processSecurityOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processSecurityOptions.js","sources":["../../../src/api-playground-2/schemaGraph/processSecurityOptions.ts"],"sourcesContent":["import { UUID } from '@mintlify/validation';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n ApiReferenceDataV2,\n ResolvedSecurityObject,\n SecuritySchemeAndScope,\n ProcessedSecurityOption,\n} from '@/api-playground-2/types';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n// Ronan left TODOs for supporting openIdConnect circa 2023 (but we do support this in mcp?) & we don't support all features of oauth2 in UI yet (circa 2025, no UI for selecting scopes)\nconst supportedSecurityTypes = ['apiKey', 'http', 'oauth2'];\n\n// docs.json security types are basic = http basic, bearer = http bearer, key = apiKey - see getSecurityOptionsForAuthMethod\n// all docs.json security types go in header, but only apiKey needs to specify that in scheme\n\nexport const getDocsJsonSecurityOptions = ({\n method,\n name,\n}: {\n method: string | undefined;\n name?: string;\n}): Record<UUID, ResolvedSecurityObject> | undefined => {\n const uuid = uuidv4();\n let securityRequirement: Record<UUID, ResolvedSecurityObject> | undefined = undefined;\n switch (method) {\n case 'basic':\n securityRequirement = {\n [uuid]: {\n Authorization: {\n type: 'http',\n scheme: 'basic',\n description:\n 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.',\n },\n },\n };\n break;\n case 'bearer':\n securityRequirement = {\n [uuid]: {\n Authorization: {\n type: 'http',\n scheme: 'bearer',\n description:\n 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.',\n },\n },\n };\n break;\n case 'key':\n securityRequirement = {\n [uuid]: {\n Key: {\n name: name ?? 'Key',\n type: 'apiKey',\n in: 'header',\n },\n },\n };\n break;\n }\n return securityRequirement;\n};\n\nexport const processSecurityOptions = (\n apiReferenceData: ApiReferenceDataV2\n): ProcessedSecurityOption[] => {\n const securityOptions = apiReferenceData.dependencies?.security ?? {};\n if (Object.keys(securityOptions).length === 0) return [];\n const processedSecurityOptions: ProcessedSecurityOption[] = [];\n\n Object.entries(securityOptions).forEach(\n ([_id, securityScheme]: [UUID, ResolvedSecurityObject]) => {\n // this differs from SchemaConverter where we build the title from the security requirement scheme names\n // by converting underscore to spaces and joining with \"&\"\n // because 1. it's ugly, 2. it never dealt with camel case, and\n // 3. we either have a nice title specific to the API Key name or the scheme type consistently from OpenAPI or docs.json\n // if we really want the ugly titles back, we can uncoment this and pass it into the schemas as the title, and override the title in the heading to always be \"Authorization\" (but not the dropdown options)\n // const name = Object.keys(securityScheme)[0];\n // const title = name?.replace(/[_-]/g, ' ') ?? 'Authorization';\n const scheme = Object.values(securityScheme)[0];\n if (!scheme) return;\n // only process supported security schemes\n if (supportedSecurityTypes.includes(scheme.type)) {\n const schema = getSchemaForSecurityScheme(scheme);\n // don't add security options that don't have a schema for rendering\n if (schema) {\n processedSecurityOptions.push({ scheme, schema });\n }\n }\n }\n );\n\n return processedSecurityOptions;\n};\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\n// TODO - Api Playground Refactor: by default we add required: true to these schemas\n// not sure if we correctly handle the case where operation has\n// - security [] to override global security requirements\n// or when there is a security: [{}]\n// empty object option in array of security requirements on operation also makes it optional\nconst getSchemaForSecurityScheme = (\n scheme: SecuritySchemeAndScope\n): ResolvedSchemaObject | undefined => {\n switch (scheme.type) {\n case 'apiKey':\n return {\n title: scheme.name,\n type: 'string',\n description: scheme.description,\n isRequired: true,\n default: scheme['x-default'],\n };\n case 'http':\n return scheme.scheme === 'basic'\n ? {\n title: 'Basic Auth',\n type: 'object',\n description: scheme.description ?? basicDescription,\n isRequired: true,\n properties: {\n username: { type: 'string' },\n password: { type: 'string' },\n },\n additionalProperties: false,\n default: scheme['x-default'],\n }\n : {\n title: 'Bearer Auth',\n type: 'string',\n isRequired: true,\n description: scheme.description ?? bearerDescription,\n format: 'bearer',\n default: scheme['x-default'],\n };\n case 'oauth2':\n return {\n title: 'OAuth2 Auth',\n type: 'string',\n isRequired: true,\n description: scheme.description ?? oauth2Description,\n format: 'bearer',\n };\n default:\n return undefined;\n }\n};\n"],"names":["supportedSecurityTypes","getDocsJsonSecurityOptions","method","name","uuid","uuidv4","securityRequirement","processSecurityOptions","apiReferenceData","securityOptions","_a","processedSecurityOptions","_id","securityScheme","scheme","schema","getSchemaForSecurityScheme","basicDescription","bearerDescription","oauth2Description"],"mappings":";AAYA,MAAMA,IAAyB,CAAC,UAAU,QAAQ,QAAQ,GAK7CC,IAA6B,CAAC;AAAA,EACzC,QAAAC;AAAA,EACA,MAAAC;AACF,MAGwD;AACtD,QAAMC,IAAOC,EAAA;AACb,MAAIC;AACJ,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,MAAAI,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,eAAe;AAAA,YACb,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,MACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAE,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,eAAe;AAAA,YACb,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,MACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAE,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,KAAK;AAAA,YACH,MAAMD,KAAQ;AAAA,YACd,MAAM;AAAA,YACN,IAAI;AAAA,UAAA;AAAA,QACN;AAAA,MACF;AAEF;AAAA,EAAA;AAEJ,SAAOG;AACT,GAEaC,IAAyB,CACpCC,MAC8B;;AAC9B,QAAMC,MAAkBC,IAAAF,EAAiB,iBAAjB,gBAAAE,EAA+B,aAAY,CAAA;AACnE,MAAI,OAAO,KAAKD,CAAe,EAAE,WAAW,UAAU,CAAA;AACtD,QAAME,IAAsD,CAAA;AAE5D,gBAAO,QAAQF,CAAe,EAAE;AAAA,IAC9B,CAAC,CAACG,GAAKC,CAAc,MAAsC;AAQzD,YA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4
|
-
|
|
2
|
+
import { apiPlaygroundInputKeys as f, initialApiPlaygroundInputs as d, CIRCULAR_REF_KEY as g, stringFileFormats as b } from "../constants/index.js";
|
|
3
|
+
function C(e) {
|
|
4
|
+
return typeof e == "object" && e !== null && g in e && typeof e[g] == "string";
|
|
5
|
+
}
|
|
6
|
+
const l = (e) => typeof e == "object" && e !== null && !Array.isArray(e), p = (e) => l(e) ? "type" in e || "properties" in e || "oneOf" in e || "anyOf" in e || "allOf" in e || "items" in e || "additionalProperties" in e || "enum" in e || "const" in e || "format" in e || "pattern" in e || "minimum" in e || "maximum" in e || "minLength" in e || "maxLength" in e || "minItems" in e || "maxItems" in e || "minProperties" in e || "maxProperties" in e || "required" in e || "nullable" in e || "description" in e : !1, x = (e) => p(e) && e.type === "array", B = (e) => {
|
|
7
|
+
if (e.oneOf)
|
|
8
|
+
return "oneOf";
|
|
9
|
+
if (e.enum)
|
|
10
|
+
switch (e.type) {
|
|
11
|
+
case "string":
|
|
12
|
+
return "enum<string>";
|
|
13
|
+
case "number":
|
|
14
|
+
return "enum<number>";
|
|
15
|
+
case "integer":
|
|
16
|
+
return "enum<integer>";
|
|
17
|
+
default:
|
|
18
|
+
return e.type;
|
|
19
|
+
}
|
|
20
|
+
return e.format && b.includes(e.format) ? "file" : e.type;
|
|
21
|
+
}, K = (e) => "enum" in e && e.enum !== void 0, I = (e) => "placeholder" in e && typeof e.placeholder == "string" ? e.placeholder : void 0, S = (e) => e.type === "string", T = (e) => e.type === "number" || e.type === "integer", D = (e) => {
|
|
22
|
+
var n;
|
|
5
23
|
const t = {};
|
|
6
|
-
return Object.entries(((
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
24
|
+
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([r, s]) => {
|
|
25
|
+
var o, c;
|
|
26
|
+
const i = (c = (o = e.dependencies) == null ? void 0 : o.responses) == null ? void 0 : c[s];
|
|
27
|
+
i && i.content && (t[r] = i.content);
|
|
10
28
|
}), t;
|
|
11
|
-
},
|
|
29
|
+
}, E = (e) => {
|
|
30
|
+
var o, c, u;
|
|
31
|
+
const t = (c = (o = e.dependencies) == null ? void 0 : o.requestBody) == null ? void 0 : c.content;
|
|
32
|
+
if (t === void 0)
|
|
33
|
+
return [d];
|
|
34
|
+
const r = Object.keys(t)[0];
|
|
35
|
+
if (!r)
|
|
36
|
+
return [d];
|
|
37
|
+
const s = Object.values(((u = t[r]) == null ? void 0 : u.examples) ?? {}), i = [];
|
|
38
|
+
for (const m of s)
|
|
39
|
+
"value" in m && i.push({
|
|
40
|
+
...d,
|
|
41
|
+
body: m.value
|
|
42
|
+
});
|
|
43
|
+
return i;
|
|
44
|
+
}, R = (e) => {
|
|
45
|
+
var n;
|
|
46
|
+
const t = (n = e.dependencies) == null ? void 0 : n.parameters;
|
|
47
|
+
if (t) {
|
|
48
|
+
const r = Object.values(t), s = r.filter(
|
|
49
|
+
(u) => !("in" in u) || u.in === "header"
|
|
50
|
+
), i = r.filter((u) => u.in === "cookie"), o = r.filter((u) => u.in === "path"), c = r.filter((u) => u.in === "query");
|
|
51
|
+
return {
|
|
52
|
+
header: s,
|
|
53
|
+
path: o,
|
|
54
|
+
query: c,
|
|
55
|
+
cookie: i
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return { header: [], path: [], query: [], cookie: [] };
|
|
59
|
+
}, q = (e) => {
|
|
60
|
+
let t;
|
|
61
|
+
if (e)
|
|
62
|
+
return typeof e == "object" && "default" in e && (t = e.default), typeof e == "object" && "x-default" in e && (t = e["x-default"]), t;
|
|
63
|
+
}, h = (e, t, n, r) => {
|
|
64
|
+
if (t.uniqueKey) {
|
|
65
|
+
const s = n || r;
|
|
66
|
+
return `${e ? e + "." : ""}${t.uniqueKey}${s ? "." + s : ""}`;
|
|
67
|
+
} else
|
|
68
|
+
return e;
|
|
69
|
+
}, $ = () => ({
|
|
70
|
+
oneOf: [
|
|
71
|
+
{
|
|
72
|
+
type: "string"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "number"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "boolean"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "object",
|
|
82
|
+
properties: {}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "array",
|
|
86
|
+
items: {
|
|
87
|
+
oneOf: [
|
|
88
|
+
{ type: "string" },
|
|
89
|
+
{ type: "number" },
|
|
90
|
+
{ type: "boolean" },
|
|
91
|
+
{ type: "object", properties: {} },
|
|
92
|
+
{ type: "array", items: {} },
|
|
93
|
+
{ type: "null" }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: "null"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}), j = (e, t) => {
|
|
102
|
+
var s, i;
|
|
103
|
+
const n = (i = (s = e.dependencies) == null ? void 0 : s.requestBody) == null ? void 0 : i.content;
|
|
104
|
+
return n === void 0 ? void 0 : Object.keys(n)[t];
|
|
105
|
+
}, v = (e) => e.replace(/\./g, "\\."), L = (e) => {
|
|
106
|
+
switch (e) {
|
|
107
|
+
case "header":
|
|
108
|
+
return f.header;
|
|
109
|
+
case "path":
|
|
110
|
+
return f.path;
|
|
111
|
+
case "query":
|
|
112
|
+
return f.query;
|
|
113
|
+
case "cookie":
|
|
114
|
+
return f.cookie;
|
|
115
|
+
default:
|
|
116
|
+
return f.header;
|
|
117
|
+
}
|
|
118
|
+
}, F = (e) => {
|
|
12
119
|
const t = {
|
|
13
120
|
server: {},
|
|
14
121
|
header: {},
|
|
@@ -17,60 +124,105 @@ const p = (e) => typeof e == "object" && e !== null && !Array.isArray(e), h = (e
|
|
|
17
124
|
cookie: {},
|
|
18
125
|
body: void 0
|
|
19
126
|
};
|
|
20
|
-
return Object.entries(e).forEach(([
|
|
21
|
-
if (
|
|
127
|
+
return Object.entries(e).forEach(([n, r]) => {
|
|
128
|
+
if (r == null)
|
|
22
129
|
return;
|
|
23
|
-
const s =
|
|
130
|
+
const s = n.split(new RegExp("(?<!\\\\)\\.")).map((u) => u.replace(/\\\./g, "."));
|
|
24
131
|
if (s.length < 2) {
|
|
25
|
-
|
|
132
|
+
n === "body" && (t.body = r);
|
|
26
133
|
return;
|
|
27
134
|
}
|
|
28
|
-
const [
|
|
29
|
-
!
|
|
30
|
-
t[
|
|
31
|
-
[...
|
|
32
|
-
|
|
33
|
-
) : [...
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
36
|
-
if (!
|
|
135
|
+
const [i, ...o] = s, c = Object.values(f);
|
|
136
|
+
!i || !c.includes(i) || (i !== f.body ? O(
|
|
137
|
+
t[i],
|
|
138
|
+
[...o],
|
|
139
|
+
r
|
|
140
|
+
) : [...o].length === 0 ? t.body = r : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}), O(t.body, o, r)));
|
|
141
|
+
}), a(t);
|
|
142
|
+
}, P = (e) => {
|
|
143
|
+
if (!l(e))
|
|
37
144
|
return !1;
|
|
38
145
|
const t = Object.keys(e);
|
|
39
|
-
return t.length === 0 ? !1 : t.every((
|
|
40
|
-
},
|
|
146
|
+
return t.length === 0 ? !1 : t.every((n) => /^\d+$/.test(n));
|
|
147
|
+
}, a = (e) => {
|
|
41
148
|
if (e == null)
|
|
42
149
|
return e;
|
|
43
150
|
if (Array.isArray(e))
|
|
44
|
-
return e.map(
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
47
|
-
return Object.keys(e).sort((s,
|
|
151
|
+
return e.map(a);
|
|
152
|
+
if (l(e)) {
|
|
153
|
+
if (P(e))
|
|
154
|
+
return Object.keys(e).sort((s, i) => Number(s) - Number(i)).map((s) => e[s]).map(a);
|
|
48
155
|
const t = {};
|
|
49
|
-
for (const [
|
|
50
|
-
t[
|
|
156
|
+
for (const [n, r] of Object.entries(e))
|
|
157
|
+
t[n] = a(r);
|
|
51
158
|
return t;
|
|
52
159
|
}
|
|
53
160
|
return e;
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
for (let
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
161
|
+
}, O = (e, t, n) => {
|
|
162
|
+
const r = [];
|
|
163
|
+
for (let i = 0; i < t.length; i++) {
|
|
164
|
+
const o = t[i];
|
|
165
|
+
if (o === "oneOf") {
|
|
166
|
+
i++;
|
|
60
167
|
continue;
|
|
61
168
|
}
|
|
62
|
-
|
|
169
|
+
o === "additionalProperties" || o === "items" || o && r.push(o);
|
|
63
170
|
}
|
|
64
171
|
let s = e;
|
|
65
|
-
for (let
|
|
66
|
-
const
|
|
67
|
-
|
|
172
|
+
for (let i = 0; i < r.length; i++) {
|
|
173
|
+
const o = r[i];
|
|
174
|
+
i === r.length - 1 ? o && (s[o] = n) : (o && (!s[o] || typeof s[o] != "object") && (s[o] = {}), o && (s = s[o]));
|
|
175
|
+
}
|
|
176
|
+
}, N = (e) => e.filter((n) => "enum" in n && n.enum && "const" in n ? n.enum.includes(n.const) : !0), y = (e) => {
|
|
177
|
+
const t = {};
|
|
178
|
+
if ("uniqueKey" in e && e.uniqueKey !== void 0) {
|
|
179
|
+
const n = q(e);
|
|
180
|
+
if (n !== void 0) {
|
|
181
|
+
const r = `${f.body}.${e.uniqueKey}`;
|
|
182
|
+
t[r] = n;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if ("oneOf" in e && Array.isArray(e.oneOf) && e.oneOf.forEach((n) => {
|
|
186
|
+
if (p(n)) {
|
|
187
|
+
const r = y(n);
|
|
188
|
+
Object.assign(t, r);
|
|
189
|
+
}
|
|
190
|
+
}), e.type === "object" && e.properties && Object.values(e.properties).forEach((n) => {
|
|
191
|
+
if (p(n)) {
|
|
192
|
+
const r = y(n);
|
|
193
|
+
Object.assign(t, r);
|
|
194
|
+
}
|
|
195
|
+
}), e.additionalProperties && typeof e.additionalProperties == "object" && p(e.additionalProperties)) {
|
|
196
|
+
const n = y(e.additionalProperties);
|
|
197
|
+
Object.assign(t, n);
|
|
198
|
+
}
|
|
199
|
+
if (e.type === "array" && "items" in e && p(e.items)) {
|
|
200
|
+
const n = y(e.items);
|
|
201
|
+
Object.assign(t, n);
|
|
68
202
|
}
|
|
203
|
+
return t;
|
|
69
204
|
};
|
|
70
205
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
206
|
+
$ as convertAnySchemaToOneOfs,
|
|
207
|
+
v as escapeDots,
|
|
208
|
+
N as filterSchemasWithConsts,
|
|
209
|
+
E as generatePrefillRequestData,
|
|
210
|
+
y as getBodyDefaultsFromSchema,
|
|
211
|
+
B as getDifferentiatedType,
|
|
212
|
+
R as getParametersPerSection,
|
|
213
|
+
j as getRequestBodyContentType,
|
|
214
|
+
q as getSchemaDefault,
|
|
215
|
+
I as getSchemaPlaceholder,
|
|
216
|
+
h as getUniqueInputKey,
|
|
217
|
+
x as isArrayObject,
|
|
218
|
+
C as isCircularRef,
|
|
219
|
+
K as isEnum,
|
|
220
|
+
T as isNumberSchema,
|
|
221
|
+
l as isPlainRecord,
|
|
222
|
+
p as isSchemaObject,
|
|
223
|
+
S as isStringSchema,
|
|
224
|
+
L as mapParamInToPlaygroundInputKey,
|
|
225
|
+
D as mapResponseExamples,
|
|
226
|
+
F as unflattenInputs
|
|
75
227
|
};
|
|
76
228
|
//# sourceMappingURL=utils.js.map
|