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