@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.
- 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/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/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 +1 -1
- 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,47 +1,49 @@
|
|
|
1
1
|
import "@mintlify/validation";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import q from "@sindresorhus/slugify";
|
|
3
|
+
import { apiPlaygroundInputKeys as a, CIRCULAR_REF_KEY as A, stringFileFormats as h, combinationKeys as m, MAX_SCHEMA_COMBINATION_SIZE as $ } from "../constants/index.js";
|
|
4
|
+
import { getExampleBodyInputs as k } from "./getExampleBodyInputs.js";
|
|
5
|
+
function D(e) {
|
|
4
6
|
return typeof e == "object" && e !== null && A in e && typeof e[A] == "string";
|
|
5
7
|
}
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const t = Array.isArray(e.oneOf) ? e.oneOf.length : 1, n = Array.isArray(e.anyOf) ? e.anyOf.length : 1,
|
|
9
|
-
return
|
|
10
|
-
if (e[
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
if (u
|
|
14
|
-
const p = u
|
|
15
|
-
|
|
16
|
-
if (p[
|
|
17
|
-
const
|
|
18
|
-
|
|
8
|
+
const K = () => ({ oneOf: [] }), z = () => ({ oneOf: [{}] }), b = (e) => typeof e == "object" && e !== null && !Array.isArray(e), N = (e) => c(e) && Array.isArray(e.oneOf), c = (e) => b(e) ? "type" in e || "properties" in e || "oneOf" in e || "anyOf" in e || "allOf" in e || "items" in e || "additionalProperties" in e || "enum" in e || "const" in e || "format" in e || "pattern" in e || "minimum" in e || "maximum" in e || "minLength" in e || "maxLength" in e || "minItems" in e || "maxItems" in e || "minProperties" in e || "maxProperties" in e || "required" in e || "nullable" in e || "description" in e : !1, E = (e) => c(e) && e.type === "array", F = (e) => E(e) && c(e.items) && e.items.type === "object";
|
|
9
|
+
function w(e) {
|
|
10
|
+
const t = Array.isArray(e.oneOf) ? e.oneOf.length : 1, n = Array.isArray(e.anyOf) ? e.anyOf.length : 1, i = Array.isArray(e.allOf) ? e.allOf.length : 1, r = [t, n, i];
|
|
11
|
+
return m.forEach((s) => {
|
|
12
|
+
if (e[s]) {
|
|
13
|
+
const f = e[s];
|
|
14
|
+
r.push(Object.keys(f).length), m.forEach((u) => {
|
|
15
|
+
if (f[u]) {
|
|
16
|
+
const p = f[u];
|
|
17
|
+
r.push(Object.keys(p).length), m.forEach((y) => {
|
|
18
|
+
if (p[y]) {
|
|
19
|
+
const g = p[y];
|
|
20
|
+
r.push(Object.keys(g).length);
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
}),
|
|
26
|
+
}), r.reduce((s, f) => s * f, 1) > $;
|
|
25
27
|
}
|
|
26
|
-
const
|
|
28
|
+
const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n] !== void 0 ? i(e[n], t[n]) : e[n] ?? t[n], V = (e) => e.oneOf && e.oneOf.length === 1 ? e.oneOf[0] : e, l = (e) => {
|
|
27
29
|
let t = { ...e };
|
|
28
30
|
if (t.properties && typeof t.properties == "object") {
|
|
29
31
|
const n = {};
|
|
30
|
-
for (const [
|
|
31
|
-
|
|
32
|
+
for (const [i, r] of Object.entries(t.properties))
|
|
33
|
+
c(r) ? n[i] = l(r) : n[i] = r;
|
|
32
34
|
t.properties = n;
|
|
33
35
|
}
|
|
34
|
-
if ("items" in t && t.items && typeof t.items == "object" &&
|
|
35
|
-
const
|
|
36
|
-
t.oneOf =
|
|
36
|
+
if ("items" in t && t.items && typeof t.items == "object" && c(t.items) && (t.items = l(t.items)), t.additionalProperties && typeof t.additionalProperties == "object" && c(t.additionalProperties) && (t.additionalProperties = l(t.additionalProperties)), t.oneOf && Array.isArray(t.oneOf) && t.oneOf.length > 1) {
|
|
37
|
+
const i = t.oneOf.map((r) => c(r) ? l(r) : r);
|
|
38
|
+
t.oneOf = i;
|
|
37
39
|
}
|
|
38
40
|
if ("oneOf" in t && t.oneOf && Array.isArray(t.oneOf) && t.oneOf.length === 1) {
|
|
39
41
|
const n = t.oneOf[0];
|
|
40
|
-
if (
|
|
41
|
-
return t = { ...t, ...n }, delete t.oneOf,
|
|
42
|
+
if (c(n))
|
|
43
|
+
return t = { ...t, ...n }, delete t.oneOf, l(t);
|
|
42
44
|
}
|
|
43
45
|
return t;
|
|
44
|
-
},
|
|
46
|
+
}, U = (e) => {
|
|
45
47
|
if (e.oneOf)
|
|
46
48
|
return "oneOf";
|
|
47
49
|
if (e.enum)
|
|
@@ -55,56 +57,59 @@ const D = (e, t, n) => t[n] ?? e[n], v = (e, t, n, r) => e[n] !== void 0 && t[n]
|
|
|
55
57
|
default:
|
|
56
58
|
return e.type;
|
|
57
59
|
}
|
|
58
|
-
return e.format &&
|
|
59
|
-
},
|
|
60
|
+
return e.format && h.includes(e.format) ? "file" : e.type;
|
|
61
|
+
}, X = (e) => "enum" in e && e.enum !== void 0, H = (e) => "placeholder" in e && typeof e.placeholder == "string" ? e.placeholder : void 0, W = (e) => e.type === "string", Y = (e) => e.type === "number" || e.type === "integer", Z = (e) => {
|
|
60
62
|
var n;
|
|
61
63
|
const t = {};
|
|
62
|
-
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([i, r]) => {
|
|
65
|
+
var s, f;
|
|
66
|
+
const o = (f = (s = e.dependencies) == null ? void 0 : s.responses) == null ? void 0 : f[r];
|
|
67
|
+
o && o.content && (t[i] = o.content);
|
|
66
68
|
}), t;
|
|
67
|
-
},
|
|
68
|
-
var
|
|
69
|
-
const t = (
|
|
69
|
+
}, G = (e) => {
|
|
70
|
+
var u, p;
|
|
71
|
+
const t = (p = (u = e.dependencies) == null ? void 0 : u.requestBody) == null ? void 0 : p.content;
|
|
70
72
|
if (t === void 0)
|
|
71
|
-
return [
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
return [
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
return [];
|
|
74
|
+
const i = Object.keys(t)[0];
|
|
75
|
+
if (!i)
|
|
76
|
+
return [];
|
|
77
|
+
const r = t[i], o = r == null ? void 0 : r.schema;
|
|
78
|
+
if (!c(o))
|
|
79
|
+
return [];
|
|
80
|
+
const s = Object.values((r == null ? void 0 : r.examples) ?? {});
|
|
81
|
+
if (s.length === 0)
|
|
82
|
+
return [];
|
|
83
|
+
const f = [];
|
|
84
|
+
for (const y of s)
|
|
85
|
+
if ("value" in y) {
|
|
86
|
+
const g = k({
|
|
87
|
+
schema: o,
|
|
88
|
+
example: y.value
|
|
89
|
+
});
|
|
90
|
+
f.push(g);
|
|
91
|
+
}
|
|
92
|
+
return f;
|
|
93
|
+
}, J = (e) => {
|
|
83
94
|
var n;
|
|
84
95
|
const t = (n = e.dependencies) == null ? void 0 : n.parameters;
|
|
85
96
|
if (t) {
|
|
86
|
-
const
|
|
87
|
-
(
|
|
88
|
-
),
|
|
97
|
+
const i = Object.values(t), r = i.filter(
|
|
98
|
+
(u) => !("in" in u) || u.in === "header"
|
|
99
|
+
), o = i.filter((u) => u.in === "cookie"), s = i.filter((u) => u.in === "path"), f = i.filter((u) => u.in === "query");
|
|
89
100
|
return {
|
|
90
|
-
header:
|
|
91
|
-
path:
|
|
92
|
-
query:
|
|
93
|
-
cookie:
|
|
101
|
+
header: r,
|
|
102
|
+
path: s,
|
|
103
|
+
query: f,
|
|
104
|
+
cookie: o
|
|
94
105
|
};
|
|
95
106
|
}
|
|
96
107
|
return { header: [], path: [], query: [], cookie: [] };
|
|
97
|
-
},
|
|
108
|
+
}, x = (e) => {
|
|
98
109
|
let t;
|
|
99
110
|
if (e)
|
|
100
111
|
return typeof e == "object" && "default" in e && (t = e.default), typeof e == "object" && "x-default" in e && (t = e["x-default"]), t;
|
|
101
|
-
},
|
|
102
|
-
if (t.uniqueKey) {
|
|
103
|
-
const i = n || r;
|
|
104
|
-
return `${e ? e + "." : ""}${t.uniqueKey}${i ? "." + i : ""}`;
|
|
105
|
-
} else
|
|
106
|
-
return e;
|
|
107
|
-
}, H = () => ({
|
|
112
|
+
}, Q = () => ({
|
|
108
113
|
oneOf: [
|
|
109
114
|
{
|
|
110
115
|
type: "string"
|
|
@@ -136,24 +141,24 @@ const D = (e, t, n) => t[n] ?? e[n], v = (e, t, n, r) => e[n] !== void 0 && t[n]
|
|
|
136
141
|
type: "null"
|
|
137
142
|
}
|
|
138
143
|
]
|
|
139
|
-
}),
|
|
140
|
-
var
|
|
141
|
-
const n = (
|
|
144
|
+
}), ee = (e, t) => {
|
|
145
|
+
var r, o;
|
|
146
|
+
const n = (o = (r = e.dependencies) == null ? void 0 : r.requestBody) == null ? void 0 : o.content;
|
|
142
147
|
return n === void 0 ? void 0 : Object.keys(n)[t];
|
|
143
|
-
},
|
|
148
|
+
}, C = (e) => e.replace(/\./g, "\\."), B = (e) => {
|
|
144
149
|
switch (e) {
|
|
145
150
|
case "header":
|
|
146
|
-
return
|
|
151
|
+
return a.header;
|
|
147
152
|
case "path":
|
|
148
|
-
return
|
|
153
|
+
return a.path;
|
|
149
154
|
case "query":
|
|
150
|
-
return
|
|
155
|
+
return a.query;
|
|
151
156
|
case "cookie":
|
|
152
|
-
return
|
|
157
|
+
return a.cookie;
|
|
153
158
|
default:
|
|
154
|
-
return
|
|
159
|
+
return a.header;
|
|
155
160
|
}
|
|
156
|
-
},
|
|
161
|
+
}, te = (e) => {
|
|
157
162
|
const t = {
|
|
158
163
|
server: {},
|
|
159
164
|
header: {},
|
|
@@ -162,112 +167,145 @@ const D = (e, t, n) => t[n] ?? e[n], v = (e, t, n, r) => e[n] !== void 0 && t[n]
|
|
|
162
167
|
cookie: {},
|
|
163
168
|
body: void 0
|
|
164
169
|
};
|
|
165
|
-
return Object.entries(e).forEach(([n,
|
|
166
|
-
if (
|
|
170
|
+
return Object.entries(e).forEach(([n, i]) => {
|
|
171
|
+
if (i == null)
|
|
167
172
|
return;
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
n === "body" && (t.body =
|
|
173
|
+
const r = n.split(new RegExp("(?<!\\\\)\\.")).map((u) => u.replace(/\\\./g, "."));
|
|
174
|
+
if (r.length < 2) {
|
|
175
|
+
n === "body" && (t.body = i);
|
|
171
176
|
return;
|
|
172
177
|
}
|
|
173
|
-
const [
|
|
174
|
-
!
|
|
175
|
-
t[
|
|
176
|
-
[...
|
|
177
|
-
|
|
178
|
-
) : [...
|
|
179
|
-
}),
|
|
180
|
-
},
|
|
181
|
-
if (!
|
|
178
|
+
const [o, ...s] = r, f = Object.values(a);
|
|
179
|
+
!o || !f.includes(o) || (o !== a.body ? S(
|
|
180
|
+
t[o],
|
|
181
|
+
[...s],
|
|
182
|
+
i
|
|
183
|
+
) : [...s].length === 0 ? t.body = i : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}), S(t.body, s, i)));
|
|
184
|
+
}), O(t);
|
|
185
|
+
}, I = (e) => {
|
|
186
|
+
if (!b(e))
|
|
182
187
|
return !1;
|
|
183
188
|
const t = Object.keys(e);
|
|
184
189
|
return t.length === 0 ? !1 : t.every((n) => /^\d+$/.test(n));
|
|
185
|
-
},
|
|
190
|
+
}, O = (e) => {
|
|
186
191
|
if (e == null)
|
|
187
192
|
return e;
|
|
188
193
|
if (Array.isArray(e))
|
|
189
|
-
return e.map(
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
return Object.keys(e).sort((
|
|
194
|
+
return e.map(O);
|
|
195
|
+
if (b(e)) {
|
|
196
|
+
if (I(e))
|
|
197
|
+
return Object.keys(e).sort((r, o) => Number(r) - Number(o)).map((r) => e[r]).map(O);
|
|
193
198
|
const t = {};
|
|
194
|
-
for (const [n,
|
|
195
|
-
t[n] =
|
|
199
|
+
for (const [n, i] of Object.entries(e))
|
|
200
|
+
t[n] = O(i);
|
|
196
201
|
return t;
|
|
197
202
|
}
|
|
198
203
|
return e;
|
|
199
|
-
},
|
|
200
|
-
const
|
|
201
|
-
for (let
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
|
|
204
|
+
}, S = (e, t, n) => {
|
|
205
|
+
const i = [];
|
|
206
|
+
for (let o = 0; o < t.length; o++) {
|
|
207
|
+
const s = t[o];
|
|
208
|
+
if (s === "oneOf") {
|
|
209
|
+
o++;
|
|
205
210
|
continue;
|
|
206
211
|
}
|
|
207
|
-
|
|
212
|
+
s === "additionalProperties" || s === "items" || s && i.push(s);
|
|
208
213
|
}
|
|
209
|
-
let
|
|
210
|
-
for (let
|
|
211
|
-
const
|
|
212
|
-
|
|
214
|
+
let r = e;
|
|
215
|
+
for (let o = 0; o < i.length; o++) {
|
|
216
|
+
const s = i[o];
|
|
217
|
+
o === i.length - 1 ? s && (r[s] = n) : (s && (!r[s] || typeof r[s] != "object") && (r[s] = {}), s && (r = r[s]));
|
|
213
218
|
}
|
|
214
|
-
},
|
|
219
|
+
}, ne = (e) => e.filter((n) => "enum" in n && n.enum && "const" in n ? n.enum.includes(n.const) : !0), d = (e) => {
|
|
215
220
|
const t = {};
|
|
216
221
|
if ("uniqueKey" in e && e.uniqueKey !== void 0) {
|
|
217
|
-
const n =
|
|
222
|
+
const n = x(e);
|
|
218
223
|
if (n !== void 0) {
|
|
219
|
-
|
|
220
|
-
t[
|
|
224
|
+
let i = `${a.body}.${e.uniqueKey}`;
|
|
225
|
+
i = i.replace(/\[INDEX\]/g, "0"), t[i] = n;
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
228
|
if ("oneOf" in e && Array.isArray(e.oneOf) && e.oneOf.forEach((n) => {
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
226
|
-
Object.assign(t,
|
|
229
|
+
if (c(n)) {
|
|
230
|
+
const i = d(n);
|
|
231
|
+
Object.assign(t, i);
|
|
227
232
|
}
|
|
228
233
|
}), e.type === "object" && e.properties && Object.values(e.properties).forEach((n) => {
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
231
|
-
Object.assign(t,
|
|
234
|
+
if (c(n)) {
|
|
235
|
+
const i = d(n);
|
|
236
|
+
Object.assign(t, i);
|
|
232
237
|
}
|
|
233
|
-
}), e.additionalProperties && typeof e.additionalProperties == "object" &&
|
|
234
|
-
const n =
|
|
238
|
+
}), e.additionalProperties && typeof e.additionalProperties == "object" && c(e.additionalProperties)) {
|
|
239
|
+
const n = d(e.additionalProperties);
|
|
235
240
|
Object.assign(t, n);
|
|
236
241
|
}
|
|
237
|
-
if (e.type === "array" && "items" in e &&
|
|
238
|
-
const n =
|
|
242
|
+
if (e.type === "array" && "items" in e && c(e.items)) {
|
|
243
|
+
const n = d(e.items);
|
|
239
244
|
Object.assign(t, n);
|
|
240
245
|
}
|
|
241
246
|
return t;
|
|
242
|
-
}
|
|
247
|
+
}, re = (e) => {
|
|
248
|
+
var r;
|
|
249
|
+
const t = "schemes" in e ? (r = e.schemes[0]) == null ? void 0 : r.scheme : e.scheme;
|
|
250
|
+
if (!t) return "header.Authorization";
|
|
251
|
+
const n = "in" in t ? t.in : "header", i = "name" in t ? t.name : T(t);
|
|
252
|
+
return `${B(n)}.${C(i)}`;
|
|
253
|
+
}, ie = (e) => e && "type" in e && e.type === "http" && e.scheme === "basic", T = (e) => e && "type" in e && e.type === "apiKey" ? e.name : "Authorization", oe = (e, t) => Buffer.from(`${e ?? ""}:${t ?? ""}`).toString("base64"), P = (e) => {
|
|
254
|
+
const t = e.typeLabel, n = "type" in e && typeof e.type == "string" ? e.type : void 0;
|
|
255
|
+
return t ?? n ?? "unknown";
|
|
256
|
+
}, se = (e) => {
|
|
257
|
+
if (e.length <= 1)
|
|
258
|
+
return e.map((r) => P(r));
|
|
259
|
+
const t = e.every((r) => r.type === "object"), n = e.map((r) => P(r));
|
|
260
|
+
return t ? e.map((r, o) => r.title ?? `Option ${o + 1}`) : new Set(n).size === n.length ? n : n.map(
|
|
261
|
+
(r, o) => {
|
|
262
|
+
var s;
|
|
263
|
+
return (((s = e[o]) == null ? void 0 : s.title) ?? `Option ${o + 1}`) + " · " + r;
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}, ue = (e, t, n, i) => q(
|
|
267
|
+
`${e ? `${e}-` : ""}${n ? `${n}-` : ""}${t || ""}-`,
|
|
268
|
+
{
|
|
269
|
+
decamelize: !0
|
|
270
|
+
}
|
|
271
|
+
), fe = (e, t) => e ? `${t ? `${t}` : ""}${e}.` : "", ce = (e, t) => e ? t ? `${t}${e}][` : `${e}[` : "";
|
|
243
272
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
ue as buildRecursiveParamFieldId,
|
|
274
|
+
_ as combine,
|
|
275
|
+
Q as convertAnySchemaToOneOfs,
|
|
276
|
+
K as createEmptyReducedSchema,
|
|
277
|
+
z as createUnknownReducedSchema,
|
|
278
|
+
oe as encodeBasicAuth,
|
|
279
|
+
C as escapeDots,
|
|
280
|
+
ne as filterSchemasWithConsts,
|
|
281
|
+
l as flattenSchemaOneOfs,
|
|
282
|
+
V as flattenSingleOneOf,
|
|
283
|
+
se as generateSchemaOptionLabels,
|
|
284
|
+
P as generateSimpleSchemaLabel,
|
|
285
|
+
d as getBodyDefaultsFromSchema,
|
|
286
|
+
ce as getDeepObjectParentName,
|
|
287
|
+
U as getDifferentiatedType,
|
|
288
|
+
J as getParametersPerSection,
|
|
289
|
+
G as getPrefillRequestExamples,
|
|
290
|
+
fe as getRecursiveParentName,
|
|
291
|
+
ee as getRequestBodyContentType,
|
|
292
|
+
x as getSchemaDefault,
|
|
293
|
+
H as getSchemaPlaceholder,
|
|
294
|
+
re as getSecurityOptionInputKeyPrefix,
|
|
295
|
+
T as getSecuritySchemeName,
|
|
296
|
+
E as isArrayObject,
|
|
297
|
+
ie as isBasicAuth,
|
|
298
|
+
D as isCircularRef,
|
|
299
|
+
X as isEnum,
|
|
300
|
+
Y as isNumberSchema,
|
|
301
|
+
F as isObjectArray,
|
|
302
|
+
b as isPlainRecord,
|
|
303
|
+
N as isReducedSchema,
|
|
304
|
+
c as isSchemaObject,
|
|
305
|
+
W as isStringSchema,
|
|
306
|
+
B as mapParamInToPlaygroundInputKey,
|
|
307
|
+
Z as mapResponseExamples,
|
|
308
|
+
w as shouldTruncateForSize,
|
|
309
|
+
M as takeLast,
|
|
310
|
+
te as unflattenInputs
|
|
273
311
|
};
|
package/dist/common/guards.js
CHANGED
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(n) {
|
|
2
2
|
return typeof n == "string";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return typeof
|
|
4
|
+
function r(n) {
|
|
5
|
+
const e = Number(n);
|
|
6
|
+
return typeof e == "number" && !isNaN(e);
|
|
7
7
|
}
|
|
8
8
|
function i(n) {
|
|
9
|
-
const
|
|
10
|
-
return typeof
|
|
9
|
+
const e = Number(n);
|
|
10
|
+
return typeof e == "number" && !isNaN(e) && e % 1 === 0;
|
|
11
11
|
}
|
|
12
12
|
function o(n) {
|
|
13
13
|
return !!n && typeof n == "object" && !Array.isArray(n);
|
|
14
14
|
}
|
|
15
15
|
function u(n) {
|
|
16
|
-
return !!n && typeof n == "object" && Array.isArray(n);
|
|
17
|
-
}
|
|
18
|
-
function f(n) {
|
|
19
16
|
return typeof n == "boolean";
|
|
20
17
|
}
|
|
21
|
-
function
|
|
22
|
-
return n === null;
|
|
23
|
-
}
|
|
24
|
-
function c(n) {
|
|
18
|
+
function f(n) {
|
|
25
19
|
return typeof window < "u" && n instanceof File;
|
|
26
20
|
}
|
|
27
21
|
export {
|
|
28
|
-
u as
|
|
29
|
-
f as
|
|
30
|
-
c as isFile,
|
|
22
|
+
u as isBoolean,
|
|
23
|
+
f as isFile,
|
|
31
24
|
i as isInteger,
|
|
32
|
-
|
|
33
|
-
t as isNumber,
|
|
25
|
+
r as isNumber,
|
|
34
26
|
o as isObject,
|
|
35
|
-
|
|
27
|
+
t as isString
|
|
36
28
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as h, jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as R, useState as E, useRef as T, useEffect as j } from "react";
|
|
3
3
|
import { EndpointLocationContext as M } from "../../contexts/EndpointLocationContext.js";
|
|
4
4
|
import { useSelectedLocale as _ } from "../../utils/locales/index.js";
|
|
@@ -6,10 +6,11 @@ import { useExpandableMemory as $ } from "../../hooks/useExpandableMemory.js";
|
|
|
6
6
|
import { Classes as B } from "../../api-playground-2/types/index.js";
|
|
7
7
|
import { ChevronRightFilled as D } from "@fluentui/react-icons";
|
|
8
8
|
import "@mintlify/validation";
|
|
9
|
+
import "@sindresorhus/slugify";
|
|
9
10
|
import { cn as o } from "../../utils/cn.js";
|
|
10
11
|
import { scrollElementIntoView as F } from "../../utils/scrollElementIntoView.js";
|
|
11
12
|
const a = "expandable-content";
|
|
12
|
-
function
|
|
13
|
+
function W({
|
|
13
14
|
title: s,
|
|
14
15
|
defaultOpen: l = !1,
|
|
15
16
|
onChange: x,
|
|
@@ -22,7 +23,7 @@ function Q({
|
|
|
22
23
|
l
|
|
23
24
|
), [y, f] = E(l), n = l || i ? w : y, [v, S] = E(
|
|
24
25
|
n || !C
|
|
25
|
-
),
|
|
26
|
+
), p = T(null), N = (t) => {
|
|
26
27
|
var b;
|
|
27
28
|
let e = t.closest(`.${a}`);
|
|
28
29
|
for (; e; ) {
|
|
@@ -35,7 +36,7 @@ function Q({
|
|
|
35
36
|
F({
|
|
36
37
|
shouldReturnEarly: !!(r != null && r.current),
|
|
37
38
|
checkIfShouldScroll(e) {
|
|
38
|
-
return !!
|
|
39
|
+
return !!p.current && p.current.contains(e);
|
|
39
40
|
},
|
|
40
41
|
preScrollCallback(e) {
|
|
41
42
|
i ? d(!0) : f(!0), N(e);
|
|
@@ -54,10 +55,10 @@ function Q({
|
|
|
54
55
|
}, A = (t) => {
|
|
55
56
|
i ? d(t) : f(t), L(t);
|
|
56
57
|
};
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ h(
|
|
58
59
|
"details",
|
|
59
60
|
{
|
|
60
|
-
ref:
|
|
61
|
+
ref: p,
|
|
61
62
|
open: n,
|
|
62
63
|
onToggle: (t) => {
|
|
63
64
|
const e = t.currentTarget.open;
|
|
@@ -66,7 +67,7 @@ function Q({
|
|
|
66
67
|
className: o(B.Expandable, "mint:mt-4 mint:mb-4 mint:border-standard mint:rounded-xl"),
|
|
67
68
|
"data-testid": m + "-children",
|
|
68
69
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ h(
|
|
70
71
|
"summary",
|
|
71
72
|
{
|
|
72
73
|
className: o(
|
|
@@ -88,7 +89,7 @@ function Q({
|
|
|
88
89
|
)
|
|
89
90
|
}
|
|
90
91
|
),
|
|
91
|
-
/* @__PURE__ */ u("div", { className: "mint:ml-3 mint:leading-tight mint:text-left", children: /* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ u("div", { className: "mint:ml-3 mint:leading-tight mint:text-left", children: /* @__PURE__ */ h("p", { className: "mint:m-0", contentEditable: !1, children: [
|
|
92
93
|
n ? c.hide : c.show,
|
|
93
94
|
" ",
|
|
94
95
|
s || c.childAttributes
|
|
@@ -114,5 +115,5 @@ function Q({
|
|
|
114
115
|
);
|
|
115
116
|
}
|
|
116
117
|
export {
|
|
117
|
-
|
|
118
|
+
W as Expandable
|
|
118
119
|
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { jsx as t, jsxs as d, Fragment as y } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as H, useRef as q, useState as M, useCallback as O, useEffect as v } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "@mintlify/validation";
|
|
9
|
-
import { cn as f } from "../../utils/cn.js";
|
|
3
|
+
import { OptionDropdown as z } from "../../api-playground/EndpointFields/components/OptionDropdown.js";
|
|
4
|
+
import { EndpointLocationContext as A } from "../../contexts/EndpointLocationContext.js";
|
|
5
|
+
import { useSelectedLocale as D } from "../../utils/locales/index.js";
|
|
6
|
+
import { LinkMultipleRegular as B } from "@fluentui/react-icons";
|
|
7
|
+
import { buildRecursiveParamFieldId as J } from "../../api-playground-2/schemaGraph/utils.js";
|
|
10
8
|
import { copyToClipboard as $ } from "../../utils/copyToClipboard.js";
|
|
11
9
|
import { scrollElementIntoView as G } from "../../utils/scrollElementIntoView.js";
|
|
12
|
-
import "../../
|
|
10
|
+
import { cn as f } from "../../utils/cn.js";
|
|
13
11
|
function u({
|
|
14
12
|
children: e,
|
|
15
13
|
prefix: o,
|
|
@@ -50,7 +48,7 @@ function Q() {
|
|
|
50
48
|
}
|
|
51
49
|
);
|
|
52
50
|
}
|
|
53
|
-
function
|
|
51
|
+
function et({
|
|
54
52
|
name: e,
|
|
55
53
|
typeLabel: o,
|
|
56
54
|
location: c,
|
|
@@ -68,7 +66,7 @@ function mt({
|
|
|
68
66
|
style: _,
|
|
69
67
|
explode: E
|
|
70
68
|
}) {
|
|
71
|
-
const { hasScrolledToAnchorRef: a } = H(
|
|
69
|
+
const { hasScrolledToAnchorRef: a } = H(A), L = D(), x = q(null), [P, S] = M(!1), i = R ?? J(C, e, r), b = O(() => {
|
|
72
70
|
i && ($(window.location.href.split("#")[0] + "#" + i), window.location.hash = i);
|
|
73
71
|
}, [i]);
|
|
74
72
|
v(() => {
|
|
@@ -121,7 +119,7 @@ function mt({
|
|
|
121
119
|
onClick: b,
|
|
122
120
|
children: [
|
|
123
121
|
"",
|
|
124
|
-
/* @__PURE__ */ t("div", { className: "mint:w-6 mint:h-6 mint:rounded-md mint:flex mint:items-center mint:justify-center mint:shadow-sm mint:text-gray-400 mint:dark:text-white/50 mint:dark:bg-background-dark mint:dark:brightness-[1.35] mint:dark:ring-1 mint:dark:hover:brightness-150 mint:bg-white mint:ring-1 mint:ring-gray-400/30 mint:dark:ring-gray-700/25 mint:hover:ring-gray-400/60 mint:dark:hover:ring-white/20 mint:group-focus/link:border-2 mint:group-focus/link:border-primary mint:dark:group-focus/link:border-primary-light", children: /* @__PURE__ */ t(
|
|
122
|
+
/* @__PURE__ */ t("div", { className: "mint:w-6 mint:h-6 mint:rounded-md mint:flex mint:items-center mint:justify-center mint:shadow-sm mint:text-gray-400 mint:dark:text-white/50 mint:dark:bg-background-dark mint:dark:brightness-[1.35] mint:dark:ring-1 mint:dark:hover:brightness-150 mint:bg-white mint:ring-1 mint:ring-gray-400/30 mint:dark:ring-gray-700/25 mint:hover:ring-gray-400/60 mint:dark:hover:ring-white/20 mint:group-focus/link:border-2 mint:group-focus/link:border-primary mint:dark:group-focus/link:border-primary-light", children: /* @__PURE__ */ t(B, {}) })
|
|
125
123
|
]
|
|
126
124
|
}
|
|
127
125
|
) }),
|
|
@@ -154,7 +152,7 @@ function mt({
|
|
|
154
152
|
"data-component-part": "field-meta",
|
|
155
153
|
children: [
|
|
156
154
|
s && s.length > 1 && h ? /* @__PURE__ */ t(
|
|
157
|
-
|
|
155
|
+
z,
|
|
158
156
|
{
|
|
159
157
|
options: s,
|
|
160
158
|
selectedIndex: I,
|
|
@@ -185,6 +183,6 @@ function mt({
|
|
|
185
183
|
export {
|
|
186
184
|
Q as DeprecatedPill,
|
|
187
185
|
u as InfoPill,
|
|
188
|
-
|
|
186
|
+
et as ParamHead,
|
|
189
187
|
K as RequiredPill
|
|
190
188
|
};
|