@mintlify/msft-sdk 1.1.22 → 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 +27 -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 +113 -118
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +55 -50
- package/dist/api-playground-2/components/Example/RequestExample.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/createBodyData.js +1 -1
- package/dist/api-playground-2/generators/createBodyData.js.map +1 -1
- package/dist/api-playground-2/generators/createHeaders.js +18 -18
- package/dist/api-playground-2/generators/createHeaders.js.map +1 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +21 -19
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateRequest.js +26 -25
- package/dist/api-playground-2/generators/generateRequest.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/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/generators/generateSnippetMap.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/usePlaygroundInputsStore.js +24 -13
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -1
- 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 +37 -0
- package/dist/common/guards.js.map +1 -0
- 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/components/toc/index.js +4 -4
- package/dist/components/toc/index.js.map +1 -1
- 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/styles.css +1 -1
- 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 +2 -3
|
@@ -1,14 +1,121 @@
|
|
|
1
1
|
import "@mintlify/validation";
|
|
2
|
-
import { apiPlaygroundInputKeys as
|
|
3
|
-
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/api-playground-2/schemaGraph/utils.ts"],"sourcesContent":["import { openApiToSchemaGraph } from '@mintlify/validation';\nimport type {\n ApiPlaygroundInputs,\n ArraySchemaObject,\n MediaObject,\n ParameterObject,\n GraphNode,\n SchemaObject,\n DataSchema,\n} from '@mintlify/validation';\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\nimport {\n CIRCULAR_REF_KEY,\n combinationKeys,\n initialApiPlaygroundInputs,\n MAX_SCHEMA_COMBINATION_SIZE,\n stringFileFormats,\n apiPlaygroundInputKeys,\n} from '@/api-playground-2/constants';\nimport type {\n ApiReferenceDataV2,\n CircularRefObject,\n DifferentiatedType,\n ResolvedSchemaObject,\n ReducedSchema,\n} from '@/api-playground-2/types';\n\nimport { PlaygroundInputValue } from '../hooks/usePlaygroundInputsStore';\nimport { cn } from '@/utils/cn';\n\nexport { cn };\n\nexport function isCircularRef(value: unknown): value is CircularRefObject {\n return (\n typeof value === 'object' &&\n value !== null &&\n CIRCULAR_REF_KEY in value &&\n typeof value[CIRCULAR_REF_KEY] === 'string'\n );\n}\n\nexport const isResolvedSchemaObject = (obj: unknown): obj is ResolvedSchemaObject => {\n return isSchemaObject(obj) && ('isCircular' in obj || 'isRequired' in obj);\n};\n\nexport const createEmptyReducedSchema = (): ReducedSchema => ({ oneOf: [] });\nexport const createUnknownReducedSchema = (): ReducedSchema => ({ oneOf: [{}] });\n\nexport const isPlainRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const isReducedSchema = (schema: unknown): schema is ReducedSchema =>\n isSchemaObject(schema) && Array.isArray(schema.oneOf);\n\n/**\n * Given an OpenAPI 3.1 schema, this function will attempt to determine the schema type\n * based on the properties present in the schema. This is useful for assigning types to\n * schemas that are missing a type.\n *\n * For example, if a schema has no type but has `schema.properties`, we can infer the\n * intended type is `object`.\n *\n * Used in the Conversion step.\n *\n * @param schema\n * @returns if exactly one type can be inferred, the string corresponding to that type; otherwise `undefined`\n */\nexport const inferType = (\n schema: Omit<SchemaObject, 'type'>\n): OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined => {\n let type: OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined;\n if (\n schema.format !== undefined ||\n schema.pattern !== undefined ||\n schema.minLength !== undefined ||\n schema.maxLength !== undefined ||\n schema.enum?.every((option) => typeof option === 'string')\n ) {\n type = 'string';\n }\n if (\n schema.multipleOf !== undefined ||\n schema.minimum !== undefined ||\n schema.maximum !== undefined ||\n schema.exclusiveMinimum !== undefined ||\n schema.exclusiveMaximum !== undefined ||\n schema.enum?.every((option) => typeof option === 'number')\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'number';\n }\n if (\n ('items' in schema && schema.items !== undefined) ||\n schema.minItems !== undefined ||\n schema.maxItems !== undefined ||\n schema.uniqueItems !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'array';\n }\n if (\n schema.additionalProperties !== undefined ||\n schema.properties !== undefined ||\n schema.minProperties !== undefined ||\n schema.maxProperties !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'object';\n }\n\n return type;\n};\n\nexport const isSchemaObject = (obj: unknown): obj is SchemaObject => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n\n return (\n 'type' in obj ||\n 'properties' in obj ||\n 'oneOf' in obj ||\n 'anyOf' in obj ||\n 'allOf' in obj ||\n 'items' in obj ||\n 'additionalProperties' in obj ||\n 'enum' in obj ||\n 'const' in obj ||\n 'format' in obj ||\n 'pattern' in obj ||\n 'minimum' in obj ||\n 'maximum' in obj ||\n 'minLength' in obj ||\n 'maxLength' in obj ||\n 'minItems' in obj ||\n 'maxItems' in obj ||\n 'minProperties' in obj ||\n 'maxProperties' in obj ||\n 'required' in obj ||\n 'nullable' in obj ||\n 'description' in obj\n );\n};\n\nexport const isArrayObject = (obj: unknown): obj is ArraySchemaObject => {\n return isSchemaObject(obj) && obj.type === 'array';\n};\n\nexport function hasCombinationKey(obj: Record<string, unknown>): boolean {\n return combinationKeys.some((key) => key in obj);\n}\n\nexport function shouldTruncateForSize(schema: OpenAPIV3_1.SchemaObject): boolean {\n const oneOfSize = Array.isArray(schema.oneOf) ? schema.oneOf.length : 1;\n const anyOfSize = Array.isArray(schema.anyOf) ? schema.anyOf.length : 1;\n const allOfSize = Array.isArray(schema.allOf) ? schema.allOf.length : 1;\n\n const combinations: number[] = [oneOfSize, anyOfSize, allOfSize];\n\n // go three levels deep to estimate if combinations may explode\n combinationKeys.forEach((key) => {\n if (schema[key as keyof OpenAPIV3_1.SchemaObject]) {\n const subSchema = schema[key as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSchema).length);\n combinationKeys.forEach((subSchemaKey) => {\n if (subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSchema = subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSchema).length);\n combinationKeys.forEach((subSubSchemaKey) => {\n if (subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSubSchema =\n subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSubSchema).length);\n }\n });\n }\n });\n }\n });\n\n const totalCombinations = combinations.reduce((acc, curr) => acc * curr, 1);\n\n return totalCombinations > MAX_SCHEMA_COMBINATION_SIZE;\n}\n\n// similar to RecursiveParamField/renderTruncatedNextProperties\nexport function createTruncatedNextProperties(\n schema: OpenAPIV3_1.SchemaObject\n): OpenAPIV3_1.SchemaObject {\n const truncatedSchema = { ...schema };\n\n // Remove all composition properties to prevent further recursion\n delete truncatedSchema.oneOf;\n delete truncatedSchema.anyOf;\n delete truncatedSchema.allOf;\n\n if (truncatedSchema.type === 'array') {\n truncatedSchema.items = {};\n } else if (truncatedSchema.type === 'object') {\n truncatedSchema.properties = {};\n if (\n truncatedSchema.additionalProperties &&\n typeof truncatedSchema.additionalProperties === 'object'\n ) {\n truncatedSchema.additionalProperties = {};\n }\n }\n\n return truncatedSchema;\n}\n\nexport function createTruncatedReducedSchema(schema: OpenAPIV3_1.SchemaObject): ReducedSchema {\n const truncatedSchema = createTruncatedNextProperties(schema);\n // For reduction, we need to wrap in oneOf\n return { oneOf: [truncatedSchema] };\n}\n\nexport function collectCombinationSizes(\n value: unknown,\n remainingDepth: number,\n combinations: number[]\n): void {\n if (remainingDepth === 0 || value === undefined || value === null) {\n return;\n }\n\n if (Array.isArray(value)) {\n combinations.push(value.length);\n if (remainingDepth > 1) {\n value.forEach((item) => collectCombinationSizes(item, remainingDepth - 1, combinations));\n }\n return;\n }\n\n if (isPlainRecord(value)) {\n combinations.push(Object.keys(value).length);\n if (remainingDepth > 1) {\n Object.values(value).forEach((item) =>\n collectCombinationSizes(item, remainingDepth - 1, combinations)\n );\n }\n }\n}\n\nexport const addKeyIfDefined = <D, K extends keyof D>(\n key: K,\n value: D[K] | undefined,\n destination: D\n) => {\n if (value !== undefined) {\n destination[key] = value;\n }\n};\n\nexport const copyKeyIfDefined = <D, K extends keyof D>(\n key: K,\n source: Pick<D, K>,\n destination: D\n) => {\n if (source[key] !== undefined) {\n destination[key] = source[key];\n }\n};\n\nexport const takeLast = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema2[key] ?? schema1[key];\n};\n\nexport const combine = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T,\n transform: (\n a: NonNullable<OpenAPIV3_1.SchemaObject[T]>,\n b: NonNullable<OpenAPIV3_1.SchemaObject[T]>\n ) => OpenAPIV3_1.SchemaObject[T]\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema1[key] !== undefined && schema2[key] !== undefined\n ? transform(schema1[key], schema2[key])\n : schema1[key] ?? schema2[key];\n};\n\nexport const copyExampleIfDefined = (\n source: Pick<OpenAPIV3_1.SchemaObject, 'example' | 'examples'>,\n destination: Pick<DataSchema, 'example'>\n) => {\n const example = source.example !== undefined ? source.example : source.examples?.[0];\n if (example !== undefined) {\n destination.example = example;\n }\n};\n\n// Testing utility for quick and dirty schema graph conversion\nexport const convertSchemaToGraph = (\n schema: OpenAPIV3_1.SchemaObject,\n skipClone: boolean = false\n) => {\n let spec: OpenAPIV3_1.Document;\n if ('openapi' in schema) {\n spec = schema as OpenAPIV3_1.Document;\n } else {\n spec = {\n openapi: '3.1.0',\n info: { title: 'Test', version: '1.0.0' },\n paths: {},\n components: {\n schemas: {\n TestSchema: schema,\n },\n },\n };\n }\n if (!skipClone) {\n const clonedSpec = JSON.parse(JSON.stringify(spec));\n return openApiToSchemaGraph({\n spec: clonedSpec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n }\n return openApiToSchemaGraph({\n spec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n};\n\nexport const flattenSingleOneOf = <T extends GraphNode & { oneOf?: SchemaObject[] }>(\n node: T\n): T => {\n if (node.oneOf && node.oneOf.length === 1) {\n return node.oneOf[0] as T;\n }\n return node;\n};\n\nexport const flattenSchemaOneOfs = (schema: SchemaObject): SchemaObject => {\n let result = { ...schema } as SchemaObject;\n\n // recursively flatten into each combinator\n if (result.properties && typeof result.properties === 'object') {\n const flattened: Record<string, SchemaObject> = {};\n for (const [key, value] of Object.entries(result.properties)) {\n if (isSchemaObject(value)) {\n flattened[key] = flattenSchemaOneOfs(value);\n } else {\n flattened[key] = value as SchemaObject;\n }\n }\n result.properties = flattened;\n }\n\n if ('items' in result && result.items && typeof result.items === 'object') {\n if (isSchemaObject(result.items)) {\n result.items = flattenSchemaOneOfs(result.items);\n }\n }\n\n if (\n result.additionalProperties &&\n typeof result.additionalProperties === 'object' &&\n isSchemaObject(result.additionalProperties)\n ) {\n result.additionalProperties = flattenSchemaOneOfs(result.additionalProperties);\n }\n if (result.oneOf && Array.isArray(result.oneOf) && result.oneOf.length > 1) {\n const oneOfArray = result.oneOf;\n const mappedOneOf = (oneOfArray as unknown[]).map((item: unknown) => {\n if (isSchemaObject(item)) {\n return flattenSchemaOneOfs(item);\n }\n return item as SchemaObject;\n });\n result.oneOf = mappedOneOf as SchemaObject[];\n }\n\n if (\n 'oneOf' in result &&\n result.oneOf &&\n Array.isArray(result.oneOf) &&\n result.oneOf.length === 1\n ) {\n const singleItem = result.oneOf[0];\n if (isSchemaObject(singleItem)) {\n result = { ...result, ...singleItem } as SchemaObject;\n delete (result as { oneOf?: unknown[] }).oneOf;\n return flattenSchemaOneOfs(result);\n }\n }\n\n return result;\n};\n\nexport const calculateMaxDepth = (obj: unknown, currentDepth = 0): number => {\n if (obj === null || typeof obj !== 'object') {\n return currentDepth;\n }\n\n if (Array.isArray(obj)) {\n if (obj.length === 0) return currentDepth;\n return Math.max(...obj.map((item) => calculateMaxDepth(item, currentDepth)));\n }\n\n const depths = Object.entries(obj).map(([key, value]) => {\n if (key === 'type' || key === 'title') {\n return currentDepth;\n }\n return calculateMaxDepth(value, currentDepth + 1);\n });\n\n return depths.length > 0 ? Math.max(...depths) : currentDepth;\n};\n\n// converts standard schema types to differentiated types that were used in v1 and oneOf type\nexport const getDifferentiatedType = (schema: ResolvedSchemaObject): DifferentiatedType => {\n if (schema.oneOf) {\n return 'oneOf';\n }\n if (schema.enum) {\n switch (schema.type) {\n case 'string':\n return 'enum<string>';\n case 'number':\n return 'enum<number>';\n case 'integer':\n return 'enum<integer>';\n default:\n return schema.type;\n }\n }\n if (schema.format && stringFileFormats.includes(schema.format)) {\n return 'file';\n }\n return schema.type;\n};\n\nexport const isEnum = (schema: SchemaObject): boolean => {\n return 'enum' in schema && schema.enum !== undefined;\n};\n\nexport const getSchemaPlaceholder = (schema: SchemaObject): string | undefined => {\n return 'placeholder' in schema && typeof schema.placeholder === 'string'\n ? schema.placeholder\n : undefined;\n};\n\nexport const isStringSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'string';\n};\n\nexport const isNumberSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n\nexport const mapResponseExamples = (apiReferenceData: ApiReferenceDataV2) => {\n const responseCodeMediaObjectMap: Record<string, MediaObject> = {};\n Object.entries(apiReferenceData.operation?.responses ?? {}).forEach(([responseCode, UUID]) => {\n const response = apiReferenceData.dependencies?.responses?.[UUID];\n if (response && response.content) {\n responseCodeMediaObjectMap[responseCode] = response.content;\n }\n });\n return responseCodeMediaObjectMap;\n};\n\nexport const generatePrefillRequestData = (\n apiReferenceData: ApiReferenceDataV2\n): ApiPlaygroundInputs[] => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n const contentType = requestBodyContentTypes[0];\n if (!contentType) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentExamples = Object.values(requestBodyContent[contentType]?.examples ?? {});\n const examples: ApiPlaygroundInputs[] = [];\n for (const example of requestBodyContentExamples) {\n if ('value' in example) {\n examples.push({\n ...initialApiPlaygroundInputs,\n body: example.value,\n });\n }\n }\n\n return examples;\n};\n\nexport const getParametersPerSection = (\n apiReferenceData: ApiReferenceDataV2\n): {\n header: ParameterObject[];\n path: ParameterObject[];\n query: ParameterObject[];\n cookie: ParameterObject[];\n} => {\n const parameters = apiReferenceData.dependencies?.parameters;\n if (parameters) {\n const parameterObjects = Object.values(parameters);\n const headerParameters = parameterObjects.filter(\n (parameter) => !('in' in parameter) || parameter.in === 'header'\n );\n const cookieParameters = parameterObjects.filter((parameter) => parameter.in === 'cookie');\n const pathParameters = parameterObjects.filter((parameter) => parameter.in === 'path');\n const queryParameters = parameterObjects.filter((parameter) => parameter.in === 'query');\n return {\n header: headerParameters,\n path: pathParameters,\n query: queryParameters,\n cookie: cookieParameters,\n };\n }\n return { header: [], path: [], query: [], cookie: [] };\n};\n\nexport const getSchemaDefault = (schema: object | undefined): unknown | undefined => {\n let defaultValue = undefined;\n if (!schema) {\n return undefined;\n }\n if (typeof schema === 'object' && 'default' in schema) {\n defaultValue = schema.default;\n }\n if (typeof schema === 'object' && 'x-default' in schema) {\n defaultValue = schema['x-default'];\n }\n return defaultValue;\n};\n\nexport const getUniqueInputKey = (\n inputKeyPrefix: string,\n schema: ResolvedSchemaObject,\n arrayIndex?: number,\n key?: string\n) => {\n if (!schema.uniqueKey) {\n return inputKeyPrefix;\n } else {\n const arrayIndexOrKey = arrayIndex || key;\n return `${inputKeyPrefix ? inputKeyPrefix + '.' : ''}${schema.uniqueKey}${arrayIndexOrKey ? '.' + arrayIndexOrKey : ''}`;\n }\n};\n\nexport const convertAnySchemaToOneOfs = (): SchemaObject => {\n return {\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'number',\n },\n {\n type: 'boolean',\n },\n {\n type: 'object',\n properties: {},\n },\n {\n type: 'array',\n items: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'object', properties: {} },\n { type: 'array', items: {} },\n { type: 'null' },\n ],\n },\n },\n {\n type: 'null',\n },\n ],\n };\n};\n\nexport const getRequestBodyContentType = (\n apiReferenceData: ApiReferenceDataV2,\n contentTypeIndex: number\n): string | undefined => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return undefined;\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n return requestBodyContentTypes[contentTypeIndex];\n};\n\nexport const escapeDots = (key: string): string => {\n return key.replace(/\\./g, '\\\\.');\n};\n\nexport const mapParamInToPlaygroundInputKey = (parameterIn: string): string => {\n switch (parameterIn) {\n case 'header':\n return apiPlaygroundInputKeys.header;\n case 'path':\n return apiPlaygroundInputKeys.path;\n case 'query':\n return apiPlaygroundInputKeys.query;\n case 'cookie':\n return apiPlaygroundInputKeys.cookie;\n default:\n return apiPlaygroundInputKeys.header;\n }\n};\n\n// CLANKED AS HELL. TODO: Refactor.\nexport const unflattenInputs = (\n inputs: Record<string, PlaygroundInputValue>\n): ApiPlaygroundInputs => {\n const result: ApiPlaygroundInputs = {\n server: {},\n header: {},\n path: {},\n query: {},\n cookie: {},\n body: undefined,\n };\n\n Object.entries(inputs).forEach(([key, value]) => {\n // skip undefined/null values\n if (value === undefined || value === null) {\n return;\n }\n // split on . but not on \\. (escaped dots), then unescape the parts\n const parts = key.split(/(?<!\\\\)\\./).map((part) => part.replace(/\\\\\\./g, '.'));\n if (parts.length < 2) {\n if (key === 'body') {\n result.body = value;\n }\n return;\n }\n\n const [section, ...keyPath] = parts;\n\n const validKeys = Object.values(apiPlaygroundInputKeys);\n if (!section || !validKeys.includes(section)) {\n return;\n }\n\n if (section !== apiPlaygroundInputKeys.body) {\n setNestedValue(\n result[section as keyof ApiPlaygroundInputs] as Record<string, unknown>,\n [...keyPath],\n value\n );\n } else {\n if ([...keyPath].length === 0) {\n result.body = value;\n } else {\n // Initialize body as object if it's undefined\n if (result.body === undefined || typeof result.body !== 'object') {\n result.body = {};\n }\n setNestedValue(result.body as Record<string, unknown>, keyPath, value);\n }\n }\n });\n\n // Convert array-like objects (objects with only numeric keys) to actual arrays\n return convertArrayLikeToArray(result) as ApiPlaygroundInputs;\n};\n\n// Check if an object should be converted to an array (all keys are numeric strings)\nconst isArrayLike = (obj: unknown): obj is Record<string, unknown> => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n const keys = Object.keys(obj);\n if (keys.length === 0) {\n return false;\n }\n // Check if all keys are numeric strings\n return keys.every((k) => /^\\d+$/.test(k));\n};\n\n// Recursively convert array-like objects to arrays\nconst convertArrayLikeToArray = (value: unknown): unknown => {\n if (value === null || value === undefined) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(convertArrayLikeToArray);\n }\n\n if (isPlainRecord(value)) {\n if (isArrayLike(value)) {\n // Convert object with numeric keys to array\n // Sort keys numerically and map to values\n const keys = Object.keys(value).sort((a, b) => Number(a) - Number(b));\n const arr = keys.map((k) => value[k]);\n // Recursively convert nested values\n return arr.map(convertArrayLikeToArray);\n }\n\n // Recursively process regular objects\n const result: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = convertArrayLikeToArray(val);\n }\n return result;\n }\n\n return value;\n};\n\n// recursively set a value in a nested object\nconst setNestedValue = (obj: Record<string, unknown>, keyPath: string[], value: unknown) => {\n // First pass: filter out keys we want to skip\n const filteredKeys: string[] = [];\n for (let i = 0; i < keyPath.length; i++) {\n const key = keyPath[i];\n if (key === 'oneOf') {\n // Skip this key and the next one (the oneOf index)\n i++;\n continue;\n }\n if (key === 'additionalProperties' || key === 'items') {\n // Skip these keys\n continue;\n }\n if (key) {\n filteredKeys.push(key);\n }\n }\n\n // Second pass: navigate through/create nested structure and set value\n let current = obj;\n for (let i = 0; i < filteredKeys.length; i++) {\n const key = filteredKeys[i];\n if (i === filteredKeys.length - 1) {\n // Last key - set the value\n if (key) {\n current[key] = value;\n }\n } else {\n // Not the last key - ensure nested object exists\n if (key && (!current[key] || typeof current[key] !== 'object')) {\n current[key] = {};\n }\n if (key) {\n current = current[key] as Record<string, unknown>;\n }\n }\n }\n};\n// CLANK ENDS HERE\n\nexport const filterSchemasWithConsts = (\n schemas: ResolvedSchemaObject[]\n): ResolvedSchemaObject[] => {\n const filteredSchemas = schemas.filter((schema) => {\n if ('enum' in schema && schema.enum && 'const' in schema) {\n return schema.enum.includes(schema.const);\n }\n return true;\n });\n return filteredSchemas;\n};\n\nexport const getBodyDefaultsFromSchema = (schema: SchemaObject): Record<string, unknown> => {\n const bodyDefaults: Record<string, unknown> = {};\n\n if ('uniqueKey' in schema && schema.uniqueKey !== undefined) {\n const defaultValue = getSchemaDefault(schema);\n if (defaultValue !== undefined) {\n const inputKey = `${apiPlaygroundInputKeys.body}.${schema.uniqueKey}`;\n bodyDefaults[inputKey] = defaultValue;\n }\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema) => {\n if (isSchemaObject(subSchema)) {\n const subDefaults = getBodyDefaultsFromSchema(subSchema);\n Object.assign(bodyDefaults, subDefaults);\n }\n });\n }\n\n if (schema.type === 'object' && schema.properties) {\n Object.values(schema.properties).forEach((propSchema) => {\n if (isSchemaObject(propSchema)) {\n const propDefaults = getBodyDefaultsFromSchema(propSchema);\n Object.assign(bodyDefaults, propDefaults);\n }\n });\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object' &&\n isSchemaObject(schema.additionalProperties)\n ) {\n const addPropsDefaults = getBodyDefaultsFromSchema(schema.additionalProperties);\n Object.assign(bodyDefaults, addPropsDefaults);\n }\n\n if (schema.type === 'array' && 'items' in schema && isSchemaObject(schema.items)) {\n const itemsDefaults = getBodyDefaultsFromSchema(schema.items);\n Object.assign(bodyDefaults, itemsDefaults);\n }\n\n return bodyDefaults;\n};"],"names":["isPlainRecord","value","isSchemaObject","obj","mapResponseExamples","apiReferenceData","responseCodeMediaObjectMap","_a","responseCode","UUID","response","_b","unflattenInputs","inputs","result","key","parts","part","section","keyPath","validKeys","apiPlaygroundInputKeys","setNestedValue","convertArrayLikeToArray","isArrayLike","keys","k","a","b","val","filteredKeys","i","current"],"mappings":";;AAiDO,MAAMA,IAAgB,CAACC,MAC5B,OAAOA,KAAU,YAAYA,MAAU,QAAQ,CAAC,MAAM,QAAQA,CAAK,GAsExDC,IAAiB,CAACC,MACxBH,EAAcG,CAAG,IAKpB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AAQ,QAAQY,KAAK;AACvC,UAAMhB,IAAMI,EAAQY,CAAC;AACrB,QAAIhB,MAAQ,SAAS;AAEnB,MAAAgB;AACA;AAAA,IACF;AACA,IAAIhB,MAAQ,0BAA0BA,MAAQ,WAI1CA,KACFe,EAAa,KAAKf,CAAG;AAAA,EAEzB;AAGA,MAAIiB,IAAU7B;AACd,WAAS4B,IAAI,GAAGA,IAAID,EAAa,QAAQC,KAAK;AAC5C,UAAMhB,IAAMe,EAAaC,CAAC;AAC1B,IAAIA,MAAMD,EAAa,SAAS,IAE1Bf,MACFiB,EAAQjB,CAAG,IAAId,MAIbc,MAAQ,CAACiB,EAAQjB,CAAG,KAAK,OAAOiB,EAAQjB,CAAG,KAAM,cACnDiB,EAAQjB,CAAG,IAAI,CAAA,IAEbA,MACFiB,IAAUA,EAAQjB,CAAG;AAAA,EAG3B;AACF;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/api-playground-2/schemaGraph/utils.ts"],"sourcesContent":["import { openApiToSchemaGraph } from '@mintlify/validation';\nimport type {\n ApiPlaygroundInputs,\n ArraySchemaObject,\n MediaObject,\n ParameterObject,\n GraphNode,\n SchemaObject,\n DataSchema,\n} from '@mintlify/validation';\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\nimport {\n CIRCULAR_REF_KEY,\n combinationKeys,\n initialApiPlaygroundInputs,\n MAX_SCHEMA_COMBINATION_SIZE,\n stringFileFormats,\n apiPlaygroundInputKeys,\n} from '@/api-playground-2/constants';\nimport type {\n ApiReferenceDataV2,\n CircularRefObject,\n DifferentiatedType,\n ResolvedSchemaObject,\n ReducedSchema,\n} from '@/api-playground-2/types';\n\nimport { PlaygroundInputValue } from '../hooks/usePlaygroundInputsStore';\nimport { cn } from '@/utils/cn';\n\nexport { cn };\n\nexport function isCircularRef(value: unknown): value is CircularRefObject {\n return (\n typeof value === 'object' &&\n value !== null &&\n CIRCULAR_REF_KEY in value &&\n typeof value[CIRCULAR_REF_KEY] === 'string'\n );\n}\n\nexport const isResolvedSchemaObject = (obj: unknown): obj is ResolvedSchemaObject => {\n return isSchemaObject(obj) && ('isCircular' in obj || 'isRequired' in obj);\n};\n\nexport const createEmptyReducedSchema = (): ReducedSchema => ({ oneOf: [] });\nexport const createUnknownReducedSchema = (): ReducedSchema => ({ oneOf: [{}] });\n\nexport const isPlainRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const isReducedSchema = (schema: unknown): schema is ReducedSchema =>\n isSchemaObject(schema) && Array.isArray(schema.oneOf);\n\n/**\n * Given an OpenAPI 3.1 schema, this function will attempt to determine the schema type\n * based on the properties present in the schema. This is useful for assigning types to\n * schemas that are missing a type.\n *\n * For example, if a schema has no type but has `schema.properties`, we can infer the\n * intended type is `object`.\n *\n * Used in the Conversion step.\n *\n * @param schema\n * @returns if exactly one type can be inferred, the string corresponding to that type; otherwise `undefined`\n */\nexport const inferType = (\n schema: Omit<SchemaObject, 'type'>\n): OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined => {\n let type: OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined;\n if (\n schema.format !== undefined ||\n schema.pattern !== undefined ||\n schema.minLength !== undefined ||\n schema.maxLength !== undefined ||\n schema.enum?.every((option) => typeof option === 'string')\n ) {\n type = 'string';\n }\n if (\n schema.multipleOf !== undefined ||\n schema.minimum !== undefined ||\n schema.maximum !== undefined ||\n schema.exclusiveMinimum !== undefined ||\n schema.exclusiveMaximum !== undefined ||\n schema.enum?.every((option) => typeof option === 'number')\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'number';\n }\n if (\n ('items' in schema && schema.items !== undefined) ||\n schema.minItems !== undefined ||\n schema.maxItems !== undefined ||\n schema.uniqueItems !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'array';\n }\n if (\n schema.additionalProperties !== undefined ||\n schema.properties !== undefined ||\n schema.minProperties !== undefined ||\n schema.maxProperties !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'object';\n }\n\n return type;\n};\n\nexport const isSchemaObject = (obj: unknown): obj is SchemaObject => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n\n return (\n 'type' in obj ||\n 'properties' in obj ||\n 'oneOf' in obj ||\n 'anyOf' in obj ||\n 'allOf' in obj ||\n 'items' in obj ||\n 'additionalProperties' in obj ||\n 'enum' in obj ||\n 'const' in obj ||\n 'format' in obj ||\n 'pattern' in obj ||\n 'minimum' in obj ||\n 'maximum' in obj ||\n 'minLength' in obj ||\n 'maxLength' in obj ||\n 'minItems' in obj ||\n 'maxItems' in obj ||\n 'minProperties' in obj ||\n 'maxProperties' in obj ||\n 'required' in obj ||\n 'nullable' in obj ||\n 'description' in obj\n );\n};\n\nexport const isArrayObject = (obj: unknown): obj is ArraySchemaObject => {\n return isSchemaObject(obj) && obj.type === 'array';\n};\n\nexport function hasCombinationKey(obj: Record<string, unknown>): boolean {\n return combinationKeys.some((key) => key in obj);\n}\n\nexport function shouldTruncateForSize(schema: OpenAPIV3_1.SchemaObject): boolean {\n const oneOfSize = Array.isArray(schema.oneOf) ? schema.oneOf.length : 1;\n const anyOfSize = Array.isArray(schema.anyOf) ? schema.anyOf.length : 1;\n const allOfSize = Array.isArray(schema.allOf) ? schema.allOf.length : 1;\n\n const combinations: number[] = [oneOfSize, anyOfSize, allOfSize];\n\n // go three levels deep to estimate if combinations may explode\n combinationKeys.forEach((key) => {\n if (schema[key as keyof OpenAPIV3_1.SchemaObject]) {\n const subSchema = schema[key as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSchema).length);\n combinationKeys.forEach((subSchemaKey) => {\n if (subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSchema = subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSchema).length);\n combinationKeys.forEach((subSubSchemaKey) => {\n if (subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSubSchema =\n subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSubSchema).length);\n }\n });\n }\n });\n }\n });\n\n const totalCombinations = combinations.reduce((acc, curr) => acc * curr, 1);\n\n return totalCombinations > MAX_SCHEMA_COMBINATION_SIZE;\n}\n\n// similar to RecursiveParamField/renderTruncatedNextProperties\nexport function createTruncatedNextProperties(\n schema: OpenAPIV3_1.SchemaObject\n): OpenAPIV3_1.SchemaObject {\n const truncatedSchema = { ...schema };\n\n // Remove all composition properties to prevent further recursion\n delete truncatedSchema.oneOf;\n delete truncatedSchema.anyOf;\n delete truncatedSchema.allOf;\n\n if (truncatedSchema.type === 'array') {\n truncatedSchema.items = {};\n } else if (truncatedSchema.type === 'object') {\n truncatedSchema.properties = {};\n if (\n truncatedSchema.additionalProperties &&\n typeof truncatedSchema.additionalProperties === 'object'\n ) {\n truncatedSchema.additionalProperties = {};\n }\n }\n\n return truncatedSchema;\n}\n\nexport function createTruncatedReducedSchema(schema: OpenAPIV3_1.SchemaObject): ReducedSchema {\n const truncatedSchema = createTruncatedNextProperties(schema);\n // For reduction, we need to wrap in oneOf\n return { oneOf: [truncatedSchema] };\n}\n\nexport function collectCombinationSizes(\n value: unknown,\n remainingDepth: number,\n combinations: number[]\n): void {\n if (remainingDepth === 0 || value === undefined || value === null) {\n return;\n }\n\n if (Array.isArray(value)) {\n combinations.push(value.length);\n if (remainingDepth > 1) {\n value.forEach((item) => collectCombinationSizes(item, remainingDepth - 1, combinations));\n }\n return;\n }\n\n if (isPlainRecord(value)) {\n combinations.push(Object.keys(value).length);\n if (remainingDepth > 1) {\n Object.values(value).forEach((item) =>\n collectCombinationSizes(item, remainingDepth - 1, combinations)\n );\n }\n }\n}\n\nexport const addKeyIfDefined = <D, K extends keyof D>(\n key: K,\n value: D[K] | undefined,\n destination: D\n) => {\n if (value !== undefined) {\n destination[key] = value;\n }\n};\n\nexport const copyKeyIfDefined = <D, K extends keyof D>(\n key: K,\n source: Pick<D, K>,\n destination: D\n) => {\n if (source[key] !== undefined) {\n destination[key] = source[key];\n }\n};\n\nexport const takeLast = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema2[key] ?? schema1[key];\n};\n\nexport const combine = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T,\n transform: (\n a: NonNullable<OpenAPIV3_1.SchemaObject[T]>,\n b: NonNullable<OpenAPIV3_1.SchemaObject[T]>\n ) => OpenAPIV3_1.SchemaObject[T]\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema1[key] !== undefined && schema2[key] !== undefined\n ? transform(schema1[key], schema2[key])\n : schema1[key] ?? schema2[key];\n};\n\nexport const copyExampleIfDefined = (\n source: Pick<OpenAPIV3_1.SchemaObject, 'example' | 'examples'>,\n destination: Pick<DataSchema, 'example'>\n) => {\n const example = source.example !== undefined ? source.example : source.examples?.[0];\n if (example !== undefined) {\n destination.example = example;\n }\n};\n\n// Testing utility for quick and dirty schema graph conversion\nexport const convertSchemaToGraph = (\n schema: OpenAPIV3_1.SchemaObject,\n skipClone: boolean = false\n) => {\n let spec: OpenAPIV3_1.Document;\n if ('openapi' in schema) {\n spec = schema as OpenAPIV3_1.Document;\n } else {\n spec = {\n openapi: '3.1.0',\n info: { title: 'Test', version: '1.0.0' },\n paths: {},\n components: {\n schemas: {\n TestSchema: schema,\n },\n },\n };\n }\n if (!skipClone) {\n const clonedSpec = JSON.parse(JSON.stringify(spec));\n return openApiToSchemaGraph({\n spec: clonedSpec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n }\n return openApiToSchemaGraph({\n spec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n};\n\nexport const flattenSingleOneOf = <T extends GraphNode & { oneOf?: SchemaObject[] }>(\n node: T\n): T => {\n if (node.oneOf && node.oneOf.length === 1) {\n return node.oneOf[0] as T;\n }\n return node;\n};\n\nexport const flattenSchemaOneOfs = (schema: SchemaObject): SchemaObject => {\n let result = { ...schema } as SchemaObject;\n\n // recursively flatten into each combinator\n if (result.properties && typeof result.properties === 'object') {\n const flattened: Record<string, SchemaObject> = {};\n for (const [key, value] of Object.entries(result.properties)) {\n if (isSchemaObject(value)) {\n flattened[key] = flattenSchemaOneOfs(value);\n } else {\n flattened[key] = value as SchemaObject;\n }\n }\n result.properties = flattened;\n }\n\n if ('items' in result && result.items && typeof result.items === 'object') {\n if (isSchemaObject(result.items)) {\n result.items = flattenSchemaOneOfs(result.items);\n }\n }\n\n if (\n result.additionalProperties &&\n typeof result.additionalProperties === 'object' &&\n isSchemaObject(result.additionalProperties)\n ) {\n result.additionalProperties = flattenSchemaOneOfs(result.additionalProperties);\n }\n if (result.oneOf && Array.isArray(result.oneOf) && result.oneOf.length > 1) {\n const oneOfArray = result.oneOf;\n const mappedOneOf = (oneOfArray as unknown[]).map((item: unknown) => {\n if (isSchemaObject(item)) {\n return flattenSchemaOneOfs(item);\n }\n return item as SchemaObject;\n });\n result.oneOf = mappedOneOf as SchemaObject[];\n }\n\n if (\n 'oneOf' in result &&\n result.oneOf &&\n Array.isArray(result.oneOf) &&\n result.oneOf.length === 1\n ) {\n const singleItem = result.oneOf[0];\n if (isSchemaObject(singleItem)) {\n result = { ...result, ...singleItem } as SchemaObject;\n delete (result as { oneOf?: unknown[] }).oneOf;\n return flattenSchemaOneOfs(result);\n }\n }\n\n return result;\n};\n\nexport const calculateMaxDepth = (obj: unknown, currentDepth = 0): number => {\n if (obj === null || typeof obj !== 'object') {\n return currentDepth;\n }\n\n if (Array.isArray(obj)) {\n if (obj.length === 0) return currentDepth;\n return Math.max(...obj.map((item) => calculateMaxDepth(item, currentDepth)));\n }\n\n const depths = Object.entries(obj).map(([key, value]) => {\n if (key === 'type' || key === 'title') {\n return currentDepth;\n }\n return calculateMaxDepth(value, currentDepth + 1);\n });\n\n return depths.length > 0 ? Math.max(...depths) : currentDepth;\n};\n\n// converts standard schema types to differentiated types that were used in v1 and oneOf type\nexport const getDifferentiatedType = (schema: ResolvedSchemaObject): DifferentiatedType => {\n if (schema.oneOf) {\n return 'oneOf';\n }\n if (schema.enum) {\n switch (schema.type) {\n case 'string':\n return 'enum<string>';\n case 'number':\n return 'enum<number>';\n case 'integer':\n return 'enum<integer>';\n default:\n return schema.type;\n }\n }\n if (schema.format && stringFileFormats.includes(schema.format)) {\n return 'file';\n }\n return schema.type;\n};\n\nexport const isEnum = (schema: SchemaObject): boolean => {\n return 'enum' in schema && schema.enum !== undefined;\n};\n\nexport const getSchemaPlaceholder = (schema: SchemaObject): string | undefined => {\n return 'placeholder' in schema && typeof schema.placeholder === 'string'\n ? schema.placeholder\n : undefined;\n};\n\nexport const isStringSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'string';\n};\n\nexport const isNumberSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n\nexport const mapResponseExamples = (apiReferenceData: ApiReferenceDataV2) => {\n const responseCodeMediaObjectMap: Record<string, MediaObject> = {};\n Object.entries(apiReferenceData.operation?.responses ?? {}).forEach(([responseCode, UUID]) => {\n const response = apiReferenceData.dependencies?.responses?.[UUID];\n if (response && response.content) {\n responseCodeMediaObjectMap[responseCode] = response.content;\n }\n });\n return responseCodeMediaObjectMap;\n};\n\nexport const generatePrefillRequestData = (\n apiReferenceData: ApiReferenceDataV2\n): ApiPlaygroundInputs[] => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n const contentType = requestBodyContentTypes[0];\n if (!contentType) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentExamples = Object.values(requestBodyContent[contentType]?.examples ?? {});\n const examples: ApiPlaygroundInputs[] = [];\n for (const example of requestBodyContentExamples) {\n if ('value' in example) {\n examples.push({\n ...initialApiPlaygroundInputs,\n body: example.value,\n });\n }\n }\n\n return examples;\n};\n\nexport const getParametersPerSection = (\n apiReferenceData: ApiReferenceDataV2\n): {\n header: ParameterObject[];\n path: ParameterObject[];\n query: ParameterObject[];\n cookie: ParameterObject[];\n} => {\n const parameters = apiReferenceData.dependencies?.parameters;\n if (parameters) {\n const parameterObjects = Object.values(parameters);\n const headerParameters = parameterObjects.filter(\n (parameter) => !('in' in parameter) || parameter.in === 'header'\n );\n const cookieParameters = parameterObjects.filter((parameter) => parameter.in === 'cookie');\n const pathParameters = parameterObjects.filter((parameter) => parameter.in === 'path');\n const queryParameters = parameterObjects.filter((parameter) => parameter.in === 'query');\n return {\n header: headerParameters,\n path: pathParameters,\n query: queryParameters,\n cookie: cookieParameters,\n };\n }\n return { header: [], path: [], query: [], cookie: [] };\n};\n\nexport const getSchemaDefault = (schema: object | undefined): unknown | undefined => {\n let defaultValue = undefined;\n if (!schema) {\n return undefined;\n }\n if (typeof schema === 'object' && 'default' in schema) {\n defaultValue = schema.default;\n }\n if (typeof schema === 'object' && 'x-default' in schema) {\n defaultValue = schema['x-default'];\n }\n return defaultValue;\n};\n\nexport const getUniqueInputKey = (\n inputKeyPrefix: string,\n schema: ResolvedSchemaObject,\n arrayIndex?: number,\n key?: string\n) => {\n if (!schema.uniqueKey) {\n return inputKeyPrefix;\n } else {\n const arrayIndexOrKey = arrayIndex || key;\n return `${inputKeyPrefix ? inputKeyPrefix + '.' : ''}${schema.uniqueKey}${arrayIndexOrKey ? '.' + arrayIndexOrKey : ''}`;\n }\n};\n\nexport const convertAnySchemaToOneOfs = (): SchemaObject => {\n return {\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'number',\n },\n {\n type: 'boolean',\n },\n {\n type: 'object',\n properties: {},\n },\n {\n type: 'array',\n items: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'object', properties: {} },\n { type: 'array', items: {} },\n { type: 'null' },\n ],\n },\n },\n {\n type: 'null',\n },\n ],\n };\n};\n\nexport const getRequestBodyContentType = (\n apiReferenceData: ApiReferenceDataV2,\n contentTypeIndex: number\n): string | undefined => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return undefined;\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n return requestBodyContentTypes[contentTypeIndex];\n};\n\nexport const escapeDots = (key: string): string => {\n return key.replace(/\\./g, '\\\\.');\n};\n\nexport const mapParamInToPlaygroundInputKey = (parameterIn: string): string => {\n switch (parameterIn) {\n case 'header':\n return apiPlaygroundInputKeys.header;\n case 'path':\n return apiPlaygroundInputKeys.path;\n case 'query':\n return apiPlaygroundInputKeys.query;\n case 'cookie':\n return apiPlaygroundInputKeys.cookie;\n default:\n return apiPlaygroundInputKeys.header;\n }\n};\n\n// CLANKED AS HELL. TODO: Refactor.\nexport const unflattenInputs = (\n inputs: Record<string, PlaygroundInputValue>\n): ApiPlaygroundInputs => {\n const result: ApiPlaygroundInputs = {\n server: {},\n header: {},\n path: {},\n query: {},\n cookie: {},\n body: undefined,\n };\n\n Object.entries(inputs).forEach(([key, value]) => {\n // skip undefined/null values\n if (value === undefined || value === null) {\n return;\n }\n // split on . but not on \\. (escaped dots), then unescape the parts\n const parts = key.split(/(?<!\\\\)\\./).map((part) => part.replace(/\\\\\\./g, '.'));\n if (parts.length < 2) {\n if (key === 'body') {\n result.body = value;\n }\n return;\n }\n\n const [section, ...keyPath] = parts;\n\n const validKeys = Object.values(apiPlaygroundInputKeys);\n if (!section || !validKeys.includes(section)) {\n return;\n }\n\n if (section !== apiPlaygroundInputKeys.body) {\n setNestedValue(\n result[section as keyof ApiPlaygroundInputs] as Record<string, unknown>,\n [...keyPath],\n value\n );\n } else {\n if ([...keyPath].length === 0) {\n result.body = value;\n } else {\n // Initialize body as object if it's undefined\n if (result.body === undefined || typeof result.body !== 'object') {\n result.body = {};\n }\n setNestedValue(result.body as Record<string, unknown>, keyPath, value);\n }\n }\n });\n\n // Convert array-like objects (objects with only numeric keys) to actual arrays\n return convertArrayLikeToArray(result) as ApiPlaygroundInputs;\n};\n\n// Check if an object should be converted to an array (all keys are numeric strings)\nconst isArrayLike = (obj: unknown): obj is Record<string, unknown> => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n const keys = Object.keys(obj);\n if (keys.length === 0) {\n return false;\n }\n // Check if all keys are numeric strings\n return keys.every((k) => /^\\d+$/.test(k));\n};\n\n// Recursively convert array-like objects to arrays\nconst convertArrayLikeToArray = (value: unknown): unknown => {\n if (value === null || value === undefined) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(convertArrayLikeToArray);\n }\n\n if (isPlainRecord(value)) {\n if (isArrayLike(value)) {\n // Convert object with numeric keys to array\n // Sort keys numerically and map to values\n const keys = Object.keys(value).sort((a, b) => Number(a) - Number(b));\n const arr = keys.map((k) => value[k]);\n // Recursively convert nested values\n return arr.map(convertArrayLikeToArray);\n }\n\n // Recursively process regular objects\n const result: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = convertArrayLikeToArray(val);\n }\n return result;\n }\n\n return value;\n};\n\n// recursively set a value in a nested object\nconst setNestedValue = (obj: Record<string, unknown>, keyPath: string[], value: unknown) => {\n // First pass: filter out keys we want to skip\n const filteredKeys: string[] = [];\n for (let i = 0; i < keyPath.length; i++) {\n const key = keyPath[i];\n if (key === 'oneOf') {\n // Skip this key and the next one (the oneOf index)\n i++;\n continue;\n }\n if (key === 'additionalProperties' || key === 'items') {\n // Skip these keys\n continue;\n }\n if (key) {\n filteredKeys.push(key);\n }\n }\n\n // Second pass: navigate through/create nested structure and set value\n let current = obj;\n for (let i = 0; i < filteredKeys.length; i++) {\n const key = filteredKeys[i];\n if (i === filteredKeys.length - 1) {\n // Last key - set the value\n if (key) {\n current[key] = value;\n }\n } else {\n // Not the last key - ensure nested object exists\n if (key && (!current[key] || typeof current[key] !== 'object')) {\n current[key] = {};\n }\n if (key) {\n current = current[key] as Record<string, unknown>;\n }\n }\n }\n};\n// CLANK ENDS HERE\n\nexport const filterSchemasWithConsts = (\n schemas: ResolvedSchemaObject[]\n): ResolvedSchemaObject[] => {\n const filteredSchemas = schemas.filter((schema) => {\n if ('enum' in schema && schema.enum && 'const' in schema) {\n return schema.enum.includes(schema.const);\n }\n return true;\n });\n return filteredSchemas;\n};\n\nexport const getBodyDefaultsFromSchema = (schema: SchemaObject): Record<string, unknown> => {\n const bodyDefaults: Record<string, unknown> = {};\n\n if ('uniqueKey' in schema && schema.uniqueKey !== undefined) {\n const defaultValue = getSchemaDefault(schema);\n if (defaultValue !== undefined) {\n const inputKey = `${apiPlaygroundInputKeys.body}.${schema.uniqueKey}`;\n bodyDefaults[inputKey] = defaultValue;\n }\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema) => {\n if (isSchemaObject(subSchema)) {\n const subDefaults = getBodyDefaultsFromSchema(subSchema);\n Object.assign(bodyDefaults, subDefaults);\n }\n });\n }\n\n if (schema.type === 'object' && schema.properties) {\n Object.values(schema.properties).forEach((propSchema) => {\n if (isSchemaObject(propSchema)) {\n const propDefaults = getBodyDefaultsFromSchema(propSchema);\n Object.assign(bodyDefaults, propDefaults);\n }\n });\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object' &&\n isSchemaObject(schema.additionalProperties)\n ) {\n const addPropsDefaults = getBodyDefaultsFromSchema(schema.additionalProperties);\n Object.assign(bodyDefaults, addPropsDefaults);\n }\n\n if (schema.type === 'array' && 'items' in schema && isSchemaObject(schema.items)) {\n const itemsDefaults = getBodyDefaultsFromSchema(schema.items);\n Object.assign(bodyDefaults, itemsDefaults);\n }\n\n return bodyDefaults;\n};"],"names":["isCircularRef","value","CIRCULAR_REF_KEY","isPlainRecord","isSchemaObject","obj","isArrayObject","getDifferentiatedType","schema","stringFileFormats","isEnum","getSchemaPlaceholder","isStringSchema","isNumberSchema","mapResponseExamples","apiReferenceData","responseCodeMediaObjectMap","_a","responseCode","UUID","response","_b","generatePrefillRequestData","requestBodyContent","initialApiPlaygroundInputs","contentType","requestBodyContentExamples","_c","examples","example","getParametersPerSection","parameters","parameterObjects","headerParameters","parameter","cookieParameters","pathParameters","queryParameters","getSchemaDefault","defaultValue","getUniqueInputKey","inputKeyPrefix","arrayIndex","key","arrayIndexOrKey","convertAnySchemaToOneOfs","getRequestBodyContentType","contentTypeIndex","escapeDots","mapParamInToPlaygroundInputKey","parameterIn","apiPlaygroundInputKeys","unflattenInputs","inputs","result","parts","part","section","keyPath","validKeys","setNestedValue","convertArrayLikeToArray","isArrayLike","keys","k","a","b","val","filteredKeys","current","filterSchemasWithConsts","schemas","getBodyDefaultsFromSchema","bodyDefaults","inputKey","subSchema","subDefaults","propSchema","propDefaults","addPropsDefaults","itemsDefaults"],"mappings":";;AAiCO,SAASA,EAAcC,GAA4C;AACxE,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVC,KAAoBD,KACpB,OAAOA,EAAMC,CAAgB,KAAM;AAEvC;AASO,MAAMC,IAAgB,CAACF,MAC5B,OAAOA,KAAU,YAAYA,MAAU,QAAQ,CAAC,MAAM,QAAQA,CAAK,GAsExDG,IAAiB,CAACC,MACxBF,EAAcE,CAAG,IAKpB,UAAUA,KACV,gBAAgBA,KAChB,WAAWA,KACX,WAAWA,KACX,WAAWA,KACX,WAAWA,KACX,0BAA0BA,KAC1B,UAAUA,KACV,WAAWA,KACX,YAAYA,KACZ,aAAaA,KACb,aAAaA,KACb,aAAaA,KACb,eAAeA,KACf,eAAeA,KACf,cAAcA,KACd,cAAcA,KACd,mBAAmBA,KACnB,mBAAmBA,KACnB,cAAcA,KACd,cAAcA,KACd,iBAAiBA,IAzBV,IA6BEC,IAAgB,CAACD,MACrBD,EAAeC,CAAG,KAAKA,EAAI,SAAS,SAiRhC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QAAW;AAC3D,UAAM+B,IAAeD,EAAiB9B,CAAM;AAC5C,QAAI+B,MAAiB,QAAW;AAC9B,YAAMmC,IAAW,GAAGvB,EAAuB,IAAI,IAAI3C,EAAO,SAAS;AACnE,MAAAiE,EAAaC,CAAQ,IAAInC;AAAA,IAC3B;AAAA,EACF;AAoBA,MAlBI,WAAW/B,KAAU,MAAM,QAAQA,EAAO,KAAK,KACjDA,EAAO,MAAM,QAAQ,CAACmE,MAAc;AAClC,QAAIvE,EAAeuE,CAAS,GAAG;AAC7B,YAAMC,IAAcJ,EAA0BG,CAAS;AACvD,aAAO,OAAOF,GAAcG,CAAW;AAAA,IACzC;AAAA,EACF,CAAC,GAGCpE,EAAO,SAAS,YAAYA,EAAO,cACrC,OAAO,OAAOA,EAAO,UAAU,EAAE,QAAQ,CAACqE,MAAe;AACvD,QAAIzE,EAAeyE,CAAU,GAAG;AAC9B,YAAMC,IAAeN,EAA0BK,CAAU;AACzD,aAAO,OAAOJ,GAAcK,CAAY;AAAA,IAC1C;AAAA,EACF,CAAC,GAIDtE,EAAO,wBACP,OAAOA,EAAO,wBAAyB,YACvCJ,EAAeI,EAAO,oBAAoB,GAC1C;AACA,UAAMuE,IAAmBP,EAA0BhE,EAAO,oBAAoB;AAC9E,WAAO,OAAOiE,GAAcM,CAAgB;AAAA,EAC9C;AAEA,MAAIvE,EAAO,SAAS,WAAW,WAAWA,KAAUJ,EAAeI,EAAO,KAAK,GAAG;AAChF,UAAMwE,IAAgBR,EAA0BhE,EAAO,KAAK;AAC5D,WAAO,OAAOiE,GAAcO,CAAa;AAAA,EAC3C;AAEA,SAAOP;AACT;"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var o = /* @__PURE__ */ ((t) => (t.Navbar = "navbar", t.Header = "header", t.SearchBarEntry = "search-bar-entry", t.SearchBarEntryMobile = "search-bar-entry-mobile", t.AssistantEntry = "assistant-entry", t.AssistantEntryMobile = "assistant-entry-mobile", t.RequestExample = "request-example", t.ResponseExample = "response-example", t.TopbarCtaButton = "topbar-cta-button", t.Sidebar = "sidebar", t.Footer = "footer", t.Banner = "banner", t.ContentArea = "content-area", t.Content = "content", t.SidebarContent = "sidebar-content", t.NavBarTransition = "navbar-transition", t.NavigationItems = "navigation-items", t.ContentContainer = "content-container", t.ContentSideLayout = "content-side-layout", t.TableOfContents = "table-of-contents", t.TableOfContentsLayout = "table-of-contents-layout", t.TableOfContentsContent = "table-of-contents-content", t.ChangelogFilters = "changelog-filters", t.ChangelogFiltersContent = "changelog-filters-content", t.Pagination = "pagination", t.PageTitle = "page-title", t.PageContextMenu = "page-context-menu", t.PageContextMenuButton = "page-context-menu-button", t.Panel = "panel", t.ChatAssistantSheet = "chat-assistant-sheet", t.ChatAssistantTextArea = "chat-assistant-textarea", t.SearchInput = "search-input", t.APIPlaygroundInput = "api-playground-input", t.AskAiCodeBlockButton = "ask-ai-code-block-button", t.CodeSnippetFeedbackButton = "code-snippet-feedback-button", t.CodeSnippetFeedbackTextArea = "code-snippet-feedback-textarea", t.EndpointsMenuTrigger = "endpoints-menu-trigger", t.MobileNav = "mobile-nav", t.MobileNavContent = "mobile-nav-content", t.LocalizationSelectTrigger = "localization-select-trigger", t.LocalizationSelectContent = "localization-select-content", t.LocalizationSelectItem = "localization-select-item", t.AssistantBarPlaceholder = "assistant-bar-placeholder", t))(o || {});
|
|
2
|
+
const n = {
|
|
3
|
+
Accordion: "accordion",
|
|
4
|
+
AccordionGroup: "accordion-group",
|
|
5
|
+
Callout: "callout",
|
|
6
|
+
Card: "card",
|
|
7
|
+
CardGroup: "card-group",
|
|
8
|
+
CodeBlock: "code-block",
|
|
9
|
+
CodeBlockIcon: "code-block-icon",
|
|
10
|
+
CodeGroup: "code-group",
|
|
11
|
+
Expandable: "expandable",
|
|
12
|
+
Field: "field",
|
|
13
|
+
Frame: "frame",
|
|
14
|
+
Icon: "icon",
|
|
15
|
+
Mermaid: "mermaid",
|
|
16
|
+
Step: "step",
|
|
17
|
+
Steps: "steps",
|
|
18
|
+
Tab: "tab",
|
|
19
|
+
Tabs: "tabs",
|
|
20
|
+
TabIcon: "tab-icon",
|
|
21
|
+
Update: "update",
|
|
22
|
+
Tooltip: "tooltip",
|
|
23
|
+
Panel: "panel",
|
|
24
|
+
APISection: "api-section",
|
|
25
|
+
APISectionHeading: "api-section-heading",
|
|
26
|
+
APISectionHeadingTitle: "api-section-heading-title",
|
|
27
|
+
APISectionHeadingSubtitle: "api-section-heading-subtitle",
|
|
28
|
+
OptionDropdown: "option-dropdown",
|
|
29
|
+
TryitButton: "tryit-button",
|
|
30
|
+
MethodPill: "method-pill",
|
|
31
|
+
MethodNavPill: "method-nav-pill",
|
|
32
|
+
NavTagPill: "nav-tag-pill",
|
|
33
|
+
NavTagPillText: "nav-tag-pill-text",
|
|
34
|
+
Anchors: "nav-anchors",
|
|
35
|
+
Anchor: "nav-anchor",
|
|
36
|
+
TabsBar: "nav-tabs",
|
|
37
|
+
TabsBarItem: "nav-tabs-item",
|
|
38
|
+
MobileNavTabsBarItem: "mobile-nav-tabs-item",
|
|
39
|
+
TableOfContents: "toc",
|
|
40
|
+
TableOfContentsItem: "toc-item",
|
|
41
|
+
Footer: "footer",
|
|
42
|
+
AdvancedFooter: "advanced-footer",
|
|
43
|
+
SidebarGroupIcon: "sidebar-group-icon",
|
|
44
|
+
SidebarGroupHeader: "sidebar-group-header",
|
|
45
|
+
SidebarTitle: "sidebar-title",
|
|
46
|
+
SidebarGroup: "sidebar-group",
|
|
47
|
+
SidebarNavGroupDivider: "sidebar-nav-group-divider",
|
|
48
|
+
NavBarLink: "navbar-link",
|
|
49
|
+
TopbarRightContainer: "topbar-right-container",
|
|
50
|
+
Logo: "nav-logo",
|
|
51
|
+
PaginationPrev: "pagination-prev",
|
|
52
|
+
PaginationNext: "pagination-next",
|
|
53
|
+
PaginationTitle: "pagination-title",
|
|
54
|
+
FeedbackToolbar: "feedback-toolbar",
|
|
55
|
+
Eyebrow: "eyebrow",
|
|
56
|
+
BreadcrumbList: "breadcrumb-list",
|
|
57
|
+
BreadcrumbItem: "breadcrumb-item",
|
|
58
|
+
Content: "mdx-content",
|
|
59
|
+
DropdownTrigger: "nav-dropdown-trigger",
|
|
60
|
+
DropdownContent: "nav-dropdown-content",
|
|
61
|
+
DropdownItem: "nav-dropdown-item",
|
|
62
|
+
DropdownItemTextContainer: "nav-dropdown-item-text-container",
|
|
63
|
+
DropdownItemTitle: "nav-dropdown-item-title",
|
|
64
|
+
DropdownItemDescription: "nav-dropdown-item-description",
|
|
65
|
+
DropdownItemIcon: "nav-dropdown-item-icon",
|
|
66
|
+
ProductsSelectorTrigger: "nav-dropdown-products-selector-trigger",
|
|
67
|
+
ProductsSelectorContent: "nav-dropdown-products-selector-content",
|
|
68
|
+
ProductsSelectorItem: "nav-dropdown-products-selector-item",
|
|
69
|
+
ProductsSelectorItemTitle: "nav-dropdown-products-selector-item-title",
|
|
70
|
+
ProductsSelectorItemDescription: "nav-dropdown-products-selector-item-description",
|
|
71
|
+
ProductsSelectorItemIcon: "nav-dropdown-products-selector-item-icon",
|
|
72
|
+
Link: "link",
|
|
73
|
+
AlmondLayout: "almond-layout",
|
|
74
|
+
AlmondNavBottomSection: "almond-nav-bottom-section",
|
|
75
|
+
AlmondNavBottomSectionDivider: "almond-nav-bottom-section-divider",
|
|
76
|
+
ChatAssistantSheet: "chat-assistant-sheet",
|
|
77
|
+
ChatAssistantSheetHeader: "chat-assistant-sheet-header",
|
|
78
|
+
ChatAssistantSheetContent: "chat-assistant-sheet-content",
|
|
79
|
+
ChatAssistantInput: "chat-assistant-input",
|
|
80
|
+
ChatAssistantFloatingInput: "chat-assistant-floating-input",
|
|
81
|
+
ChatAssistantSendButton: "chat-assistant-send-button",
|
|
82
|
+
ChatAssistantDisclaimerText: "chat-assistant-disclaimer-text",
|
|
83
|
+
StarterQuestionText: "starter-question-text",
|
|
84
|
+
LoginLink: "login-link",
|
|
85
|
+
LogoutLink: "logout-link",
|
|
86
|
+
ContextualFeedbackContainer: "contextual-feedback-container",
|
|
87
|
+
ContextualFeedbackForm: "contextual-feedback-form",
|
|
88
|
+
ContextualFeedbackFormTitle: "contextual-feedback-form-title",
|
|
89
|
+
ContextualFeedbackFormInput: "contextual-feedback-input",
|
|
90
|
+
ContextualFeedbackFormButton: "contextual-feedback-button",
|
|
91
|
+
ContextualFeedbackFormSubmitButton: "contextual-feedback-form-submit-button",
|
|
92
|
+
CodeSnippetFeedbackPopoverContent: "code-snippet-feedback-popover-content",
|
|
93
|
+
CodeSnippetFeedbackForm: "code-snippet-feedback-form",
|
|
94
|
+
CodeSnippetFeedbackButton: "code-snippet-feedback-button",
|
|
95
|
+
CodeSnippetFeedbackTextArea: "code-snippet-feedback-textarea",
|
|
96
|
+
CodeSnippetFeedbackFormTitle: "code-snippet-feedback-form-title",
|
|
97
|
+
CodeSnippetFeedbackFormDescription: "code-snippet-feedback-form-description",
|
|
98
|
+
CodeSnippetFeedbackFormSubmitButton: "code-snippet-feedback-form-submit-button",
|
|
99
|
+
NotFoundContainer: "not-found-container",
|
|
100
|
+
NotFoundStatusCode: "not-found-status-code",
|
|
101
|
+
NotFoundTitle: "not-found-title",
|
|
102
|
+
NotFoundDescription: "not-found-description",
|
|
103
|
+
NotFoundLogo: "not-found-logo",
|
|
104
|
+
NotFoundLogoContainer: "not-found-logo-container",
|
|
105
|
+
NotFoundMessage: "not-found-message",
|
|
106
|
+
NotFoundGoBackButton: "not-found-go-back-button",
|
|
107
|
+
NotFoundGoBackArrow: "not-found-go-back-arrow",
|
|
108
|
+
NotFoundGoBackText: "not-found-go-back-text",
|
|
109
|
+
NotFoundRecommendedPagesList: "not-found-recommended-pages-list",
|
|
110
|
+
NotFoundRecommendedPageLink: "not-found-recommended-page-link"
|
|
111
|
+
}, a = Object.fromEntries(
|
|
112
|
+
Object.entries(n).map(([t, e]) => [t, `${e}`])
|
|
113
|
+
);
|
|
114
|
+
export {
|
|
115
|
+
a as Classes,
|
|
116
|
+
o as Ids
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api-playground-2/types/index.ts"],"sourcesContent":["import React from 'react';\nimport {\n ParameterObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n ServerObject,\n SecurityOption,\n UUID,\n CodeSample,\n ApiPlaygroundInputs,\n Operation,\n} from '@mintlify/validation';\nimport { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nimport { CIRCULAR_REF_KEY } from '@/api-playground-2/constants';\n\nexport interface ApiReferenceDataV2 {\n filename?: string;\n originalFileLocation?: string;\n // operation is our new version of \"endpoint\" - V2 includes additional data for rendering\n operation?: OperationV2;\n // data for a schema-only page\n schemaData?: SchemaV2;\n dependencies?: {\n parameters?: Record<UUID, ParameterObject>;\n requestBody?: RequestBodyObject;\n responses?: Record<UUID, ResponseObject>;\n servers: Record<UUID, ServerObject>;\n security: Record<UUID, ResolvedSecurityObject>;\n processedSecurityOptions?: ProcessedSecurityOption[];\n schemas?: Record<UUID, SchemaObject>;\n };\n}\n\nexport type OperationV2 = Operation & {\n path: string;\n baseUrl: string | undefined;\n baseUrlOptions: string[];\n title: string;\n description: string;\n securityRequirements?: SecurityOption[];\n requestExamples?: CodeExample[];\n responseExamples?: CodeExample[];\n codeSamples?: CodeSample[];\n requestExampleType?: 'mdx' | 'webhook' | 'codeSamples' | 'generated';\n requestExampleLanguages?: string[];\n requiredOnlyExamples?: boolean;\n responseExampleType?: 'mdx' | 'generated';\n prefillPlaygroundWithExample?: boolean;\n prefillPlaygroundExamples?: ApiPlaygroundInputs[];\n disableProxy?: boolean;\n};\n\nexport type SchemaV2 = SchemaObject;\n\nexport type ResolvedSecurityObject = {\n [name: string]: SecuritySchemeAndScope;\n};\n\nexport type SecuritySchemeAndScope = (\n | OpenAPIV3.SecuritySchemeObject\n | OpenAPIV3_1.SecuritySchemeObject\n) & {\n scopes?: string[];\n 'x-default'?: string;\n};\n\nexport type ProcessedSecurityOption = {\n scheme: SecuritySchemeAndScope;\n schema: SchemaObject;\n};\n\nexport type CodeExample = {\n dropdown?: boolean;\n language?: string;\n code?: string | React.ReactElement | React.ReactElement[];\n filename?: string;\n};\n\nexport type SchemaGeneratedExample = {\n title: string;\n description?: string;\n value: unknown;\n};\n\n/**\n * SchemaObject after being processed by the various transformations in `resolveOperationWithDependencies`.\n * This is the type of object that all the API UI components should be consuming. Any properties that\n * aren't actually part of the OpenAPI V3/3.1 SchemaObject type should be put here—as such, we should\n * be very judicious about adding anything to this type!\n */\nexport type ResolvedSchemaObject = SchemaObject & {\n /**\n * Distinct from the `required` property of the OpenAPI V3/3.1 SchemaObject type, which is either\n * a boolean on a property (V3) or an array of strings on the parent schema (V3.1). Our version is\n * determined from whichever one of those is relevant; a UI component doesn't have to do any figuring-out\n * itself, it just has to check for this property.\n */\n isRequired?: boolean;\n /**\n * A unique key representing the path to this schema node from the root. Used for generating\n * unique input keys in the playground data store.\n */\n uniqueKey?: string;\n\n isCircular?: boolean;\n\n type?: DifferentiatedType;\n\n [CIRCULAR_REF_KEY]?: UUID;\n};\n\nexport type CircularRefObject = {\n [CIRCULAR_REF_KEY]: UUID;\n};\n\nexport type DifferentiatedType =\n | SchemaObject['type']\n | 'oneOf'\n | 'any'\n | 'enum<string>'\n | 'enum<number>'\n | 'enum<integer>'\n | 'file';\n\nexport type Location = 'request' | 'response';\nexport type ReducedSchema = ResolvedSchemaObject & { oneOf: ResolvedSchemaObject[] };\n\nexport enum Ids {\n Navbar = 'navbar',\n Header = 'header',\n SearchBarEntry = 'search-bar-entry',\n SearchBarEntryMobile = 'search-bar-entry-mobile',\n AssistantEntry = 'assistant-entry',\n AssistantEntryMobile = 'assistant-entry-mobile',\n RequestExample = 'request-example',\n ResponseExample = 'response-example',\n TopbarCtaButton = 'topbar-cta-button',\n Sidebar = 'sidebar',\n Footer = 'footer',\n Banner = 'banner',\n ContentArea = 'content-area',\n Content = 'content',\n SidebarContent = 'sidebar-content',\n NavBarTransition = 'navbar-transition',\n NavigationItems = 'navigation-items',\n ContentContainer = 'content-container',\n ContentSideLayout = 'content-side-layout',\n TableOfContents = 'table-of-contents',\n TableOfContentsLayout = 'table-of-contents-layout',\n TableOfContentsContent = 'table-of-contents-content',\n ChangelogFilters = 'changelog-filters',\n ChangelogFiltersContent = 'changelog-filters-content',\n Pagination = 'pagination',\n PageTitle = 'page-title',\n PageContextMenu = 'page-context-menu',\n PageContextMenuButton = 'page-context-menu-button',\n Panel = 'panel',\n ChatAssistantSheet = 'chat-assistant-sheet',\n ChatAssistantTextArea = 'chat-assistant-textarea',\n SearchInput = 'search-input',\n APIPlaygroundInput = 'api-playground-input',\n AskAiCodeBlockButton = 'ask-ai-code-block-button',\n CodeSnippetFeedbackButton = 'code-snippet-feedback-button',\n CodeSnippetFeedbackTextArea = 'code-snippet-feedback-textarea',\n EndpointsMenuTrigger = 'endpoints-menu-trigger',\n MobileNav = 'mobile-nav',\n MobileNavContent = 'mobile-nav-content',\n LocalizationSelectTrigger = 'localization-select-trigger',\n LocalizationSelectContent = 'localization-select-content',\n LocalizationSelectItem = 'localization-select-item',\n AssistantBarPlaceholder = 'assistant-bar-placeholder',\n}\n\nconst _classes = {\n Accordion: 'accordion',\n AccordionGroup: 'accordion-group',\n Callout: 'callout',\n Card: 'card',\n CardGroup: 'card-group',\n CodeBlock: 'code-block',\n CodeBlockIcon: 'code-block-icon',\n CodeGroup: 'code-group',\n Expandable: 'expandable',\n Field: 'field',\n Frame: 'frame',\n Icon: 'icon',\n Mermaid: 'mermaid',\n Step: 'step',\n Steps: 'steps',\n Tab: 'tab',\n Tabs: 'tabs',\n TabIcon: 'tab-icon',\n Update: 'update',\n Tooltip: 'tooltip',\n Panel: 'panel',\n APISection: 'api-section',\n APISectionHeading: 'api-section-heading',\n APISectionHeadingTitle: 'api-section-heading-title',\n APISectionHeadingSubtitle: 'api-section-heading-subtitle',\n OptionDropdown: 'option-dropdown',\n TryitButton: 'tryit-button',\n MethodPill: 'method-pill',\n MethodNavPill: 'method-nav-pill',\n NavTagPill: 'nav-tag-pill',\n NavTagPillText: 'nav-tag-pill-text',\n\n Anchors: 'nav-anchors',\n Anchor: 'nav-anchor',\n TabsBar: 'nav-tabs',\n TabsBarItem: 'nav-tabs-item',\n MobileNavTabsBarItem: 'mobile-nav-tabs-item',\n TableOfContents: 'toc',\n TableOfContentsItem: 'toc-item',\n Footer: 'footer',\n AdvancedFooter: 'advanced-footer',\n SidebarGroupIcon: 'sidebar-group-icon',\n SidebarGroupHeader: 'sidebar-group-header',\n SidebarTitle: 'sidebar-title',\n SidebarGroup: 'sidebar-group',\n SidebarNavGroupDivider: 'sidebar-nav-group-divider',\n NavBarLink: 'navbar-link',\n TopbarRightContainer: 'topbar-right-container',\n Logo: 'nav-logo',\n PaginationPrev: 'pagination-prev',\n PaginationNext: 'pagination-next',\n PaginationTitle: 'pagination-title',\n FeedbackToolbar: 'feedback-toolbar',\n Eyebrow: 'eyebrow',\n BreadcrumbList: 'breadcrumb-list',\n BreadcrumbItem: 'breadcrumb-item',\n Content: 'mdx-content',\n DropdownTrigger: 'nav-dropdown-trigger',\n DropdownContent: 'nav-dropdown-content',\n DropdownItem: 'nav-dropdown-item',\n DropdownItemTextContainer: 'nav-dropdown-item-text-container',\n DropdownItemTitle: 'nav-dropdown-item-title',\n DropdownItemDescription: 'nav-dropdown-item-description',\n DropdownItemIcon: 'nav-dropdown-item-icon',\n ProductsSelectorTrigger: 'nav-dropdown-products-selector-trigger',\n ProductsSelectorContent: 'nav-dropdown-products-selector-content',\n ProductsSelectorItem: 'nav-dropdown-products-selector-item',\n ProductsSelectorItemTitle: 'nav-dropdown-products-selector-item-title',\n ProductsSelectorItemDescription: 'nav-dropdown-products-selector-item-description',\n ProductsSelectorItemIcon: 'nav-dropdown-products-selector-item-icon',\n\n Link: 'link',\n\n AlmondLayout: 'almond-layout',\n AlmondNavBottomSection: 'almond-nav-bottom-section',\n AlmondNavBottomSectionDivider: 'almond-nav-bottom-section-divider',\n\n ChatAssistantSheet: 'chat-assistant-sheet',\n ChatAssistantSheetHeader: 'chat-assistant-sheet-header',\n ChatAssistantSheetContent: 'chat-assistant-sheet-content',\n ChatAssistantInput: 'chat-assistant-input',\n ChatAssistantFloatingInput: 'chat-assistant-floating-input',\n ChatAssistantSendButton: 'chat-assistant-send-button',\n ChatAssistantDisclaimerText: 'chat-assistant-disclaimer-text',\n StarterQuestionText: 'starter-question-text',\n\n LoginLink: 'login-link',\n LogoutLink: 'logout-link',\n\n ContextualFeedbackContainer: 'contextual-feedback-container',\n ContextualFeedbackForm: 'contextual-feedback-form',\n ContextualFeedbackFormTitle: 'contextual-feedback-form-title',\n ContextualFeedbackFormInput: 'contextual-feedback-input',\n ContextualFeedbackFormButton: 'contextual-feedback-button',\n ContextualFeedbackFormSubmitButton: 'contextual-feedback-form-submit-button',\n\n CodeSnippetFeedbackPopoverContent: 'code-snippet-feedback-popover-content',\n CodeSnippetFeedbackForm: 'code-snippet-feedback-form',\n CodeSnippetFeedbackButton: 'code-snippet-feedback-button',\n CodeSnippetFeedbackTextArea: 'code-snippet-feedback-textarea',\n CodeSnippetFeedbackFormTitle: 'code-snippet-feedback-form-title',\n CodeSnippetFeedbackFormDescription: 'code-snippet-feedback-form-description',\n CodeSnippetFeedbackFormSubmitButton: 'code-snippet-feedback-form-submit-button',\n\n NotFoundContainer: 'not-found-container',\n NotFoundStatusCode: 'not-found-status-code',\n NotFoundTitle: 'not-found-title',\n NotFoundDescription: 'not-found-description',\n NotFoundLogo: 'not-found-logo',\n NotFoundLogoContainer: 'not-found-logo-container',\n NotFoundMessage: 'not-found-message',\n NotFoundGoBackButton: 'not-found-go-back-button',\n NotFoundGoBackArrow: 'not-found-go-back-arrow',\n NotFoundGoBackText: 'not-found-go-back-text',\n NotFoundRecommendedPagesList: 'not-found-recommended-pages-list',\n NotFoundRecommendedPageLink: 'not-found-recommended-page-link',\n} as const;\n\n \nexport const Classes = Object.fromEntries(\n Object.entries(_classes).map(([key, value]) => [key, `${value}`])\n) as { readonly [K in keyof typeof _classes]: `${(typeof _classes)[K]}` };\n"],"names":["Ids","_classes","Classes","key","value"],"mappings":"AAiIO,IAAKA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,iBAAiB,oBACjBA,EAAA,uBAAuB,2BACvBA,EAAA,iBAAiB,mBACjBA,EAAA,uBAAuB,0BACvBA,EAAA,iBAAiB,mBACjBA,EAAA,kBAAkB,oBAClBA,EAAA,kBAAkB,qBAClBA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,cAAc,gBACdA,EAAA,UAAU,WACVA,EAAA,iBAAiB,mBACjBA,EAAA,mBAAmB,qBACnBA,EAAA,kBAAkB,oBAClBA,EAAA,mBAAmB,qBACnBA,EAAA,oBAAoB,uBACpBA,EAAA,kBAAkB,qBAClBA,EAAA,wBAAwB,4BACxBA,EAAA,yBAAyB,6BACzBA,EAAA,mBAAmB,qBACnBA,EAAA,0BAA0B,6BAC1BA,EAAA,aAAa,cACbA,EAAA,YAAY,cACZA,EAAA,kBAAkB,qBAClBA,EAAA,wBAAwB,4BACxBA,EAAA,QAAQ,SACRA,EAAA,qBAAqB,wBACrBA,EAAA,wBAAwB,2BACxBA,EAAA,cAAc,gBACdA,EAAA,qBAAqB,wBACrBA,EAAA,uBAAuB,4BACvBA,EAAA,4BAA4B,gCAC5BA,EAAA,8BAA8B,kCAC9BA,EAAA,uBAAuB,0BACvBA,EAAA,YAAY,cACZA,EAAA,mBAAmB,sBACnBA,EAAA,4BAA4B,+BAC5BA,EAAA,4BAA4B,+BAC5BA,EAAA,yBAAyB,4BACzBA,EAAA,0BAA0B,6BA3ChBA,IAAAA,KAAA,CAAA,CAAA;AA8CZ,MAAMC,IAAW;AAAA,EACf,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe;A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ACxB,+BAA+B;AAAA,EAE/B,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,oBAAoB;AAAA,EACpB,4BAA4B;AAAA,EAC5B,yBAAyB;AAAA,EACzB,6BAA6B;AAAA,EAC7B,qBAAqB;AAAA,EAErB,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB,6BAA6B;AAAA,EAC7B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EAEpC,mCAAmC;AAAA,EACnC,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,qCAAqC;AAAA,EAErC,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,8BAA8B;AAAA,EAC9B,6BAA6B;AAC/B,GAGaC,IAAU,OAAO;AAAA,EAC5B,OAAO,QAAQD,CAAQ,EAAE,IAAI,CAAC,CAACE,GAAKC,CAAK,MAAM,CAACD,GAAK,GAAGC,CAAK,EAAE,CAAC;AAClE;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function e(n) {
|
|
2
|
+
return typeof n == "string";
|
|
3
|
+
}
|
|
4
|
+
function t(n) {
|
|
5
|
+
const r = Number(n);
|
|
6
|
+
return typeof r == "number" && !isNaN(r);
|
|
7
|
+
}
|
|
8
|
+
function i(n) {
|
|
9
|
+
const r = Number(n);
|
|
10
|
+
return typeof r == "number" && !isNaN(r) && r % 1 === 0;
|
|
11
|
+
}
|
|
12
|
+
function o(n) {
|
|
13
|
+
return !!n && typeof n == "object" && !Array.isArray(n);
|
|
14
|
+
}
|
|
15
|
+
function u(n) {
|
|
16
|
+
return !!n && typeof n == "object" && Array.isArray(n);
|
|
17
|
+
}
|
|
18
|
+
function f(n) {
|
|
19
|
+
return typeof n == "boolean";
|
|
20
|
+
}
|
|
21
|
+
function s(n) {
|
|
22
|
+
return n === null;
|
|
23
|
+
}
|
|
24
|
+
function c(n) {
|
|
25
|
+
return typeof window < "u" && n instanceof File;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
u as isArray,
|
|
29
|
+
f as isBoolean,
|
|
30
|
+
c as isFile,
|
|
31
|
+
i as isInteger,
|
|
32
|
+
s as isNull,
|
|
33
|
+
t as isNumber,
|
|
34
|
+
o as isObject,
|
|
35
|
+
e as isString
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sources":["../../src/common/guards.ts"],"sourcesContent":["import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\n\nexport function isNumber(val: unknown): val is number {\n const num = Number(val);\n return typeof num === 'number' && !isNaN(num);\n}\n\nexport function isInteger(val: unknown): val is number {\n const num = Number(val);\n return typeof num === 'number' && !isNaN(num) && num % 1 === 0;\n}\n\nexport function isObject(val: unknown): val is Record<string, unknown> {\n return !!val && typeof val === 'object' && !Array.isArray(val);\n}\n\nexport function isArray(val: unknown): val is Array<unknown> {\n return !!val && typeof val === 'object' && Array.isArray(val);\n}\n\nexport function isBoolean(val: unknown): val is boolean {\n return typeof val === 'boolean';\n}\n\nexport function isNull(val: unknown): val is null {\n return val === null;\n}\n\n/** File is a web API - must do window check to avoid server-side error */\nexport function isFile(val: unknown): val is File {\n return typeof window !== 'undefined' && val instanceof File;\n}\n\nexport const CHILD_TAB_IDS_ATTRIBUTE = 'data-child-tab-ids';\nexport const CHILD_HEADING_IDS_ATTRIBUTE = 'data-child-heading-ids';\n\nexport type DocumentV3 = OpenAPIV3.Document | OpenAPIV3_1.Document;\n"],"names":["isString","val","isNumber","num","isInteger","isObject","isArray","isBoolean","isNull","isFile"],"mappings":"AAEO,SAASA,EAASC,GAA6B;AACpD,SAAO,OAAOA,KAAQ;AACxB;AAEO,SAASC,EAASD,GAA6B;AACpD,QAAME,IAAM,OAAOF,CAAG;AACtB,SAAO,OAAOE,KAAQ,YAAY,CAAC,MAAMA,CAAG;AAC9C;AAEO,SAASC,EAAUH,GAA6B;AACrD,QAAME,IAAM,OAAOF,CAAG;AACtB,SAAO,OAAOE,KAAQ,YAAY,CAAC,MAAMA,CAAG,KAAKA,IAAM,MAAM;AAC/D;AAEO,SAASE,EAASJ,GAA8C;AACrE,SAAO,CAAC,CAACA,KAAO,OAAOA,KAAQ,YAAY,CAAC,MAAM,QAAQA,CAAG;AAC/D;AAEO,SAASK,EAAQL,GAAqC;AAC3D,SAAO,CAAC,CAACA,KAAO,OAAOA,KAAQ,YAAY,MAAM,QAAQA,CAAG;AAC9D;AAEO,SAASM,EAAUN,GAA8B;AACtD,SAAO,OAAOA,KAAQ;AACxB;AAEO,SAASO,EAAOP,GAA2B;AAChD,SAAOA,MAAQ;AACjB;AAGO,SAASQ,EAAOR,GAA2B;AAChD,SAAO,OAAO,SAAW,OAAeA,aAAe;AACzD;"}
|