@mintlify/msft-sdk 1.1.57 → 1.1.59
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/ApiPlaygroundContext.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/index.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +0 -1
- package/dist/api-playground/ApiPlayground/Response/index.js +0 -1
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +0 -1
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +0 -1
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js +0 -1
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -1
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -1
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -1
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js +0 -1
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +0 -1
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +0 -1
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -1
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +0 -1
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js +0 -1
- package/dist/api-playground/ApiPlayground/components/SendPill.js +0 -1
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -1
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +0 -1
- package/dist/api-playground/ApiPlayground/index.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -1
- package/dist/api-playground/EndpointFields/components/Description.js +0 -1
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +0 -1
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +0 -1
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +0 -1
- package/dist/api-playground/EndpointFields/index.js +0 -1
- package/dist/api-playground-2/Api.js +0 -1
- package/dist/api-playground-2/ApiExamples.js +0 -1
- package/dist/api-playground-2/ApiFields.js +0 -1
- package/dist/api-playground-2/EndpointHeader.js +0 -1
- package/dist/api-playground-2/OperationPage.js +0 -1
- package/dist/api-playground-2/Playground.js +0 -1
- package/dist/api-playground-2/SchemaPage.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +0 -1
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +0 -1
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +0 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +0 -1
- package/dist/api-playground-2/components/Example/ResponseExample.js +0 -1
- package/dist/api-playground-2/components/Request/BodySection.js +0 -1
- package/dist/api-playground-2/components/Request/InputSectionContainer.js +0 -1
- package/dist/api-playground-2/components/Request/ParameterSection.js +0 -1
- package/dist/api-playground-2/components/Request/SecuritySection.js +0 -1
- package/dist/api-playground-2/components/Request/ServerSection.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/NullInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +0 -1
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +0 -1
- package/dist/api-playground-2/components/TypeDropdown.js +0 -1
- package/dist/api-playground-2/constants/index.js +0 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +0 -1
- package/dist/api-playground-2/generators/createBodyData.js +0 -1
- package/dist/api-playground-2/generators/createHeaders.js +0 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +0 -1
- package/dist/api-playground-2/generators/generateRequest.js +0 -1
- package/dist/api-playground-2/generators/generateResponseExampleMap.js +0 -1
- package/dist/api-playground-2/generators/generateSnippet.js +0 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +0 -1
- package/dist/api-playground-2/generators/getFileProperties.js +0 -1
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +0 -1
- package/dist/api-playground-2/hooks/useInitializeInputs.js +0 -1
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +0 -1
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +0 -1
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +0 -1
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +0 -1
- package/dist/api-playground-2/schemaGraph/errors.js +0 -1
- package/dist/api-playground-2/schemaGraph/getAllRequiredProperties.js +0 -1
- package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js +0 -1
- package/dist/api-playground-2/schemaGraph/getDocumentProperties.js +0 -1
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +0 -1
- package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js +0 -1
- package/dist/api-playground-2/schemaGraph/processExamples.js +0 -1
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +0 -1
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js +0 -1
- package/dist/api-playground-2/schemaGraph/resolveGraphNode.js +0 -1
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +0 -1
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +0 -1
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +0 -1
- package/dist/api-playground-2/schemaGraph/utils.js +0 -1
- package/dist/api-playground-2/types/index.js +0 -1
- package/dist/common/guards.js +0 -1
- package/dist/common/parseApiTargetFromMetadata.js +0 -1
- package/dist/common/parseOpenApiString.js +0 -1
- package/dist/common/potentiallyParseOpenApiString.js +0 -1
- package/dist/common/replaceSlashIndex.js +0 -1
- package/dist/common/slugToTitle.js +0 -1
- package/dist/components/Api/ApiReferenceProvider.js +0 -1
- package/dist/components/Api/ErrorBoundary.js +0 -1
- package/dist/components/Api/Expandable.js +0 -1
- package/dist/components/Api/Markdown.js +0 -1
- package/dist/components/Api/MethodPill.js +0 -1
- package/dist/components/Api/Param.js +0 -1
- package/dist/components/Api/colors.js +0 -1
- package/dist/components/Api/dropdown-menu.js +0 -1
- package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js +0 -1
- package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js +0 -1
- package/dist/components/content-components/CodeGroupSelect/index.js +0 -1
- package/dist/components/content-components/all-components.js +0 -1
- package/dist/components/content-components/callouts.js +0 -1
- package/dist/components/content-components/code-block.js +0 -1
- package/dist/components/content-components/code-group.js +0 -1
- package/dist/components/content-components/code-snippet.js +0 -1
- package/dist/components/content-components/code-snippets.js +0 -1
- package/dist/components/content-components/default-components.js +0 -1
- package/dist/components/content-components/details/details.js +0 -1
- package/dist/components/content-components/getNodeText.js +0 -1
- package/dist/components/content-components/heading.js +0 -1
- package/dist/components/content-components/home.js +0 -1
- package/dist/components/content-components/image.js +0 -1
- package/dist/components/content-components/latex.js +0 -1
- package/dist/components/content-components/link.js +0 -1
- package/dist/components/content-components/param-name.js +0 -1
- package/dist/components/content-components/table/index.js +0 -1
- package/dist/components/content-components/table/table-modal.js +0 -1
- package/dist/components/content-components/tabs/tab.js +0 -1
- package/dist/components/content-components/tabs/tabs.js +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-context.js +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot.js +0 -1
- package/dist/components/content-components/zone-pivots/zone-target.js +0 -1
- package/dist/components/docsLayout.js +1 -1
- package/dist/components/docsPage.js +1 -1
- package/dist/components/mdx-renderer.js +0 -1
- package/dist/components/nav-tree/index.js +0 -1
- package/dist/components/nav-tree/mobile-nav.js +0 -1
- package/dist/components/page-context-menu.js +0 -1
- package/dist/components/plain-text-page.js +4 -4
- package/dist/components/toc/index.js +0 -1
- package/dist/components/toc/pivot-aware-toc.js +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/constants/initialRequest.js +0 -1
- package/dist/constants/prism-languages.js +0 -1
- package/dist/constants/snippetPresets.js +0 -1
- package/dist/constants/zIndex.js +0 -1
- package/dist/context/components-context.js +0 -1
- package/dist/contexts/ApiPlaygroundInputsContext.js +0 -1
- package/dist/contexts/CodeExampleLabelContext.js +0 -1
- package/dist/contexts/ConfigContext.js +0 -1
- package/dist/contexts/EndpointLocationContext.js +0 -1
- package/dist/contexts/MDXContentContext.js +0 -1
- package/dist/env.js +0 -1
- package/dist/hooks/useApiPlaygroundDisplay.js +0 -1
- package/dist/hooks/useApiPlaygroundInputs.js +0 -1
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -1
- package/dist/hooks/useBaseUrlOptions.js +0 -1
- package/dist/hooks/useCheckHash.js +0 -1
- package/dist/hooks/useComponentSchemas.js +0 -1
- package/dist/hooks/useEndpoint.js +0 -1
- package/dist/hooks/useExpandableMemory.js +0 -1
- package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -1
- package/dist/hooks/useGenerateNextItems.js +0 -1
- package/dist/hooks/useGenerateNextProperties.js +0 -1
- package/dist/hooks/useKeyboardShortcut.js +0 -1
- package/dist/hooks/useMDXContent.js +0 -1
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -1
- package/dist/hooks/useMarkdownCopy.js +0 -1
- package/dist/hooks/usePlaygroundSchemaOptions.js +0 -1
- package/dist/hooks/usePrefilledInputs/index.js +0 -1
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -1
- package/dist/hooks/useSecurityOption.js +0 -1
- package/dist/hooks/useSendPlaygroundRequest.js +0 -1
- package/dist/hooks/useSetDefaultValue.js +0 -1
- package/dist/index.js +0 -1
- package/dist/openapi/filterEnums.js +0 -1
- package/dist/openapi/generateNextAdditionalProperties.js +0 -1
- package/dist/openapi/generateNextItems.js +0 -1
- package/dist/openapi/generateNextProperties.js +0 -1
- package/dist/openapi/generateOptionLabels.js +0 -1
- package/dist/openapi/generateSimpleLabels.js +0 -1
- package/dist/openapi/generateTypeStringFromSchema.js +0 -1
- package/dist/openapi/getAuthFilteredSchemaArray.js +0 -1
- package/dist/parser/convert-html-to-mdx.js +0 -1
- package/dist/parser/serialize-mdx.js +0 -1
- package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -1
- package/dist/paths/optionallyRemoveLeadingSlash.js +0 -1
- package/dist/paths/optionallyRemoveTrailingSlash.js +0 -1
- package/dist/plugins/extract-headings.js +0 -1
- package/dist/plugins/rehype/rehype-code-blocks.js +0 -1
- package/dist/plugins/remark/remark-heading-ids.js +0 -1
- package/dist/plugins/sanitize/rehype-callouts.js +0 -1
- package/dist/plugins/sanitize/rehype-details.js +0 -1
- package/dist/plugins/sanitize/rehype-heading-ids.js +0 -1
- package/dist/plugins/sanitize/rehype-image-urls.js +0 -1
- package/dist/plugins/sanitize/rehype-latex.js +0 -1
- package/dist/plugins/sanitize/rehype-param-name.js +0 -1
- package/dist/plugins/sanitize/rehype-pre-to-mdx-fence.js +0 -1
- package/dist/plugins/sanitize/rehype-remark.js +0 -1
- package/dist/plugins/sanitize/rehype-table-align.js +0 -1
- package/dist/plugins/sanitize/rehype-tabs.js +0 -1
- package/dist/plugins/sanitize/rehype-unwrap-image-links.js +0 -1
- package/dist/plugins/sanitize/rehype-zone-pivots.js +0 -1
- package/dist/plugins/sanitize/remove-html-comments.js +0 -1
- package/dist/styles.css +1 -1
- package/dist/utils/api-playground/defaults.js +0 -1
- package/dist/utils/api-playground/paramFieldDefaults.js +0 -1
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -1
- package/dist/utils/api-reference/getNextPropertiesByType.js +0 -1
- package/dist/utils/clean-title.js +0 -1
- package/dist/utils/cn.js +0 -1
- package/dist/utils/containsMarkdownTable.js +0 -1
- package/dist/utils/copyToClipboard.js +0 -1
- package/dist/utils/flattenObject.js +0 -1
- package/dist/utils/formatJSON.js +0 -1
- package/dist/utils/generate-llms-txt.js +0 -1
- package/dist/utils/get-node-text.js +0 -1
- package/dist/utils/getScrollbarClassname.js +0 -1
- package/dist/utils/locales/en.js +0 -1
- package/dist/utils/locales/index.js +0 -1
- package/dist/utils/rehype.js +0 -1
- package/dist/utils/scrollElementIntoView.js +0 -1
- package/dist/utils/string.js +0 -1
- package/dist/utils/uuid.js +0 -1
- package/package.json +1 -1
- package/dist/api-playground/ApiPlayground/ApiPlaygroundContext.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/index.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +0 -1
- package/dist/api-playground/ApiPlayground/Response/index.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/SendPill.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +0 -1
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +0 -1
- package/dist/api-playground/ApiPlayground/index.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +0 -1
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +0 -1
- package/dist/api-playground/EndpointFields/components/Description.js.map +0 -1
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +0 -1
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +0 -1
- package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +0 -1
- package/dist/api-playground/EndpointFields/index.js.map +0 -1
- package/dist/api-playground-2/Api.js.map +0 -1
- package/dist/api-playground-2/ApiExamples.js.map +0 -1
- package/dist/api-playground-2/ApiFields.js.map +0 -1
- package/dist/api-playground-2/EndpointHeader.js.map +0 -1
- package/dist/api-playground-2/OperationPage.js.map +0 -1
- package/dist/api-playground-2/Playground.js.map +0 -1
- package/dist/api-playground-2/SchemaPage.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +0 -1
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +0 -1
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +0 -1
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js.map +0 -1
- package/dist/api-playground-2/components/Example/RequestExample.js.map +0 -1
- package/dist/api-playground-2/components/Example/ResponseExample.js.map +0 -1
- package/dist/api-playground-2/components/Request/BodySection.js.map +0 -1
- package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +0 -1
- package/dist/api-playground-2/components/Request/ParameterSection.js.map +0 -1
- package/dist/api-playground-2/components/Request/SecuritySection.js.map +0 -1
- package/dist/api-playground-2/components/Request/ServerSection.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +0 -1
- package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +0 -1
- package/dist/api-playground-2/components/TypeDropdown.js.map +0 -1
- package/dist/api-playground-2/constants/index.js.map +0 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +0 -1
- package/dist/api-playground-2/generators/createBodyData.js.map +0 -1
- package/dist/api-playground-2/generators/createHeaders.js.map +0 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +0 -1
- package/dist/api-playground-2/generators/generateRequest.js.map +0 -1
- package/dist/api-playground-2/generators/generateResponseExampleMap.js.map +0 -1
- package/dist/api-playground-2/generators/generateSnippet.js.map +0 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js.map +0 -1
- package/dist/api-playground-2/generators/getFileProperties.js.map +0 -1
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +0 -1
- package/dist/api-playground-2/hooks/useInitializeInputs.js.map +0 -1
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +0 -1
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/errors.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/getAllRequiredProperties.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/getDocumentProperties.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/resolveGraphNode.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js.map +0 -1
- package/dist/api-playground-2/schemaGraph/utils.js.map +0 -1
- package/dist/api-playground-2/types/index.js.map +0 -1
- package/dist/common/guards.js.map +0 -1
- package/dist/common/parseApiTargetFromMetadata.js.map +0 -1
- package/dist/common/parseOpenApiString.js.map +0 -1
- package/dist/common/potentiallyParseOpenApiString.js.map +0 -1
- package/dist/common/replaceSlashIndex.js.map +0 -1
- package/dist/common/slugToTitle.js.map +0 -1
- package/dist/components/Api/ApiReferenceProvider.js.map +0 -1
- package/dist/components/Api/ErrorBoundary.js.map +0 -1
- package/dist/components/Api/Expandable.js.map +0 -1
- package/dist/components/Api/Markdown.js.map +0 -1
- package/dist/components/Api/MethodPill.js.map +0 -1
- package/dist/components/Api/Param.js.map +0 -1
- package/dist/components/Api/colors.js.map +0 -1
- package/dist/components/Api/dropdown-menu.js.map +0 -1
- package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js.map +0 -1
- package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js.map +0 -1
- package/dist/components/content-components/CodeGroupSelect/index.js.map +0 -1
- package/dist/components/content-components/all-components.js.map +0 -1
- package/dist/components/content-components/callouts.js.map +0 -1
- package/dist/components/content-components/code-block.js.map +0 -1
- package/dist/components/content-components/code-group.js.map +0 -1
- package/dist/components/content-components/code-snippet.js.map +0 -1
- package/dist/components/content-components/code-snippets.js.map +0 -1
- package/dist/components/content-components/default-components.js.map +0 -1
- package/dist/components/content-components/details/details.js.map +0 -1
- package/dist/components/content-components/getNodeText.js.map +0 -1
- package/dist/components/content-components/heading.js.map +0 -1
- package/dist/components/content-components/home.js.map +0 -1
- package/dist/components/content-components/image.js.map +0 -1
- package/dist/components/content-components/latex.js.map +0 -1
- package/dist/components/content-components/link.js.map +0 -1
- package/dist/components/content-components/param-name.js.map +0 -1
- package/dist/components/content-components/table/index.js.map +0 -1
- package/dist/components/content-components/table/table-modal.js.map +0 -1
- package/dist/components/content-components/tabs/tab.js.map +0 -1
- package/dist/components/content-components/tabs/tabs.js.map +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-context.js.map +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js.map +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot.js.map +0 -1
- package/dist/components/content-components/zone-pivots/zone-target.js.map +0 -1
- package/dist/components/docsLayout.js.map +0 -1
- package/dist/components/docsPage.js.map +0 -1
- package/dist/components/mdx-renderer.js.map +0 -1
- package/dist/components/nav-tree/index.js.map +0 -1
- package/dist/components/nav-tree/mobile-nav.js.map +0 -1
- package/dist/components/page-context-menu.js.map +0 -1
- package/dist/components/plain-text-page.js.map +0 -1
- package/dist/components/toc/index.js.map +0 -1
- package/dist/components/toc/pivot-aware-toc.js.map +0 -1
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/initialRequest.js.map +0 -1
- package/dist/constants/prism-languages.js.map +0 -1
- package/dist/constants/snippetPresets.js.map +0 -1
- package/dist/constants/zIndex.js.map +0 -1
- package/dist/context/components-context.js.map +0 -1
- package/dist/contexts/ApiPlaygroundInputsContext.js.map +0 -1
- package/dist/contexts/CodeExampleLabelContext.js.map +0 -1
- package/dist/contexts/ConfigContext.js.map +0 -1
- package/dist/contexts/EndpointLocationContext.js.map +0 -1
- package/dist/contexts/MDXContentContext.js.map +0 -1
- package/dist/env.js.map +0 -1
- package/dist/hooks/useApiPlaygroundDisplay.js.map +0 -1
- package/dist/hooks/useApiPlaygroundInputs.js.map +0 -1
- package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +0 -1
- package/dist/hooks/useBaseUrlOptions.js.map +0 -1
- package/dist/hooks/useCheckHash.js.map +0 -1
- package/dist/hooks/useComponentSchemas.js.map +0 -1
- package/dist/hooks/useEndpoint.js.map +0 -1
- package/dist/hooks/useExpandableMemory.js.map +0 -1
- package/dist/hooks/useGenerateNextAdditionalProperties.js.map +0 -1
- package/dist/hooks/useGenerateNextItems.js.map +0 -1
- package/dist/hooks/useGenerateNextProperties.js.map +0 -1
- package/dist/hooks/useKeyboardShortcut.js.map +0 -1
- package/dist/hooks/useMDXContent.js.map +0 -1
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +0 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +0 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +0 -1
- package/dist/hooks/useMarkdownCopy.js.map +0 -1
- package/dist/hooks/usePlaygroundSchemaOptions.js.map +0 -1
- package/dist/hooks/usePrefilledInputs/index.js.map +0 -1
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +0 -1
- package/dist/hooks/useSecurityOption.js.map +0 -1
- package/dist/hooks/useSendPlaygroundRequest.js.map +0 -1
- package/dist/hooks/useSetDefaultValue.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/openapi/filterEnums.js.map +0 -1
- package/dist/openapi/generateNextAdditionalProperties.js.map +0 -1
- package/dist/openapi/generateNextItems.js.map +0 -1
- package/dist/openapi/generateNextProperties.js.map +0 -1
- package/dist/openapi/generateOptionLabels.js.map +0 -1
- package/dist/openapi/generateSimpleLabels.js.map +0 -1
- package/dist/openapi/generateTypeStringFromSchema.js.map +0 -1
- package/dist/openapi/getAuthFilteredSchemaArray.js.map +0 -1
- package/dist/parser/convert-html-to-mdx.js.map +0 -1
- package/dist/parser/serialize-mdx.js.map +0 -1
- package/dist/paths/isEqualIgnoringLeadingSlash.js.map +0 -1
- package/dist/paths/optionallyRemoveLeadingSlash.js.map +0 -1
- package/dist/paths/optionallyRemoveTrailingSlash.js.map +0 -1
- package/dist/plugins/extract-headings.js.map +0 -1
- package/dist/plugins/rehype/rehype-code-blocks.js.map +0 -1
- package/dist/plugins/remark/remark-heading-ids.js.map +0 -1
- package/dist/plugins/sanitize/rehype-callouts.js.map +0 -1
- package/dist/plugins/sanitize/rehype-details.js.map +0 -1
- package/dist/plugins/sanitize/rehype-heading-ids.js.map +0 -1
- package/dist/plugins/sanitize/rehype-image-urls.js.map +0 -1
- package/dist/plugins/sanitize/rehype-latex.js.map +0 -1
- package/dist/plugins/sanitize/rehype-param-name.js.map +0 -1
- package/dist/plugins/sanitize/rehype-pre-to-mdx-fence.js.map +0 -1
- package/dist/plugins/sanitize/rehype-remark.js.map +0 -1
- package/dist/plugins/sanitize/rehype-table-align.js.map +0 -1
- package/dist/plugins/sanitize/rehype-tabs.js.map +0 -1
- package/dist/plugins/sanitize/rehype-unwrap-image-links.js.map +0 -1
- package/dist/plugins/sanitize/rehype-zone-pivots.js.map +0 -1
- package/dist/plugins/sanitize/remove-html-comments.js.map +0 -1
- package/dist/utils/api-playground/defaults.js.map +0 -1
- package/dist/utils/api-playground/paramFieldDefaults.js.map +0 -1
- package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +0 -1
- package/dist/utils/api-reference/getNextPropertiesByType.js.map +0 -1
- package/dist/utils/clean-title.js.map +0 -1
- package/dist/utils/cn.js.map +0 -1
- package/dist/utils/containsMarkdownTable.js.map +0 -1
- package/dist/utils/copyToClipboard.js.map +0 -1
- package/dist/utils/flattenObject.js.map +0 -1
- package/dist/utils/formatJSON.js.map +0 -1
- package/dist/utils/generate-llms-txt.js.map +0 -1
- package/dist/utils/get-node-text.js.map +0 -1
- package/dist/utils/getScrollbarClassname.js.map +0 -1
- package/dist/utils/locales/en.js.map +0 -1
- package/dist/utils/locales/index.js.map +0 -1
- package/dist/utils/rehype.js.map +0 -1
- package/dist/utils/scrollElementIntoView.js.map +0 -1
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/uuid.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSendPlaygroundRequest.js","sources":["../../../src/api-playground-2/hooks/useSendPlaygroundRequest.ts"],"sourcesContent":["\nimport { ApiPlaygroundResultType } from '@mintlify/models';\nimport { HttpMethod } from '@mintlify/validation';\nimport { AxiosResponse } from 'axios';\nimport { useCallback } from 'react';\nimport { NEXT_PUBLIC } from '@/env';\n\n\nimport { ApiReferenceDataV2 } from '../types';\nimport { usePlaygroundInputsStore } from './usePlaygroundInputsStore';\n\nexport type UseSendPlaygroundRequestProps = {\n apiReferenceData: ApiReferenceDataV2;\n baseUrl: string | undefined;\n contentType: string | undefined;\n setResult: (result: ApiPlaygroundResultType) => void;\n setIsSending: (isSending: boolean) => void;\n};\n\nexport type RequestInfo = {\n method: HttpMethod;\n url: string;\n header: Record<string, unknown>;\n query: Record<string, unknown>;\n cookie: Record<string, unknown>;\n body: unknown;\n};\n\nexport const useSendPlaygroundRequest = ({\n apiReferenceData,\n baseUrl,\n contentType = 'application/json',\n setResult,\n setIsSending,\n}: UseSendPlaygroundRequestProps) => {\n // replace with msft analytics \n const { getApiPlaygroundInputs } = usePlaygroundInputsStore();\n const inputs = getApiPlaygroundInputs();\n\n const disableProxy = apiReferenceData.operation?.disableProxy;\n const path = apiReferenceData.operation?.path;\n const method = apiReferenceData.operation?.method;\n\n return useCallback(async () => {\n setIsSending(true);\n if (!path || !baseUrl || !method || !contentType || !baseUrl) {\n setIsSending(false);\n setResult({\n error: true,\n errorMessage: 'Missing required fields to send a playground request',\n });\n console.error(\n `Missing some required field to send a playground request:\\n\\npath=${path}\\nmethod=${method}\\ncontentType=${contentType}\\nbaseUrl=${baseUrl}`\n );\n return;\n }\n const axios = await import('axios').then((x) => x.default);\n\n const pathWithInputs = addPathParams(path, inputs.path);\n\n const url = joinWithSingleSlash(addServerVariables(baseUrl, inputs.server), pathWithInputs);\n\n const headers = addContentType(inputs.header, contentType);\n\n const request: RequestInfo = {\n method,\n url,\n header: headers,\n body: inputs.body,\n cookie: inputs.cookie,\n query: inputs.query,\n };\n\n try {\n if (disableProxy) {\n const response = await performDirectRequest(request);\n setResult({\n error: false,\n response: {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n data: response.data,\n },\n });\n } else {\n if (contentType && contentType.includes('multipart/form-data')) {\n const data = await performFileRequest(request);\n\n setResult(data);\n } else {\n const { data } = await axios.post<unknown, AxiosResponse<ApiPlaygroundResultType>>(\n `${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/request`,\n request\n );\n setResult(data);\n }\n }\n } catch (err) {\n setResult({\n error: true,\n errorMessage: 'unable to complete request',\n });\n console.error(err);\n }\n setIsSending(false);\n }, [\n method,\n path,\n setIsSending,\n inputs,\n baseUrl,\n contentType,\n disableProxy,\n setResult,\n ]);\n};\n\nexport const addPathParams = (path: string, pathInputs: Record<string, unknown>) => {\n return Object.entries(pathInputs).reduce((path, [inputName, inputValue]) => {\n if (inputValue == undefined) return path;\n return path.replace(`{${inputName}}`, encodeURIComponent(inputValue.toString()));\n }, path);\n};\n\nexport const addServerVariables = (baseUrl: string, variables: Record<string, string>): string => {\n let url = baseUrl;\n Object.entries(variables).forEach(([key, input]) => {\n if (input) url = url.replace(`{${key}}`, input);\n });\n return url;\n};\n\nexport const joinWithSingleSlash = (baseUrl: string, path: string): string => {\n // remove the last slash of the baseUrl and the first slash of the path, and join with slash\n return baseUrl.replace(/\\/$/, '') + '/' + path.replace(/^\\//, '');\n};\n\nconst addContentType = (headers: Record<string, unknown>, contentType: string) => {\n if (Object.keys(headers).some((name) => name.toLowerCase() === 'content-type')) {\n return headers;\n }\n\n return {\n ...headers,\n ['content-type']: contentType,\n };\n};\n\nconst performDirectRequest = async (request: RequestInfo) => {\n const axios = await import('axios').then((it) => it.default);\n\n const contentType = Object.keys(request.header).find(\n (key) => key.toLowerCase() === 'content-type'\n );\n let data = request.body;\n \n let headers = request.header as Record<string, string>;\n if (contentType?.includes('multipart/form-data')) {\n const { data: formData, headers: formHeaders } = handleFormData(request);\n data = formData;\n headers = formHeaders;\n }\n\n return axios({\n url: request.url,\n method: request.method,\n params: request.query,\n data,\n headers,\n // prevent axios from adding [] after array query params\n paramsSerializer: {\n indexes: null,\n },\n responseType: 'arraybuffer',\n // prevent axios from erroring on bad status codes\n validateStatus: () => true,\n // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding\n // we can't use `responseEncoding` as it's ignored client-side\n transformResponse: (data) => {\n return Buffer.from(data).toString('base64');\n },\n });\n};\n\nconst performFileRequest = async (request: RequestInfo) => {\n const axios = await import('axios').then((it) => it.default);\n const formData = new FormData();\n formData.append(\n 'requestInfo',\n JSON.stringify({\n method: request.method,\n url: request.url,\n header: request.header,\n query: request.query,\n cookie: request.cookie,\n })\n );\n if (typeof request.body === 'object' && request.body !== null) {\n Object.entries(request.body).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(key, typeof item === 'object' ? JSON.stringify(item) : item.toString());\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(key, typeof value === 'object' ? JSON.stringify(value) : value.toString());\n }\n });\n }\n\n const { data } = await axios.post<unknown, AxiosResponse<ApiPlaygroundResultType>>(\n `${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/file-request`,\n formData\n );\n return data;\n};\n\nconst handleFormData = (request: RequestInfo) => {\n let data = request.body;\n \n const headers = request.header as Record<string, string>;\n\n if (headers['content-type']?.includes('multipart/form-data')) {\n const formData = new FormData();\n if (typeof data === 'object' && data !== null) {\n Object.entries(data).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === 'object' ? JSON.stringify(item) : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === 'object' ? JSON.stringify(value) : value.toString()\n );\n }\n });\n data = formData;\n delete headers['content-type'];\n }\n }\n return { data, headers };\n};\n"],"names":["useSendPlaygroundRequest","apiReferenceData","baseUrl","contentType","setResult","setIsSending","getApiPlaygroundInputs","usePlaygroundInputsStore","inputs","disableProxy","_a","path","_b","method","_c","useCallback","axios","x","pathWithInputs","addPathParams","url","joinWithSingleSlash","addServerVariables","headers","addContentType","request","response","performDirectRequest","data","performFileRequest","NEXT_PUBLIC","err","pathInputs","inputName","inputValue","variables","key","input","name","it","formData","formHeaders","handleFormData","value","item"],"mappings":";;;AA4BO,MAAMA,IAA2B,CAAC;AAAA,EACvC,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,cAAAC;AACF,MAAqC;;AAEnC,QAAM,EAAE,wBAAAC,EAAA,IAA2BC,EAAA,GAC7BC,IAASF,EAAA,GAETG,KAAeC,IAAAT,EAAiB,cAAjB,gBAAAS,EAA4B,cAC3CC,KAAOC,IAAAX,EAAiB,cAAjB,gBAAAW,EAA4B,MACnCC,KAASC,IAAAb,EAAiB,cAAjB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M,SAAAL,EAAA;AACjB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addApiReferenceDataFromMdxAndDocsConfig.js","sources":["../../../src/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.ts"],"sourcesContent":["import type { MdxExtracts } from '@mintlify/common';\nimport { PageMetaTags } from '@mintlify/models';\nimport { DocsConfig, Endpoint } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2, OperationV2 } from '@/api-playground-2/types';\nimport { toShikiLang } from '@/constants/snippetPresets';\n\nimport { getFirstWebhookExample, mdxCodeExampleToExamples } from './processExamples';\nimport { getDocsJsonSecurityOptions } from './processSecurityOptions';\nimport { generatePrefillRequestData } from './utils';\n\nconst mapEndpointToOperationV2 = (endpoint: Endpoint): OperationV2 => {\n const baseUrlOptions = endpoint.servers?.map((server) => server.url) ?? [];\n let baseUrl: string | undefined = undefined;\n if (baseUrlOptions.length > 1) {\n baseUrl = baseUrlOptions[0];\n } else {\n baseUrl = baseUrlOptions[0];\n }\n // ignore security options added from mdx endpoint, they are just copied from docs.json\n\n return {\n path: endpoint.path,\n method: endpoint.method,\n title: endpoint.title ?? '',\n description: endpoint.description ?? '',\n type: endpoint.type ?? 'path',\n baseUrl,\n baseUrlOptions,\n deprecated: endpoint.deprecated,\n };\n};\n\nexport const addApiReferenceDataFromMdxAndDocsConfig = ({\n pageMetadata,\n apiReferenceData2,\n mdxExtracts,\n docsConfig,\n}: {\n pageMetadata: PageMetaTags;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n mdxExtracts: MdxExtracts | undefined;\n docsConfig: DocsConfig | undefined;\n}): ApiReferenceDataV2 => {\n const apiReferenceData: ApiReferenceDataV2 = apiReferenceData2 ?? { operation: undefined };\n\n // if apiReferenceData2 is undefined, we need to add the operation from mdxExtracts\n if (!apiReferenceData2 && mdxExtracts?.endpoint) {\n apiReferenceData.operation = mapEndpointToOperationV2(mdxExtracts.endpoint);\n }\n\n // If we have a description from the frontmatter, use it instead of the OpenAPI description\n if (pageMetadata.description && apiReferenceData.operation) {\n apiReferenceData.operation.description = pageMetadata.description;\n }\n\n // now we should have a valid operationV2 either built by apiReferenceData from page props or just created from mdxExtracts\n // if there isn't, something went wrong and ngmi, operation remains undefined\n if (!apiReferenceData.operation) {\n return apiReferenceData;\n }\n\n // add docsConfig data to operation (either built by apiReferenceData from page props or just created from mdxExtracts)\n const configUrlOrUrls = docsConfig?.api?.mdx?.server;\n const configSecurity = docsConfig?.api?.mdx?.auth;\n\n // openapi servers > mdx servers > docs.json servers\n const alreadyHasServers =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n\n if (typeof configUrlOrUrls === 'string' && !alreadyHasServers) {\n apiReferenceData.operation.baseUrl = configUrlOrUrls;\n } else if (Array.isArray(configUrlOrUrls) && !alreadyHasServers) {\n if (configUrlOrUrls.length > 1) {\n apiReferenceData.operation.baseUrlOptions = configUrlOrUrls;\n } else {\n apiReferenceData.operation.baseUrl = configUrlOrUrls[0];\n }\n }\n\n if (configSecurity && Object.keys(apiReferenceData.dependencies?.security ?? {}).length === 0) {\n const docsJsonSecurityOptions = getDocsJsonSecurityOptions({\n method: configSecurity.method,\n name: configSecurity.name,\n });\n if (docsJsonSecurityOptions) {\n if (!apiReferenceData.dependencies) {\n apiReferenceData.dependencies = {\n servers: {},\n security: {},\n };\n }\n apiReferenceData.dependencies.security = { ...docsJsonSecurityOptions };\n }\n }\n\n const requestExamples = mdxExtracts?.codeExamples?.request;\n const responseExamples = mdxExtracts?.codeExamples?.response;\n\n // for examples, mdx > webhook example > codeSamples > generated\n if (requestExamples) {\n apiReferenceData.operation.requestExamples = mdxCodeExampleToExamples(requestExamples);\n apiReferenceData.operation.requestExampleType = 'mdx';\n } else {\n if (apiReferenceData.operation.type === 'webhook') {\n apiReferenceData.operation.requestExamples = getFirstWebhookExample(apiReferenceData);\n apiReferenceData.operation.requestExampleType = 'webhook';\n } else if (\n apiReferenceData.operation.codeSamples &&\n apiReferenceData.operation.codeSamples.length > 0\n ) {\n const requestExampleLanguages = docsConfig?.api?.examples?.languages?.map(toShikiLang);\n apiReferenceData.operation.requestExampleType = 'codeSamples';\n apiReferenceData.operation.requestExampleLanguages = requestExampleLanguages;\n apiReferenceData.operation.requiredOnlyExamples =\n docsConfig?.api?.examples?.defaults === 'required';\n } else {\n apiReferenceData.operation.requestExampleType = 'generated';\n }\n }\n\n if (responseExamples) {\n apiReferenceData.operation.responseExamples = mdxCodeExampleToExamples(responseExamples);\n apiReferenceData.operation.responseExampleType = 'mdx';\n } else {\n apiReferenceData.operation.responseExampleType = 'generated';\n }\n\n const hasBaseUrl =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n const prefillExamplesEnabled = docsConfig?.api?.examples?.prefill && hasBaseUrl;\n if (prefillExamplesEnabled) {\n apiReferenceData.operation.prefillPlaygroundWithExample = Boolean(prefillExamplesEnabled);\n apiReferenceData.operation.prefillPlaygroundExamples =\n generatePrefillRequestData(apiReferenceData);\n }\n\n const disableProxy = docsConfig?.api?.playground?.proxy === false;\n if (disableProxy) {\n apiReferenceData.operation.disableProxy = true;\n }\n\n return apiReferenceData;\n};\n"],"names":["mapEndpointToOperationV2","endpoint","baseUrlOptions","_a","server","baseUrl","addApiReferenceDataFromMdxAndDocsConfig","pageMetadata","apiReferenceData2","mdxExtracts","docsConfig","apiReferenceData","configUrlOrUrls","_b","configSecurity","_d","_c","alreadyHasServers","_e","docsJsonSecurityOptions","getDocsJsonSecurityOptions","requestExamples","_f","responseExamples","_g","mdxCodeExampleToExamples","getFirstWebhookExample","requestExampleLanguages","_j","_i","_h","toShikiLang","_l","_k","hasBaseUrl","prefillExamplesEnabled","_n","_m","generatePrefillRequestData","_p","_o"],"mappings":";;;;AAWA,MAAMA,IAA2B,CAACC,MAAoC;;AACpE,QAAMC,MAAiBC,IAAAF,EAAS,YAAT,gBAAAE,EAAkB,IAAI,CAACC,MAAWA,EAAO,SAAQ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AAyBC,KAAAC,IAAA3B,KAAA,gBAAAA,EAAY,QAAZ,gBAAA2B,EAAiB,aAAjB,gBAAAD,EAA2B,YAAWF;AACrE,SAAIC,MACFxB,EAAiB,UAAU,+BAA+B,EAAQwB,GAClExB,EAAiB,UAAU,4BACzB2B,EAA2B3B,CAAgB,MAG1B4B,KAAAC,IAAA9B,KAAA,gBAAAA,EAAY,QAAZ,gBAAA8B,EAAiB,eAAjB,gBAAAD,EAA6B,WAAU,OAE1D5B,EAAiB,UAAU,eAAe,KAGrCA;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addUniqueKeysToSchema.js","sources":["../../../src/api-playground-2/schemaGraph/addUniqueKeysToSchema.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { escapeDots, isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n/**\n * Add unique keys to each schema node, representing the path from the root.\n * This is used to generate unique input keys for the playground data store.\n *\n * @param schema - The schema to process\n * @param pathPrefix - The current path prefix (e.g., \"body.application/json\")\n * @returns The schema with uniqueKey properties added\n */\nexport const addUniqueKeysToSchema = (\n schema: SchemaObject,\n pathPrefix: string = ''\n): ResolvedSchemaObject => {\n if (!isSchemaObject(schema)) {\n return schema;\n }\n\n const processedSchema: ResolvedSchemaObject = {\n ...schema,\n uniqueKey: pathPrefix,\n };\n\n if (processedSchema.oneOf && Array.isArray(processedSchema.oneOf)) {\n processedSchema.oneOf = processedSchema.oneOf.map((subSchema, index) => {\n if (isSchemaObject(subSchema)) {\n const subPath = pathPrefix ? `${pathPrefix}.oneOf.${index}` : `${index}`;\n return addUniqueKeysToSchema(subSchema, subPath);\n }\n return subSchema;\n });\n }\n\n if (processedSchema.type === 'object' && processedSchema.properties) {\n const processedProperties: Record<string, SchemaObject> = {};\n Object.entries(processedSchema.properties).forEach(([name, propSchema]) => {\n if (isSchemaObject(propSchema)) {\n const propPath = pathPrefix ? `${pathPrefix}.${escapeDots(name)}` : escapeDots(name);\n processedProperties[name] = addUniqueKeysToSchema(propSchema, propPath);\n } else {\n processedProperties[name] = propSchema;\n }\n });\n processedSchema.properties = processedProperties;\n }\n\n if (\n processedSchema.additionalProperties &&\n typeof processedSchema.additionalProperties === 'object' &&\n isSchemaObject(processedSchema.additionalProperties)\n ) {\n const addPropsPath = pathPrefix ? `${pathPrefix}.additionalProperties` : 'additionalProperties';\n processedSchema.additionalProperties = addUniqueKeysToSchema(\n processedSchema.additionalProperties,\n addPropsPath\n );\n }\n\n if (\n processedSchema.type === 'array' &&\n 'items' in processedSchema &&\n isSchemaObject(processedSchema.items)\n ) {\n const itemsPath = pathPrefix ? `${pathPrefix}.items` : 'items';\n processedSchema.items = addUniqueKeysToSchema(processedSchema.items, itemsPath);\n }\n\n return processedSchema;\n};\n"],"names":["addUniqueKeysToSchema","schema","pathPrefix","isSchemaObject","processedSchema","subSchema","index","subPath","processedProperties","name","propSchema","propPath","escapeDots","addPropsPath","itemsPath"],"mappings":";AAaO,MAAMA,IAAwB,CACnCC,GACAC,IAAqB,OACI;AACzB,MAAI,CAACC,EAAeF,CAAM;AACxB,WAAOA;AAGT,QAAMG,IAAwC;AAAA,IAC5C,GAAGH;AAAA,IACH,WAAWC;AAAA,EAAA;AAab,MAVIE,EAAgB,SAAS,MAAM,QAAQA,EAAgB,KAAK,MAC9DA,EAAgB,QAAQA,EAAgB,MAAM,IAAI,CAACC,GAAWC,MAAU;AACtE,QAAIH,EAAeE,CAAS,GAAG;AAC7B,YAAME,IAAUL,IAAa,GAAGA,CAAU,UAAUI,CAAK,KAAK,GAAGA,CAAK;AACtE,aAAON,EAAsBK,GAAWE,CAAO;AAAA,IACjD;AACA,WAAOF;AAAA,EACT,CAAC,IAGCD,EAAgB,SAAS,YAAYA,EAAgB,YAAY;AACnE,UAAMI,IAAoD,CAAA;AAC1D,WAAO,QAAQJ,EAAgB,UAAU,EAAE,QAAQ,CAAC,CAACK,GAAMC,CAAU,MAAM;AACzE,UAAIP,EAAeO,CAAU,GAAG;AAC9B,cAAMC,IAAWT,IAAa,GAAGA,CAAU,IAAIU,EAAWH,CAAI,CAAC,KAAKG,EAAWH,CAAI;AACnF,QAAAD,EAAoBC,CAAI,IAAIT,EAAsBU,GAAYC,CAAQ;AAAA,MACxE;AACE,QAAAH,EAAoBC,CAAI,IAAIC;AAAA,IAEhC,CAAC,GACDN,EAAgB,aAAaI;AAAA,EAC/B;AAEA,MACEJ,EAAgB,wBAChB,OAAOA,EAAgB,wBAAyB,YAChDD,EAAeC,EAAgB,oBAAoB,GACnD;AACA,UAAMS,IAAeX,IAAa,GAAGA,CAAU,0BAA0B;AACzE,IAAAE,EAAgB,uBAAuBJ;AAAA,MACrCI,EAAgB;AAAA,MAChBS;AAAA,IAAA;AAAA,EAEJ;AAEA,MACET,EAAgB,SAAS,WACzB,WAAWA,KACXD,EAAeC,EAAgB,KAAK,GACpC;AACA,UAAMU,IAAYZ,IAAa,GAAGA,CAAU,WAAW;AACvD,IAAAE,EAAgB,QAAQJ,EAAsBI,EAAgB,OAAOU,CAAS;AAAA,EAChF;AAEA,SAAOV;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../src/api-playground-2/schemaGraph/errors.ts"],"sourcesContent":["// ERRORS\nexport const generateMessage = (path: string[], ...messages: string[]): string => {\n const pathString = path\n .map((component) => component.replace('\\\\', '\\\\\\\\').replace('/', '\\\\/'))\n .join('/');\n return [pathString, ...messages].join('\\n');\n};\n\n/**\n * Thrown when a value is incorrect or missing, according to the OpenAPI spec.\n */\nexport class InvalidSchemaError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'InvalidSchemaError';\n Object.setPrototypeOf(this, InvalidSchemaError.prototype);\n }\n}\n\n/**\n * Thrown when a schema is valid according to OpenAPI, but is unsatisfiable\n * (e.g. a value that must be both a number and a string).\n */\nexport class ImpossibleSchemaError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'ImpossibleSchemaError';\n Object.setPrototypeOf(this, ImpossibleSchemaError.prototype);\n }\n}\n\n/**\n * Thrown when there is an issue that was caused in another part of the conversion\n * (e.g. a schema in reduced form that is missing `oneOf`).\n */\nexport class ConversionError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'ConversionError';\n Object.setPrototypeOf(this, ConversionError.prototype);\n }\n}\n\nexport function handleExistingError(\n error: unknown,\n path: string[],\n safeParse: boolean = false,\n ...messages: string[]\n) {\n if (safeParse) {\n console.error(generateMessage(path, ...messages), error);\n } else {\n throw error;\n }\n}\n"],"names":["generateMessage","path","messages","component","ImpossibleSchemaError","handleExistingError","error","safeParse"],"mappings":"AACO,MAAMA,IAAkB,CAACC,MAAmBC,MAI1C,CAHYD,EAChB,IAAI,CAACE,MAAcA,EAAU,QAAQ,MAAM,MAAM,EAAE,QAAQ,KAAK,KAAK,CAAC,EACtE,KAAK,GAAG,GACS,GAAGD,CAAQ,EAAE,KAAK;AAAA,CAAI;AAkBrC,MAAME,UAA8B,MAAM;AAAA,EAC/C,YAAYH,MAAmBC,GAAoB;AACjD,UAAMF,EAAgBC,GAAM,GAAGC,CAAQ,CAAC,GACxC,KAAK,OAAO,yBACZ,OAAO,eAAe,MAAME,EAAsB,SAAS;AAAA,EAC7D;AACF;AAcO,SAASC,EACdC,GACAL,GACAM,IAAqB,OAClBL,GACH;AACA,MAAIK;AACF,YAAQ,MAAMP,EAAgBC,GAAM,GAAGC,CAAQ,GAAGI,CAAK;AAAA;AAEvD,UAAMA;AAEV;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAllRequiredProperties.js","sources":["../../../src/api-playground-2/schemaGraph/getAllRequiredProperties.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { isSchemaObject } from './utils';\n\nexport const getAllRequiredProperties = (\n schema: SchemaObject,\n collected: Set<string> = new Set()\n): string[] => {\n if ('required' in schema && Array.isArray(schema.required)) {\n schema.required.forEach((prop) => collected.add(prop));\n }\n\n if ('items' in schema && schema.items) {\n if (isSchemaObject(schema.items)) {\n getAllRequiredProperties(schema.items, collected);\n }\n }\n\n if ('properties' in schema && schema.properties) {\n Object.values(schema.properties).forEach((propSchema) => {\n getAllRequiredProperties(propSchema, collected);\n });\n }\n\n if ('additionalProperties' in schema && isSchemaObject(schema.additionalProperties)) {\n getAllRequiredProperties(schema.additionalProperties, collected);\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema) => {\n if (isSchemaObject(subSchema)) {\n getAllRequiredProperties(subSchema, collected);\n }\n });\n }\n\n return [...collected];\n};\n"],"names":["getAllRequiredProperties","schema","collected","prop","isSchemaObject","propSchema","subSchema"],"mappings":";AAIO,MAAMA,IAA2B,CACtCC,GACAC,IAAyB,oBAAI,WAEzB,cAAcD,KAAU,MAAM,QAAQA,EAAO,QAAQ,KACvDA,EAAO,SAAS,QAAQ,CAACE,MAASD,EAAU,IAAIC,CAAI,CAAC,GAGnD,WAAWF,KAAUA,EAAO,SAC1BG,EAAeH,EAAO,KAAK,KAC7BD,EAAyBC,EAAO,OAAOC,CAAS,GAIhD,gBAAgBD,KAAUA,EAAO,cACnC,OAAO,OAAOA,EAAO,UAAU,EAAE,QAAQ,CAACI,MAAe;AACvD,EAAAL,EAAyBK,GAAYH,CAAS;AAChD,CAAC,GAGC,0BAA0BD,KAAUG,EAAeH,EAAO,oBAAoB,KAChFD,EAAyBC,EAAO,sBAAsBC,CAAS,GAG7D,WAAWD,KAAU,MAAM,QAAQA,EAAO,KAAK,KACjDA,EAAO,MAAM,QAAQ,CAACK,MAAc;AAClC,EAAIF,EAAeE,CAAS,KAC1BN,EAAyBM,GAAWJ,CAAS;AAEjD,CAAC,GAGI,CAAC,GAAGA,CAAS;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getApiReferenceDataFromGraph.js","sources":["../../../src/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.ts"],"sourcesContent":["import { parseApiTargetFromMetadata } from '../../common/parseApiTargetFromMetadata';\nimport type { PageMetaTags } from '@mintlify/models';\nimport type { SchemaGraphData } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\n\nimport { getSchemaGraphOperationData } from './getSchemaGraphOperationData';\nimport { getSchemaGraphSchemaData } from './getSchemaGraphSchemaData';\n\nexport const getApiReferenceDataFromGraph = ({\n metadata,\n schemaGraphData,\n}: {\n metadata: PageMetaTags;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 => {\n const target = parseApiTargetFromMetadata(metadata);\n\n if (!target) {\n return {};\n }\n\n try {\n if (target.type === 'operation') {\n return getSchemaGraphOperationData({\n target,\n schemaGraphData,\n });\n } else {\n return getSchemaGraphSchemaData({\n target,\n schemaGraphData,\n });\n }\n } catch (error) {\n throw error;\n }\n};\n"],"names":["getApiReferenceDataFromGraph","metadata","schemaGraphData","target","parseApiTargetFromMetadata","getSchemaGraphOperationData","getSchemaGraphSchemaData","error"],"mappings":";;;AASO,MAAMA,IAA+B,CAAC;AAAA,EAC3C,UAAAC;AAAA,EACA,iBAAAC;AACF,MAG0B;AACxB,QAAMC,IAASC,EAA2BH,CAAQ;AAElD,MAAI,CAACE;AACH,WAAO,CAAA;AAGT,MAAI;AACF,WAAIA,EAAO,SAAS,cACXE,EAA4B;AAAA,MACjC,QAAAF;AAAA,MACA,iBAAAD;AAAA,IAAA,CACD,IAEMI,EAAyB;AAAA,MAC9B,QAAAH;AAAA,MACA,iBAAAD;AAAA,IAAA,CACD;AAAA,EAEL,SAASK,GAAO;AACd,UAAMA;AAAA,EACR;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDocumentProperties.js","sources":["../../../src/api-playground-2/schemaGraph/getDocumentProperties.ts"],"sourcesContent":["import {\n Operation,\n SchemaGraphData,\n Document,\n ServerObject,\n SecurityRequirement,\n UUID,\n} from '@mintlify/validation';\nimport zip from 'lodash/zip';\n\nimport {\n deeplyResolveGraphNode,\n resolveGraphNode,\n} from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport { flattenSingleOneOf } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSecurityObject } from '@/api-playground-2/types';\n\nexport const getDocument = (schemaGraphData: SchemaGraphData) => {\n return resolveGraphNode<Document>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: schemaGraphData.documentId,\n });\n};\n\n// Decorate an Operation object that has been parsed from a path with some additional properties which\n// are stored at the top level of the schema document.\nexport function withDocumentProperties({\n operation,\n schemaGraphData,\n}: {\n operation: Operation;\n schemaGraphData: SchemaGraphData;\n}): Operation {\n // get servers\n const servers = getDocument(schemaGraphData)?.servers;\n\n // get security\n const security = getDocument(schemaGraphData)?.security;\n\n return {\n ...operation,\n servers,\n security,\n };\n}\n\nexport const getResolvedServers = (\n schemaGraphData: SchemaGraphData\n): Record<string, ServerObject> => {\n const serverUUIDs = getDocument(schemaGraphData)?.servers;\n if (!serverUUIDs) return {};\n\n return Object.fromEntries(\n zip(\n serverUUIDs,\n serverUUIDs.map((serverUUID) =>\n deeplyResolveGraphNode<ServerObject>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: serverUUID,\n })\n )\n )\n .filter((entry): entry is [UUID, ServerObject] => entry[1] !== undefined)\n .map(([uuid, server]) => [uuid, flattenSingleOneOf(server)])\n );\n};\n\nexport const getResolvedSecuritys = (\n schemaGraphData: SchemaGraphData\n): Record<string, ResolvedSecurityObject> => {\n const securityUUIDs = getDocument(schemaGraphData)?.security;\n if (!securityUUIDs) return {};\n\n return Object.fromEntries(\n zip(\n securityUUIDs,\n securityUUIDs.map((securityUUID) =>\n deeplyResolveGraphNode<SecurityRequirement>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: securityUUID,\n })\n )\n )\n .filter((entry): entry is [UUID, ResolvedSecurityObject] => entry[1] !== undefined)\n .map(([uuid, security]) => [uuid, flattenSingleOneOf(security)])\n );\n};\n"],"names":["getDocument","schemaGraphData","resolveGraphNode","withDocumentProperties","operation","servers","_a","security","_b","getResolvedServers","serverUUIDs","zip","serverUUID","deeplyResolveGraphNode","entry","uuid","server","flattenSingleOneOf","getResolvedSecuritys","securityUUIDs","securityUUID"],"mappings":";;;AAiBO,MAAMA,IAAc,CAACC,MACnBC,EAA2B;AAAA,EAChC,mBAAmBD,EAAgB,KAAK;AAAA,EACxC,eAAeA,EAAgB,KAAK;AAAA,EACpC,IAAIA,EAAgB;AAAA,CACrB;AAKI,SAASE,EAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,iBAAAH;AACF,GAGc;;AAEZ,QAAMI,KAAUC,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B,SAGxCC,KAAWC,IAAAR,EAAYC,CAAe,MAA3B,gBAAAO,EAA8B;AAE/C,SAAO;AAAA,IACL,GAAGJ;AAAA,IACH,SAAAC;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEO,MAAME,IAAqB,CAChCR,MACiC;;AACjC,QAAMS,KAAcJ,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B;AAClD,SAAKI,IAEE,OAAO;AAAA,IACZC;AAAA,MACED;AAAA,MACAA,EAAY;AAAA,QAAI,CAACE,MACfC,EAAqC;AAAA,UACnC,mBAAmBZ,EAAgB,KAAK;AAAA,UACxC,eAAeA,EAAgB,KAAK;AAAA,UACpC,IAAIW;AAAA,QAAA,CACL;AAAA,MAAA;AAAA,IACH,EAEC,OAAO,CAACE,MAAyCA,EAAM,CAAC,MAAM,MAAS,EACvE,IAAI,CAAC,CAACC,GAAMC,CAAM,MAAM,CAACD,GAAME,EAAmBD,CAAM,CAAC,CAAC;AAAA,EAAA,IAdtC,CAAA;AAgB3B,GAEaE,IAAuB,CAClCjB,MAC2C;;AAC3C,QAAMkB,KAAgBb,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B;AACpD,SAAKa,IAEE,OAAO;AAAA,IACZR;AAAA,MACEQ;AAAA,MACAA,EAAc;AAAA,QAAI,CAACC,MACjBP,EAA4C;AAAA,UAC1C,mBAAmBZ,EAAgB,KAAK;AAAA,UACxC,eAAeA,EAAgB,KAAK;AAAA,UACpC,IAAImB;AAAA,QAAA,CACL;AAAA,MAAA;AAAA,IACH,EAEC,OAAO,CAACN,MAAmDA,EAAM,CAAC,MAAM,MAAS,EACjF,IAAI,CAAC,CAACC,GAAMR,CAAQ,MAAM,CAACQ,GAAME,EAAmBV,CAAQ,CAAC,CAAC;AAAA,EAAA,IAdxC,CAAA;AAgB7B;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaGraphOperationData.js","sources":["../../../src/api-playground-2/schemaGraph/getSchemaGraphOperationData.ts"],"sourcesContent":["import type { OperationTargetType } from '@mintlify/common';\nimport type {\n CodeSample,\n HttpMethod,\n PathOrRef,\n SchemaGraphData,\n Operation,\n} from '@mintlify/validation';\n\nimport {\n getResolvedSecuritys,\n getResolvedServers,\n withDocumentProperties,\n} from '@/api-playground-2/schemaGraph/getDocumentProperties';\nimport { resolveGraphNode } from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport type { ApiReferenceDataV2, OperationV2 } from '@/api-playground-2/types';\n\nimport { resolveOperationWithDependencies } from './resolveOperationWithDependencies';\n\nexport const createOperationV2 = ({\n operation,\n target,\n baseUrlOptions,\n}: {\n operation: Operation;\n target: OperationTargetType;\n baseUrlOptions: string[];\n}): OperationV2 => {\n let baseUrl: string | undefined = undefined;\n let baseUrls: string[] = [];\n if (baseUrlOptions.length > 1) {\n baseUrls = baseUrlOptions;\n } else {\n baseUrl = baseUrlOptions[0];\n }\n\n const codeSamples: CodeSample[] = [];\n if (Array.isArray(operation['x-code-samples']) && operation['x-code-samples'].length > 0) {\n operation['x-code-samples'].forEach((codeSample) => {\n if (\n codeSample &&\n typeof codeSample === 'object' &&\n 'source' in codeSample &&\n typeof codeSample['source'] === 'string' &&\n 'lang' in codeSample &&\n typeof codeSample['lang'] === 'string'\n ) {\n codeSamples.push({\n label:\n 'label' in codeSample && typeof codeSample['label'] === 'string'\n ? codeSample['label']\n : undefined,\n lang: codeSample['lang'],\n source: codeSample['source'],\n });\n }\n });\n }\n\n return {\n ...operation,\n path: target.endpoint || '',\n baseUrl,\n baseUrlOptions: baseUrls,\n title: operation.summary ?? '',\n description: operation.description ?? '',\n codeSamples,\n };\n};\n\n// An OpenAPI doc comes to us with a `paths` array. We turn that array into a series of path objects\n// which have a set of `method` keys that map to operation objects.\nexport const getOperationId = (\n graph: SchemaGraphData,\n endpoint: string,\n method: HttpMethod | 'webhook'\n) => {\n const pathUuid = graph.spec.refUuidMap[`${endpoint}/${method}`];\n if (!pathUuid) return undefined;\n\n // pathNode has a shape like:\n // {\n // path: string;\n // [method: HttpMethod]: UUID;\n // }\n const pathNode = resolveGraphNode<PathOrRef>({\n uuidObjectHashMap: graph.spec.uuidObjectHashMap,\n hashedNodeMap: graph.spec.hashedNodeMap,\n id: pathUuid,\n });\n\n // TODO - Api Playground Refactor: I think we assume in the converter that webhooks always have \"post\" as a method\n // technically I they can have multiple/other methods specified?\n const pathNodeOperationObject = method === 'webhook' ? pathNode?.['post'] : pathNode?.[method];\n\n return pathNodeOperationObject;\n};\n\nexport const getSchemaGraphOperationData = ({\n target,\n schemaGraphData,\n}: {\n target: OperationTargetType;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 => {\n const { uuidObjectHashMap, hashedNodeMap } = schemaGraphData.spec;\n\n const operationId = getOperationId(schemaGraphData, target.endpoint, target.method);\n\n if (!operationId) {\n throw new Error(\n `no matching OpenAPI operation found with path \"${target.endpoint}\" and method \"${target.method}\"`\n );\n }\n\n const resolvedData = resolveOperationWithDependencies({\n operationId,\n uuidObjectHashMap,\n hashedNodeMap,\n });\n\n if (!resolvedData) {\n // better error handling?\n return {};\n }\n\n let operation = resolvedData.operation;\n\n // The Operation object doesn't directly contain all the properties we want, so we add a few elsewhere\n // in the spec.\n operation = withDocumentProperties({\n operation,\n schemaGraphData,\n });\n\n const servers = getResolvedServers(schemaGraphData);\n const security = getResolvedSecuritys(schemaGraphData);\n const baseUrlOptions = Object.values(servers).map((server) => server.url);\n\n const operationV2 = createOperationV2({\n operation,\n target,\n baseUrlOptions,\n });\n\n // Then we need to make sure we have dependencies for those new properties.\n const dependenciesWithDocumentDependencies = {\n ...resolvedData.dependencies,\n servers,\n security,\n ...(resolvedData.schemas && { schemas: resolvedData.schemas }),\n };\n\n return {\n operation: operationV2,\n dependencies: dependenciesWithDocumentDependencies,\n };\n};\n"],"names":["createOperationV2","operation","target","baseUrlOptions","baseUrl","baseUrls","codeSamples","codeSample","getOperationId","graph","endpoint","method","pathUuid","pathNode","resolveGraphNode","getSchemaGraphOperationData","schemaGraphData","uuidObjectHashMap","hashedNodeMap","operationId","resolvedData","resolveOperationWithDependencies","withDocumentProperties","servers","getResolvedServers","security","getResolvedSecuritys","server","operationV2","dependenciesWithDocumentDependencies"],"mappings":";;;AAmBO,MAAMA,IAAoB,CAAC;AAAA,EAChC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AACF,MAImB;AACjB,MAAIC,GACAC,IAAqB,CAAA;AACzB,EAAIF,EAAe,SAAS,IAC1BE,IAAWF,IAEXC,IAAUD,EAAe,CAAC;AAG5B,QAAMG,IAA4B,CAAA;AAClC,SAAI,MAAM,QAAQL,EAAU,gBAAgB,CAAC,KAAKA,EAAU,gBAAgB,EAAE,SAAS,KACrFA,EAAU,gBAAgB,EAAE,QAAQ,CAACM,MAAe;AAClD,IACEA,KACA,OAAOA,KAAe,YACtB,YAAYA,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B,IAAYmB,EAAa;AAI7B,EAAAnB,IAAYqB,EAAuB;AAAA,IACjC,WAAArB;AAAA,IACA,iBAAAe;AAAA,EAAA,CACD;AAED,QAAMO,IAAUC,EAAmBR,CAAe,GAC5CS,IAAWC,EAAqBV,CAAe,GAC/Cb,IAAiB,OAAO,OAAOoB,CAAO,EAAE,IAAI,CAACI,MAAWA,EAAO,GAAG,GAElEC,IAAc5B,EAAkB;AAAA,IACpC,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAGK0B,IAAuC;AAAA,IAC3C,GAAGT,EAAa;AAAA,IAChB,SAAAG;AAAA,IACA,UAAAE;AAAA,IACA,GAAIL,EAAa,WAAW,EAAE,SAASA,EAAa,QAAA;AAAA,EAAQ;AAG9D,SAAO;AAAA,IACL,WAAWQ;AAAA,IACX,cAAcC;AAAA,EAAA;AAElB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaGraphSchemaData.js","sources":["../../../src/api-playground-2/schemaGraph/getSchemaGraphSchemaData.ts"],"sourcesContent":["import type { SchemaTargetType } from '@mintlify/common';\nimport { SchemaGraphData } from '@mintlify/validation';\n\nimport { resolveSchemaWithDependencies } from '@/api-playground-2/schemaGraph/resolveSchemaWithDependencies';\nimport { ApiReferenceDataV2 } from '@/api-playground-2/types';\n\nexport function getSchemaGraphSchemaData({\n target,\n schemaGraphData,\n}: {\n target: SchemaTargetType;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 {\n const resolvedData = resolveSchemaWithDependencies({\n schemaPath: `#/components/schemas/${target.name}`,\n schemaGraphData,\n });\n\n return {\n schemaData: resolvedData,\n };\n}\n"],"names":["getSchemaGraphSchemaData","target","schemaGraphData","resolveSchemaWithDependencies"],"mappings":";AAMO,SAASA,EAAyB;AAAA,EACvC,QAAAC;AAAA,EACA,iBAAAC;AACF,GAGuB;AAMrB,SAAO;AAAA,IACL,YANmBC,EAA8B;AAAA,MACjD,YAAY,wBAAwBF,EAAO,IAAI;AAAA,MAC/C,iBAAAC;AAAA,IAAA,CACD;AAAA,EAGa;AAEhB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getLanguageFromClassName","className","fallback","match","mdxCodeExampleToExamples","mdxCodeExampleData","examples","dropdown","_a","attr","_b","child","jsx","parse","lang","generateExamplesFromSchema","content","contentType","mediaObject","exampleName","example","isSchemaObject","generateExampleFromSchema","schema","firstOption","generateStringExample","generateNumericExample","propName","subschema","format","n","getFirstExampleValue","firstContentType","contentTypeObject","firstExample","getFirstWebhookExample","apiReferenceData","requestExamples"],"mappings":";;AAaO,SAASA,EAAyBC,GAA+BC,GAA2B;AACjG,QAAMC,IAAQ,iBAAiB,KAAKF,KAAa,EAAE;AACnD,SAAOE,IAAQA,EAAM,CAAC,KAAK,SAASD,KAAY;AAClD;AAEO,MAAME,IAA2B,CAACC,MAA0D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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processSecurityOptions.js","sources":["../../../src/api-playground-2/schemaGraph/processSecurityOptions.ts"],"sourcesContent":["import { UUID } from '@mintlify/validation';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n ApiReferenceDataV2,\n ResolvedSecurityObject,\n SecuritySchemeAndScope,\n ProcessedSecurityOption,\n} from '@/api-playground-2/types';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n// Ronan left TODOs for supporting openIdConnect circa 2023 (but we do support this in mcp?) & we don't support all features of oauth2 in UI yet (circa 2025, no UI for selecting scopes)\nconst supportedSecurityTypes = ['apiKey', 'http', 'oauth2'];\n\n// docs.json security types are basic = http basic, bearer = http bearer, key = apiKey - see getSecurityOptionsForAuthMethod\n// all docs.json security types go in header, but only apiKey needs to specify that in scheme\n\nexport const getDocsJsonSecurityOptions = ({\n method,\n name,\n}: {\n method: string | undefined;\n name?: string;\n}): Record<UUID, ResolvedSecurityObject> | undefined => {\n const uuid = uuidv4();\n let securityRequirement: Record<UUID, ResolvedSecurityObject> | undefined = undefined;\n switch (method) {\n case 'basic':\n securityRequirement = {\n [uuid]: {\n Authorization: {\n type: 'http',\n scheme: 'basic',\n description:\n 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.',\n },\n },\n };\n break;\n case 'bearer':\n securityRequirement = {\n [uuid]: {\n Authorization: {\n type: 'http',\n scheme: 'bearer',\n description:\n 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.',\n },\n },\n };\n break;\n case 'key':\n securityRequirement = {\n [uuid]: {\n Key: {\n name: name ?? 'Key',\n type: 'apiKey',\n in: 'header',\n },\n },\n };\n break;\n }\n return securityRequirement;\n};\n\nexport const processSecurityOptions = (\n apiReferenceData: ApiReferenceDataV2\n): ProcessedSecurityOption[] => {\n const securityOptions = apiReferenceData.dependencies?.security ?? {};\n if (Object.keys(securityOptions).length === 0) return [];\n const processedSecurityOptions: ProcessedSecurityOption[] = [];\n\n Object.entries(securityOptions).forEach(\n ([_id, securityScheme]: [UUID, ResolvedSecurityObject]) => {\n // this differs from SchemaConverter where we build the title from the security requirement scheme names\n // by converting underscore to spaces and joining with \"&\"\n // because 1. it's ugly, 2. it never dealt with camel case, and\n // 3. we either have a nice title specific to the API Key name or the scheme type consistently from OpenAPI or docs.json\n // if we really want the ugly titles back, we can uncoment this and pass it into the schemas as the title, and override the title in the heading to always be \"Authorization\" (but not the dropdown options)\n // const name = Object.keys(securityScheme)[0];\n // const title = name?.replace(/[_-]/g, ' ') ?? 'Authorization';\n const scheme = Object.values(securityScheme)[0];\n if (!scheme) return;\n // only process supported security schemes\n if (supportedSecurityTypes.includes(scheme.type)) {\n const schema = getSchemaForSecurityScheme(scheme);\n // don't add security options that don't have a schema for rendering\n if (schema) {\n processedSecurityOptions.push({ scheme, schema });\n }\n }\n }\n );\n\n return processedSecurityOptions;\n};\n\nexport const basicDescription =\n 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.';\nexport const bearerDescription =\n 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.';\nexport const oauth2Description =\n 'The access token received from the authorization server in the OAuth 2.0 flow.';\n\n// TODO - Api Playground Refactor: by default we add required: true to these schemas\n// not sure if we correctly handle the case where operation has\n// - security [] to override global security requirements\n// or when there is a security: [{}]\n// empty object option in array of security requirements on operation also makes it optional\nconst getSchemaForSecurityScheme = (\n scheme: SecuritySchemeAndScope\n): ResolvedSchemaObject | undefined => {\n switch (scheme.type) {\n case 'apiKey':\n return {\n title: scheme.name,\n type: 'string',\n description: scheme.description,\n isRequired: true,\n default: scheme['x-default'],\n };\n case 'http':\n return scheme.scheme === 'basic'\n ? {\n title: 'Basic Auth',\n type: 'object',\n description: scheme.description ?? basicDescription,\n isRequired: true,\n properties: {\n username: { type: 'string' },\n password: { type: 'string' },\n },\n additionalProperties: false,\n default: scheme['x-default'],\n }\n : {\n title: 'Bearer Auth',\n type: 'string',\n isRequired: true,\n description: scheme.description ?? bearerDescription,\n format: 'bearer',\n default: scheme['x-default'],\n };\n case 'oauth2':\n return {\n title: 'OAuth2 Auth',\n type: 'string',\n isRequired: true,\n description: scheme.description ?? oauth2Description,\n format: 'bearer',\n };\n default:\n return undefined;\n }\n};\n"],"names":["supportedSecurityTypes","getDocsJsonSecurityOptions","method","name","uuid","uuidv4","securityRequirement","processSecurityOptions","apiReferenceData","securityOptions","_a","processedSecurityOptions","_id","securityScheme","scheme","schema","getSchemaForSecurityScheme","basicDescription","bearerDescription","oauth2Description"],"mappings":";AAYA,MAAMA,IAAyB,CAAC,UAAU,QAAQ,QAAQ,GAK7CC,IAA6B,CAAC;AAAA,EACzC,QAAAC;AAAA,EACA,MAAAC;AACF,MAGwD;AACtD,QAAMC,IAAOC,EAAA;AACb,MAAIC;AACJ,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,MAAAI,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,eAAe;AAAA,YACb,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,MACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAE,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,eAAe;AAAA,YACb,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,MACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAE,IAAsB;AAAA,QACpB,CAACF,CAAI,GAAG;AAAA,UACN,KAAK;AAAA,YACH,MAAMD,KAAQ;AAAA,YACd,MAAM;AAAA,YACN,IAAI;AAAA,UAAA;AAAA,QACN;AAAA,MACF;AAEF;AAAA,EAAA;AAEJ,SAAOG;AACT,GAEaC,IAAyB,CACpCC,MAC8B;;AAC9B,QAAMC,MAAkBC,IAAAF,EAAiB,iBAAjB,gBAAAE,EAA+B,aAAY,CAAA;AACnE,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C,QAAQ;AAAA,MAAA;AAAA,IAEZ;AACE;AAAA,EAAO;AAEb;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reduceCompositions.js","sources":["../../../src/api-playground-2/schemaGraph/reduceCompositions.ts"],"sourcesContent":["import { type SchemaObject } from '@mintlify/validation';\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nimport { CIRCULAR_REF_KEY, MAX_SCHEMA_COMBINATION_SIZE } from '@/api-playground-2/constants';\nimport type { ResolvedSchemaObject, ReducedSchema, Location } from '@/api-playground-2/types';\n\nimport { handleExistingError, ImpossibleSchemaError } from './errors';\nimport {\n takeLast,\n combine,\n createEmptyReducedSchema,\n createUnknownReducedSchema,\n isReducedSchema,\n flattenSchemaOneOfs,\n isCircularRef,\n shouldTruncateForSize,\n} from './utils';\n\n/**\n * Entrypoint function for performing reduction on an OpenAPI schema. Reduction means that\n * the schema is transformed into its *reduced form*. In this form, the schema and any subschemas\n * are represented by a schema with one property, `oneOf`, whose items are guaranteed NOT to have a\n * `oneOf`, `anyOf`, or `allOf` property.\n */\nexport function reduceExpandedSchema({\n schema,\n depth,\n location,\n flattenOneOfs = true,\n}: {\n schema: SchemaObject;\n depth: number;\n location?: Location;\n flattenOneOfs?: boolean;\n}): SchemaObject {\n const reduced = reduceCompositions({\n schema,\n depth,\n location,\n safeParse: false,\n path: ['#'],\n });\n\n return flattenOneOfs ? flattenSchemaOneOfs(reduced) : reduced;\n}\n\nfunction reduceCompositions({\n schema,\n depth,\n location,\n safeParse = false,\n path = ['#'],\n}: {\n schema: OpenAPIV3_1.SchemaObject | { [CIRCULAR_REF_KEY]: string };\n depth: number;\n location?: Location;\n safeParse?: boolean;\n path?: string[];\n}): ReducedSchema {\n try {\n // Handle circular reference - preserve it as-is\n if (isCircularRef(schema)) {\n return { oneOf: [schema] };\n }\n\n if (shouldTruncateForSize(schema)) {\n // TODO - Api Playground Refactor: find the problematic property and truncate only that subschema instead of making the entire schema any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return { oneOf: [{ type: 'any' as any }] };\n }\n\n if (schema.oneOf && schema.oneOf.length > 0) {\n schema.oneOf = reduceOptionsCompositions({\n schemaArray: schema.oneOf,\n depth,\n location,\n path: [...path, 'oneOf'],\n });\n } else {\n // Always give reduced schema a oneOf\n schema.oneOf = [];\n }\n\n if (schema.anyOf && schema.anyOf.length > 0) {\n schema.anyOf = reduceOptionsCompositions({\n schemaArray: schema.anyOf,\n depth,\n location,\n path: [...path, 'anyOf'],\n });\n }\n\n // Take the schema's allOf options\n // Recursively reduce each of them\n // Take the reduced allOf array and multiply it to turn it into a large oneOf array\n // Now multiply our current \"oneOf\"\n if (schema.allOf && schema.allOf.length > 0) {\n const totalAllOf = schema.allOf\n .map((subschema, index) =>\n reduceCompositions({\n schema: subschema,\n depth: depth + 1,\n location,\n safeParse,\n path: [...path, 'allOf', index.toString()],\n })\n )\n .reduce<ReducedSchema>(\n (accumulator, current) => combineReducedSchemas(accumulator, current, depth + 1),\n createEmptyReducedSchema()\n );\n schema.oneOf = multiplySchemaArrays(schema.oneOf, totalAllOf.oneOf, depth);\n }\n\n if (schema.properties) {\n for (const key in schema.properties) {\n \n const subschema = schema.properties[key] as OpenAPIV3_1.SchemaObject;\n\n // Convert circular refs to reduced schema\n if (isCircularRef(subschema)) {\n schema.properties[key] = { oneOf: [subschema] };\n continue;\n }\n\n // remove readOnly and writeOnly properties BEFORE we combine anything\n if (\n (subschema.readOnly && location === 'request') ||\n (subschema.writeOnly && location === 'response')\n ) {\n delete schema.properties[key];\n continue;\n }\n\n const propertyPath = [...path, 'properties', key];\n try {\n schema.properties[key] = reduceCompositions({\n schema: subschema,\n depth: depth + 1,\n location,\n safeParse,\n path: propertyPath,\n });\n } catch (error) {\n handleExistingError(error, propertyPath, safeParse, 'error reducing property schema');\n schema.properties[key] = { oneOf: [{}] }; // an \"any\" schema\n }\n }\n }\n\n if ('items' in schema && schema.items) {\n // Preserve circular refs without processing\n if (!isCircularRef(schema.items)) {\n try {\n schema.items = reduceCompositions({\n schema: schema.items,\n depth: depth + 1,\n location,\n safeParse,\n path: [...path, 'items'],\n });\n } catch (error) {\n handleExistingError(error, [...path, 'items'], safeParse, 'error reducing items schema');\n schema.items = createUnknownReducedSchema();\n }\n }\n }\n\n if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {\n // Preserve circular refs without processing\n if (!isCircularRef(schema.additionalProperties)) {\n try {\n schema.additionalProperties = reduceCompositions({\n schema: schema.additionalProperties,\n depth: depth + 1,\n location,\n safeParse,\n path: [...path, 'additionalProperties'],\n });\n } catch (error) {\n schema.additionalProperties = error instanceof ImpossibleSchemaError ? false : true;\n }\n }\n }\n\n if (schema.anyOf && schema.anyOf.length > 0) {\n schema.oneOf = multiplySchemaArrays(schema.oneOf, schema.anyOf, depth);\n }\n\n const topLevelSchemaArray = generateTopLevelSchemaArray(schema);\n\n return {\n oneOf: multiplySchemaArrays(schema.oneOf, topLevelSchemaArray, depth),\n };\n } catch (error) {\n if (error instanceof Error) {\n console.error('Error processing schema:', error.message);\n }\n \n return { oneOf: [{ type: 'any' } as ResolvedSchemaObject] };\n }\n}\n\nfunction reduceOptionsCompositions({\n schemaArray,\n depth,\n location,\n path = ['#'],\n}: {\n schemaArray: SchemaObject[];\n depth: number;\n location?: Location;\n path?: string[];\n}): SchemaObject[] {\n const evaluatedArray = schemaArray.flatMap((subschema, index) => {\n try {\n const reduced = reduceCompositions({\n schema: subschema,\n depth: depth + 1,\n location,\n safeParse: false,\n path: [...path, index.toString()],\n });\n return reduced.oneOf;\n } catch (error) {\n if (error instanceof ImpossibleSchemaError) {\n return [];\n }\n throw error;\n }\n });\n\n if (evaluatedArray.length === 0) {\n throw new ImpossibleSchemaError(path, 'no valid options in schema');\n }\n\n return evaluatedArray;\n}\n\nfunction multiplySchemaArrays(a: SchemaObject[], b: SchemaObject[], depth: number): SchemaObject[] {\n const totalCombinations = a.length * b.length;\n if (totalCombinations > MAX_SCHEMA_COMBINATION_SIZE) {\n return [{}];\n }\n\n if (a.length === 0 && b.length === 0) {\n return [{}];\n }\n if (a.length === 0) {\n return b;\n }\n if (b.length === 0) {\n return a;\n }\n\n const product = a.flatMap((schema1) => {\n return b.flatMap((schema2) => {\n try {\n const combinedSchema = combineTopLevelSchemas(schema1, schema2, depth + 1);\n return [combinedSchema];\n } catch (error) {\n if (error instanceof ImpossibleSchemaError) {\n return [];\n }\n throw error;\n }\n });\n });\n\n if (product.length === 0) {\n // throw new ImpossibleSchemaError(\n // [],\n // 'impossible schema combination',\n // `schema 1: ${JSON.stringify(a, null, 2)}`,\n // `schema 2: ${JSON.stringify(b, null, 2)}`\n // );\n }\n\n return product;\n}\n\nfunction combineReducedSchemas(\n schema1: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject,\n schema2: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject,\n depth: number\n): ReducedSchema {\n return {\n oneOf: multiplySchemaArrays(\n \n ((schema1 as OpenAPIV3_1.SchemaObject).oneOf ?? []) as OpenAPIV3_1.SchemaObject[],\n \n ((schema2 as OpenAPIV3_1.SchemaObject).oneOf ?? []) as OpenAPIV3_1.SchemaObject[],\n depth\n ),\n };\n}\n\nfunction combineTopLevelSchemas(\n schema1: SchemaObject,\n schema2: SchemaObject,\n depth: number\n): OpenAPIV3_1.SchemaObject {\n let type1 = schema1.type;\n let type2 = schema2.type;\n\n if (type1 === 'integer' && type2 === 'number') {\n type2 = 'integer';\n } else if (type1 === 'number' && type2 === 'integer') {\n type1 = 'integer';\n }\n\n if (type1 && type2 && type1 !== type2) {\n throw new ImpossibleSchemaError([], `mismatched type in composition: \"${type1}\" \"${type2}\"`);\n }\n\n for (const schema of [schema1, schema2]) {\n if (typeof schema.exclusiveMaximum === 'number') {\n if (schema.maximum === undefined || schema.maximum >= schema.exclusiveMaximum) {\n schema.maximum = schema.exclusiveMaximum;\n schema.exclusiveMaximum = true;\n } else {\n schema.exclusiveMaximum = undefined;\n }\n }\n\n if (typeof schema.exclusiveMinimum === 'number') {\n if (schema.minimum === undefined || schema.minimum <= schema.exclusiveMinimum) {\n schema.minimum = schema.exclusiveMinimum;\n schema.exclusiveMinimum = true;\n } else {\n schema.exclusiveMinimum = undefined;\n }\n }\n }\n\n // missing properties here from BaseSchemaObject because we have no UI reflecting them:\n // not\n // discriminator\n // xml\n // externalDocs\n const combinedSchema: SchemaObject = {\n title: takeLast(schema1, schema2, 'title'),\n description: takeLast(schema1, schema2, 'description'),\n format: takeLast(schema1, schema2, 'format'),\n default: takeLast(schema1, schema2, 'default'),\n multipleOf: combine(schema1, schema2, 'multipleOf', leastCommonMultiple),\n maximum: combine(schema1, schema2, 'maximum', Math.min),\n minimum: combine(schema1, schema2, 'minimum', Math.max),\n maxLength: combine(schema1, schema2, 'maxLength', Math.min),\n minLength: combine(schema1, schema2, 'minLength', Math.max),\n pattern: takeLast(schema1, schema2, 'pattern'),\n maxItems: combine(schema1, schema2, 'maxItems', Math.min),\n minItems: combine(schema1, schema2, 'minItems', Math.max),\n uniqueItems: takeLast(schema1, schema2, 'uniqueItems'),\n maxProperties: combine(schema1, schema2, 'maxProperties', Math.min),\n minProperties: combine(schema1, schema2, 'minProperties', Math.max),\n required: combine(schema1, schema2, 'required', (a, b) =>\n b.concat(a.filter((value) => !b.includes(value)))\n ),\n enum: combine(schema1, schema2, 'enum', (a, b) => b.filter((value) => a.includes(value))),\n const: combine(schema1, schema2, 'const', (a, b) => b ?? a),\n readOnly: schema1.readOnly && schema2.readOnly,\n writeOnly: schema1.writeOnly && schema2.writeOnly,\n deprecated: schema1.deprecated || schema2.deprecated,\n };\n\n for (const schema of [schema1, schema2]) {\n Object.keys(schema).forEach((key) => {\n if (key.startsWith('x-')) {\n \n combinedSchema[key as keyof SchemaObject] = takeLast(\n schema1,\n schema2,\n \n key as keyof SchemaObject\n );\n }\n });\n }\n\n // Delete undefined values\n Object.entries(combinedSchema).forEach(([key, value]) => {\n if (value === undefined) {\n \n delete combinedSchema[key as keyof SchemaObject];\n }\n });\n\n const example = mergeExamples(schema1, schema2);\n if (example !== undefined) {\n combinedSchema.example = example;\n }\n\n if (combinedSchema.maximum !== undefined) {\n combinedSchema.exclusiveMaximum =\n (schema1.maximum === combinedSchema.maximum ? schema1.exclusiveMaximum : undefined) ||\n (schema2.maximum === combinedSchema.maximum ? schema2.exclusiveMaximum : undefined);\n }\n\n if (combinedSchema.minimum !== undefined) {\n combinedSchema.exclusiveMinimum =\n (schema1.minimum === combinedSchema.minimum ? schema1.exclusiveMinimum : undefined) ||\n (schema2.minimum === combinedSchema.minimum ? schema2.exclusiveMinimum : undefined);\n }\n\n const type = type1 ?? type2;\n if (type === 'array') {\n return {\n type: 'array',\n items: combineReducedSchemas(\n 'items' in schema1 && schema1.items ? schema1.items : {},\n 'items' in schema2 && schema2.items ? schema2.items : {},\n depth + 1\n ),\n ...combinedSchema,\n };\n }\n\n if (schema1.properties && schema2.properties) {\n const combinedProperties = { ...schema1.properties };\n Object.entries(schema2.properties).forEach(([property, schema]) => {\n const schema1Property = combinedProperties[property];\n if (schema1Property) {\n combinedProperties[property] = combineReducedSchemas(schema1Property, schema, depth + 1);\n } else {\n combinedProperties[property] = schema;\n }\n });\n combinedSchema.properties = combinedProperties;\n } else if (schema1.properties || schema2.properties) {\n combinedSchema.properties = {\n ...schema1.properties,\n ...schema2.properties,\n };\n }\n\n if (schema1.additionalProperties === false || schema2.additionalProperties === false) {\n combinedSchema.additionalProperties = false;\n } else {\n const leftAdditional = isReducedSchema(schema1.additionalProperties)\n ? schema1.additionalProperties\n : undefined;\n const rightAdditional = isReducedSchema(schema2.additionalProperties)\n ? schema2.additionalProperties\n : undefined;\n\n if (leftAdditional && rightAdditional) {\n combinedSchema.additionalProperties = combineReducedSchemas(\n leftAdditional,\n rightAdditional,\n depth + 1\n );\n } else if (leftAdditional) {\n combinedSchema.additionalProperties = leftAdditional;\n } else if (rightAdditional) {\n combinedSchema.additionalProperties = rightAdditional;\n } else if (schema1.additionalProperties === true || schema2.additionalProperties === true) {\n combinedSchema.additionalProperties = true;\n }\n }\n\n return type ? { type, ...combinedSchema } : combinedSchema;\n}\n\nfunction generateTopLevelSchemaArray(schema: OpenAPIV3_1.SchemaObject): OpenAPIV3_1.SchemaObject[] {\n \n if ((schema as OpenAPIV3.SchemaObject).nullable) {\n const typedSchema = { ...schema };\n delete typedSchema.oneOf;\n delete typedSchema.anyOf;\n delete typedSchema.allOf;\n \n delete (typedSchema as OpenAPIV3.SchemaObject).nullable;\n\n const nullSchema = { ...schema };\n delete nullSchema.oneOf;\n delete nullSchema.anyOf;\n delete nullSchema.allOf;\n \n delete (nullSchema as OpenAPIV3.SchemaObject).nullable;\n nullSchema.type = 'null';\n\n return [typedSchema, nullSchema];\n }\n\n if (Array.isArray(schema.type)) {\n if (schema.type.length === 0) {\n const topLevelSchema = { ...schema };\n delete topLevelSchema.oneOf;\n delete topLevelSchema.anyOf;\n delete topLevelSchema.allOf;\n delete topLevelSchema.type;\n return [topLevelSchema];\n }\n\n return schema.type.map((typeString) => {\n const topLevelSchema = { ...schema };\n delete topLevelSchema.oneOf;\n delete topLevelSchema.anyOf;\n delete topLevelSchema.allOf;\n topLevelSchema.type = typeString;\n return topLevelSchema;\n });\n }\n\n const topLevelSchema = { ...schema };\n delete topLevelSchema.oneOf;\n delete topLevelSchema.anyOf;\n delete topLevelSchema.allOf;\n return [topLevelSchema];\n}\n\nfunction mergeExamples(\n schema1: SchemaObject,\n schema2: SchemaObject\n): SchemaObject['example'] | undefined {\n // literally exactly the same as combineExamples in packages/validation/src/openapi/utils.ts\n const examples1 =\n \n 'examples' in schema1 ? (schema1 as OpenAPIV3_1.SchemaObject).examples : undefined;\n const examples2 =\n \n 'examples' in schema2 ? (schema2 as OpenAPIV3_1.SchemaObject).examples : undefined;\n\n const example1 = examples1?.[0] !== undefined ? examples1[0] : schema1.example;\n const example2 = examples2?.[0] !== undefined ? examples2[0] : schema2.example;\n\n if (\n example1 &&\n example2 &&\n typeof example1 === 'object' &&\n typeof example2 === 'object' &&\n !Array.isArray(example1) &&\n !Array.isArray(example2)\n ) {\n return {\n \n ...(example1 as Record<string, unknown>),\n \n ...(example2 as Record<string, unknown>),\n };\n }\n\n // null is a valid example\n return example2 !== undefined ? example2 : example1;\n}\n\nfunction leastCommonMultiple(a: number, b: number): number {\n return Math.abs(a * b) / greatestCommonDivisor(a, b);\n}\n\nfunction greatestCommonDivisor(a: number, b: number): number {\n return b === 0 ? a : greatestCommonDivisor(b, a % b);\n}\n"],"names":["reduceExpandedSchema","schema","depth","location","flattenOneOfs","reduced","reduceCompositions","flattenSchemaOneOfs","safeParse","path","isCircularRef","shouldTruncateForSize","reduceOptionsCompositions","totalAllOf","subschema","index","accumulator","current","combineReducedSchemas","createEmptyReducedSchema","multiplySchemaArrays","key","propertyPath","error","handleExistingError","createUnknownReducedSchema","ImpossibleSchemaError","topLevelSchemaArray","generateTopLevelSchemaArray","schemaArray","evaluatedArray","a","b","MAX_SCHEMA_COMBINATION_SIZE","product","schema1","schema2","combineTopLevelSchemas","type1","type2","combinedSchema","takeLast","combine","leastCommonMultiple","value","example","mergeExamples","type","combinedProperties","property","schema1Property","leftAdditional","isReducedSchema","rightAdditional","typedSchema","nullSchema","topLevelSchema","typeString","examples1","examples2","example1","example2","greatestCommonDivisor"],"mappings":";;;AAwBO,SAASA,EAAqB;AAAA,EACnC,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC,IAAgB;AAClB,GAKiB;AACf,QAAMC,IAAUC,EAAmB;AAAA,IACjC,QAAAL;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAW;AAAA,IACX,MAAM,CAAC,GAAG;AAAA,EAAA,CACX;AAED,SAAOC,IAAgBG,EAAoBF,CAAO,IAAIA;AACxD;AAEA,SAASC,EAAmB;AAAA,EAC1B,QAAAL;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAK,IAAY;AAAA,EACZ,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AAIC,CAAC;AACrD;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveGraphNode.js","sources":["../../../src/api-playground-2/schemaGraph/resolveGraphNode.ts"],"sourcesContent":["import {\n type GraphNode,\n type HashedNodeMap,\n type UUID,\n type UUIDObjectHashMap,\n type SchemaObject,\n} from '@mintlify/validation';\n\nimport { CIRCULAR_REF_KEY } from '@/api-playground-2/constants';\nimport type { Location } from '@/api-playground-2/types';\n\nimport { reduceExpandedSchema } from './reduceCompositions';\n\n/**\n * Find a single node within the OpenAPI schema graph by its UUID. We can't know, from the graph,\n * the type of the returned node—it's up to the caller to properly specify the type.\n */\nexport const resolveGraphNode = <T extends GraphNode>({\n uuidObjectHashMap,\n hashedNodeMap,\n id,\n}: {\n uuidObjectHashMap: UUIDObjectHashMap;\n hashedNodeMap: HashedNodeMap;\n id?: UUID;\n}): T | undefined => {\n if (!id || !uuidObjectHashMap[id]) return undefined;\n const hashId = uuidObjectHashMap[id];\n if (!hashId) return undefined;\n \n return hashedNodeMap[hashId] as T | undefined;\n};\n\n/**\n * Find a single node within the OpenAPI schema graph, and recursively expand everything within its\n * subtree by following any resolvable UUIDs back through the graph.\n *\n * This function handles schema composition (anyOf, oneOf, allOf) through the use of reduceExpandedSchema,\n * which does some fun math and reshapes a schema such that there are only `oneOf` properties with\n * arrays of schemas within them.\n *\n * We only use the flattenOneOfs flag when testing against the v1 SchemaConverter, otherwise we want to recursively\n * remove oneOfs in the schema reduction.\n */\nexport const deeplyResolveGraphNode = <T extends GraphNode>({\n uuidObjectHashMap,\n hashedNodeMap,\n id,\n location,\n flattenOneOfs = true,\n}: {\n uuidObjectHashMap: UUIDObjectHashMap;\n hashedNodeMap: HashedNodeMap;\n id?: UUID;\n location?: Location;\n flattenOneOfs?: boolean;\n}): T | undefined => {\n if (!id) return undefined;\n\n const memo = new Map<UUID, unknown>();\n const visited = new Set<UUID>();\n\n const isResolvableUuid = (value: unknown): value is UUID =>\n typeof value === 'string' && value in uuidObjectHashMap;\n\n // Given a UUID, return the *fully-expanded* graph node at that UUID. We also memoize the result\n // + mark it as visited, to save work and to prevent infinite recursion, respectively.\n const resolveByUuid = (uuid: UUID, depth: number, currentLocation?: Location): unknown => {\n // If we've already deeply expanded this UUID, return it\n if (memo.has(uuid)) return memo.get(uuid);\n\n // If we've already visited this UUID but we haven't memoized it, then another call to this function\n // has already started expanding it; return a circular reference marker with the UUID.\n if (visited.has(uuid)) return { [CIRCULAR_REF_KEY]: uuid };\n\n // Visit the node: mark as visited, resolve the node, expand it, and memoize the result.\n visited.add(uuid);\n const node = resolveGraphNode<GraphNode>({ uuidObjectHashMap, hashedNodeMap, id: uuid });\n if (!node) return uuid;\n const expanded = expand(node, depth + 1, currentLocation);\n memo.set(uuid, expanded);\n\n return expanded;\n };\n\n // Recursive function -- for all properties of the object, expand the value if it is a UUID; return\n // the fully expanded objects all the way back up to the top.\n const expand = (value: unknown, depth: number, currentLocation?: Location): unknown => {\n if (value == null) return value;\n if (isResolvableUuid(value)) return resolveByUuid(value, depth, currentLocation);\n if (Array.isArray(value)) return value.map((item) => expand(item, depth + 1, currentLocation));\n if (typeof value === 'object') {\n \n const obj = value as Record<string, unknown>;\n\n // if the object contains a $ref, resolve it with any adjacent properties\n if (typeof obj.$ref === 'string' && isResolvableUuid(obj.$ref)) {\n const resolvedRef = resolveByUuid(obj.$ref, depth, currentLocation);\n if (resolvedRef && typeof resolvedRef === 'object') {\n \n const expandedObj: Record<string, unknown> = { ...resolvedRef } as Record<\n string,\n unknown\n >;\n // skip $ref, already expanded\n for (const [k, v] of Object.entries(obj)) {\n if (k !== '$ref') {\n expandedObj[k] = expand(v, depth + 1, currentLocation);\n }\n }\n\n return expandedObj;\n }\n }\n\n // Otherwise, recursively expand all properties\n \n const expandedObj: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(obj)) {\n expandedObj[k] = expand(v, depth + 1, currentLocation);\n }\n\n return expandedObj;\n }\n return value;\n };\n\n // expand the schema by resolving all UUIDs into their full object graph\n \n const expanded = expand(id, 0, location) as SchemaObject;\n\n // reduce the expanded schema, converting any compositions into a single `oneOf` property\n const reduced = reduceExpandedSchema({\n schema: expanded,\n depth: 0,\n location,\n flattenOneOfs,\n });\n\n \n return reduced as T | undefined;\n};\n"],"names":["resolveGraphNode","uuidObjectHashMap","hashedNodeMap","id","hashId","deeplyResolveGraphNode","location","flattenOneOfs","memo","visited","isResolvableUuid","value","resolveByUuid","uuid","depth","currentLocation","CIRCULAR_REF_KEY","node","expanded","expand","item","obj","resolvedRef","expandedObj","k","v","reduceExpandedSchema"],"mappings":";;AAiBO,MAAMA,IAAmB,CAAsB;AAAA,EACpD,mBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,IAAAC;AACF,MAIqB;AACnB,MAAI,CAACA,KAAM,CAACF,EAAkBE,CAAE,EAAG;AACnC,QAAMC,IAASH,EAAkBE,CAAE;AACnC,MAAKC;AAEL,WAAOF,EAAcE,CAAM;AAC7B,GAaaC,IAAyB,CAAsB;AAAA,EAC1D,mBAAAJ;AAAA,EACA,eAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAG;AAAA,EACA,eAAAC,IAAgB;AAClB,MAMqB;AACnB,MAAI,CAACJ,EAAI;AAET,QAAMK,wBAAW,IAAA,GACXC,wBAAc,IAAA,GAEdC,IAAmB,CAACC,MACxB,OAAOA,KAAU,YAAYA,KAASV,GAIlCW,IAAgB,CAACC,GAAYC,GAAeC,MAAwC;AAExF,QAAIP,EAAK,IAAIK,CAAI,EAAG,QAAOL,EAAK,IAAIK,CAAI;AAIxC,QAAIJ,EAAQ,IAAII,CAAI,UAAU,EAAE,CAACG,CAAgB,GAAGH,EAAA;AAGpD,IAAAJ,EAAQ,IAAII,CAAI;AAChB,UAAMI,IAAOjB,EAA4B,EAAE,mBAAAC,GAAmB,eAAAC,GAAe,IAAIW,GAAM;AACvF,QAAI,CAACI,EAAM,QAAOJ;AAClB,UAAMK,IAAWC,EAAOF,CAAgC;AACxD,WAAAT,EAAK,IAAIK,GAAMK,CAAQ,GAEhBA;AAAAA,EACT,GAIMC,IAAS,CAACR,GAAgBG,GAAeC,MAAwC;AACrF,QAAIJ,KAAS,KAAM,QAAOA;AAC1B,QAAID,EAAiBC,CAAK,UAAUC,EAAcD,CAA6B;AAC/E,QAAI,MAAM,QAAQA,CAAK,UAAUA,EAAM,IAAI,CAACS,MAASD,EAAOC,CAAgC,CAAC;AAC7F,QAAI,OAAOT,KAAU,UAAU;AAE7B,YAAMU,IAAMV;AAGZ,UAAI,OAAOU,EAAI,QAAS,YAAYX,EAAiBW,EAAI,IAAI,GAAG;AAC9D,cAAMC,IAAcV,EAAcS,EAAI,IAA4B;AAClE,YAAIC,KAAe,OAAOA,KAAgB,UAAU;AAElD,gBAAMC,IAAuC,EAAE,GAAGD,EAAA;AAKlD,qBAAW,CAACE,GAAGC,CAAC,KAAK,OAAO,QAAQJ,CAAG;AACrC,YAAIG,MAAM,WACRD,EAAYC,CAAC,IAAIL,EAAOM,CAA6B;AAIzD,iBAAOF;AAAAA,QACT;AAAA,MACF;AAIA,YAAMA,IAAuC,CAAA;AAC7C,iBAAW,CAACC,GAAGC,CAAC,KAAK,OAAO,QAAQJ,CAAG;AACrC,QAAAE,EAAYC,CAAC,IAAIL,EAAOM,CAA6B;AAGvD,aAAOF;AAAA,IACT;AACA,WAAOZ;AAAA,EACT,GAIMO,IAAWC,EAAOhB,CAAe;AAWvC,SARgBuB,EAAqB;AAAA,IACnC,QAAQR;AAAA,IACR,OAAO;AAAA,IACP,UAAAZ;AAAA,IACA,eAAAC;AAAA,EAAA,CACD;AAIH;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOperationWithDependencies.js","sources":["../../../src/api-playground-2/schemaGraph/resolveOperationWithDependencies.ts"],"sourcesContent":["import type {\n HashedNodeMap,\n HttpMethod,\n Operation,\n ParameterObject,\n RequestBodyObject,\n ResponseObject,\n ParameterOrRef,\n UUID,\n UUIDObjectHashMap,\n MediaObject,\n SchemaObject,\n} from '@mintlify/validation';\n\nimport { CIRCULAR_REF_KEY } from '@/api-playground-2/constants';\nimport { reduceExpandedSchema } from '@/api-playground-2/schemaGraph/reduceCompositions';\nimport { sortSchemaByRequired } from '@/api-playground-2/schemaGraph/sortSchemaByRequired';\nimport {\n flattenSingleOneOf,\n isSchemaObject,\n isCircularRef,\n} from '@/api-playground-2/schemaGraph/utils';\n\nimport { addUniqueKeysToSchema } from './addUniqueKeysToSchema';\nimport { generateExamplesFromSchema } from './processExamples';\nimport { deeplyResolveGraphNode, resolveGraphNode } from './resolveGraphNode';\n\nexport type ResolvedEndpoint = {\n deprecated: boolean;\n description: string;\n method: HttpMethod;\n path: string;\n request: {\n body: UUID | undefined;\n parameters: UUID[] | undefined;\n security: UUID[] | undefined;\n };\n // e.g. { '200': 'uuid-here', '400': 'uuid-here' }\n response: Record<string, UUID> | undefined;\n type: 'path' | 'webhook';\n};\n\nexport type ResolvedOperationData = {\n operation: Operation;\n dependencies: {\n parameters?: Record<UUID, ParameterObject>;\n requestBody?: RequestBodyObject;\n responses?: Record<UUID, ResponseObject>;\n };\n schemas?: Record<UUID, SchemaObject>;\n};\n\nexport const resolveOperationWithDependencies = ({\n operationId,\n uuidObjectHashMap,\n hashedNodeMap,\n}: {\n operationId: UUID;\n uuidObjectHashMap: UUIDObjectHashMap;\n hashedNodeMap: HashedNodeMap;\n}): ResolvedOperationData | undefined => {\n const operation = resolveGraphNode<Operation>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: operationId,\n });\n\n if (!operation) {\n return undefined;\n }\n\n const parameters = new Map<UUID, ParameterObject>();\n const responses = new Map<UUID, ResponseObject>();\n\n const parameterIds = operation.parameters;\n parameterIds?.forEach((paramId) => {\n if (typeof paramId !== 'string') return;\n const parameter = resolveParameter(paramId, uuidObjectHashMap, hashedNodeMap);\n if (parameter && 'name' in parameter && 'in' in parameter) {\n parameters.set(paramId, parameter);\n }\n });\n\n let requestBody: RequestBodyObject | undefined;\n const requestBodyId = operation.requestBody;\n if (requestBodyId && typeof requestBodyId === 'string') {\n requestBody = resolveRequestBody(requestBodyId, uuidObjectHashMap, hashedNodeMap);\n\n if (requestBody) {\n requestBody.content = generateExamplesFromSchema(requestBody.content);\n }\n }\n\n const responsesMap = operation.responses;\n if (responsesMap) {\n Object.values(responsesMap).forEach((responseId) => {\n if (typeof responseId !== 'string') return;\n const response = resolveResponse(responseId, uuidObjectHashMap, hashedNodeMap);\n\n if (response && response.content) {\n response.content = generateExamplesFromSchema(response.content);\n }\n\n if (response) {\n responses.set(responseId, response);\n }\n });\n }\n\n // Collect all schemas with circular references\n const allResolvedObjects = {\n operation,\n parameters: Object.fromEntries(parameters),\n requestBody,\n responses: Object.fromEntries(responses),\n };\n\n const schemas = collectCircularSchemas(allResolvedObjects, uuidObjectHashMap, hashedNodeMap);\n\n // we're using Maps above for the ergonomics, but we convert to JS objects at return time\n // for better serialization.\n return {\n operation,\n dependencies: {\n parameters: Object.fromEntries(parameters),\n requestBody,\n responses: Object.fromEntries(responses),\n },\n schemas: Object.keys(schemas).length > 0 ? schemas : undefined,\n };\n};\n\nfunction resolveRequestBody(\n requestBodyId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): RequestBodyObject | undefined {\n let requestBody = deeplyResolveGraphNode<RequestBodyObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: requestBodyId,\n });\n if (!requestBody) return undefined;\n\n requestBody = flattenSingleOneOf<RequestBodyObject>(requestBody);\n\n Object.values(requestBody.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n\n return requestBody;\n}\n\nfunction resolveResponse(\n responseId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): ResponseObject | undefined {\n let response = deeplyResolveGraphNode<ResponseObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: responseId,\n });\n if (!response) return undefined;\n\n response = flattenSingleOneOf<ResponseObject>(response);\n\n if (response.content) {\n Object.values(response.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'response',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n }\n\n return response;\n}\n\nfunction resolveParameter(\n parameterId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): ParameterOrRef | undefined {\n let parameter = deeplyResolveGraphNode<ParameterOrRef>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: parameterId,\n });\n if (!parameter) return undefined;\n\n parameter = flattenSingleOneOf<ParameterOrRef>(parameter);\n\n if ('schema' in parameter && parameter.schema && isSchemaObject(parameter.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: parameter.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (parameter as any).schema = resolvedSchema;\n }\n\n if ('content' in parameter && parameter.content) {\n Object.values(parameter.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n }\n\n return parameter;\n}\n\n/**\n * Collect all schemas that have circular references by walking through the resolved objects.\n * Returns a map of UUID -> SchemaObject for schemas that contain circular refs.\n */\nfunction collectCircularSchemas(\n obj: unknown,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap,\n visited = new Set<UUID>()\n): Record<UUID, SchemaObject> {\n const schemas: Record<UUID, SchemaObject> = {};\n\n const collect = (value: unknown): void => {\n if (value == null) return;\n\n // If we encounter a circular ref, collect the referenced schema\n if (isCircularRef(value)) {\n const uuid = value[CIRCULAR_REF_KEY];\n if (!visited.has(uuid)) {\n visited.add(uuid);\n let node = deeplyResolveGraphNode<SchemaObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: uuid,\n });\n\n if (!node) return;\n\n node = reduceExpandedSchema({\n schema: node,\n depth: 0,\n location: 'request',\n });\n node = sortSchemaByRequired(node);\n\n schemas[uuid] = node;\n // Recursively collect from this schema too\n collect(node);\n }\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(collect);\n return;\n }\n\n if (typeof value === 'object') {\n for (const v of Object.values(value)) {\n collect(v);\n }\n }\n };\n\n collect(obj);\n return schemas;\n}\n"],"names":["resolveOperationWithDependencies","operationId","uuidObjectHashMap","hashedNodeMap","operation","resolveGraphNode","parameters","responses","parameterIds","paramId","parameter","resolveParameter","requestBody","requestBodyId","resolveRequestBody","generateExamplesFromSchema","responsesMap","responseId","response","resolveResponse","allResolvedObjects","schemas","collectCircularSchemas","deeplyResolveGraphNode","flattenSingleOneOf","mediaType","isSchemaObject","resolvedSchema","reduceExpandedSchema","sortSchemaByRequired","addUniqueKeysToSchema","parameterId","obj","visited","collect","value","isCircularRef","uuid","CIRCULAR_REF_KEY","node","v"],"mappings":";;;;;;;AAoDO,MAAMA,IAAmC,CAAC;AAAA,EAC/C,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,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AM;AAEX,UAAAA,IAAOX,EAAqB;AAAA,YAC1B,QAAQW;AAAA,YACR,OAAO;AAAA,YACP,UAAU;AAAA,UAAA,CACX,GACDA,IAAOV,EAAqBU,CAAI,GAEhClB,EAAQgB,CAAI,IAAIE,GAEhBL,EAAQK,CAAI;AAAA,QACd;AACA;AAAA,MACF;AAEA,UAAI,MAAM,QAAQJ,CAAK,GAAG;AACxB,QAAAA,EAAM,QAAQD,CAAO;AACrB;AAAA,MACF;AAEA,UAAI,OAAOC,KAAU;AACnB,mBAAWK,KAAK,OAAO,OAAOL,CAAK;AACjC,UAAAD,EAAQM,CAAC;AAAA;AAAA,EAGf;AAEA,SAAAN,EAAQF,CAAG,GACJX;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSchemaWithDependencies.js","sources":["../../../src/api-playground-2/schemaGraph/resolveSchemaWithDependencies.ts"],"sourcesContent":["import { SchemaGraphData } from '@mintlify/validation';\n\nimport { addUniqueKeysToSchema } from '@/api-playground-2/schemaGraph/addUniqueKeysToSchema';\nimport { reduceExpandedSchema } from '@/api-playground-2/schemaGraph/reduceCompositions';\nimport { deeplyResolveGraphNode } from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport { sortSchemaByRequired } from '@/api-playground-2/schemaGraph/sortSchemaByRequired';\nimport { SchemaV2 } from '@/api-playground-2/types';\n\nfunction getSchemaId(schemaString: string, graph: SchemaGraphData) {\n const schemaUuid = graph.spec.refUuidMap[schemaString];\n if (!schemaUuid) return undefined;\n return schemaUuid;\n}\n\nexport function resolveSchemaWithDependencies({\n schemaPath,\n schemaGraphData,\n}: {\n schemaPath: string;\n schemaGraphData: SchemaGraphData;\n}): SchemaV2 {\n const schemaId = getSchemaId(schemaPath, schemaGraphData);\n if (!schemaId) {\n throw new Error(`no matching OpenAPI schema found with path \"${schemaPath}\"`);\n }\n let schema = deeplyResolveGraphNode<SchemaV2>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: schemaId,\n });\n if (!schema) {\n throw new Error(`no matching OpenAPI schema found with id \"${schemaPath}\"`);\n }\n schema = reduceExpandedSchema({\n schema,\n depth: 0,\n location: 'request',\n });\n schema = sortSchemaByRequired(schema);\n schema = addUniqueKeysToSchema(schema, '');\n\n return schema;\n}\n"],"names":["getSchemaId","schemaString","graph","schemaUuid","resolveSchemaWithDependencies","schemaPath","schemaGraphData","schemaId","schema","deeplyResolveGraphNode","reduceExpandedSchema","sortSchemaByRequired","addUniqueKeysToSchema"],"mappings":";;;;AAQA,SAASA,EAAYC,GAAsBC,GAAwB;AACjE,QAAMC,IAAaD,EAAM,KAAK,WAAWD,CAAY;AACrD,MAAKE;AACL,WAAOA;AACT;AAEO,SAASC,EAA8B;AAAA,EAC5C,YAAAC;AAAA,EACA,iBAAAC;AACF,GAGa;AACX,QAAMC,IAAWP,EAAYK,GAAYC,CAAe;AACxD,MAAI,CAACC;AACH,UAAM,IAAI,MAAM,+CAA+CF,CAAU,GAAG;AAE9E,MAAIG,IAASC,EAAiC;AAAA,IAC5C,mBAAmBH,EAAgB,KAAK;AAAA,IACxC,eAAeA,EAAgB,KAAK;AAAA,IACpC,IAAIC;AAAA,EAAA,CACL;AACD,MAAI,CAACC;AACH,UAAM,IAAI,MAAM,6CAA6CH,CAAU,GAAG;AAE5E,SAAAG,IAASE,EAAqB;AAAA,IAC5B,QAAAF;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACX,GACDA,IAASG,EAAqBH,CAAM,GACpCA,IAASI,EAAsBJ,GAAQ,EAAE,GAElCA;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sortSchemaByRequired.js","sources":["../../../src/api-playground-2/schemaGraph/sortSchemaByRequired.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n/**\n * Mutate a SchemaObject to sort its properties by whether or not they are required. Transforms\n * a schema's `required: string[]` field into individual `isRequired: true` fields on the respective\n * properties.\n */\nexport const sortSchemaByRequired = (schema: SchemaObject): ResolvedSchemaObject => {\n if (!isSchemaObject(schema)) {\n return schema;\n }\n\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return {\n ...schema,\n oneOf: schema.oneOf.map((subSchema) =>\n isSchemaObject(subSchema) ? sortSchemaByRequired(subSchema) : subSchema\n ),\n };\n }\n\n if (schema.type === 'object' && schema.properties) {\n const requiredSet = new Set(schema.required || []);\n const entries = Object.entries(schema.properties).filter(\n (entry): entry is [string, SchemaObject] => isSchemaObject(entry[1])\n );\n\n const sortedEntries = entries.sort(([nameA], [nameB]) => {\n const isRequiredA = requiredSet.has(nameA);\n const isRequiredB = requiredSet.has(nameB);\n if (isRequiredA === isRequiredB) return 0;\n return isRequiredA ? -1 : 1;\n });\n\n const sortedProperties: Record<string, SchemaObject> = {};\n sortedEntries.forEach(([name, propSchema]) => {\n const isRequired = requiredSet.has(name);\n const processedSchema = isSchemaObject(propSchema)\n ? sortSchemaByRequired(propSchema)\n : propSchema;\n\n sortedProperties[name] = isRequired\n ? { ...processedSchema, isRequired: true }\n : processedSchema;\n });\n\n return {\n ...schema,\n properties: sortedProperties,\n };\n }\n\n if (schema.type === 'array' && isSchemaObject(schema.items)) {\n return {\n ...schema,\n items: sortSchemaByRequired(schema.items),\n };\n }\n\n return schema;\n};\n"],"names":["sortSchemaByRequired","schema","isSchemaObject","subSchema","requiredSet","sortedEntries","entry","nameA","nameB","isRequiredA","isRequiredB","sortedProperties","name","propSchema","isRequired","processedSchema"],"mappings":";AAUO,MAAMA,IAAuB,CAACC,MAA+C;AAClF,MAAI,CAACC,EAAeD,CAAM;AACxB,WAAOA;AAGT,MAAIA,EAAO,SAAS,MAAM,QAAQA,EAAO,KAAK;AAC5C,WAAO;AAAA,MACL,GAAGA;AAAA,MACH,OAAOA,EAAO,MAAM;AAAA,QAAI,CAACE,MACvBD,EAAeC,CAAS,IAAIH,EAAqBG,CAAS,IAAIA;AAAA,MAAA;AAAA,IAChE;AAIJ,MAAIF,EAAO,SAAS,YAAYA,EAAO,YAAY;AACjD,UAAMG,IAAc,IAAI,IAAIH,EAAO,YAAY,CAAA,CAAE,GAK3CI,IAJU,OAAO,QAAQJ,EAAO,UAAU,EAAE;AAAA,MAChD,CAACK,MAA2CJ,EAAeI,EAAM,CAAC,CAAC;AAAA,IAAA,EAGvC,KAAK,CAAC,CAACC,CAAK,GAAG,CAACC,CAAK,MAAM;AACvD,YAAMC,IAAcL,EAAY,IAAIG,CAAK,GACnCG,IAAcN,EAAY,IAAII,CAAK;AACzC,aAAIC,MAAgBC,IAAoB,IACjCD,IAAc,KAAK;AAAA,IAC5B,CAAC,GAEKE,IAAiD,CAAA;AACvD,WAAAN,EAAc,QAAQ,CAAC,CAACO,GAAMC,CAAU,MAAM;AAC5C,YAAMC,IAAaV,EAAY,IAAIQ,CAAI,GACjCG,IAAkBb,EAAeW,CAAU,IAC7Cb,EAAqBa,CAAU,IAC/BA;AAEJ,MAAAF,EAAiBC,CAAI,IAAIE,IACrB,EAAE,GAAGC,GAAiB,YAAY,OAClCA;AAAA,IACN,CAAC,GAEM;AAAA,MACL,GAAGd;AAAA,MACH,YAAYU;AAAA,IAAA;AAAA,EAEhB;AAEA,SAAIV,EAAO,SAAS,WAAWC,EAAeD,EAAO,KAAK,IACjD;AAAA,IACL,GAAGA;AAAA,IACH,OAAOD,EAAqBC,EAAO,KAAK;AAAA,EAAA,IAIrCA;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
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","createEmptyReducedSchema","createUnknownReducedSchema","isPlainRecord","isReducedSchema","schema","isSchemaObject","obj","isArrayObject","shouldTruncateForSize","oneOfSize","anyOfSize","allOfSize","combinations","combinationKeys","key","subSchema","subSchemaKey","subSubSchema","subSubSchemaKey","subSubSubSchema","acc","curr","MAX_SCHEMA_COMBINATION_SIZE","takeLast","schema1","schema2","combine","transform","flattenSingleOneOf","node","flattenSchemaOneOfs","result","flattened","mappedOneOf","item","singleItem","getDifferentiatedType","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","arrayIndexOrKey","convertAnySchemaToOneOfs","getRequestBodyContentType","contentTypeIndex","escapeDots","mapParamInToPlaygroundInputKey","parameterIn","apiPlaygroundInputKeys","unflattenInputs","inputs","parts","part","section","keyPath","validKeys","setNestedValue","convertArrayLikeToArray","isArrayLike","keys","k","a","b","val","filteredKeys","i","current","filterSchemasWithConsts","schemas","getBodyDefaultsFromSchema","bodyDefaults","inputKey","subDefaults","propSchema","propDefaults","addPropsDefaults","itemsDefaults"],"mappings":";;AAiCO,SAASA,EAAcC,GAA4C;AACxE,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVC,KAAoBD,KACpB,OAAOA,EAAMC,CAAgB,KAAM;AAEvC;AAMO,MAAMC,IAA2B,OAAsB,EAAE,OAAO,GAAC,IAC3DC,IAA6B,OAAsB,EAAE,OAAO,CAAC,CAAA,CAAE,EAAA,IAE/DC,IAAgB,CAACJ,MAC5B,OAAOA,KAAU,YAAYA,MAAU,QAAQ,CAAC,MAAM,QAAQA,CAAK,GAExDK,IAAkB,CAACC,MAC9BC,EAAeD,CAAM,KAAK,MAAM,QAAQA,EAAO,KAAK,GAmEzCC,IAAiB,CAACC,MACxBJ,EAAcI,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;AAOtC,SAASE,EAAsBJ,GAA2C;AAC/E,QAAMK,IAAY,MAAM,QAAQL,EAAO,KAAK,IAAIA,EAAO,MAAM,SAAS,GAChEM,IAAY,MAAM,QAAQN,EAAO,KAAK,IAAIA,EAAO,MAAM,SAAS,GAChEO,IAAY,MAAM,QAAQP,EAAO,KAAK,IAAIA,EAAO,MAAM,SAAS,GAEhEQ,IAAyB,CAACH,GAAWC,GAAWC,CAAS;AAG/D,SAAAE,EAAgB,QAAQ,CAACC,MAAQ;AAC/B,QAAIV,EAAOU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MuF,IAAcH,EAA0BpF,CAAS;AACvD,aAAO,OAAOqF,GAAcE,CAAW;AAAA,IACzC;AAAA,EACF,CAAC,GAGClG,EAAO,SAAS,YAAYA,EAAO,cACrC,OAAO,OAAOA,EAAO,UAAU,EAAE,QAAQ,CAACmG,MAAe;AACvD,QAAIlG,EAAekG,CAAU,GAAG;AAC9B,YAAMC,IAAeL,EAA0BI,CAAU;AACzD,aAAO,OAAOH,GAAcI,CAAY;AAAA,IAC1C;AAAA,EACF,CAAC,GAIDpG,EAAO,wBACP,OAAOA,EAAO,wBAAyB,YACvCC,EAAeD,EAAO,oBAAoB,GAC1C;AACA,UAAMqG,IAAmBN,EAA0B/F,EAAO,oBAAoB;AAC9E,WAAO,OAAOgG,GAAcK,CAAgB;AAAA,EAC9C;AAEA,MAAIrG,EAAO,SAAS,WAAW,WAAWA,KAAUC,EAAeD,EAAO,KAAK,GAAG;AAChF,UAAMsG,IAAgBP,EAA0B/F,EAAO,KAAK;AAC5D,WAAO,OAAOgG,GAAcM,CAAa;AAAA,EAC3C;AAEA,SAAON;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
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,yBAA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,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;"}
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseApiTargetFromMetadata.js","sources":["../../src/common/parseApiTargetFromMetadata.ts"],"sourcesContent":["import { PageMetaTags } from '@mintlify/models';\nimport { parseOpenApiString, parseOpenApiSchemaString } from './parseOpenApiString';\n\nexport type SchemaTargetType = {\n type: 'schema';\n} & ReturnType<typeof parseOpenApiSchemaString>;\n\nexport type OperationTargetType = {\n type: 'operation';\n} & ReturnType<typeof parseOpenApiString>;\n\n\nexport const parseApiTargetFromMetadata = (\n metadata: PageMetaTags\n): SchemaTargetType | OperationTargetType | undefined => {\n const openapiSchema = metadata['openapi-schema'];\n if (typeof openapiSchema === 'string' && openapiSchema.length > 0) {\n return {\n type: 'schema',\n ...parseOpenApiSchemaString(openapiSchema),\n };\n }\n\n const openapi = metadata.openapi;\n if (typeof openapi === 'string' && openapi.length > 0) {\n try {\n return {\n type: 'operation',\n ...parseOpenApiString(openapi),\n };\n } catch (error) {\n console.error(`unable to parse value \"${openapi}\" for field \"openapi\":`, error);\n return undefined;\n }\n }\n\n return undefined;\n};"],"names":["parseApiTargetFromMetadata","metadata","openapiSchema","parseOpenApiSchemaString","openapi","parseOpenApiString","error"],"mappings":";AAYO,MAAMA,IAA6B,CACxCC,MACuD;AACvD,QAAMC,IAAgBD,EAAS,gBAAgB;AAC/C,MAAI,OAAOC,KAAkB,YAAYA,EAAc,SAAS;AAC9D,WAAO;AAAA,MACL,MAAM;AAAA,MACN,GAAGC,EAAyBD,CAAa;AAAA,IAAA;AAI7C,QAAME,IAAUH,EAAS;AACzB,MAAI,OAAOG,KAAY,YAAYA,EAAQ,SAAS;AAClD,QAAI;AACF,aAAO;AAAA,QACL,MAAM;AAAA,QACN,GAAGC,EAAmBD,CAAO;AAAA,MAAA;AAAA,IAEjC,SAASE,GAAO;AACd,cAAQ,MAAM,0BAA0BF,CAAO,0BAA0BE,CAAK;AAC9E;AAAA,IACF;AAIJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseOpenApiString.js","sources":["../../src/common/parseOpenApiString.ts"],"sourcesContent":["import { OpenAPIV3 } from 'openapi-types';\n\nconst VALID_METHODS: string[] = Object.values(OpenAPIV3.HttpMethods).concat(\n 'webhook' as OpenAPIV3.HttpMethods\n);\n\n/**\n *\n * @param str either the openapi or api string defined in the frontmatter\n * @returns method: API method (GET, POST, PUT, DELETE, PATCH)\n * endpoint: API endpoint\n * filename: filename of the openapi file (if applicable)\n * returns undefined for any of the values (fails silently)\n */\nexport const potentiallyParseOpenApiString = (\n str: string\n):\n | {\n method: OpenAPIV3.HttpMethods;\n endpoint: string;\n filename?: string;\n }\n | undefined => {\n const components = str.trim().split(/\\s+/);\n let filename: string | undefined;\n let method: string;\n let endpoint: string;\n\n if (components.length > 3) {\n // improperly formatted openapi string\n return undefined;\n } else if (components[0] && components[1] && components[2]) {\n [filename, method, endpoint] = components;\n } else if (components[0] && components[1]) {\n [method, endpoint] = components;\n } else {\n // improperly formatted openapi string\n return undefined;\n }\n\n if (method) {\n method = method.toLowerCase();\n if (!VALID_METHODS.includes(method)) {\n // invalid http method\n return undefined;\n }\n }\n\n return {\n method: method as OpenAPIV3.HttpMethods,\n endpoint,\n filename,\n };\n};\n\n/**\n *\n * @param str either the openapi or api string defined in the frontmatter\n * @returns method: API method (GET, POST, PUT, DELETE, PATCH)\n * endpoint: API endpoint\n * filename: filename of the openapi file (if applicable)\n */\nexport const parseOpenApiString = (\n str: string\n): {\n method: OpenAPIV3.HttpMethods;\n endpoint: string;\n filename?: string;\n} => {\n const components = str.trim().split(/\\s+/);\n let filename: string | undefined;\n let method: string;\n let endpoint: string;\n\n if (components.length > 3) {\n throw new Error('improperly formatted openapi string');\n } else if (components[0] && components[1] && components[2]) {\n [filename, method, endpoint] = components;\n } else if (components[0] && components[1]) {\n [method, endpoint] = components;\n } else {\n throw new Error('improperly formatted openapi string');\n }\n\n method = method.toLowerCase();\n\n if (!VALID_METHODS.includes(method)) {\n throw new Error('invalid http method');\n }\n\n return {\n method: method as OpenAPIV3.HttpMethods,\n endpoint,\n filename,\n };\n};\n\n/**\n * same as above, but for openapi-schema frontmatter\n */\nexport const parseOpenApiSchemaString = (\n str: string\n): {\n name: string;\n filename?: string;\n} => {\n const components = str.trim().split(/\\s+/);\n let filename: string | undefined;\n let name: string;\n\n if (components.length > 2) {\n throw new Error('improperly formatted openapi schema string');\n } else if (components[0] && components[1]) {\n [filename, name] = components;\n } else if (components[0]) {\n [name] = components;\n } else {\n throw new Error('improperly formatted openapi schema string');\n }\n\n return {\n name,\n filename,\n };\n};\n"],"names":["VALID_METHODS","OpenAPIV3","parseOpenApiString","str","components","filename","method","endpoint","parseOpenApiSchemaString","name"],"mappings":";AAEA,MAAMA,IAA0B,OAAO,OAAOC,EAAU,WAAW,EAAE;AAAA,EACnE;AACF,GA0DaC,IAAqB,CAChCC,MAKG;AACH,QAAMC,IAAaD,EAAI,KAAA,EAAO,MAAM,KAAK;AACzC,MAAIE,GACAC,GACAC;AAEJ,MAAIH,EAAW,SAAS;AACtB,UAAM,IAAI,MAAM,qCAAqC;AACvD,MAAWA,EAAW,CAAC,KAAKA,EAAW,CAAC,KAAKA,EAAW,CAAC;AACvD,KAACC,GAAUC,GAAQC,CAAQ,IAAIH;AAAA,WACtBA,EAAW,CAAC,KAAKA,EAAW,CAAC;AACtC,KAACE,GAAQC,CAAQ,IAAIH;AAAA;AAErB,UAAM,IAAI,MAAM,qCAAqC;AAKvD,MAFAE,IAASA,EAAO,YAAA,GAEZ,CAACN,EAAc,SAASM,CAAM;AAChC,UAAM,IAAI,MAAM,qBAAqB;AAGvC,SAAO;AAAA,IACL,QAAAA;AAAA,IACA,UAAAC;AAAA,IACA,UAAAF;AAAA,EAAA;AAEJ,GAKaG,IAA2B,CACtCL,MAIG;AACH,QAAMC,IAAaD,EAAI,KAAA,EAAO,MAAM,KAAK;AACzC,MAAIE,GACAI;AAEJ,MAAIL,EAAW,SAAS;AACtB,UAAM,IAAI,MAAM,4CAA4C;MACnDA,EAAW,CAAC,KAAKA,EAAW,CAAC;AACtC,KAACC,GAAUI,CAAI,IAAIL;AAAA,WACVA,EAAW,CAAC;AACrB,KAACK,CAAI,IAAIL;AAAA;AAET,UAAM,IAAI,MAAM,4CAA4C;AAG9D,SAAO;AAAA,IACL,MAAAK;AAAA,IACA,UAAAJ;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"potentiallyParseOpenApiString.js","sources":["../../src/common/potentiallyParseOpenApiString.ts"],"sourcesContent":["import { OpenAPIV3 } from 'openapi-types';\n\nconst VALID_METHODS: string[] = Object.values(OpenAPIV3.HttpMethods).concat(\n 'webhook' as OpenAPIV3.HttpMethods\n);\n\nexport const potentiallyParseOpenApiString = (\n str: string\n):\n | {\n method: OpenAPIV3.HttpMethods;\n endpoint: string;\n filename?: string;\n }\n | undefined => {\n const components = str.trim().split(/\\s+/);\n let filename: string | undefined;\n let method: string;\n let endpoint: string;\n\n if (components.length > 3) {\n // improperly formatted openapi string\n return undefined;\n } else if (components[0] && components[1] && components[2]) {\n [filename, method, endpoint] = components;\n } else if (components[0] && components[1]) {\n [method, endpoint] = components;\n } else {\n // improperly formatted openapi string\n return undefined;\n }\n\n if (method) {\n method = method.toLowerCase();\n if (!VALID_METHODS.includes(method)) {\n // invalid http method\n return undefined;\n }\n }\n\n return {\n method: method as OpenAPIV3.HttpMethods,\n endpoint,\n filename,\n };\n};"],"names":["VALID_METHODS","OpenAPIV3","potentiallyParseOpenApiString","str","components","filename","method","endpoint"],"mappings":";AAEA,MAAMA,IAA0B,OAAO,OAAOC,EAAU,WAAW,EAAE;AAAA,EACnE;AACF,GAEaC,IAAgC,CAC3CC,MAOe;AACf,QAAMC,IAAaD,EAAI,KAAA,EAAO,MAAM,KAAK;AACzC,MAAIE,GACAC,GACAC;AAEJ,MAAI,EAAAH,EAAW,SAAS,IAGxB;AAAA,QAAWA,EAAW,CAAC,KAAKA,EAAW,CAAC,KAAKA,EAAW,CAAC;AACvD,OAACC,GAAUC,GAAQC,CAAQ,IAAIH;AAAA,aACtBA,EAAW,CAAC,KAAKA,EAAW,CAAC;AACtC,OAACE,GAAQC,CAAQ,IAAIH;AAAA;AAGrB;AAGF,QAAI,EAAAE,MACFA,IAASA,EAAO,YAAA,GACZ,CAACN,EAAc,SAASM,CAAM;AAMpC,aAAO;AAAA,QACL,QAAAA;AAAA,QACA,UAAAC;AAAA,QACA,UAAAF;AAAA,MAAA;AAAA;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replaceSlashIndex.js","sources":["../../src/common/replaceSlashIndex.ts"],"sourcesContent":["export function replaceSlashIndex(path: string): string {\n if (typeof path !== 'string') return path;\n if (path.endsWith('/index')) {\n return path.slice(0, -6);\n } else if (path === 'index') {\n return '';\n }\n return path;\n }\n "],"names":["replaceSlashIndex","path"],"mappings":"AAAO,SAASA,EAAkBC,GAAsB;AACpD,SAAI,OAAOA,KAAS,WAAiBA,IACjCA,EAAK,SAAS,QAAQ,IACjBA,EAAK,MAAM,GAAG,EAAE,IACdA,MAAS,UACX,KAEFA;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugToTitle.js","sources":["../../src/common/slugToTitle.ts"],"sourcesContent":["export const slugToTitle = (slug: string) => {\n const indexOfQuestionMark = slug.indexOf('?');\n if (indexOfQuestionMark > -1) {\n slug = slug.substring(0, indexOfQuestionMark);\n }\n const slugArr = slug.split('/');\n let defaultTitle = slugArr[slugArr.length - 1]!.split('-').join(' '); //replace all dashes\n defaultTitle = defaultTitle.split('_').join(' '); //replace all underscores\n defaultTitle = defaultTitle.charAt(0).toUpperCase() + defaultTitle.slice(1); //capitalize first letter\n return defaultTitle;\n};"],"names":["slugToTitle","slug","indexOfQuestionMark","slugArr","defaultTitle"],"mappings":"AAAO,MAAMA,IAAc,CAACC,MAAiB;AAC3C,QAAMC,IAAsBD,EAAK,QAAQ,GAAG;AAC5C,EAAIC,IAAsB,OACxBD,IAAOA,EAAK,UAAU,GAAGC,CAAmB;AAE9C,QAAMC,IAAUF,EAAK,MAAM,GAAG;AAC9B,MAAIG,IAAeD,EAAQA,EAAQ,SAAS,CAAC,EAAG,MAAM,GAAG,EAAE,KAAK,GAAG;AACnE,SAAAC,IAAeA,EAAa,MAAM,GAAG,EAAE,KAAK,GAAG,GAC/CA,IAAeA,EAAa,OAAO,CAAC,EAAE,gBAAgBA,EAAa,MAAM,CAAC,GACnEA;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReferenceProvider.js","sources":["../../../src/components/Api/ApiReferenceProvider.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\n\ninterface ApiReferenceContextValue {\n apiReferenceData2?: any;\n docsConfig?: any;\n mdxExtracts?: any;\n}\n\nconst ApiReferenceContext = createContext<ApiReferenceContextValue | undefined>(undefined);\n\nexport function useApiReference() {\n const context = useContext(ApiReferenceContext);\n return context;\n}\n\ninterface ApiReferenceProvider2Props {\n apiReferenceData2?: any;\n docsConfig?: any;\n mdxExtracts?: any;\n children: React.ReactNode;\n}\n\nexport function ApiReferenceProvider2({\n apiReferenceData2,\n docsConfig,\n mdxExtracts,\n children,\n}: ApiReferenceProvider2Props) {\n return (\n <ApiReferenceContext.Provider value={{ apiReferenceData2, docsConfig, mdxExtracts }}>\n {children}\n </ApiReferenceContext.Provider>\n );\n}\n"],"names":["ApiReferenceContext","createContext","useApiReference","useContext"],"mappings":";;AAQA,MAAMA,IAAsBC,EAAoD,MAAS;AAElF,SAASC,IAAkB;AAEhC,SADgBC,EAAWH,CAAmB;AAEhD;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sources":["../../../src/components/Api/ErrorBoundary.tsx"],"sourcesContent":["\nimport React, { ReactNode } from 'react';\n\nclass ErrorBoundary extends React.Component<{ children: ReactNode }, { hasError: boolean }> {\n constructor(props: { children: ReactNode }) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n console.log({ error, errorInfo });\n }\n render() {\n if (this.state.hasError) {\n return null;\n }\n return this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"names":["ErrorBoundary","React","props","error","errorInfo"],"mappings":";AAGA,MAAMA,UAAsBC,EAAM,UAA0D;AAAA,EAC1F,YAAYC,GAAgC;AAC1C,UAAMA,CAAK,GACX,KAAK,QAAQ,EAAE,UAAU,GAAA;AAAA,EAC3B;AAAA,EACA,OAAO,2BAA2B;AAChC,WAAO,EAAE,UAAU,GAAA;AAAA,EACrB;AAAA,EACA,kBAAkBC,GAAcC,GAAkC;AAChE,YAAQ,IAAI,EAAE,OAAAD,GAAO,WAAAC,EAAA,CAAW;AAAA,EAClC;AAAA,EACA,SAAS;AACP,WAAI,KAAK,MAAM,WACN,OAEF,KAAK,MAAM;AAAA,EACpB;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Expandable.js","sources":["../../../src/components/Api/Expandable.tsx"],"sourcesContent":["\nimport { ReactNode, useContext, useEffect, useRef, useState } from \"react\";\n\nimport { EndpointLocationContext } from \"@/contexts/EndpointLocationContext\";\nimport { useSelectedLocale } from \"@/utils/locales\";\nimport { useExpandableMemory } from \"@/hooks/useExpandableMemory\";\nimport { Classes } from \"@/api-playground-2/types\";\nimport { ChevronRightFilled } from '@fluentui/react-icons';\nimport { cn } from \"@/api-playground-2/schemaGraph/utils\";\nimport { scrollElementIntoView } from \"@/utils/scrollElementIntoView\";\n\nconst EXPANDABLE_CONTENT_CLASS = \"expandable-content\";\n\nexport interface ExpandableProps {\n title?: string;\n defaultOpen?: boolean;\n onChange?: (open: boolean) => void;\n lazy?: boolean;\n children?: ReactNode;\n uniqueParamId?: string;\n}\n\nexport function Expandable({\n title,\n defaultOpen = false,\n onChange: onChangeProp,\n lazy,\n children,\n uniqueParamId,\n}: ExpandableProps) {\n const { hasScrolledToAnchorRef } = useContext(EndpointLocationContext);\n\n const locale = useSelectedLocale();\n // if uniqueParamId is provided, we use session storage to\n // track if a user manually toggled the param field expandable\n const shouldUseSessionStorage = !!uniqueParamId;\n const { isExpanded, onManualToggle } = useExpandableMemory(\n uniqueParamId || \"\",\n defaultOpen\n );\n\n // in case we ever render an expandable that is not a param field,\n // we can just use regular state to track it\n const [localOpen, setLocalOpen] = useState(defaultOpen);\n\n const open = defaultOpen || shouldUseSessionStorage ? isExpanded : localOpen;\n\n // setShouldRenderChildren should only ever be called with true - we never want to unmount stateful components\n const [shouldRenderChildren, setShouldRenderChildren] = useState(\n open || !lazy\n );\n\n const expandableRef = useRef<HTMLDetailsElement>(null);\n\n const openClosestExpandables = (element: HTMLElement) => {\n let parent = element.closest(`.${EXPANDABLE_CONTENT_CLASS}`);\n while (parent) {\n const button = parent.previousElementSibling as HTMLButtonElement;\n if (button.getAttribute(\"aria-expanded\") === \"false\") {\n button.click();\n }\n parent =\n parent.parentElement?.closest(`.${EXPANDABLE_CONTENT_CLASS}`) ?? null;\n }\n };\n\n useEffect(() => {\n const checkHashAndExpand = () => {\n scrollElementIntoView({\n shouldReturnEarly: !!hasScrolledToAnchorRef?.current,\n checkIfShouldScroll(targetEl) {\n return (\n !!expandableRef.current && expandableRef.current.contains(targetEl)\n );\n },\n preScrollCallback(targetEl) {\n if (shouldUseSessionStorage) {\n onManualToggle(true);\n } else {\n setLocalOpen(true);\n }\n openClosestExpandables(targetEl);\n },\n postScrollCallback() {\n if (hasScrolledToAnchorRef) hasScrolledToAnchorRef.current = true;\n },\n });\n };\n\n checkHashAndExpand();\n window.addEventListener(\"hashchange\", checkHashAndExpand);\n return () => {\n window.removeEventListener(\"hashchange\", checkHashAndExpand);\n };\n }, [shouldUseSessionStorage, onManualToggle, hasScrolledToAnchorRef]);\n\n const onChange = (open: boolean) => {\n setShouldRenderChildren(true);\n\n if (onChangeProp) {\n onChangeProp(open);\n }\n };\n\n const setOpenState = (newOpenState: boolean) => {\n if (shouldUseSessionStorage) {\n onManualToggle(newOpenState);\n } else {\n setLocalOpen(newOpenState);\n }\n\n onChange(newOpenState);\n };\n\n return (\n <details\n key={title}\n ref={expandableRef}\n open={open}\n onToggle={(e) => {\n const newState = e.currentTarget.open;\n if (newState !== open) {\n setOpenState(newState);\n }\n }}\n className={cn(Classes.Expandable, \"mint:mt-4 mint:mb-4 mint:border-standard mint:rounded-xl\")}\n data-testid={uniqueParamId + \"-children\"}\n >\n <summary\n className={cn(\n \"not-prose mint:text-sm mint:flex mint:flex-row mint:items-center mint:content-center mint:w-full mint:cursor-pointer\",\n \"mint:text-gray-600 mint:hover:text-gray-900 mint:dark:text-gray-300 mint:dark:hover:text-gray-200 mint:py-3 mint:px-3.5 mint:hover:bg-gray-50/50 mint:dark:hover:bg-white/5 mint:rounded-t-xl\",\n \"mint:list-none mint:[&::-webkit-details-marker]:hidden\",\n !open && \"mint:rounded-b-xl\"\n )}\n aria-controls=\"Children attributes\"\n aria-expanded={open}\n data-component-part=\"expandable-button\"\n >\n <ChevronRightFilled\n className={cn(\n \"mint:h-2.5 mint:w-2.5 mint:text-gray-500 mint:dark:text-gray-400 mint:shrink-0 mint:transition-transform\",\n open && \"mint:rotate-180\"\n )}\n />\n <div className=\"mint:ml-3 mint:leading-tight mint:text-left\">\n <p className=\"mint:m-0\" contentEditable={false}>\n {open ? locale[\"hide\"] : locale[\"show\"]}{\" \"}\n {title || locale[\"childAttributes\"]}\n </p>\n </div>\n </summary>\n <div\n id={title + \"Children\"}\n className={cn(\n EXPANDABLE_CONTENT_CLASS,\n \"mint:mx-3 mint:px-2 mint:border-t mint:border-gray-100 mint:dark:border-white/10\"\n )}\n data-component-part={EXPANDABLE_CONTENT_CLASS}\n >\n {shouldRenderChildren && children}\n </div>\n </details>\n );\n}\n"],"names":["EXPANDABLE_CONTENT_CLASS","Expandable","title","defaultOpen","onChangeProp","lazy","children","uniqueParamId","hasScrolledToAnchorRef","useContext","EndpointLocationContext","locale","useSelectedLocale","shouldUseSessionStorage","isExpanded","onManualToggle","useExpandableMemory","localOpen","setLocalOpen","useState","open","shouldRenderChildren","setShouldRenderChildren","expandableRef","useRef","openClosestExpandables","element","parent","button","_a","useEffect","checkHashAndExpand","scrollElementIntoView","targetEl","onChange","setOpenState","newOpenState","jsxs","e","newState","cn","Classes","jsx","ChevronRightFilled"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAA2B;AAW1B,SAASC,EAAW;AAAA,EACzB,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC;AAAA,EACV,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AACF,GAAoB;AAClB,QAAM,EAAE,wBAAAC,EAAA,IAA2BC,EAAWC,CAAuB,GAE/DC,IAASC,EAAA,GAGTC,IAA0B,CAAC,CAACN,GAC5B,EAAE,YAAAO,GAAY,gBAAAC,EAAA,IAAmBC;AAAA,IACrCT,KAAiB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CKJ;AAAA,EAAA;AAgDX;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","sources":["../../../src/components/Api/Markdown.tsx"],"sourcesContent":["import ReactMarkdown, { Components } from 'react-markdown';\nimport rehypeKatex from 'rehype-katex';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\n\nimport { cn } from '../../utils/cn';\nimport { CodeBlock } from '../content-components/code-block';\nimport { getNodeText } from '../content-components/getNodeText';\n\nconst commonRemarkPlugins = [remarkGfm, remarkMath];\nconst commonRehypePlugins = [rehypeKatex];\n\nexport function Markdown({\n children,\n className,\n components,\n showCopyButton = false,\n}: {\n children: string;\n className?: string;\n components?: Partial<Components> | null | undefined;\n showCopyButton?: boolean;\n}) {\n return (\n <div className={className}>\n <ReactMarkdown\n remarkPlugins={commonRemarkPlugins}\n rehypePlugins={commonRehypePlugins}\n components={{\n p: ({ children }) => <p className=\"mint:break-words\">{children}</p>,\n pre: ({ children, ...props }) => {\n if (\n typeof children === 'object' &&\n children !== null &&\n 'props' in children &&\n typeof children.props === 'object' &&\n children.props !== null &&\n 'className' in children.props &&\n children.props.className === 'language-suggestions'\n ) {\n return children;\n }\n\n const codeString = getNodeText(children);\n\n return (\n <div className=\"mint:relative\">\n <pre {...props} className={props.className}>\n {children}\n </pre>\n {showCopyButton && (\n <div className=\"mint:absolute mint:top-2 mint:right-2\">\n <CodeBlock children={codeString} />\n </div>\n )}\n </div>\n );\n },\n ...components,\n }}\n >\n {children}\n </ReactMarkdown>\n </div>\n );\n}\n\nexport const MarkdownWithoutHeaders = ({\n children,\n className,\n}: {\n children: string;\n className?: string;\n}) => {\n const headingClass = 'mint:text-base mint:font-medium';\n return (\n <Markdown\n components={{\n h1: ({ children }) => <h1 className={headingClass}>{children}</h1>,\n h2: ({ children }) => <h2 className={headingClass}>{children}</h2>,\n h3: ({ children }) => <h3 className={headingClass}>{children}</h3>,\n h4: ({ children }) => <h4 className={headingClass}>{children}</h4>,\n h5: ({ children }) => <h5 className={headingClass}>{children}</h5>,\n h6: ({ children }) => <h6 className={headingClass}>{children}</h6>,\n }}\n className={className}\n >\n {children}\n </Markdown>\n );\n};\n"],"names":["commonRemarkPlugins","remarkGfm","remarkMath","commonRehypePlugins","rehypeKatex","Markdown","children","className","components","showCopyButton","jsx","ReactMarkdown","props","codeString","getNodeText","jsxs","CodeBlock","MarkdownWithoutHeaders","headingClass"],"mappings":";;;;;;;AASA,MAAMA,IAAsB,CAACC,GAAWC,CAAU,GAC5CC,IAAsB,CAACC,CAAW;AAEjC,SAASC,EAAS;AAAA,EACvB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC,IAAiB;AACnB,GAKG;AACD,SACE,gBAAAC,EAAC,SAAI,WAAAH,GACH,UAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAeX;AAAA,MACf,eAAeG;AAAA,MACf,YAAY;AAAA,QACV,GAAG,CAAC,EAAE,UAAAG,EAAAA,MAAe,gBAAAI,EAAC,KAAA,EAAE,WAAU,oBAAoB,UAAAJ,EAAAA,CAAS;AAAA,QAC/D,KAAK,CAAC,EAAE,UAAAA,GAAU,GAAGM,QAAY;AAC/B,cACE,OAAON,KAAa,YACpBA,MAAa,QACb,WAAWA,KACX,OAAOA,EAAS,SAAU,YAC1BA,EAAS,UAAU,QACnB,eAAeA,EAAS,SACxBA,EAAS,MAAM,cAAc;AAE7B,mBAAOA;AAGT,gBAAMO,IAAaC,EAAYR,CAAQ;AAEvC,iBACE,gBAAAS,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,YAAA,gBAAAL,EAAC,SAAK,GAAGE,GAAO,WAAWA,EAAM,WAC9B,UAAAN,GACH;AAAA,YACCG,uBACE,OAAA,EAAI,WAAU,yCACb,UAAA,gBAAAC,EAACM,GAAA,EAAU,UAAUH,EAAA,CAAY,EAAA,CACnC;AAAA,UAAA,GAEJ;AAAA,QAEJ;AAAA,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