@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,100 +1,106 @@
1
1
  import { useCallback as j } from "react";
2
- import { NEXT_PUBLIC as h } from "../../env.js";
3
- import { usePlaygroundInputsStore as w } from "./usePlaygroundInputsStore.js";
4
- const J = ({
5
- apiReferenceData: r,
6
- baseUrl: n,
7
- contentType: t = "application/json",
8
- setResult: s,
9
- setIsSending: e
2
+ import { NEXT_PUBLIC as b } from "../../env.js";
3
+ import { encodeBasicAuth as w } from "../schemaGraph/utils.js";
4
+ import { usePlaygroundInputsStore as z } from "./usePlaygroundInputsStore.js";
5
+ const H = ({
6
+ apiReferenceData: t,
7
+ baseUrl: e,
8
+ contentType: o = "application/json",
9
+ setResult: i,
10
+ setIsSending: r
10
11
  }) => {
11
- var l, u, y;
12
- const { getApiPlaygroundInputs: a } = w(), o = a(), d = (l = r.operation) == null ? void 0 : l.disableProxy, c = (u = r.operation) == null ? void 0 : u.path, f = (y = r.operation) == null ? void 0 : y.method;
12
+ var y, h, m;
13
+ const n = z((p) => p.getApiPlaygroundInputs), a = (y = t.operation) == null ? void 0 : y.disableProxy, c = (h = t.operation) == null ? void 0 : h.path, d = (m = t.operation) == null ? void 0 : m.method;
13
14
  return j(async () => {
14
- if (e(!0), !c || !n || !f || !t || !n) {
15
- e(!1), s({
15
+ const p = n();
16
+ if (r(!0), !c || !e || !d || !o || !e) {
17
+ r(!1), i({
16
18
  error: !0,
17
19
  errorMessage: "Missing required fields to send a playground request"
18
20
  }), console.error(
19
21
  `Missing some required field to send a playground request:
20
22
 
21
23
  path=${c}
22
- method=${f}
23
- contentType=${t}
24
- baseUrl=${n}`
24
+ method=${d}
25
+ contentType=${o}
26
+ baseUrl=${e}`
25
27
  );
26
28
  return;
27
29
  }
28
- const m = await import("axios").then((i) => i.default), b = O(c, o.path), g = x(P(n, o.server), b), S = A(o.header, t), p = {
29
- method: f,
30
- url: g,
31
- header: S,
32
- body: o.body,
33
- cookie: o.cookie,
34
- query: o.query
30
+ const A = await import("axios").then((s) => s.default), g = O(c, p.path), S = $(P(e, p.server), g);
31
+ let f = x(p.header, o);
32
+ f = C(f);
33
+ const u = {
34
+ method: d,
35
+ url: S,
36
+ header: f,
37
+ body: p.body,
38
+ cookie: p.cookie,
39
+ query: p.query
35
40
  };
41
+ let l;
36
42
  try {
37
- if (d) {
38
- const i = await $(p);
39
- s({
43
+ if (a) {
44
+ const s = await E(u);
45
+ l = s.status, i({
40
46
  error: !1,
41
47
  response: {
42
- status: i.status,
43
- statusText: i.statusText,
44
- headers: i.headers,
45
- data: i.data
48
+ status: s.status,
49
+ statusText: s.statusText,
50
+ headers: s.headers,
51
+ data: s.data
46
52
  }
47
53
  });
48
- } else if (t && t.includes("multipart/form-data")) {
49
- const i = await E(p);
50
- s(i);
54
+ } else if (o && o.includes("multipart/form-data")) {
55
+ const s = await F(u);
56
+ "response" in s && (l = s.response.status), i(s);
51
57
  } else {
52
- const { data: i } = await m.post(
53
- `${h.BASE_PATH}/_mintlify/api/request`,
54
- p
58
+ const { data: s } = await A.post(
59
+ `${b.BASE_PATH}/_mintlify/api/request`,
60
+ u
55
61
  );
56
- s(i);
62
+ "response" in s && (l = s.response.status), i(s);
57
63
  }
58
- } catch (i) {
59
- s({
64
+ } catch (s) {
65
+ i({
60
66
  error: !0,
61
67
  errorMessage: "unable to complete request"
62
- }), console.error(i);
68
+ }), console.error(s);
63
69
  }
64
- e(!1);
70
+ r(!1);
65
71
  }, [
66
- f,
72
+ d,
67
73
  c,
74
+ r,
75
+ n,
68
76
  e,
69
77
  o,
70
- n,
71
- t,
72
- d,
73
- s
78
+ a,
79
+ i
74
80
  ]);
75
- }, O = (r, n) => Object.entries(n).reduce((t, [s, e]) => e == null ? t : t.replace(`{${s}}`, encodeURIComponent(e.toString())), r), P = (r, n) => {
76
- let t = r;
77
- return Object.entries(n).forEach(([s, e]) => {
78
- e && (t = t.replace(`{${s}}`, e));
79
- }), t;
80
- }, x = (r, n) => r.replace(/\/$/, "") + "/" + n.replace(/^\//, ""), A = (r, n) => Object.keys(r).some((t) => t.toLowerCase() === "content-type") ? r : {
81
- ...r,
82
- "content-type": n
83
- }, $ = async (r) => {
84
- const n = await import("axios").then((a) => a.default), t = Object.keys(r.header).find(
85
- (a) => a.toLowerCase() === "content-type"
81
+ }, O = (t, e) => Object.entries(e).reduce((o, [i, r]) => r == null ? o : o.replace(`{${i}}`, encodeURIComponent(r.toString())), t), P = (t, e) => {
82
+ let o = t;
83
+ return Object.entries(e).forEach(([i, r]) => {
84
+ r && (o = o.replace(`{${i}}`, r));
85
+ }), o;
86
+ }, $ = (t, e) => t.replace(/\/$/, "") + "/" + e.replace(/^\//, ""), x = (t, e) => Object.keys(t).some((o) => o.toLowerCase() === "content-type") ? t : {
87
+ ...t,
88
+ "content-type": e
89
+ }, E = async (t) => {
90
+ const e = await import("axios").then((n) => n.default), o = Object.keys(t.header).find(
91
+ (n) => n.toLowerCase() === "content-type"
86
92
  );
87
- let s = r.body, e = r.header;
88
- if (t != null && t.includes("multipart/form-data")) {
89
- const { data: a, headers: o } = F(r);
90
- s = a, e = o;
93
+ let i = t.body, r = t.header;
94
+ if (o != null && o.includes("multipart/form-data")) {
95
+ const { data: n, headers: a } = B(t);
96
+ i = n, r = a;
91
97
  }
92
- return n({
93
- url: r.url,
94
- method: r.method,
95
- params: r.query,
96
- data: s,
97
- headers: e,
98
+ return e({
99
+ url: t.url,
100
+ method: t.method,
101
+ params: t.query,
102
+ data: i,
103
+ headers: r,
98
104
  // prevent axios from adding [] after array query params
99
105
  paramsSerializer: {
100
106
  indexes: null
@@ -104,52 +110,59 @@ baseUrl=${n}`
104
110
  validateStatus: () => !0,
105
111
  // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding
106
112
  // we can't use `responseEncoding` as it's ignored client-side
107
- transformResponse: (a) => Buffer.from(a).toString("base64")
113
+ transformResponse: (n) => Buffer.from(n).toString("base64")
108
114
  });
109
- }, E = async (r) => {
110
- const n = await import("axios").then((e) => e.default), t = new FormData();
111
- t.append(
115
+ }, F = async (t) => {
116
+ const e = await import("axios").then((r) => r.default), o = new FormData();
117
+ o.append(
112
118
  "requestInfo",
113
119
  JSON.stringify({
114
- method: r.method,
115
- url: r.url,
116
- header: r.header,
117
- query: r.query,
118
- cookie: r.cookie
120
+ method: t.method,
121
+ url: t.url,
122
+ header: t.header,
123
+ query: t.query,
124
+ cookie: t.cookie
119
125
  })
120
- ), typeof r.body == "object" && r.body !== null && Object.entries(r.body).forEach(([e, a]) => {
121
- a instanceof File ? t.append(e, a) : Array.isArray(a) ? a.forEach((o) => {
122
- o instanceof File ? t.append(e, o) : o != null && t.append(e, typeof o == "object" ? JSON.stringify(o) : o.toString());
123
- }) : a != null && t.append(e, typeof a == "object" ? JSON.stringify(a) : a.toString());
126
+ ), typeof t.body == "object" && t.body !== null && Object.entries(t.body).forEach(([r, n]) => {
127
+ n instanceof File ? o.append(r, n) : Array.isArray(n) ? n.forEach((a) => {
128
+ a instanceof File ? o.append(r, a) : a != null && o.append(r, typeof a == "object" ? JSON.stringify(a) : a.toString());
129
+ }) : n != null && o.append(r, typeof n == "object" ? JSON.stringify(n) : n.toString());
124
130
  });
125
- const { data: s } = await n.post(
126
- `${h.BASE_PATH}/_mintlify/api/file-request`,
127
- t
131
+ const { data: i } = await e.post(
132
+ `${b.BASE_PATH}/_mintlify/api/file-request`,
133
+ o
128
134
  );
129
- return s;
130
- }, F = (r) => {
131
- var s;
132
- let n = r.body;
133
- const t = r.header;
134
- if ((s = t["content-type"]) != null && s.includes("multipart/form-data")) {
135
- const e = new FormData();
136
- typeof n == "object" && n !== null && (Object.entries(n).forEach(([a, o]) => {
137
- o instanceof File ? e.append(a, o) : Array.isArray(o) ? o.forEach((d) => {
138
- d instanceof File ? e.append(a, d) : d != null && e.append(
139
- a,
140
- typeof d == "object" ? JSON.stringify(d) : d.toString()
135
+ return i;
136
+ }, B = (t) => {
137
+ var i;
138
+ let e = t.body;
139
+ const o = t.header;
140
+ if ((i = o["content-type"]) != null && i.includes("multipart/form-data")) {
141
+ const r = new FormData();
142
+ typeof e == "object" && e !== null && (Object.entries(e).forEach(([n, a]) => {
143
+ a instanceof File ? r.append(n, a) : Array.isArray(a) ? a.forEach((c) => {
144
+ c instanceof File ? r.append(n, c) : c != null && r.append(
145
+ n,
146
+ typeof c == "object" ? JSON.stringify(c) : c.toString()
141
147
  );
142
- }) : o != null && e.append(
143
- a,
144
- typeof o == "object" ? JSON.stringify(o) : o.toString()
148
+ }) : a != null && r.append(
149
+ n,
150
+ typeof a == "object" ? JSON.stringify(a) : a.toString()
145
151
  );
146
- }), n = e, delete t["content-type"]);
152
+ }), e = r, delete o["content-type"]);
153
+ }
154
+ return { data: e, headers: o };
155
+ }, C = (t) => {
156
+ if (!t.Authorization || typeof t.Authorization != "object") return t;
157
+ if (typeof t.Authorization == "object") {
158
+ const e = "username" in t.Authorization ? t.Authorization.username : "", o = "password" in t.Authorization ? t.Authorization.password : "", i = w(e, o);
159
+ t.Authorization = `Basic ${i}`, delete t.Authorization.username, delete t.Authorization.password;
147
160
  }
148
- return { data: n, headers: t };
161
+ return t;
149
162
  };
150
163
  export {
151
164
  O as addPathParams,
152
165
  P as addServerVariables,
153
- x as joinWithSingleSlash,
154
- J as useSendPlaygroundRequest
166
+ $ as joinWithSingleSlash,
167
+ H as useSendPlaygroundRequest
155
168
  };
@@ -1,56 +1,47 @@
1
1
  import { toShikiLang as w } from "../../constants/snippetPresets.js";
2
- import { mdxCodeExampleToExamples as f, getFirstWebhookExample as B } from "./processExamples.js";
2
+ import { mdxCodeExampleToExamples as R, getFirstWebhookExample as B } from "./processExamples.js";
3
3
  import { getDocsJsonSecurityOptions as F } from "./processSecurityOptions.js";
4
- import { generatePrefillRequestData as J } from "./utils.js";
5
- const R = (a) => {
4
+ import { getPrefillRequestExamples as J } from "./utils.js";
5
+ const W = (a) => {
6
6
  var p;
7
- const t = ((p = a.servers) == null ? void 0 : p.map((e) => e.url)) ?? [];
7
+ const l = ((p = a.servers) == null ? void 0 : p.map((e) => e.url)) ?? [];
8
8
  let r;
9
- return t.length > 1, r = t[0], {
9
+ return l.length > 1, r = l[0], {
10
10
  path: a.path,
11
11
  method: a.method,
12
12
  title: a.title ?? "",
13
13
  description: a.description ?? "",
14
14
  type: a.type ?? "path",
15
15
  baseUrl: r,
16
- baseUrlOptions: t,
16
+ baseUrlOptions: l,
17
17
  deprecated: a.deprecated
18
18
  };
19
- }, G = ({
19
+ }, I = ({
20
20
  pageMetadata: a,
21
- apiReferenceData2: t,
21
+ apiReferenceData2: l,
22
22
  mdxExtracts: r,
23
23
  docsConfig: p
24
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)
25
+ var u, y, h, b, q, x, E, U, O, T, S, d, P, v, f, k;
26
+ const e = l ?? { operation: void 0 };
27
+ if (!l && (r != null && r.endpoint) && (e.operation = W(r.endpoint)), a.description && e.operation && (e.operation.description = a.description), !e.operation)
28
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
29
+ const t = (y = (u = p == null ? void 0 : p.api) == null ? void 0 : u.mdx) == null ? void 0 : y.server, o = (b = (h = p == null ? void 0 : p.api) == null ? void 0 : h.mdx) == null ? void 0 : b.auth, i = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0;
30
+ if (typeof t == "string" && !i ? e.operation.baseUrl = t : Array.isArray(t) && !i && (t.length > 1 ? e.operation.baseUrlOptions = t : e.operation.baseUrl = t[0]), o && Object.keys(((q = e.dependencies) == null ? void 0 : q.security) ?? {}).length === 0) {
31
+ const A = F({
32
+ method: o.method,
33
+ name: o.name
34
34
  });
35
- o && (e.dependencies || (e.dependencies = {
35
+ A && (e.dependencies || (e.dependencies = {
36
36
  servers: {},
37
37
  security: {}
38
- }), e.dependencies.security = { ...o });
38
+ }), e.dependencies.security = { ...A });
39
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;
40
+ const s = (x = r == null ? void 0 : r.codeExamples) == null ? void 0 : x.request, n = (E = r == null ? void 0 : r.codeExamples) == null ? void 0 : E.response, D = (T = (O = (U = p == null ? void 0 : p.api) == null ? void 0 : U.examples) == null ? void 0 : O.languages) == null ? void 0 : T.map(w);
41
+ e.operation.requestExampleLanguages = D, s ? (e.operation.requestExamples = R(s), e.operation.requestExampleType = "mdx") : e.operation.type === "webhook" ? (e.operation.requestExamples = B(e, 0), e.operation.requestExampleType = "webhook") : e.operation.codeSamples && e.operation.codeSamples.length > 0 ? (e.operation.requestExampleType = "codeSamples", e.operation.requiredOnlyExamples = ((d = (S = p == null ? void 0 : p.api) == null ? void 0 : S.examples) == null ? void 0 : d.defaults) === "required") : e.operation.requestExampleType = "generated", n ? (e.operation.responseExamples = R(n), e.operation.responseExampleType = "mdx") : e.operation.responseExampleType = "generated";
42
+ const L = e.operation.baseUrl || e.operation.baseUrlOptions.length > 0, m = ((v = (P = p == null ? void 0 : p.api) == null ? void 0 : P.examples) == null ? void 0 : v.prefill) && L;
43
+ return m && (e.operation.prefillPlaygroundWithExample = !!m, e.operation.prefillPlaygroundExamples = J(e), e.operation.prefillPlaygroundExamples.length > 0 && (e.operation.requestExampleType = "examples")), ((k = (f = p == null ? void 0 : p.api) == null ? void 0 : f.playground) == null ? void 0 : k.proxy) === !1 && (e.operation.disableProxy = !0), e;
53
44
  };
54
45
  export {
55
- G as addApiReferenceDataFromMdxAndDocsConfig
46
+ I as addApiReferenceDataFromMdxAndDocsConfig
56
47
  };
@@ -0,0 +1,50 @@
1
+ import { isSchemaObject as n } from "./utils.js";
2
+ const p = (t) => {
3
+ const e = t.type;
4
+ if (Array.isArray(e))
5
+ return e[0] ?? "string";
6
+ if (!e) {
7
+ if (t.oneOf && Array.isArray(t.oneOf)) {
8
+ const i = t.oneOf.map(
9
+ (r) => n(r) && "typeLabel" in r ? r.typeLabel : void 0
10
+ ).filter((r) => r !== void 0);
11
+ if (i.length > 0) {
12
+ const o = new Set(i).size === i.length ? " | " : " · ";
13
+ return i.join(o);
14
+ }
15
+ }
16
+ return "any";
17
+ }
18
+ switch (e) {
19
+ case "null":
20
+ return "null";
21
+ case "object":
22
+ return t.title ? `${t.title} · object` : "object";
23
+ case "array":
24
+ if ("items" in t && t.items && n(t.items)) {
25
+ const r = "typeLabel" in t.items && typeof t.items.typeLabel == "string" ? t.items.typeLabel : p(t.items), s = r.includes(" | ") ? `(${r})` : r;
26
+ return r === "object" && t.title ? `${t.title} · object[]` : `${s}[]`;
27
+ }
28
+ return t.title ? `${t.title} · array` : "array";
29
+ default:
30
+ return "enum" in t && t.enum !== void 0 ? `enum<${e}>` : "format" in t && typeof t.format == "string" ? `${e}<${t.format}>` : e;
31
+ }
32
+ }, l = (t) => {
33
+ if (!n(t))
34
+ return t;
35
+ const e = {
36
+ ...t
37
+ };
38
+ if (e.oneOf && Array.isArray(e.oneOf) && (e.oneOf = e.oneOf.map((i) => n(i) ? l(i) : i)), e.type === "object" && e.properties) {
39
+ const i = {};
40
+ Object.entries(e.properties).forEach(([r, o]) => {
41
+ n(o) ? i[r] = l(o) : i[r] = o;
42
+ }), e.properties = i;
43
+ }
44
+ return e.additionalProperties && typeof e.additionalProperties == "object" && n(e.additionalProperties) && (e.additionalProperties = l(
45
+ e.additionalProperties
46
+ )), e.type === "array" && "items" in e && n(e.items) && (e.items = l(e.items)), e.typeLabel = p(e), e;
47
+ };
48
+ export {
49
+ l as addTypeLabelsToSchema
50
+ };
@@ -1,40 +1,56 @@
1
- import { isSchemaObject as s, escapeDots as p } from "./utils.js";
2
- const n = (d, o = "") => {
3
- if (!s(d))
4
- return d;
1
+ import l from "@sindresorhus/slugify";
2
+ import { buildRecursiveParamFieldId as p, isSchemaObject as s, escapeDots as d } from "./utils.js";
3
+ const u = (r, t = "") => {
4
+ if (!s(r))
5
+ return r;
5
6
  const e = {
6
- ...d,
7
- uniqueKey: o
7
+ ...r,
8
+ uniqueKey: t
8
9
  };
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);
10
+ if (e.oneOf && Array.isArray(e.oneOf) && (e.oneOf = e.oneOf.map((o, i) => {
11
+ if (s(o)) {
12
+ const n = t ? `${t}.oneOf.${i}` : `oneOf.${i}`;
13
+ return u(o, n);
13
14
  }
14
- return t;
15
+ return o;
15
16
  })), 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);
17
+ const o = {};
18
+ Object.entries(e.properties).forEach(([i, n]) => {
19
+ if (s(n)) {
20
+ const c = t ? `${t}.${d(i)}` : d(i);
21
+ o[i] = u(n, c);
21
22
  } else
22
- t[i] = r;
23
- }), e.properties = t;
23
+ o[i] = n;
24
+ }), e.properties = o;
24
25
  }
25
26
  if (e.additionalProperties && typeof e.additionalProperties == "object" && s(e.additionalProperties)) {
26
- const t = o ? `${o}.additionalProperties` : "additionalProperties";
27
- e.additionalProperties = n(
27
+ const o = t ? `${t}.additionalProperties` : "additionalProperties";
28
+ e.additionalProperties = u(
28
29
  e.additionalProperties,
29
- t
30
+ o
30
31
  );
31
32
  }
32
33
  if (e.type === "array" && "items" in e && s(e.items)) {
33
- const t = o ? `${o}.items` : "items";
34
- e.items = n(e.items, t);
34
+ const o = t ? `${t}.items` : "items";
35
+ e.items = u(e.items, o + ".[INDEX]");
35
36
  }
36
37
  return e;
38
+ }, f = (r, t, e, o) => {
39
+ if (t.uniqueKey) {
40
+ let i = t.uniqueKey;
41
+ return e == null || e.forEach((n) => {
42
+ i = i.replace("[INDEX]", n.toString());
43
+ }), `${r ? r + "." : ""}${i}`;
44
+ } else
45
+ return r;
46
+ }, m = (r, t, e, o) => {
47
+ if (!r.uniqueKey)
48
+ return p(t, e, o);
49
+ const i = r.uniqueKey.replace(/\[INDEX\]/g, ""), n = t ? `${t}-${i}` : i;
50
+ return l(n, { decamelize: !0 });
37
51
  };
38
52
  export {
39
- n as addUniqueKeysToSchema
53
+ u as addUniqueKeysToSchema,
54
+ m as getParamIdFromSchema,
55
+ f as getUniqueInputKey
40
56
  };
@@ -0,0 +1,94 @@
1
+ import { apiPlaygroundInputKeys as g } from "../constants/index.js";
2
+ import { isSchemaObject as b } from "./utils.js";
3
+ const j = ({
4
+ schema: r,
5
+ example: t
6
+ }) => s(r, t, g.body);
7
+ function c(r, t) {
8
+ let e = r;
9
+ return t.forEach((i) => {
10
+ e = e.replace("[INDEX]", i.toString());
11
+ }), e;
12
+ }
13
+ function s(r, t, e, i = []) {
14
+ const u = {};
15
+ if (t == null)
16
+ return u;
17
+ if (r.oneOf && Array.isArray(r.oneOf)) {
18
+ for (const n of r.oneOf)
19
+ if (b(n) && l(n, t)) {
20
+ const o = n;
21
+ if (o.type !== "object" && o.type !== "array") {
22
+ if (o.uniqueKey) {
23
+ const f = c(
24
+ o.uniqueKey,
25
+ i
26
+ );
27
+ u[`${e}.${f}`] = t;
28
+ }
29
+ return u;
30
+ }
31
+ return s(o, t, e, i);
32
+ }
33
+ if (r.oneOf.length > 0 && b(r.oneOf[0])) {
34
+ const n = r.oneOf[0];
35
+ if (n.type !== "object" && n.type !== "array") {
36
+ if (n.uniqueKey) {
37
+ const o = c(n.uniqueKey, i);
38
+ u[`${e}.${o}`] = t;
39
+ }
40
+ return u;
41
+ }
42
+ return s(n, t, e, i);
43
+ }
44
+ }
45
+ if (r.type === "object" && r.properties && typeof t == "object" && !Array.isArray(t))
46
+ for (const [n, o] of Object.entries(r.properties)) {
47
+ if (!b(o)) continue;
48
+ const f = t[n];
49
+ if (f === void 0) continue;
50
+ const y = o;
51
+ if (y.type === "object" || y.type === "array" || y.oneOf) {
52
+ const p = s(
53
+ y,
54
+ f,
55
+ e,
56
+ i
57
+ );
58
+ Object.assign(u, p);
59
+ } else if (y.uniqueKey) {
60
+ const p = c(
61
+ y.uniqueKey,
62
+ i
63
+ );
64
+ u[`${e}.${p}`] = f;
65
+ }
66
+ }
67
+ if (r.type === "array" && Array.isArray(t) && "items" in r && b(r.items)) {
68
+ const n = r.items;
69
+ t.forEach((o, f) => {
70
+ const y = [...i, f], p = s(n, o, e, y);
71
+ Object.assign(u, p);
72
+ });
73
+ }
74
+ if (!r.properties && !r.oneOf && r.type !== "array" && r.type !== "object" && r.uniqueKey) {
75
+ const n = c(r.uniqueKey, i);
76
+ u[`${e}.${n}`] = t;
77
+ }
78
+ return u;
79
+ }
80
+ function l(r, t) {
81
+ const e = typeof t;
82
+ if (r.enum && Array.isArray(r.enum))
83
+ return r.enum.includes(t);
84
+ if (r.type === "string" && e === "string" && r.pattern && typeof t == "string")
85
+ try {
86
+ return new RegExp(r.pattern).test(t);
87
+ } catch {
88
+ return !1;
89
+ }
90
+ return !!(r.type === "string" && e === "string" || r.type === "number" && e === "number" || r.type === "integer" && e === "number" && Number.isInteger(t) || r.type === "boolean" && e === "boolean" || r.type === "object" && e === "object" && t !== null && !Array.isArray(t) || r.type === "array" && Array.isArray(t));
91
+ }
92
+ export {
93
+ j as getExampleBodyInputs
94
+ };