@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
@@ -0,0 +1,92 @@
1
+ import { CodeBuilder as w } from "../../../helpers/code-builder.js";
2
+ import { getHeader as E, getHeaderName as O, isMimeTypeJSON as S } from "../../../helpers/headers.js";
3
+ import { quote as i } from "../../../helpers/shell.js";
4
+ const J = {
5
+ "http1.0": "0",
6
+ "url ": "",
7
+ cookie: "b",
8
+ data: "d",
9
+ form: "F",
10
+ globoff: "g",
11
+ header: "H",
12
+ insecure: "k",
13
+ request: "X"
14
+ }, U = ($) => (d) => {
15
+ if ($) {
16
+ const l = J[d];
17
+ return l ? `-${l}` : "";
18
+ }
19
+ return `--${d}`;
20
+ }, F = {
21
+ info: {
22
+ key: "curl",
23
+ title: "cURL",
24
+ link: "http://curl.haxx.se/",
25
+ description: "cURL is a command line tool and library for transferring data with URL syntax",
26
+ extname: ".sh"
27
+ },
28
+ convert: ({ fullUrl: $, method: d, httpVersion: l, headersObj: a, allHeaders: s, postData: o }, h = {}) => {
29
+ var g;
30
+ const { indent: m = " ", short: b = !1, binary: c = !1, globOff: x = !1 } = h, y = " ", { push: n, join: k } = new w({
31
+ ...typeof m == "string" ? { indent: m } : {},
32
+ join: m !== !1 ? ` \\
33
+ ${m}` : " "
34
+ }), r = U(b);
35
+ let u = i($);
36
+ if (n(`curl ${r("request")} ${d}`), x && (u = unescape(u), n(r("globoff"))), n(`${r("url ")}${u}`), l === "HTTP/1.0" && n(r("http1.0")), E(s, "accept-encoding") && n("--compressed"), o.mimeType === "multipart/form-data") {
37
+ const e = O(a, "content-type");
38
+ if (e) {
39
+ const t = a[e];
40
+ if (e && t) {
41
+ const f = String(t).replace(/; boundary.+?(?=(;|$))/, "");
42
+ a[e] = f, s[e] = f;
43
+ }
44
+ }
45
+ }
46
+ switch (Object.keys(a).sort().forEach((e) => {
47
+ const t = `${e}: ${a[e]}`;
48
+ n(`${r("header")} ${i(t)}`);
49
+ }), s.cookie && n(`${r("cookie")} ${i(s.cookie)}`), o.mimeType) {
50
+ case "multipart/form-data":
51
+ (g = o.params) == null || g.forEach((e) => {
52
+ let t = "";
53
+ e.fileName ? t = `${e.name}='@${e.fileName}'` : t = i(`${e.name}=${e.value}`), n(`${r("form")} ${t}`);
54
+ });
55
+ break;
56
+ case "application/x-www-form-urlencoded":
57
+ o.params ? o.params.forEach((e) => {
58
+ const t = e.name, f = encodeURIComponent(e.name), p = f !== t, N = p ? f : t, T = c ? "--data-binary" : p ? "--data-urlencode" : r("data");
59
+ n(`${T} ${i(`${N}=${e.value}`)}`);
60
+ }) : n(`${c ? "--data-binary" : r("data")} ${i(o.text)}`);
61
+ break;
62
+ default: {
63
+ if (!o.text)
64
+ break;
65
+ let e = !1;
66
+ if (S(o.mimeType) && o.text.length > 20)
67
+ try {
68
+ const t = JSON.parse(o.text);
69
+ e = !0, o.text.indexOf("'") > 0 ? n(
70
+ `${c ? "--data-binary" : r("data")} @- <<EOF
71
+ ${JSON.stringify(
72
+ t,
73
+ null,
74
+ y
75
+ )}
76
+ EOF`
77
+ ) : n(
78
+ `${c ? "--data-binary" : r("data")} '
79
+ ${JSON.stringify(t, null, y)}
80
+ '`
81
+ );
82
+ } catch {
83
+ }
84
+ e || n(`${c ? "--data-binary" : r("data")} ${i(o.text)}`);
85
+ }
86
+ }
87
+ return k();
88
+ }
89
+ };
90
+ export {
91
+ F as curl
92
+ };
@@ -0,0 +1,56 @@
1
+ import { CodeBuilder as b } from "../../../helpers/code-builder.js";
2
+ import { quote as r } from "../../../helpers/shell.js";
3
+ const g = {
4
+ info: {
5
+ key: "httpie",
6
+ title: "HTTPie",
7
+ link: "http://httpie.org/",
8
+ description: "a CLI, cURL-like tool for humans",
9
+ extname: ".sh",
10
+ installation: () => "brew install httpie"
11
+ },
12
+ convert: ({ allHeaders: h, postData: i, queryObj: a, fullUrl: u, method: y, url: f }, $) => {
13
+ var c;
14
+ const e = {
15
+ body: !1,
16
+ cert: !1,
17
+ headers: !1,
18
+ indent: " ",
19
+ pretty: !1,
20
+ print: !1,
21
+ queryParams: !1,
22
+ short: !1,
23
+ style: !1,
24
+ timeout: !1,
25
+ verbose: !1,
26
+ verify: !1,
27
+ ...$
28
+ }, { push: o, join: m, unshift: l } = new b({
29
+ indent: e.indent,
30
+ // @ts-expect-error SEEMS LEGIT
31
+ join: e.indent !== !1 ? ` \\
32
+ ${e.indent}` : " "
33
+ });
34
+ let p = !1;
35
+ const t = [];
36
+ e.headers && t.push(e.short ? "-h" : "--headers"), e.body && t.push(e.short ? "-b" : "--body"), e.verbose && t.push(e.short ? "-v" : "--verbose"), e.print && t.push(`${e.short ? "-p" : "--print"}=${e.print}`), e.verify && t.push(`--verify=${e.verify}`), e.cert && t.push(`--cert=${e.cert}`), e.pretty && t.push(`--pretty=${e.pretty}`), e.style && t.push(`--style=${e.style}`), e.timeout && t.push(`--timeout=${e.timeout}`), e.queryParams && Object.keys(a).forEach((s) => {
37
+ const n = a[s];
38
+ Array.isArray(n) ? n.forEach((v) => {
39
+ o(`${s}==${r(v)}`);
40
+ }) : o(`${s}==${r(n)}`);
41
+ }), Object.keys(h).sort().forEach((s) => {
42
+ o(`${s}:${r(h[s])}`);
43
+ }), i.mimeType === "application/x-www-form-urlencoded" ? (c = i.params) != null && c.length && (t.push(e.short ? "-f" : "--form"), i.params.forEach((s) => {
44
+ o(`${s.name}=${r(s.value)}`);
45
+ })) : p = !0;
46
+ const d = t.length ? `${t.join(" ")} ` : "";
47
+ if (f = r(e.queryParams ? f : u), l(`http ${d}${y} ${f}`), p && i.text) {
48
+ const s = r(i.text);
49
+ l(`echo ${s} | `);
50
+ }
51
+ return m();
52
+ }
53
+ };
54
+ export {
55
+ g as httpie
56
+ };
@@ -0,0 +1,19 @@
1
+ import { curl as l } from "./curl/client.js";
2
+ import { httpie as t } from "./httpie/client.js";
3
+ import { wget as e } from "./wget/client.js";
4
+ const m = {
5
+ info: {
6
+ key: "shell",
7
+ title: "Shell",
8
+ default: "curl",
9
+ cli: "%s"
10
+ },
11
+ clientsById: {
12
+ curl: l,
13
+ httpie: t,
14
+ wget: e
15
+ }
16
+ };
17
+ export {
18
+ m as shell
19
+ };
@@ -0,0 +1,30 @@
1
+ import { CodeBuilder as c } from "../../../helpers/code-builder.js";
2
+ import { quote as o, escape as h } from "../../../helpers/shell.js";
3
+ const u = {
4
+ info: {
5
+ key: "wget",
6
+ title: "Wget",
7
+ link: "https://www.gnu.org/software/wget/",
8
+ description: "a free software package for retrieving files using HTTP, HTTPS",
9
+ extname: ".sh"
10
+ },
11
+ convert: ({ method: i, postData: n, allHeaders: r, fullUrl: f }, d) => {
12
+ const e = {
13
+ indent: " ",
14
+ short: !1,
15
+ verbose: !1,
16
+ ...d
17
+ }, { push: t, join: g } = new c({
18
+ ...typeof e.indent == "string" ? { indent: e.indent } : {},
19
+ join: e.indent !== !1 ? ` \\
20
+ ${e.indent}` : " "
21
+ });
22
+ return e.verbose ? t(`wget ${e.short ? "-v" : "--verbose"}`) : t(`wget ${e.short ? "-q" : "--quiet"}`), t(`--method ${o(i)}`), Object.keys(r).forEach((s) => {
23
+ const a = `${s}: ${r[s]}`;
24
+ t(`--header ${o(a)}`);
25
+ }), n.text && t(`--body-data ${h(o(n.text))}`), t(e.short ? "-O" : "--output-document"), t(`- ${o(f)}`), g();
26
+ }
27
+ };
28
+ export {
29
+ u as wget
30
+ };
@@ -0,0 +1,38 @@
1
+ const a = (t, r) => r.repeat(t), j = (t, r, c, n) => {
2
+ const o = a(n, c), e = a(n - 1, c), i = r ? `,
3
+ ${o}` : ", ";
4
+ return r ? `[
5
+ ${o}${t.join(i)}
6
+ ${e}]` : `[${t.join(i)}]`;
7
+ }, b = (t, r, c) => `let ${t} = ${s(r, c)}`, s = (t, r, c) => {
8
+ switch (c = c === void 0 ? 1 : c + 1, Object.prototype.toString.call(t)) {
9
+ case "[object Number]":
10
+ return t;
11
+ case "[object Array]": {
12
+ let n = !1;
13
+ const o = t.map((e) => (Object.prototype.toString.call(e) === "[object Object]" && (n = Object.keys(e).length > 1), s(e, r, c)));
14
+ return j(o, n, r.indent, c);
15
+ }
16
+ case "[object Object]": {
17
+ const n = [];
18
+ for (const o in t)
19
+ n.push(`"${o}": ${s(t[o], r, c)}`);
20
+ return j(
21
+ n,
22
+ // @ts-expect-error needs better types
23
+ r.pretty && n.length > 1,
24
+ // @ts-expect-error needs better types
25
+ r.indent,
26
+ c
27
+ );
28
+ }
29
+ case "[object Boolean]":
30
+ return t.toString();
31
+ default:
32
+ return t == null ? "nil" : `"${t.toString().replace(/"/g, '\\"')}"`;
33
+ }
34
+ };
35
+ export {
36
+ b as literalDeclaration,
37
+ s as literalRepresentation
38
+ };
@@ -0,0 +1,14 @@
1
+ import { urlsession as s } from "./urlsession/client.js";
2
+ const i = {
3
+ info: {
4
+ key: "swift",
5
+ title: "Swift",
6
+ default: "urlsession"
7
+ },
8
+ clientsById: {
9
+ urlsession: s
10
+ }
11
+ };
12
+ export {
13
+ i as swift
14
+ };
@@ -0,0 +1,59 @@
1
+ import { CodeBuilder as h } from "../../../helpers/code-builder.js";
2
+ import { literalDeclaration as c, literalRepresentation as j } from "../helpers.js";
3
+ const R = {
4
+ info: {
5
+ key: "urlsession",
6
+ title: "URLSession",
7
+ link: "https://developer.apple.com/documentation/foundation/urlsession",
8
+ description: "Foundation's URLSession request",
9
+ extname: ".swift"
10
+ },
11
+ convert: ({ allHeaders: i, postData: t, uriObj: d, queryObj: l, method: f }, y) => {
12
+ var p;
13
+ const n = {
14
+ indent: " ",
15
+ pretty: !0,
16
+ timeout: 10,
17
+ ...y
18
+ }, { push: e, blank: a, join: b } = new h({ indent: n.indent });
19
+ e("import Foundation"), a();
20
+ const m = t.text || t.jsonObj || t.params;
21
+ if (m)
22
+ switch (t.mimeType) {
23
+ case "application/x-www-form-urlencoded":
24
+ if ((p = t.params) != null && p.length) {
25
+ const o = t.params.map((r) => `"${r.name}": "${r.value}"`);
26
+ n.pretty ? (e("let parameters = ["), o.forEach((r) => {
27
+ e(`${r},`, 1);
28
+ }), e("]")) : e(`let parameters = [${o.join(", ")}]`), e('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'), e("let postData = Data(joinedParameters.utf8)"), a();
29
+ }
30
+ break;
31
+ case "application/json":
32
+ t.jsonObj && (e(`${c("parameters", t.jsonObj, n)} as [String : Any?]`), a(), e("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"), a());
33
+ break;
34
+ case "multipart/form-data":
35
+ e(c("parameters", t.params, n)), a(), e(`let boundary = "${t.boundary}"`), a(), e('var body = ""'), e("for param in parameters {"), e('let paramName = param["name"]!', 1), e('body += "--\\(boundary)\\r\\n"', 1), e('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""', 1), e('if let filename = param["fileName"] {', 1), e('let contentType = param["contentType"]!', 2), e("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)", 2), e('body += "; filename=\\"\\(filename)\\"\\r\\n"', 2), e('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"', 2), e("body += fileContent", 2), e('} else if let paramValue = param["value"] {', 1), e('body += "\\r\\n\\r\\n\\(paramValue)"', 2), e("}", 1), e("}"), a(), e("let postData = Data(body.utf8)"), a();
36
+ break;
37
+ default:
38
+ e(`let postData = Data("${t.text}".utf8)`), a();
39
+ }
40
+ e(`let url = URL(string: "${d.href}")!`);
41
+ const u = l ? Object.entries(l) : [];
42
+ return u.length < 1 ? e("var request = URLRequest(url: url)") : (e("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"), e("let queryItems: [URLQueryItem] = ["), u.forEach((o) => {
43
+ const r = o[0], s = o[1];
44
+ switch (Object.prototype.toString.call(s)) {
45
+ case "[object String]":
46
+ e(`URLQueryItem(name: "${r}", value: "${s}"),`, 1);
47
+ break;
48
+ case "[object Array]":
49
+ s.forEach(($) => {
50
+ e(`URLQueryItem(name: "${r}", value: "${$}"),`, 1);
51
+ });
52
+ break;
53
+ }
54
+ }), e("]"), e("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"), a(), e("var request = URLRequest(url: components.url!)")), e(`request.httpMethod = "${f}"`), e(`request.timeoutInterval = ${n.timeout}`), Object.keys(i).length && e(`request.allHTTPHeaderFields = ${j(i, n)}`), m && e("request.httpBody = postData"), a(), e("let (data, _) = try await URLSession.shared.data(for: request)"), e("print(String(decoding: data, as: UTF8.self))"), b();
55
+ }
56
+ };
57
+ export {
58
+ R as urlsession
59
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ApiPlaygroundDisplayType } from '@mintlify/models';
2
1
  import { ApiPlaygroundInputs } from '@mintlify/validation';
3
2
  import { ApiPlaygroundResultType } from '@mintlify/models';
4
3
  import { AsyncAPIDocumentInterface } from '@mintlify/common';
@@ -22,9 +21,11 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
22
21
  import { MdxExtracts as MdxExtracts_2 } from '@mintlify/common';
23
22
  import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
24
23
  import { MintConfig } from '@mintlify/models';
24
+ import { NamedExoticComponent } from 'react';
25
25
  import { Node as Node_2 } from 'unist';
26
26
  import { Node as Node_3 } from 'hast';
27
27
  import { OpenApiMetadata } from '@mintlify/models';
28
+ import { openApiToSchemaGraph } from '@mintlify/validation';
28
29
  import { OpenAPIV3 } from 'openapi-types';
29
30
  import { OpenAPIV3_1 } from 'openapi-types';
30
31
  import { Operation } from '@mintlify/validation';
@@ -48,6 +49,7 @@ import { StoreApi } from 'zustand';
48
49
  import { Text as Text_2 } from 'hast';
49
50
  import { TrieveType } from '@mintlify/validation';
50
51
  import { UseBoundStore } from 'zustand';
52
+ import { UserInfoInputs } from '@mintlify/validation';
51
53
  import { UUID } from '@mintlify/validation';
52
54
 
53
55
  export declare const addApiReferenceDataFromMdxAndDocsConfig: ({ pageMetadata, apiReferenceData2, mdxExtracts, docsConfig, }: {
@@ -94,47 +96,23 @@ declare type ApiExamplesProps = {
94
96
  noInputs?: boolean;
95
97
  };
96
98
 
97
- export declare function ApiFields({ pageMetadata }: {
98
- pageMetadata: PageMetaTags;
99
- }): JSX_2.Element;
100
-
101
- export declare const ApiPlayground: ({ endpoint, display, pathname }: ApiPlaygroundParams) => JSX_2.Element;
102
-
103
- export declare const ApiPlaygroundContext: Context<ApiPlaygroundContextType>;
104
-
105
- export declare const ApiPlaygroundContextLegacy: Context<ApiPlaygroundContextTypeLegacy>;
99
+ export declare const ApiFields: NamedExoticComponent< {
100
+ pageMetadata: PageMetaTags;
101
+ }>;
106
102
 
107
- export declare type ApiPlaygroundContextType = {
108
- isSending?: boolean;
109
- sendRequest?: () => void;
110
- isPlaygroundExpanded: boolean;
111
- result?: ApiPlaygroundResultType;
112
- selectedBaseUrlIndex: number;
113
- setSelectedBaseUrlIndex?: (index: number) => void;
114
- setIsPlaygroundExpanded?: (expanded: boolean) => void;
115
- baseUrlOptions?: string[];
116
- selectedExampleIndex?: number;
117
- setSelectedExampleIndex?: (index: number) => void;
118
- };
103
+ declare const ApiPlaygroundContext: Context<ApiPlaygroundContextType>;
104
+ export { ApiPlaygroundContext }
105
+ export { ApiPlaygroundContext as ApiPlaygroundContextLegacy }
119
106
 
120
- export declare type ApiPlaygroundContextTypeLegacy = {
107
+ declare type ApiPlaygroundContextType = {
121
108
  isSending?: boolean;
122
109
  sendRequest?: () => void;
123
110
  isPlaygroundExpanded: boolean;
124
111
  result?: ApiPlaygroundResultType;
125
- selectedBaseUrlIndex: number;
126
- setSelectedBaseUrlIndex?: (index: number) => void;
127
112
  setIsPlaygroundExpanded?: (expanded: boolean) => void;
128
- baseUrlOptions?: string[];
129
- selectedExampleIndex?: number;
130
- setSelectedExampleIndex?: (index: number) => void;
131
- };
132
-
133
- declare type ApiPlaygroundParams = {
134
- endpoint: Endpoint;
135
- display: ApiPlaygroundDisplayType;
136
- pathname: string;
137
113
  };
114
+ export { ApiPlaygroundContextType }
115
+ export { ApiPlaygroundContextType as ApiPlaygroundContextTypeLegacy }
138
116
 
139
117
  export declare const ApiReferenceContext: Context<ApiReferenceContextType>;
140
118
 
@@ -171,8 +149,8 @@ export declare interface ApiReferenceDataV2 {
171
149
  schemaData?: SchemaV2;
172
150
  dependencies?: {
173
151
  parameters?: Record<UUID, ParameterObject>;
174
- requestBody?: RequestBodyObject;
175
- responses?: Record<UUID, ResponseObject>;
152
+ requestBody?: ResolvedRequestBody;
153
+ responses?: ResolvedResponses;
176
154
  servers: Record<UUID, ServerObject>;
177
155
  security: Record<UUID, ResolvedSecurityObject>;
178
156
  processedSecurityOptions?: ProcessedSecurityOption[];
@@ -521,16 +499,13 @@ export declare type ElementType = {
521
499
  tagName?: string;
522
500
  };
523
501
 
524
- export declare const EndpointFields: () => JSX_2.Element | null;
525
-
526
- export declare const EndpointHeader: ({ onCopy, baseUrlOptions, selectedBaseUrlIndex, setSelectedBaseUrlIndex, isCopiedActive, display, path, method, onBaseUrlChange, isInPlaygroundModal, }: EndpointHeaderProps) => JSX_2.Element;
502
+ export declare const EndpointHeader: ({ baseUrl, baseUrlOptions, selectedBaseUrlIndex, setSelectedBaseUrlIndex, display, path, method, onBaseUrlChange, isInPlaygroundModal, }: EndpointHeaderProps) => JSX_2.Element;
527
503
 
528
504
  declare type EndpointHeaderProps = {
529
- onCopy: () => void;
505
+ baseUrl: string;
530
506
  baseUrlOptions: string[];
531
507
  selectedBaseUrlIndex: number;
532
508
  setSelectedBaseUrlIndex: (index: number) => void;
533
- isCopiedActive: boolean;
534
509
  isInPlaygroundModal: boolean;
535
510
  display: 'simple' | 'none' | 'interactive';
536
511
  path: string;
@@ -703,6 +678,8 @@ declare interface NavTreeProps {
703
678
  anchors?: AnchorConfig[];
704
679
  }
705
680
 
681
+ export { openApiToSchemaGraph }
682
+
706
683
  export declare const OperationPage: ({ apiReferenceData, operation, children, }: {
707
684
  apiReferenceData: ApiReferenceDataV2;
708
685
  operation: OperationV2;
@@ -719,13 +696,14 @@ export declare type OperationV2 = Operation & {
719
696
  requestExamples?: CodeExample[];
720
697
  responseExamples?: CodeExample[];
721
698
  codeSamples?: CodeSample[];
722
- requestExampleType?: 'mdx' | 'webhook' | 'codeSamples' | 'generated';
699
+ requestExampleType?: 'mdx' | 'webhook' | 'codeSamples' | 'generated' | 'examples';
723
700
  requestExampleLanguages?: string[];
724
701
  requiredOnlyExamples?: boolean;
725
702
  responseExampleType?: 'mdx' | 'generated';
726
703
  prefillPlaygroundWithExample?: boolean;
727
- prefillPlaygroundExamples?: ApiPlaygroundInputs[];
704
+ prefillPlaygroundExamples?: Record<string, PlaygroundInputValue>[];
728
705
  disableProxy?: boolean;
706
+ userInfoPlaygroundInputs?: UserInfoInputs;
729
707
  };
730
708
 
731
709
  export declare const PageContext: Context<PageContextType>;
@@ -806,17 +784,28 @@ export declare interface PlainTextPageProps {
806
784
  export declare const Playground: ({ isPlaygroundExpanded, setIsPlaygroundExpanded, baseUrl, baseUrlOptions, apiReferenceData, }: PlaygroundProps) => JSX_2.Element | null;
807
785
 
808
786
  declare interface PlaygroundInputsState {
787
+ apiReferenceData: ApiReferenceDataV2 | undefined;
809
788
  inputs: Record<string, PlaygroundInputValue>;
810
- initialize: (initialValues: Record<string, PlaygroundInputValue>) => void;
789
+ initializeInputs: (initialValues: Record<string, PlaygroundInputValue>) => void;
790
+ initializeApiReferenceData: (apiReferenceData: ApiReferenceDataV2) => void;
811
791
  setInput: (name: string, value: PlaygroundInputValue) => void;
812
792
  setInputs: (inputs: Record<string, PlaygroundInputValue>) => void;
813
793
  replaceInputs: (inputs: Record<string, PlaygroundInputValue>) => void;
794
+ deleteInput: (name: string) => void;
814
795
  getInput: (name: string) => PlaygroundInputValue;
815
796
  getApiPlaygroundInputs: () => ApiPlaygroundInputs;
816
797
  clear: () => void;
817
798
  reset: () => void;
799
+ selectedBaseUrlIndex: number;
800
+ setSelectedBaseUrlIndex: (index: number) => void;
818
801
  selectedSecurityOptionIndex: number;
819
802
  setSelectedSecurityOptionIndex: (index: number) => void;
803
+ selectedExampleIndex: number;
804
+ setSelectedExampleIndex: (index: number) => void;
805
+ selectedRequestBodyContentTypeIndex: number;
806
+ setSelectedRequestBodyContentTypeIndex: (index: number) => void;
807
+ selectedResponseContentTypeIndex: number;
808
+ setSelectedResponseContentTypeIndex: (index: number) => void;
820
809
  }
821
810
 
822
811
  declare type PlaygroundInputValue = unknown;
@@ -830,8 +819,15 @@ declare type PlaygroundProps = {
830
819
  };
831
820
 
832
821
  export declare type ProcessedSecurityOption = {
822
+ schemes: Array<ProcessedSecurityScheme>;
823
+ title: string;
824
+ };
825
+
826
+ declare type ProcessedSecurityScheme = {
833
827
  scheme: SecuritySchemeAndScope;
834
828
  schema: SchemaObject;
829
+ schemeName: string;
830
+ name: string;
835
831
  };
836
832
 
837
833
  export declare const processSecurityOptions: (apiReferenceData: ApiReferenceDataV2) => ProcessedSecurityOption[];
@@ -860,6 +856,14 @@ export declare function remarkHeadingIds(): (tree: Root) => void;
860
856
 
861
857
  export declare function removeHtmlComments(root: Root_2): void;
862
858
 
859
+ declare type ResolvedRequestBody = RequestBodyObject & {
860
+ exampleType?: 'generated' | 'examples';
861
+ };
862
+
863
+ declare type ResolvedResponses = Record<UUID, ResponseObject & {
864
+ exampleType?: 'generated' | 'examples';
865
+ }>;
866
+
863
867
  /**
864
868
  * SchemaObject after being processed by the various transformations in `resolveOperationWithDependencies`.
865
869
  * This is the type of object that all the API UI components should be consuming. Any properties that
@@ -882,6 +886,7 @@ export declare type ResolvedSchemaObject = SchemaObject & {
882
886
  isCircular?: boolean;
883
887
  type?: DifferentiatedType;
884
888
  [CIRCULAR_REF_KEY]?: UUID;
889
+ typeLabel?: string;
885
890
  };
886
891
 
887
892
  export declare type ResolvedSecurityObject = {
@@ -991,30 +996,32 @@ export declare const useCopyPathWithInputs: ({ path, baseUrl }: {
991
996
  }) => string;
992
997
 
993
998
  /**
994
- * CLANKED
995
- * Syncs playground state with URL pathname changes.
999
+ * RE-CLANKED BUT BETTER THIS TIME
1000
+ * Simplified playground initialization hook.
996
1001
  *
997
- * This hook implements the following behavior:
998
- * - When the pathname changes, it resets the playground inputs
999
- * - After reset, it initializes with the new default values for the current endpoint
1000
- * - When playground closes without pathname change, state is preserved
1001
- * - Query parameter changes (like ?playground=open) do NOT reset the state
1002
+ * Assumes the Playground component remounts for each new page/endpoint,
1003
+ * so we don't need complex pathname tracking.
1002
1004
  *
1003
- * Uses refs to track previous pathname to avoid unnecessary resets.
1005
+ * Handles:
1006
+ * - Initial mount: Reset and initialize with defaults
1007
+ * - Credentials loading: Update inputs when credentials load from localStorage
1008
+ * - Example switching: Handled via selectedExampleIndex prop changes
1004
1009
  */
1005
- export declare function useInitializeInputs({ apiReferenceData, selectedBaseUrlIndex, selectedExampleIndex, selectedRequestBodyContentTypeIndex, }: UsePlaygroundStateSyncProps): void;
1006
-
1007
- export declare function useMarkdownCopy(pathname: string): void;
1008
-
1009
- export declare const usePlaygroundInputsStore: UseBoundStore<StoreApi<PlaygroundInputsState>>;
1010
+ export declare function useInitializeInputs({ apiReferenceData, selectedBaseUrlIndex, selectedExampleIndex, selectedRequestBodyContentTypeIndex, locallyStoredCredentials, serverInputs, }: UseInitializeInputsProps): void;
1010
1011
 
1011
- declare interface UsePlaygroundStateSyncProps {
1012
+ declare interface UseInitializeInputsProps {
1012
1013
  apiReferenceData: ApiReferenceDataV2;
1013
1014
  selectedBaseUrlIndex: number;
1014
1015
  selectedExampleIndex: number;
1015
1016
  selectedRequestBodyContentTypeIndex: number;
1017
+ locallyStoredCredentials: Record<string, any> | undefined;
1018
+ serverInputs: Record<string, string> | undefined;
1016
1019
  }
1017
1020
 
1021
+ export declare function useMarkdownCopy(pathname: string): void;
1022
+
1023
+ export declare const usePlaygroundInputsStore: UseBoundStore<StoreApi<PlaygroundInputsState>>;
1024
+
1018
1025
  export declare const useSelectedSecurityOption: () => {
1019
1026
  selectedSecurityOptionIndex: number;
1020
1027
  setSelectedSecurityOptionIndex: (index: number) => void;