@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,44 +1,61 @@
1
- const y = (t, s, n, l) => {
2
- var o, u, d;
3
- const a = [], i = /* @__PURE__ */ new Set(), p = Object.values(
4
- ((u = (o = t.dependencies) == null ? void 0 : o.parameters) == null ? void 0 : u.header) ?? {}
5
- ).filter((e) => !e.in || e.in === "header").filter((e) => e.schema.isRequired), f = Object.values(
6
- ((d = t.dependencies) == null ? void 0 : d.processedSecurityOptions) ?? {}
7
- ).filter(({ scheme: e }) => !("in" in e) || e.in === "header");
8
- Object.entries(s).filter((e) => e[1] != null).forEach(([e, r]) => {
9
- i.add(e), a.push({
1
+ import { isBasicAuth as g, encodeBasicAuth as y } from "../schemaGraph/utils.js";
2
+ import { generateAuthPlaceholder as h } from "./generateAuthPlaceholder.js";
3
+ const P = ({
4
+ apiReferenceData: a,
5
+ headerInputs: r,
6
+ selectedBodyContentType: o,
7
+ securityOption: i
8
+ }) => {
9
+ var d;
10
+ const s = [], n = /* @__PURE__ */ new Set(), c = Object.values(((d = a.dependencies) == null ? void 0 : d.parameters) ?? {}).filter(
11
+ (e) => !e.in || e.in === "header"
12
+ ), v = new Set(c.map((e) => e.name)), w = c.filter(
13
+ (e) => {
14
+ var t;
15
+ return (t = e.schema) == null ? void 0 : t.isRequired;
16
+ }
17
+ );
18
+ return Object.entries(r).filter((e) => e[1] != null).filter(([e]) => v.has(e)).forEach(([e, t]) => {
19
+ n.add(e), s.push({
10
20
  name: e,
11
- value: r.toString()
21
+ value: t.toString()
12
22
  });
13
- }), p.forEach((e) => {
14
- const r = e.name;
15
- i.has(r) || a.push({
16
- name: r,
17
- value: `<${r.toLowerCase()}>`
23
+ }), w.forEach((e) => {
24
+ const t = e.name;
25
+ n.has(t) || s.push({
26
+ name: t,
27
+ value: `<${t.toLowerCase()}>`
18
28
  });
19
- });
20
- const c = f[l];
21
- if (c) {
22
- const { scheme: e, schema: r } = c, h = "name" in e ? e.name : r.title ?? "Authorization";
23
- i.has(h) || a.push({ name: h, value: m(e) });
24
- }
25
- return n && v(a, n), a;
26
- }, m = (t) => {
27
- switch (t.type) {
28
- case "http":
29
- return t.scheme === "basic" ? "Basic <encoded-value>" : "Bearer <token>";
30
- case "oauth2":
31
- return "Bearer <token>";
32
- case "apiKey":
33
- default:
34
- return "<api-key>";
35
- }
36
- }, v = (t, s) => {
37
- t.some(({ name: n }) => n.toLowerCase() === "content-type") || t.push({
29
+ }), i && i.schemes.forEach(({ scheme: e, name: t }) => {
30
+ var u, f;
31
+ const H = "in" in e && e.in === "header" || e.type === "http" || e.type === "oauth2";
32
+ if (g(e)) {
33
+ const l = (u = r[t]) == null ? void 0 : u.username, p = (f = r[t]) == null ? void 0 : f.password;
34
+ if (l || p) {
35
+ const S = y(l, p);
36
+ s.push({
37
+ name: t,
38
+ value: `Basic ${S}`
39
+ });
40
+ } else
41
+ s.push({
42
+ name: t,
43
+ value: h(e)
44
+ });
45
+ } else H && (t in r && typeof r[t] == "string" ? s.push({
46
+ name: t,
47
+ value: r[t].toString()
48
+ }) : s.push({
49
+ name: t,
50
+ value: h(e)
51
+ }));
52
+ }), o && A(s, o), s;
53
+ }, A = (a, r) => {
54
+ a.some(({ name: o }) => o.toLowerCase() === "content-type") || a.push({
38
55
  name: "Content-Type",
39
- value: s
56
+ value: r
40
57
  });
41
58
  };
42
59
  export {
43
- y as createHeaders
60
+ P as createHeaders
44
61
  };
@@ -0,0 +1,30 @@
1
+ const l = (f, i) => Object.entries(f.query).flatMap(([t, r]) => r ? Array.isArray(r) ? r.filter(Boolean).map((n) => ({
2
+ name: t,
3
+ value: n.toString()
4
+ })) : typeof r == "object" ? i != null && i.includes(t) ? Object.entries(r).filter(([n, e]) => e).map(([n, e]) => ({
5
+ name: `${t}[${n}]`,
6
+ value: e.toString()
7
+ })) : [{ name: t, value: JSON.stringify(r) }] : [
8
+ {
9
+ name: t,
10
+ value: r.toString()
11
+ }
12
+ ] : []), a = ({
13
+ inputs: f,
14
+ queryParamsWithDeepObjects: i,
15
+ securityOption: t
16
+ }) => {
17
+ const r = l(f, i);
18
+ return t && t.schemes.forEach(({ scheme: n, name: e }) => {
19
+ if ("in" in n && n.in === "query") {
20
+ const o = "name" in n ? n.name : e;
21
+ o in f.query ? r.filter((u) => u.name == o && u.value === "") : r.push({
22
+ name: o,
23
+ value: ""
24
+ });
25
+ }
26
+ }), r;
27
+ };
28
+ export {
29
+ a as createQueryString
30
+ };
@@ -0,0 +1,14 @@
1
+ const t = (e) => {
2
+ switch (e.type) {
3
+ case "http":
4
+ return e.scheme === "basic" ? "Basic <encoded-value>" : "Bearer <token>";
5
+ case "oauth2":
6
+ return "Bearer <token>";
7
+ case "apiKey":
8
+ default:
9
+ return "<api-key>";
10
+ }
11
+ };
12
+ export {
13
+ t as generateAuthPlaceholder
14
+ };
@@ -1,39 +1,41 @@
1
- import { getFirstExampleValue as f } from "../schemaGraph/processExamples.js";
2
- import { langToPresetMap as q } from "../../constants/snippetPresets.js";
3
- import { generateRequest as x } from "./generateRequest.js";
4
- import { generateSnippet as B } from "./generateSnippet.js";
5
- const I = ({
1
+ import { getFirstExampleValue as q } from "../schemaGraph/processExamples.js";
2
+ import { langToPresetMap as x } from "../../constants/snippetPresets.js";
3
+ import { generateRequest as h } from "./generateRequest.js";
4
+ import { generateSnippet as v } from "./generateSnippet.js";
5
+ const P = ({
6
6
  apiReferenceData: e,
7
7
  baseUrl: n,
8
8
  inputs: o,
9
- apiPlaygroundMode: a,
10
- selectedSecurityOptionIndex: d,
11
- lang: l,
12
- requiredOnly: u
9
+ apiPlaygroundMode: l,
10
+ lang: d,
11
+ requiredOnly: u,
12
+ selectedSecurityOptionIndex: g,
13
+ selectedRequestBodyContentTypeIndex: r
13
14
  }) => {
14
- var r, s, p, c;
15
- if (n && a !== "none") {
16
- const g = Object.keys(
17
- ((s = (r = e.dependencies) == null ? void 0 : r.requestBody) == null ? void 0 : s.content) ?? {}
18
- )[0], y = f(
19
- ((c = (p = e.dependencies) == null ? void 0 : p.requestBody) == null ? void 0 : c.content) ?? {}
15
+ var s, p, c, i;
16
+ if (n && l !== "none") {
17
+ const y = Object.keys(
18
+ ((p = (s = e.dependencies) == null ? void 0 : s.requestBody) == null ? void 0 : p.content) ?? {}
19
+ )[r], f = q(
20
+ ((i = (c = e.dependencies) == null ? void 0 : c.requestBody) == null ? void 0 : i.content) ?? {},
21
+ r
20
22
  );
21
23
  try {
22
- const i = x({
24
+ const m = h({
23
25
  baseUrl: n,
24
26
  apiReferenceData: e,
25
27
  inputs: o,
26
- exampleData: y,
27
- selectedBodyContentType: g,
28
+ exampleData: f,
29
+ selectedBodyContentType: y,
28
30
  requiredOnly: u,
29
- selectedSecurityOptionIndex: d
30
- }), m = q[l];
31
- if (m == null)
31
+ selectedSecurityOptionIndex: g
32
+ }), a = x[d];
33
+ if (a == null)
32
34
  return;
33
- const [t] = B({
34
- request: i,
35
+ const [t] = v({
36
+ request: m,
35
37
  pathInputs: o.path,
36
- snippetPresets: [m],
38
+ snippetPresets: [a],
37
39
  apiReferenceData: e
38
40
  });
39
41
  if (t)
@@ -47,5 +49,5 @@ const I = ({
47
49
  }
48
50
  };
49
51
  export {
50
- I as generateInteractiveCodeSample
52
+ P as generateInteractiveCodeSample
51
53
  };
@@ -1,65 +1,61 @@
1
- import { isObject as c } from "../../common/guards.js";
2
- import y from "lodash/cloneDeep";
3
- import $ from "lodash/merge";
4
- import { getAllRequiredProperties as k } from "../schemaGraph/getAllRequiredProperties.js";
5
- import { isSchemaObject as F } from "../schemaGraph/utils.js";
6
- import { initialRequest as H } from "../../constants/initialRequest.js";
7
- import { addPathParams as J, joinWithSingleSlash as K, addServerVariables as M } from "../../hooks/useSendPlaygroundRequest.js";
8
- import { getPostData as N } from "./createBodyData.js";
9
- import { createHeaders as Q } from "./createHeaders.js";
10
- import { getFileProperties as V } from "./getFileProperties.js";
11
- const T = ({
1
+ import { isObject as m } from "../../common/guards.js";
2
+ import v from "lodash/cloneDeep";
3
+ import { getAllRequiredProperties as K } from "../schemaGraph/getAllRequiredProperties.js";
4
+ import { isSchemaObject as Q } from "../schemaGraph/utils.js";
5
+ import { initialRequest as V } from "../../constants/initialRequest.js";
6
+ import { addPathParams as w, joinWithSingleSlash as x, addServerVariables as z } from "../../hooks/useSendPlaygroundRequest.js";
7
+ import { getPostData as G } from "./createBodyData.js";
8
+ import { createCookies as J } from "./createCookies.js";
9
+ import { createHeaders as L } from "./createHeaders.js";
10
+ import { createQueryString as M } from "./createQueryString.js";
11
+ import { getFileProperties as N } from "./getFileProperties.js";
12
+ const te = ({
12
13
  exampleData: o,
13
- apiReferenceData: r,
14
+ apiReferenceData: e,
14
15
  baseUrl: t,
15
- inputs: e,
16
- selectedBodyContentType: i,
17
- requiredOnly: n,
18
- selectedSecurityOptionIndex: S
16
+ inputs: r,
17
+ selectedBodyContentType: s,
18
+ requiredOnly: q,
19
+ selectedSecurityOptionIndex: O
19
20
  }) => {
20
- var f, l, p, u, b, g;
21
- const j = Object.values(((f = r.dependencies) == null ? void 0 : f.parameters) ?? {}).filter((d) => d.style === "deepObject").map((d) => d.name), v = _(e, j), a = J(((l = r.operation) == null ? void 0 : l.path) ?? "", e.path), q = Q(r, e.header, i, S), m = w(e.body), O = c(o), A = c(e.body) ? h(e.body) : {}, P = !m && O ? $(y(o), A) : null, E = m ? o : P;
22
- let s;
23
- i && F(
24
- (b = (u = (p = r.dependencies) == null ? void 0 : p.requestBody) == null ? void 0 : u.content[i]) == null ? void 0 : b.schema
25
- ) && (s = r.dependencies.requestBody.content[i].schema);
26
- const B = n && !e.body && s ? k(s) : void 0, I = s ? V(s) : void 0, U = N(
27
- E,
28
- i,
21
+ var p, l, f, h, u, b, y, a;
22
+ const d = (l = (p = e.dependencies) == null ? void 0 : p.processedSecurityOptions) == null ? void 0 : l[O], g = Object.values(((f = e.dependencies) == null ? void 0 : f.parameters) ?? {}).filter((c) => c.style === "deepObject").map((c) => c.name), P = M({ inputs: r, queryParamsWithDeepObjects: g, securityOption: d }), S = w(((h = e.operation) == null ? void 0 : h.path) ?? "", r.path), k = L({
23
+ apiReferenceData: e,
24
+ headerInputs: r.header,
25
+ selectedBodyContentType: s,
26
+ securityOption: d
27
+ }), E = J({ securityOption: d, inputs: r }), n = X(r.body), I = m(o), A = m(r.body) ? j(r.body) : r.body ?? {}, U = !n && I ? { ...v(o), ...A } : null, W = n ? o : U;
28
+ let i;
29
+ s && Q(
30
+ (y = (b = (u = e.dependencies) == null ? void 0 : u.requestBody) == null ? void 0 : b.content[s]) == null ? void 0 : y.schema
31
+ ) && (i = e.dependencies.requestBody.content[s].schema);
32
+ const B = q && !r.body && i ? K(i) : void 0, F = i ? N(i) : void 0, H = G(
33
+ W,
34
+ s,
29
35
  B,
30
- I
36
+ F
31
37
  );
32
38
  return {
33
- ...H,
34
- method: (((g = r.operation) == null ? void 0 : g.method) ?? "").toUpperCase(),
35
- url: K(M(t, e.server), a),
36
- queryString: v,
37
- headers: q,
38
- postData: U
39
+ ...V,
40
+ method: (((a = e.operation) == null ? void 0 : a.method) ?? "").toUpperCase(),
41
+ url: x(z(t, r.server), S),
42
+ queryString: P,
43
+ headers: k,
44
+ postData: H,
45
+ cookies: E
39
46
  };
40
- }, _ = (o, r) => Object.entries(o.query).flatMap(([t, e]) => e ? Array.isArray(e) ? e.filter(Boolean).map((i) => ({
41
- name: t,
42
- value: i.toString()
43
- })) : typeof e == "object" ? r != null && r.includes(t) ? Object.entries(e).filter(([i, n]) => n).map(([i, n]) => ({
44
- name: `${t}[${i}]`,
45
- value: n.toString()
46
- })) : [{ name: t, value: JSON.stringify(e) }] : [
47
- {
48
- name: t,
49
- value: e.toString()
50
- }
51
- ] : []), w = (o) => {
47
+ }, X = (o) => {
52
48
  if (o == null)
53
49
  return !0;
54
50
  if (typeof o == "object")
55
- return Object.values(o).every((r) => r === void 0);
51
+ return Object.values(o).every((e) => e === void 0);
56
52
  };
57
- function h(o) {
58
- const r = y(o);
59
- for (const t in r)
60
- r[t] === void 0 ? delete r[t] : c(r[t]) && h(r[t]);
61
- return r;
53
+ function j(o) {
54
+ const e = v(o);
55
+ for (const t in e)
56
+ e[t] === void 0 ? delete e[t] : m(e[t]) && j(e[t]);
57
+ return e;
62
58
  }
63
59
  export {
64
- T as generateRequest
60
+ te as generateRequest
65
61
  };
@@ -1,5 +1,7 @@
1
- const y = (a, l) => Object.entries(a).sort().reduce((e, [n, r]) => {
2
- const t = Object.keys(r), c = t[l] ? r[t[l]] : r[t[0]];
1
+ import { generateExampleFromSchema as h } from "../schemaGraph/processExamples.js";
2
+ import { isSchemaObject as p } from "../schemaGraph/utils.js";
3
+ const x = (u, t) => Object.entries(u).sort().reduce((e, [n, i]) => {
4
+ const a = Object.keys(i), c = t !== void 0 && a[t] ? i[a[t]] : i[a[0]];
3
5
  if (c === void 0)
4
6
  return e[n] = {
5
7
  "": {
@@ -8,7 +10,7 @@ const y = (a, l) => Object.entries(a).sort().reduce((e, [n, r]) => {
8
10
  language: ""
9
11
  }
10
12
  }, e;
11
- const i = c.examples, s = i == null ? void 0 : i[0];
13
+ const l = c.schema, r = c.examples, s = r == null ? void 0 : r[0];
12
14
  if (s && "value" in s && s.value === void 0)
13
15
  return e[n] = {
14
16
  "": {
@@ -17,19 +19,21 @@ const y = (a, l) => Object.entries(a).sort().reduce((e, [n, r]) => {
17
19
  language: ""
18
20
  }
19
21
  }, e;
20
- const g = Object.entries(i ?? {}).reduce(
21
- (u, [h, o]) => {
22
- const f = "value" in o ? o.value : o, d = "title" in o && typeof o.title == "string" ? o.title : "", v = JSON.stringify(f, null, 2);
23
- return u[d] = {
22
+ const m = Object.entries(r ?? {}).reduce(
23
+ (g, [E, o]) => {
24
+ let f = "value" in o ? o.value : o;
25
+ l && p(l) && (f = h(l).value);
26
+ const v = "title" in o && typeof o.title == "string" ? o.title : "", d = JSON.stringify(f, null, 2);
27
+ return g[v] = {
24
28
  filename: n,
25
29
  language: "json",
26
- code: v
27
- }, u;
30
+ code: d
31
+ }, g;
28
32
  },
29
33
  {}
30
34
  );
31
- return e[n] = g, e;
35
+ return e[n] = m, e;
32
36
  }, {});
33
37
  export {
34
- y as generateResponseExampleMap
38
+ x as generateResponseExampleMap
35
39
  };
@@ -1,4 +1,4 @@
1
- import { HTTPSnippet as U } from "@readme/httpsnippet";
1
+ import { HTTPSnippet as U } from "../../httpsnippet/src/index.js";
2
2
  import { generateUniqueString as x } from "../../utils/uuid.js";
3
3
  import { snippetPresets as R } from "../../constants/snippetPresets.js";
4
4
  const N = ({
@@ -1,7 +1,7 @@
1
- import { requestExampleLanguages as k } from "@mintlify/models";
2
- import { toShikiLang as x, shikiLangToDisplayLang as m } from "../../constants/snippetPresets.js";
3
- import { generateInteractiveCodeSample as v } from "./generateInteractiveCodeSample.js";
4
- const p = ({
1
+ import { requestExampleLanguages as x } from "@mintlify/models";
2
+ import { toShikiLang as v, shikiLangToDisplayLang as m } from "../../constants/snippetPresets.js";
3
+ import { generateInteractiveCodeSample as C } from "./generateInteractiveCodeSample.js";
4
+ const y = ({
5
5
  codeSamples: t,
6
6
  apiReferenceData: c,
7
7
  baseUrl: r,
@@ -9,15 +9,16 @@ const p = ({
9
9
  apiPlaygroundMode: f,
10
10
  requestExampleLanguages: a,
11
11
  requiredOnly: g,
12
- selectedSecurityOptionIndex: L
12
+ selectedSecurityOptionIndex: L,
13
+ selectedRequestBodyContentTypeIndex: d
13
14
  }) => {
14
- const d = r && f !== "none" || r && a, o = a ?? [];
15
+ const k = r && f !== "none" || r && a, o = a ?? [];
15
16
  t = t.map((n) => ({
16
17
  ...n,
17
- lang: x(n.lang)
18
+ lang: v(n.lang)
18
19
  })), a === void 0 && (t.forEach((n) => {
19
20
  o.includes(n.lang) || o.push(n.lang);
20
- }), d && k.forEach((n) => {
21
+ }), k && x.forEach((n) => {
21
22
  o.includes(n) || o.push(n);
22
23
  }));
23
24
  const h = {};
@@ -25,14 +26,15 @@ const p = ({
25
26
  let s = m[n] ?? n;
26
27
  const u = t.filter((i) => i.lang === n), l = h[s] ?? {};
27
28
  if (u.length === 0) {
28
- const i = v({
29
+ const i = C({
29
30
  baseUrl: r,
30
31
  apiReferenceData: c,
31
32
  inputs: e,
32
33
  apiPlaygroundMode: f,
33
34
  lang: n,
34
35
  requiredOnly: g,
35
- selectedSecurityOptionIndex: L
36
+ selectedSecurityOptionIndex: L,
37
+ selectedRequestBodyContentTypeIndex: d
36
38
  });
37
39
  i && E(
38
40
  i,
@@ -65,5 +67,5 @@ const p = ({
65
67
  };
66
68
  };
67
69
  export {
68
- p as generateSnippetMap
70
+ y as generateSnippetMap
69
71
  };
@@ -1,13 +1,13 @@
1
- import { usePlaygroundInputsStore as s } from "./usePlaygroundInputsStore.js";
2
- const l = ({ path: e, baseUrl: r }) => {
3
- const { getApiPlaygroundInputs: t } = s(), o = t(), n = c(e, o.path);
4
- return p(a(r, o.server), n);
5
- }, c = (e, r) => Object.entries(r).reduce((t, [o, n]) => n == null ? t : t.replace(`{${o}}`, encodeURIComponent(n.toString())), e), a = (e, r) => {
6
- let t = e;
7
- return Object.entries(r).forEach(([o, n]) => {
8
- n && (t = t.replace(`{${o}}`, n));
9
- }), t;
10
- }, p = (e, r) => e.replace(/\/$/, "") + "/" + r.replace(/^\//, "");
1
+ import { usePlaygroundInputsStore as p } from "./usePlaygroundInputsStore.js";
2
+ const d = ({ path: t, baseUrl: e }) => {
3
+ const o = p((s) => s.getApiPlaygroundInputs)(), n = a(t, o.path);
4
+ return c(u(e, o.server), n);
5
+ }, a = (t, e) => Object.entries(e).reduce((r, [o, n]) => n == null ? r : r.replace(`{${o}}`, encodeURIComponent(n.toString())), t), u = (t, e) => {
6
+ let r = t;
7
+ return Object.entries(e).forEach(([o, n]) => {
8
+ n && (r = r.replace(`{${o}}`, n));
9
+ }), r;
10
+ }, c = (t, e) => t.replace(/\/$/, "") + "/" + e.replace(/^\//, "");
11
11
  export {
12
- l as useCopyPathWithInputs
12
+ d as useCopyPathWithInputs
13
13
  };