@mintlify/msft-sdk 1.1.61 → 1.1.63

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 (234) hide show
  1. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
  2. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
  3. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
  4. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
  5. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
  6. package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
  7. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
  8. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
  9. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +6 -5
  10. package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
  11. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
  12. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
  13. package/dist/api-playground/EndpointFields/components/Description.js +6 -5
  14. package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
  15. package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
  16. package/dist/api-playground-2/ApiExamples.js +19 -20
  17. package/dist/api-playground-2/ApiFields.js +20 -247
  18. package/dist/api-playground-2/EndpointHeader.js +59 -47
  19. package/dist/api-playground-2/OperationPage.js +70 -66
  20. package/dist/api-playground-2/Playground.js +67 -83
  21. package/dist/api-playground-2/SchemaPage.js +22 -9
  22. package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
  23. package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
  24. package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
  25. package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
  26. package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
  27. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
  28. package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
  29. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
  30. package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
  31. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
  32. package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
  33. package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
  34. package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
  35. package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
  36. package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
  37. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
  38. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
  39. package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
  40. package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
  41. package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
  42. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
  43. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
  44. package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
  45. package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
  46. package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
  47. package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
  48. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
  49. package/dist/api-playground-2/generators/createCookies.js +23 -0
  50. package/dist/api-playground-2/generators/createHeaders.js +53 -36
  51. package/dist/api-playground-2/generators/createQueryString.js +30 -0
  52. package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
  53. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
  54. package/dist/api-playground-2/generators/generateRequest.js +47 -51
  55. package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
  56. package/dist/api-playground-2/generators/generateSnippet.js +1 -1
  57. package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
  58. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
  59. package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
  60. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
  61. package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
  62. package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
  63. package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
  64. package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
  65. package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
  66. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
  67. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
  68. package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
  69. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
  70. package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
  71. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
  72. package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
  73. package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
  74. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
  75. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
  76. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
  77. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
  78. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
  79. package/dist/api-playground-2/schemaGraph/utils.js +185 -147
  80. package/dist/common/guards.js +11 -19
  81. package/dist/components/Api/Expandable.js +10 -9
  82. package/dist/components/Api/Param.js +11 -13
  83. package/dist/components/Api/dropdown-menu.js +10 -9
  84. package/dist/components/content-components/code-group.js +4 -4
  85. package/dist/contexts/EndpointLocationContext.js +3 -3
  86. package/dist/hooks/useApiParamFieldOption.js +10 -0
  87. package/dist/hooks/useEndpoint.js +3 -3
  88. package/dist/hooks/useKeyboardShortcut.js +13 -13
  89. package/dist/hooks/useSendPlaygroundRequest.js +14 -146
  90. package/dist/httpsnippet/src/helpers/code-builder.js +27 -0
  91. package/dist/httpsnippet/src/helpers/escape.js +11 -0
  92. package/dist/httpsnippet/src/helpers/headers.js +13 -0
  93. package/dist/httpsnippet/src/helpers/reducer.js +7 -0
  94. package/dist/httpsnippet/src/helpers/shell.js +5 -0
  95. package/dist/httpsnippet/src/helpers/url-format.js +35 -0
  96. package/dist/httpsnippet/src/helpers/url-parse.js +76 -0
  97. package/dist/httpsnippet/src/index.js +157 -0
  98. package/dist/httpsnippet/src/targets/c/libcurl/client.js +22 -0
  99. package/dist/httpsnippet/src/targets/c/target.js +15 -0
  100. package/dist/httpsnippet/src/targets/clojure/clj_http/client.js +120 -0
  101. package/dist/httpsnippet/src/targets/clojure/target.js +14 -0
  102. package/dist/httpsnippet/src/targets/csharp/httpclient/client.js +76 -0
  103. package/dist/httpsnippet/src/targets/csharp/restsharp/client.js +63 -0
  104. package/dist/httpsnippet/src/targets/csharp/target.js +17 -0
  105. package/dist/httpsnippet/src/targets/go/native/client.js +24 -0
  106. package/dist/httpsnippet/src/targets/go/target.js +15 -0
  107. package/dist/httpsnippet/src/targets/http/http1.1/client.js +34 -0
  108. package/dist/httpsnippet/src/targets/http/target.js +14 -0
  109. package/dist/httpsnippet/src/targets/index.js +43 -0
  110. package/dist/httpsnippet/src/targets/java/asynchttp/client.js +23 -0
  111. package/dist/httpsnippet/src/targets/java/nethttp/client.js +28 -0
  112. package/dist/httpsnippet/src/targets/java/okhttp/client.js +23 -0
  113. package/dist/httpsnippet/src/targets/java/target.js +20 -0
  114. package/dist/httpsnippet/src/targets/java/unirest/client.js +23 -0
  115. package/dist/httpsnippet/src/targets/javascript/axios/client.js +50 -0
  116. package/dist/httpsnippet/src/targets/javascript/fetch/client.js +61 -0
  117. package/dist/httpsnippet/src/targets/javascript/jquery/client.js +51 -0
  118. package/dist/httpsnippet/src/targets/javascript/target.js +20 -0
  119. package/dist/httpsnippet/src/targets/javascript/xhr/client.js +49 -0
  120. package/dist/httpsnippet/src/targets/json/native/client.js +39 -0
  121. package/dist/httpsnippet/src/targets/json/target.js +14 -0
  122. package/dist/httpsnippet/src/targets/kotlin/okhttp/client.js +23 -0
  123. package/dist/httpsnippet/src/targets/kotlin/target.js +14 -0
  124. package/dist/httpsnippet/src/targets/node/axios/client.js +40 -0
  125. package/dist/httpsnippet/src/targets/node/fetch/client.js +68 -0
  126. package/dist/httpsnippet/src/targets/node/native/client.js +45 -0
  127. package/dist/httpsnippet/src/targets/node/target.js +19 -0
  128. package/dist/httpsnippet/src/targets/objc/helpers.js +27 -0
  129. package/dist/httpsnippet/src/targets/objc/nsurlsession/client.js +63 -0
  130. package/dist/httpsnippet/src/targets/objc/target.js +14 -0
  131. package/dist/httpsnippet/src/targets/ocaml/cohttp/client.js +32 -0
  132. package/dist/httpsnippet/src/targets/ocaml/target.js +14 -0
  133. package/dist/httpsnippet/src/targets/php/curl/client.js +85 -0
  134. package/dist/httpsnippet/src/targets/php/guzzle/client.js +57 -0
  135. package/dist/httpsnippet/src/targets/php/helpers.js +65 -0
  136. package/dist/httpsnippet/src/targets/php/http1/client.js +28 -0
  137. package/dist/httpsnippet/src/targets/php/http2/client.js +55 -0
  138. package/dist/httpsnippet/src/targets/php/target.js +21 -0
  139. package/dist/httpsnippet/src/targets/powershell/common.js +19 -0
  140. package/dist/httpsnippet/src/targets/powershell/restmethod/client.js +14 -0
  141. package/dist/httpsnippet/src/targets/powershell/target.js +16 -0
  142. package/dist/httpsnippet/src/targets/powershell/webrequest/client.js +14 -0
  143. package/dist/httpsnippet/src/targets/python/helpers.js +33 -0
  144. package/dist/httpsnippet/src/targets/python/requests/client.js +74 -0
  145. package/dist/httpsnippet/src/targets/python/target.js +15 -0
  146. package/dist/httpsnippet/src/targets/r/httr/client.js +46 -0
  147. package/dist/httpsnippet/src/targets/r/target.js +14 -0
  148. package/dist/httpsnippet/src/targets/ruby/native/client.js +37 -0
  149. package/dist/httpsnippet/src/targets/ruby/target.js +14 -0
  150. package/dist/httpsnippet/src/targets/shell/curl/client.js +92 -0
  151. package/dist/httpsnippet/src/targets/shell/httpie/client.js +56 -0
  152. package/dist/httpsnippet/src/targets/shell/target.js +19 -0
  153. package/dist/httpsnippet/src/targets/shell/wget/client.js +30 -0
  154. package/dist/httpsnippet/src/targets/swift/helpers.js +38 -0
  155. package/dist/httpsnippet/src/targets/swift/target.js +14 -0
  156. package/dist/httpsnippet/src/targets/swift/urlsession/client.js +59 -0
  157. package/dist/index.d.ts +65 -58
  158. package/dist/index.js +109 -111
  159. package/dist/openapi/generateTypeStringFromSchema.js +2 -31
  160. package/dist/styles.css +1 -1
  161. package/package.json +17 -4
  162. package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
  163. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
  164. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
  165. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
  166. package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
  167. package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
  168. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
  169. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
  170. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
  171. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
  172. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
  173. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
  174. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
  175. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
  176. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
  177. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
  178. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
  179. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
  180. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
  181. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
  182. package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
  183. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
  184. package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
  185. package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
  186. package/dist/api-playground/ApiPlayground/index.js +0 -67
  187. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
  188. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
  189. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
  190. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
  191. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
  192. package/dist/api-playground/EndpointFields/index.js +0 -7
  193. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
  194. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
  195. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
  196. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
  197. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
  198. package/dist/common/potentiallyParseOpenApiString.js +0 -24
  199. package/dist/common/replaceSlashIndex.js +0 -6
  200. package/dist/common/slugToTitle.js +0 -10
  201. package/dist/constants/prism-languages.js +0 -19
  202. package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
  203. package/dist/contexts/MDXContentContext.js +0 -17
  204. package/dist/hooks/useApiPlaygroundInputs.js +0 -6
  205. package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
  206. package/dist/hooks/useBaseUrlOptions.js +0 -18
  207. package/dist/hooks/useComponentSchemas.js +0 -9
  208. package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
  209. package/dist/hooks/useGenerateNextItems.js +0 -11
  210. package/dist/hooks/useGenerateNextProperties.js +0 -11
  211. package/dist/hooks/useMDXContent.js +0 -6
  212. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
  213. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
  214. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
  215. package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
  216. package/dist/hooks/usePrefilledInputs/index.js +0 -65
  217. package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
  218. package/dist/hooks/useSecurityOption.js +0 -10
  219. package/dist/hooks/useSetDefaultValue.js +0 -63
  220. package/dist/openapi/filterEnums.js +0 -20
  221. package/dist/openapi/generateNextAdditionalProperties.js +0 -7
  222. package/dist/openapi/generateNextItems.js +0 -7
  223. package/dist/openapi/generateNextProperties.js +0 -23
  224. package/dist/openapi/generateOptionLabels.js +0 -20
  225. package/dist/openapi/generateSimpleLabels.js +0 -4
  226. package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
  227. package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
  228. package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
  229. package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
  230. package/dist/utils/api-playground/defaults.js +0 -15
  231. package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
  232. package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
  233. package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
  234. package/dist/utils/flattenObject.js +0 -10
@@ -1,64 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useState as a, useMemo as u } from "react";
3
- import { InputSectionContainer as x } from "../components/InputSectionContainer.js";
4
- import { TypeDropdown as T } from "../components/TypeDropdown.js";
5
- import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
6
- import { Tabs as S } from "../../../components/content-components/tabs/tabs.js";
7
- import { Tab as I } from "../../../components/content-components/tabs/tab.js";
8
- const k = ({ body: d, value: o, setValue: n }) => {
9
- const [y, f] = a(0), [m, h] = a(0), r = u(() => Object.entries(d), [d]), s = r[m] ?? r[0];
10
- if (s === void 0) return null;
11
- const [b, { schemaArray: i }] = s;
12
- return /* @__PURE__ */ t(
13
- x,
14
- {
15
- name: "Body",
16
- rightElement: r.length > 1 && /* @__PURE__ */ t("div", { onClick: (e) => e.stopPropagation(), className: "mint:text-xs mint:font-mono", children: /* @__PURE__ */ t(
17
- T,
18
- {
19
- options: r.map(([e, c]) => ({
20
- label: e,
21
- schema: c
22
- })),
23
- selectedIndex: m,
24
- onSelectOption: (e) => {
25
- h(e);
26
- }
27
- }
28
- ) }),
29
- children: i.length > 1 ? /* @__PURE__ */ t(
30
- S,
31
- {
32
- defaultTab: y,
33
- onClickTab: (e) => f(e),
34
- className: "mint:mb-0!",
35
- children: i.map((e, c) => {
36
- const p = e.title ?? `Option ${c + 1}`;
37
- return /* @__PURE__ */ t(I, { title: p, children: /* @__PURE__ */ t(
38
- l,
39
- {
40
- schemaArray: [e],
41
- value: o,
42
- setValue: n,
43
- clearValue: o === void 0 ? void 0 : () => n(void 0),
44
- isBody: !0
45
- }
46
- ) }, p);
47
- })
48
- }
49
- ) : /* @__PURE__ */ t(
50
- l,
51
- {
52
- schemaArray: i,
53
- value: o,
54
- setValue: n,
55
- clearValue: o === void 0 ? void 0 : () => n(void 0),
56
- isBody: !0
57
- }
58
- )
59
- }
60
- );
61
- };
62
- export {
63
- k as BodySection
64
- };
@@ -1,32 +0,0 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useMemo as p } from "react";
3
- import { InputSectionContainer as h } from "../components/InputSectionContainer.js";
4
- import { RecursiveInput as j } from "./inputs/RecursiveInput.js";
5
- const P = ({ name: d, parameters: c, value: t, setValue: o }) => {
6
- const s = p(() => Object.entries(c).map(([e, r]) => {
7
- const i = t[e], m = (n) => {
8
- const l = { ...t };
9
- l[e] = n, o(l);
10
- }, f = i === void 0 ? void 0 : () => {
11
- const n = { ...t };
12
- delete n[e], o(n);
13
- };
14
- return /* @__PURE__ */ u(
15
- j,
16
- {
17
- name: e,
18
- schemaArray: r.schema,
19
- style: r.style,
20
- explode: r.explode,
21
- value: i,
22
- setValue: m,
23
- clearValue: f
24
- },
25
- e
26
- );
27
- }), [c, o, t]);
28
- return s.length === 0 ? null : /* @__PURE__ */ u(h, { name: d, children: s });
29
- };
30
- export {
31
- P as ParameterSection
32
- };
@@ -1,201 +0,0 @@
1
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import { useState as C, useContext as B, useEffect as J } from "react";
3
- import { DescriptionWithoutHeaders as H } from "../../EndpointFields/components/Description.js";
4
- import { useApiPlaygroundPrefillExamples as I } from "../../../hooks/useApiPlaygroundPrefillExamples.js";
5
- import { useMDXContent as R } from "../../../hooks/useMDXContent.js";
6
- import { parseAuthInputsFromUserInfo as G } from "../../../hooks/usePrefilledInputs/index.js";
7
- import { useSecurityOption as U } from "../../../hooks/useSecurityOption.js";
8
- import { getDefaultsFromParameterGroup as W, getDefaultFromSchema as Q } from "../../../utils/api-playground/defaults.js";
9
- import { paramFieldDefaults as w } from "../../../utils/api-playground/paramFieldDefaults.js";
10
- import { getFilteredSecurityOptions as X } from "../../../utils/api-reference/getFilteredSecurityOptions.js";
11
- import "@mintlify/validation";
12
- import { cn as z } from "../../../utils/cn.js";
13
- import { ApiPlaygroundContext as K } from "../ApiPlaygroundContext.js";
14
- import { Response as P } from "../Response/index.js";
15
- import { EndpointsMenu as L } from "../components/EndpointsMenu.js";
16
- import { PathHeader as T, SendPill as Y } from "../components/PathHeader.js";
17
- import { PlaygroundModalWrapper as Z } from "../components/PlaygroundModalWrapper.js";
18
- import { BodySection as _ } from "./BodySection.js";
19
- import { ParameterSection as y } from "./ParameterSection.js";
20
- import { SecuritySection as $ } from "./SecuritySection.js";
21
- import { ServerSection as ee } from "./ServerSection.js";
22
- import { ApiExamples as te } from "../../../api-playground-2/ApiExamples.js";
23
- function Oe({
24
- endpoint: t,
25
- inputs: a,
26
- setInputs: m,
27
- pathname: j
28
- }) {
29
- var k;
30
- const [{ pageMetadata: b }] = R(), [v, A] = C(0), { prefillExamplesEnabled: f, generatedRequestExampleData: p } = I(), S = U(t.request.security), {
31
- isSending: E,
32
- selectedBaseUrlIndex: D,
33
- isPlaygroundExpanded: g,
34
- setIsPlaygroundExpanded: F,
35
- sendRequest: M,
36
- result: l,
37
- selectedExampleIndex: d
38
- } = B(K), h = (k = t.servers) == null ? void 0 : k[D], q = X(t), V = q[v], n = h == null ? void 0 : h.variables;
39
- return J(() => {
40
- var N;
41
- if (!g) return;
42
- const e = f ? p[d ?? 0] : JSON.parse(JSON.stringify(a));
43
- if (n) {
44
- const i = {};
45
- Object.entries(n).forEach(([o, c]) => {
46
- e.server[o] === void 0 && (i[o] = String(c.default));
47
- }), e.server = { ...e.server, ...i };
48
- }
49
- [
50
- ["header", t.request.parameters.header],
51
- ["path", t.request.parameters.path],
52
- ["query", t.request.parameters.query],
53
- ["cookie", t.request.parameters.cookie]
54
- ].forEach(([i, o]) => {
55
- var O;
56
- const c = f ? (O = p[d ?? 0]) == null ? void 0 : O[i] : W(o);
57
- e[i] = {
58
- ...c,
59
- ...w[i],
60
- ...e[i]
61
- };
62
- });
63
- const x = G(
64
- S
65
- );
66
- e.query = { ...e.query, ...x.query }, e.header = { ...e.header, ...x.header }, e.cookie = { ...e.cookie, ...x.cookie };
67
- const u = Object.values(t.request.body)[0];
68
- if (u != null && u.schemaArray.length) {
69
- const i = f ? (N = p[d ?? 0]) == null ? void 0 : N.body : Q(u.schemaArray[0]), o = w.body;
70
- if (typeof i == "object" && i !== null)
71
- e.body = Object.assign(
72
- {},
73
- i,
74
- o,
75
- typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {}
76
- );
77
- else if (Object.keys(o).length) {
78
- const c = typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {};
79
- e.body = { ...o, ...c };
80
- } else e.body === void 0 && i !== void 0 && (e.body = i);
81
- }
82
- JSON.stringify(e) !== JSON.stringify(a) && m(e);
83
- }, [g, t, d, S]), /* @__PURE__ */ s(
84
- Z,
85
- {
86
- isPlaygroundExpanded: g,
87
- setIsPlaygroundExpanded: F,
88
- children: [
89
- /* @__PURE__ */ s("div", { className: "mint:flex mint:items-center mint:justify-between mint:gap-x-2", children: [
90
- /* @__PURE__ */ r(L, { endpoint: t, pathname: j }),
91
- /* @__PURE__ */ r(T, { endpoint: t, hasGrayBackground: !0, display: "interactive" }),
92
- /* @__PURE__ */ r(
93
- Y,
94
- {
95
- label: "Send",
96
- method: t.method,
97
- isSending: E,
98
- onClick: M,
99
- className: "mint:w-20"
100
- }
101
- )
102
- ] }),
103
- /* @__PURE__ */ s("div", { className: "mint:grid mint:grid-cols-1 mint:lg:grid-cols-5 mint:gap-x-8 mint:gap-y-6 mint:mt-5 mint:relative", children: [
104
- /* @__PURE__ */ s("div", { className: "mint:col-span-1 mint:lg:col-span-3", children: [
105
- /* @__PURE__ */ s("div", { className: "mint:space-y-1 mint:min-w-full mint:w-full mint:max-w-full mint:overflow-hidden", children: [
106
- /* @__PURE__ */ r("div", { className: "mint:text-base mint:font-medium mint:text-gray-900 mint:dark:text-white mint:max-w-full", children: t.title }),
107
- /* @__PURE__ */ r("div", { className: "mint:flex mint:items-start mint:gap-x-12 mint:justify-between mint:max-w-full! mint:overflow-x-auto", children: b.description && /* @__PURE__ */ r(
108
- H,
109
- {
110
- markdown: b.description,
111
- className: "mint:text-sm mint:text-gray-500 mint:dark:text-gray-400"
112
- }
113
- ) })
114
- ] }),
115
- l && /* @__PURE__ */ r(P, { result: l, className: "mint:mt-6 mint:block mint:lg:hidden" }),
116
- /* @__PURE__ */ s("div", { className: "mint:space-y-2 mint:mt-6", children: [
117
- n && Object.keys(n).length > 0 && /* @__PURE__ */ r(
118
- ee,
119
- {
120
- variables: n,
121
- value: a.server,
122
- setValue: (e) => m({ ...a, server: e })
123
- }
124
- ),
125
- V && /* @__PURE__ */ r(
126
- $,
127
- {
128
- inputs: a,
129
- setInputs: m,
130
- securityOptions: q,
131
- selectedSecurityOptionIndex: v,
132
- setSelectedSecurityOptionIndex: A
133
- }
134
- ),
135
- /* @__PURE__ */ r(
136
- y,
137
- {
138
- name: "Header",
139
- value: a.header,
140
- setValue: (e) => m({ ...a, header: e }),
141
- parameters: t.request.parameters.header
142
- }
143
- ),
144
- /* @__PURE__ */ r(
145
- y,
146
- {
147
- name: "Cookie",
148
- value: a.cookie,
149
- setValue: (e) => m({ ...a, cookie: e }),
150
- parameters: t.request.parameters.cookie
151
- }
152
- ),
153
- /* @__PURE__ */ r(
154
- y,
155
- {
156
- name: "Path",
157
- value: a.path,
158
- setValue: (e) => m({ ...a, path: e }),
159
- parameters: t.request.parameters.path
160
- }
161
- ),
162
- /* @__PURE__ */ r(
163
- y,
164
- {
165
- name: "Query",
166
- value: a.query,
167
- setValue: (e) => m({ ...a, query: e }),
168
- parameters: t.request.parameters.query
169
- }
170
- ),
171
- /* @__PURE__ */ r(
172
- _,
173
- {
174
- value: a.body,
175
- setValue: (e) => m({ ...a, body: e }),
176
- body: t.request.body
177
- }
178
- )
179
- ] })
180
- ] }),
181
- /* @__PURE__ */ s(
182
- "div",
183
- {
184
- className: z(
185
- "mint:p-px mint:col-span-1 mint:lg:col-span-2 mint:lg:space-y-6 mint:lg:flex mint:lg:sticky mint:lg:top-0 mint:lg:self-start mint:lg:h-[calc(100vh-5.5rem)]",
186
- l && "mint:lg:flex-col mint:overflow-y-auto mint:lg:-top-12 mint:lg:h-screen"
187
- ),
188
- children: [
189
- l && /* @__PURE__ */ r(P, { result: l, className: "mint:hidden mint:lg:block mint:min-h-fit" }),
190
- /* @__PURE__ */ r(te, { isModal: !0, "data-testid": "api-playground-request-example", className: "mint:xl:w-full" })
191
- ]
192
- }
193
- )
194
- ] })
195
- ]
196
- }
197
- );
198
- }
199
- export {
200
- Oe as PlaygroundModal
201
- };
@@ -1,146 +0,0 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { useMemo as y } from "react";
3
- import "@mintlify/validation";
4
- import { cn as b } from "../../../utils/cn.js";
5
- import { InputSectionContainer as g } from "../components/InputSectionContainer.js";
6
- import { TypeDropdown as w } from "../components/TypeDropdown.js";
7
- import { RecursiveInput as P } from "./inputs/RecursiveInput.js";
8
- const B = "Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.", S = "Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.", V = "The access token received from the authorization server in the OAuth 2.0 flow.", M = ({
9
- inputs: e,
10
- setInputs: t,
11
- securityOptions: o,
12
- selectedSecurityOptionIndex: s,
13
- setSelectedSecurityOptionIndex: c
14
- }) => {
15
- const n = o[s], h = y(() => n ? ["header", "query", "cookie"].flatMap(
16
- (r) => Object.entries(n.parameters[r]).map(([i, f]) => {
17
- const {
18
- schemaArray: p,
19
- transform: l,
20
- value: u
21
- } = j(f, e[r][i]);
22
- return /* @__PURE__ */ d(
23
- P,
24
- {
25
- name: i,
26
- schemaArray: p,
27
- value: u,
28
- setValue: (a) => {
29
- const m = {
30
- ...e,
31
- [r]: { ...e[r] }
32
- };
33
- m[r][i] = l(a), t(m);
34
- },
35
- clearValue: u === void 0 ? void 0 : () => {
36
- const a = {
37
- ...e,
38
- [r]: { ...e[r] }
39
- };
40
- delete a[r][i], t(a);
41
- }
42
- },
43
- `${r}:${i}`
44
- );
45
- })
46
- ) : null, [n, t, e]);
47
- return /* @__PURE__ */ d(
48
- g,
49
- {
50
- name: "Authorization",
51
- rightElement: /* @__PURE__ */ d(
52
- "div",
53
- {
54
- onClick: (r) => r.stopPropagation(),
55
- className: b("mint:text-xs mint:font-mono", o.length <= 1 && "mint:hidden"),
56
- children: /* @__PURE__ */ d(
57
- w,
58
- {
59
- options: o.map((r) => ({
60
- label: r.title,
61
- schema: r
62
- })),
63
- selectedIndex: s,
64
- onSelectOption: (r) => {
65
- c(r);
66
- }
67
- }
68
- )
69
- }
70
- ),
71
- children: h
72
- }
73
- );
74
- }, j = (e, t) => ({
75
- schemaArray: x(e),
76
- transform: A(e),
77
- value: q(e, t)
78
- }), x = (e) => {
79
- const t = k(e);
80
- switch (e.type) {
81
- case "apiKey":
82
- return [
83
- {
84
- type: "string",
85
- required: !0,
86
- description: t,
87
- default: e["x-default"]
88
- }
89
- ];
90
- case "http":
91
- return e.scheme === "basic" ? [
92
- {
93
- type: "object",
94
- required: !0,
95
- description: t,
96
- properties: {
97
- username: [{ type: "string" }],
98
- password: [{ type: "string" }]
99
- },
100
- additionalProperties: !1,
101
- default: e["x-default"]
102
- }
103
- ] : [
104
- {
105
- type: "string",
106
- required: !0,
107
- format: "bearer",
108
- description: t,
109
- default: e["x-default"]
110
- }
111
- ];
112
- case "oauth2":
113
- return [
114
- {
115
- type: "string",
116
- required: !0,
117
- format: "bearer",
118
- description: t
119
- }
120
- ];
121
- }
122
- }, k = (e) => {
123
- switch (e.type) {
124
- case "apiKey":
125
- return e.description;
126
- case "http":
127
- return e.description ?? (e.scheme === "basic" ? B : S);
128
- case "oauth2":
129
- return e.description ?? V;
130
- }
131
- }, q = (e, t) => {
132
- if (e.type !== "http" || e.scheme !== "basic" || typeof t != "string" || !t.startsWith("Basic "))
133
- return t;
134
- const o = t.slice(6), s = Buffer.from(o, "base64").toString("utf-8"), [c, n] = s.split(":");
135
- return { username: c, password: n };
136
- }, A = (e) => e.type !== "http" || e.scheme !== "basic" ? (t) => t : (t) => {
137
- const o = t && typeof t == "object" && "username" in t ? t.username : void 0, s = t && typeof t == "object" && "password" in t ? t.password : void 0, c = `${o ?? ""}:${s ?? ""}`;
138
- return `Basic ${Buffer.from(c).toString("base64")}`;
139
- };
140
- export {
141
- M as SecuritySection,
142
- B as basicDescription,
143
- S as bearerDescription,
144
- k as getDescriptionForSecurityParameter,
145
- V as oauth2Description
146
- };
@@ -1,30 +0,0 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { useMemo as u } from "react";
3
- import { InputSectionContainer as p } from "../components/InputSectionContainer.js";
4
- import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
5
- const O = ({ variables: o, value: e, setValue: n }) => {
6
- const i = u(() => Object.entries(o).map(([r, s]) => {
7
- const a = e[r];
8
- return /* @__PURE__ */ c(
9
- l,
10
- {
11
- name: r,
12
- schemaArray: [s],
13
- value: a,
14
- setValue: (t) => {
15
- const m = { ...e };
16
- m[r] = String(t), n(m);
17
- },
18
- clearValue: a === void 0 ? void 0 : () => {
19
- const t = { ...e };
20
- delete t[r], n(t);
21
- }
22
- },
23
- r
24
- );
25
- }), [o, n, e]);
26
- return /* @__PURE__ */ c(p, { name: "Server", children: i });
27
- };
28
- export {
29
- O as ServerSection
30
- };
@@ -1,43 +0,0 @@
1
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
- import { useContext as f } from "react";
3
- import { usePrefilledInputs as a } from "../../../hooks/usePrefilledInputs/index.js";
4
- import { useSecurityOption as p } from "../../../hooks/useSecurityOption.js";
5
- import x from "../../../components/Api/ErrorBoundary.js";
6
- import "@mintlify/validation";
7
- import { cn as b } from "../../../utils/cn.js";
8
- import { ApiPlaygroundContext as g } from "../ApiPlaygroundContext.js";
9
- import { EndpointHeader as k } from "../components/PathHeader.js";
10
- import { PlaygroundModal as y } from "./PlaygroundModal.js";
11
- const w = ({ endpoint: r, inputs: i, setInputs: m, display: n, pathname: s }) => {
12
- var l;
13
- const { selectedBaseUrlIndex: u, setIsPlaygroundExpanded: o } = f(g), t = (l = r.servers) == null ? void 0 : l[u], c = p(r.request.security);
14
- return a({
15
- inputs: i,
16
- setInputs: m,
17
- baseUrl: t == null ? void 0 : t.url,
18
- securityOption: c,
19
- userInfoInputs: void 0
20
- }), /* @__PURE__ */ e(x, { children: /* @__PURE__ */ d(
21
- "div",
22
- {
23
- className: b(
24
- "mint:flex mint:w-full mint:flex-col mint:bg-background-light mint:dark:bg-background-dark mint:border-standard mint:rounded-2xl",
25
- n === "simple" ? "mint:p-1" : "mint:p-1.5"
26
- ),
27
- children: [
28
- /* @__PURE__ */ e(
29
- k,
30
- {
31
- endpoint: r,
32
- display: n,
33
- onClickInteractive: () => o == null ? void 0 : o(!0)
34
- }
35
- ),
36
- /* @__PURE__ */ e(y, { endpoint: r, inputs: i, setInputs: m, pathname: s })
37
- ]
38
- }
39
- ) });
40
- };
41
- export {
42
- w as Request
43
- };
@@ -1,93 +0,0 @@
1
- import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
- import { useState as w, useMemo as E } from "react";
3
- import { generateUniqueString as f } from "../../../../utils/uuid.js";
4
- import { useGenerateNextItems as N } from "../../../../hooks/useGenerateNextItems.js";
5
- import { AddRegular as C } from "@fluentui/react-icons";
6
- import "@mintlify/validation";
7
- import { cn as k } from "../../../../utils/cn.js";
8
- import { InputContainer as K } from "../../components/InputContainer.js";
9
- import { RecursiveInput as V } from "./RecursiveInput.js";
10
- const H = ({
11
- name: n,
12
- schema: m,
13
- typeDropdown: i,
14
- value: t,
15
- setValue: o,
16
- clearValue: g,
17
- depth: p,
18
- parentNames: x
19
- }) => {
20
- const [l, u] = w((t == null ? void 0 : t.map(f)) ?? []), h = N(m), A = E(() => {
21
- const c = (t == null ? void 0 : t.map((d, e) => /* @__PURE__ */ r(
22
- V,
23
- {
24
- schemaArray: h,
25
- value: d,
26
- setValue: (s) => {
27
- const a = [...t];
28
- a[e] = s, o(a);
29
- },
30
- clearValue: () => {
31
- const s = [...t];
32
- s.splice(e, 1), u((a) => {
33
- const y = [...a];
34
- return y.splice(e, 1), y;
35
- }), o(s);
36
- },
37
- depth: p + 1,
38
- arrayIndex: e
39
- },
40
- l[e]
41
- ))) ?? [], I = () => {
42
- u((d) => [...d, f()]), o([...t ?? [], void 0]);
43
- };
44
- return c.push(
45
- /* @__PURE__ */ r(
46
- j,
47
- {
48
- label: "Add an item",
49
- className: k(c.length > 0 && "mint:mt-4"),
50
- onClick: I,
51
- dataTestId: n + "-add-item-button"
52
- },
53
- "add-button"
54
- )
55
- ), c;
56
- }, [l, h, t, o, p, n]);
57
- return /* @__PURE__ */ r(
58
- K,
59
- {
60
- name: n,
61
- typeDropdown: i,
62
- schema: m,
63
- onClear: g,
64
- parentNames: x,
65
- isArray: !0,
66
- children: A
67
- }
68
- );
69
- };
70
- function j({
71
- className: n,
72
- onClick: m,
73
- label: i,
74
- dataTestId: t
75
- }) {
76
- return /* @__PURE__ */ r("div", { className: n, children: /* @__PURE__ */ b(
77
- "button",
78
- {
79
- "aria-label": i,
80
- className: "mint:flex mint:text-playground-input mint:w-fit mint:items-center mint:gap-x-1.5 mint:py-1! mint:px-2! mint:hover:bg-gray-50 mint:dark:hover:bg-white/[0.03] mint:cursor-pointer",
81
- onClick: m,
82
- "data-testid": t,
83
- children: [
84
- /* @__PURE__ */ r(C, { className: "mint:h-3 mint:w-3" }),
85
- /* @__PURE__ */ r("span", { className: "mint:text-gray-600 mint:dark:text-gray-200", children: i })
86
- ]
87
- }
88
- ) });
89
- }
90
- export {
91
- j as AddAdditionalItemButton,
92
- H as ArrayInput
93
- };