@mintlify/msft-sdk 1.1.23 → 1.1.25

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.
Files changed (356) hide show
  1. package/dist/api-playground/ApiPlayground/Request/BodySection.js +65 -0
  2. package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -0
  3. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +33 -0
  4. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -0
  5. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +202 -0
  6. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -0
  7. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +147 -0
  8. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -0
  9. package/dist/api-playground/ApiPlayground/Request/ServerSection.js +31 -0
  10. package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -0
  11. package/dist/api-playground/ApiPlayground/Request/index.js +44 -0
  12. package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -0
  13. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +94 -0
  14. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -0
  15. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +91 -0
  16. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +1 -0
  17. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +63 -0
  18. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -0
  19. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +34 -0
  20. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -0
  21. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +62 -0
  22. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -0
  23. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +110 -0
  24. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +1 -0
  25. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +88 -0
  26. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -0
  27. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +62 -0
  28. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -0
  29. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +55 -0
  30. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -0
  31. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +68 -0
  32. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -0
  33. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +45 -0
  34. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -0
  35. package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +7 -0
  36. package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -0
  37. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +45 -0
  38. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -0
  39. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +54 -0
  40. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -0
  41. package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +15 -0
  42. package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -0
  43. package/dist/api-playground/ApiPlayground/Response/ResponseError.js +14 -0
  44. package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -0
  45. package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +12 -0
  46. package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -0
  47. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +20 -0
  48. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -0
  49. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +21 -0
  50. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -0
  51. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +93 -0
  52. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -0
  53. package/dist/api-playground/ApiPlayground/Response/index.js +80 -0
  54. package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -0
  55. package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +24 -0
  56. package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +1 -0
  57. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +45 -0
  58. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -0
  59. package/dist/api-playground/ApiPlayground/components/ArrayCount.js +18 -0
  60. package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -0
  61. package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +40 -0
  62. package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +1 -0
  63. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +43 -0
  64. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -0
  65. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +44 -0
  66. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -0
  67. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +39 -0
  68. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +1 -0
  69. package/dist/api-playground/ApiPlayground/components/InputContainer.js +129 -0
  70. package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -0
  71. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +60 -0
  72. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -0
  73. package/dist/api-playground/ApiPlayground/components/ModalHeader.js +16 -0
  74. package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +1 -0
  75. package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +29 -0
  76. package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -0
  77. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +20 -0
  78. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +1 -0
  79. package/dist/api-playground/ApiPlayground/components/PathHeader.js +163 -0
  80. package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -0
  81. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +59 -0
  82. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -0
  83. package/dist/api-playground/ApiPlayground/components/PrettyPath.js +50 -0
  84. package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +1 -0
  85. package/dist/api-playground/ApiPlayground/components/SendPill.js +40 -0
  86. package/dist/api-playground/ApiPlayground/components/SendPill.js.map +1 -0
  87. package/dist/api-playground/ApiPlayground/components/TrashButton.js +27 -0
  88. package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -0
  89. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +53 -0
  90. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -0
  91. package/dist/api-playground/ApiPlayground/index.js +68 -0
  92. package/dist/api-playground/ApiPlayground/index.js.map +1 -0
  93. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +51 -0
  94. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +1 -0
  95. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +20 -0
  96. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +1 -0
  97. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +19 -0
  98. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -0
  99. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +29 -0
  100. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -0
  101. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +6 -0
  102. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -0
  103. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +13 -0
  104. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -0
  105. package/dist/api-playground/EndpointFields/components/Description.js +13 -0
  106. package/dist/api-playground/EndpointFields/components/Description.js.map +1 -0
  107. package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +20 -0
  108. package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -0
  109. package/dist/api-playground/EndpointFields/components/OptionDropdown.js +36 -0
  110. package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -0
  111. package/dist/api-playground/EndpointFields/components/SectionHeading.js +44 -0
  112. package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -0
  113. package/dist/api-playground/EndpointFields/index.js +7 -0
  114. package/dist/api-playground/EndpointFields/index.js.map +1 -0
  115. package/dist/api-playground-2/Api.js +13 -0
  116. package/dist/api-playground-2/Api.js.map +1 -0
  117. package/dist/api-playground-2/ApiExamples.js +19 -18
  118. package/dist/api-playground-2/ApiExamples.js.map +1 -1
  119. package/dist/api-playground-2/ApiFields.js +253 -0
  120. package/dist/api-playground-2/ApiFields.js.map +1 -0
  121. package/dist/api-playground-2/EndpointHeader.js +52 -0
  122. package/dist/api-playground-2/EndpointHeader.js.map +1 -0
  123. package/dist/api-playground-2/OperationPage.js +101 -0
  124. package/dist/api-playground-2/OperationPage.js.map +1 -0
  125. package/dist/api-playground-2/Playground.js +136 -0
  126. package/dist/api-playground-2/Playground.js.map +1 -0
  127. package/dist/api-playground-2/SchemaPage.js +14 -0
  128. package/dist/api-playground-2/SchemaPage.js.map +1 -0
  129. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +88 -0
  130. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -0
  131. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +16 -0
  132. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +1 -0
  133. package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +21 -0
  134. package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -0
  135. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +57 -0
  136. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -0
  137. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +90 -0
  138. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -0
  139. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +122 -0
  140. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -0
  141. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +75 -0
  142. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -0
  143. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +253 -0
  144. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +1 -0
  145. package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +28 -0
  146. package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -0
  147. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +101 -114
  148. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
  149. package/dist/api-playground-2/components/Request/BodySection.js +41 -0
  150. package/dist/api-playground-2/components/Request/BodySection.js.map +1 -0
  151. package/dist/api-playground-2/components/Request/InputSectionContainer.js +66 -0
  152. package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -0
  153. package/dist/api-playground-2/components/Request/ParameterSection.js +36 -0
  154. package/dist/api-playground-2/components/Request/ParameterSection.js.map +1 -0
  155. package/dist/api-playground-2/components/Request/SecuritySection.js +55 -0
  156. package/dist/api-playground-2/components/Request/SecuritySection.js.map +1 -0
  157. package/dist/api-playground-2/components/Request/ServerSection.js +33 -0
  158. package/dist/api-playground-2/components/Request/ServerSection.js.map +1 -0
  159. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +55 -0
  160. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +1 -0
  161. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +48 -0
  162. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +1 -0
  163. package/dist/api-playground-2/components/Request/inputs/FileInput.js +43 -0
  164. package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +1 -0
  165. package/dist/api-playground-2/components/Request/inputs/InputContainer.js +127 -0
  166. package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +1 -0
  167. package/dist/api-playground-2/components/Request/inputs/NullInput.js +15 -0
  168. package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +1 -0
  169. package/dist/api-playground-2/components/Request/inputs/NumberInput.js +46 -0
  170. package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +1 -0
  171. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +104 -0
  172. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +1 -0
  173. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +77 -0
  174. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +1 -0
  175. package/dist/api-playground-2/components/Request/inputs/SelectInput.js +54 -0
  176. package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +1 -0
  177. package/dist/api-playground-2/components/Request/inputs/StringInput.js +44 -0
  178. package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +1 -0
  179. package/dist/api-playground-2/components/Request/inputs/TextInput.js +29 -0
  180. package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +1 -0
  181. package/dist/api-playground-2/components/TypeDropdown.js +48 -0
  182. package/dist/api-playground-2/components/TypeDropdown.js.map +1 -0
  183. package/dist/api-playground-2/constants/index.js +15 -4
  184. package/dist/api-playground-2/constants/index.js.map +1 -1
  185. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +11 -0
  186. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -0
  187. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +6 -6
  188. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
  189. package/dist/api-playground-2/generators/generateSnippet.js +187 -36
  190. package/dist/api-playground-2/generators/generateSnippet.js.map +1 -1
  191. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +14 -0
  192. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +1 -0
  193. package/dist/api-playground-2/hooks/useInitializeInputs.js +101 -0
  194. package/dist/api-playground-2/hooks/useInitializeInputs.js.map +1 -0
  195. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +156 -0
  196. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -0
  197. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +57 -0
  198. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +1 -0
  199. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +41 -0
  200. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js.map +1 -0
  201. package/dist/api-playground-2/schemaGraph/errors.js +19 -0
  202. package/dist/api-playground-2/schemaGraph/errors.js.map +1 -0
  203. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js +26 -0
  204. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js.map +1 -0
  205. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js +58 -0
  206. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js.map +1 -0
  207. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +77 -0
  208. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js.map +1 -0
  209. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js +16 -0
  210. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js.map +1 -0
  211. package/dist/api-playground-2/schemaGraph/processExamples.js +118 -8
  212. package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
  213. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +107 -0
  214. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +1 -0
  215. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +283 -0
  216. package/dist/api-playground-2/schemaGraph/reduceCompositions.js.map +1 -0
  217. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js +61 -0
  218. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js.map +1 -0
  219. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +149 -0
  220. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js.map +1 -0
  221. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +33 -0
  222. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js.map +1 -0
  223. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +35 -0
  224. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js.map +1 -0
  225. package/dist/api-playground-2/schemaGraph/utils.js +243 -45
  226. package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
  227. package/dist/api-playground-2/types/index.js +118 -0
  228. package/dist/api-playground-2/types/index.js.map +1 -0
  229. package/dist/common/guards.js +32 -6
  230. package/dist/common/guards.js.map +1 -1
  231. package/dist/common/parseApiTargetFromMetadata.js +24 -0
  232. package/dist/common/parseApiTargetFromMetadata.js.map +1 -0
  233. package/dist/common/parseOpenApiString.js +42 -0
  234. package/dist/common/parseOpenApiString.js.map +1 -0
  235. package/dist/common/potentiallyParseOpenApiString.js +25 -0
  236. package/dist/common/potentiallyParseOpenApiString.js.map +1 -0
  237. package/dist/common/replaceSlashIndex.js +7 -0
  238. package/dist/common/replaceSlashIndex.js.map +1 -0
  239. package/dist/common/slugToTitle.js +11 -0
  240. package/dist/common/slugToTitle.js.map +1 -0
  241. package/dist/components/Api/ApiReferenceProvider.js +6 -15
  242. package/dist/components/Api/ApiReferenceProvider.js.map +1 -1
  243. package/dist/components/Api/Expandable.js +119 -0
  244. package/dist/components/Api/Expandable.js.map +1 -0
  245. package/dist/components/Api/Markdown.js +66 -0
  246. package/dist/components/Api/Markdown.js.map +1 -0
  247. package/dist/components/Api/Param.js +191 -0
  248. package/dist/components/Api/Param.js.map +1 -0
  249. package/dist/components/content-components/code-block.js +68 -61
  250. package/dist/components/content-components/code-block.js.map +1 -1
  251. package/dist/components/content-components/code-group.js +36 -25
  252. package/dist/components/content-components/code-group.js.map +1 -1
  253. package/dist/components/content-components/getNodeText.js +5 -0
  254. package/dist/components/content-components/getNodeText.js.map +1 -0
  255. package/dist/components/nav-tree/index.js +135 -109
  256. package/dist/components/nav-tree/index.js.map +1 -1
  257. package/dist/constants/index.js +5 -0
  258. package/dist/constants/index.js.map +1 -0
  259. package/dist/constants/zIndex.js +7 -0
  260. package/dist/constants/zIndex.js.map +1 -0
  261. package/dist/contexts/ApiPlaygroundInputsContext.js +18 -0
  262. package/dist/contexts/ApiPlaygroundInputsContext.js.map +1 -0
  263. package/dist/contexts/ConfigContext.js +60 -12
  264. package/dist/contexts/ConfigContext.js.map +1 -1
  265. package/dist/contexts/EndpointLocationContext.js +18 -0
  266. package/dist/contexts/EndpointLocationContext.js.map +1 -0
  267. package/dist/contexts/MDXContentContext.js +18 -0
  268. package/dist/contexts/MDXContentContext.js.map +1 -0
  269. package/dist/env.js +6 -1
  270. package/dist/env.js.map +1 -1
  271. package/dist/hooks/useApiPlaygroundInputs.js +7 -0
  272. package/dist/hooks/useApiPlaygroundInputs.js.map +1 -0
  273. package/dist/hooks/useApiPlaygroundPrefillExamples.js +40 -0
  274. package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +1 -0
  275. package/dist/hooks/useBaseUrlOptions.js +19 -0
  276. package/dist/hooks/useBaseUrlOptions.js.map +1 -0
  277. package/dist/hooks/useCheckHash.js +18 -0
  278. package/dist/hooks/useCheckHash.js.map +1 -0
  279. package/dist/hooks/useComponentSchemas.js +10 -0
  280. package/dist/hooks/useComponentSchemas.js.map +1 -0
  281. package/dist/hooks/useEndpoint.js +3 -3
  282. package/dist/hooks/useExpandableMemory.js +46 -0
  283. package/dist/hooks/useExpandableMemory.js.map +1 -0
  284. package/dist/hooks/useGenerateNextAdditionalProperties.js +12 -0
  285. package/dist/hooks/useGenerateNextAdditionalProperties.js.map +1 -0
  286. package/dist/hooks/useGenerateNextItems.js +12 -0
  287. package/dist/hooks/useGenerateNextItems.js.map +1 -0
  288. package/dist/hooks/useGenerateNextProperties.js +12 -0
  289. package/dist/hooks/useGenerateNextProperties.js.map +1 -0
  290. package/dist/hooks/useKeyboardShortcut.js +26 -0
  291. package/dist/hooks/useKeyboardShortcut.js.map +1 -0
  292. package/dist/hooks/useMDXContent.js +7 -0
  293. package/dist/hooks/useMDXContent.js.map +1 -0
  294. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +10 -0
  295. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -0
  296. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +16 -0
  297. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -0
  298. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +16 -0
  299. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -0
  300. package/dist/hooks/usePlaygroundSchemaOptions.js +43 -0
  301. package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -0
  302. package/dist/hooks/usePrefilledInputs/index.js +66 -0
  303. package/dist/hooks/usePrefilledInputs/index.js.map +1 -0
  304. package/dist/hooks/usePrefilledInputs/storedServerVariables.js +30 -0
  305. package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -0
  306. package/dist/hooks/useSecurityOption.js +11 -0
  307. package/dist/hooks/useSecurityOption.js.map +1 -0
  308. package/dist/hooks/useSendPlaygroundRequest.js +146 -15
  309. package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
  310. package/dist/hooks/useSetDefaultValue.js +64 -0
  311. package/dist/hooks/useSetDefaultValue.js.map +1 -0
  312. package/dist/index.d.ts +404 -7
  313. package/dist/index.js +159 -112
  314. package/dist/index.js.map +1 -1
  315. package/dist/openapi/filterEnums.js +21 -0
  316. package/dist/openapi/filterEnums.js.map +1 -0
  317. package/dist/openapi/generateNextAdditionalProperties.js +8 -0
  318. package/dist/openapi/generateNextAdditionalProperties.js.map +1 -0
  319. package/dist/openapi/generateNextItems.js +8 -0
  320. package/dist/openapi/generateNextItems.js.map +1 -0
  321. package/dist/openapi/generateNextProperties.js +24 -0
  322. package/dist/openapi/generateNextProperties.js.map +1 -0
  323. package/dist/openapi/generateOptionLabels.js +21 -0
  324. package/dist/openapi/generateOptionLabels.js.map +1 -0
  325. package/dist/openapi/generateSimpleLabels.js +5 -0
  326. package/dist/openapi/generateSimpleLabels.js.map +1 -0
  327. package/dist/openapi/generateTypeStringFromSchema.js +34 -0
  328. package/dist/openapi/generateTypeStringFromSchema.js.map +1 -0
  329. package/dist/openapi/getAuthFilteredSchemaArray.js +19 -0
  330. package/dist/openapi/getAuthFilteredSchemaArray.js.map +1 -0
  331. package/dist/paths/isEqualIgnoringLeadingSlash.js +22 -0
  332. package/dist/paths/isEqualIgnoringLeadingSlash.js.map +1 -0
  333. package/dist/paths/optionallyRemoveLeadingSlash.js +7 -0
  334. package/dist/paths/optionallyRemoveLeadingSlash.js.map +1 -0
  335. package/dist/paths/optionallyRemoveTrailingSlash.js +7 -0
  336. package/dist/paths/optionallyRemoveTrailingSlash.js.map +1 -0
  337. package/dist/styles.css +1 -1
  338. package/dist/utils/api-playground/defaults.js +16 -0
  339. package/dist/utils/api-playground/defaults.js.map +1 -0
  340. package/dist/utils/api-playground/paramFieldDefaults.js +11 -0
  341. package/dist/utils/api-playground/paramFieldDefaults.js.map +1 -0
  342. package/dist/utils/api-reference/getFilteredSecurityOptions.js +5 -0
  343. package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +1 -0
  344. package/dist/utils/api-reference/getNextPropertiesByType.js +6 -0
  345. package/dist/utils/api-reference/getNextPropertiesByType.js.map +1 -0
  346. package/dist/utils/containsMarkdownTable.js +5 -0
  347. package/dist/utils/containsMarkdownTable.js.map +1 -0
  348. package/dist/utils/copyToClipboard.js +12 -0
  349. package/dist/utils/copyToClipboard.js.map +1 -0
  350. package/dist/utils/flattenObject.js +11 -0
  351. package/dist/utils/flattenObject.js.map +1 -0
  352. package/dist/utils/formatJSON.js +39 -0
  353. package/dist/utils/formatJSON.js.map +1 -0
  354. package/dist/utils/scrollElementIntoView.js +21 -0
  355. package/dist/utils/scrollElementIntoView.js.map +1 -0
  356. package/package.json +10 -10
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSendPlaygroundRequest.js","sources":["../../../src/api-playground-2/hooks/useSendPlaygroundRequest.ts"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundResultType } from '@mintlify/models';\nimport { HttpMethod } from '@mintlify/validation';\nimport { AxiosResponse } from 'axios';\nimport { useCallback } from 'react';\nimport { NEXT_PUBLIC } from '@/env';\n\n\nimport { ApiReferenceDataV2 } from '../types';\nimport { usePlaygroundInputsStore } from './usePlaygroundInputsStore';\n\nexport type UseSendPlaygroundRequestProps = {\n apiReferenceData: ApiReferenceDataV2;\n baseUrl: string | undefined;\n contentType: string | undefined;\n setResult: (result: ApiPlaygroundResultType) => void;\n setIsSending: (isSending: boolean) => void;\n};\n\nexport type RequestInfo = {\n method: HttpMethod;\n url: string;\n header: Record<string, unknown>;\n query: Record<string, unknown>;\n cookie: Record<string, unknown>;\n body: unknown;\n};\n\nexport const useSendPlaygroundRequest = ({\n apiReferenceData,\n baseUrl,\n contentType = 'application/json',\n setResult,\n setIsSending,\n}: UseSendPlaygroundRequestProps) => {\n // replace with msft analytics \n const { getApiPlaygroundInputs } = usePlaygroundInputsStore();\n const inputs = getApiPlaygroundInputs();\n\n const disableProxy = apiReferenceData.operation?.disableProxy;\n const path = apiReferenceData.operation?.path;\n const method = apiReferenceData.operation?.method;\n\n return useCallback(async () => {\n setIsSending(true);\n if (!path || !baseUrl || !method || !contentType || !baseUrl) {\n setIsSending(false);\n setResult({\n error: true,\n errorMessage: 'Missing required fields to send a playground request',\n });\n console.error(\n `Missing some required field to send a playground request:\\n\\npath=${path}\\nmethod=${method}\\ncontentType=${contentType}\\nbaseUrl=${baseUrl}`\n );\n return;\n }\n const axios = await import('axios').then((x) => x.default);\n\n const pathWithInputs = addPathParams(path, inputs.path);\n\n const url = joinWithSingleSlash(addServerVariables(baseUrl, inputs.server), pathWithInputs);\n\n const headers = addContentType(inputs.header, contentType);\n\n const request: RequestInfo = {\n method,\n url,\n header: headers,\n body: inputs.body,\n cookie: inputs.cookie,\n query: inputs.query,\n };\n\n try {\n if (disableProxy) {\n const response = await performDirectRequest(request);\n setResult({\n error: false,\n response: {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n data: response.data,\n },\n });\n } else {\n if (contentType && contentType.includes('multipart/form-data')) {\n const data = await performFileRequest(request);\n\n setResult(data);\n } else {\n const { data } = await axios.post<unknown, AxiosResponse<ApiPlaygroundResultType>>(\n `${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/request`,\n request\n );\n setResult(data);\n }\n }\n } catch (err) {\n setResult({\n error: true,\n errorMessage: 'unable to complete request',\n });\n console.error(err);\n }\n setIsSending(false);\n }, [\n method,\n path,\n setIsSending,\n inputs,\n baseUrl,\n contentType,\n disableProxy,\n setResult,\n ]);\n};\n\nexport const addPathParams = (path: string, pathInputs: Record<string, unknown>) => {\n return Object.entries(pathInputs).reduce((path, [inputName, inputValue]) => {\n if (inputValue == undefined) return path;\n return path.replace(`{${inputName}}`, encodeURIComponent(inputValue.toString()));\n }, path);\n};\n\nexport const addServerVariables = (baseUrl: string, variables: Record<string, string>): string => {\n let url = baseUrl;\n Object.entries(variables).forEach(([key, input]) => {\n if (input) url = url.replace(`{${key}}`, input);\n });\n return url;\n};\n\nexport const joinWithSingleSlash = (baseUrl: string, path: string): string => {\n // remove the last slash of the baseUrl and the first slash of the path, and join with slash\n return baseUrl.replace(/\\/$/, '') + '/' + path.replace(/^\\//, '');\n};\n\nconst addContentType = (headers: Record<string, unknown>, contentType: string) => {\n if (Object.keys(headers).some((name) => name.toLowerCase() === 'content-type')) {\n return headers;\n }\n\n return {\n ...headers,\n ['content-type']: contentType,\n };\n};\n\nconst performDirectRequest = async (request: RequestInfo) => {\n const axios = await import('axios').then((it) => it.default);\n\n const contentType = Object.keys(request.header).find(\n (key) => key.toLowerCase() === 'content-type'\n );\n let data = request.body;\n \n let headers = request.header as Record<string, string>;\n if (contentType?.includes('multipart/form-data')) {\n const { data: formData, headers: formHeaders } = handleFormData(request);\n data = formData;\n headers = formHeaders;\n }\n\n return axios({\n url: request.url,\n method: request.method,\n params: request.query,\n data,\n headers,\n // prevent axios from adding [] after array query params\n paramsSerializer: {\n indexes: null,\n },\n responseType: 'arraybuffer',\n // prevent axios from erroring on bad status codes\n validateStatus: () => true,\n // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding\n // we can't use `responseEncoding` as it's ignored client-side\n transformResponse: (data) => {\n return Buffer.from(data).toString('base64');\n },\n });\n};\n\nconst performFileRequest = async (request: RequestInfo) => {\n const axios = await import('axios').then((it) => it.default);\n const formData = new FormData();\n formData.append(\n 'requestInfo',\n JSON.stringify({\n method: request.method,\n url: request.url,\n header: request.header,\n query: request.query,\n cookie: request.cookie,\n })\n );\n if (typeof request.body === 'object' && request.body !== null) {\n Object.entries(request.body).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(key, typeof item === 'object' ? JSON.stringify(item) : item.toString());\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(key, typeof value === 'object' ? JSON.stringify(value) : value.toString());\n }\n });\n }\n\n const { data } = await axios.post<unknown, AxiosResponse<ApiPlaygroundResultType>>(\n `${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/file-request`,\n formData\n );\n return data;\n};\n\nconst handleFormData = (request: RequestInfo) => {\n let data = request.body;\n \n const headers = request.header as Record<string, string>;\n\n if (headers['content-type']?.includes('multipart/form-data')) {\n const formData = new FormData();\n if (typeof data === 'object' && data !== null) {\n Object.entries(data).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === 'object' ? JSON.stringify(item) : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === 'object' ? JSON.stringify(value) : value.toString()\n );\n }\n });\n data = formData;\n delete headers['content-type'];\n }\n }\n return { data, headers };\n};\n"],"names":["useSendPlaygroundRequest","apiReferenceData","baseUrl","contentType","setResult","setIsSending","getApiPlaygroundInputs","usePlaygroundInputsStore","inputs","disableProxy","_a","path","_b","method","_c","useCallback","axios","x","pathWithInputs","addPathParams","url","joinWithSingleSlash","addServerVariables","headers","addContentType","request","response","performDirectRequest","data","performFileRequest","NEXT_PUBLIC","err","pathInputs","inputName","inputValue","variables","key","input","name","it","formData","formHeaders","handleFormData","value","item"],"mappings":";;;AA6BO,MAAMA,IAA2B,CAAC;AAAA,EACvC,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC;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,MAGtE,CAAC,IAC+BD,KAAU,QAC1CH,EAAS;AAAA,QACPJ;AAAA,QACA,OAAOO,KAAU,WAAW,KAAK,UAAUA,CAAK,IAAIA,EAAM,SAAA;AAAA,MAAS;AAAA,IAGzE,CAAC,GACDf,IAAOY,GACP,OAAOjB,EAAQ,cAAc;AAAA,EAEjC;AACA,SAAO,EAAE,MAAAK,GAAM,SAAAL,EAAA;AACjB;"}
@@ -0,0 +1,57 @@
1
+ import { toShikiLang as w } from "../../constants/snippetPresets.js";
2
+ import { mdxCodeExampleToExamples as f, getFirstWebhookExample as B } from "./processExamples.js";
3
+ import { getDocsJsonSecurityOptions as F } from "./processSecurityOptions.js";
4
+ import { generatePrefillRequestData as J } from "./utils.js";
5
+ const R = (a) => {
6
+ var p;
7
+ const t = ((p = a.servers) == null ? void 0 : p.map((e) => e.url)) ?? [];
8
+ let r;
9
+ return t.length > 1, r = t[0], {
10
+ path: a.path,
11
+ method: a.method,
12
+ title: a.title ?? "",
13
+ description: a.description ?? "",
14
+ type: a.type ?? "path",
15
+ baseUrl: r,
16
+ baseUrlOptions: t,
17
+ deprecated: a.deprecated
18
+ };
19
+ }, G = ({
20
+ pageMetadata: a,
21
+ apiReferenceData2: t,
22
+ mdxExtracts: r,
23
+ docsConfig: p
24
+ }) => {
25
+ var y, h, b, q, U, O, E, S, T, v, x, P, k, d, A, D;
26
+ const e = t ?? { operation: void 0 };
27
+ if (!t && (r != null && r.endpoint) && (e.operation = R(r.endpoint)), a.description && e.operation && (e.operation.description = a.description), !e.operation)
28
+ return e;
29
+ const l = (h = (y = p == null ? void 0 : p.api) == null ? void 0 : y.mdx) == null ? void 0 : h.server, i = (q = (b = p == null ? void 0 : p.api) == null ? void 0 : b.mdx) == null ? void 0 : q.auth, s = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0;
30
+ if (typeof l == "string" && !s ? e.operation.baseUrl = l : Array.isArray(l) && !s && (l.length > 1 ? e.operation.baseUrlOptions = l : e.operation.baseUrl = l[0]), i && Object.keys(((U = e.dependencies) == null ? void 0 : U.security) ?? {}).length === 0) {
31
+ const o = F({
32
+ method: i.method,
33
+ name: i.name
34
+ });
35
+ o && (e.dependencies || (e.dependencies = {
36
+ servers: {},
37
+ security: {}
38
+ }), e.dependencies.security = { ...o });
39
+ }
40
+ const n = (O = r == null ? void 0 : r.codeExamples) == null ? void 0 : O.request, m = (E = r == null ? void 0 : r.codeExamples) == null ? void 0 : E.response;
41
+ if (n)
42
+ e.operation.requestExamples = f(n), e.operation.requestExampleType = "mdx";
43
+ else if (e.operation.type === "webhook")
44
+ e.operation.requestExamples = B(e), e.operation.requestExampleType = "webhook";
45
+ else if (e.operation.codeSamples && e.operation.codeSamples.length > 0) {
46
+ const o = (v = (T = (S = p == null ? void 0 : p.api) == null ? void 0 : S.examples) == null ? void 0 : T.languages) == null ? void 0 : v.map(w);
47
+ e.operation.requestExampleType = "codeSamples", e.operation.requestExampleLanguages = o, e.operation.requiredOnlyExamples = ((P = (x = p == null ? void 0 : p.api) == null ? void 0 : x.examples) == null ? void 0 : P.defaults) === "required";
48
+ } else
49
+ e.operation.requestExampleType = "generated";
50
+ m ? (e.operation.responseExamples = f(m), e.operation.responseExampleType = "mdx") : e.operation.responseExampleType = "generated";
51
+ const L = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0, u = ((d = (k = p == null ? void 0 : p.api) == null ? void 0 : k.examples) == null ? void 0 : d.prefill) && L;
52
+ return u && (e.operation.prefillPlaygroundWithExample = !!u, e.operation.prefillPlaygroundExamples = J(e)), ((D = (A = p == null ? void 0 : p.api) == null ? void 0 : A.playground) == null ? void 0 : D.proxy) === !1 && (e.operation.disableProxy = !0), e;
53
+ };
54
+ export {
55
+ G as addApiReferenceDataFromMdxAndDocsConfig
56
+ };
57
+ //# sourceMappingURL=addApiReferenceDataFromMdxAndDocsConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addApiReferenceDataFromMdxAndDocsConfig.js","sources":["../../../src/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.ts"],"sourcesContent":["import type { MdxExtracts } from '@mintlify/common';\nimport { PageMetaTags } from '@mintlify/models';\nimport { DocsConfig, Endpoint } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2, OperationV2 } from '@/api-playground-2/types';\nimport { toShikiLang } from '@/constants/snippetPresets';\n\nimport { getFirstWebhookExample, mdxCodeExampleToExamples } from './processExamples';\nimport { getDocsJsonSecurityOptions } from './processSecurityOptions';\nimport { generatePrefillRequestData } from './utils';\n\nconst mapEndpointToOperationV2 = (endpoint: Endpoint): OperationV2 => {\n const baseUrlOptions = endpoint.servers?.map((server) => server.url) ?? [];\n let baseUrl: string | undefined = undefined;\n if (baseUrlOptions.length > 1) {\n baseUrl = baseUrlOptions[0];\n } else {\n baseUrl = baseUrlOptions[0];\n }\n // ignore security options added from mdx endpoint, they are just copied from docs.json\n\n return {\n path: endpoint.path,\n method: endpoint.method,\n title: endpoint.title ?? '',\n description: endpoint.description ?? '',\n type: endpoint.type ?? 'path',\n baseUrl,\n baseUrlOptions,\n deprecated: endpoint.deprecated,\n };\n};\n\nexport const addApiReferenceDataFromMdxAndDocsConfig = ({\n pageMetadata,\n apiReferenceData2,\n mdxExtracts,\n docsConfig,\n}: {\n pageMetadata: PageMetaTags;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n mdxExtracts: MdxExtracts | undefined;\n docsConfig: DocsConfig | undefined;\n}): ApiReferenceDataV2 => {\n const apiReferenceData: ApiReferenceDataV2 = apiReferenceData2 ?? { operation: undefined };\n\n // if apiReferenceData2 is undefined, we need to add the operation from mdxExtracts\n if (!apiReferenceData2 && mdxExtracts?.endpoint) {\n apiReferenceData.operation = mapEndpointToOperationV2(mdxExtracts.endpoint);\n }\n\n // If we have a description from the frontmatter, use it instead of the OpenAPI description\n if (pageMetadata.description && apiReferenceData.operation) {\n apiReferenceData.operation.description = pageMetadata.description;\n }\n\n // now we should have a valid operationV2 either built by apiReferenceData from page props or just created from mdxExtracts\n // if there isn't, something went wrong and ngmi, operation remains undefined\n if (!apiReferenceData.operation) {\n return apiReferenceData;\n }\n\n // add docsConfig data to operation (either built by apiReferenceData from page props or just created from mdxExtracts)\n const configUrlOrUrls = docsConfig?.api?.mdx?.server;\n const configSecurity = docsConfig?.api?.mdx?.auth;\n\n // openapi servers > mdx servers > docs.json servers\n const alreadyHasServers =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n\n if (typeof configUrlOrUrls === 'string' && !alreadyHasServers) {\n apiReferenceData.operation.baseUrl = configUrlOrUrls;\n } else if (Array.isArray(configUrlOrUrls) && !alreadyHasServers) {\n if (configUrlOrUrls.length > 1) {\n apiReferenceData.operation.baseUrlOptions = configUrlOrUrls;\n } else {\n apiReferenceData.operation.baseUrl = configUrlOrUrls[0];\n }\n }\n\n if (configSecurity && Object.keys(apiReferenceData.dependencies?.security ?? {}).length === 0) {\n const docsJsonSecurityOptions = getDocsJsonSecurityOptions({\n method: configSecurity.method,\n name: configSecurity.name,\n });\n if (docsJsonSecurityOptions) {\n if (!apiReferenceData.dependencies) {\n apiReferenceData.dependencies = {\n servers: {},\n security: {},\n };\n }\n apiReferenceData.dependencies.security = { ...docsJsonSecurityOptions };\n }\n }\n\n const requestExamples = mdxExtracts?.codeExamples?.request;\n const responseExamples = mdxExtracts?.codeExamples?.response;\n\n // for examples, mdx > webhook example > codeSamples > generated\n if (requestExamples) {\n apiReferenceData.operation.requestExamples = mdxCodeExampleToExamples(requestExamples);\n apiReferenceData.operation.requestExampleType = 'mdx';\n } else {\n if (apiReferenceData.operation.type === 'webhook') {\n apiReferenceData.operation.requestExamples = getFirstWebhookExample(apiReferenceData);\n apiReferenceData.operation.requestExampleType = 'webhook';\n } else if (\n apiReferenceData.operation.codeSamples &&\n apiReferenceData.operation.codeSamples.length > 0\n ) {\n const requestExampleLanguages = docsConfig?.api?.examples?.languages?.map(toShikiLang);\n apiReferenceData.operation.requestExampleType = 'codeSamples';\n apiReferenceData.operation.requestExampleLanguages = requestExampleLanguages;\n apiReferenceData.operation.requiredOnlyExamples =\n docsConfig?.api?.examples?.defaults === 'required';\n } else {\n apiReferenceData.operation.requestExampleType = 'generated';\n }\n }\n\n if (responseExamples) {\n apiReferenceData.operation.responseExamples = mdxCodeExampleToExamples(responseExamples);\n apiReferenceData.operation.responseExampleType = 'mdx';\n } else {\n apiReferenceData.operation.responseExampleType = 'generated';\n }\n\n const hasBaseUrl =\n apiReferenceData.operation.baseUrl || apiReferenceData.operation.baseUrlOptions.length > 0;\n const prefillExamplesEnabled = docsConfig?.api?.examples?.prefill && hasBaseUrl;\n if (prefillExamplesEnabled) {\n apiReferenceData.operation.prefillPlaygroundWithExample = Boolean(prefillExamplesEnabled);\n apiReferenceData.operation.prefillPlaygroundExamples =\n generatePrefillRequestData(apiReferenceData);\n }\n\n const disableProxy = docsConfig?.api?.playground?.proxy === false;\n if (disableProxy) {\n apiReferenceData.operation.disableProxy = true;\n }\n\n return apiReferenceData;\n};\n"],"names":["mapEndpointToOperationV2","endpoint","baseUrlOptions","_a","server","baseUrl","addApiReferenceDataFromMdxAndDocsConfig","pageMetadata","apiReferenceData2","mdxExtracts","docsConfig","apiReferenceData","configUrlOrUrls","_b","configSecurity","_d","_c","alreadyHasServers","_e","docsJsonSecurityOptions","getDocsJsonSecurityOptions","requestExamples","_f","responseExamples","_g","mdxCodeExampleToExamples","getFirstWebhookExample","requestExampleLanguages","_j","_i","_h","toShikiLang","_l","_k","hasBaseUrl","prefillExamplesEnabled","_n","_m","generatePrefillRequestData","_p","_o"],"mappings":";;;;AAWA,MAAMA,IAA2B,CAACC,MAAoC;;AACpE,QAAMC,MAAiBC,IAAAF,EAAS,YAAT,gBAAAE,EAAkB,IAAI,CAACC,MAAWA,EAAO,SAAQ,CAAA;AACxE,MAAIC;AACJ,SAAIH,EAAe,SAAS,GAC1BG,IAAUH,EAAe,CAAC,GAMrB;AAAA,IACL,MAAMD,EAAS;AAAA,IACf,QAAQA,EAAS;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U,+BAA+B,EAAQwB,GAClExB,EAAiB,UAAU,4BACzB2B,EAA2B3B,CAAgB,MAG1B4B,KAAAC,IAAA9B,KAAA,gBAAAA,EAAY,QAAZ,gBAAA8B,EAAiB,eAAjB,gBAAAD,EAA6B,WAAU,OAE1D5B,EAAiB,UAAU,eAAe,KAGrCA;AACT;"}
@@ -0,0 +1,41 @@
1
+ import { isSchemaObject as s, escapeDots as p } from "./utils.js";
2
+ const n = (d, o = "") => {
3
+ if (!s(d))
4
+ return d;
5
+ const e = {
6
+ ...d,
7
+ uniqueKey: o
8
+ };
9
+ if (e.oneOf && Array.isArray(e.oneOf) && (e.oneOf = e.oneOf.map((t, i) => {
10
+ if (s(t)) {
11
+ const r = o ? `${o}.oneOf.${i}` : `${i}`;
12
+ return n(t, r);
13
+ }
14
+ return t;
15
+ })), e.type === "object" && e.properties) {
16
+ const t = {};
17
+ Object.entries(e.properties).forEach(([i, r]) => {
18
+ if (s(r)) {
19
+ const a = o ? `${o}.${p(i)}` : p(i);
20
+ t[i] = n(r, a);
21
+ } else
22
+ t[i] = r;
23
+ }), e.properties = t;
24
+ }
25
+ if (e.additionalProperties && typeof e.additionalProperties == "object" && s(e.additionalProperties)) {
26
+ const t = o ? `${o}.additionalProperties` : "additionalProperties";
27
+ e.additionalProperties = n(
28
+ e.additionalProperties,
29
+ t
30
+ );
31
+ }
32
+ if (e.type === "array" && "items" in e && s(e.items)) {
33
+ const t = o ? `${o}.items` : "items";
34
+ e.items = n(e.items, t);
35
+ }
36
+ return e;
37
+ };
38
+ export {
39
+ n as addUniqueKeysToSchema
40
+ };
41
+ //# sourceMappingURL=addUniqueKeysToSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addUniqueKeysToSchema.js","sources":["../../../src/api-playground-2/schemaGraph/addUniqueKeysToSchema.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { escapeDots, isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n/**\n * Add unique keys to each schema node, representing the path from the root.\n * This is used to generate unique input keys for the playground data store.\n *\n * @param schema - The schema to process\n * @param pathPrefix - The current path prefix (e.g., \"body.application/json\")\n * @returns The schema with uniqueKey properties added\n */\nexport const addUniqueKeysToSchema = (\n schema: SchemaObject,\n pathPrefix: string = ''\n): ResolvedSchemaObject => {\n if (!isSchemaObject(schema)) {\n return schema;\n }\n\n const processedSchema: ResolvedSchemaObject = {\n ...schema,\n uniqueKey: pathPrefix,\n };\n\n if (processedSchema.oneOf && Array.isArray(processedSchema.oneOf)) {\n processedSchema.oneOf = processedSchema.oneOf.map((subSchema, index) => {\n if (isSchemaObject(subSchema)) {\n const subPath = pathPrefix ? `${pathPrefix}.oneOf.${index}` : `${index}`;\n return addUniqueKeysToSchema(subSchema, subPath);\n }\n return subSchema;\n });\n }\n\n if (processedSchema.type === 'object' && processedSchema.properties) {\n const processedProperties: Record<string, SchemaObject> = {};\n Object.entries(processedSchema.properties).forEach(([name, propSchema]) => {\n if (isSchemaObject(propSchema)) {\n const propPath = pathPrefix ? `${pathPrefix}.${escapeDots(name)}` : escapeDots(name);\n processedProperties[name] = addUniqueKeysToSchema(propSchema, propPath);\n } else {\n processedProperties[name] = propSchema;\n }\n });\n processedSchema.properties = processedProperties;\n }\n\n if (\n processedSchema.additionalProperties &&\n typeof processedSchema.additionalProperties === 'object' &&\n isSchemaObject(processedSchema.additionalProperties)\n ) {\n const addPropsPath = pathPrefix ? `${pathPrefix}.additionalProperties` : 'additionalProperties';\n processedSchema.additionalProperties = addUniqueKeysToSchema(\n processedSchema.additionalProperties,\n addPropsPath\n );\n }\n\n if (\n processedSchema.type === 'array' &&\n 'items' in processedSchema &&\n isSchemaObject(processedSchema.items)\n ) {\n const itemsPath = pathPrefix ? `${pathPrefix}.items` : 'items';\n processedSchema.items = addUniqueKeysToSchema(processedSchema.items, itemsPath);\n }\n\n return processedSchema;\n};\n"],"names":["addUniqueKeysToSchema","schema","pathPrefix","isSchemaObject","processedSchema","subSchema","index","subPath","processedProperties","name","propSchema","propPath","escapeDots","addPropsPath","itemsPath"],"mappings":";AAaO,MAAMA,IAAwB,CACnCC,GACAC,IAAqB,OACI;AACzB,MAAI,CAACC,EAAeF,CAAM;AACxB,WAAOA;AAGT,QAAMG,IAAwC;AAAA,IAC5C,GAAGH;AAAA,IACH,WAAWC;AAAA,EAAA;AAab,MAVIE,EAAgB,SAAS,MAAM,QAAQA,EAAgB,KAAK,MAC9DA,EAAgB,QAAQA,EAAgB,MAAM,IAAI,CAACC,GAAWC,MAAU;AACtE,QAAIH,EAAeE,CAAS,GAAG;AAC7B,YAAME,IAAUL,IAAa,GAAGA,CAAU,UAAUI,CAAK,KAAK,GAAGA,CAAK;AACtE,aAAON,EAAsBK,GAAWE,CAAO;AAAA,IACjD;AACA,WAAOF;AAAA,EACT,CAAC,IAGCD,EAAgB,SAAS,YAAYA,EAAgB,YAAY;AACnE,UAAMI,IAAoD,CAAA;AAC1D,WAAO,QAAQJ,EAAgB,UAAU,EAAE,QAAQ,CAAC,CAACK,GAAMC,CAAU,MAAM;AACzE,UAAIP,EAAeO,CAAU,GAAG;AAC9B,cAAMC,IAAWT,IAAa,GAAGA,CAAU,IAAIU,EAAWH,CAAI,CAAC,KAAKG,EAAWH,CAAI;AACnF,QAAAD,EAAoBC,CAAI,IAAIT,EAAsBU,GAAYC,CAAQ;AAAA,MACxE;AACE,QAAAH,EAAoBC,CAAI,IAAIC;AAAA,IAEhC,CAAC,GACDN,EAAgB,aAAaI;AAAA,EAC/B;AAEA,MACEJ,EAAgB,wBAChB,OAAOA,EAAgB,wBAAyB,YAChDD,EAAeC,EAAgB,oBAAoB,GACnD;AACA,UAAMS,IAAeX,IAAa,GAAGA,CAAU,0BAA0B;AACzE,IAAAE,EAAgB,uBAAuBJ;AAAA,MACrCI,EAAgB;AAAA,MAChBS;AAAA,IAAA;AAAA,EAEJ;AAEA,MACET,EAAgB,SAAS,WACzB,WAAWA,KACXD,EAAeC,EAAgB,KAAK,GACpC;AACA,UAAMU,IAAYZ,IAAa,GAAGA,CAAU,WAAW;AACvD,IAAAE,EAAgB,QAAQJ,EAAsBI,EAAgB,OAAOU,CAAS;AAAA,EAChF;AAEA,SAAOV;AACT;"}
@@ -0,0 +1,19 @@
1
+ const s = (r, ...e) => [r.map((o) => o.replace("\\", "\\\\").replace("/", "\\/")).join("/"), ...e].join(`
2
+ `);
3
+ class n extends Error {
4
+ constructor(e, ...t) {
5
+ super(s(e, ...t)), this.name = "ImpossibleSchemaError", Object.setPrototypeOf(this, n.prototype);
6
+ }
7
+ }
8
+ function a(r, e, t = !1, ...o) {
9
+ if (t)
10
+ console.error(s(e, ...o), r);
11
+ else
12
+ throw r;
13
+ }
14
+ export {
15
+ n as ImpossibleSchemaError,
16
+ s as generateMessage,
17
+ a as handleExistingError
18
+ };
19
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../../src/api-playground-2/schemaGraph/errors.ts"],"sourcesContent":["// ERRORS\nexport const generateMessage = (path: string[], ...messages: string[]): string => {\n const pathString = path\n .map((component) => component.replace('\\\\', '\\\\\\\\').replace('/', '\\\\/'))\n .join('/');\n return [pathString, ...messages].join('\\n');\n};\n\n/**\n * Thrown when a value is incorrect or missing, according to the OpenAPI spec.\n */\nexport class InvalidSchemaError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'InvalidSchemaError';\n Object.setPrototypeOf(this, InvalidSchemaError.prototype);\n }\n}\n\n/**\n * Thrown when a schema is valid according to OpenAPI, but is unsatisfiable\n * (e.g. a value that must be both a number and a string).\n */\nexport class ImpossibleSchemaError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'ImpossibleSchemaError';\n Object.setPrototypeOf(this, ImpossibleSchemaError.prototype);\n }\n}\n\n/**\n * Thrown when there is an issue that was caused in another part of the conversion\n * (e.g. a schema in reduced form that is missing `oneOf`).\n */\nexport class ConversionError extends Error {\n constructor(path: string[], ...messages: string[]) {\n super(generateMessage(path, ...messages));\n this.name = 'ConversionError';\n Object.setPrototypeOf(this, ConversionError.prototype);\n }\n}\n\nexport function handleExistingError(\n error: unknown,\n path: string[],\n safeParse: boolean = false,\n ...messages: string[]\n) {\n if (safeParse) {\n console.error(generateMessage(path, ...messages), error);\n } else {\n throw error;\n }\n}\n"],"names":["generateMessage","path","messages","component","ImpossibleSchemaError","handleExistingError","error","safeParse"],"mappings":"AACO,MAAMA,IAAkB,CAACC,MAAmBC,MAI1C,CAHYD,EAChB,IAAI,CAACE,MAAcA,EAAU,QAAQ,MAAM,MAAM,EAAE,QAAQ,KAAK,KAAK,CAAC,EACtE,KAAK,GAAG,GACS,GAAGD,CAAQ,EAAE,KAAK;AAAA,CAAI;AAkBrC,MAAME,UAA8B,MAAM;AAAA,EAC/C,YAAYH,MAAmBC,GAAoB;AACjD,UAAMF,EAAgBC,GAAM,GAAGC,CAAQ,CAAC,GACxC,KAAK,OAAO,yBACZ,OAAO,eAAe,MAAME,EAAsB,SAAS;AAAA,EAC7D;AACF;AAcO,SAASC,EACdC,GACAL,GACAM,IAAqB,OAClBL,GACH;AACA,MAAIK;AACF,YAAQ,MAAMP,EAAgBC,GAAM,GAAGC,CAAQ,GAAGI,CAAK;AAAA;AAEvD,UAAMA;AAEV;"}
@@ -0,0 +1,26 @@
1
+ import { parseApiTargetFromMetadata as o } from "../../common/parseApiTargetFromMetadata.js";
2
+ import { getSchemaGraphOperationData as p } from "./getSchemaGraphOperationData.js";
3
+ import { getSchemaGraphSchemaData as m } from "./getSchemaGraphSchemaData.js";
4
+ const f = ({
5
+ metadata: e,
6
+ schemaGraphData: t
7
+ }) => {
8
+ const r = o(e);
9
+ if (!r)
10
+ return {};
11
+ try {
12
+ return r.type === "operation" ? p({
13
+ target: r,
14
+ schemaGraphData: t
15
+ }) : m({
16
+ target: r,
17
+ schemaGraphData: t
18
+ });
19
+ } catch (a) {
20
+ throw a;
21
+ }
22
+ };
23
+ export {
24
+ f as getApiReferenceDataFromGraph
25
+ };
26
+ //# sourceMappingURL=getApiReferenceDataFromGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getApiReferenceDataFromGraph.js","sources":["../../../src/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.ts"],"sourcesContent":["import { parseApiTargetFromMetadata } from '../../common/parseApiTargetFromMetadata';\nimport type { PageMetaTags } from '@mintlify/models';\nimport type { SchemaGraphData } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\n\nimport { getSchemaGraphOperationData } from './getSchemaGraphOperationData';\nimport { getSchemaGraphSchemaData } from './getSchemaGraphSchemaData';\n\nexport const getApiReferenceDataFromGraph = ({\n metadata,\n schemaGraphData,\n}: {\n metadata: PageMetaTags;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 => {\n const target = parseApiTargetFromMetadata(metadata);\n\n if (!target) {\n return {};\n }\n\n try {\n if (target.type === 'operation') {\n return getSchemaGraphOperationData({\n target,\n schemaGraphData,\n });\n } else {\n return getSchemaGraphSchemaData({\n target,\n schemaGraphData,\n });\n }\n } catch (error) {\n throw error;\n }\n};\n"],"names":["getApiReferenceDataFromGraph","metadata","schemaGraphData","target","parseApiTargetFromMetadata","getSchemaGraphOperationData","getSchemaGraphSchemaData","error"],"mappings":";;;AASO,MAAMA,IAA+B,CAAC;AAAA,EAC3C,UAAAC;AAAA,EACA,iBAAAC;AACF,MAG0B;AACxB,QAAMC,IAASC,EAA2BH,CAAQ;AAElD,MAAI,CAACE;AACH,WAAO,CAAA;AAGT,MAAI;AACF,WAAIA,EAAO,SAAS,cACXE,EAA4B;AAAA,MACjC,QAAAF;AAAA,MACA,iBAAAD;AAAA,IAAA,CACD,IAEMI,EAAyB;AAAA,MAC9B,QAAAH;AAAA,MACA,iBAAAD;AAAA,IAAA,CACD;AAAA,EAEL,SAASK,GAAO;AACd,UAAMA;AAAA,EACR;AACF;"}
@@ -0,0 +1,58 @@
1
+ import u from "lodash/zip";
2
+ import { deeplyResolveGraphNode as p, resolveGraphNode as n } from "./resolveGraphNode.js";
3
+ import { flattenSingleOneOf as c } from "./utils.js";
4
+ const d = (e) => n({
5
+ uuidObjectHashMap: e.spec.uuidObjectHashMap,
6
+ hashedNodeMap: e.spec.hashedNodeMap,
7
+ id: e.documentId
8
+ });
9
+ function O({
10
+ operation: e,
11
+ schemaGraphData: r
12
+ }) {
13
+ var o, i;
14
+ const t = (o = d(r)) == null ? void 0 : o.servers, s = (i = d(r)) == null ? void 0 : i.security;
15
+ return {
16
+ ...e,
17
+ servers: t,
18
+ security: s
19
+ };
20
+ }
21
+ const l = (e) => {
22
+ var t;
23
+ const r = (t = d(e)) == null ? void 0 : t.servers;
24
+ return r ? Object.fromEntries(
25
+ u(
26
+ r,
27
+ r.map(
28
+ (s) => p({
29
+ uuidObjectHashMap: e.spec.uuidObjectHashMap,
30
+ hashedNodeMap: e.spec.hashedNodeMap,
31
+ id: s
32
+ })
33
+ )
34
+ ).filter((s) => s[1] !== void 0).map(([s, o]) => [s, c(o)])
35
+ ) : {};
36
+ }, b = (e) => {
37
+ var t;
38
+ const r = (t = d(e)) == null ? void 0 : t.security;
39
+ return r ? Object.fromEntries(
40
+ u(
41
+ r,
42
+ r.map(
43
+ (s) => p({
44
+ uuidObjectHashMap: e.spec.uuidObjectHashMap,
45
+ hashedNodeMap: e.spec.hashedNodeMap,
46
+ id: s
47
+ })
48
+ )
49
+ ).filter((s) => s[1] !== void 0).map(([s, o]) => [s, c(o)])
50
+ ) : {};
51
+ };
52
+ export {
53
+ d as getDocument,
54
+ b as getResolvedSecuritys,
55
+ l as getResolvedServers,
56
+ O as withDocumentProperties
57
+ };
58
+ //# sourceMappingURL=getDocumentProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDocumentProperties.js","sources":["../../../src/api-playground-2/schemaGraph/getDocumentProperties.ts"],"sourcesContent":["import {\n Operation,\n SchemaGraphData,\n Document,\n ServerObject,\n SecurityRequirement,\n UUID,\n} from '@mintlify/validation';\nimport zip from 'lodash/zip';\n\nimport {\n deeplyResolveGraphNode,\n resolveGraphNode,\n} from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport { flattenSingleOneOf } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSecurityObject } from '@/api-playground-2/types';\n\nexport const getDocument = (schemaGraphData: SchemaGraphData) => {\n return resolveGraphNode<Document>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: schemaGraphData.documentId,\n });\n};\n\n// Decorate an Operation object that has been parsed from a path with some additional properties which\n// are stored at the top level of the schema document.\nexport function withDocumentProperties({\n operation,\n schemaGraphData,\n}: {\n operation: Operation;\n schemaGraphData: SchemaGraphData;\n}): Operation {\n // get servers\n const servers = getDocument(schemaGraphData)?.servers;\n\n // get security\n const security = getDocument(schemaGraphData)?.security;\n\n return {\n ...operation,\n servers,\n security,\n };\n}\n\nexport const getResolvedServers = (\n schemaGraphData: SchemaGraphData\n): Record<string, ServerObject> => {\n const serverUUIDs = getDocument(schemaGraphData)?.servers;\n if (!serverUUIDs) return {};\n\n return Object.fromEntries(\n zip(\n serverUUIDs,\n serverUUIDs.map((serverUUID) =>\n deeplyResolveGraphNode<ServerObject>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: serverUUID,\n })\n )\n )\n .filter((entry): entry is [UUID, ServerObject] => entry[1] !== undefined)\n .map(([uuid, server]) => [uuid, flattenSingleOneOf(server)])\n );\n};\n\nexport const getResolvedSecuritys = (\n schemaGraphData: SchemaGraphData\n): Record<string, ResolvedSecurityObject> => {\n const securityUUIDs = getDocument(schemaGraphData)?.security;\n if (!securityUUIDs) return {};\n\n return Object.fromEntries(\n zip(\n securityUUIDs,\n securityUUIDs.map((securityUUID) =>\n deeplyResolveGraphNode<SecurityRequirement>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: securityUUID,\n })\n )\n )\n .filter((entry): entry is [UUID, ResolvedSecurityObject] => entry[1] !== undefined)\n .map(([uuid, security]) => [uuid, flattenSingleOneOf(security)])\n );\n};\n"],"names":["getDocument","schemaGraphData","resolveGraphNode","withDocumentProperties","operation","servers","_a","security","_b","getResolvedServers","serverUUIDs","zip","serverUUID","deeplyResolveGraphNode","entry","uuid","server","flattenSingleOneOf","getResolvedSecuritys","securityUUIDs","securityUUID"],"mappings":";;;AAiBO,MAAMA,IAAc,CAACC,MACnBC,EAA2B;AAAA,EAChC,mBAAmBD,EAAgB,KAAK;AAAA,EACxC,eAAeA,EAAgB,KAAK;AAAA,EACpC,IAAIA,EAAgB;AAAA,CACrB;AAKI,SAASE,EAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,iBAAAH;AACF,GAGc;;AAEZ,QAAMI,KAAUC,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B,SAGxCC,KAAWC,IAAAR,EAAYC,CAAe,MAA3B,gBAAAO,EAA8B;AAE/C,SAAO;AAAA,IACL,GAAGJ;AAAA,IACH,SAAAC;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEO,MAAME,IAAqB,CAChCR,MACiC;;AACjC,QAAMS,KAAcJ,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B;AAClD,SAAKI,IAEE,OAAO;AAAA,IACZC;AAAA,MACED;AAAA,MACAA,EAAY;AAAA,QAAI,CAACE,MACfC,EAAqC;AAAA,UACnC,mBAAmBZ,EAAgB,KAAK;AAAA,UACxC,eAAeA,EAAgB,KAAK;AAAA,UACpC,IAAIW;AAAA,QAAA,CACL;AAAA,MAAA;AAAA,IACH,EAEC,OAAO,CAACE,MAAyCA,EAAM,CAAC,MAAM,MAAS,EACvE,IAAI,CAAC,CAACC,GAAMC,CAAM,MAAM,CAACD,GAAME,EAAmBD,CAAM,CAAC,CAAC;AAAA,EAAA,IAdtC,CAAA;AAgB3B,GAEaE,IAAuB,CAClCjB,MAC2C;;AAC3C,QAAMkB,KAAgBb,IAAAN,EAAYC,CAAe,MAA3B,gBAAAK,EAA8B;AACpD,SAAKa,IAEE,OAAO;AAAA,IACZR;AAAA,MACEQ;AAAA,MACAA,EAAc;AAAA,QAAI,CAACC,MACjBP,EAA4C;AAAA,UAC1C,mBAAmBZ,EAAgB,KAAK;AAAA,UACxC,eAAeA,EAAgB,KAAK;AAAA,UACpC,IAAImB;AAAA,QAAA,CACL;AAAA,MAAA;AAAA,IACH,EAEC,OAAO,CAACN,MAAmDA,EAAM,CAAC,MAAM,MAAS,EACjF,IAAI,CAAC,CAACC,GAAMR,CAAQ,MAAM,CAACQ,GAAME,EAAmBV,CAAQ,CAAC,CAAC;AAAA,EAAA,IAdxC,CAAA;AAgB7B;"}
@@ -0,0 +1,77 @@
1
+ import { withDocumentProperties as h, getResolvedServers as f, getResolvedSecuritys as b } from "./getDocumentProperties.js";
2
+ import { resolveGraphNode as O } from "./resolveGraphNode.js";
3
+ import { resolveOperationWithDependencies as v } from "./resolveOperationWithDependencies.js";
4
+ const y = ({
5
+ operation: e,
6
+ target: n,
7
+ baseUrlOptions: o
8
+ }) => {
9
+ let r, t = [];
10
+ o.length > 1 ? t = o : r = o[0];
11
+ const i = [];
12
+ return Array.isArray(e["x-code-samples"]) && e["x-code-samples"].length > 0 && e["x-code-samples"].forEach((s) => {
13
+ s && typeof s == "object" && "source" in s && typeof s.source == "string" && "lang" in s && typeof s.lang == "string" && i.push({
14
+ label: "label" in s && typeof s.label == "string" ? s.label : void 0,
15
+ lang: s.lang,
16
+ source: s.source
17
+ });
18
+ }), {
19
+ ...e,
20
+ path: n.endpoint || "",
21
+ baseUrl: r,
22
+ baseUrlOptions: t,
23
+ title: e.summary ?? "",
24
+ description: e.description ?? "",
25
+ codeSamples: i
26
+ };
27
+ }, g = (e, n, o) => {
28
+ const r = e.spec.refUuidMap[`${n}/${o}`];
29
+ if (!r) return;
30
+ const t = O({
31
+ uuidObjectHashMap: e.spec.uuidObjectHashMap,
32
+ hashedNodeMap: e.spec.hashedNodeMap,
33
+ id: r
34
+ });
35
+ return o === "webhook" ? t == null ? void 0 : t.post : t == null ? void 0 : t[o];
36
+ }, w = ({
37
+ target: e,
38
+ schemaGraphData: n
39
+ }) => {
40
+ const { uuidObjectHashMap: o, hashedNodeMap: r } = n.spec, t = g(n, e.endpoint, e.method);
41
+ if (!t)
42
+ throw new Error(
43
+ `no matching OpenAPI operation found with path "${e.endpoint}" and method "${e.method}"`
44
+ );
45
+ const i = v({
46
+ operationId: t,
47
+ uuidObjectHashMap: o,
48
+ hashedNodeMap: r
49
+ });
50
+ if (!i)
51
+ return {};
52
+ let s = i.operation;
53
+ s = h({
54
+ operation: s,
55
+ schemaGraphData: n
56
+ });
57
+ const c = f(n), p = b(n), d = Object.values(c).map((l) => l.url), u = y({
58
+ operation: s,
59
+ target: e,
60
+ baseUrlOptions: d
61
+ }), a = {
62
+ ...i.dependencies,
63
+ servers: c,
64
+ security: p,
65
+ ...i.schemas && { schemas: i.schemas }
66
+ };
67
+ return {
68
+ operation: u,
69
+ dependencies: a
70
+ };
71
+ };
72
+ export {
73
+ y as createOperationV2,
74
+ g as getOperationId,
75
+ w as getSchemaGraphOperationData
76
+ };
77
+ //# sourceMappingURL=getSchemaGraphOperationData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSchemaGraphOperationData.js","sources":["../../../src/api-playground-2/schemaGraph/getSchemaGraphOperationData.ts"],"sourcesContent":["import type { OperationTargetType } from '@mintlify/common';\nimport type {\n CodeSample,\n HttpMethod,\n PathOrRef,\n SchemaGraphData,\n Operation,\n} from '@mintlify/validation';\n\nimport {\n getResolvedSecuritys,\n getResolvedServers,\n withDocumentProperties,\n} from '@/api-playground-2/schemaGraph/getDocumentProperties';\nimport { resolveGraphNode } from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport type { ApiReferenceDataV2, OperationV2 } from '@/api-playground-2/types';\n\nimport { resolveOperationWithDependencies } from './resolveOperationWithDependencies';\n\nexport const createOperationV2 = ({\n operation,\n target,\n baseUrlOptions,\n}: {\n operation: Operation;\n target: OperationTargetType;\n baseUrlOptions: string[];\n}): OperationV2 => {\n let baseUrl: string | undefined = undefined;\n let baseUrls: string[] = [];\n if (baseUrlOptions.length > 1) {\n baseUrls = baseUrlOptions;\n } else {\n baseUrl = baseUrlOptions[0];\n }\n\n const codeSamples: CodeSample[] = [];\n if (Array.isArray(operation['x-code-samples']) && operation['x-code-samples'].length > 0) {\n operation['x-code-samples'].forEach((codeSample) => {\n if (\n codeSample &&\n typeof codeSample === 'object' &&\n 'source' in codeSample &&\n typeof codeSample['source'] === 'string' &&\n 'lang' in codeSample &&\n typeof codeSample['lang'] === 'string'\n ) {\n codeSamples.push({\n label:\n 'label' in codeSample && typeof codeSample['label'] === 'string'\n ? codeSample['label']\n : undefined,\n lang: codeSample['lang'],\n source: codeSample['source'],\n });\n }\n });\n }\n\n return {\n ...operation,\n path: target.endpoint || '',\n baseUrl,\n baseUrlOptions: baseUrls,\n title: operation.summary ?? '',\n description: operation.description ?? '',\n codeSamples,\n };\n};\n\n// An OpenAPI doc comes to us with a `paths` array. We turn that array into a series of path objects\n// which have a set of `method` keys that map to operation objects.\nexport const getOperationId = (\n graph: SchemaGraphData,\n endpoint: string,\n method: HttpMethod | 'webhook'\n) => {\n const pathUuid = graph.spec.refUuidMap[`${endpoint}/${method}`];\n if (!pathUuid) return undefined;\n\n // pathNode has a shape like:\n // {\n // path: string;\n // [method: HttpMethod]: UUID;\n // }\n const pathNode = resolveGraphNode<PathOrRef>({\n uuidObjectHashMap: graph.spec.uuidObjectHashMap,\n hashedNodeMap: graph.spec.hashedNodeMap,\n id: pathUuid,\n });\n\n // TODO - Api Playground Refactor: I think we assume in the converter that webhooks always have \"post\" as a method\n // technically I they can have multiple/other methods specified?\n const pathNodeOperationObject = method === 'webhook' ? pathNode?.['post'] : pathNode?.[method];\n\n return pathNodeOperationObject;\n};\n\nexport const getSchemaGraphOperationData = ({\n target,\n schemaGraphData,\n}: {\n target: OperationTargetType;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 => {\n const { uuidObjectHashMap, hashedNodeMap } = schemaGraphData.spec;\n\n const operationId = getOperationId(schemaGraphData, target.endpoint, target.method);\n\n if (!operationId) {\n throw new Error(\n `no matching OpenAPI operation found with path \"${target.endpoint}\" and method \"${target.method}\"`\n );\n }\n\n const resolvedData = resolveOperationWithDependencies({\n operationId,\n uuidObjectHashMap,\n hashedNodeMap,\n });\n\n if (!resolvedData) {\n // better error handling?\n return {};\n }\n\n let operation = resolvedData.operation;\n\n // The Operation object doesn't directly contain all the properties we want, so we add a few elsewhere\n // in the spec.\n operation = withDocumentProperties({\n operation,\n schemaGraphData,\n });\n\n const servers = getResolvedServers(schemaGraphData);\n const security = getResolvedSecuritys(schemaGraphData);\n const baseUrlOptions = Object.values(servers).map((server) => server.url);\n\n const operationV2 = createOperationV2({\n operation,\n target,\n baseUrlOptions,\n });\n\n // Then we need to make sure we have dependencies for those new properties.\n const dependenciesWithDocumentDependencies = {\n ...resolvedData.dependencies,\n servers,\n security,\n ...(resolvedData.schemas && { schemas: resolvedData.schemas }),\n };\n\n return {\n operation: operationV2,\n dependencies: dependenciesWithDocumentDependencies,\n };\n};\n"],"names":["createOperationV2","operation","target","baseUrlOptions","baseUrl","baseUrls","codeSamples","codeSample","getOperationId","graph","endpoint","method","pathUuid","pathNode","resolveGraphNode","getSchemaGraphOperationData","schemaGraphData","uuidObjectHashMap","hashedNodeMap","operationId","resolvedData","resolveOperationWithDependencies","withDocumentProperties","servers","getResolvedServers","security","getResolvedSecuritys","server","operationV2","dependenciesWithDocumentDependencies"],"mappings":";;;AAmBO,MAAMA,IAAoB,CAAC;AAAA,EAChC,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AACF,MAImB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cX,EAAeQ,GAAiBd,EAAO,UAAUA,EAAO,MAAM;AAElF,MAAI,CAACiB;AACH,UAAM,IAAI;AAAA,MACR,kDAAkDjB,EAAO,QAAQ,iBAAiBA,EAAO,MAAM;AAAA,IAAA;AAInG,QAAMkB,IAAeC,EAAiC;AAAA,IACpD,aAAAF;AAAA,IACA,mBAAAF;AAAA,IACA,eAAAC;AAAA,EAAA,CACD;AAED,MAAI,CAACE;AAEH,WAAO,CAAA;AAGT,MAAInB,IAAYmB,EAAa;AAI7B,EAAAnB,IAAYqB,EAAuB;AAAA,IACjC,WAAArB;AAAA,IACA,iBAAAe;AAAA,EAAA,CACD;AAED,QAAMO,IAAUC,EAAmBR,CAAe,GAC5CS,IAAWC,EAAqBV,CAAe,GAC/Cb,IAAiB,OAAO,OAAOoB,CAAO,EAAE,IAAI,CAACI,MAAWA,EAAO,GAAG,GAElEC,IAAc5B,EAAkB;AAAA,IACpC,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAGK0B,IAAuC;AAAA,IAC3C,GAAGT,EAAa;AAAA,IAChB,SAAAG;AAAA,IACA,UAAAE;AAAA,IACA,GAAIL,EAAa,WAAW,EAAE,SAASA,EAAa,QAAA;AAAA,EAAQ;AAG9D,SAAO;AAAA,IACL,WAAWQ;AAAA,IACX,cAAcC;AAAA,EAAA;AAElB;"}
@@ -0,0 +1,16 @@
1
+ import { resolveSchemaWithDependencies as t } from "./resolveSchemaWithDependencies.js";
2
+ function o({
3
+ target: e,
4
+ schemaGraphData: a
5
+ }) {
6
+ return {
7
+ schemaData: t({
8
+ schemaPath: `#/components/schemas/${e.name}`,
9
+ schemaGraphData: a
10
+ })
11
+ };
12
+ }
13
+ export {
14
+ o as getSchemaGraphSchemaData
15
+ };
16
+ //# sourceMappingURL=getSchemaGraphSchemaData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSchemaGraphSchemaData.js","sources":["../../../src/api-playground-2/schemaGraph/getSchemaGraphSchemaData.ts"],"sourcesContent":["import type { SchemaTargetType } from '@mintlify/common';\nimport { SchemaGraphData } from '@mintlify/validation';\n\nimport { resolveSchemaWithDependencies } from '@/api-playground-2/schemaGraph/resolveSchemaWithDependencies';\nimport { ApiReferenceDataV2 } from '@/api-playground-2/types';\n\nexport function getSchemaGraphSchemaData({\n target,\n schemaGraphData,\n}: {\n target: SchemaTargetType;\n schemaGraphData: SchemaGraphData;\n}): ApiReferenceDataV2 {\n const resolvedData = resolveSchemaWithDependencies({\n schemaPath: `#/components/schemas/${target.name}`,\n schemaGraphData,\n });\n\n return {\n schemaData: resolvedData,\n };\n}\n"],"names":["getSchemaGraphSchemaData","target","schemaGraphData","resolveSchemaWithDependencies"],"mappings":";AAMO,SAASA,EAAyB;AAAA,EACvC,QAAAC;AAAA,EACA,iBAAAC;AACF,GAGuB;AAMrB,SAAO;AAAA,IACL,YANmBC,EAA8B;AAAA,MACjD,YAAY,wBAAwBF,EAAO,IAAI;AAAA,MAC/C,iBAAAC;AAAA,IAAA,CACD;AAAA,EAGa;AAEhB;"}
@@ -1,13 +1,123 @@
1
- import "html-react-parser";
2
- const i = (t) => {
3
- const a = Object.keys(t)[0];
4
- if (a) {
5
- const e = t[a], s = Object.values((e == null ? void 0 : e.examples) ?? {})[0];
6
- if (s && "value" in s)
7
- return s.value;
1
+ import m from "html-react-parser";
2
+ import { isSchemaObject as s } from "./utils.js";
3
+ function p(e, r) {
4
+ const t = /language-(\w+)/.exec(e ?? "");
5
+ return t ? t[1] ?? "text" : r ?? "text";
6
+ }
7
+ const g = (e) => {
8
+ var a, i;
9
+ const r = [], t = (a = e.attributes) == null ? void 0 : a.some(
10
+ (n) => n.name === "dropdown" && n.value !== "false"
11
+ );
12
+ return (i = e.children) == null || i.map((n) => {
13
+ const u = m(n.html ?? ""), o = typeof u == "object" && !Array.isArray(u) && u.type === "pre" ? u.props.language ?? p(u.props.className, n.filename) : void 0;
14
+ r.push({
15
+ dropdown: t,
16
+ language: o,
17
+ code: u,
18
+ filename: n.filename
19
+ });
20
+ }), r;
21
+ }, E = (e) => (Object.entries(e).forEach(([r, t]) => {
22
+ const a = {};
23
+ t.examples ? (Object.entries(t.examples).forEach(
24
+ ([i, n]) => {
25
+ "$ref" in n || (a[i] = {
26
+ title: i,
27
+ description: n.description,
28
+ value: n.value
29
+ });
30
+ }
31
+ ), e[r] && (e[r].examples = a)) : t.example ? (a.Example = {
32
+ title: "Example",
33
+ value: t.example
34
+ }, e[r] && (e[r].examples = a)) : s(t.schema) && (a.Example = l(t.schema), e[r] && (e[r].examples = a));
35
+ }), e), l = (e) => {
36
+ const r = {
37
+ title: "Example",
38
+ value: void 0
39
+ };
40
+ if (e.example !== void 0)
41
+ return r.value = e.example, r;
42
+ if (e.default !== void 0)
43
+ return r.value = e.default, r;
44
+ if (e.enum)
45
+ return r.value = e.enum[0], r;
46
+ if (e.oneOf && Array.isArray(e.oneOf) && e.oneOf.length > 0) {
47
+ const t = e.oneOf[0];
48
+ if (s(t))
49
+ return l(t);
8
50
  }
51
+ switch (e.type) {
52
+ case "string":
53
+ return r.value = x(e), r;
54
+ case "boolean":
55
+ return r.value = !0, r;
56
+ case "number":
57
+ case "integer":
58
+ return r.value = f(e), r;
59
+ case "object":
60
+ return r.value = Object.fromEntries(
61
+ Object.entries(e.properties ?? {}).map(([t, a]) => [
62
+ t,
63
+ l(a).value
64
+ ])
65
+ ), r;
66
+ case "array":
67
+ return r.value = [l(e.items).value], r;
68
+ default:
69
+ return r.value = "<unknown>", r;
70
+ }
71
+ }, f = (e) => {
72
+ const r = e.type === "integer" ? Math.floor : (t) => t;
73
+ return e.minimum !== void 0 && e.maximum !== void 0 ? r((e.minimum + e.maximum) / 2) : e.minimum !== void 0 ? r(e.minimum + 1) : e.maximum !== void 0 ? 123 < e.maximum ? 123 : r(e.maximum - 1) : 123;
74
+ }, x = (e) => {
75
+ var r;
76
+ switch ((r = e.format) == null ? void 0 : r.toLowerCase()) {
77
+ case "byte":
78
+ case "base64":
79
+ return "aSDinaTvuI8gbWludGxpZnk=";
80
+ case "date":
81
+ return "2023-12-25";
82
+ case "date-time":
83
+ return "2023-11-07T05:31:56Z";
84
+ case "email":
85
+ return "jsmith@example.com";
86
+ case "uuid":
87
+ return "3c90c3cc-0d44-4b50-8888-8dd25736052a";
88
+ case "ipv4":
89
+ return "127.0.0.1";
90
+ case "ipv6":
91
+ return "2606:4700:3108::ac42:2835";
92
+ default:
93
+ return "<string>";
94
+ }
95
+ }, v = (e) => {
96
+ const r = Object.keys(e)[0];
97
+ if (r) {
98
+ const t = e[r], i = Object.values((t == null ? void 0 : t.examples) ?? {})[0];
99
+ if (i && "value" in i)
100
+ return i.value;
101
+ }
102
+ }, b = (e) => {
103
+ var t, a;
104
+ const r = [];
105
+ if ((a = (t = e.dependencies) == null ? void 0 : t.requestBody) != null && a.content) {
106
+ const i = v(e.dependencies.requestBody.content);
107
+ i && r.push({
108
+ language: "json",
109
+ filename: "Example Request Body",
110
+ code: JSON.stringify(i.value, null, 2)
111
+ });
112
+ }
113
+ return r;
9
114
  };
10
115
  export {
11
- i as getFirstExampleValue
116
+ l as generateExampleFromSchema,
117
+ E as generateExamplesFromSchema,
118
+ v as getFirstExampleValue,
119
+ b as getFirstWebhookExample,
120
+ p as getLanguageFromClassName,
121
+ g as mdxCodeExampleToExamples
12
122
  };
13
123
  //# sourceMappingURL=processExamples.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample"],"mappings":";AA4KO,MAAMA,IAAuB,CAClCC,MAC8B;AAC9B,QAAMC,IAAmB,OAAO,KAAKD,CAAO,EAAE,CAAC;AAC/C,MAAIC,GAAkB;AACpB,UAAMC,IAAoBF,EAAQC,CAAgB,GAE5CE,IADW,OAAO,QAAOD,KAAA,gBAAAA,EAAmB,aAAY,CAAA,CAAE,EAClC,CAAC;AAC/B,QAAIC,KAAgB,WAAWA;AAC7B,aAAOA,EAAa;AAAA,EAExB;AAEF;"}
1
+ {"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getLanguageFromClassName","className","fallback","match","mdxCodeExampleToExamples","mdxCodeExampleData","examples","dropdown","_a","attr","_b","child","jsx","parse","lang","generateExamplesFromSchema","content","contentType","mediaObject","exampleName","example","isSchemaObject","generateExampleFromSchema","schema","firstOption","generateStringExample","generateNumericExample","propName","subschema","format","n","getFirstExampleValue","firstContentType","contentTypeObject","firstExample","getFirstWebhookExample","apiReferenceData","requestExamples"],"mappings":";;AAaO,SAASA,EAAyBC,GAA+BC,GAA2B;AACjG,QAAMC,IAAQ,iBAAiB,KAAKF,KAAa,EAAE;AACnD,SAAOE,IAAQA,EAAM,CAAC,KAAK,SAASD,KAAY;AAClD;AAEO,MAAME,IAA2B,CAACC,MAA0D;;AACjG,QAAMC,IAA0B,CAAA,GAC1BC,KAAWC,IAAAH,EAAmB,eAAnB,gBAAAG,EAA+B;AAAA,IAC9C,CAACC,MAASA,EAAK,SAAS,cAAcA,EAAK,UAAU;AAAA;AAEvD,UAAAC,IAAAL,EAAmB,aAAnB,QAAAK,EAA6B,IAAI,CAACC,MAAU;AAC1C,UAAMC,IAAMC,EAAMF,EAAM,QAAQ,EAAE,GAC5BG,IACJ,OAAOF,KAAQ,YAAY,CAAC,MAAM,QAAQA,CAAG,KAAKA,EAAI,SAAS,QAC3DA,EAAI,MAAM,YAAYZ,EAAyBY,EAAI,MAAM,WAAWD,EAAM,QAAQ,IAClF;AACN,IAAAL,EAAS,KAAK;AAAA,MACZ,UAAAC;AAAA,MACA,UAAUO;AAAA,MACV,MAAMF;AAAA,MACN,UAAUD,EAAM;AAAA,IAAA,CACjB;AAAA,EACH,IACOL;AACT,GAGaS,IAA6B,CACxCC,OAEA,OAAO,QAAQA,CAAO,EAAE,QAAQ,CAAC,CAACC,GAAaC,CAAW,MAAM;AAC9D,QAAMZ,IAAmD,CAAA;AACzD,EAAIY,EAAY,YACd,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