@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.
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
- package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +6 -5
- package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
- package/dist/api-playground/EndpointFields/components/Description.js +6 -5
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
- package/dist/api-playground-2/ApiExamples.js +19 -20
- package/dist/api-playground-2/ApiFields.js +20 -247
- package/dist/api-playground-2/EndpointHeader.js +59 -47
- package/dist/api-playground-2/OperationPage.js +70 -66
- package/dist/api-playground-2/Playground.js +67 -83
- package/dist/api-playground-2/SchemaPage.js +22 -9
- package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
- package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
- package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
- package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
- package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
- package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
- package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
- package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
- package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
- package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
- package/dist/api-playground-2/generators/createCookies.js +23 -0
- package/dist/api-playground-2/generators/createHeaders.js +53 -36
- package/dist/api-playground-2/generators/createQueryString.js +30 -0
- package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
- package/dist/api-playground-2/generators/generateRequest.js +47 -51
- package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
- package/dist/api-playground-2/generators/generateSnippet.js +1 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
- package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
- package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
- package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
- package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
- package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
- package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
- package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
- package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
- package/dist/api-playground-2/schemaGraph/utils.js +185 -147
- package/dist/common/guards.js +11 -19
- package/dist/components/Api/Expandable.js +10 -9
- package/dist/components/Api/Param.js +11 -13
- package/dist/components/Api/dropdown-menu.js +10 -9
- package/dist/components/content-components/code-group.js +4 -4
- package/dist/contexts/EndpointLocationContext.js +3 -3
- package/dist/hooks/useApiParamFieldOption.js +10 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useKeyboardShortcut.js +13 -13
- package/dist/hooks/useSendPlaygroundRequest.js +14 -146
- package/dist/httpsnippet/src/helpers/code-builder.js +27 -0
- package/dist/httpsnippet/src/helpers/escape.js +11 -0
- package/dist/httpsnippet/src/helpers/headers.js +13 -0
- package/dist/httpsnippet/src/helpers/reducer.js +7 -0
- package/dist/httpsnippet/src/helpers/shell.js +5 -0
- package/dist/httpsnippet/src/helpers/url-format.js +35 -0
- package/dist/httpsnippet/src/helpers/url-parse.js +76 -0
- package/dist/httpsnippet/src/index.js +157 -0
- package/dist/httpsnippet/src/targets/c/libcurl/client.js +22 -0
- package/dist/httpsnippet/src/targets/c/target.js +15 -0
- package/dist/httpsnippet/src/targets/clojure/clj_http/client.js +120 -0
- package/dist/httpsnippet/src/targets/clojure/target.js +14 -0
- package/dist/httpsnippet/src/targets/csharp/httpclient/client.js +76 -0
- package/dist/httpsnippet/src/targets/csharp/restsharp/client.js +63 -0
- package/dist/httpsnippet/src/targets/csharp/target.js +17 -0
- package/dist/httpsnippet/src/targets/go/native/client.js +24 -0
- package/dist/httpsnippet/src/targets/go/target.js +15 -0
- package/dist/httpsnippet/src/targets/http/http1.1/client.js +34 -0
- package/dist/httpsnippet/src/targets/http/target.js +14 -0
- package/dist/httpsnippet/src/targets/index.js +43 -0
- package/dist/httpsnippet/src/targets/java/asynchttp/client.js +23 -0
- package/dist/httpsnippet/src/targets/java/nethttp/client.js +28 -0
- package/dist/httpsnippet/src/targets/java/okhttp/client.js +23 -0
- package/dist/httpsnippet/src/targets/java/target.js +20 -0
- package/dist/httpsnippet/src/targets/java/unirest/client.js +23 -0
- package/dist/httpsnippet/src/targets/javascript/axios/client.js +50 -0
- package/dist/httpsnippet/src/targets/javascript/fetch/client.js +61 -0
- package/dist/httpsnippet/src/targets/javascript/jquery/client.js +51 -0
- package/dist/httpsnippet/src/targets/javascript/target.js +20 -0
- package/dist/httpsnippet/src/targets/javascript/xhr/client.js +49 -0
- package/dist/httpsnippet/src/targets/json/native/client.js +39 -0
- package/dist/httpsnippet/src/targets/json/target.js +14 -0
- package/dist/httpsnippet/src/targets/kotlin/okhttp/client.js +23 -0
- package/dist/httpsnippet/src/targets/kotlin/target.js +14 -0
- package/dist/httpsnippet/src/targets/node/axios/client.js +40 -0
- package/dist/httpsnippet/src/targets/node/fetch/client.js +68 -0
- package/dist/httpsnippet/src/targets/node/native/client.js +45 -0
- package/dist/httpsnippet/src/targets/node/target.js +19 -0
- package/dist/httpsnippet/src/targets/objc/helpers.js +27 -0
- package/dist/httpsnippet/src/targets/objc/nsurlsession/client.js +63 -0
- package/dist/httpsnippet/src/targets/objc/target.js +14 -0
- package/dist/httpsnippet/src/targets/ocaml/cohttp/client.js +32 -0
- package/dist/httpsnippet/src/targets/ocaml/target.js +14 -0
- package/dist/httpsnippet/src/targets/php/curl/client.js +85 -0
- package/dist/httpsnippet/src/targets/php/guzzle/client.js +57 -0
- package/dist/httpsnippet/src/targets/php/helpers.js +65 -0
- package/dist/httpsnippet/src/targets/php/http1/client.js +28 -0
- package/dist/httpsnippet/src/targets/php/http2/client.js +55 -0
- package/dist/httpsnippet/src/targets/php/target.js +21 -0
- package/dist/httpsnippet/src/targets/powershell/common.js +19 -0
- package/dist/httpsnippet/src/targets/powershell/restmethod/client.js +14 -0
- package/dist/httpsnippet/src/targets/powershell/target.js +16 -0
- package/dist/httpsnippet/src/targets/powershell/webrequest/client.js +14 -0
- package/dist/httpsnippet/src/targets/python/helpers.js +33 -0
- package/dist/httpsnippet/src/targets/python/requests/client.js +74 -0
- package/dist/httpsnippet/src/targets/python/target.js +15 -0
- package/dist/httpsnippet/src/targets/r/httr/client.js +46 -0
- package/dist/httpsnippet/src/targets/r/target.js +14 -0
- package/dist/httpsnippet/src/targets/ruby/native/client.js +37 -0
- package/dist/httpsnippet/src/targets/ruby/target.js +14 -0
- package/dist/httpsnippet/src/targets/shell/curl/client.js +92 -0
- package/dist/httpsnippet/src/targets/shell/httpie/client.js +56 -0
- package/dist/httpsnippet/src/targets/shell/target.js +19 -0
- package/dist/httpsnippet/src/targets/shell/wget/client.js +30 -0
- package/dist/httpsnippet/src/targets/swift/helpers.js +38 -0
- package/dist/httpsnippet/src/targets/swift/target.js +14 -0
- package/dist/httpsnippet/src/targets/swift/urlsession/client.js +59 -0
- package/dist/index.d.ts +65 -58
- package/dist/index.js +109 -111
- package/dist/openapi/generateTypeStringFromSchema.js +2 -31
- package/dist/styles.css +1 -1
- package/package.json +17 -4
- package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
- package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
- package/dist/api-playground/ApiPlayground/index.js +0 -67
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
- package/dist/api-playground/EndpointFields/index.js +0 -7
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
- package/dist/common/potentiallyParseOpenApiString.js +0 -24
- package/dist/common/replaceSlashIndex.js +0 -6
- package/dist/common/slugToTitle.js +0 -10
- package/dist/constants/prism-languages.js +0 -19
- package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
- package/dist/contexts/MDXContentContext.js +0 -17
- package/dist/hooks/useApiPlaygroundInputs.js +0 -6
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
- package/dist/hooks/useBaseUrlOptions.js +0 -18
- package/dist/hooks/useComponentSchemas.js +0 -9
- package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
- package/dist/hooks/useGenerateNextItems.js +0 -11
- package/dist/hooks/useGenerateNextProperties.js +0 -11
- package/dist/hooks/useMDXContent.js +0 -6
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
- package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
- package/dist/hooks/usePrefilledInputs/index.js +0 -65
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
- package/dist/hooks/useSecurityOption.js +0 -10
- package/dist/hooks/useSetDefaultValue.js +0 -63
- package/dist/openapi/filterEnums.js +0 -20
- package/dist/openapi/generateNextAdditionalProperties.js +0 -7
- package/dist/openapi/generateNextItems.js +0 -7
- package/dist/openapi/generateNextProperties.js +0 -23
- package/dist/openapi/generateOptionLabels.js +0 -20
- package/dist/openapi/generateSimpleLabels.js +0 -4
- package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
- package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
- package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
- package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
- package/dist/utils/api-playground/defaults.js +0 -15
- package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
- package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
- package/dist/utils/flattenObject.js +0 -10
|
@@ -1,44 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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:
|
|
21
|
+
value: t.toString()
|
|
12
22
|
});
|
|
13
|
-
}),
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
name:
|
|
17
|
-
value: `<${
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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:
|
|
56
|
+
value: r
|
|
40
57
|
});
|
|
41
58
|
};
|
|
42
59
|
export {
|
|
43
|
-
|
|
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
|
|
2
|
-
import { langToPresetMap as
|
|
3
|
-
import { generateRequest as
|
|
4
|
-
import { generateSnippet as
|
|
5
|
-
const
|
|
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:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
apiPlaygroundMode: l,
|
|
10
|
+
lang: d,
|
|
11
|
+
requiredOnly: u,
|
|
12
|
+
selectedSecurityOptionIndex: g,
|
|
13
|
+
selectedRequestBodyContentTypeIndex: r
|
|
13
14
|
}) => {
|
|
14
|
-
var
|
|
15
|
-
if (n &&
|
|
16
|
-
const
|
|
17
|
-
((
|
|
18
|
-
)[
|
|
19
|
-
((
|
|
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
|
|
24
|
+
const m = h({
|
|
23
25
|
baseUrl: n,
|
|
24
26
|
apiReferenceData: e,
|
|
25
27
|
inputs: o,
|
|
26
|
-
exampleData:
|
|
27
|
-
selectedBodyContentType:
|
|
28
|
+
exampleData: f,
|
|
29
|
+
selectedBodyContentType: y,
|
|
28
30
|
requiredOnly: u,
|
|
29
|
-
selectedSecurityOptionIndex:
|
|
30
|
-
}),
|
|
31
|
-
if (
|
|
31
|
+
selectedSecurityOptionIndex: g
|
|
32
|
+
}), a = x[d];
|
|
33
|
+
if (a == null)
|
|
32
34
|
return;
|
|
33
|
-
const [t] =
|
|
34
|
-
request:
|
|
35
|
+
const [t] = v({
|
|
36
|
+
request: m,
|
|
35
37
|
pathInputs: o.path,
|
|
36
|
-
snippetPresets: [
|
|
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
|
-
|
|
52
|
+
P as generateInteractiveCodeSample
|
|
51
53
|
};
|
|
@@ -1,65 +1,61 @@
|
|
|
1
|
-
import { isObject as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { createHeaders as
|
|
10
|
-
import {
|
|
11
|
-
|
|
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:
|
|
14
|
+
apiReferenceData: e,
|
|
14
15
|
baseUrl: t,
|
|
15
|
-
inputs:
|
|
16
|
-
selectedBodyContentType:
|
|
17
|
-
requiredOnly:
|
|
18
|
-
selectedSecurityOptionIndex:
|
|
16
|
+
inputs: r,
|
|
17
|
+
selectedBodyContentType: s,
|
|
18
|
+
requiredOnly: q,
|
|
19
|
+
selectedSecurityOptionIndex: O
|
|
19
20
|
}) => {
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
36
|
+
F
|
|
31
37
|
);
|
|
32
38
|
return {
|
|
33
|
-
...
|
|
34
|
-
method: (((
|
|
35
|
-
url:
|
|
36
|
-
queryString:
|
|
37
|
-
headers:
|
|
38
|
-
postData:
|
|
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
|
-
},
|
|
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((
|
|
51
|
+
return Object.values(o).every((e) => e === void 0);
|
|
56
52
|
};
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
for (const t in
|
|
60
|
-
|
|
61
|
-
return
|
|
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
|
-
|
|
60
|
+
te as generateRequest
|
|
65
61
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
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
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
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:
|
|
27
|
-
},
|
|
30
|
+
code: d
|
|
31
|
+
}, g;
|
|
28
32
|
},
|
|
29
33
|
{}
|
|
30
34
|
);
|
|
31
|
-
return e[n] =
|
|
35
|
+
return e[n] = m, e;
|
|
32
36
|
}, {});
|
|
33
37
|
export {
|
|
34
|
-
|
|
38
|
+
x as generateResponseExampleMap
|
|
35
39
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTTPSnippet as U } from "
|
|
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
|
|
2
|
-
import { toShikiLang as
|
|
3
|
-
import { generateInteractiveCodeSample as
|
|
4
|
-
const
|
|
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
|
|
15
|
+
const k = r && f !== "none" || r && a, o = a ?? [];
|
|
15
16
|
t = t.map((n) => ({
|
|
16
17
|
...n,
|
|
17
|
-
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
|
-
}),
|
|
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 =
|
|
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
|
-
|
|
70
|
+
y as generateSnippetMap
|
|
69
71
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { usePlaygroundInputsStore as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
},
|
|
6
|
-
let
|
|
7
|
-
return Object.entries(
|
|
8
|
-
n && (
|
|
9
|
-
}),
|
|
10
|
-
},
|
|
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
|
-
|
|
12
|
+
d as useCopyPathWithInputs
|
|
13
13
|
};
|