@mintlify/msft-sdk 1.1.23 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-playground/ApiPlayground/Request/BodySection.js +65 -0
- package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +33 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +201 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +147 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +31 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/index.js +44 -0
- package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +94 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +91 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +63 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +34 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +110 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +88 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +55 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +68 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +45 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +7 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +45 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +54 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +15 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js +14 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +12 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +20 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +21 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +93 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/index.js +80 -0
- package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +24 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +45 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js +18 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +40 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +44 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +45 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +39 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +129 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +60 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js +16 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +29 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +20 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +163 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +59 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js +50 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js +40 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +27 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +53 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground/ApiPlayground/index.js +68 -0
- package/dist/api-playground/ApiPlayground/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +51 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +20 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +19 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +29 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +6 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +13 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/Description.js +13 -0
- package/dist/api-playground/EndpointFields/components/Description.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +20 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +36 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +44 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -0
- package/dist/api-playground/EndpointFields/index.js +7 -0
- package/dist/api-playground/EndpointFields/index.js.map +1 -0
- package/dist/api-playground-2/Api.js +13 -0
- package/dist/api-playground-2/Api.js.map +1 -0
- package/dist/api-playground-2/ApiExamples.js +19 -18
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/ApiFields.js +253 -0
- package/dist/api-playground-2/ApiFields.js.map +1 -0
- package/dist/api-playground-2/EndpointHeader.js +52 -0
- package/dist/api-playground-2/EndpointHeader.js.map +1 -0
- package/dist/api-playground-2/OperationPage.js +101 -0
- package/dist/api-playground-2/OperationPage.js.map +1 -0
- package/dist/api-playground-2/Playground.js +136 -0
- package/dist/api-playground-2/Playground.js.map +1 -0
- package/dist/api-playground-2/SchemaPage.js +14 -0
- package/dist/api-playground-2/SchemaPage.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +16 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +21 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +57 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +122 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +75 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +253 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +28 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +101 -114
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Request/BodySection.js +41 -0
- package/dist/api-playground-2/components/Request/BodySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js +66 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js +36 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js +55 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/ServerSection.js +33 -0
- package/dist/api-playground-2/components/Request/ServerSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +55 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +48 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +43 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +127 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js +15 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +46 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +104 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +77 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +54 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +44 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +29 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground-2/components/TypeDropdown.js +48 -0
- package/dist/api-playground-2/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground-2/constants/index.js +6 -4
- package/dist/api-playground-2/constants/index.js.map +1 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +11 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -0
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +6 -6
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippet.js +187 -36
- package/dist/api-playground-2/generators/generateSnippet.js.map +1 -1
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +14 -0
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js +101 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +156 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +57 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/processExamples.js +41 -8
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +107 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/utils.js +195 -43
- package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
- package/dist/api-playground-2/types/index.js +118 -0
- package/dist/api-playground-2/types/index.js.map +1 -0
- package/dist/common/guards.js +32 -6
- package/dist/common/guards.js.map +1 -1
- package/dist/common/potentiallyParseOpenApiString.js +25 -0
- package/dist/common/potentiallyParseOpenApiString.js.map +1 -0
- package/dist/common/replaceSlashIndex.js +7 -0
- package/dist/common/replaceSlashIndex.js.map +1 -0
- package/dist/common/slugToTitle.js +11 -0
- package/dist/common/slugToTitle.js.map +1 -0
- package/dist/components/Api/Expandable.js +119 -0
- package/dist/components/Api/Expandable.js.map +1 -0
- package/dist/components/Api/Markdown.js +66 -0
- package/dist/components/Api/Markdown.js.map +1 -0
- package/dist/components/Api/Param.js +191 -0
- package/dist/components/Api/Param.js.map +1 -0
- package/dist/components/content-components/code-block.js +68 -61
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/code-group.js +36 -25
- package/dist/components/content-components/code-group.js.map +1 -1
- package/dist/components/content-components/getNodeText.js +5 -0
- package/dist/components/content-components/getNodeText.js.map +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/zIndex.js +7 -0
- package/dist/constants/zIndex.js.map +1 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js +18 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js.map +1 -0
- package/dist/contexts/ConfigContext.js +2 -3
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/contexts/EndpointLocationContext.js +18 -0
- package/dist/contexts/EndpointLocationContext.js.map +1 -0
- package/dist/contexts/MDXContentContext.js +19 -0
- package/dist/contexts/MDXContentContext.js.map +1 -0
- package/dist/env.js +6 -1
- package/dist/env.js.map +1 -1
- package/dist/hooks/useApiPlaygroundInputs.js +7 -0
- package/dist/hooks/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +40 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +1 -0
- package/dist/hooks/useBaseUrlOptions.js +19 -0
- package/dist/hooks/useBaseUrlOptions.js.map +1 -0
- package/dist/hooks/useCheckHash.js +18 -0
- package/dist/hooks/useCheckHash.js.map +1 -0
- package/dist/hooks/useComponentSchemas.js +10 -0
- package/dist/hooks/useComponentSchemas.js.map +1 -0
- package/dist/hooks/useCurrentPath.js +17 -0
- package/dist/hooks/useCurrentPath.js.map +1 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useExpandableMemory.js +46 -0
- package/dist/hooks/useExpandableMemory.js.map +1 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js +12 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js.map +1 -0
- package/dist/hooks/useGenerateNextItems.js +12 -0
- package/dist/hooks/useGenerateNextItems.js.map +1 -0
- package/dist/hooks/useGenerateNextProperties.js +12 -0
- package/dist/hooks/useGenerateNextProperties.js.map +1 -0
- package/dist/hooks/useKeyboardShortcut.js +26 -0
- package/dist/hooks/useKeyboardShortcut.js.map +1 -0
- package/dist/hooks/useMDXContent.js +7 -0
- package/dist/hooks/useMDXContent.js.map +1 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +10 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js +43 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/index.js +66 -0
- package/dist/hooks/usePrefilledInputs/index.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +30 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -0
- package/dist/hooks/useSecurityOption.js +11 -0
- package/dist/hooks/useSecurityOption.js.map +1 -0
- package/dist/hooks/useSendPlaygroundRequest.js +146 -15
- package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
- package/dist/hooks/useSetDefaultValue.js +64 -0
- package/dist/hooks/useSetDefaultValue.js.map +1 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +143 -108
- package/dist/index.js.map +1 -1
- package/dist/openapi/filterEnums.js +21 -0
- package/dist/openapi/filterEnums.js.map +1 -0
- package/dist/openapi/generateNextAdditionalProperties.js +8 -0
- package/dist/openapi/generateNextAdditionalProperties.js.map +1 -0
- package/dist/openapi/generateNextItems.js +8 -0
- package/dist/openapi/generateNextItems.js.map +1 -0
- package/dist/openapi/generateNextProperties.js +24 -0
- package/dist/openapi/generateNextProperties.js.map +1 -0
- package/dist/openapi/generateOptionLabels.js +21 -0
- package/dist/openapi/generateOptionLabels.js.map +1 -0
- package/dist/openapi/generateSimpleLabels.js +5 -0
- package/dist/openapi/generateSimpleLabels.js.map +1 -0
- package/dist/openapi/generateTypeStringFromSchema.js +34 -0
- package/dist/openapi/generateTypeStringFromSchema.js.map +1 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js +19 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js.map +1 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js +22 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js +7 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js +7 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js.map +1 -0
- package/dist/utils/api-playground/defaults.js +16 -0
- package/dist/utils/api-playground/defaults.js.map +1 -0
- package/dist/utils/api-playground/paramFieldDefaults.js +11 -0
- package/dist/utils/api-playground/paramFieldDefaults.js.map +1 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +5 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +1 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js +6 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js.map +1 -0
- package/dist/utils/containsMarkdownTable.js +5 -0
- package/dist/utils/containsMarkdownTable.js.map +1 -0
- package/dist/utils/copyToClipboard.js +12 -0
- package/dist/utils/copyToClipboard.js.map +1 -0
- package/dist/utils/decodeSlug.js +8 -0
- package/dist/utils/decodeSlug.js.map +1 -0
- package/dist/utils/flattenObject.js +11 -0
- package/dist/utils/flattenObject.js.map +1 -0
- package/dist/utils/formatJSON.js +39 -0
- package/dist/utils/formatJSON.js.map +1 -0
- package/dist/utils/optionallyAddLeadingSlash.js +7 -0
- package/dist/utils/optionallyAddLeadingSlash.js.map +1 -0
- package/dist/utils/scrollElementIntoView.js +21 -0
- package/dist/utils/scrollElementIntoView.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { SimpleSchemaField as a } from "./components/EndpointFields/fields/SimpleSchemaField.js";
|
|
3
|
+
const c = ({
|
|
4
|
+
apiReferenceData: t,
|
|
5
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
6
|
+
children: i
|
|
7
|
+
}) => {
|
|
8
|
+
const e = t.schemaData;
|
|
9
|
+
return e ? /* @__PURE__ */ m("div", { className: "mint:flex mint:flex-col mint:gap-8", children: /* @__PURE__ */ m(a, { schema: e, fieldType: "schema", displayFlattened: !0 }) }) : null;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
c as SchemaPage
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=SchemaPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaPage.js","sources":["../../src/api-playground-2/SchemaPage.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\nimport { SimpleSchemaField } from './components/EndpointFields/fields/SimpleSchemaField';\nimport { ApiReferenceDataV2 } from './types';\nimport { cn } from \"../utils/cn\";\n\nexport const SchemaPage = ({\n apiReferenceData,\n // eslint-disable-next-line unused-imports/no-unused-vars\n children,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n children: ReactNode;\n}) => {\n const schema = apiReferenceData.schemaData;\n // const { pageMetadata } = useContext(PageContext);\n // const { isCustom, isFrame } = getPageMode(pageMetadata);\n if (!schema) {\n return null;\n }\n\n return (\n <div className=\"mint:flex mint:flex-col mint:gap-8\">\n {/* TODO - Api Playground Refactor: make <Api> and <Content> mutually exclusive */}\n {/* {children ? <div className={clsx(\n Classes.Content,\n 'mint:relative',\n !isCustom && !isFrame && 'mint:mt-8 mint:mb-14 mint:prose mint:prose-gray dark:prose-invert'\n )}>{children}</div> : <ApiFields pageMetadata={pageMetadata} />} */}\n <SimpleSchemaField schema={schema} fieldType=\"schema\" displayFlattened={true} />\n </div>\n );\n};\n"],"names":["SchemaPage","apiReferenceData","children","schema","jsx","SimpleSchemaField"],"mappings":";;AAMO,MAAMA,IAAa,CAAC;AAAA,EACzB,kBAAAC;AAAA;AAAA,EAEA,UAAAC;AACF,MAGM;AACJ,QAAMC,IAASF,EAAiB;AAGhC,SAAKE,IAKH,gBAAAC,EAAC,OAAA,EAAI,WAAU,sCAOb,UAAA,gBAAAA,EAACC,GAAA,EAAkB,QAAAF,GAAgB,WAAU,UAAS,kBAAkB,GAAA,CAAM,GAChF,IAZO;AAcX;"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import { SectionHeading as f } from "../../../api-playground/EndpointFields/components/SectionHeading.js";
|
|
4
|
+
import { Classes as y } from "../../types/index.js";
|
|
5
|
+
import { cn as z } from "../../../utils/cn.js";
|
|
6
|
+
import { PrimitiveParamField as o } from "./fields/PrimitiveParamField.js";
|
|
7
|
+
const T = ({
|
|
8
|
+
apiReferenceData: m
|
|
9
|
+
}) => {
|
|
10
|
+
var c;
|
|
11
|
+
const [a, l] = d(0), s = (c = m.dependencies) == null ? void 0 : c.processedSecurityOptions;
|
|
12
|
+
if (!s) return null;
|
|
13
|
+
const p = s[a];
|
|
14
|
+
if (!p) return null;
|
|
15
|
+
const { scheme: e, schema: t } = p, i = [];
|
|
16
|
+
if (e.type === "apiKey" && "name" in e && "in" in e)
|
|
17
|
+
i.push(
|
|
18
|
+
/* @__PURE__ */ n(
|
|
19
|
+
o,
|
|
20
|
+
{
|
|
21
|
+
fieldType: "authorization",
|
|
22
|
+
schema: t,
|
|
23
|
+
typeOptions: ["string"],
|
|
24
|
+
name: e.name
|
|
25
|
+
},
|
|
26
|
+
`${e.in}:${e.name}`
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
else if (e.type === "http" && "scheme" in e)
|
|
30
|
+
if (e.scheme === "basic") {
|
|
31
|
+
const r = { ...t, type: "string" };
|
|
32
|
+
i.push(
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
o,
|
|
35
|
+
{
|
|
36
|
+
fieldType: "authorization",
|
|
37
|
+
schema: r,
|
|
38
|
+
typeOptions: ["string"],
|
|
39
|
+
name: t.title ?? "Authorization"
|
|
40
|
+
},
|
|
41
|
+
`header:${t.title}`
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
} else e.scheme === "bearer" && i.push(
|
|
45
|
+
/* @__PURE__ */ n(
|
|
46
|
+
o,
|
|
47
|
+
{
|
|
48
|
+
fieldType: "authorization",
|
|
49
|
+
schema: t,
|
|
50
|
+
typeOptions: ["string"],
|
|
51
|
+
name: t.title ?? "Authorization"
|
|
52
|
+
},
|
|
53
|
+
`header:${t.title}`
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
else e.type === "oauth2" && i.push(
|
|
57
|
+
/* @__PURE__ */ n(
|
|
58
|
+
o,
|
|
59
|
+
{
|
|
60
|
+
fieldType: "authorization",
|
|
61
|
+
schema: t,
|
|
62
|
+
typeOptions: ["string"],
|
|
63
|
+
name: t.title ?? "Authorization"
|
|
64
|
+
},
|
|
65
|
+
`header:${t.title}`
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
if (i.length === 0) return null;
|
|
69
|
+
const h = s.map(
|
|
70
|
+
(r) => r.schema.title ?? "Authorization"
|
|
71
|
+
);
|
|
72
|
+
return /* @__PURE__ */ u("div", { className: z(y.APISection), children: [
|
|
73
|
+
/* @__PURE__ */ n(
|
|
74
|
+
f,
|
|
75
|
+
{
|
|
76
|
+
title: "Authorizations",
|
|
77
|
+
options: h,
|
|
78
|
+
selectedIndex: a,
|
|
79
|
+
onSelectOption: l
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
i
|
|
83
|
+
] });
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
T as EndpointSecurity
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=EndpointSecurity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointSecurity.js","sources":["../../../../src/api-playground-2/components/EndpointFields/EndpointSecurity.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport type { ApiReferenceDataV2, ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { SectionHeading } from '@/api-playground/EndpointFields/components/SectionHeading';\nimport { Classes } from '@/api-playground-2/types';\nimport { cn } from '@/utils/cn';\n\nimport { PrimitiveParamField } from './fields/PrimitiveParamField';\n\nexport const EndpointSecurity = ({\n apiReferenceData,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n}) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const securityOptions = apiReferenceData.dependencies?.processedSecurityOptions;\n if (!securityOptions) return null;\n\n const selectedSecurity = securityOptions[selectedIndex];\n if (!selectedSecurity) return null;\n const { scheme, schema } = selectedSecurity;\n const parameters: React.ReactNode[] = [];\n\n if (scheme.type === 'apiKey' && 'name' in scheme && 'in' in scheme) {\n parameters.push(\n <PrimitiveParamField\n key={`${scheme.in}:${scheme.name}`}\n fieldType=\"authorization\"\n schema={schema}\n typeOptions={['string']}\n name={scheme.name}\n />\n );\n } else if (scheme.type === 'http' && 'scheme' in scheme) {\n if (scheme.scheme === 'basic') {\n // we don't show the actual object schema here, because technically what is sent is the\n // base64 encoded string of the username and password\n // but we need the correct (object) schema to show in the playground\n // since we take username and password and base64 encode it for you\n \n const fakeBasicHttpSchema = { ...schema, type: 'string' } as ResolvedSchemaObject;\n parameters.push(\n <PrimitiveParamField\n key={`header:${schema.title}`}\n fieldType=\"authorization\"\n schema={fakeBasicHttpSchema}\n typeOptions={['string']}\n name={schema.title ?? 'Authorization'}\n />\n );\n } else if (scheme.scheme === 'bearer') {\n parameters.push(\n <PrimitiveParamField\n key={`header:${schema.title}`}\n fieldType=\"authorization\"\n schema={schema}\n typeOptions={['string']}\n name={schema.title ?? 'Authorization'}\n />\n );\n }\n } else if (scheme.type === 'oauth2') {\n parameters.push(\n <PrimitiveParamField\n key={`header:${schema.title}`}\n fieldType=\"authorization\"\n schema={schema}\n typeOptions={['string']}\n name={schema.title ?? 'Authorization'}\n />\n );\n }\n\n if (parameters.length === 0) return null;\n const dropdownOptions = securityOptions.map(\n (security) => security.schema.title ?? 'Authorization'\n );\n\n return (\n <div className={cn(Classes.APISection)}>\n <SectionHeading\n title=\"Authorizations\"\n options={dropdownOptions}\n selectedIndex={selectedIndex}\n onSelectOption={setSelectedIndex}\n />\n {parameters}\n </div>\n );\n};\n"],"names":["EndpointSecurity","apiReferenceData","selectedIndex","setSelectedIndex","useState","securityOptions","_a","selectedSecurity","scheme","schema","parameters","jsx","PrimitiveParamField","fakeBasicHttpSchema","dropdownOptions","security","cn","Classes","SectionHeading"],"mappings":";;;;;;AAWO,MAAMA,IAAmB,CAAC;AAAA,EAC/B,kBAAAC;AACF,MAEM;;AACJ,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,CAAC,GAC9CC,KAAkBC,IAAAL,EAAiB,iBAAjB,gBAAAK,EAA+B;AACvD,MAAI,CAACD,EAAiB,QAAO;AAE7B,QAAME,IAAmBF,EAAgBH,CAAa;AACtD,MAAI,CAACK,EAAkB,QAAO;AAC9B,QAAM,EAAE,QAAAC,GAAQ,QAAAC,EAAA,IAAWF,GACrBG,IAAgC,CAAA;AAEtC,MAAIF,EAAO,SAAS,YAAY,UAAUA,KAAU,QAAQA;AAC1D,IAAAE,EAAW;AAAA,MACT,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,QAAAH;AAAA,UACA,aAAa,CAAC,QAAQ;AAAA,UACtB,MAAMD,EAAO;AAAA,QAAA;AAAA,QAJR,GAAGA,EAAO,EAAE,IAAIA,EAAO,IAAI;AAAA,MAAA;AAAA,IAKlC;AAAA,WAEOA,EAAO,SAAS,UAAU,YAAYA;AAC/C,QAAIA,EAAO,WAAW,SAAS;AAM7B,YAAMK,IAAsB,EAAE,GAAGJ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({ schema: s }) => {
|
|
3
|
+
const n = s.enum;
|
|
4
|
+
return !n || n.length === 0 ? null : /* @__PURE__ */ t("div", { className: "mint:whitespace-pre-wrap mint:prose-sm mint:mt-6", children: [
|
|
5
|
+
"Available options:",
|
|
6
|
+
n.map((e, i) => /* @__PURE__ */ t("div", { className: "mint:inline-block", children: [
|
|
7
|
+
/* @__PURE__ */ l("code", { children: e }),
|
|
8
|
+
i !== n.length - 1 && ",",
|
|
9
|
+
" "
|
|
10
|
+
] }, `${e}-${i}`))
|
|
11
|
+
] });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
r as EnumOptions
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enum.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/Enum.tsx"],"sourcesContent":["import type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const EnumOptions = ({ schema }: { schema: ResolvedSchemaObject }) => {\n const enumValues = schema.enum;\n if (!enumValues || enumValues.length === 0) {\n return null;\n }\n\n return (\n <div className=\"mint:whitespace-pre-wrap mint:prose-sm mint:mt-6\">\n Available options:\n {enumValues.map((enumValue: string | number, i: number) => (\n <div key={`${enumValue}-${i}`} className=\"mint:inline-block\">\n <code>{enumValue}</code>\n {i !== enumValues.length - 1 && ','}{' '}\n </div>\n ))}\n </div>\n );\n};\n"],"names":["EnumOptions","schema","enumValues","jsxs","enumValue","jsx"],"mappings":";AAGO,MAAMA,IAAc,CAAC,EAAE,QAAAC,QAA+C;AAC3E,QAAMC,IAAaD,EAAO;AAC1B,SAAI,CAACC,KAAcA,EAAW,WAAW,IAChC,OAIP,gBAAAC,EAAC,OAAA,EAAI,WAAU,oDAAmD,UAAA;AAAA,IAAA;AAAA,IAE/DD,EAAW,IAAI,CAACE,GAA4B,MAC3C,gBAAAD,EAAC,OAAA,EAA8B,WAAU,qBACvC,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAM,UAAAD,EAAA,CAAU;AAAA,MAChB,MAAMF,EAAW,SAAS,KAAK;AAAA,MAAK;AAAA,IAAA,EAAA,GAF7B,GAAGE,CAAS,IAAI,CAAC,EAG3B,CACD;AAAA,EAAA,GACH;AAEJ;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as e, Fragment as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useSelectedLocale as o } from "../../../../utils/locales/index.js";
|
|
3
|
+
const v = ({ schema: i }) => {
|
|
4
|
+
const u = i.exclusiveMinimum || i.exclusiveMinimum !== void 0, n = i.exclusiveMaximum || i.exclusiveMaximum !== void 0, t = o();
|
|
5
|
+
let m = "";
|
|
6
|
+
return i.maximum !== void 0 && (m = `x ${n ? "<" : "<="} ${i.maximum}`), i.minimum !== void 0 && (m = `x ${u ? ">" : ">="} ${i.minimum}`), i.maximum !== void 0 && i.minimum !== void 0 && (m = `${i.minimum} ${u ? "<" : "<="} x ${n ? "<" : "<="} ${i.maximum}`), m === "" && i.multipleOf === void 0 ? null : /* @__PURE__ */ e("div", { className: "mint:prose mint:prose-sm mint:prose-gray mint:dark:prose-invert mint:mt-6", children: [
|
|
7
|
+
m && /* @__PURE__ */ e(l, { children: [
|
|
8
|
+
t.requiredRange,
|
|
9
|
+
": ",
|
|
10
|
+
/* @__PURE__ */ r("code", { children: m })
|
|
11
|
+
] }),
|
|
12
|
+
i.multipleOf && /* @__PURE__ */ e(l, { children: [
|
|
13
|
+
"Must be a multiple of ",
|
|
14
|
+
/* @__PURE__ */ r("code", { children: i.multipleOf })
|
|
15
|
+
] })
|
|
16
|
+
] });
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
v as NumberMetadata
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=NumberMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberMetadata.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/NumberMetadata.tsx"],"sourcesContent":["'use client';\n\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { useSelectedLocale } from '@/utils/locales';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const NumberMetadata = ({ schema }: { schema: ResolvedSchemaObject }) => {\n const exclusiveMinimum = schema.exclusiveMinimum || schema.exclusiveMinimum !== undefined;\n const exclusiveMaximum = schema.exclusiveMaximum || schema.exclusiveMaximum !== undefined;\n const locale = useSelectedLocale();\n let range = '';\n if (schema.maximum !== undefined) {\n range = `x ${exclusiveMaximum ? '<' : '<='} ${schema.maximum}`;\n }\n if (schema.minimum !== undefined) {\n range = `x ${exclusiveMinimum ? '>' : '>='} ${schema.minimum}`;\n }\n if (schema.maximum !== undefined && schema.minimum !== undefined) {\n range = `${schema.minimum} ${exclusiveMinimum ? '<' : '<='} x ${exclusiveMaximum ? '<' : '<='} ${schema.maximum}`;\n }\n if (range === '' && schema.multipleOf === undefined) {\n return null;\n }\n return (\n <div className=\"mint:prose mint:prose-sm mint:prose-gray mint:dark:prose-invert mint:mt-6\">\n {range && (\n <>\n {locale['requiredRange']}: <code>{range}</code>\n </>\n )}\n {schema.multipleOf && (\n <>\n Must be a multiple of <code>{schema.multipleOf}</code>\n </>\n )}\n </div>\n );\n};\n"],"names":["NumberMetadata","schema","exclusiveMinimum","exclusiveMaximum","locale","useSelectedLocale","range","jsxs","Fragment","jsx"],"mappings":";;AAMO,MAAMA,IAAiB,CAAC,EAAE,QAAAC,QAA+C;AAC9E,QAAMC,IAAmBD,EAAO,oBAAoBA,EAAO,qBAAqB,QAC1EE,IAAmBF,EAAO,oBAAoBA,EAAO,qBAAqB,QAC1EG,IAASC,EAAA;AACf,MAAIC,IAAQ;AAUZ,SATIL,EAAO,YAAY,WACrBK,IAAQ,KAAKH,IAAmB,MAAM,IAAI,IAAIF,EAAO,OAAO,KAE1DA,EAAO,YAAY,WACrBK,IAAQ,KAAKJ,IAAmB,MAAM,IAAI,IAAID,EAAO,OAAO,KAE1DA,EAAO,YAAY,UAAaA,EAAO,YAAY,WACrDK,IAAQ,GAAGL,EAAO,OAAO,IAAIC,IAAmB,MAAM,IAAI,MAAMC,IAAmB,MAAM,IAAI,IAAIF,EAAO,OAAO,KAE7GK,MAAU,MAAML,EAAO,eAAe,SACjC,OAGP,gBAAAM,EAAC,OAAA,EAAI,WAAU,6EACZ,UAAA;AAAA,IAAAD,KACC,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,MAAAJ,EAAO;AAAA,MAAiB;AAAA,MAAE,gBAAAK,EAAC,UAAM,UAAAH,EAAA,CAAM;AAAA,IAAA,GAC1C;AAAA,IAEDL,EAAO,cACN,gBAAAM,EAAAC,GAAA,EAAE,UAAA;AAAA,MAAA;AAAA,MACsB,gBAAAC,EAAC,QAAA,EAAM,UAAAR,EAAO,WAAA,CAAW;AAAA,IAAA,EAAA,CACjD;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as i, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { isEnum as d, isStringSchema as b, isNumberSchema as v } from "../../../schemaGraph/utils.js";
|
|
3
|
+
import { ParamFieldWrapper as x } from "../../../../api-playground/ApiPlayground/components/ParamFieldWrapper.js";
|
|
4
|
+
import { ExampleDescription as P } from "../../../../api-playground/EndpointFields/ParamFields/ExampleDescription.js";
|
|
5
|
+
import { Description as S } from "../../../../api-playground/EndpointFields/components/Description.js";
|
|
6
|
+
import { ParamHead as E } from "../../../../components/Api/Param.js";
|
|
7
|
+
import { EnumOptions as g } from "./Enum.js";
|
|
8
|
+
import { NumberMetadata as j } from "./NumberMetadata.js";
|
|
9
|
+
import { StringMetadata as q } from "./StringMetadata.js";
|
|
10
|
+
import { cn as y } from "../../../../utils/cn.js";
|
|
11
|
+
const V = ({
|
|
12
|
+
fieldType: n,
|
|
13
|
+
schema: r,
|
|
14
|
+
name: a,
|
|
15
|
+
location: l,
|
|
16
|
+
typeOptions: m,
|
|
17
|
+
selectedIndex: e,
|
|
18
|
+
onSelectTypeOption: f,
|
|
19
|
+
parentName: u,
|
|
20
|
+
paramId: o,
|
|
21
|
+
style: s,
|
|
22
|
+
explode: c
|
|
23
|
+
}) => {
|
|
24
|
+
const N = m[e ?? 0], t = r.description;
|
|
25
|
+
return /* @__PURE__ */ i(x, { paramId: o, className: "mint:primitive-param-field", children: /* @__PURE__ */ p("div", { className: "mint:py-2", children: [
|
|
26
|
+
/* @__PURE__ */ i(
|
|
27
|
+
E,
|
|
28
|
+
{
|
|
29
|
+
id: o,
|
|
30
|
+
name: a,
|
|
31
|
+
typeLabel: N,
|
|
32
|
+
location: l,
|
|
33
|
+
fieldType: n,
|
|
34
|
+
required: r.isRequired,
|
|
35
|
+
deprecated: r.deprecated,
|
|
36
|
+
defaultValue: r.default,
|
|
37
|
+
typeOptions: m,
|
|
38
|
+
selectedTypeOptionIndex: e,
|
|
39
|
+
onSelectTypeOption: f,
|
|
40
|
+
parentName: u,
|
|
41
|
+
style: s,
|
|
42
|
+
explode: c
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ p("div", { className: y({ "mint:mt-4 mint:mb-4": t || d(r) }), children: [
|
|
46
|
+
t && /* @__PURE__ */ i(S, { markdown: t }),
|
|
47
|
+
d(r) && /* @__PURE__ */ i(g, { schema: r }),
|
|
48
|
+
b(r) && /* @__PURE__ */ i(q, { schema: r, description: t }),
|
|
49
|
+
v(r) && /* @__PURE__ */ i(j, { schema: r }),
|
|
50
|
+
/* @__PURE__ */ i(P, { schema: r })
|
|
51
|
+
] })
|
|
52
|
+
] }) });
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
V as PrimitiveParamField
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=PrimitiveParamField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimitiveParamField.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.tsx"],"sourcesContent":["'use client';\n\nimport { cn, isEnum, isStringSchema, isNumberSchema } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { ParamFieldWrapper } from '@/api-playground/ApiPlayground/components/ParamFieldWrapper';\nimport { ExampleDescription } from '@/api-playground/EndpointFields/ParamFields/ExampleDescription';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { ParamHead } from '../../../../components/Api/Param';\nimport { FieldType } from '../../../types/api';\n\nimport { EnumOptions } from './Enum';\nimport { NumberMetadata } from './NumberMetadata';\nimport { SimpleSchemaFieldProps } from './SimpleSchemaField';\nimport { StringMetadata } from './StringMetadata';\n\nexport type PrimitiveParamFieldProps = Omit<SimpleSchemaFieldProps, 'schema'> & {\n fieldType: FieldType;\n schema: ResolvedSchemaObject;\n typeOptions: string[];\n paramId?: string;\n};\n\nexport const PrimitiveParamField = ({\n fieldType,\n schema,\n name,\n location,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n parentName,\n paramId,\n style,\n explode,\n}: PrimitiveParamFieldProps) => {\n const typeLabel = typeOptions[selectedIndex ?? 0];\n const description = schema.description;\n\n return (\n <ParamFieldWrapper paramId={paramId} className=\"mint:primitive-param-field\">\n <div className=\"mint:py-2\">\n <ParamHead\n id={paramId}\n name={name}\n typeLabel={typeLabel}\n location={location}\n fieldType={fieldType}\n required={schema.isRequired}\n deprecated={schema.deprecated}\n defaultValue={schema.default}\n typeOptions={typeOptions}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-4 mint:mb-4': description || isEnum(schema) })}>\n {description && <Description markdown={description} />}\n {/* TODO: Enum with consts - I think this only happens within a oneOf schema actually? */}\n {/* {isEnumWithConsts(schema) && <EnumConstTable schema={schema} />} */}\n {isEnum(schema) && <EnumOptions schema={schema} />}\n {isStringSchema(schema) && <StringMetadata schema={schema} description={description} />}\n {isNumberSchema(schema) && <NumberMetadata schema={schema} />}\n <ExampleDescription schema={schema} />\n </div>\n </div>\n </ParamFieldWrapper>\n );\n};\n"],"names":["PrimitiveParamField","fieldType","schema","name","location","typeOptions","selectedIndex","onSelectTypeOption","parentName","paramId","style","explode","typeLabel","description","jsx","ParamFieldWrapper","jsxs","ParamHead","cn","isEnum","Description","EnumOptions","isStringSchema","StringMetadata","isNumberSchema","NumberMetadata","ExampleDescription"],"mappings":";;;;;;;;;;AAsBO,MAAMA,IAAsB,CAAC;AAAA,EAClC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,MAAgC;AAC9B,QAAMC,IAAYP,EAAYC,KAAiB,CAAC,GAC1CO,IAAcX,EAAO;AAE3B,SACE,gBAAAY,EAACC,KAAkB,SAAAN,GAAkB,WAAU,8BAC7C,UAAA,gBAAAO,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,IAAIR;AAAA,QACJ,MAAAN;AAAA,QACA,WAAAS;AAAA,QACA,UAAAR;AAAA,QACA,WAAAH;AAAA,QACA,UAAUC,EAAO;AAAA,QACjB,YAAYA,EAAO;AAAA,QACnB,cAAcA,EAAO;AAAA,QACrB,aAAAG;AAAA,QACA,yBAAyBC;AAAA,QACzB,oBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,OAAAE;AAAA,QACA,SAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAK,EAAC,OAAA,EAAI,WAAWE,EAAG,EAAE,uBAAuBL,KAAeM,EAAOjB,CAAM,EAAA,CAAG,GACxE,UAAA;AAAA,MAAAW,KAAe,gBAAAC,EAACM,GAAA,EAAY,UAAUP,EAAA,CAAa;AAAA,MAGnDM,EAAOjB,CAAM,KAAK,gBAAAY,EAACO,KAAY,QAAAnB,EAAA,CAAgB;AAAA,MAC/CoB,EAAepB,CAAM,KAAK,gBAAAY,EAACS,GAAA,EAAe,QAAArB,GAAgB,aAAAW,GAA0B;AAAA,MACpFW,EAAetB,CAAM,KAAK,gBAAAY,EAACW,KAAe,QAAAvB,EAAA,CAAgB;AAAA,MAC3D,gBAAAY,EAACY,KAAmB,QAAAxB,EAAA,CAAgB;AAAA,IAAA,EAAA,CACtC;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as i, jsxs as d, Fragment as t } from "react/jsx-runtime";
|
|
2
|
+
import { isArrayObject as j } from "../../../schemaGraph/utils.js";
|
|
3
|
+
import { ParamFieldWrapper as k } from "../../../../api-playground/ApiPlayground/components/ParamFieldWrapper.js";
|
|
4
|
+
import { ExampleDescription as q } from "../../../../api-playground/EndpointFields/ParamFields/ExampleDescription.js";
|
|
5
|
+
import { Description as F } from "../../../../api-playground/EndpointFields/components/Description.js";
|
|
6
|
+
import { ParamHead as M } from "../../../../components/Api/Param.js";
|
|
7
|
+
import { SimpleSchemaField as N } from "./SimpleSchemaField.js";
|
|
8
|
+
import { cn as l } from "../../../../utils/cn.js";
|
|
9
|
+
const H = ({
|
|
10
|
+
displayFlattened: r = !1,
|
|
11
|
+
fieldType: e,
|
|
12
|
+
schema: n,
|
|
13
|
+
name: c,
|
|
14
|
+
location: m,
|
|
15
|
+
parentName: a,
|
|
16
|
+
typeOptions: o,
|
|
17
|
+
selectedIndex: f,
|
|
18
|
+
onSelectTypeOption: p,
|
|
19
|
+
paramId: u,
|
|
20
|
+
style: s,
|
|
21
|
+
explode: h,
|
|
22
|
+
required: g,
|
|
23
|
+
schemas: v
|
|
24
|
+
}) => {
|
|
25
|
+
if (!j(n)) return null;
|
|
26
|
+
const A = (o == null ? void 0 : o[f ?? 0]) ?? "unknown", b = n.items;
|
|
27
|
+
return /* @__PURE__ */ i(k, { paramId: u, className: "mint:array-param-field", children: /* @__PURE__ */ d("div", { className: l(!r && "mint:py-2"), children: [
|
|
28
|
+
/* @__PURE__ */ i(
|
|
29
|
+
M,
|
|
30
|
+
{
|
|
31
|
+
id: u,
|
|
32
|
+
name: c,
|
|
33
|
+
location: m,
|
|
34
|
+
required: g ?? !1,
|
|
35
|
+
deprecated: n.deprecated,
|
|
36
|
+
typeLabel: A,
|
|
37
|
+
fieldType: e,
|
|
38
|
+
typeOptions: o,
|
|
39
|
+
selectedTypeOptionIndex: f,
|
|
40
|
+
onSelectTypeOption: p,
|
|
41
|
+
parentName: a,
|
|
42
|
+
style: s,
|
|
43
|
+
explode: h
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ d("div", { className: l({ "mint:mt-4 mint:mb-4": n.description }), children: [
|
|
47
|
+
c && n.description && /* @__PURE__ */ i(F, { markdown: n.description }),
|
|
48
|
+
/* @__PURE__ */ i(P, { schema: n, description: n.description }),
|
|
49
|
+
/* @__PURE__ */ i(
|
|
50
|
+
N,
|
|
51
|
+
{
|
|
52
|
+
schema: b,
|
|
53
|
+
displayFlattened: r,
|
|
54
|
+
fieldType: e,
|
|
55
|
+
location: m,
|
|
56
|
+
parentName: a,
|
|
57
|
+
style: s,
|
|
58
|
+
explode: h,
|
|
59
|
+
onSelectTypeOption: p,
|
|
60
|
+
schemas: v
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ i(q, { schema: n })
|
|
64
|
+
] })
|
|
65
|
+
] }) });
|
|
66
|
+
}, P = ({
|
|
67
|
+
schema: r,
|
|
68
|
+
description: e
|
|
69
|
+
}) => /* @__PURE__ */ i(t, { children: (r.minItems !== void 0 || r.maxItems !== void 0) && /* @__PURE__ */ i("div", { className: l("mint:prose mint:prose-sm mint:prose-gray mint:dark:prose-invert", e && "mint:mt-6"), children: /* @__PURE__ */ i(S, { minItems: r.minItems, maxItems: r.maxItems }) }) }), S = ({ minItems: r, maxItems: e }) => r === e && r !== void 0 ? /* @__PURE__ */ d(t, { children: [
|
|
70
|
+
"Required array length: ",
|
|
71
|
+
/* @__PURE__ */ i("code", { children: r }),
|
|
72
|
+
" element",
|
|
73
|
+
r > 1 ? "s" : ""
|
|
74
|
+
] }) : r && e ? /* @__PURE__ */ d(t, { children: [
|
|
75
|
+
"Required array length: ",
|
|
76
|
+
/* @__PURE__ */ i("code", { children: `${r} - ${e}` }),
|
|
77
|
+
" element",
|
|
78
|
+
e > 1 ? "s" : ""
|
|
79
|
+
] }) : r ? /* @__PURE__ */ d(t, { children: [
|
|
80
|
+
"Minimum length: ",
|
|
81
|
+
/* @__PURE__ */ i("code", { children: r })
|
|
82
|
+
] }) : e ? /* @__PURE__ */ d(t, { children: [
|
|
83
|
+
"Maximum length: ",
|
|
84
|
+
/* @__PURE__ */ i("code", { children: e })
|
|
85
|
+
] }) : "";
|
|
86
|
+
export {
|
|
87
|
+
P as ArrayMetadata,
|
|
88
|
+
H as SimpleArrayParamField
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=SimpleArrayParamField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleArrayParamField.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.tsx"],"sourcesContent":["'use client';\n\nimport { cn, isArrayObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { ParamFieldWrapper } from '@/api-playground/ApiPlayground/components/ParamFieldWrapper';\nimport { ExampleDescription } from '@/api-playground/EndpointFields/ParamFields/ExampleDescription';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { ParamHead } from '../../../../components/Api/Param';\n\nimport { SimpleSchemaField, SimpleSchemaFieldProps } from './SimpleSchemaField';\n\ntype SimpleArrayParamFieldProps = Omit<SimpleSchemaFieldProps, 'schema'> & {\n schema: ResolvedSchemaObject;\n paramId?: string;\n};\n\nexport const SimpleArrayParamField = ({\n displayFlattened = false,\n fieldType,\n schema,\n name,\n location,\n parentName,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n paramId,\n style,\n explode,\n required,\n schemas,\n}: SimpleArrayParamFieldProps) => {\n if (!isArrayObject(schema)) return null;\n\n const typeLabel = typeOptions?.[selectedIndex ?? 0] ?? 'unknown';\n const itemSchema = schema.items;\n\n return (\n <ParamFieldWrapper paramId={paramId} className=\"mint:array-param-field\">\n <div className={cn(!displayFlattened && 'mint:py-2')}>\n <ParamHead\n id={paramId}\n name={name}\n location={location}\n required={required ?? false}\n deprecated={schema.deprecated}\n typeLabel={typeLabel}\n fieldType={fieldType}\n typeOptions={typeOptions}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-4 mint:mb-4': schema.description })}>\n {name && schema.description && <Description markdown={schema.description} />}\n <ArrayMetadata schema={schema} description={schema.description} />\n <SimpleSchemaField\n schema={itemSchema}\n displayFlattened={displayFlattened}\n fieldType={fieldType}\n location={location}\n parentName={parentName}\n style={style}\n explode={explode}\n onSelectTypeOption={onSelectTypeOption}\n schemas={schemas}\n />\n <ExampleDescription schema={schema} />\n </div>\n </div>\n </ParamFieldWrapper>\n );\n};\n\nexport const ArrayMetadata = ({\n schema,\n description,\n}: {\n schema: ResolvedSchemaObject;\n description?: string;\n}) => {\n return (\n <>\n {(schema.minItems !== undefined || schema.maxItems !== undefined) && (\n <div className={cn('mint:prose mint:prose-sm mint:prose-gray mint:dark:prose-invert', description && 'mint:mt-6')}>\n <ArrayLength minItems={schema.minItems} maxItems={schema.maxItems} />\n </div>\n )}\n </>\n );\n};\n\nconst ArrayLength = ({ minItems, maxItems }: { minItems?: number; maxItems?: number }) => {\n if (minItems === maxItems && minItems !== undefined) {\n return (\n <>\n Required array length: <code>{minItems}</code> element{minItems > 1 ? 's' : ''}\n </>\n );\n }\n if (minItems && maxItems) {\n return (\n <>\n Required array length: <code>{`${minItems} - ${maxItems}`}</code> element\n {maxItems > 1 ? 's' : ''}\n </>\n );\n }\n if (minItems) {\n return (\n <>\n Minimum length: <code>{minItems}</code>\n </>\n );\n }\n if (maxItems) {\n return (\n <>\n Maximum length: <code>{maxItems}</code>\n </>\n );\n }\n return '';\n};\n"],"names":["SimpleArrayParamField","displayFlattened","fieldType","schema","name","location","parentName","typeOptions","selectedIndex","onSelectTypeOption","paramId","style","explode","required","schemas","isArrayObject","typeLabel","itemSchema","jsx","ParamFieldWrapper","jsxs","cn","ParamHead","Description","ArrayMetadata","SimpleSchemaField","ExampleDescription","description","Fragment","ArrayLength","minItems","maxItems"],"mappings":";;;;;;;;AAgBO,MAAMA,IAAwB,CAAC;AAAA,EACpC,kBAAAC,IAAmB;AAAA,EACnB,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AACF,MAAkC;AAChC,MAAI,CAACC,EAAcZ,CAAM,EAAG,QAAO;AAEnC,QAAMa,KAAYT,KAAA,gBAAAA,EAAcC,KAAiB,OAAM,WACjDS,IAAad,EAAO;AAE1B,SACE,gBAAAe,EAACC,GAAA,EAAkB,SAAAT,GAAkB,WAAU,0BAC7C,UAAA,gBAAAU,EAAC,OAAA,EAAI,WAAWC,EAAG,CAACpB,KAAoB,WAAW,GACjD,UAAA;AAAA,IAAA,gBAAAiB;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,IAAIZ;AAAA,QACJ,MAAAN;AAAA,QACA,UAAAC;AAAA,QACA,UAAUQ,KAAY;AAAA,QACtB,YAAY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,EACuB,gBAAAV,EAAC,UAAM,UAAAY,EAAA,CAAS;AAAA,EAAO;AAAA,EAASA,IAAW,IAAI,MAAM;AAAA,GAC9E,IAGAA,KAAYC,IAEZ,gBAAAX,EAAAQ,GAAA,EAAE,UAAA;AAAA,EAAA;AAAA,oBACwB,QAAA,EAAM,UAAA,GAAGE,CAAQ,MAAMC,CAAQ,IAAG;AAAA,EAAO;AAAA,EAChEA,IAAW,IAAI,MAAM;AAAA,GACxB,IAGAD,IAEA,gBAAAV,EAAAQ,GAAA,EAAE,UAAA;AAAA,EAAA;AAAA,EACgB,gBAAAV,EAAC,UAAM,UAAAY,EAAA,CAAS;AAAA,GAClC,IAGAC,IAEA,gBAAAX,EAAAQ,GAAA,EAAE,UAAA;AAAA,EAAA;AAAA,EACgB,gBAAAV,EAAC,UAAM,UAAAa,EAAA,CAAS;AAAA,GAClC,IAGG;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as i, jsxs as u, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as M } from "react";
|
|
3
|
+
import { isSchemaObject as O } from "../../../schemaGraph/utils.js";
|
|
4
|
+
import { ParamFieldWrapper as R } from "../../../../api-playground/ApiPlayground/components/ParamFieldWrapper.js";
|
|
5
|
+
import { ExampleDescription as y } from "../../../../api-playground/EndpointFields/ParamFields/ExampleDescription.js";
|
|
6
|
+
import { getRecursiveParentName as C } from "../../../../api-playground/EndpointFields/ParamFields/RecursiveParamField.js";
|
|
7
|
+
import { Description as S } from "../../../../api-playground/EndpointFields/components/Description.js";
|
|
8
|
+
import { OneOfSelection as H } from "../../../../api-playground/EndpointFields/components/OneOfDropdown.js";
|
|
9
|
+
import { Expandable as U } from "../../../../components/Api/Expandable.js";
|
|
10
|
+
import { ParamHead as W } from "../../../../components/Api/Param.js";
|
|
11
|
+
import { generateSimpleSchemaLabel as z, SimpleSchemaField as A } from "./SimpleSchemaField.js";
|
|
12
|
+
import { cn as P } from "../../../../utils/cn.js";
|
|
13
|
+
function B(e) {
|
|
14
|
+
return e.type !== "object" ? { properties: void 0, additionalProperties: void 0 } : {
|
|
15
|
+
properties: e.properties,
|
|
16
|
+
additionalProperties: e.additionalProperties
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const ir = ({
|
|
20
|
+
fieldType: e,
|
|
21
|
+
schema: r,
|
|
22
|
+
name: t,
|
|
23
|
+
location: p,
|
|
24
|
+
parentName: a,
|
|
25
|
+
typeOptions: q,
|
|
26
|
+
selectedIndex: j,
|
|
27
|
+
onSelectTypeOption: n,
|
|
28
|
+
paramId: v,
|
|
29
|
+
style: s,
|
|
30
|
+
explode: c,
|
|
31
|
+
required: w,
|
|
32
|
+
displayFlattened: f = !1,
|
|
33
|
+
schemas: x,
|
|
34
|
+
oneOfOptions: l
|
|
35
|
+
}) => {
|
|
36
|
+
const { properties: b, additionalProperties: o } = B(r), g = M(() => {
|
|
37
|
+
const E = [], N = (d, m) => {
|
|
38
|
+
const D = C(t ?? void 0, a), F = /* @__PURE__ */ i(
|
|
39
|
+
A,
|
|
40
|
+
{
|
|
41
|
+
schema: m,
|
|
42
|
+
name: d,
|
|
43
|
+
required: m.isRequired,
|
|
44
|
+
fieldType: e,
|
|
45
|
+
location: p,
|
|
46
|
+
parentName: D,
|
|
47
|
+
style: s,
|
|
48
|
+
explode: c,
|
|
49
|
+
onSelectTypeOption: n,
|
|
50
|
+
schemas: x
|
|
51
|
+
},
|
|
52
|
+
d
|
|
53
|
+
);
|
|
54
|
+
E.push(F);
|
|
55
|
+
};
|
|
56
|
+
return b && Object.entries(b).forEach(([d, m]) => {
|
|
57
|
+
N(d, m);
|
|
58
|
+
}), o && typeof o == "object" && O(o) && N("{key}", o), E;
|
|
59
|
+
}, [
|
|
60
|
+
b,
|
|
61
|
+
o,
|
|
62
|
+
e,
|
|
63
|
+
t,
|
|
64
|
+
a,
|
|
65
|
+
p,
|
|
66
|
+
s,
|
|
67
|
+
c,
|
|
68
|
+
n,
|
|
69
|
+
x
|
|
70
|
+
]), h = g.length > 0, k = z(r, !1);
|
|
71
|
+
return /* @__PURE__ */ i(R, { paramId: v, className: "mint:object-param-field", children: /* @__PURE__ */ u("div", { className: P(!f && "mint:py-0"), children: [
|
|
72
|
+
/* @__PURE__ */ i(
|
|
73
|
+
W,
|
|
74
|
+
{
|
|
75
|
+
id: v,
|
|
76
|
+
name: t,
|
|
77
|
+
location: p,
|
|
78
|
+
required: w ?? !1,
|
|
79
|
+
deprecated: r.deprecated,
|
|
80
|
+
typeLabel: k,
|
|
81
|
+
fieldType: e,
|
|
82
|
+
typeOptions: q ?? [k],
|
|
83
|
+
selectedTypeOptionIndex: j,
|
|
84
|
+
onSelectTypeOption: n,
|
|
85
|
+
parentName: a,
|
|
86
|
+
style: s,
|
|
87
|
+
explode: c
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ u("div", { className: P({ "mint:mt-0": r.description || h }), children: [
|
|
91
|
+
t && r.description && /* @__PURE__ */ i(S, { markdown: r.description }),
|
|
92
|
+
/* @__PURE__ */ u(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
className: P({
|
|
96
|
+
"mint:mt-4 mint:mb-4 mint:rounded-xl mint:border mint:border-gray-100 mint:px-4 mint:pb-4 mint:pt-2 mint:dark:border-white/10": l
|
|
97
|
+
}),
|
|
98
|
+
children: [
|
|
99
|
+
l && /* @__PURE__ */ i(
|
|
100
|
+
H,
|
|
101
|
+
{
|
|
102
|
+
selectedIndex: j,
|
|
103
|
+
options: l,
|
|
104
|
+
onSelectOption: n
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
!t && r.description && /* @__PURE__ */ i(S, { markdown: r.description }),
|
|
108
|
+
h && /* @__PURE__ */ i(G, { expandable: !f, defaultOpen: f, children: /* @__PURE__ */ i("div", { children: g }) }),
|
|
109
|
+
/* @__PURE__ */ i(y, { schema: r })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] })
|
|
114
|
+
] }) });
|
|
115
|
+
};
|
|
116
|
+
function G({ expandable: e, children: r, ...t }) {
|
|
117
|
+
return e ? /* @__PURE__ */ i(U, { ...t, children: r }) : /* @__PURE__ */ i(L, { children: r });
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
ir as SimpleObjectParamField
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=SimpleObjectParamField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleObjectParamField.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.tsx"],"sourcesContent":["'use client';\n\nimport { UUID } from '@mintlify/validation';\nimport { ReactNode, useMemo } from 'react';\n\nimport { cn, isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport { ParamFieldWrapper } from '@/api-playground/ApiPlayground/components/ParamFieldWrapper';\nimport { ExampleDescription } from '@/api-playground/EndpointFields/ParamFields/ExampleDescription';\nimport { getRecursiveParentName } from '@/api-playground/EndpointFields/ParamFields/RecursiveParamField';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { OneOfSelection } from '@/api-playground/EndpointFields/components/OneOfDropdown';\nimport { Expandable } from '../../../../components/Api/Expandable';\nimport { ExpandableProps } from '../../../../components/Api/Expandable';\nimport { ParamHead } from '../../../../components/Api/Param';\n\nimport {\n generateSimpleSchemaLabel,\n SimpleSchemaField,\n SimpleSchemaFieldProps,\n} from './SimpleSchemaField';\n\nexport type SimpleObjectParamFieldProps = SimpleSchemaFieldProps & {\n paramId?: string;\n schemas?: Record<UUID, ResolvedSchemaObject>;\n oneOfOptions?: string[];\n defaultExpanded?: boolean;\n};\n\nfunction maybeUseProperties(schema: ResolvedSchemaObject) {\n if (schema.type !== 'object') {\n return { properties: undefined, additionalProperties: undefined };\n }\n return {\n properties: schema.properties,\n additionalProperties: schema.additionalProperties,\n };\n}\n\nexport const SimpleObjectParamField = ({\n fieldType,\n schema,\n name,\n location,\n parentName,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n paramId,\n style,\n explode,\n required,\n displayFlattened = false,\n schemas,\n oneOfOptions,\n}: SimpleObjectParamFieldProps) => {\n const { properties, additionalProperties } = maybeUseProperties(schema);\n\n const children: ReactNode[] = useMemo(() => {\n const fields: ReactNode[] = [];\n\n const renderProperty = (propertyName: string, propertySchema: ResolvedSchemaObject) => {\n const childParentName = getRecursiveParentName(name ?? undefined, parentName);\n\n const property = (\n <SimpleSchemaField\n key={propertyName}\n schema={propertySchema}\n name={propertyName}\n required={propertySchema.isRequired}\n fieldType={fieldType}\n location={location}\n parentName={childParentName}\n style={style}\n explode={explode}\n onSelectTypeOption={onSelectTypeOption}\n schemas={schemas}\n />\n );\n fields.push(property);\n };\n\n if (properties) {\n Object.entries(properties).forEach(([propertyName, propertySchema]) => {\n renderProperty(propertyName, propertySchema);\n });\n }\n\n if (\n additionalProperties &&\n typeof additionalProperties === 'object' &&\n isSchemaObject(additionalProperties)\n ) {\n // Render a representative additional property\n renderProperty('{key}', additionalProperties);\n }\n\n return fields;\n }, [\n properties,\n additionalProperties,\n fieldType,\n name,\n parentName,\n location,\n style,\n explode,\n onSelectTypeOption,\n schemas,\n ]);\n\n const hasChildren = children.length > 0;\n const typeLabel = generateSimpleSchemaLabel(schema, false);\n\n return (\n <ParamFieldWrapper paramId={paramId} className=\"mint:object-param-field\">\n <div className={cn(!displayFlattened && 'mint:py-0')}>\n <ParamHead\n id={paramId}\n name={name}\n location={location}\n required={required ?? false}\n deprecated={schema.deprecated}\n typeLabel={typeLabel}\n fieldType={fieldType}\n typeOptions={typeOptions ?? [typeLabel]}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-0': schema.description || hasChildren })}>\n {name && schema.description && <Description markdown={schema.description} />}\n <div\n className={cn({\n 'mint:mt-4 mint:mb-4 mint:rounded-xl mint:border mint:border-gray-100 mint:px-4 mint:pb-4 mint:pt-2 mint:dark:border-white/10':\n oneOfOptions,\n })}\n >\n {oneOfOptions && (\n <OneOfSelection\n selectedIndex={selectedIndex}\n options={oneOfOptions}\n onSelectOption={onSelectTypeOption}\n />\n )}\n {!name && schema.description && <Description markdown={schema.description} />}\n {hasChildren && (\n <MaybeExpandable expandable={!displayFlattened} defaultOpen={displayFlattened}>\n <div>{children}</div>\n </MaybeExpandable>\n )}\n <ExampleDescription schema={schema} />\n </div>\n </div>\n </div>\n </ParamFieldWrapper>\n );\n};\n\ninterface MaybeExpandableProps extends ExpandableProps {\n expandable: boolean;\n children: ReactNode;\n}\n\nfunction MaybeExpandable({ expandable, children, ...rest }: MaybeExpandableProps) {\n return expandable ? <Expandable {...rest}>{children}</Expandable> : <>{children}</>;\n}\n"],"names":["maybeUseProperties","schema","SimpleObjectParamField","fieldType","name","location","parentName","typeOptions","selectedIndex","onSelectTypeOption","paramId","style","explode","required","displayFlattened","schemas","oneOfOptions","properties","additionalProperties","children","useMemo","fields","renderProperty","propertyName","propertySchema","childParentName","getRecursiveParentName","property","jsx","SimpleSchemaField","isSchemaObject","hasChildren","typeLabel","generateSimpleSchemaLabel","ParamFieldWrapper","jsxs","cn","ParamHead","Description","OneOfSelection","MaybeExpandable","ExampleDescription","expandable","rest","Expandable"],"mappings":";;;;;;;;;;;;AA6BA,SAASA,EAAmBC,GAA8B;AACxD,SAAIA,EAAO,SAAS,WACX,EAAE,YAAY,QAAW,sBAAsB,OAAA,IAEjD;AAAA,IACL,YAAYA,EAAO;AAAA,IACnB,sBAAsBA,EAAO;AAAA,EAAA;AAEjC;AAEO,MAAMC,KAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,QAAAF;AAAA,EACA,MAAAG;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,SA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EAAE,YAAAE,GAAY,UAAAvB,GAAU,GAAGwB,KAA8B;AAChF,SAAOD,sBAAcE,GAAA,EAAY,GAAGD,GAAO,UAAAxB,EAAA,CAAS,2BAAmB,UAAAA,EAAA,CAAS;AAClF;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as i, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { ParamFieldWrapper as b } from "../../../../api-playground/ApiPlayground/components/ParamFieldWrapper.js";
|
|
3
|
+
import { ExampleDescription as x } from "../../../../api-playground/EndpointFields/ParamFields/ExampleDescription.js";
|
|
4
|
+
import { EnumOptions as g } from "../../../../api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js";
|
|
5
|
+
import { NumberMetadata as w } from "../../../../api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js";
|
|
6
|
+
import { StringMetadata as S } from "../../../../api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js";
|
|
7
|
+
import { Description as h } from "../../../../api-playground/EndpointFields/components/Description.js";
|
|
8
|
+
import { ParamHead as E } from "../../../../components/Api/Param.js";
|
|
9
|
+
import { cn as P } from "../../../../utils/cn.js";
|
|
10
|
+
const T = ({
|
|
11
|
+
fieldType: t,
|
|
12
|
+
schema: r,
|
|
13
|
+
required: m,
|
|
14
|
+
name: p,
|
|
15
|
+
location: u,
|
|
16
|
+
typeOptions: d,
|
|
17
|
+
selectedIndex: l,
|
|
18
|
+
onSelectTypeOption: f,
|
|
19
|
+
parentName: v,
|
|
20
|
+
paramId: s,
|
|
21
|
+
style: y,
|
|
22
|
+
explode: N,
|
|
23
|
+
enumTable: o
|
|
24
|
+
}) => {
|
|
25
|
+
const a = d[l ?? 0], n = r.description ?? (p === void 0 ? `The ${t} is of type \`${a}\`.` : void 0);
|
|
26
|
+
return /* @__PURE__ */ i(b, { paramId: s, className: "mint:primitive-param-field", children: /* @__PURE__ */ e("div", { className: "mint:py-2", children: [
|
|
27
|
+
/* @__PURE__ */ i(
|
|
28
|
+
E,
|
|
29
|
+
{
|
|
30
|
+
id: s,
|
|
31
|
+
name: p,
|
|
32
|
+
typeLabel: a,
|
|
33
|
+
location: u,
|
|
34
|
+
fieldType: t,
|
|
35
|
+
required: m ?? !1,
|
|
36
|
+
deprecated: r.deprecated,
|
|
37
|
+
defaultValue: r.default,
|
|
38
|
+
typeOptions: d,
|
|
39
|
+
selectedTypeOptionIndex: l,
|
|
40
|
+
onSelectTypeOption: f,
|
|
41
|
+
parentName: v,
|
|
42
|
+
style: y,
|
|
43
|
+
explode: N
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ e("div", { className: P({ "mint:mt-4 mint:mb-4": n || c(r) }), children: [
|
|
47
|
+
n && /* @__PURE__ */ i(h, { markdown: n }),
|
|
48
|
+
o && /* @__PURE__ */ i(D, { enumTable: o }),
|
|
49
|
+
!o && c(r) && /* @__PURE__ */ i(g, { schema: r }),
|
|
50
|
+
j(r) && /* @__PURE__ */ i(S, { schema: r, description: n }),
|
|
51
|
+
C(r) && /* @__PURE__ */ i(w, { schema: r }),
|
|
52
|
+
/* @__PURE__ */ i(x, { schema: r })
|
|
53
|
+
] })
|
|
54
|
+
] }) });
|
|
55
|
+
}, c = (t) => t.type === "enum<integer>" || t.type === "enum<number>" || t.type === "enum<string>" || "enum" in t, j = (t) => t.type === "string", C = (t) => t.type === "number" || t.type === "integer", D = ({
|
|
56
|
+
enumTable: t
|
|
57
|
+
}) => /* @__PURE__ */ e("div", { className: "mint:whitespace-pre-wrap mint:prose mint:prose-sm mint:mt-6", children: [
|
|
58
|
+
"Available options:",
|
|
59
|
+
/* @__PURE__ */ e("table", { className: "mint:w-min mint:max-w-full mint:text-sm not-prose", children: [
|
|
60
|
+
/* @__PURE__ */ e("tr", { children: [
|
|
61
|
+
/* @__PURE__ */ i("th", { className: "mint:text-left", children: "Title" }),
|
|
62
|
+
/* @__PURE__ */ i("th", { children: "Const" })
|
|
63
|
+
] }),
|
|
64
|
+
t.map(({ title: r, const: m }) => /* @__PURE__ */ e("tr", { children: [
|
|
65
|
+
/* @__PURE__ */ i("td", { children: r }),
|
|
66
|
+
/* @__PURE__ */ i("td", { children: /* @__PURE__ */ i("code", { children: m }) })
|
|
67
|
+
] }, r))
|
|
68
|
+
] })
|
|
69
|
+
] });
|
|
70
|
+
export {
|
|
71
|
+
D as EnumConstTable,
|
|
72
|
+
T as SimplePrimitiveParamField,
|
|
73
|
+
c as isEnum
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=SimplePrimitiveParamField.js.map
|
package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimplePrimitiveParamField.js","sources":["../../../../../src/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.tsx"],"sourcesContent":["'use client';\n\nimport {\n AnySchema,\n BooleanSchema,\n DataSchema,\n FileSchema,\n IncrementalDataSchema,\n NullSchema,\n NumberEnumSchema,\n NumberSchema,\n StringEnumSchema,\n StringSchema,\n} from '@mintlify/validation';\n\nimport { ParamFieldWrapper } from '@/api-playground/ApiPlayground/components/ParamFieldWrapper';\nimport { ExampleDescription } from '@/api-playground/EndpointFields/ParamFields/ExampleDescription';\nimport { EnumOptions } from '@/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum';\nimport { NumberMetadata } from '@/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata';\nimport { StringMetadata } from '@/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { ParamHead } from '../../../../components/Api/Param';\nimport { SimpleSchemaFieldProps } from './SimpleSchemaField';\nimport { FieldType } from '@/api-playground-2/types/api';\nimport { cn } from \"../../../../utils/cn\";\n\ntype PrimitiveSchema =\n | BooleanSchema\n | StringSchema\n | NumberSchema\n | StringEnumSchema\n | NumberEnumSchema\n | FileSchema\n | NullSchema\n | AnySchema;\n\nexport type SimplePrimitiveParamFieldProps = Omit<SimpleSchemaFieldProps, 'schema'> & {\n fieldType: FieldType;\n schema: PrimitiveSchema;\n typeOptions: string[];\n paramId?: string;\n};\n\nexport const SimplePrimitiveParamField = ({\n fieldType,\n schema,\n required,\n name,\n location,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n parentName,\n paramId,\n style,\n explode,\n enumTable,\n}: SimplePrimitiveParamFieldProps) => {\n const typeLabel = typeOptions[selectedIndex ?? 0];\n\n const description =\n schema.description ??\n (name === undefined ? `The ${fieldType} is of type \\`${typeLabel}\\`.` : undefined);\n\n return (\n <ParamFieldWrapper paramId={paramId} className=\"mint:primitive-param-field\">\n <div className=\"mint:py-2\">\n <ParamHead\n id={paramId}\n name={name}\n typeLabel={typeLabel}\n location={location}\n fieldType={fieldType}\n required={required ?? false}\n deprecated={schema.deprecated}\n defaultValue={schema.default}\n typeOptions={typeOptions}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-4 mint:mb-4': description || isEnum(schema) })}>\n {description && <Description markdown={description} />}\n {enumTable && <EnumConstTable enumTable={enumTable} />}\n {!enumTable && isEnum(schema) && <EnumOptions schema={schema} />}\n {isStringSchema(schema) && <StringMetadata schema={schema} description={description} />}\n {isNumberSchema(schema) && <NumberMetadata schema={schema} />}\n <ExampleDescription schema={schema} />\n </div>\n </div>\n </ParamFieldWrapper>\n );\n};\n\nexport const isEnum = (\n schema: DataSchema | IncrementalDataSchema\n): schema is NumberEnumSchema | StringEnumSchema => {\n return (\n schema.type === 'enum<integer>' ||\n schema.type === 'enum<number>' ||\n schema.type === 'enum<string>' ||\n 'enum' in schema\n );\n};\n\nconst isStringSchema = (schema: DataSchema | IncrementalDataSchema): schema is StringSchema => {\n return schema.type === 'string';\n};\n\nconst isNumberSchema = (schema: DataSchema | IncrementalDataSchema): schema is NumberSchema => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n\nexport const EnumConstTable = ({\n enumTable,\n}: {\n enumTable: { title: string; const: string | number }[];\n}) => {\n return (\n <div className=\"mint:whitespace-pre-wrap mint:prose mint:prose-sm mint:mt-6\">\n Available options:\n <table className=\"mint:w-min mint:max-w-full mint:text-sm not-prose\">\n <tr>\n <th className=\"mint:text-left\">Title</th>\n <th>Const</th>\n </tr>\n {enumTable.map(({ title, const: constValue }) => {\n return (\n <tr key={title}>\n <td>{title}</td>\n <td>\n <code>{constValue}</code>\n </td>\n </tr>\n );\n })}\n </table>\n </div>\n );\n};\n"],"names":["SimplePrimitiveParamField","fieldType","schema","required","name","location","typeOptions","selectedIndex","onSelectTypeOption","parentName","paramId","style","explode","enumTable","typeLabel","description","jsx","ParamFieldWrapper","jsxs","ParamHead","cn","isEnum","Description","EnumConstTable","EnumOptions","isStringSchema","StringMetadata","isNumberSchema","NumberMetadata","ExampleDescription","title","constValue"],"mappings":";;;;;;;;;AA2CO,MAAMA,IAA4B,CAAC;AAAA,EACxC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,MAAsC;AACpC,QAAMC,IAAYR,EAAYC,KAAiB,CAAC,GAE1CQ,IACJb,EAAO,gBACNE,MAAS,SAAY,OAAOH,CAAS,iBAAiBa,CAAS,QAAQ;AAE1E,SACE,gBAAAE,EAACC,KAAkB,SAAAP,GAAkB,WAAU,8BAC7C,UAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,IAAIT;AAAA,QACJ,MAAAN;AAAA,QACA,WAAAU;AAAA,QAC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