@mintlify/msft-sdk 1.1.22 → 1.1.23
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-2/ApiExamples.js +24 -16
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +66 -58
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +55 -50
- package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
- package/dist/api-playground-2/generators/createBodyData.js +1 -1
- package/dist/api-playground-2/generators/createBodyData.js.map +1 -1
- package/dist/api-playground-2/generators/createHeaders.js +18 -18
- package/dist/api-playground-2/generators/createHeaders.js.map +1 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +18 -16
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateRequest.js +26 -25
- package/dist/api-playground-2/generators/generateRequest.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +24 -13
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/common/guards.js +11 -0
- package/dist/common/guards.js.map +1 -0
- package/dist/components/toc/index.js +4 -4
- package/dist/components/toc/index.js.map +1 -1
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -11
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
var o,
|
|
3
|
-
const a = [], i = /* @__PURE__ */ new Set(),
|
|
4
|
-
((
|
|
5
|
-
).filter((e) => !e.in || e.in === "header").filter((e) => e.schema.isRequired),
|
|
6
|
-
((
|
|
1
|
+
const y = (t, s, n, l) => {
|
|
2
|
+
var o, u, d;
|
|
3
|
+
const a = [], i = /* @__PURE__ */ new Set(), p = Object.values(
|
|
4
|
+
((u = (o = t.dependencies) == null ? void 0 : o.parameters) == null ? void 0 : u.header) ?? {}
|
|
5
|
+
).filter((e) => !e.in || e.in === "header").filter((e) => e.schema.isRequired), f = Object.values(
|
|
6
|
+
((d = t.dependencies) == null ? void 0 : d.processedSecurityOptions) ?? {}
|
|
7
7
|
).filter(({ scheme: e }) => !("in" in e) || e.in === "header");
|
|
8
|
-
|
|
8
|
+
Object.entries(s).filter((e) => e[1] != null).forEach(([e, r]) => {
|
|
9
9
|
i.add(e), a.push({
|
|
10
10
|
name: e,
|
|
11
11
|
value: r.toString()
|
|
12
12
|
});
|
|
13
|
-
}),
|
|
13
|
+
}), p.forEach((e) => {
|
|
14
14
|
const r = e.name;
|
|
15
15
|
i.has(r) || a.push({
|
|
16
16
|
name: r,
|
|
17
17
|
value: `<${r.toLowerCase()}>`
|
|
18
18
|
});
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
19
|
+
});
|
|
20
|
+
const c = f[l];
|
|
21
|
+
if (c) {
|
|
22
|
+
const { scheme: e, schema: r } = c, h = "name" in e ? e.name : r.title ?? "Authorization";
|
|
23
|
+
i.has(h) || a.push({ name: h, value: m(e) });
|
|
24
|
+
}
|
|
25
|
+
return n && v(a, n), a;
|
|
26
|
+
}, m = (t) => {
|
|
27
27
|
switch (t.type) {
|
|
28
28
|
case "http":
|
|
29
29
|
return t.scheme === "basic" ? "Basic <encoded-value>" : "Bearer <token>";
|
|
@@ -33,13 +33,13 @@ const v = (t, s, n) => {
|
|
|
33
33
|
default:
|
|
34
34
|
return "<api-key>";
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, v = (t, s) => {
|
|
37
37
|
t.some(({ name: n }) => n.toLowerCase() === "content-type") || t.push({
|
|
38
38
|
name: "Content-Type",
|
|
39
39
|
value: s
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
y as createHeaders
|
|
44
44
|
};
|
|
45
45
|
//# sourceMappingURL=createHeaders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHeaders.js","sources":["../../../src/api-playground-2/generators/createHeaders.ts"],"sourcesContent":["import type { Header } from 'har-format';\n\nimport type { ApiReferenceDataV2, SecuritySchemeAndScope } from '@/api-playground-2/types';\n\nexport const createHeaders = (\n apiReferenceData: ApiReferenceDataV2,\n headerInputs: Record<string, unknown>,\n selectedBodyContentType?: string\n): Header[] => {\n const headers: Header[] = [];\n const addedHeaders = new Set<string>();\n const requiredHeaderParameters = Object.values(\n apiReferenceData.dependencies?.parameters?.header ?? {}\n )\n .filter((param) => !param.in || param.in === 'header')\n .filter((param) => param.schema.isRequired);\n const securityHeaderParameters = Object.values(\n apiReferenceData.dependencies?.processedSecurityOptions ?? {}\n ).filter(({ scheme }) => !('in' in scheme) || scheme.in === 'header');\n\n Object.entries(headerInputs)\n .filter((entry): entry is [string, NonNullable<unknown>] => entry[1] != null)\n .forEach(([name, value]) => {\n addedHeaders.add(name);\n headers.push({\n name,\n value: value.toString(),\n });\n });\n\n requiredHeaderParameters.forEach((param) => {\n const name = param.name;\n if (!addedHeaders.has(name)) {\n headers.push({\n name,\n value: `<${name.toLowerCase()}>`,\n });\n }\n });\n\n securityHeaderParameters
|
|
1
|
+
{"version":3,"file":"createHeaders.js","sources":["../../../src/api-playground-2/generators/createHeaders.ts"],"sourcesContent":["import type { Header } from 'har-format';\n\nimport type { ApiReferenceDataV2, SecuritySchemeAndScope } from '@/api-playground-2/types';\n\nexport const createHeaders = (\n apiReferenceData: ApiReferenceDataV2,\n headerInputs: Record<string, unknown>,\n selectedBodyContentType?: string,\n // @ts-expect-error\n selectedSecurityOptionIndex: number\n): Header[] => {\n const headers: Header[] = [];\n const addedHeaders = new Set<string>();\n const requiredHeaderParameters = Object.values(\n apiReferenceData.dependencies?.parameters?.header ?? {}\n )\n .filter((param) => !param.in || param.in === 'header')\n .filter((param) => param.schema.isRequired);\n const securityHeaderParameters = Object.values(\n apiReferenceData.dependencies?.processedSecurityOptions ?? {}\n ).filter(({ scheme }) => !('in' in scheme) || scheme.in === 'header');\n\n Object.entries(headerInputs)\n .filter((entry): entry is [string, NonNullable<unknown>] => entry[1] != null)\n .forEach(([name, value]) => {\n addedHeaders.add(name);\n headers.push({\n name,\n value: value.toString(),\n });\n });\n\n requiredHeaderParameters.forEach((param) => {\n const name = param.name;\n if (!addedHeaders.has(name)) {\n headers.push({\n name,\n value: `<${name.toLowerCase()}>`,\n });\n }\n });\n\n const securityOption = securityHeaderParameters[selectedSecurityOptionIndex];\n if (securityOption) {\n const { scheme, schema } = securityOption;\n const name = 'name' in scheme ? scheme.name : schema.title ?? 'Authorization';\n if (!addedHeaders.has(name)) {\n headers.push({ name, value: generateAuthPlaceholder(scheme) });\n }\n }\n\n if (selectedBodyContentType) {\n addContentTypeHeader(headers, selectedBodyContentType);\n }\n\n return headers;\n};\n\nconst generateAuthPlaceholder = (scheme: SecuritySchemeAndScope): string => {\n switch (scheme.type) {\n case 'http':\n return scheme.scheme === 'basic' ? 'Basic <encoded-value>' : 'Bearer <token>';\n case 'oauth2':\n return 'Bearer <token>';\n case 'apiKey':\n default:\n return '<api-key>';\n }\n};\n\nconst addContentTypeHeader = (headers: Header[], contentType: string) => {\n if (headers.some(({ name }) => name.toLowerCase() === 'content-type')) {\n return;\n }\n\n headers.push({\n name: 'Content-Type',\n value: contentType,\n });\n};\n"],"names":["createHeaders","apiReferenceData","headerInputs","selectedBodyContentType","selectedSecurityOptionIndex","_a","_b","_c","headers","addedHeaders","requiredHeaderParameters","param","securityHeaderParameters","scheme","entry","name","value","securityOption","schema","generateAuthPlaceholder","addContentTypeHeader","contentType"],"mappings":"AAIO,MAAMA,IAAgB,CAC3BC,GACAC,GACAC,GAEA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AA,EAEjE;AAEA,SAAIV,KACFiB,EAAqBZ,GAASL,CAAuB,GAGhDK;AACT,GAEMW,IAA0B,CAACN,MAA2C;AAC1E,UAAQA,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAOA,EAAO,WAAW,UAAU,0BAA0B;AAAA,IAC/D,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL;AACE,aAAO;AAAA,EAAA;AAEb,GAEMO,IAAuB,CAACZ,GAAmBa,MAAwB;AACvE,EAAIb,EAAQ,KAAK,CAAC,EAAE,MAAAO,EAAA,MAAWA,EAAK,kBAAkB,cAAc,KAIpEP,EAAQ,KAAK;AAAA,IACX,MAAM;AAAA,IACN,OAAOa;AAAA,EAAA,CACR;AACH;"}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { getFirstExampleValue as
|
|
2
|
-
import { langToPresetMap as
|
|
3
|
-
import { generateRequest as
|
|
4
|
-
import { generateSnippet as
|
|
5
|
-
const
|
|
1
|
+
import { getFirstExampleValue as f } from "../schemaGraph/processExamples.js";
|
|
2
|
+
import { langToPresetMap as q } from "../../constants/snippetPresets.js";
|
|
3
|
+
import { generateRequest as x } from "./generateRequest.js";
|
|
4
|
+
import { generateSnippet as B } from "./generateSnippet.js";
|
|
5
|
+
const I = async ({
|
|
6
6
|
apiReferenceData: e,
|
|
7
7
|
baseUrl: n,
|
|
8
8
|
inputs: o,
|
|
9
9
|
apiPlaygroundMode: m,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
selectedSecurityOptionIndex: d,
|
|
11
|
+
lang: l,
|
|
12
|
+
requiredOnly: u
|
|
12
13
|
}) => {
|
|
13
14
|
var r, s, p, c;
|
|
14
15
|
if (n && m !== "none") {
|
|
15
|
-
const
|
|
16
|
+
const y = Object.keys(
|
|
16
17
|
((s = (r = e.dependencies) == null ? void 0 : r.requestBody) == null ? void 0 : s.content) ?? {}
|
|
17
|
-
)[0],
|
|
18
|
+
)[0], g = f(
|
|
18
19
|
((c = (p = e.dependencies) == null ? void 0 : p.requestBody) == null ? void 0 : c.content) ?? {}
|
|
19
20
|
);
|
|
20
21
|
try {
|
|
21
|
-
const a =
|
|
22
|
+
const a = x({
|
|
22
23
|
baseUrl: n,
|
|
23
24
|
apiReferenceData: e,
|
|
24
25
|
inputs: o,
|
|
25
|
-
exampleData:
|
|
26
|
-
selectedBodyContentType:
|
|
27
|
-
requiredOnly:
|
|
28
|
-
|
|
26
|
+
exampleData: g,
|
|
27
|
+
selectedBodyContentType: y,
|
|
28
|
+
requiredOnly: u,
|
|
29
|
+
selectedSecurityOptionIndex: d
|
|
30
|
+
}), i = q[l];
|
|
29
31
|
if (i == null)
|
|
30
32
|
return;
|
|
31
|
-
const [t] = await
|
|
33
|
+
const [t] = await B({
|
|
32
34
|
request: a,
|
|
33
35
|
pathInputs: o.path,
|
|
34
36
|
snippetPresets: [i],
|
|
@@ -45,6 +47,6 @@ const E = async ({
|
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
49
|
export {
|
|
48
|
-
|
|
50
|
+
I as generateInteractiveCodeSample
|
|
49
51
|
};
|
|
50
52
|
//# sourceMappingURL=generateInteractiveCodeSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateInteractiveCodeSample.js","sources":["../../../src/api-playground-2/generators/generateInteractiveCodeSample.ts"],"sourcesContent":["import { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { ApiPlaygroundInputs, CodeSample } from '@mintlify/validation';\n\nimport { getFirstExampleValue } from '@/api-playground-2/schemaGraph/processExamples';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { langToPresetMap } from '@/constants/snippetPresets';\n\nimport { generateRequest } from './generateRequest';\nimport { generateSnippet } from './generateSnippet';\n\nexport const generateInteractiveCodeSample = async ({\n apiReferenceData,\n baseUrl,\n inputs,\n apiPlaygroundMode,\n lang,\n requiredOnly,\n}: {\n lang: string;\n baseUrl?: string;\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundMode: ApiPlaygroundDisplayType;\n requiredOnly?: boolean;\n}): Promise<CodeSample | undefined> => {\n if (baseUrl && apiPlaygroundMode !== 'none') {\n const firstRequestBodyContentType = Object.keys(\n apiReferenceData.dependencies?.requestBody?.content ?? {}\n )[0];\n const firstExample = getFirstExampleValue(\n apiReferenceData.dependencies?.requestBody?.content ?? {}\n );\n try {\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs,\n exampleData: firstExample,\n selectedBodyContentType: firstRequestBodyContentType,\n requiredOnly,\n });\n const preset = langToPresetMap[lang];\n if (preset == undefined) {\n return;\n }\n const [snippet] = await generateSnippet({\n request,\n pathInputs: inputs.path,\n snippetPresets: [preset],\n apiReferenceData,\n });\n if (snippet)\n return {\n label: 'Interactive Example',\n lang: snippet.language,\n source: snippet.code,\n };\n } catch (err) {}\n }\n};\n"],"names":["generateInteractiveCodeSample","apiReferenceData","baseUrl","inputs","apiPlaygroundMode","lang","requiredOnly","firstRequestBodyContentType","_b","_a","firstExample","getFirstExampleValue","_d","_c","request","generateRequest","preset","langToPresetMap","snippet","generateSnippet"],"mappings":";;;;AAUO,MAAMA,IAAgC,OAAO;AAAA,EAClD,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AACF,
|
|
1
|
+
{"version":3,"file":"generateInteractiveCodeSample.js","sources":["../../../src/api-playground-2/generators/generateInteractiveCodeSample.ts"],"sourcesContent":["import { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { ApiPlaygroundInputs, CodeSample } from '@mintlify/validation';\n\nimport { getFirstExampleValue } from '@/api-playground-2/schemaGraph/processExamples';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { langToPresetMap } from '@/constants/snippetPresets';\n\nimport { generateRequest } from './generateRequest';\nimport { generateSnippet } from './generateSnippet';\n\nexport const generateInteractiveCodeSample = async ({\n apiReferenceData,\n baseUrl,\n inputs,\n apiPlaygroundMode,\n selectedSecurityOptionIndex,\n lang,\n requiredOnly,\n}: {\n lang: string;\n baseUrl?: string;\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundMode: ApiPlaygroundDisplayType;\n selectedSecurityOptionIndex: number;\n requiredOnly?: boolean;\n}): Promise<CodeSample | undefined> => {\n if (baseUrl && apiPlaygroundMode !== 'none') {\n const firstRequestBodyContentType = Object.keys(\n apiReferenceData.dependencies?.requestBody?.content ?? {}\n )[0];\n const firstExample = getFirstExampleValue(\n apiReferenceData.dependencies?.requestBody?.content ?? {}\n );\n try {\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs,\n exampleData: firstExample,\n selectedBodyContentType: firstRequestBodyContentType,\n requiredOnly,\n selectedSecurityOptionIndex,\n });\n const preset = langToPresetMap[lang];\n if (preset == undefined) {\n return;\n }\n const [snippet] = await generateSnippet({\n request,\n pathInputs: inputs.path,\n snippetPresets: [preset],\n apiReferenceData,\n });\n if (snippet)\n return {\n label: 'Interactive Example',\n lang: snippet.language,\n source: snippet.code,\n };\n } catch (err) {}\n }\n};\n"],"names":["generateInteractiveCodeSample","apiReferenceData","baseUrl","inputs","apiPlaygroundMode","selectedSecurityOptionIndex","lang","requiredOnly","firstRequestBodyContentType","_b","_a","firstExample","getFirstExampleValue","_d","_c","request","generateRequest","preset","langToPresetMap","snippet","generateSnippet"],"mappings":";;;;AAUO,MAAMA,IAAgC,OAAO;AAAA,EAClD,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AACF,MAQuC;;AACrC,MAAIL,KAAWE,MAAsB,QAAQ;AAC3C,UAAMI,IAA8B,OAAO;AAAA,QACzCC,KAAAC,IAAAT,EAAiB,iBAAjB,gBAAAS,EAA+B,gBAA/B,gBAAAD,EAA4C,YAAW,CAAA;AAAA,IAAC,EACxD,CAAC,GACGE,IAAeC;AAAA,QACnBC,KAAAC,IAAAb,EAAiB,iBAAjB,gBAAAa,EAA+B,gBAA/B,gBAAAD,EAA4C,YAAW,CAAA;AAAA,IAAC;AAE1D,QAAI;AACF,YAAME,IAAUC,EAAgB;AAAA,QAC9B,SAAAd;AAAA,QACA,kBAAAD;AAAA,QACA,QAAAE;AAAA,QACA,aAAaQ;AAAA,QACb,yBAAyBH;AAAA,QACzB,cAAAD;AAAA,QACA,6BAAAF;AAAA,MAAA,CACD,GACKY,IAASC,EAAgBZ,CAAI;AACnC,UAAIW,KAAU;AACZ;AAEF,YAAM,CAACE,CAAO,IAAI,MAAMC,EAAgB;AAAA,QACtC,SAAAL;AAAA,QACA,YAAYZ,EAAO;AAAA,QACnB,gBAAgB,CAACc,CAAM;AAAA,QACvB,kBAAAhB;AAAA,MAAA,CACD;AACD,UAAIkB;AACF,eAAO;AAAA,UACL,OAAO;AAAA,UACP,MAAMA,EAAQ;AAAA,UACd,QAAQA,EAAQ;AAAA,QAAA;AAAA,IAEtB,QAAc;AAAA,IAAC;AAAA,EACjB;AACF;"}
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { isObject as c } from "
|
|
1
|
+
import { isObject as c } from "../../common/guards.js";
|
|
2
2
|
import y from "lodash/cloneDeep";
|
|
3
|
-
import
|
|
4
|
-
import { getAllRequiredProperties as
|
|
5
|
-
import { isSchemaObject as
|
|
6
|
-
import { initialRequest as
|
|
7
|
-
import { addPathParams as
|
|
8
|
-
import { getPostData as
|
|
9
|
-
import { createHeaders as
|
|
10
|
-
import { getFileProperties as
|
|
11
|
-
const
|
|
3
|
+
import $ from "lodash/merge";
|
|
4
|
+
import { getAllRequiredProperties as k } from "../schemaGraph/getAllRequiredProperties.js";
|
|
5
|
+
import { isSchemaObject as F } from "../schemaGraph/utils.js";
|
|
6
|
+
import { initialRequest as H } from "../../constants/initialRequest.js";
|
|
7
|
+
import { addPathParams as J, joinWithSingleSlash as K, addServerVariables as M } from "../../hooks/useSendPlaygroundRequest.js";
|
|
8
|
+
import { getPostData as N } from "./createBodyData.js";
|
|
9
|
+
import { createHeaders as Q } from "./createHeaders.js";
|
|
10
|
+
import { getFileProperties as V } from "./getFileProperties.js";
|
|
11
|
+
const T = ({
|
|
12
12
|
exampleData: o,
|
|
13
13
|
apiReferenceData: r,
|
|
14
14
|
baseUrl: t,
|
|
15
15
|
inputs: e,
|
|
16
16
|
selectedBodyContentType: i,
|
|
17
|
-
requiredOnly: n
|
|
17
|
+
requiredOnly: n,
|
|
18
|
+
selectedSecurityOptionIndex: S
|
|
18
19
|
}) => {
|
|
19
20
|
var f, l, p, u, b, g;
|
|
20
|
-
const
|
|
21
|
+
const j = Object.values(((f = r.dependencies) == null ? void 0 : f.parameters) ?? {}).filter((d) => d.style === "deepObject").map((d) => d.name), v = _(e, j), a = J(((l = r.operation) == null ? void 0 : l.path) ?? "", e.path), q = Q(r, e.header, i, S), m = w(e.body), O = c(o), A = c(e.body) ? h(e.body) : {}, P = !m && O ? $(y(o), A) : null, E = m ? o : P;
|
|
21
22
|
let s;
|
|
22
|
-
i &&
|
|
23
|
+
i && F(
|
|
23
24
|
(b = (u = (p = r.dependencies) == null ? void 0 : p.requestBody) == null ? void 0 : u.content[i]) == null ? void 0 : b.schema
|
|
24
25
|
) && (s = r.dependencies.requestBody.content[i].schema);
|
|
25
|
-
const
|
|
26
|
-
P,
|
|
27
|
-
i,
|
|
26
|
+
const B = n && !e.body && s ? k(s) : void 0, I = s ? V(s) : void 0, U = N(
|
|
28
27
|
E,
|
|
29
|
-
|
|
28
|
+
i,
|
|
29
|
+
B,
|
|
30
|
+
I
|
|
30
31
|
);
|
|
31
32
|
return {
|
|
32
|
-
...
|
|
33
|
+
...H,
|
|
33
34
|
method: (((g = r.operation) == null ? void 0 : g.method) ?? "").toUpperCase(),
|
|
34
|
-
url:
|
|
35
|
-
queryString:
|
|
36
|
-
headers:
|
|
37
|
-
postData:
|
|
35
|
+
url: K(M(t, e.server), a),
|
|
36
|
+
queryString: v,
|
|
37
|
+
headers: q,
|
|
38
|
+
postData: U
|
|
38
39
|
};
|
|
39
|
-
},
|
|
40
|
+
}, _ = (o, r) => Object.entries(o.query).flatMap(([t, e]) => e ? Array.isArray(e) ? e.filter(Boolean).map((i) => ({
|
|
40
41
|
name: t,
|
|
41
42
|
value: i.toString()
|
|
42
43
|
})) : typeof e == "object" ? r != null && r.includes(t) ? Object.entries(e).filter(([i, n]) => n).map(([i, n]) => ({
|
|
@@ -47,7 +48,7 @@ const W = ({
|
|
|
47
48
|
name: t,
|
|
48
49
|
value: e.toString()
|
|
49
50
|
}
|
|
50
|
-
] : []),
|
|
51
|
+
] : []), w = (o) => {
|
|
51
52
|
if (o == null)
|
|
52
53
|
return !0;
|
|
53
54
|
if (typeof o == "object")
|
|
@@ -60,6 +61,6 @@ function h(o) {
|
|
|
60
61
|
return r;
|
|
61
62
|
}
|
|
62
63
|
export {
|
|
63
|
-
|
|
64
|
+
T as generateRequest
|
|
64
65
|
};
|
|
65
66
|
//# sourceMappingURL=generateRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRequest.js","sources":["../../../src/api-playground-2/generators/generateRequest.ts"],"sourcesContent":["import { isObject } from '
|
|
1
|
+
{"version":3,"file":"generateRequest.js","sources":["../../../src/api-playground-2/generators/generateRequest.ts"],"sourcesContent":["import { isObject } from '../../common/guards';\nimport { ApiPlaygroundInputs, SchemaObject } from '@mintlify/validation';\nimport type { Request } from 'har-format';\nimport cloneDeep from 'lodash/cloneDeep';\nimport merge from 'lodash/merge';\n\nimport { getAllRequiredProperties } from '@/api-playground-2/schemaGraph/getAllRequiredProperties';\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { initialRequest } from '@/constants/initialRequest';\nimport {\n addPathParams,\n addServerVariables,\n joinWithSingleSlash,\n} from '@/hooks/useSendPlaygroundRequest';\n\nimport { getPostData } from './createBodyData';\nimport { createHeaders } from './createHeaders';\nimport { getFileProperties } from './getFileProperties';\n\ntype QueryParam = { name: string; value: string };\n\n/**\n * Constructs the request from the URL, schema, and inputs\n */\nexport const generateRequest = ({\n exampleData,\n apiReferenceData,\n baseUrl,\n inputs,\n selectedBodyContentType,\n requiredOnly,\n selectedSecurityOptionIndex,\n}: {\n exampleData?: unknown;\n apiReferenceData: ApiReferenceDataV2;\n baseUrl: string;\n inputs: ApiPlaygroundInputs;\n selectedBodyContentType?: string;\n requiredOnly?: boolean;\n selectedSecurityOptionIndex: number;\n}): Request => {\n const queryParamsWithDeepObjects = Object.values(apiReferenceData.dependencies?.parameters ?? {})\n .filter((param) => param.style === 'deepObject')\n .map((param) => param.name);\n\n const queryString = createQueryString(inputs, queryParamsWithDeepObjects);\n const path = addPathParams(apiReferenceData.operation?.path ?? '', inputs.path);\n const headers = createHeaders(apiReferenceData, inputs.header, selectedBodyContentType, selectedSecurityOptionIndex);\n\n const bodyIsEmpty = isBodyEmpty(inputs.body);\n const bodyIsObject = isObject(exampleData);\n const input = isObject(inputs.body) ? deleteUndefinedKeys(inputs.body) : {};\n\n const mergedExampleAndBody =\n !bodyIsEmpty && bodyIsObject ? merge(cloneDeep(exampleData), input) : null;\n\n const bodyData = bodyIsEmpty ? exampleData : mergedExampleAndBody;\n let requestBodySchema: SchemaObject | undefined = undefined;\n\n if (selectedBodyContentType) {\n if (\n isSchemaObject(\n apiReferenceData.dependencies?.requestBody?.content[selectedBodyContentType]?.schema\n )\n ) {\n requestBodySchema =\n apiReferenceData.dependencies.requestBody.content[selectedBodyContentType].schema;\n }\n }\n\n const requiredProperties =\n requiredOnly && !inputs.body && requestBodySchema\n ? \n getAllRequiredProperties(requestBodySchema as SchemaObject)\n : undefined;\n\n const fileProperties = requestBodySchema ? getFileProperties(requestBodySchema) : undefined;\n\n const postData = getPostData(\n bodyData,\n selectedBodyContentType,\n requiredProperties,\n fileProperties\n );\n\n return {\n ...initialRequest,\n method: (apiReferenceData.operation?.method ?? '').toUpperCase(),\n url: joinWithSingleSlash(addServerVariables(baseUrl, inputs.server), path),\n queryString,\n headers,\n postData,\n };\n};\n\nconst createQueryString = (\n inputs: ApiPlaygroundInputs,\n queryParamsWithDeepObjects?: string[]\n): QueryParam[] => {\n return Object.entries(inputs.query).flatMap(([name, value]) => {\n if (!value) return [];\n\n if (Array.isArray(value)) {\n return value.filter(Boolean).map((element) => ({\n name,\n value: element.toString(),\n }));\n }\n\n if (typeof value === 'object') {\n if (queryParamsWithDeepObjects?.includes(name)) {\n return Object.entries(value)\n .filter(([_, value]) => value)\n .map(([key, value]) => ({\n name: `${name}[${key}]`,\n value: value.toString(),\n }));\n }\n\n return [{ name, value: JSON.stringify(value) }];\n }\n\n return [\n {\n name,\n value: value.toString(),\n },\n ];\n });\n};\n\nconst isBodyEmpty = (bodyData: unknown) => {\n if (bodyData === null || bodyData === undefined) {\n return true;\n }\n\n if (typeof bodyData === 'object') {\n return Object.values(bodyData).every((value) => value === undefined);\n }\n};\n\nfunction deleteUndefinedKeys(obj: Record<string, unknown>): Record<string, unknown> {\n const objClone = cloneDeep(obj);\n for (const key in objClone) {\n if (objClone[key] === undefined) delete objClone[key];\n else if (isObject(objClone[key])) deleteUndefinedKeys(objClone[key]);\n }\n return objClone;\n}\n"],"names":["generateRequest","exampleData","apiReferenceData","baseUrl","inputs","selectedBodyContentType","requiredOnly","selectedSecurityOptionIndex","queryParamsWithDeepObjects","_a","param","queryString","createQueryString","path","addPathParams","_b","headers","createHeaders","bodyIsEmpty","isBodyEmpty","bodyIsObject","isObject","input","deleteUndefinedKeys","mergedExampleAndBody","merge","cloneDeep","bodyData","requestBodySchema","isSchemaObject","_e","_d","_c","requiredProperties","getAllRequiredProperties","fileProperties","getFileProperties","postData","getPostData","initialRequest","_f","joinWithSingleSlash","addServerVariables","name","value","element","_","key","obj","objClone"],"mappings":";;;;;;;;;;AAyBO,MAAMA,IAAkB,CAAC;AAAA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EAASF,CAAG,CAAC;AAErE,SAAOE;AACT;"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { requestExampleLanguages as
|
|
2
|
-
import { toShikiLang as
|
|
3
|
-
import { generateInteractiveCodeSample as
|
|
4
|
-
const
|
|
1
|
+
import { requestExampleLanguages as k } from "@mintlify/models";
|
|
2
|
+
import { toShikiLang as x, shikiLangToDisplayLang as m } from "../../constants/snippetPresets.js";
|
|
3
|
+
import { generateInteractiveCodeSample as v } from "./generateInteractiveCodeSample.js";
|
|
4
|
+
const j = async ({
|
|
5
5
|
codeSamples: t,
|
|
6
6
|
apiReferenceData: c,
|
|
7
7
|
baseUrl: i,
|
|
8
8
|
inputs: e,
|
|
9
9
|
apiPlaygroundMode: f,
|
|
10
10
|
requestExampleLanguages: r,
|
|
11
|
-
requiredOnly: g
|
|
11
|
+
requiredOnly: g,
|
|
12
|
+
selectedSecurityOptionIndex: L
|
|
12
13
|
}) => {
|
|
13
|
-
const
|
|
14
|
+
const d = i && f !== "none" || i && r, s = r ?? [];
|
|
14
15
|
t = t.map((n) => ({
|
|
15
16
|
...n,
|
|
16
|
-
lang:
|
|
17
|
+
lang: x(n.lang)
|
|
17
18
|
})), r === void 0 && (t.forEach((n) => {
|
|
18
19
|
s.includes(n.lang) || s.push(n.lang);
|
|
19
|
-
}),
|
|
20
|
+
}), d && k.forEach((n) => {
|
|
20
21
|
s.includes(n) || s.push(n);
|
|
21
22
|
}));
|
|
22
23
|
const h = {};
|
|
@@ -24,13 +25,14 @@ const O = async ({
|
|
|
24
25
|
let o = m[n] ?? n;
|
|
25
26
|
const u = t.filter((a) => a.lang === n), l = h[o] ?? {};
|
|
26
27
|
if (u.length === 0) {
|
|
27
|
-
const a = await
|
|
28
|
+
const a = await v({
|
|
28
29
|
baseUrl: i,
|
|
29
30
|
apiReferenceData: c,
|
|
30
31
|
inputs: e,
|
|
31
32
|
apiPlaygroundMode: f,
|
|
32
33
|
lang: n,
|
|
33
|
-
requiredOnly: g
|
|
34
|
+
requiredOnly: g,
|
|
35
|
+
selectedSecurityOptionIndex: L
|
|
34
36
|
});
|
|
35
37
|
a && E(
|
|
36
38
|
a,
|
|
@@ -63,6 +65,6 @@ const O = async ({
|
|
|
63
65
|
};
|
|
64
66
|
};
|
|
65
67
|
export {
|
|
66
|
-
|
|
68
|
+
j as generateSnippetMap
|
|
67
69
|
};
|
|
68
70
|
//# sourceMappingURL=generateSnippetMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSnippetMap.js","sources":["../../../src/api-playground-2/generators/generateSnippetMap.ts"],"sourcesContent":["import {\n ApiPlaygroundDisplayType,\n requestExampleLanguages as defaultRequestExampleLanguages,\n} from '@mintlify/models';\nimport { ApiPlaygroundInputs, CodeSample } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { shikiLangToDisplayLang, toShikiLang } from '@/constants/snippetPresets';\nimport { ExampleCodeSnippet } from '@/types/exampleCodeSnippet';\n\nimport { generateInteractiveCodeSample } from './generateInteractiveCodeSample';\n\n// more or less identical but in all places where we use Endpoint, we use ApiReferenceDataV2 instead\nexport const generateSnippetMap = async ({\n codeSamples,\n apiReferenceData,\n baseUrl,\n inputs,\n apiPlaygroundMode,\n requestExampleLanguages,\n requiredOnly,\n}: {\n codeSamples: CodeSample[];\n apiReferenceData: ApiReferenceDataV2;\n baseUrl?: string;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundMode: ApiPlaygroundDisplayType;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n}): Promise<Record<string, Record<string, ExampleCodeSnippet>>> => {\n const shouldHaveGeneratedExamples =\n (baseUrl && apiPlaygroundMode !== 'none') || (baseUrl && requestExampleLanguages);\n const langOrder = requestExampleLanguages ?? [];\n codeSamples = codeSamples.map((codeSample) => ({\n ...codeSample,\n lang: toShikiLang(codeSample.lang),\n }));\n if (requestExampleLanguages === undefined) {\n codeSamples.forEach((codeSample) => {\n if (langOrder.includes(codeSample.lang)) return;\n langOrder.push(codeSample.lang);\n });\n if (shouldHaveGeneratedExamples) {\n defaultRequestExampleLanguages.forEach((lang) => {\n if (langOrder.includes(lang)) return;\n langOrder.push(lang);\n });\n }\n }\n\n const map: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n for (const shikiLang of langOrder) {\n let displayLang = shikiLangToDisplayLang[shikiLang] ?? shikiLang;\n\n const codeSamplesInLang = codeSamples.filter((codeSample) => codeSample.lang === shikiLang);\n\n const labelToSnippetMap = map[displayLang] ?? {};\n if (codeSamplesInLang.length === 0) {\n const generatedCodeSample = await generateInteractiveCodeSample({\n baseUrl,\n apiReferenceData,\n inputs,\n apiPlaygroundMode,\n lang: shikiLang,\n requiredOnly,\n });\n if (generatedCodeSample) {\n addCodeSampleToLabelToSnippetMap(\n generatedCodeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n true\n );\n }\n } else {\n codeSamplesInLang.forEach((codeSample) => {\n displayLang = shikiLangToDisplayLang[shikiLang] ?? codeSample.label ?? shikiLang;\n addCodeSampleToLabelToSnippetMap(\n codeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n false\n );\n });\n }\n if (Object.keys(labelToSnippetMap).length > 0) {\n map[displayLang] = labelToSnippetMap;\n }\n }\n\n return map;\n};\n\nconst addCodeSampleToLabelToSnippetMap = (\n codeSample: CodeSample,\n shikiLang: string,\n displayLang: string,\n labelToSnippetMap: Record<string, ExampleCodeSnippet>,\n isGenerated: boolean\n) => {\n // if we have entered an empty label, retroactively update it to 'Example 1'\n if ('' in labelToSnippetMap) {\n labelToSnippetMap['Example 1'] = labelToSnippetMap[''];\n delete labelToSnippetMap[''];\n }\n\n const numExistingLabels = Object.keys(labelToSnippetMap).length;\n const label =\n codeSample.label ?? (numExistingLabels > 0 ? `Example ${numExistingLabels + 1}` : '');\n\n labelToSnippetMap[label] = {\n filename: isGenerated ? displayLang : label || displayLang, // (used in CodeSnippets)\n language: shikiLang,\n code: codeSample.source,\n };\n};\n"],"names":["generateSnippetMap","codeSamples","apiReferenceData","baseUrl","inputs","apiPlaygroundMode","requestExampleLanguages","requiredOnly","shouldHaveGeneratedExamples","langOrder","codeSample","toShikiLang","defaultRequestExampleLanguages","lang","map","shikiLang","displayLang","shikiLangToDisplayLang","codeSamplesInLang","labelToSnippetMap","generatedCodeSample","generateInteractiveCodeSample","addCodeSampleToLabelToSnippetMap","isGenerated","numExistingLabels","label"],"mappings":";;;AAaO,MAAMA,IAAqB,OAAO;AAAA,EACvC,aAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EAAA,yBACAC;AAAAA,EACA,cAAAC;AACF,
|
|
1
|
+
{"version":3,"file":"generateSnippetMap.js","sources":["../../../src/api-playground-2/generators/generateSnippetMap.ts"],"sourcesContent":["import {\n ApiPlaygroundDisplayType,\n requestExampleLanguages as defaultRequestExampleLanguages,\n} from '@mintlify/models';\nimport { ApiPlaygroundInputs, CodeSample } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { shikiLangToDisplayLang, toShikiLang } from '@/constants/snippetPresets';\nimport { ExampleCodeSnippet } from '@/types/exampleCodeSnippet';\n\nimport { generateInteractiveCodeSample } from './generateInteractiveCodeSample';\n\n// more or less identical but in all places where we use Endpoint, we use ApiReferenceDataV2 instead\nexport const generateSnippetMap = async ({\n codeSamples,\n apiReferenceData,\n baseUrl,\n inputs,\n apiPlaygroundMode,\n requestExampleLanguages,\n requiredOnly,\n selectedSecurityOptionIndex,\n}: {\n codeSamples: CodeSample[];\n apiReferenceData: ApiReferenceDataV2;\n baseUrl?: string;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundMode: ApiPlaygroundDisplayType;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n selectedSecurityOptionIndex: number;\n}): Promise<Record<string, Record<string, ExampleCodeSnippet>>> => {\n const shouldHaveGeneratedExamples =\n (baseUrl && apiPlaygroundMode !== 'none') || (baseUrl && requestExampleLanguages);\n const langOrder = requestExampleLanguages ?? [];\n codeSamples = codeSamples.map((codeSample) => ({\n ...codeSample,\n lang: toShikiLang(codeSample.lang),\n }));\n if (requestExampleLanguages === undefined) {\n codeSamples.forEach((codeSample) => {\n if (langOrder.includes(codeSample.lang)) return;\n langOrder.push(codeSample.lang);\n });\n if (shouldHaveGeneratedExamples) {\n defaultRequestExampleLanguages.forEach((lang) => {\n if (langOrder.includes(lang)) return;\n langOrder.push(lang);\n });\n }\n }\n\n const map: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n for (const shikiLang of langOrder) {\n let displayLang = shikiLangToDisplayLang[shikiLang] ?? shikiLang;\n\n const codeSamplesInLang = codeSamples.filter((codeSample) => codeSample.lang === shikiLang);\n\n const labelToSnippetMap = map[displayLang] ?? {};\n if (codeSamplesInLang.length === 0) {\n const generatedCodeSample = await generateInteractiveCodeSample({\n baseUrl,\n apiReferenceData,\n inputs,\n apiPlaygroundMode,\n lang: shikiLang,\n requiredOnly,\n selectedSecurityOptionIndex,\n });\n if (generatedCodeSample) {\n addCodeSampleToLabelToSnippetMap(\n generatedCodeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n true\n );\n }\n } else {\n codeSamplesInLang.forEach((codeSample) => {\n displayLang = shikiLangToDisplayLang[shikiLang] ?? codeSample.label ?? shikiLang;\n addCodeSampleToLabelToSnippetMap(\n codeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n false\n );\n });\n }\n if (Object.keys(labelToSnippetMap).length > 0) {\n map[displayLang] = labelToSnippetMap;\n }\n }\n\n return map;\n};\n\nconst addCodeSampleToLabelToSnippetMap = (\n codeSample: CodeSample,\n shikiLang: string,\n displayLang: string,\n labelToSnippetMap: Record<string, ExampleCodeSnippet>,\n isGenerated: boolean\n) => {\n // if we have entered an empty label, retroactively update it to 'Example 1'\n if ('' in labelToSnippetMap) {\n labelToSnippetMap['Example 1'] = labelToSnippetMap[''];\n delete labelToSnippetMap[''];\n }\n\n const numExistingLabels = Object.keys(labelToSnippetMap).length;\n const label =\n codeSample.label ?? (numExistingLabels > 0 ? `Example ${numExistingLabels + 1}` : '');\n\n labelToSnippetMap[label] = {\n filename: isGenerated ? displayLang : label || displayLang, // (used in CodeSnippets)\n language: shikiLang,\n code: codeSample.source,\n };\n};\n"],"names":["generateSnippetMap","codeSamples","apiReferenceData","baseUrl","inputs","apiPlaygroundMode","requestExampleLanguages","requiredOnly","selectedSecurityOptionIndex","shouldHaveGeneratedExamples","langOrder","codeSample","toShikiLang","defaultRequestExampleLanguages","lang","map","shikiLang","displayLang","shikiLangToDisplayLang","codeSamplesInLang","labelToSnippetMap","generatedCodeSample","generateInteractiveCodeSample","addCodeSampleToLabelToSnippetMap","isGenerated","numExistingLabels","label"],"mappings":";;;AAaO,MAAMA,IAAqB,OAAO;AAAA,EACvC,aAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EAAA,yBACAC;AAAAA,EACA,cAAAC;AAAA,EACA,6BAAAC;AACF,MASmE;AACjE,QAAMC,IACHN,KAAWE,MAAsB,UAAYF,KAAWG,GACrDI,IAAYJ,KAA2B,CAAA;AAC7C,EAAAL,IAAcA,EAAY,IAAI,CAACU,OAAgB;AAAA,IAC7C,GAAGA;AAAA,IACH,MAAMC,EAAYD,EAAW,IAAI;AAAA,EAAA,EACjC,GACEL,MAA4B,WAC9BL,EAAY,QAAQ,CAACU,MAAe;AAClC,IAAID,EAAU,SAASC,EAAW,IAAI,KACtCD,EAAU,KAAKC,EAAW,IAAI;AAAA,EAChC,CAAC,GACGF,KACFI,EAA+B,QAAQ,CAACC,MAAS;AAC/C,IAAIJ,EAAU,SAASI,CAAI,KAC3BJ,EAAU,KAAKI,CAAI;AAAA,EACrB,CAAC;AAIL,QAAMC,IAA0D,CAAA;AAEhE,aAAWC,KAAaN,GAAW;AACjC,QAAIO,IAAcC,EAAu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const
|
|
2
|
+
import { unflattenInputs as c } from "../schemaGraph/utils.js";
|
|
3
|
+
const u = s((e, n) => ({
|
|
4
4
|
inputs: {},
|
|
5
|
-
initialize: (t) =>
|
|
5
|
+
initialize: (t) => e({
|
|
6
6
|
inputs: { ...t }
|
|
7
7
|
}),
|
|
8
|
-
setInput: (t,
|
|
9
|
-
inputs: { ...
|
|
8
|
+
setInput: (t, i) => e((p) => ({
|
|
9
|
+
inputs: { ...p.inputs, [t]: i }
|
|
10
10
|
})),
|
|
11
|
-
setInputs: (t) =>
|
|
12
|
-
inputs: { ...
|
|
11
|
+
setInputs: (t) => e((i) => ({
|
|
12
|
+
inputs: { ...i.inputs, ...t }
|
|
13
13
|
})),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
14
|
+
replaceInputs: (t) => e({ inputs: t }),
|
|
15
|
+
getInput: (t) => n().inputs[t],
|
|
16
|
+
getApiPlaygroundInputs: () => c(n().inputs),
|
|
17
|
+
clear: () => e({ inputs: {} }),
|
|
18
|
+
reset: () => e({ inputs: {} }),
|
|
19
|
+
selectedSecurityOptionIndex: 0,
|
|
20
|
+
setSelectedSecurityOptionIndex: (t) => e({ selectedSecurityOptionIndex: t })
|
|
21
|
+
})), d = () => {
|
|
22
|
+
const e = u(
|
|
23
|
+
(t) => t.selectedSecurityOptionIndex
|
|
24
|
+
), n = u(
|
|
25
|
+
(t) => t.setSelectedSecurityOptionIndex
|
|
26
|
+
);
|
|
27
|
+
return { selectedSecurityOptionIndex: e, setSelectedSecurityOptionIndex: n };
|
|
28
|
+
};
|
|
19
29
|
export {
|
|
20
|
-
|
|
30
|
+
u as usePlaygroundInputsStore,
|
|
31
|
+
d as useSelectedSecurityOption
|
|
21
32
|
};
|
|
22
33
|
//# sourceMappingURL=usePlaygroundInputsStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaygroundInputsStore.js","sources":["../../../src/api-playground-2/hooks/usePlaygroundInputsStore.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { create } from 'zustand';\n\nimport { unflattenInputs } from '../schemaGraph/utils';\n\nexport type PlaygroundInputValue = unknown;\n\ninterface PlaygroundInputsState {\n inputs: Record<string, PlaygroundInputValue>;\n initialize: (initialValues: Record<string, PlaygroundInputValue>) => void;\n setInput: (name: string, value: PlaygroundInputValue) => void;\n setInputs: (inputs: Record<string, PlaygroundInputValue>) => void;\n getInput: (name: string) => PlaygroundInputValue;\n getApiPlaygroundInputs: () => ApiPlaygroundInputs;\n clear: () => void;\n reset: () => void;\n}\n\nexport const usePlaygroundInputsStore = create<PlaygroundInputsState>((set, get) => ({\n inputs: {},\n initialize: (initialValues) =>\n set({\n inputs: { ...initialValues },\n }),\n setInput: (name, value) =>\n set((state) => ({\n inputs: { ...state.inputs, [name]: value },\n })),\n setInputs: (inputs) =>\n set((state) => ({\n inputs: { ...state.inputs, ...inputs },\n })),\n getInput: (name) => get().inputs[name],\n getApiPlaygroundInputs: () => unflattenInputs(get().inputs),\n clear: () => set({ inputs: {} }),\n reset: () => set({ inputs: {} }),\n}));\n"],"names":["usePlaygroundInputsStore","create","set","get","initialValues","name","value","state","inputs","unflattenInputs"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"usePlaygroundInputsStore.js","sources":["../../../src/api-playground-2/hooks/usePlaygroundInputsStore.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { create } from 'zustand';\n\nimport { unflattenInputs } from '../schemaGraph/utils';\n\nexport type PlaygroundInputValue = unknown;\n\ninterface PlaygroundInputsState {\n inputs: Record<string, PlaygroundInputValue>;\n initialize: (initialValues: Record<string, PlaygroundInputValue>) => void;\n setInput: (name: string, value: PlaygroundInputValue) => void;\n setInputs: (inputs: Record<string, PlaygroundInputValue>) => void;\n replaceInputs: (inputs: Record<string, PlaygroundInputValue>) => void;\n getInput: (name: string) => PlaygroundInputValue;\n getApiPlaygroundInputs: () => ApiPlaygroundInputs;\n clear: () => void;\n reset: () => void;\n selectedSecurityOptionIndex: number;\n setSelectedSecurityOptionIndex: (index: number) => void;\n}\n\nexport const usePlaygroundInputsStore = create<PlaygroundInputsState>((set, get) => ({\n inputs: {},\n initialize: (initialValues) =>\n set({\n inputs: { ...initialValues },\n }),\n setInput: (name, value) =>\n set((state) => ({\n inputs: { ...state.inputs, [name]: value },\n })),\n setInputs: (inputs) =>\n set((state) => ({\n inputs: { ...state.inputs, ...inputs },\n })),\n replaceInputs: (inputs) =>\n set({ inputs }),\n getInput: (name) => get().inputs[name],\n getApiPlaygroundInputs: () => unflattenInputs(get().inputs),\n clear: () => set({ inputs: {} }),\n reset: () => set({ inputs: {} }),\n selectedSecurityOptionIndex: 0,\n setSelectedSecurityOptionIndex: (index) => set({ selectedSecurityOptionIndex: index }),\n}));\n\nexport const useSelectedSecurityOption = () => {\n const selectedSecurityOptionIndex = usePlaygroundInputsStore(\n (state) => state.selectedSecurityOptionIndex\n );\n const setSelectedSecurityOptionIndex = usePlaygroundInputsStore(\n (state) => state.setSelectedSecurityOptionIndex\n );\n return { selectedSecurityOptionIndex, setSelectedSecurityOptionIndex };\n};\n"],"names":["usePlaygroundInputsStore","create","set","get","initialValues","name","value","state","inputs","unflattenInputs","index","useSelectedSecurityOption","selectedSecurityOptionIndex","setSelectedSecurityOptionIndex"],"mappings":";;AAqBO,MAAMA,IAA2BC,EAA8B,CAACC,GAAKC,OAAS;AAAA,EACnF,QAAQ,CAAA;AAAA,EACR,YAAY,CAACC,MACXF,EAAI;AAAA,IACF,QAAQ,EAAE,GAAGE,EAAA;AAAA,EAAc,CAC5B;AAAA,EACH,UAAU,CAACC,GAAMC,MACfJ,EAAI,CAACK,OAAW;AAAA,IACd,QAAQ,EAAE,GAAGA,EAAM,QAAQ,CAACF,CAAI,GAAGC,EAAA;AAAA,EAAM,EACzC;AAAA,EACJ,WAAW,CAACE,MACVN,EAAI,CAACK,OAAW;AAAA,IACd,QAAQ,EAAE,GAAGA,EAAM,QAAQ,GAAGC,EAAA;AAAA,EAAO,EACrC;AAAA,EACJ,eAAe,CAACA,MACdN,EAAI,EAAE,QAAAM,GAAQ;AAAA,EAChB,UAAU,CAACH,MAASF,EAAA,EAAM,OAAOE,CAAI;AAAA,EACrC,wBAAwB,MAAMI,EAAgBN,EAAA,EAAM,MAAM;AAAA,EAC1D,OAAO,MAAMD,EAAI,EAAE,QAAQ,CAAA,GAAI;AAAA,EAC/B,OAAO,MAAMA,EAAI,EAAE,QAAQ,CAAA,GAAI;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,gCAAgC,CAACQ,MAAUR,EAAI,EAAE,6BAA6BQ,GAAO;AACvF,EAAE,GAEWC,IAA4B,MAAM;AAC7C,QAAMC,IAA8BZ;AAAA,IAClC,CAACO,MAAUA,EAAM;AAAA,EAAA,GAEbM,IAAiCb;AAAA,IACrC,CAACO,MAAUA,EAAM;AAAA,EAAA;AAEnB,SAAO,EAAE,6BAAAK,GAA6B,gCAAAC,EAAA;AACxC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample"],"mappings":";AA4KO,MAAMA,IAAuB,CAClCC,MAC8B;AAC9B,QAAMC,IAAmB,OAAO,KAAKD,CAAO,EAAE,CAAC;AAC/C,MAAIC,GAAkB;AACpB,UAAMC,IAAoBF,EAAQC,CAAgB,GAE5CE,IADW,OAAO,QAAOD,KAAA,gBAAAA,EAAmB,aAAY,CAAA,CAAE,EAClC,CAAC;AAC/B,QAAIC,KAAgB,WAAWA;AAC7B,aAAOA,EAAa;AAAA,EAExB;AAEF;"}
|
|
1
|
+
{"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import type { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample"],"mappings":";AA4KO,MAAMA,IAAuB,CAClCC,MAC8B;AAC9B,QAAMC,IAAmB,OAAO,KAAKD,CAAO,EAAE,CAAC;AAC/C,MAAIC,GAAkB;AACpB,UAAMC,IAAoBF,EAAQC,CAAgB,GAE5CE,IADW,OAAO,QAAOD,KAAA,gBAAAA,EAAmB,aAAY,CAAA,CAAE,EAClC,CAAC;AAC/B,QAAIC,KAAgB,WAAWA;AAC7B,aAAOA,EAAa;AAAA,EAExB;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sources":["../../src/common/guards.ts"],"sourcesContent":["import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\n\nexport function isNumber(val: unknown): val is number {\n const num = Number(val);\n return typeof num === 'number' && !isNaN(num);\n}\n\nexport function isInteger(val: unknown): val is number {\n const num = Number(val);\n return typeof num === 'number' && !isNaN(num) && num % 1 === 0;\n}\n\nexport function isObject(val: unknown): val is Record<string, unknown> {\n return !!val && typeof val === 'object' && !Array.isArray(val);\n}\n\nexport function isArray(val: unknown): val is Array<unknown> {\n return !!val && typeof val === 'object' && Array.isArray(val);\n}\n\nexport function isBoolean(val: unknown): val is boolean {\n return typeof val === 'boolean';\n}\n\nexport function isNull(val: unknown): val is null {\n return val === null;\n}\n\n/** File is a web API - must do window check to avoid server-side error */\nexport function isFile(val: unknown): val is File {\n return typeof window !== 'undefined' && val instanceof File;\n}\n\nexport const CHILD_TAB_IDS_ATTRIBUTE = 'data-child-tab-ids';\nexport const CHILD_HEADING_IDS_ATTRIBUTE = 'data-child-heading-ids';\n\nexport type DocumentV3 = OpenAPIV3.Document | OpenAPIV3_1.Document;\n"],"names":["isObject","val","isFile"],"mappings":"AAgBO,SAASA,EAASC,GAA8C;AACrE,SAAO,CAAC,CAACA,KAAO,OAAOA,KAAQ,YAAY,CAAC,MAAM,QAAQA,CAAG;AAC/D;AAeO,SAASC,EAAOD,GAA2B;AAChD,SAAO,OAAO,SAAW,OAAeA,aAAe;AACzD;"}
|
|
@@ -21,7 +21,7 @@ function j({ toc: i }) {
|
|
|
21
21
|
if (!e) return (p = i[0]) == null ? void 0 : p.slug;
|
|
22
22
|
const r = window.getComputedStyle(document.documentElement), E = parseFloat(
|
|
23
23
|
r.getPropertyValue("--scroll-mt") || "0"
|
|
24
|
-
),
|
|
24
|
+
), k = parseFloat(r.fontSize), R = E * k + 100, h = e.scrollTop, f = i.map((s) => {
|
|
25
25
|
const v = document.getElementById(s.slug);
|
|
26
26
|
if (!v) return null;
|
|
27
27
|
const C = v.getBoundingClientRect(), I = e.getBoundingClientRect(), L = C.top - I.top + h;
|
|
@@ -30,7 +30,7 @@ function j({ toc: i }) {
|
|
|
30
30
|
if (f.length === 0) return (b = i[0]) == null ? void 0 : b.slug;
|
|
31
31
|
let a = f[0];
|
|
32
32
|
for (const s of f)
|
|
33
|
-
h +
|
|
33
|
+
h + R >= s.top && (a = s);
|
|
34
34
|
return a == null ? void 0 : a.id;
|
|
35
35
|
}, l = () => {
|
|
36
36
|
if (o.current) return;
|
|
@@ -44,7 +44,7 @@ function j({ toc: i }) {
|
|
|
44
44
|
return n || (u = setTimeout(l, 100)), () => {
|
|
45
45
|
u && clearTimeout(u), t.current && clearTimeout(t.current), window.removeEventListener("hashchange", m), e ? e.removeEventListener("scroll", l) : window.removeEventListener("scroll", l);
|
|
46
46
|
};
|
|
47
|
-
}, [i]), /* @__PURE__ */ d("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-
|
|
47
|
+
}, [i]), /* @__PURE__ */ d("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-2 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#9ca3af] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full", children: i.map((n, m) => {
|
|
48
48
|
const e = x === n.slug;
|
|
49
49
|
return /* @__PURE__ */ S("li", { className: "mint:relative", children: [
|
|
50
50
|
e && /* @__PURE__ */ d("div", { className: "mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-1" }),
|
|
@@ -54,7 +54,7 @@ function j({ toc: i }) {
|
|
|
54
54
|
href: `#${n.slug}`,
|
|
55
55
|
className: A(
|
|
56
56
|
"mint:block mint:pl-6 mint:leading-relaxed mint:no-underline",
|
|
57
|
-
e ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold" : "mint:text-[#424242] mint:
|
|
57
|
+
e ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold" : "mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]"
|
|
58
58
|
),
|
|
59
59
|
children: n.title
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { TocItem } from \"../../types\";\nimport { cn } from \"../../utils/cn\";\n\ninterface TableOfContentsProps {\n toc: TocItem[];\n}\n\nexport function TableOfContents({ toc }: TableOfContentsProps) {\n const [activeId, setActiveId] = useState(\"\");\n const ignoreScrollRef = useRef(false);\n const ignoreTimeoutRef = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (toc.length === 0) return;\n\n ignoreScrollRef.current = false;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n } else {\n setActiveId(toc[0]?.slug || \"\");\n }\n\n const handleHashChange = () => {\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n }\n };\n\n const scrollContainer = document.getElementById(\"main-content\");\n\n const getActiveHeading = () => {\n if (!scrollContainer) return toc[0]?.slug;\n\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(\n style.getPropertyValue(\"--scroll-mt\") || \"0\"\n );\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize + 100;\n\n const scrollY = scrollContainer.scrollTop;\n\n const headingPositions = toc\n .map((item) => {\n const element = document.getElementById(item.slug);\n if (!element) return null;\n\n const rect = element.getBoundingClientRect();\n const containerRect = scrollContainer.getBoundingClientRect();\n const relativeTop = rect.top - containerRect.top + scrollY;\n\n return { id: item.slug, top: relativeTop };\n })\n .filter(Boolean) as Array<{ id: string; top: number }>;\n\n if (headingPositions.length === 0) return toc[0]?.slug;\n\n let currentHeading = headingPositions[0];\n for (const heading of headingPositions) {\n if (scrollY + scrollOffset >= heading.top) {\n currentHeading = heading;\n }\n }\n\n return currentHeading?.id;\n };\n\n const handleScroll = () => {\n if (ignoreScrollRef.current) return;\n\n const newActiveId = getActiveHeading();\n if (newActiveId) {\n setActiveId(newActiveId);\n }\n };\n\n window.addEventListener(\"hashchange\", handleHashChange);\n\n if (scrollContainer) {\n scrollContainer.addEventListener(\"scroll\", handleScroll, {\n passive: true,\n });\n } else {\n window.addEventListener(\"scroll\", handleScroll, { passive: true });\n }\n\n let timeoutId: NodeJS.Timeout | undefined;\n if (!hash) {\n timeoutId = setTimeout(handleScroll, 100);\n }\n\n return () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (ignoreTimeoutRef.current) clearTimeout(ignoreTimeoutRef.current);\n window.removeEventListener(\"hashchange\", handleHashChange);\n if (scrollContainer) {\n scrollContainer.removeEventListener(\"scroll\", handleScroll);\n } else {\n window.removeEventListener(\"scroll\", handleScroll);\n }\n };\n }, [toc]);\n\n return (\n <ul className=\"mint:list-none mint:flex mint:flex-col mint:gap-
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { TocItem } from \"../../types\";\nimport { cn } from \"../../utils/cn\";\n\ninterface TableOfContentsProps {\n toc: TocItem[];\n}\n\nexport function TableOfContents({ toc }: TableOfContentsProps) {\n const [activeId, setActiveId] = useState(\"\");\n const ignoreScrollRef = useRef(false);\n const ignoreTimeoutRef = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (toc.length === 0) return;\n\n ignoreScrollRef.current = false;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n } else {\n setActiveId(toc[0]?.slug || \"\");\n }\n\n const handleHashChange = () => {\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n }\n };\n\n const scrollContainer = document.getElementById(\"main-content\");\n\n const getActiveHeading = () => {\n if (!scrollContainer) return toc[0]?.slug;\n\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(\n style.getPropertyValue(\"--scroll-mt\") || \"0\"\n );\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize + 100;\n\n const scrollY = scrollContainer.scrollTop;\n\n const headingPositions = toc\n .map((item) => {\n const element = document.getElementById(item.slug);\n if (!element) return null;\n\n const rect = element.getBoundingClientRect();\n const containerRect = scrollContainer.getBoundingClientRect();\n const relativeTop = rect.top - containerRect.top + scrollY;\n\n return { id: item.slug, top: relativeTop };\n })\n .filter(Boolean) as Array<{ id: string; top: number }>;\n\n if (headingPositions.length === 0) return toc[0]?.slug;\n\n let currentHeading = headingPositions[0];\n for (const heading of headingPositions) {\n if (scrollY + scrollOffset >= heading.top) {\n currentHeading = heading;\n }\n }\n\n return currentHeading?.id;\n };\n\n const handleScroll = () => {\n if (ignoreScrollRef.current) return;\n\n const newActiveId = getActiveHeading();\n if (newActiveId) {\n setActiveId(newActiveId);\n }\n };\n\n window.addEventListener(\"hashchange\", handleHashChange);\n\n if (scrollContainer) {\n scrollContainer.addEventListener(\"scroll\", handleScroll, {\n passive: true,\n });\n } else {\n window.addEventListener(\"scroll\", handleScroll, { passive: true });\n }\n\n let timeoutId: NodeJS.Timeout | undefined;\n if (!hash) {\n timeoutId = setTimeout(handleScroll, 100);\n }\n\n return () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (ignoreTimeoutRef.current) clearTimeout(ignoreTimeoutRef.current);\n window.removeEventListener(\"hashchange\", handleHashChange);\n if (scrollContainer) {\n scrollContainer.removeEventListener(\"scroll\", handleScroll);\n } else {\n window.removeEventListener(\"scroll\", handleScroll);\n }\n };\n }, [toc]);\n\n return (\n <ul className=\"mint:list-none mint:flex mint:flex-col mint:gap-2 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#9ca3af] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full\">\n {toc.map((item, index) => {\n const isActive = activeId === item.slug;\n return (\n <li key={`${item.slug}-${index}`} className=\"mint:relative\">\n {isActive && (\n <div className=\"mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-1\" />\n )}\n <a\n href={`#${item.slug}`}\n className={cn(\n \"mint:block mint:pl-6 mint:leading-relaxed mint:no-underline\",\n isActive\n ? \"mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold\"\n : \"mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]\"\n )}\n >\n {item.title}\n </a>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"names":["TableOfContents","toc","activeId","setActiveId","useState","ignoreScrollRef","useRef","ignoreTimeoutRef","useEffect","hash","_a","handleHashChange","scrollContainer","getActiveHeading","style","scrollMtRem","fontSize","scrollOffset","scrollY","headingPositions","item","element","rect","containerRect","relativeTop","_b","currentHeading","heading","handleScroll","newActiveId","timeoutId","jsx","index","isActive","jsxs","cn"],"mappings":";;;AAQO,SAASA,EAAgB,EAAE,KAAAC,KAA6B;AAC7D,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAE,GACrCC,IAAkBC,EAAO,EAAK,GAC9BC,IAAmBD,EAAA;AAEzB,SAAAE,EAAU,MAAM;;AACd,QAAIP,EAAI,WAAW,EAAG;AAEtB,IAAAI,EAAgB,UAAU,IACtBE,EAAiB,WACnB,aAAaA,EAAiB,OAAO;AAGvC,UAAME,IAAO,OAAO,SAAS,KAAK,MAAM,CAAC;AACzC,IAAIA,KACFN,EAAYM,CAAI,GAChBJ,EAAgB,UAAU,IAC1BE,EAAiB,UAAU,WAAW,MAAM;AAC1C,MAAAF,EAAgB,UAAU;AAAA,IAC5B,GAAG,GAAI,KAEPF,IAAYO,IAAAT,EAAI,CAAC,MAAL,gBAAAS,EAAQ,SAAQ,EAAE;AAGhC,UAAMC,IAAmB,MAAM;AAC7B,YAAMF,IAAO,OAAO,SAAS,KAAK,MAAM,CAAC;AACzC,MAAIA,MACFN,EAAYM,CAAI,GAChBJ,EAAgB,UAAU,IACtBE,EAAiB,WACnB,aAAaA,EAAiB,OAAO,GAEvCA,EAAiB,UAAU,WAAW,MAAM;AAC1C,QAAAF,EAAgB,UAAU;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