@mintlify/msft-sdk 1.1.71 → 1.1.72
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/index.js +29 -28
- package/dist/api-playground-2/generators/generateSnippet.js +29 -27
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +23 -22
- package/dist/api-playground-2/schemaGraph/utils.js +64 -63
- package/dist/httpsnippet/src/targets/http/http1.1/client.js +11 -11
- package/dist/index.d.ts +11 -0
- package/dist/utils/base64.js +23 -0
- package/package.json +1 -1
- package/dist/utils/request/isValidUrl.js +0 -10
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import { jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { extension as p } from "mime-types";
|
|
3
|
-
import { useState as c, useMemo as
|
|
4
|
-
import
|
|
3
|
+
import { useState as c, useMemo as y } from "react";
|
|
4
|
+
import f from "../../../components/Api/ErrorBoundary.js";
|
|
5
5
|
import "@mintlify/validation";
|
|
6
6
|
import "@sindresorhus/slugify";
|
|
7
7
|
import { cn as d } from "../../../utils/cn.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { base64ToUint8Array as b } from "../../../utils/base64.js";
|
|
9
|
+
import { ResponseBody as g } from "./ResponseBody/index.js";
|
|
10
|
+
import { ResponseError as h } from "./ResponseError.js";
|
|
10
11
|
import { ResponseHeaders as u } from "./ResponseHeaders.js";
|
|
11
|
-
import { ResponseTopbar as
|
|
12
|
-
const
|
|
12
|
+
import { ResponseTopbar as x } from "./ResponseTopbar.js";
|
|
13
|
+
const A = ["body", "headers"], E = ({
|
|
13
14
|
result: e,
|
|
14
|
-
className:
|
|
15
|
+
className: r
|
|
15
16
|
}) => {
|
|
16
|
-
const [o,
|
|
17
|
+
const [o, t] = c("body"), s = R(e), i = () => /* @__PURE__ */ n(
|
|
17
18
|
"div",
|
|
18
19
|
{
|
|
19
20
|
className: d(
|
|
20
21
|
"mint:rounded-xt mint:dark:bg-zinc-950 mint:bg-white"
|
|
21
22
|
),
|
|
22
|
-
children: e.error ? /* @__PURE__ */ n(
|
|
23
|
+
children: e.error ? /* @__PURE__ */ n(h, { message: e.errorMessage }) : o === "body" ? /* @__PURE__ */ n(g, { data: s }) : /* @__PURE__ */ n(u, { response: e.response })
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
|
-
return /* @__PURE__ */ n(
|
|
26
|
+
return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ m(
|
|
26
27
|
"div",
|
|
27
28
|
{
|
|
28
29
|
className: d(
|
|
29
30
|
"mint:w-full mint:rounded-2xl mint:border mint:p-0.5",
|
|
30
31
|
"mint:bg-gray-50 mint:dark:bg-white/5 mint:border-gray-950/10 mint:dark:border-white/10",
|
|
31
|
-
|
|
32
|
+
r
|
|
32
33
|
),
|
|
33
34
|
children: [
|
|
34
35
|
/* @__PURE__ */ n(
|
|
35
|
-
|
|
36
|
+
x,
|
|
36
37
|
{
|
|
37
38
|
selectedSection: o,
|
|
38
|
-
setSelectedSection:
|
|
39
|
+
setSelectedSection: t,
|
|
39
40
|
result: e,
|
|
40
41
|
data: s
|
|
41
42
|
}
|
|
@@ -44,12 +45,12 @@ const E = ["body", "headers"], H = ({
|
|
|
44
45
|
]
|
|
45
46
|
}
|
|
46
47
|
) });
|
|
47
|
-
},
|
|
48
|
+
}, R = (e) => y(() => {
|
|
48
49
|
if (e.error || e.response.data == null)
|
|
49
50
|
return;
|
|
50
|
-
const
|
|
51
|
-
return o &&
|
|
52
|
-
type:
|
|
51
|
+
const r = b(e.response.data), o = w(e.response.headers), t = l(o), s = new Blob([r], { type: o }), i = URL.createObjectURL(s), a = o && p(o) || void 0;
|
|
52
|
+
return o && t !== "other" ? {
|
|
53
|
+
type: t,
|
|
53
54
|
contentType: o,
|
|
54
55
|
blob: s,
|
|
55
56
|
url: i,
|
|
@@ -57,24 +58,24 @@ const E = ["body", "headers"], H = ({
|
|
|
57
58
|
} : {
|
|
58
59
|
type: "other",
|
|
59
60
|
contentType: o,
|
|
60
|
-
content:
|
|
61
|
+
content: new TextDecoder().decode(r),
|
|
61
62
|
blob: s,
|
|
62
63
|
url: i,
|
|
63
64
|
extension: a
|
|
64
65
|
};
|
|
65
|
-
}, [e]),
|
|
66
|
-
var
|
|
66
|
+
}, [e]), w = (e) => {
|
|
67
|
+
var r;
|
|
67
68
|
for (const o in e)
|
|
68
69
|
if (o.toLowerCase() === "content-type") {
|
|
69
|
-
const
|
|
70
|
-
if (typeof
|
|
71
|
-
return (
|
|
70
|
+
const t = e[o];
|
|
71
|
+
if (typeof t == "string")
|
|
72
|
+
return (r = t.split(";")[0]) == null ? void 0 : r.toLowerCase();
|
|
72
73
|
}
|
|
73
|
-
},
|
|
74
|
-
const [
|
|
75
|
-
return
|
|
74
|
+
}, l = (e) => {
|
|
75
|
+
const [r] = (e == null ? void 0 : e.split("/")) ?? [];
|
|
76
|
+
return r === "image" || r === "audio" || r === "video" ? r : "other";
|
|
76
77
|
};
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
E as Response,
|
|
80
|
+
A as responseSections
|
|
80
81
|
};
|
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
import { HTTPSnippet as
|
|
1
|
+
import { HTTPSnippet as U } from "../../httpsnippet/src/index.js";
|
|
2
2
|
import { generateUniqueString as x } from "../../utils/uuid.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const E = ({
|
|
3
|
+
import { snippetPresets as y } from "../../constants/snippetPresets.js";
|
|
4
|
+
const v = ({
|
|
6
5
|
request: n,
|
|
7
|
-
pathInputs:
|
|
8
|
-
apiReferenceData:
|
|
9
|
-
snippetPresets:
|
|
10
|
-
isMultipleRequest:
|
|
6
|
+
pathInputs: p,
|
|
7
|
+
apiReferenceData: a,
|
|
8
|
+
snippetPresets: s = y,
|
|
9
|
+
isMultipleRequest: c = !1
|
|
11
10
|
}) => {
|
|
12
|
-
const
|
|
11
|
+
const l = {}, m = /:{[^{}]+}/g, f = n.url.replace(m, (e) => {
|
|
13
12
|
const t = ":62437";
|
|
14
|
-
return
|
|
15
|
-
}), d = /{[^{}]+}/g,
|
|
16
|
-
const t = e.slice(1, e.length - 1), r =
|
|
13
|
+
return l[t] = e, t;
|
|
14
|
+
}), d = /{[^{}]+}/g, h = f.replace(d, (e) => {
|
|
15
|
+
const t = e.slice(1, e.length - 1), r = p[t];
|
|
17
16
|
if (e === "{endpoint}")
|
|
18
17
|
return "https://{endpoint}";
|
|
19
18
|
if (r && (typeof r != "string" || r.length > 0))
|
|
20
19
|
return `${encodeURIComponent(r.toString())}`;
|
|
21
20
|
const o = x();
|
|
22
|
-
return
|
|
21
|
+
return l[o] = e, o;
|
|
23
22
|
});
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
let u;
|
|
24
|
+
try {
|
|
25
|
+
u = new U({
|
|
26
|
+
...n,
|
|
27
|
+
url: h,
|
|
28
|
+
postData: n.postData || { mimeType: "application/json" }
|
|
29
|
+
});
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return console.error("Error creating HTTPSnippet:", e), [
|
|
26
32
|
{
|
|
27
33
|
filename: "Error",
|
|
28
34
|
code: "A valid request URL is required to generate request examples",
|
|
29
35
|
language: ""
|
|
30
36
|
}
|
|
31
37
|
];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
url: u,
|
|
35
|
-
postData: n.postData || { mimeType: "application/json" }
|
|
36
|
-
});
|
|
37
|
-
return p.map((e) => {
|
|
38
|
+
}
|
|
39
|
+
return s.map((e) => {
|
|
38
40
|
var g;
|
|
39
|
-
const { filename: t, snippet: r, language: o } = e, { target:
|
|
41
|
+
const { filename: t, snippet: r, language: o } = e, { target: P, client: S } = r;
|
|
40
42
|
try {
|
|
41
|
-
const i =
|
|
43
|
+
const i = u.convert(P, S), T = R(l, (i == null ? void 0 : i.toString()) || "");
|
|
42
44
|
return {
|
|
43
|
-
filename:
|
|
44
|
-
code:
|
|
45
|
+
filename: c ? t : ((g = a.operation) == null ? void 0 : g.title) || t,
|
|
46
|
+
code: T,
|
|
45
47
|
language: o
|
|
46
48
|
};
|
|
47
49
|
} catch (i) {
|
|
48
50
|
return console.error(`Error generating snippet for ${o}:`, i), null;
|
|
49
51
|
}
|
|
50
52
|
}).filter((e) => e !== null);
|
|
51
|
-
},
|
|
53
|
+
}, R = (n, p) => Object.entries(n).reduce((a, [s, c]) => a.replace(s, c), p);
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
v as generateSnippet
|
|
54
56
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useContext as
|
|
1
|
+
import { useContext as S, useCallback as x } from "react";
|
|
2
2
|
import { encodeBasicAuth as z } from "../schemaGraph/utils.js";
|
|
3
3
|
import { usePlaygroundInputsStore as O } from "./usePlaygroundInputsStore.js";
|
|
4
4
|
import { ApiReferenceContext2 as F } from "../../contexts/ConfigContext.js";
|
|
5
|
-
|
|
5
|
+
import { arrayBufferToBase64 as P } from "../../utils/base64.js";
|
|
6
|
+
const k = ({
|
|
6
7
|
apiReferenceData: t,
|
|
7
8
|
baseUrl: r,
|
|
8
9
|
contentType: o = "application/json",
|
|
@@ -10,33 +11,33 @@ const L = ({
|
|
|
10
11
|
setIsSending: a
|
|
11
12
|
}) => {
|
|
12
13
|
var m, b, g;
|
|
13
|
-
const { requestEndpointUrl: s, fileRequestEndpointUrl: n } =
|
|
14
|
+
const { requestEndpointUrl: s, fileRequestEndpointUrl: n } = S(F), i = O((p) => p.getApiPlaygroundInputs), h = (m = t.operation) == null ? void 0 : m.disableProxy, d = (b = t.operation) == null ? void 0 : b.path, f = (g = t.operation) == null ? void 0 : g.method;
|
|
14
15
|
return x(async () => {
|
|
15
|
-
const
|
|
16
|
-
if (a(!0), !
|
|
16
|
+
const p = i();
|
|
17
|
+
if (a(!0), !d || !r || !f || !o || !r) {
|
|
17
18
|
a(!1), e({
|
|
18
19
|
error: !0,
|
|
19
20
|
errorMessage: "Missing required fields to send a playground request"
|
|
20
21
|
}), console.error(
|
|
21
22
|
`Missing some required field to send a playground request:
|
|
22
23
|
|
|
23
|
-
path=${
|
|
24
|
+
path=${d}
|
|
24
25
|
method=${f}
|
|
25
26
|
contentType=${o}
|
|
26
27
|
baseUrl=${r}`
|
|
27
28
|
);
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
const A = await import("axios").then((c) => c.default), j =
|
|
31
|
-
let u =
|
|
32
|
-
u =
|
|
31
|
+
const A = await import("axios").then((c) => c.default), j = $(d, p.path), w = E(C(r, p.server), j);
|
|
32
|
+
let u = B(p.header, o);
|
|
33
|
+
u = M(u);
|
|
33
34
|
const l = {
|
|
34
35
|
method: f,
|
|
35
|
-
url:
|
|
36
|
+
url: w,
|
|
36
37
|
header: u,
|
|
37
|
-
body:
|
|
38
|
-
cookie:
|
|
39
|
-
query:
|
|
38
|
+
body: p.body,
|
|
39
|
+
cookie: p.cookie,
|
|
40
|
+
query: p.query
|
|
40
41
|
};
|
|
41
42
|
let y;
|
|
42
43
|
try {
|
|
@@ -70,7 +71,7 @@ baseUrl=${r}`
|
|
|
70
71
|
a(!1);
|
|
71
72
|
}, [
|
|
72
73
|
f,
|
|
73
|
-
|
|
74
|
+
d,
|
|
74
75
|
a,
|
|
75
76
|
i,
|
|
76
77
|
r,
|
|
@@ -78,12 +79,12 @@ baseUrl=${r}`
|
|
|
78
79
|
h,
|
|
79
80
|
e
|
|
80
81
|
]);
|
|
81
|
-
},
|
|
82
|
+
}, $ = (t, r) => Object.entries(r).reduce((o, [e, a]) => a == null ? o : o.replace(`{${e}}`, encodeURIComponent(a.toString())), t), C = (t, r) => {
|
|
82
83
|
let o = t;
|
|
83
84
|
return Object.entries(r).forEach(([e, a]) => {
|
|
84
85
|
a && (o = o.replace(`{${e}}`, a));
|
|
85
86
|
}), o;
|
|
86
|
-
},
|
|
87
|
+
}, E = (t, r) => t.replace(/\/$/, "") + "/" + r.replace(/^\//, ""), B = (t, r) => Object.keys(t).some((o) => o.toLowerCase() === "content-type") ? t : {
|
|
87
88
|
...t,
|
|
88
89
|
"content-type": r
|
|
89
90
|
}, D = async (t) => {
|
|
@@ -110,7 +111,7 @@ baseUrl=${r}`
|
|
|
110
111
|
validateStatus: () => !0,
|
|
111
112
|
// prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding
|
|
112
113
|
// we can't use `responseEncoding` as it's ignored client-side
|
|
113
|
-
transformResponse: (s) =>
|
|
114
|
+
transformResponse: (s) => P(s)
|
|
114
115
|
});
|
|
115
116
|
}, J = async (t, r) => {
|
|
116
117
|
const o = await import("axios").then((s) => s.default), e = new FormData();
|
|
@@ -152,7 +153,7 @@ baseUrl=${r}`
|
|
|
152
153
|
}), r = a, delete o["content-type"]);
|
|
153
154
|
}
|
|
154
155
|
return { data: r, headers: o };
|
|
155
|
-
},
|
|
156
|
+
}, M = (t) => {
|
|
156
157
|
if (!t.Authorization || typeof t.Authorization != "object") return t;
|
|
157
158
|
if (typeof t.Authorization == "object") {
|
|
158
159
|
const r = "username" in t.Authorization ? t.Authorization.username : "", o = "password" in t.Authorization ? t.Authorization.password : "", e = z(r, o);
|
|
@@ -161,8 +162,8 @@ baseUrl=${r}`
|
|
|
161
162
|
return t;
|
|
162
163
|
};
|
|
163
164
|
export {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
$ as addPathParams,
|
|
166
|
+
C as addServerVariables,
|
|
167
|
+
E as joinWithSingleSlash,
|
|
168
|
+
k as useSendPlaygroundRequest
|
|
168
169
|
};
|
|
@@ -2,11 +2,12 @@ import "@mintlify/validation";
|
|
|
2
2
|
import q from "@sindresorhus/slugify";
|
|
3
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
4
|
import { getExampleBodyInputs as k } from "./getExampleBodyInputs.js";
|
|
5
|
-
|
|
5
|
+
import { stringToBase64 as E } from "../../utils/base64.js";
|
|
6
|
+
function z(e) {
|
|
6
7
|
return typeof e == "object" && e !== null && A in e && typeof e[A] == "string";
|
|
7
8
|
}
|
|
8
|
-
const
|
|
9
|
-
function
|
|
9
|
+
const N = () => ({ oneOf: [] }), F = () => ({ oneOf: [{}] }), b = (e) => typeof e == "object" && e !== null && !Array.isArray(e), w = (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, x = (e) => c(e) && e.type === "array", M = (e) => x(e) && c(e.items) && e.items.type === "object";
|
|
10
|
+
function _(e) {
|
|
10
11
|
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
12
|
return m.forEach((s) => {
|
|
12
13
|
if (e[s]) {
|
|
@@ -25,7 +26,7 @@ function w(e) {
|
|
|
25
26
|
}
|
|
26
27
|
}), r.reduce((s, f) => s * f, 1) > $;
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
+
const V = (e, t, n) => t[n] ?? e[n], U = (e, t, n, i) => e[n] !== void 0 && t[n] !== void 0 ? i(e[n], t[n]) : e[n] ?? t[n], X = (e) => e.oneOf && e.oneOf.length === 1 ? e.oneOf[0] : e, l = (e) => {
|
|
29
30
|
let t = { ...e };
|
|
30
31
|
if (t.properties && typeof t.properties == "object") {
|
|
31
32
|
const n = {};
|
|
@@ -43,7 +44,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
43
44
|
return t = { ...t, ...n }, delete t.oneOf, l(t);
|
|
44
45
|
}
|
|
45
46
|
return t;
|
|
46
|
-
},
|
|
47
|
+
}, H = (e) => {
|
|
47
48
|
if (e.oneOf)
|
|
48
49
|
return "oneOf";
|
|
49
50
|
if (e.enum)
|
|
@@ -58,7 +59,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
58
59
|
return e.type;
|
|
59
60
|
}
|
|
60
61
|
return e.format && h.includes(e.format) ? "file" : e.type;
|
|
61
|
-
},
|
|
62
|
+
}, W = (e) => "enum" in e && e.enum !== void 0, Y = (e) => "placeholder" in e && typeof e.placeholder == "string" ? e.placeholder : void 0, Z = (e) => e.type === "string", G = (e) => e.type === "number" || e.type === "integer", J = (e) => {
|
|
62
63
|
var n;
|
|
63
64
|
const t = {};
|
|
64
65
|
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([i, r]) => {
|
|
@@ -66,7 +67,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
66
67
|
const o = (f = (s = e.dependencies) == null ? void 0 : s.responses) == null ? void 0 : f[r];
|
|
67
68
|
o && o.content && (t[i] = o.content);
|
|
68
69
|
}), t;
|
|
69
|
-
},
|
|
70
|
+
}, Q = (e) => {
|
|
70
71
|
var u, p;
|
|
71
72
|
const t = (p = (u = e.dependencies) == null ? void 0 : u.requestBody) == null ? void 0 : p.content;
|
|
72
73
|
if (t === void 0)
|
|
@@ -90,7 +91,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
90
91
|
f.push(g);
|
|
91
92
|
}
|
|
92
93
|
return f;
|
|
93
|
-
},
|
|
94
|
+
}, ee = (e) => {
|
|
94
95
|
var n;
|
|
95
96
|
const t = (n = e.dependencies) == null ? void 0 : n.parameters;
|
|
96
97
|
if (t) {
|
|
@@ -105,11 +106,11 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
return { header: [], path: [], query: [], cookie: [] };
|
|
108
|
-
},
|
|
109
|
+
}, C = (e) => {
|
|
109
110
|
let t;
|
|
110
111
|
if (e)
|
|
111
112
|
return typeof e == "object" && "default" in e && (t = e.default), typeof e == "object" && "x-default" in e && (t = e["x-default"]), t;
|
|
112
|
-
},
|
|
113
|
+
}, te = () => ({
|
|
113
114
|
oneOf: [
|
|
114
115
|
{
|
|
115
116
|
type: "string"
|
|
@@ -141,11 +142,11 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
141
142
|
type: "null"
|
|
142
143
|
}
|
|
143
144
|
]
|
|
144
|
-
}),
|
|
145
|
+
}), ne = (e, t) => {
|
|
145
146
|
var r, o;
|
|
146
147
|
const n = (o = (r = e.dependencies) == null ? void 0 : r.requestBody) == null ? void 0 : o.content;
|
|
147
148
|
return n === void 0 ? void 0 : Object.keys(n)[t];
|
|
148
|
-
},
|
|
149
|
+
}, B = (e) => e.replace(/\./g, "\\."), I = (e) => {
|
|
149
150
|
switch (e) {
|
|
150
151
|
case "header":
|
|
151
152
|
return a.header;
|
|
@@ -158,7 +159,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
158
159
|
default:
|
|
159
160
|
return a.header;
|
|
160
161
|
}
|
|
161
|
-
},
|
|
162
|
+
}, re = (e) => {
|
|
162
163
|
const t = {
|
|
163
164
|
server: {},
|
|
164
165
|
header: {},
|
|
@@ -176,13 +177,13 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
176
177
|
return;
|
|
177
178
|
}
|
|
178
179
|
const [o, ...s] = r, f = Object.values(a);
|
|
179
|
-
!o || !f.includes(o) || (o !== a.body ?
|
|
180
|
+
!o || !f.includes(o) || (o !== a.body ? P(
|
|
180
181
|
t[o],
|
|
181
182
|
[...s],
|
|
182
183
|
i
|
|
183
|
-
) : [...s].length === 0 ? t.body = i : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}),
|
|
184
|
+
) : [...s].length === 0 ? t.body = i : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}), P(t.body, s, i)));
|
|
184
185
|
}), O(t);
|
|
185
|
-
},
|
|
186
|
+
}, T = (e) => {
|
|
186
187
|
if (!b(e))
|
|
187
188
|
return !1;
|
|
188
189
|
const t = Object.keys(e);
|
|
@@ -193,7 +194,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
193
194
|
if (Array.isArray(e))
|
|
194
195
|
return e.map(O);
|
|
195
196
|
if (b(e)) {
|
|
196
|
-
if (
|
|
197
|
+
if (T(e))
|
|
197
198
|
return Object.keys(e).sort((r, o) => Number(r) - Number(o)).map((r) => e[r]).map(O);
|
|
198
199
|
const t = {};
|
|
199
200
|
for (const [n, i] of Object.entries(e))
|
|
@@ -201,7 +202,7 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
201
202
|
return t;
|
|
202
203
|
}
|
|
203
204
|
return e;
|
|
204
|
-
},
|
|
205
|
+
}, P = (e, t, n) => {
|
|
205
206
|
const i = [];
|
|
206
207
|
for (let o = 0; o < t.length; o++) {
|
|
207
208
|
const s = t[o];
|
|
@@ -216,10 +217,10 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
216
217
|
const s = i[o];
|
|
217
218
|
o === i.length - 1 ? s && (r[s] = n) : (s && (!r[s] || typeof r[s] != "object") && (r[s] = {}), s && (r = r[s]));
|
|
218
219
|
}
|
|
219
|
-
},
|
|
220
|
+
}, ie = (e) => e.filter((n) => "enum" in n && n.enum && "const" in n ? n.enum.includes(n.const) : !0), d = (e) => {
|
|
220
221
|
const t = {};
|
|
221
222
|
if ("uniqueKey" in e && e.uniqueKey !== void 0) {
|
|
222
|
-
const n =
|
|
223
|
+
const n = C(e);
|
|
223
224
|
if (n !== void 0) {
|
|
224
225
|
let i = `${a.body}.${e.uniqueKey}`;
|
|
225
226
|
i = i.replace(/\[INDEX\]/g, "0"), t[i] = n;
|
|
@@ -244,68 +245,68 @@ const M = (e, t, n) => t[n] ?? e[n], _ = (e, t, n, i) => e[n] !== void 0 && t[n]
|
|
|
244
245
|
Object.assign(t, n);
|
|
245
246
|
}
|
|
246
247
|
return t;
|
|
247
|
-
},
|
|
248
|
+
}, oe = (e) => {
|
|
248
249
|
var r;
|
|
249
250
|
const t = "schemes" in e ? (r = e.schemes[0]) == null ? void 0 : r.scheme : e.scheme;
|
|
250
251
|
if (!t) return "header.Authorization";
|
|
251
|
-
const n = "in" in t ? t.in : "header", i = "name" in t ? t.name :
|
|
252
|
-
return `${
|
|
253
|
-
},
|
|
252
|
+
const n = "in" in t ? t.in : "header", i = "name" in t ? t.name : j(t);
|
|
253
|
+
return `${I(n)}.${B(i)}`;
|
|
254
|
+
}, se = (e) => e && "type" in e && e.type === "http" && e.scheme === "basic", j = (e) => e && "type" in e && e.type === "apiKey" ? e.name : "Authorization", ue = (e, t) => E(`${e ?? ""}:${t ?? ""}`), S = (e) => {
|
|
254
255
|
const t = e.typeLabel, n = "type" in e && typeof e.type == "string" ? e.type : void 0;
|
|
255
256
|
return t ?? n ?? "unknown";
|
|
256
|
-
},
|
|
257
|
+
}, fe = (e) => {
|
|
257
258
|
if (e.length <= 1)
|
|
258
|
-
return e.map((r) =>
|
|
259
|
-
const t = e.every((r) => r.type === "object"), n = e.map((r) =>
|
|
259
|
+
return e.map((r) => S(r));
|
|
260
|
+
const t = e.every((r) => r.type === "object"), n = e.map((r) => S(r));
|
|
260
261
|
return t ? e.map((r, o) => r.title ?? `Option ${o + 1}`) : new Set(n).size === n.length ? n : n.map(
|
|
261
262
|
(r, o) => {
|
|
262
263
|
var s;
|
|
263
264
|
return (((s = e[o]) == null ? void 0 : s.title) ?? `Option ${o + 1}`) + " · " + r;
|
|
264
265
|
}
|
|
265
266
|
);
|
|
266
|
-
},
|
|
267
|
+
}, ce = (e, t, n, i) => q(
|
|
267
268
|
`${e ? `${e}-` : ""}${n ? `${n}-` : ""}${t || ""}-`,
|
|
268
269
|
{
|
|
269
270
|
decamelize: !0
|
|
270
271
|
}
|
|
271
|
-
),
|
|
272
|
+
), ae = (e, t) => e ? `${t ? `${t}` : ""}${e}.` : "", pe = (e, t) => e ? t ? `${t}${e}][` : `${e}[` : "";
|
|
272
273
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
274
|
+
ce as buildRecursiveParamFieldId,
|
|
275
|
+
U as combine,
|
|
276
|
+
te as convertAnySchemaToOneOfs,
|
|
277
|
+
N as createEmptyReducedSchema,
|
|
278
|
+
F as createUnknownReducedSchema,
|
|
279
|
+
ue as encodeBasicAuth,
|
|
280
|
+
B as escapeDots,
|
|
281
|
+
ie as filterSchemasWithConsts,
|
|
281
282
|
l as flattenSchemaOneOfs,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
X as flattenSingleOneOf,
|
|
284
|
+
fe as generateSchemaOptionLabels,
|
|
285
|
+
S as generateSimpleSchemaLabel,
|
|
285
286
|
d as getBodyDefaultsFromSchema,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
287
|
+
pe as getDeepObjectParentName,
|
|
288
|
+
H as getDifferentiatedType,
|
|
289
|
+
ee as getParametersPerSection,
|
|
290
|
+
Q as getPrefillRequestExamples,
|
|
291
|
+
ae as getRecursiveParentName,
|
|
292
|
+
ne as getRequestBodyContentType,
|
|
293
|
+
C as getSchemaDefault,
|
|
294
|
+
Y as getSchemaPlaceholder,
|
|
295
|
+
oe as getSecurityOptionInputKeyPrefix,
|
|
296
|
+
j as getSecuritySchemeName,
|
|
297
|
+
x as isArrayObject,
|
|
298
|
+
se as isBasicAuth,
|
|
299
|
+
z as isCircularRef,
|
|
300
|
+
W as isEnum,
|
|
301
|
+
G as isNumberSchema,
|
|
302
|
+
M as isObjectArray,
|
|
302
303
|
b as isPlainRecord,
|
|
303
|
-
|
|
304
|
+
w as isReducedSchema,
|
|
304
305
|
c as isSchemaObject,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
Z as isStringSchema,
|
|
307
|
+
I as mapParamInToPlaygroundInputKey,
|
|
308
|
+
J as mapResponseExamples,
|
|
309
|
+
_ as shouldTruncateForSize,
|
|
310
|
+
V as takeLast,
|
|
311
|
+
re as unflattenInputs
|
|
311
312
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodeBuilder as m } from "../../../helpers/code-builder.js";
|
|
2
2
|
const i = `\r
|
|
3
|
-
`,
|
|
3
|
+
`, L = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "http1.1",
|
|
6
6
|
title: "HTTP/1.1",
|
|
@@ -8,27 +8,27 @@ const i = `\r
|
|
|
8
8
|
description: "HTTP/1.1 request string in accordance with RFC 7230",
|
|
9
9
|
extname: null
|
|
10
10
|
},
|
|
11
|
-
convert: ({ method: h, fullUrl:
|
|
11
|
+
convert: ({ method: h, fullUrl: l, uriObj: c, httpVersion: a, allHeaders: r, postData: n }, u) => {
|
|
12
12
|
const o = {
|
|
13
13
|
absoluteURI: !1,
|
|
14
14
|
autoContentLength: !0,
|
|
15
15
|
autoHost: !0,
|
|
16
16
|
...u
|
|
17
|
-
}, { blank:
|
|
18
|
-
t(`${h} ${
|
|
17
|
+
}, { blank: d, push: t, join: g } = new m({ indent: "", join: i }), p = o.absoluteURI ? l : c.path;
|
|
18
|
+
t(`${h} ${p} ${a}`);
|
|
19
19
|
const s = Object.keys(r);
|
|
20
20
|
if (s.forEach((e) => {
|
|
21
|
-
const
|
|
22
|
-
t(`${
|
|
21
|
+
const f = e.toLowerCase().replace(/(^|-)(\w)/g, (x) => x.toUpperCase());
|
|
22
|
+
t(`${f}: ${r[e]}`);
|
|
23
23
|
}), o.autoHost && !s.includes("host") && t(`Host: ${c.host}`), o.autoContentLength && n.text && !s.includes("content-length")) {
|
|
24
|
-
const e =
|
|
24
|
+
const e = new TextEncoder().encode(n.text).length.toString();
|
|
25
25
|
t(`Content-Length: ${e}`);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
return `${
|
|
27
|
+
d();
|
|
28
|
+
const $ = g(), C = n.text || "";
|
|
29
|
+
return `${$}${i}${C}`;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
L as http11
|
|
34
34
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { Element as Element_2 } from 'hast';
|
|
|
16
16
|
import { Endpoint } from '@mintlify/validation';
|
|
17
17
|
import { GitSource } from '@mintlify/validation';
|
|
18
18
|
import { Handle } from 'hast-util-to-mdast';
|
|
19
|
+
import { HttpMethod } from '@mintlify/validation';
|
|
19
20
|
import { IncrementalDataSchemaArray } from '@mintlify/validation';
|
|
20
21
|
import { InkeepType } from '@mintlify/models';
|
|
21
22
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
@@ -937,6 +938,16 @@ export declare function remarkHeadingIds(): (tree: Root) => void;
|
|
|
937
938
|
|
|
938
939
|
export declare function removeHtmlComments(root: Root_2): void;
|
|
939
940
|
|
|
941
|
+
declare type RequestInfo_2 = {
|
|
942
|
+
method: HttpMethod;
|
|
943
|
+
url: string;
|
|
944
|
+
header: Record<string, unknown>;
|
|
945
|
+
query: Record<string, unknown>;
|
|
946
|
+
cookie: Record<string, unknown>;
|
|
947
|
+
body: unknown;
|
|
948
|
+
};
|
|
949
|
+
export { RequestInfo_2 as RequestInfo }
|
|
950
|
+
|
|
940
951
|
declare type ResolvedRequestBody = RequestBodyObject & {
|
|
941
952
|
exampleType?: 'generated' | 'examples';
|
|
942
953
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function c(n) {
|
|
2
|
+
const e = new TextEncoder().encode(n);
|
|
3
|
+
return a(e);
|
|
4
|
+
}
|
|
5
|
+
function a(n) {
|
|
6
|
+
const t = n instanceof ArrayBuffer ? new Uint8Array(n) : n;
|
|
7
|
+
let e = "";
|
|
8
|
+
const r = t.byteLength;
|
|
9
|
+
for (let o = 0; o < r; o++)
|
|
10
|
+
e += String.fromCharCode(t[o]);
|
|
11
|
+
return btoa(e);
|
|
12
|
+
}
|
|
13
|
+
function s(n) {
|
|
14
|
+
const t = atob(n), e = new Uint8Array(t.length);
|
|
15
|
+
for (let r = 0; r < t.length; r++)
|
|
16
|
+
e[r] = t.charCodeAt(r);
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
a as arrayBufferToBase64,
|
|
21
|
+
s as base64ToUint8Array,
|
|
22
|
+
c as stringToBase64
|
|
23
|
+
};
|
package/package.json
CHANGED