@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 @@
|
|
|
1
|
+
{"version":3,"file":"InputContainer.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/InputContainer.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { isEnum } from '@/api-playground-2/schemaGraph/utils';\nimport { ArrayCount } from '@/api-playground/ApiPlayground/components/ArrayCount';\nimport { ObjectExpandButton } from '@/api-playground/ApiPlayground/components/ObjectExpandButton';\nimport { TrashButton } from '@/api-playground/ApiPlayground/components/TrashButton';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { DeprecatedPill, InfoPill, RequiredPill } from '../../../../components/Api/Param';\nimport { containsMarkdownTable } from '../../../../utils/containsMarkdownTable';\n\nimport { InputContainerParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const InputContainer = ({\n name,\n schema,\n defaultExpanded = true,\n typeDropdown,\n arrayIndex,\n parentNames,\n clearValue,\n style,\n explode,\n children,\n}: InputContainerParams) => {\n const [showChildren, setShowChildren] = useState(defaultExpanded);\n const descriptionContainsTable =\n isEnum(schema) && schema.description && containsMarkdownTable(schema.description);\n const typeLabel =\n schema.format && typeof schema.format === 'string'\n ? `${schema.type}<${schema.format}>`\n : isEnum(schema)\n ? `enum<${schema.type}>`\n : schema.type;\n const isArray = schema.type === 'array';\n const isObject = schema.type === 'object';\n const propertiesCount = isObject ? Object.keys(schema.properties ?? {}).length : 0;\n return (\n <>\n <div\n className={cn(\n 'mint:flex mint:space-x-3 mint:items-start',\n arrayIndex != undefined && !isObject && 'mint:flex mint:items-center'\n )}\n >\n {arrayIndex != undefined && (\n <ArrayCount className={cn(isObject && 'mint:mt-8')}>{arrayIndex + 1}</ArrayCount>\n )}\n <div\n className={cn(\n 'mint:flex-1 mint:lg:grid-cols-2 mint:gap-x-12 mint:gap-y-4 mint:py-5 mint:max-w-full',\n !isArray && !isObject && \"mint:grid\",\n isArray && 'mint:flex mint:flex-col',\n isObject &&\n 'mint:gap-y-0 mint:flex mint:flex-col mint:border mint:border-gray-50 mint:dark:border-white/5 mint:rounded-xl mint:px-4 mint:py-0 mint:my-5',\n arrayIndex !== undefined && 'mint:py-1 mint:my-2'\n )}\n >\n <div\n className={cn(\n 'mint:space-y-2',\n isObject && 'mint:py-5 mint:border-b mint:border-gray-50 mint:dark:border-white/5',\n !showChildren && 'mint:border-none',\n arrayIndex != undefined && !isObject && 'mint:flex mint:items-center'\n )}\n >\n <div className=\"mint:flex mint:items-center mint:justify-between mint:font-mono mint:font-bold\">\n <div\n className=\"mint:flex mint:flex-wrap mint:items-center mint:gap-2 mint:text-xs mint:truncate\"\n title={\n parentNames && parentNames.length > 0 ? `${parentNames.join('.')}.${name}` : name\n }\n >\n <div className={cn(\"mint:text-sm mint:truncate\", name == undefined && 'mint:hidden')}>\n {parentNames && parentNames.length > 0 && style === 'deepObject' && explode ? (\n <>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">\n {parentNames.map((parentName, index) => (\n <>\n {parentName}\n {index === 0 ? '[' : ']['}\n </>\n ))}\n </span>\n <span className=\"mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100\">{name}</span>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">{']'}</span>\n </>\n ) : (\n <>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">\n {parentNames ? `${parentNames.join('.')}.` : ''}\n </span>\n <span className=\"mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100\">{name}</span>\n </>\n )}\n </div>\n {typeDropdown != undefined ? typeDropdown : <InfoPill>{typeLabel}</InfoPill>}\n {schema.isRequired && <RequiredPill />}\n {schema.deprecated && <DeprecatedPill />}\n </div>\n {isObject && (\n <ObjectExpandButton\n onClick={() => setShowChildren(!showChildren)}\n count={propertiesCount}\n labeled={defaultExpanded == false}\n />\n )}\n </div>\n {schema.description && !descriptionContainsTable && (\n <Description\n markdown={schema.description}\n className=\"mint:text-gray-500 mint:dark:text-gray-400\"\n />\n )}\n </div>\n {showChildren && (\n <div\n className={cn(\n 'mint:grid mint:grid-cols-1 mint:w-full mint:items-start mint:divide-y mint:divide-gray-50 mint:dark:divide-white/5',\n isArray && 'mint:divide-y-0'\n )}\n >\n {children}\n </div>\n )}\n </div>\n {/* // TODO - Api Playground Refactor: make sure clearValue works to delete keys */}\n {(arrayIndex != undefined || parentNames) && clearValue && (\n <TrashButton\n className={cn(isObject && 'mint:mt-8', parentNames && 'mint:mt-7')}\n onClick={() => clearValue()}\n />\n )}\n </div>\n {schema.description && descriptionContainsTable && (\n <Description markdown={schema.description} className=\"mint:text-gray-500 mint:dark:text-gray-400\" />\n )}\n </>\n );\n};\n"],"names":["InputContainer","name","schema","defaultExpanded","typeDropdown","arrayIndex","parentNames","clearValue","style","explode","children","showChildren","setShowChildren","useState","descriptionContainsTable","isEnum","containsMarkdownTable","typeLabel","isArray","isObject","propertiesCount","jsxs","Fragment","cn","ArrayCount","jsx","parentName","index","InfoPill","RequiredPill","DeprecatedPill","ObjectExpandButton","Description","TrashButton"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
const e = () => /* @__PURE__ */ t(
|
|
3
|
+
"input",
|
|
4
|
+
{
|
|
5
|
+
className: "mint:flex-1 mint:min-w-0 mint:outline-0 mint:bg-transparent mint:text-playground-input",
|
|
6
|
+
type: "text",
|
|
7
|
+
placeholder: "--",
|
|
8
|
+
contentEditable: "false",
|
|
9
|
+
disabled: !0
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
e as NullInput
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=NullInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NullInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/NullInput.tsx"],"sourcesContent":["import { cn } from \"../../../../utils/cn\";\nexport const NullInput = () => {\n return (\n <input\n className=\"mint:flex-1 mint:min-w-0 mint:outline-0 mint:bg-transparent mint:text-playground-input\"\n type=\"text\"\n placeholder=\"--\"\n contentEditable=\"false\"\n disabled\n />\n );\n};\n"],"names":["NullInput","jsx"],"mappings":";AACO,MAAMA,IAAY,MAErB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,MAAK;AAAA,IACL,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,UAAQ;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { isInteger as b, isNumber as N } from "../../../../common/guards.js";
|
|
3
|
+
import { usePlaygroundInputsStore as h } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getSchemaPlaceholder as P, getUniqueInputKey as S } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as v } from "../../../../utils/locales/index.js";
|
|
6
|
+
import { Ids as x } from "../../../types/index.js";
|
|
7
|
+
const A = ({
|
|
8
|
+
name: a,
|
|
9
|
+
schema: n,
|
|
10
|
+
inputKeyPrefix: l,
|
|
11
|
+
numberType: s,
|
|
12
|
+
arrayIndex: p
|
|
13
|
+
}) => {
|
|
14
|
+
const m = v(), { getInput: c, setInput: o } = h(), u = P(n), r = S(l, n, p), g = c(r), f = u ?? `enter ${a ?? "value"}`, i = n.type, d = ((e, t) => e === "integer" ? b(t) ? t : void 0 : N(t) ? t : void 0)(s, g), I = (e) => {
|
|
15
|
+
if (e.target.value.length === 0) {
|
|
16
|
+
o(r, void 0);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (i === "integer") {
|
|
20
|
+
const t = parseInt(e.target.value);
|
|
21
|
+
if (isNaN(t))
|
|
22
|
+
return;
|
|
23
|
+
o(r, t);
|
|
24
|
+
} else
|
|
25
|
+
o(r, parseFloat(e.target.value));
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ y(
|
|
28
|
+
"input",
|
|
29
|
+
{
|
|
30
|
+
id: x.APIPlaygroundInput,
|
|
31
|
+
className: "mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input",
|
|
32
|
+
placeholder: f,
|
|
33
|
+
"aria-label": u ?? m["aria.enterValue"].replace("{name}", a ?? "value"),
|
|
34
|
+
onKeyDown: (e) => {
|
|
35
|
+
(e.key === "e" || e.key === "." && i === "integer") && e.preventDefault();
|
|
36
|
+
},
|
|
37
|
+
type: "number",
|
|
38
|
+
value: d ?? "",
|
|
39
|
+
onChange: I
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
A as NumberInput
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/NumberInput.tsx"],"sourcesContent":["import { isInteger, isNumber } from '../../../../common/guards';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\nimport { Ids } from '@/api-playground-2/types';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const NumberInput = ({\n name,\n schema,\n inputKeyPrefix,\n numberType,\n arrayIndex,\n}: InputParams & { numberType: string }) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n const placeholder = schemaPlaceholder ?? `enter ${name ?? 'value'}`;\n const schemaType = schema.type;\n\n const getSafeNumberValue = (numberType: string, value: unknown) => {\n if (numberType === 'integer') {\n return isInteger(value) ? value : undefined;\n } else {\n return isNumber(value) ? value : undefined;\n }\n };\n const safeValue = getSafeNumberValue(numberType, value);\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.value.length === 0) {\n setInput(uniqueInputKey, undefined);\n return;\n }\n\n if (schemaType === 'integer') {\n const parsedInteger = parseInt(event.target.value);\n if (isNaN(parsedInteger)) {\n return;\n }\n setInput(uniqueInputKey, parsedInteger);\n } else {\n setInput(uniqueInputKey, parseFloat(event.target.value));\n }\n };\n\n return (\n <input\n id={Ids.APIPlaygroundInput}\n className=\"mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input\"\n placeholder={placeholder}\n aria-label={schemaPlaceholder ?? locale['aria.enterValue'].replace('{name}', name ?? 'value')}\n onKeyDown={(event) => {\n // disallow \"e\", and disallow \".\" for integer inputs\n if (event.key === 'e' || (event.key === '.' && schemaType === 'integer')) {\n event.preventDefault();\n }\n }}\n type=\"number\"\n value={safeValue ?? ''}\n onChange={onChange}\n />\n );\n};\n"],"names":["NumberInput","name","schema","inputKeyPrefix","numberType","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","uniqueInputKey","getUniqueInputKey","value","placeholder","schemaType","safeValue","isInteger","isNumber","onChange","event","parsedInteger","jsx","Ids"],"mappings":";;;;;;AAWO,MAAMA,IAAc,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF,MAA4C;AAC1C,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAoBC,EAAqBV,CAAM,GAC/CW,IAAiBC,EAAkBX,GAAgBD,GAAQG,CAAU,GACrEU,IAAQP,EAASK,CAAc,GAC/BG,IAAcL,KAAqB,SAASV,KAAQ,OAAO,IAC3DgB,IAAaf,EAAO,MASpBgB,KAPqB,CAACd,GAAoBW,MAC1CX,MAAe,YACVe,EAAUJ,CAAK,IAAIA,IAAQ,SAE3BK,EAASL,CAAK,IAAIA,IAAQ,QAGAX,GAAYW,CAAK,GAEhDM,IAAW,CAACC,MAAyC;AACzD,QAAIA,EAAM,OAAO,MAAM,WAAW,GAAG;AACnC,MAAAb,EAASI,GAAgB,MAAS;AAClC;AAAA,IACF;AAEA,QAAII,MAAe,WAAW;AAC5B,YAAMM,IAAgB,SAASD,EAAM,OAAO,KAAK;AACjD,UAAI,MAAMC,CAAa;AACrB;AAEF,MAAAd,EAASI,GAAgBU,CAAa;AAAA,IACxC;AACE,MAAAd,EAASI,GAAgB,WAAWS,EAAM,OAAO,KAAK,CAAC;AAAA,EAE3D;AAEA,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAIC,EAAI;AAAA,MACR,WAAU;AAAA,MACV,aAAAT;AAAA,MACA,cAAYL,KAAqBL,EAAO,iBAAiB,EAAE,QAAQ,UAAUL,KAAQ,OAAO;AAAA,MAC5F,WAAW,CAACqB,MAAU;AAEpB,SAAIA,EAAM,QAAQ,OAAQA,EAAM,QAAQ,OAAOL,MAAe,cAC5DK,EAAM,eAAA;AAAA,MAEV;AAAA,MACA,MAAK;AAAA,MACL,OAAOJ,KAAa;AAAA,MACpB,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as r, Fragment as K, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { v4 as q } from "uuid";
|
|
4
|
+
import { isSchemaObject as u, getUniqueInputKey as b, convertAnySchemaToOneOfs as w } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { AdditionalPropertyButton as B } from "../../../../api-playground/ApiPlayground/components/AdditionalPropertyButton.js";
|
|
6
|
+
import { DifferentiatedInput as f } from "./DifferentiatedInput.js";
|
|
7
|
+
const G = ({
|
|
8
|
+
schema: t,
|
|
9
|
+
depth: s,
|
|
10
|
+
parentNames: m,
|
|
11
|
+
style: a,
|
|
12
|
+
explode: d,
|
|
13
|
+
inputKeyPrefix: e,
|
|
14
|
+
name: l
|
|
15
|
+
}) => {
|
|
16
|
+
const O = [];
|
|
17
|
+
Object.entries(t.properties ?? {}).forEach(([o, n]) => {
|
|
18
|
+
if (u(n)) {
|
|
19
|
+
const i = l ? [l] : void 0;
|
|
20
|
+
O.push(
|
|
21
|
+
/* @__PURE__ */ r(
|
|
22
|
+
f,
|
|
23
|
+
{
|
|
24
|
+
name: o,
|
|
25
|
+
schema: n,
|
|
26
|
+
depth: (s ?? 0) + 1,
|
|
27
|
+
parentNames: i,
|
|
28
|
+
style: a,
|
|
29
|
+
explode: d,
|
|
30
|
+
inputKeyPrefix: e
|
|
31
|
+
},
|
|
32
|
+
o
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const h = t.additionalProperties !== void 0 && t.additionalProperties !== !1, j = q(), [p, v] = g([]), c = [];
|
|
38
|
+
p.forEach((o) => {
|
|
39
|
+
var n;
|
|
40
|
+
if (u(t.additionalProperties)) {
|
|
41
|
+
const i = b(e, t, void 0, o);
|
|
42
|
+
c.push(
|
|
43
|
+
/* @__PURE__ */ r(
|
|
44
|
+
f,
|
|
45
|
+
{
|
|
46
|
+
name: o,
|
|
47
|
+
schema: { ...t.additionalProperties, uniqueKey: i },
|
|
48
|
+
depth: (s ?? 0) + 1,
|
|
49
|
+
parentNames: m,
|
|
50
|
+
style: a,
|
|
51
|
+
explode: d,
|
|
52
|
+
inputKeyPrefix: e
|
|
53
|
+
},
|
|
54
|
+
o
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
} else {
|
|
58
|
+
const i = b(e, t, void 0, o), y = {
|
|
59
|
+
oneOf: (n = w().oneOf) == null ? void 0 : n.map((S) => ({
|
|
60
|
+
...S,
|
|
61
|
+
uniqueKey: i
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
u(y) && c.push(
|
|
65
|
+
/* @__PURE__ */ r(
|
|
66
|
+
f,
|
|
67
|
+
{
|
|
68
|
+
name: o,
|
|
69
|
+
schema: y,
|
|
70
|
+
depth: (s ?? 0) + 1,
|
|
71
|
+
parentNames: m,
|
|
72
|
+
style: a,
|
|
73
|
+
explode: d,
|
|
74
|
+
inputKeyPrefix: e
|
|
75
|
+
},
|
|
76
|
+
o
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const P = [...O, ...c];
|
|
82
|
+
if (s === 0)
|
|
83
|
+
return /* @__PURE__ */ r(K, { children: P });
|
|
84
|
+
const A = (o) => {
|
|
85
|
+
const n = [...p, o];
|
|
86
|
+
v(n);
|
|
87
|
+
}, I = [...Object.keys(t.properties ?? {}), ...p];
|
|
88
|
+
return /* @__PURE__ */ T(K, { children: [
|
|
89
|
+
P,
|
|
90
|
+
h ? /* @__PURE__ */ r(
|
|
91
|
+
B,
|
|
92
|
+
{
|
|
93
|
+
existingKeys: I,
|
|
94
|
+
onAddKey: A,
|
|
95
|
+
dataTestId: ("name" in t && t.name ? t.name : "") + "-additional-property-button"
|
|
96
|
+
},
|
|
97
|
+
"add-property-button" + j
|
|
98
|
+
) : null
|
|
99
|
+
] });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
G as ObjectInput
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=ObjectInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/ObjectInput.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n convertAnySchemaToOneOfs,\n getUniqueInputKey,\n isSchemaObject,\n} from '@/api-playground-2/schemaGraph/utils';\nimport { AdditionalPropertyButton } from '@/api-playground/ApiPlayground/components/AdditionalPropertyButton';\n\nimport { DifferentiatedInput, InputParams } from './DifferentiatedInput';\n\nexport const ObjectInput = ({\n schema,\n depth,\n parentNames,\n style,\n explode,\n inputKeyPrefix,\n name,\n}: InputParams) => {\n const propertiesInputs: React.ReactNode[] = [];\n\n Object.entries(schema.properties ?? {}).forEach(([propName, propSchema]) => {\n if (isSchemaObject(propSchema)) {\n const newParentNames = name ? [name] : undefined;\n\n propertiesInputs.push(\n <DifferentiatedInput\n key={propName}\n name={propName}\n schema={propSchema}\n depth={(depth ?? 0) + 1}\n parentNames={newParentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n }\n });\n\n const allowsAdditionalProperties =\n schema.additionalProperties !== undefined && schema.additionalProperties !== false;\n const additionalPropButtonKey = uuidv4();\n const [additionalPropKeys, setAdditionalPropKeys] = useState<string[]>([]);\n const additionalPropertiesInputs: React.ReactNode[] = [];\n\n additionalPropKeys.forEach((key) => {\n if (isSchemaObject(schema.additionalProperties)) {\n const uniqueKey = getUniqueInputKey(inputKeyPrefix, schema, undefined, key);\n additionalPropertiesInputs.push(\n <DifferentiatedInput\n key={key}\n name={key}\n schema={{ ...schema.additionalProperties, uniqueKey }}\n depth={(depth ?? 0) + 1}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n } else {\n const uniqueKey = getUniqueInputKey(inputKeyPrefix, schema, undefined, key);\n const anySchemaToOneOfSchema = convertAnySchemaToOneOfs();\n const oneOfWithKeys = {\n oneOf: anySchemaToOneOfSchema.oneOf?.map((schema) => {\n return {\n ...schema,\n uniqueKey,\n };\n }),\n };\n\n if (isSchemaObject(oneOfWithKeys)) {\n additionalPropertiesInputs.push(\n <DifferentiatedInput\n key={key}\n name={key}\n schema={oneOfWithKeys}\n depth={(depth ?? 0) + 1}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n }\n }\n });\n\n const children = [...propertiesInputs, ...additionalPropertiesInputs];\n\n if (depth === 0) {\n return <>{children}</>;\n }\n\n const addKey = (key: string) => {\n const newAdditionalPropKeys = [...additionalPropKeys, key];\n setAdditionalPropKeys(newAdditionalPropKeys);\n };\n\n const existingKeys = [...Object.keys(schema.properties ?? {}), ...additionalPropKeys];\n\n return (\n <>\n {children}\n {allowsAdditionalProperties ? (\n <AdditionalPropertyButton\n key={'add-property-button' + additionalPropButtonKey}\n existingKeys={existingKeys}\n onAddKey={addKey}\n dataTestId={\n ('name' in schema && schema.name ? schema.name : '') + '-additional-property-button'\n }\n />\n ) : null}\n </>\n );\n};\n"],"names":["ObjectInput","schema","depth","parentNames","style","explode","inputKeyPrefix","name","propertiesInputs","propName","propSchema","isSchemaObject","newParentNames","jsx","DifferentiatedInput","allowsAdditionalProperties","additionalPropButtonKey","uuidv4","additionalPropKeys","setAdditionalPropKeys","useState","additionalPropertiesInputs","key","uniqueKey","getUniqueInputKey","oneOfWithKeys","_a","convertAnySchemaToOneOfs","children","addKey","newAdditionalPropKeys","existingKeys","jsxs","Fragment","AdditionalPropertyButton"],"mappings":"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"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { generateSimpleSchemaLabel as T, generateSchemaOptionLabels as w } from "../../EndpointFields/fields/SimpleSchemaField.js";
|
|
4
|
+
import { usePlaygroundInputsStore as D } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
5
|
+
import { isSchemaObject as L } from "../../../schemaGraph/utils.js";
|
|
6
|
+
import { TypeDropdown as j } from "../../TypeDropdown.js";
|
|
7
|
+
import { DifferentiatedInput as b } from "./DifferentiatedInput.js";
|
|
8
|
+
import { Tabs as k } from "../../../../components/content-components/tabs/tabs.js";
|
|
9
|
+
import { Tab as q } from "../../../../components/content-components/tabs/tab.js";
|
|
10
|
+
const G = ({
|
|
11
|
+
name: m,
|
|
12
|
+
schema: r,
|
|
13
|
+
clearValue: l,
|
|
14
|
+
parentNames: c,
|
|
15
|
+
style: p,
|
|
16
|
+
explode: a,
|
|
17
|
+
inputKeyPrefix: s
|
|
18
|
+
}) => {
|
|
19
|
+
const [i, S] = g(0), n = "oneOf" in r && r.oneOf ? r.oneOf.filter(L) : [], y = n.some((e) => e.type === "null"), O = n.map((e) => ({
|
|
20
|
+
label: T(e, y),
|
|
21
|
+
schema: e
|
|
22
|
+
})), t = n[i], { setInput: f } = D(), d = `${s}.${r.uniqueKey}`, u = (e) => {
|
|
23
|
+
t && "type" in t && t.type === "null" ? f(d, null) : f(d, void 0), S(e);
|
|
24
|
+
};
|
|
25
|
+
if (!t) return null;
|
|
26
|
+
if (n.every((e) => e.type === "object")) {
|
|
27
|
+
const e = w(n);
|
|
28
|
+
return /* @__PURE__ */ o(
|
|
29
|
+
k,
|
|
30
|
+
{
|
|
31
|
+
defaultTab: i,
|
|
32
|
+
onChange: u,
|
|
33
|
+
className: "mint:border-gray-100! mint:mb-4! mint:dark:border-white/10!",
|
|
34
|
+
children: e.map((h) => /* @__PURE__ */ o(q, { title: h, children: /* @__PURE__ */ o(
|
|
35
|
+
b,
|
|
36
|
+
{
|
|
37
|
+
skipContainer: !0,
|
|
38
|
+
name: m,
|
|
39
|
+
schema: t,
|
|
40
|
+
clearValue: l,
|
|
41
|
+
parentNames: c,
|
|
42
|
+
style: p,
|
|
43
|
+
explode: a,
|
|
44
|
+
inputKeyPrefix: s
|
|
45
|
+
}
|
|
46
|
+
) }, h))
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const I = O.filter(
|
|
51
|
+
({ schema: e }) => e.type !== "null"
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ o(
|
|
54
|
+
b,
|
|
55
|
+
{
|
|
56
|
+
name: m,
|
|
57
|
+
schema: t,
|
|
58
|
+
typeDropdown: /* @__PURE__ */ o(
|
|
59
|
+
j,
|
|
60
|
+
{
|
|
61
|
+
options: I,
|
|
62
|
+
selectedIndex: i,
|
|
63
|
+
onSelectOption: u
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
clearValue: l,
|
|
67
|
+
parentNames: c,
|
|
68
|
+
style: p,
|
|
69
|
+
explode: a,
|
|
70
|
+
inputKeyPrefix: s
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
G as OneOfInput
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=OneOfInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OneOfInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/OneOfInput.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport {\n generateSchemaOptionLabels,\n generateSimpleSchemaLabel,\n} from '@/api-playground-2/components/EndpointFields/fields/SimpleSchemaField';\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport { Tabs, Tab } from '../../../../components/content-components/tabs';\n\nimport { TypeDropdown } from '../../TypeDropdown';\nimport { DifferentiatedInput, InputParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const OneOfInput = ({\n name,\n schema,\n clearValue,\n parentNames,\n style,\n explode,\n inputKeyPrefix,\n}: InputParams & { value?: unknown }) => {\n const [selectedSchemaIndex, setSelectedSchemaIndex] = useState(0);\n const schemas = 'oneOf' in schema && schema.oneOf ? schema.oneOf.filter(isSchemaObject) : [];\n const nullable = schemas.some((schema) => schema.type === 'null');\n // TODO - Api Playground Refactor: equivalent of schemasWithLabelInfo from RecursiveInput\n const schemasWithLabels = schemas.map((schema) => ({\n label: generateSimpleSchemaLabel(schema, nullable),\n schema: schema,\n }));\n const selectedSchema = schemas[selectedSchemaIndex];\n\n const { setInput } = usePlaygroundInputsStore();\n const uniqueKey = `${inputKeyPrefix}.${schema.uniqueKey}`;\n\n const onSelectTypeOption = (index: number) => {\n if (selectedSchema && 'type' in selectedSchema && selectedSchema.type === 'null') {\n setInput(uniqueKey, null);\n } else {\n setInput(uniqueKey, undefined);\n }\n setSelectedSchemaIndex(index);\n };\n\n if (!selectedSchema) return null;\n\n if (schemas.every((schema) => schema.type === 'object')) {\n const oneOfOptions = generateSchemaOptionLabels(schemas);\n return (\n <Tabs\n defaultTab={selectedSchemaIndex}\n onChange={onSelectTypeOption}\n className=\"mint:border-gray-100! mint:mb-4! mint:dark:border-white/10!\"\n >\n {oneOfOptions.map((option) => (\n <Tab title={option} key={option}>\n <DifferentiatedInput\n skipContainer\n name={name}\n schema={selectedSchema}\n clearValue={clearValue}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n </Tab>\n ))}\n </Tabs>\n );\n }\n\n const filteredSchemasWithLabels = schemasWithLabels.filter(\n ({ schema }) => schema.type !== 'null'\n );\n\n const typeDropdown = (\n <TypeDropdown\n options={filteredSchemasWithLabels}\n selectedIndex={selectedSchemaIndex}\n onSelectOption={onSelectTypeOption}\n />\n );\n\n return (\n <DifferentiatedInput\n name={name}\n schema={selectedSchema}\n typeDropdown={typeDropdown}\n clearValue={clearValue}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n};\n"],"names":["OneOfInput","name","schema","clearValue","parentNames","style","explode","inputKeyPrefix","selectedSchemaIndex","setSelectedSchemaIndex","useState","schemas","isSchemaObject","nullable","schemasWithLabels","generateSimpleSchemaLabel","selectedSchema","setInput","usePlaygroundInputsStore","uniqueKey","onSelectTypeOption","index","oneOfOptions","generateSchemaOptionLabels","jsx","Tabs","option","Tab","DifferentiatedInput","filteredSchemasWithLabels","TypeDropdown"],"mappings":";;;;;;;;;AAcO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AACF,MAAyC;AACvC,QAAM,CAACC,GAAqBC,CAAsB,IAAIC,EAAS,CAAC,GAC1DC,IAAU,WAAWT,KAAUA,EAAO,QAAQA,EAAO,MAAM,OAAOU,CAAc,IAAI,CAAA,GACpFC,IAAWF,EAAQ,KAAK,CAACT,MAAWA,EAAO,SAAS,MAAM,GAE1DY,IAAoBH,EAAQ,IAAI,CAACT,OAAY;AAAA,IACjD,OAAOa,EAA0Bb,GAAQW,CAAQ;AAAA,IACjD,QAAQX;AAAAA,EAAA,EACR,GACIc,IAAiBL,EAAQH,CAAmB,GAE5C,EAAE,UAAAS,EAAA,IAAaC,EAAA,GACfC,IAAY,GAAGZ,CAAc,IAAIL,EAAO,SAAS,IAEjDkB,IAAqB,CAACC,MAAkB;AAC5C,IAAIL,KAAkB,UAAUA,KAAkBA,EAAe,SAAS,SACxEC,EAASE,GAAW,IAAI,IAExBF,EAASE,GAAW,MAAS,GAE/BV,EAAuBY,CAAK;AAAA,EAC9B;AAEA,MAAI,CAACL,EAAgB,QAAO;AAE5B,MAAIL,EAAQ,MAAM,CAACT,MAAWA,EAAO,SAAS,QAAQ,GAAG;AACvD,UAAMoB,IAAeC,EAA2BZ,CAAO;AACvD,WACE,gBAAAa;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,YAAYjB;AAAA,QACZ,UAAUY;AAAA,QACV,WAAU;AAAA,QAET,YAAa,IAAI,CAACM,MACjB,gBAAAF,EAACG,GAAA,EAAI,OAAOD,GACV,UAAA,gBAAAF;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,eAAa;AAAA,YACb,MAAA3B;AAAA,YACA,QAAQe;AAAA,YACR,YAAAb;AAAA,YACA,aAAAC;AAAA,YACA,OAAAC;AAAA,YACA,SAAAC;AAAA,YACA,gBAAAC;AAAA,UAAA;AAAA,QAAA,EACF,GAVuBmB,CAWzB,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AAEA,QAAMG,IAA4Bf,EAAkB;AAAA,IAClD,CAAC,EAAE,QAAAZ,QAAaA,EAAO,SAAS;AAAA,EAAA;AAWlC,SACE,gBAAAsB;AAAA,IAACI;AAAA,IAAA;AAAA,MACC,MAAA3B;AAAA,MACA,QAAQe;AAAA,MACR,cAXF,gBAAAQ;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,SAASD;AAAA,UACT,eAAerB;AAAA,UACf,gBAAgBY;AAAA,QAAA;AAAA,MAAA;AAAA,MAShB,YAAAjB;AAAA,MACA,aAAAC;AAAA,MACA,OAAAC;AAAA,MACA,SAAAC;AAAA,MACA,gBAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { isBoolean as S, isString as b, isNumber as v, isInteger as y } from "../../../../common/guards.js";
|
|
3
|
+
import { ChevronDownIcon as I } from "lucide-react";
|
|
4
|
+
import { usePlaygroundInputsStore as w } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
5
|
+
import { getSchemaPlaceholder as N, getUniqueInputKey as k } from "../../../schemaGraph/utils.js";
|
|
6
|
+
import { useSelectedLocale as P } from "../../../../utils/locales/index.js";
|
|
7
|
+
import { cn as j } from "../../../../utils/cn.js";
|
|
8
|
+
const U = ({
|
|
9
|
+
name: a,
|
|
10
|
+
schema: n,
|
|
11
|
+
inputKeyPrefix: u,
|
|
12
|
+
enumType: m,
|
|
13
|
+
arrayIndex: p
|
|
14
|
+
}) => {
|
|
15
|
+
const g = P(), { getInput: d, setInput: s } = w(), l = N(n), f = n.type === "boolean" ? [!0, !1] : n.enum ?? [], r = k(u, n, p), h = d(r), i = ((t, e) => {
|
|
16
|
+
switch (t) {
|
|
17
|
+
case "integer":
|
|
18
|
+
return y(e) ? e : void 0;
|
|
19
|
+
case "number":
|
|
20
|
+
return v(e) ? e : void 0;
|
|
21
|
+
case "string":
|
|
22
|
+
return b(e) ? e : void 0;
|
|
23
|
+
case "boolean":
|
|
24
|
+
return S(e) ? e : void 0;
|
|
25
|
+
default:
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
})(m, h), x = (t) => {
|
|
29
|
+
m === "boolean" ? s(r, t.target.value === "true") : s(r, t.target.value);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ c("div", { className: "mint:relative", children: [
|
|
32
|
+
/* @__PURE__ */ c(
|
|
33
|
+
"select",
|
|
34
|
+
{
|
|
35
|
+
className: j(
|
|
36
|
+
"mint:relative mint:text-playground-input mint:w-full mint:text-left mint:flex-1 mint:outline-0 mint:cursor-pointer mint:bg-transparent",
|
|
37
|
+
i !== void 0 ? "mint:text-gray-900! mint:dark:text-gray-100!" : "mint:text-gray-400! mint:dark:text-white/30!"
|
|
38
|
+
),
|
|
39
|
+
value: (i == null ? void 0 : i.toString()) ?? "",
|
|
40
|
+
"aria-label": l ?? g["aria.selectOption"].replace("{name}", a || "option"),
|
|
41
|
+
onChange: x,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ o("option", { value: "", disabled: !0, children: l ?? `select ${a || "option"}` }),
|
|
44
|
+
f.map((t) => /* @__PURE__ */ o("option", { value: t.toString(), children: t.toString() }, t.toString()))
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ o(I, { className: "mint:absolute mint:right-2 mint:top-1/2 mint:-translate-y-1/2 mint:h-4 mint:w-4 mint:text-gray-400 mint:dark:text-white/30 mint:pointer-events-none" })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
U as SelectInput
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=SelectInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/SelectInput.tsx"],"sourcesContent":["import { isString, isNumber, isInteger, isBoolean } from '../../../../common/guards';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\nimport { InputParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const SelectInput = ({\n name,\n schema,\n inputKeyPrefix,\n enumType,\n arrayIndex,\n}: InputParams & { enumType: string }) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const options = schema.type === 'boolean' ? [true, false] : schema.enum ?? [];\n\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n\n const getSafeEnumValue = (enumType: string, value: unknown) => {\n switch (enumType) {\n case 'integer': {\n return isInteger(value) ? value : undefined;\n }\n case 'number': {\n return isNumber(value) ? value : undefined;\n }\n case 'string': {\n return isString(value) ? value : undefined;\n }\n case 'boolean': {\n return isBoolean(value) ? value : undefined;\n }\n default: {\n return undefined;\n }\n }\n };\n\n const safeValue = getSafeEnumValue(enumType, value);\n\n const onChange = (event: ChangeEvent<HTMLSelectElement>) => {\n if (enumType === 'boolean') {\n setInput(uniqueInputKey, event.target.value === 'true');\n } else {\n setInput(uniqueInputKey, event.target.value);\n }\n };\n\n return (\n <div className=\"mint:relative\">\n <select\n className={cn(\n 'mint:relative mint:text-playground-input mint:w-full mint:text-left mint:flex-1 mint:outline-0 mint:cursor-pointer mint:bg-transparent',\n safeValue !== undefined\n ? 'mint:text-gray-900! mint:dark:text-gray-100!'\n : 'mint:text-gray-400! mint:dark:text-white/30!'\n )}\n value={safeValue?.toString() ?? ''}\n aria-label={\n schemaPlaceholder ?? locale['aria.selectOption'].replace('{name}', name || 'option')\n }\n onChange={onChange}\n >\n <option value=\"\" disabled>\n {schemaPlaceholder ?? `select ${name || 'option'}`}\n </option>\n {options.map((opt) => (\n <option key={opt.toString()} value={opt.toString()}>\n {opt.toString()}\n </option>\n ))}\n </select>\n <ChevronDownIcon className=\"mint:absolute mint:right-2 mint:top-1/2 mint:-translate-y-1/2 mint:h-4 mint:w-4 mint:text-gray-400 mint:dark:text-white/30 mint:pointer-events-none\" />\n </div>\n );\n};\n"],"names":["SelectInput","name","schema","inputKeyPrefix","enumType","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","options","uniqueInputKey","getUniqueInputKey","value","safeValue","isInteger","isNumber","isString","isBoolean","onChange","event","jsxs","cn","jsx","opt","ChevronDownIcon"],"mappings":";;;;;;;AAUO,MAAMA,IAAc,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AACF,MAA0C;AACxC,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAoBC,EAAqBV,CAAM,GAC/CW,IAAUX,EAAO,SAAS,YAAY,CAAC,IAAM,EAAK,IAAIA,EAAO,QAAQ,CAAA,GAErEY,IAAiBC,EAAkBZ,GAAgBD,GAAQG,CAAU,GACrEW,IAAQR,EAASM,CAAc,GAsB/BG,KApBmB,CAACb,GAAkBY,MAAmB;AAC7D,YAAQZ,GAAAA;AAAAA,MACN,KAAK;AACH,eAAOc,EAAUF,CAAK,IAAIA,IAAQ;AAAA,MAEpC,KAAK;AACH,eAAOG,EAASH,CAAK,IAAIA,IAAQ;AAAA,MAEnC,KAAK;AACH,eAAOI,EAASJ,CAAK,IAAIA,IAAQ;AAAA,MAEnC,KAAK;AACH,eAAOK,EAAUL,CAAK,IAAIA,IAAQ;AAAA,MAEpC;AACE;AAAA,IACF;AAAA,EAEJ,GAEmCZ,GAAUY,CAAK,GAE5CM,IAAW,CAACC,MAA0C;AAC1D,IAAInB,MAAa,YACfK,EAASK,GAAgBS,EAAM,OAAO,UAAU,MAAM,IAEtDd,EAASK,GAAgBS,EAAM,OAAO,KAAK;AAAA,EAE/C;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,IAAA,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACAR,MAAc,SACV,iDACA;AAAA,QAAA;AAAA,QAEN,QAAOA,KAAA,gBAAAA,EAAW,eAAc;AAAA,QAChC,cACEN,KAAqBL,EAAO,mBAAmB,EAAE,QAAQ,UAAUL,KAAQ,QAAQ;AAAA,QAErF,UAAAqB;AAAA,QAEA,UAAA;AAAA,UAAA,gBAAAI,EAAC,UAAA,EAAO,OAAM,IAAG,UAAQ,IACtB,UAAAf,KAAqB,UAAUV,KAAQ,QAAQ,GAAA,CAClD;AAAA,UACCY,EAAQ,IAAI,CAACc,MACZ,gBAAAD,EAAC,YAA4B,OAAOC,EAAI,SAAA,GACrC,YAAI,SAAA,EAAS,GADHA,EAAI,UAEjB,CACD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH,gBAAAD,EAACE,GAAA,EAAgB,WAAU,sJAAA,CAAsJ;AAAA,EAAA,GACnL;AAEJ;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as y, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { isString as I } from "../../../../common/guards.js";
|
|
3
|
+
import { usePlaygroundInputsStore as b } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getSchemaPlaceholder as P, getUniqueInputKey as S } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as j } from "../../../../utils/locales/index.js";
|
|
6
|
+
import { Ids as k } from "../../../types/index.js";
|
|
7
|
+
const A = ({ name: t, schema: i, inputKeyPrefix: p, arrayIndex: d }) => {
|
|
8
|
+
const g = j(), { getInput: f, setInput: l } = b(), s = P(i), { prefix: e, placeholder: a } = w(i.format), r = S(p, i, d), m = f(r), n = I(m) ? m : void 0, x = e && (n != null && n.startsWith(e)) ? n.substring(e.length) : n, h = (o) => {
|
|
9
|
+
const u = `${e ?? ""}${o}`;
|
|
10
|
+
u ? l(r, u) : l(r, void 0);
|
|
11
|
+
}, v = (o) => {
|
|
12
|
+
h(o.target.value);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ y("div", { className: "mint:relative mint:flex mint:flex-1 mint:items-center", children: [
|
|
15
|
+
/* @__PURE__ */ c("div", { className: "mint:absolute mint:left-2.5 mint:top-0 mint:bottom-0 mint:flex mint:items-center mint:justify-center mint:text-sm mint:text-gray-800 mint:dark:text-gray-100", children: e }),
|
|
16
|
+
/* @__PURE__ */ c(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
id: k.APIPlaygroundInput,
|
|
20
|
+
className: "mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input",
|
|
21
|
+
style: { paddingLeft: e ? e.length * 0.52 + "rem" : void 0 },
|
|
22
|
+
placeholder: s ?? a ?? `enter ${t ?? "value"}`,
|
|
23
|
+
"aria-label": s ?? a ?? g["aria.enterValue"].replace("{name}", t ?? "value"),
|
|
24
|
+
type: "text",
|
|
25
|
+
value: x ?? "",
|
|
26
|
+
onChange: v,
|
|
27
|
+
spellCheck: !1
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
}, w = (t) => {
|
|
32
|
+
switch (t == null ? void 0 : t.toLowerCase()) {
|
|
33
|
+
case "bearer":
|
|
34
|
+
return {
|
|
35
|
+
prefix: "Bearer ",
|
|
36
|
+
placeholder: "enter bearer token"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {};
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
A as StringInput
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=StringInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/StringInput.tsx"],"sourcesContent":["import { isString } from '../../../../common/guards';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\nimport { Ids } from '@/api-playground-2/types';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const StringInput = ({ name, schema, inputKeyPrefix, arrayIndex }: InputParams) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const { prefix, placeholder } = getInputAttributesForFormat(schema.format);\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n\n const safeValue = isString(value) ? value : undefined;\n\n // remove modifications\n const unmodifiedValue =\n prefix && safeValue?.startsWith(prefix) ? safeValue.substring(prefix.length) : safeValue;\n\n const setModifiedValue = (newValue: string) => {\n // apply modifications\n const modifiedValue = `${prefix ?? ''}${newValue}`;\n\n if (!modifiedValue) setInput(uniqueInputKey, undefined);\n else setInput(uniqueInputKey, modifiedValue);\n };\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n setModifiedValue(event.target.value);\n };\n\n return (\n <div className=\"mint:relative mint:flex mint:flex-1 mint:items-center\">\n <div className=\"mint:absolute mint:left-2.5 mint:top-0 mint:bottom-0 mint:flex mint:items-center mint:justify-center mint:text-sm mint:text-gray-800 mint:dark:text-gray-100\">\n {prefix}\n </div>\n <input\n id={Ids.APIPlaygroundInput}\n className=\"mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input\"\n style={{ paddingLeft: prefix ? prefix.length * 0.52 + 'rem' : undefined }}\n placeholder={schemaPlaceholder ?? placeholder ?? `enter ${name ?? 'value'}`}\n aria-label={\n schemaPlaceholder ??\n placeholder ??\n locale['aria.enterValue'].replace('{name}', name ?? 'value')\n }\n type=\"text\"\n value={unmodifiedValue ?? ''}\n onChange={onChange}\n spellCheck={false}\n />\n </div>\n );\n};\n\ntype InputAttributes = {\n prefix?: string;\n placeholder?: string;\n};\n\nconst getInputAttributesForFormat = (format: string | undefined): InputAttributes => {\n switch (format?.toLowerCase()) {\n case 'bearer':\n return {\n prefix: 'Bearer ',\n placeholder: 'enter bearer token',\n };\n }\n return {};\n};\n"],"names":["StringInput","name","schema","inputKeyPrefix","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","prefix","placeholder","getInputAttributesForFormat","uniqueInputKey","getUniqueInputKey","value","safeValue","isString","unmodifiedValue","setModifiedValue","newValue","modifiedValue","onChange","event","jsxs","jsx","Ids","format"],"mappings":";;;;;;AAWO,MAAMA,IAAc,CAAC,EAAE,MAAAC,GAAM,QAAAC,GAAQ,gBAAAC,GAAgB,YAAAC,QAA8B;AACxF,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAoBC,EAAqBT,CAAM,GAC/C,EAAE,QAAAU,GAAQ,aAAAC,EAAA,IAAgBC,EAA4BZ,EAAO,MAAM,GACnEa,IAAiBC,EAAkBb,GAAgBD,GAAQE,CAAU,GACrEa,IAAQV,EAASQ,CAAc,GAE/BG,IAAYC,EAASF,CAAK,IAAIA,IAAQ,QAGtCG,IACJR,MAAUM,KAAA,QAAAA,EAAW,WAAWN,MAAUM,EAAU,UAAUN,EAAO,MAAM,IAAIM,GAE3EG,IAAmB,CAACC,MAAqB;AAE7C,UAAMC,IAAgB,GAAGX,KAAU,EAAE,GAAGU,CAAQ;AAEhD,IAAKC,IACAf,EAASO,GAAgBQ,CAAa,IADvBf,EAASO,GAAgB,MAAS;AAAA,EAExD,GAEMS,IAAW,CAACC,MAAyC;AACzD,IAAAJ,EAAiBI,EAAM,OAAO,KAAK;AAAA,EACrC;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,gKACZ,UAAAf,GACH;AAAA,IACA,gBAAAe;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAIC,EAAI;AAAA,QACR,WAAU;AAAA,QACV,OAAO,EAAE,aAAahB,IAASA,EAAO,SAAS,OAAO,QAAQ,OAAA;AAAA,QAC9D,aAAaF,KAAqBG,KAAe,SAASZ,KAAQ,OAAO;AAAA,QACzE,cACES,KACAG,KACAR,EAAO,iBAAiB,EAAE,QAAQ,UAAUJ,KAAQ,OAAO;AAAA,QAE7D,MAAK;AAAA,QACL,OAAOmB,KAAmB;AAAA,QAC1B,UAAAI;AAAA,QACA,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ,GAOMV,IAA8B,CAACe,MAAgD;AACnF,UAAQA,KAAA,gBAAAA,EAAQ,eAAY;AAAA,IAC1B,KAAK;AACH,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,aAAa;AAAA,MAAA;AAAA,EACf;AAEJ,SAAO,CAAA;AACT;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { isString as g } from "../../../../common/guards.js";
|
|
3
|
+
import { usePlaygroundInputsStore as x } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getUniqueInputKey as d, getSchemaPlaceholder as h } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as v } from "../../../../utils/locales/index.js";
|
|
6
|
+
const b = ({ name: e, schema: t, inputKeyPrefix: r, arrayIndex: l }) => {
|
|
7
|
+
const i = v(), { getInput: m, setInput: u } = x(), n = d(r, t, l), o = m(n), s = g(o) ? o : void 0, p = (c) => {
|
|
8
|
+
u(n, c.target.value);
|
|
9
|
+
}, a = h(t);
|
|
10
|
+
return /* @__PURE__ */ f(
|
|
11
|
+
"textarea",
|
|
12
|
+
{
|
|
13
|
+
className: "mint:-mx-3.5 mint:px-3.5 mint:flex-1 mint:min-h-[2.5rem] mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input mint:resize-y",
|
|
14
|
+
rows: 2,
|
|
15
|
+
placeholder: a ?? `Enter ${e ?? "value"}`,
|
|
16
|
+
"aria-label": a ?? i["aria.enterValue"].replace("{name}", e ?? "value"),
|
|
17
|
+
value: s,
|
|
18
|
+
onChange: p,
|
|
19
|
+
spellCheck: !1,
|
|
20
|
+
autoCapitalize: "off",
|
|
21
|
+
autoComplete: "off",
|
|
22
|
+
autoCorrect: "off"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
b as TextInput
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/TextInput.tsx"],"sourcesContent":["import { isString } from '../../../../common/guards';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const TextInput = ({ name, schema, inputKeyPrefix, arrayIndex }: InputParams) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n const safeValue = isString(value) ? value : undefined;\n const onChange = (event: ChangeEvent<HTMLTextAreaElement>) => {\n setInput(uniqueInputKey, event.target.value);\n };\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n\n return (\n <textarea\n className=\"mint:-mx-3.5 mint:px-3.5 mint:flex-1 mint:min-h-[2.5rem] mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input mint:resize-y\"\n rows={2}\n placeholder={schemaPlaceholder ?? `Enter ${name ?? 'value'}`}\n aria-label={schemaPlaceholder ?? locale['aria.enterValue'].replace('{name}', name ?? 'value')}\n value={safeValue}\n onChange={onChange}\n spellCheck={false}\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n />\n );\n};\n"],"names":["TextInput","name","schema","inputKeyPrefix","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","uniqueInputKey","getUniqueInputKey","value","safeValue","isString","onChange","event","schemaPlaceholder","getSchemaPlaceholder","jsx"],"mappings":";;;;;AAUO,MAAMA,IAAY,CAAC,EAAE,MAAAC,GAAM,QAAAC,GAAQ,gBAAAC,GAAgB,YAAAC,QAA8B;AACtF,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAiBC,EAAkBR,GAAgBD,GAAQE,CAAU,GACrEQ,IAAQL,EAASG,CAAc,GAC/BG,IAAYC,EAASF,CAAK,IAAIA,IAAQ,QACtCG,IAAW,CAACC,MAA4C;AAC5D,IAAAR,EAASE,GAAgBM,EAAM,OAAO,KAAK;AAAA,EAC7C,GACMC,IAAoBC,EAAqBhB,CAAM;AAErD,SACE,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAM;AAAA,MACN,aAAaF,KAAqB,SAAShB,KAAQ,OAAO;AAAA,MAC1D,cAAYgB,KAAqBZ,EAAO,iBAAiB,EAAE,QAAQ,UAAUJ,KAAQ,OAAO;AAAA,MAC5F,OAAOY;AAAA,MACP,UAAAE;AAAA,MACA,YAAY;AAAA,MACZ,gBAAe;AAAA,MACf,cAAa;AAAA,MACb,aAAY;AAAA,IAAA;AAAA,EAAA;AAGlB;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDownFilled as d } from "@fluentui/react-icons";
|
|
3
|
+
import { DropdownMenu as c, DropdownMenuTrigger as x, DropdownMenuContent as h, DropdownMenuItem as p } from "../../components/Api/dropdown-menu.js";
|
|
4
|
+
import { cn as g } from "../../utils/cn.js";
|
|
5
|
+
const k = ({
|
|
6
|
+
options: n,
|
|
7
|
+
selectedIndex: m,
|
|
8
|
+
onSelectOption: o,
|
|
9
|
+
className: l
|
|
10
|
+
}) => {
|
|
11
|
+
const r = n.length > 1, e = n[m];
|
|
12
|
+
return /* @__PURE__ */ t(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: g(
|
|
16
|
+
"mint:relative mint:flex mint:items-center mint:px-2 mint:py-0.5 mint:text-gray-600 dark:text-gray-300 mint:hover:text-gray-950 dark:hover:text-white mint:font-medium",
|
|
17
|
+
l
|
|
18
|
+
),
|
|
19
|
+
children: /* @__PURE__ */ a(c, { children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
x,
|
|
22
|
+
{
|
|
23
|
+
disabled: !r,
|
|
24
|
+
className: "mint:font-mono mint:text-xs mint:text-gray-600 mint:dark:text-gray-300 mint:hover:text-gray-950 mint:dark:hover:text-white mint:px-2",
|
|
25
|
+
children: /* @__PURE__ */ a("div", { className: "mint:flex mint:items-center mint:gap-1.5", children: [
|
|
26
|
+
/* @__PURE__ */ t("span", { children: e == null ? void 0 : e.label }),
|
|
27
|
+
r && /* @__PURE__ */ t(d, { className: "mint:h-2.5 mint:w-2.5 mint:text-gray-500 mint:dark:text-gray-400 mint:shrink-0" })
|
|
28
|
+
] })
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ t(h, { className: "mint:min-w-24", children: n.map((s, i) => /* @__PURE__ */ t(
|
|
32
|
+
p,
|
|
33
|
+
{
|
|
34
|
+
isSelected: i === m,
|
|
35
|
+
onSelect: () => o(i),
|
|
36
|
+
className: "mint:text-xs",
|
|
37
|
+
children: s.label
|
|
38
|
+
},
|
|
39
|
+
i
|
|
40
|
+
)) })
|
|
41
|
+
] })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
k as TypeDropdown
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=TypeDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeDropdown.js","sources":["../../../src/api-playground-2/components/TypeDropdown.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDownFilled } from '@fluentui/react-icons';\n\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@/components/Api/dropdown-menu';\nimport { cn } from \"../../utils/cn\";\n\n// the same as components/TypeDropdown, but for using SchemaObjects and prefilled labels\ntype TypeDropdownParams = {\n options: { label: string; schema: ResolvedSchemaObject }[];\n selectedIndex: number;\n onSelectOption: (index: number) => void;\n className?: string;\n};\n\nexport const TypeDropdown = ({\n options,\n selectedIndex,\n onSelectOption,\n className,\n}: TypeDropdownParams) => {\n const displayOptions = options.length > 1;\n const selectedOption = options[selectedIndex];\n\n return (\n <div\n className={cn(\n 'mint:relative mint:flex mint:items-center mint:px-2 mint:py-0.5 mint:text-gray-600 dark:text-gray-300 mint:hover:text-gray-950 dark:hover:text-white mint:font-medium',\n className\n )}\n >\n <DropdownMenu>\n <DropdownMenuTrigger\n disabled={!displayOptions}\n className=\"mint:font-mono mint:text-xs mint:text-gray-600 mint:dark:text-gray-300 mint:hover:text-gray-950 mint:dark:hover:text-white mint:px-2\"\n >\n <div className=\"mint:flex mint:items-center mint:gap-1.5\">\n <span>{selectedOption?.label}</span>\n {displayOptions && (\n <ChevronDownFilled className=\"mint:h-2.5 mint:w-2.5 mint:text-gray-500 mint:dark:text-gray-400 mint:shrink-0\" />\n )}\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent className=\"mint:min-w-24\">\n {options.map((option, index) => (\n <DropdownMenuItem\n key={index}\n isSelected={index === selectedIndex}\n onSelect={() => onSelectOption(index)}\n className=\"mint:text-xs\"\n >\n {option.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n"],"names":["TypeDropdown","options","selectedIndex","onSelectOption","className","displayOptions","selectedOption","jsx","cn","DropdownMenu","DropdownMenuTrigger","jsxs","ChevronDownFilled","DropdownMenuContent","option","index","DropdownMenuItem"],"mappings":";;;;AAqBO,MAAMA,IAAe,CAAC;AAAA,EAC3B,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AACF,MAA0B;AACxB,QAAMC,IAAiBJ,EAAQ,SAAS,GAClCK,IAAiBL,EAAQC,CAAa;AAE5C,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAGF,4BAACK,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,UAAU,CAACL;AAAA,YACX,WAAU;AAAA,YAEV,UAAA,gBAAAM,EAAC,OAAA,EAAI,WAAU,4CACb,UAAA;AAAA,cAAA,gBAAAJ,EAAC,QAAA,EAAM,iCAAgB,MAAA,CAAM;AAAA,cAC5BF,KACC,gBAAAE,EAACK,GAAA,EAAkB,WAAU,iFAAA,CAAiF;AAAA,YAAA,EAAA,CAElH;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAL,EAACM,KAAoB,WAAU,iBAC5B,YAAQ,IAAI,CAACC,GAAQC,MACpB,gBAAAR;AAAA,UAACS;AAAA,UAAA;AAAA,YAEC,YAAYD,MAAUb;AAAA,YACtB,UAAU,MAAMC,EAAeY,CAAK;AAAA,YACpC,WAAU;AAAA,YAET,UAAAD,EAAO;AAAA,UAAA;AAAA,UALHC;AAAA,QAAA,CAOR,EAAA,CACH;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const e = {
|
|
1
|
+
const e = "$circularRef", r = ["binary", "base64"], o = {
|
|
2
2
|
server: {},
|
|
3
3
|
path: {},
|
|
4
4
|
query: {},
|
|
5
5
|
header: {},
|
|
6
6
|
cookie: {},
|
|
7
7
|
body: void 0
|
|
8
|
-
},
|
|
8
|
+
}, a = {
|
|
9
9
|
server: "server",
|
|
10
10
|
path: "path",
|
|
11
11
|
query: "query",
|
|
@@ -14,7 +14,9 @@ const e = {
|
|
|
14
14
|
body: "body"
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
e as CIRCULAR_REF_KEY,
|
|
18
|
+
a as apiPlaygroundInputKeys,
|
|
19
|
+
o as initialApiPlaygroundInputs,
|
|
20
|
+
r as stringFileFormats
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api-playground-2/constants/index.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\n\nexport const MAX_RECURSION_DEPTH = 10;\nexport const MAX_SCHEMA_COMBINATION_SIZE = 1000;\nexport const CIRCULAR_REF_KEY = '$circularRef';\nexport const stringFileFormats = ['binary', 'base64'];\n\nexport const combinationKeys = [\n 'properties',\n 'additionalProperties',\n 'items',\n 'oneOf',\n 'anyOf',\n 'allOf',\n];\n\n// duplicated from ApiPlaygroundInputsContext.tsx\nexport const initialApiPlaygroundInputs: ApiPlaygroundInputs = {\n server: {},\n path: {},\n query: {},\n header: {},\n cookie: {},\n body: undefined,\n};\n\nexport const apiPlaygroundInputKeys = {\n server: 'server',\n path: 'path',\n query: 'query',\n header: 'header',\n cookie: 'cookie',\n body: 'body',\n};\n"],"names":["initialApiPlaygroundInputs","apiPlaygroundInputKeys"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api-playground-2/constants/index.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\n\nexport const MAX_RECURSION_DEPTH = 10;\nexport const MAX_SCHEMA_COMBINATION_SIZE = 1000;\nexport const CIRCULAR_REF_KEY = '$circularRef';\nexport const stringFileFormats = ['binary', 'base64'];\n\nexport const combinationKeys = [\n 'properties',\n 'additionalProperties',\n 'items',\n 'oneOf',\n 'anyOf',\n 'allOf',\n];\n\n// duplicated from ApiPlaygroundInputsContext.tsx\nexport const initialApiPlaygroundInputs: ApiPlaygroundInputs = {\n server: {},\n path: {},\n query: {},\n header: {},\n cookie: {},\n body: undefined,\n};\n\nexport const apiPlaygroundInputKeys = {\n server: 'server',\n path: 'path',\n query: 'query',\n header: 'header',\n cookie: 'cookie',\n body: 'body',\n};\n"],"names":["CIRCULAR_REF_KEY","stringFileFormats","initialApiPlaygroundInputs","apiPlaygroundInputKeys"],"mappings":"AAIO,MAAMA,IAAmB,gBACnBC,IAAoB,CAAC,UAAU,QAAQ,GAYvCC,IAAkD;AAAA,EAC7D,QAAQ,CAAA;AAAA,EACR,MAAM,CAAA;AAAA,EACN,OAAO,CAAA;AAAA,EACP,QAAQ,CAAA;AAAA,EACR,QAAQ,CAAA;AAAA,EACR,MAAM;AACR,GAEaC,IAAyB;AAAA,EACpC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACR;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
const t = e({
|
|
3
|
+
isSending: !1,
|
|
4
|
+
selectedBaseUrlIndex: 0,
|
|
5
|
+
isPlaygroundExpanded: !1,
|
|
6
|
+
selectedExampleIndex: 0
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
t as ApiPlaygroundContext
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=ApiPlaygroundContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiPlaygroundContext.js","sources":["../../../src/api-playground-2/contexts/ApiPlaygroundContext.tsx"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundResultType } from '@mintlify/models';\nimport { createContext } from 'react';\n\n// duplicate of apps/client/src/api-playground/ApiPlayground/ApiPlaygroundContext.tsx\nexport type ApiPlaygroundContextType = {\n isSending?: boolean;\n sendRequest?: () => void;\n isPlaygroundExpanded: boolean;\n result?: ApiPlaygroundResultType;\n selectedBaseUrlIndex: number;\n setSelectedBaseUrlIndex?: (index: number) => void;\n setIsPlaygroundExpanded?: (expanded: boolean) => void;\n baseUrlOptions?: string[];\n selectedExampleIndex?: number;\n setSelectedExampleIndex?: (index: number) => void;\n};\n\nexport const ApiPlaygroundContext = createContext<ApiPlaygroundContextType>({\n isSending: false,\n selectedBaseUrlIndex: 0,\n isPlaygroundExpanded: false,\n selectedExampleIndex: 0,\n});\n"],"names":["ApiPlaygroundContext","createContext"],"mappings":";AAmBO,MAAMA,IAAuBC,EAAwC;AAAA,EAC1E,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,sBAAsB;AACxB,CAAC;"}
|
|
@@ -19,7 +19,7 @@ const I = async ({
|
|
|
19
19
|
((c = (p = e.dependencies) == null ? void 0 : p.requestBody) == null ? void 0 : c.content) ?? {}
|
|
20
20
|
);
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
22
|
+
const i = x({
|
|
23
23
|
baseUrl: n,
|
|
24
24
|
apiReferenceData: e,
|
|
25
25
|
inputs: o,
|
|
@@ -27,13 +27,13 @@ const I = async ({
|
|
|
27
27
|
selectedBodyContentType: y,
|
|
28
28
|
requiredOnly: u,
|
|
29
29
|
selectedSecurityOptionIndex: d
|
|
30
|
-
}),
|
|
31
|
-
if (
|
|
30
|
+
}), a = q[l];
|
|
31
|
+
if (a == null)
|
|
32
32
|
return;
|
|
33
|
-
const [t] =
|
|
34
|
-
request:
|
|
33
|
+
const [t] = B({
|
|
34
|
+
request: i,
|
|
35
35
|
pathInputs: o.path,
|
|
36
|
-
snippetPresets: [
|
|
36
|
+
snippetPresets: [a],
|
|
37
37
|
apiReferenceData: e
|
|
38
38
|
});
|
|
39
39
|
if (t)
|