@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.
Files changed (26) hide show
  1. package/dist/api-playground-2/ApiExamples.js +24 -16
  2. package/dist/api-playground-2/ApiExamples.js.map +1 -1
  3. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +66 -58
  4. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
  5. package/dist/api-playground-2/components/Example/RequestExample.js +55 -50
  6. package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
  7. package/dist/api-playground-2/generators/createBodyData.js +1 -1
  8. package/dist/api-playground-2/generators/createBodyData.js.map +1 -1
  9. package/dist/api-playground-2/generators/createHeaders.js +18 -18
  10. package/dist/api-playground-2/generators/createHeaders.js.map +1 -1
  11. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +18 -16
  12. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
  13. package/dist/api-playground-2/generators/generateRequest.js +26 -25
  14. package/dist/api-playground-2/generators/generateRequest.js.map +1 -1
  15. package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
  16. package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
  17. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +24 -13
  18. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -1
  19. package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
  20. package/dist/common/guards.js +11 -0
  21. package/dist/common/guards.js.map +1 -0
  22. package/dist/components/toc/index.js +4 -4
  23. package/dist/components/toc/index.js.map +1 -1
  24. package/dist/contexts/ConfigContext.js.map +1 -1
  25. package/dist/styles.css +1 -1
  26. package/package.json +10 -11
@@ -1,27 +1,35 @@
1
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { useContext as x, useState as f, useMemo as u } from "react";
3
- import { usePlaygroundInputsStore as d } from "./hooks/usePlaygroundInputsStore.js";
4
- import { CodeExampleLabelContext as h } from "../contexts/CodeExampleLabelContext.js";
5
- import { ApiReferenceContext2 as g } from "../contexts/ConfigContext.js";
6
- import R from "../components/Api/ErrorBoundary.js";
7
- import { clsx as v } from "clsx";
8
- import { RequestExample as C } from "./components/Example/RequestExample.js";
1
+ import { jsx as e, jsxs as x } from "react/jsx-runtime";
2
+ import { useContext as f, useState as u, useMemo as d } from "react";
3
+ import { usePlaygroundInputsStore as h, useSelectedSecurityOption as g } from "./hooks/usePlaygroundInputsStore.js";
4
+ import { CodeExampleLabelContext as R } from "../contexts/CodeExampleLabelContext.js";
5
+ import { ApiReferenceContext2 as v } from "../contexts/ConfigContext.js";
6
+ import C from "../components/Api/ErrorBoundary.js";
7
+ import { clsx as S } from "clsx";
8
+ import { RequestExample as y } from "./components/Example/RequestExample.js";
9
9
  import { ResponseExample as D } from "./components/Example/ResponseExample.js";
10
- const H = ({ className: t, isModal: m = !1, apiReferenceData: n }) => {
11
- const { apiReferenceData2: i } = x(g), r = n || i, { getApiPlaygroundInputs: o } = d(), a = o(), [s, p] = f(), l = u(
12
- () => v(
10
+ const O = ({ className: t, isModal: n = !1, apiReferenceData: i }) => {
11
+ const { apiReferenceData2: o } = f(v), r = i || o, { getApiPlaygroundInputs: m } = h(), { selectedSecurityOptionIndex: a } = g(), s = m(), [p, c] = u(), l = d(
12
+ () => S(
13
13
  "mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]",
14
14
  t
15
15
  ),
16
- [t, m]
16
+ [t, n]
17
17
  );
18
- return /* @__PURE__ */ e(h.Provider, { value: { selectedLabel: s, setSelectedLabel: p }, children: /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c(R, { children: [
19
- /* @__PURE__ */ e(C, { apiReferenceData: r, inputs: a, maxHeight: "mint:max-h-[40vh]" }),
18
+ return /* @__PURE__ */ e(R.Provider, { value: { selectedLabel: p, setSelectedLabel: c }, children: /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ x(C, { children: [
19
+ /* @__PURE__ */ e(
20
+ y,
21
+ {
22
+ selectedSecurityOptionIndex: a,
23
+ apiReferenceData: r,
24
+ inputs: s,
25
+ maxHeight: "mint:max-h-[40vh]"
26
+ }
27
+ ),
20
28
  /* @__PURE__ */ e(D, { apiReferenceData: r, maxHeight: "mint:max-h-[40vh]" })
21
29
  ] }) }) });
22
30
  };
23
31
  export {
24
- H as ApiExamples,
25
- H as default
32
+ O as ApiExamples,
33
+ O as default
26
34
  };
27
35
  //# sourceMappingURL=ApiExamples.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApiExamples.js","sources":["../../src/api-playground-2/ApiExamples.tsx"],"sourcesContent":["'use client';\n\nimport React, { useContext, useMemo, useState } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { CodeExampleLabelContext } from '@/contexts/CodeExampleLabelContext';\nimport { ApiReferenceContext2 } from '@/contexts/ConfigContext';\nimport ErrorBoundary from '../components/Api/ErrorBoundary';\nimport { clsx } from 'clsx';\n\nimport { RequestExample } from './components/Example/RequestExample';\nimport { ResponseExample } from './components/Example/ResponseExample';\nimport { ApiReferenceDataV2 } from './types';\n\n\ntype ApiExamplesProps = {\n className?: string;\n isModal?: boolean;\n apiReferenceData?: ApiReferenceDataV2;\n};\n\nexport const ApiExamples = ({ className, isModal = false, apiReferenceData }: ApiExamplesProps) => {\n const { apiReferenceData2: apiReferenceData2FromContext } = useContext(ApiReferenceContext2);\n const apiReferenceData2 = apiReferenceData || apiReferenceData2FromContext;\n const { getApiPlaygroundInputs } = usePlaygroundInputsStore();\n const inputs = getApiPlaygroundInputs();\n const [selectedLabel, setSelectedLabel] = useState<string | undefined>();\n\n const containerClassName = useMemo(\n () =>\n clsx(\n 'mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]',\n className,\n ),\n [className, isModal]\n );\n\n return (\n <CodeExampleLabelContext.Provider value={{ selectedLabel, setSelectedLabel }}>\n <div className={containerClassName}>\n <ErrorBoundary>\n <RequestExample apiReferenceData={apiReferenceData2} inputs={inputs} maxHeight=\"mint:max-h-[40vh]\" />\n <ResponseExample apiReferenceData={apiReferenceData2} maxHeight=\"mint:max-h-[40vh]\" />\n {/* TODO - Api Playground Refactor: OpenApiSchemaExample */}\n </ErrorBoundary>\n </div>\n </CodeExampleLabelContext.Provider>\n );\n};\n\nexport default ApiExamples;\n"],"names":["ApiExamples","className","isModal","apiReferenceData","apiReferenceData2FromContext","useContext","ApiReferenceContext2","apiReferenceData2","getApiPlaygroundInputs","usePlaygroundInputsStore","inputs","selectedLabel","setSelectedLabel","useState","containerClassName","useMemo","clsx","jsx","CodeExampleLabelContext","ErrorBoundary","RequestExample","ResponseExample"],"mappings":";;;;;;;;;AAqBO,MAAMA,IAAc,CAAC,EAAE,WAAAC,GAAW,SAAAC,IAAU,IAAO,kBAAAC,QAAyC;AACjG,QAAM,EAAE,mBAAmBC,MAAiCC,EAAWC,CAAoB,GACrFC,IAAoBJ,KAAoBC,GACxC,EAAE,wBAAAI,EAAA,IAA2BC,EAAA,GAC7BC,IAASF,EAAA,GACT,CAACG,GAAeC,CAAgB,IAAIC,EAAA,GAEpCC,IAAqBC;AAAA,IACzB,MACEC;AAAA,MACE;AAAA,MACAf;AAAA,IAAA;AAAA,IAEJ,CAACA,GAAWC,CAAO;AAAA,EAAA;AAGrB,SACE,gBAAAe,EAACC,EAAwB,UAAxB,EAAiC,OAAO,EAAE,eAAAP,GAAe,kBAAAC,KACxD,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAWH,GACd,4BAACK,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAe,kBAAkBb,GAAmB,QAAAG,GAAgB,WAAU,qBAAoB;AAAA,IACnG,gBAAAO,EAACI,GAAA,EAAgB,kBAAkBd,GAAmB,WAAU,oBAAA,CAAoB;AAAA,EAAA,EAAA,CAEtF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ApiExamples.js","sources":["../../src/api-playground-2/ApiExamples.tsx"],"sourcesContent":["'use client';\n\nimport React, { useContext, useMemo, useState } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { CodeExampleLabelContext } from '@/contexts/CodeExampleLabelContext';\nimport { ApiReferenceContext2 } from '@/contexts/ConfigContext';\nimport ErrorBoundary from '../components/Api/ErrorBoundary';\nimport { clsx } from 'clsx';\n\nimport { RequestExample } from './components/Example/RequestExample';\nimport { ResponseExample } from './components/Example/ResponseExample';\nimport { ApiReferenceDataV2 } from './types';\nimport { useSelectedSecurityOption } from './hooks/usePlaygroundInputsStore';\n\n\ntype ApiExamplesProps = {\n className?: string;\n isModal?: boolean;\n apiReferenceData?: ApiReferenceDataV2;\n};\n\nexport const ApiExamples = ({ className, isModal = false, apiReferenceData }: ApiExamplesProps) => {\n const { apiReferenceData2: apiReferenceData2FromContext } = useContext(ApiReferenceContext2);\n const apiReferenceData2 = apiReferenceData || apiReferenceData2FromContext;\n const { getApiPlaygroundInputs } = usePlaygroundInputsStore();\n const {selectedSecurityOptionIndex} = useSelectedSecurityOption();\n const inputs = getApiPlaygroundInputs();\n const [selectedLabel, setSelectedLabel] = useState<string | undefined>();\n\n const containerClassName = useMemo(\n () =>\n clsx(\n 'mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]',\n className,\n ),\n [className, isModal]\n );\n\n return (\n <CodeExampleLabelContext.Provider value={{ selectedLabel, setSelectedLabel }}>\n <div className={containerClassName}>\n <ErrorBoundary>\n <RequestExample\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n apiReferenceData={apiReferenceData2}\n inputs={inputs}\n maxHeight=\"mint:max-h-[40vh]\"\n />\n <ResponseExample apiReferenceData={apiReferenceData2} maxHeight=\"mint:max-h-[40vh]\" />\n {/* TODO - Api Playground Refactor: OpenApiSchemaExample */}\n </ErrorBoundary>\n </div>\n </CodeExampleLabelContext.Provider>\n );\n};\n\nexport default ApiExamples;\n"],"names":["ApiExamples","className","isModal","apiReferenceData","apiReferenceData2FromContext","useContext","ApiReferenceContext2","apiReferenceData2","getApiPlaygroundInputs","usePlaygroundInputsStore","selectedSecurityOptionIndex","useSelectedSecurityOption","inputs","selectedLabel","setSelectedLabel","useState","containerClassName","useMemo","clsx","jsx","CodeExampleLabelContext","ErrorBoundary","RequestExample","ResponseExample"],"mappings":";;;;;;;;;AAsBO,MAAMA,IAAc,CAAC,EAAE,WAAAC,GAAW,SAAAC,IAAU,IAAO,kBAAAC,QAAyC;AACjG,QAAM,EAAE,mBAAmBC,MAAiCC,EAAWC,CAAoB,GACrFC,IAAoBJ,KAAoBC,GACxC,EAAE,wBAAAI,EAAA,IAA2BC,EAAA,GAC7B,EAAC,6BAAAC,EAAA,IAA+BC,EAAA,GAChCC,IAASJ,EAAA,GACT,CAACK,GAAeC,CAAgB,IAAIC,EAAA,GAEpCC,IAAqBC;AAAA,IACzB,MACEC;AAAA,MACE;AAAA,MACAjB;AAAA,IAAA;AAAA,IAEJ,CAACA,GAAWC,CAAO;AAAA,EAAA;AAGrB,SACE,gBAAAiB,EAACC,EAAwB,UAAxB,EAAiC,OAAO,EAAE,eAAAP,GAAe,kBAAAC,KACxD,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAWH,GACd,4BAACK,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,6BAAAZ;AAAA,QACA,kBAAkBH;AAAA,QAClB,QAAAK;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,gBAAAO,EAACI,GAAA,EAAgB,kBAAkBhB,GAAmB,WAAU,oBAAA,CAAoB;AAAA,EAAA,EAAA,CAEtF,GACF,GACF;AAEJ;"}
@@ -1,66 +1,70 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import { useState as M, useEffect as B } from "react";
3
- import { generateRequest as E } from "../../generators/generateRequest.js";
4
- import { generateSnippet as I } from "../../generators/generateSnippet.js";
5
- import { getFirstExampleValue as a } from "../../schemaGraph/processExamples.js";
6
- import { CodeGroupSelect as w } from "../../../components/content-components/CodeGroupSelect/index.js";
7
- import { CodeSnippets as A } from "../../../components/content-components/code-snippets.js";
8
- import { langToPresetMap as G } from "../../../constants/snippetPresets.js";
9
- const Q = ({
1
+ import { jsx as j } from "react/jsx-runtime";
2
+ import { useState as y, useEffect as E } from "react";
3
+ import { generateRequest as a } from "../../generators/generateRequest.js";
4
+ import { generateSnippet as w } from "../../generators/generateSnippet.js";
5
+ import { getFirstExampleValue as A } from "../../schemaGraph/processExamples.js";
6
+ import { CodeGroupSelect as G } from "../../../components/content-components/CodeGroupSelect/index.js";
7
+ import { CodeSnippets as P } from "../../../components/content-components/code-snippets.js";
8
+ import { langToPresetMap as V } from "../../../constants/snippetPresets.js";
9
+ const W = ({
10
10
  baseUrl: s,
11
11
  apiReferenceData: t,
12
12
  inputs: n,
13
13
  requestExampleLanguages: c,
14
14
  requiredOnly: p,
15
- maxHeight: o
15
+ maxHeight: o,
16
+ selectedSecurityOptionIndex: m
16
17
  }) => {
17
- var f, S, r, x, d;
18
- const m = (f = t.dependencies) == null ? void 0 : f.requestBody;
19
- if (!m)
20
- return /* @__PURE__ */ y(
21
- C,
18
+ var h, S, r, d, T;
19
+ const f = (h = t.dependencies) == null ? void 0 : h.requestBody;
20
+ if (!f)
21
+ return /* @__PURE__ */ j(
22
+ B,
22
23
  {
23
24
  apiReferenceData: t,
24
25
  baseUrl: s,
25
26
  inputs: n,
26
27
  requestExampleLanguages: c,
27
28
  requiredOnly: p,
28
- maxHeight: o
29
+ maxHeight: o,
30
+ selectedSecurityOptionIndex: m
29
31
  }
30
32
  );
31
- const i = a(m.content);
33
+ const i = A(f.content);
32
34
  if (!i) return null;
33
- const l = Object.entries(m.content).map(
34
- ([e, T]) => ({
35
+ const l = Object.entries(f.content).map(
36
+ ([e, x]) => ({
35
37
  contentType: e,
36
- examples: T.examples
38
+ examples: x.examples
37
39
  })
38
40
  ), u = 0;
39
- return ((S = l[u]) == null ? void 0 : S.examples.length) > 1 ? /* @__PURE__ */ y(
40
- P,
41
+ return ((S = l[u]) == null ? void 0 : S.examples.length) > 1 ? /* @__PURE__ */ j(
42
+ k,
41
43
  {
42
44
  apiReferenceData: t,
43
45
  selectedBodyContentType: (r = l[u]) == null ? void 0 : r.contentType,
44
46
  baseUrl: s,
45
47
  inputs: n,
46
- examples: (x = l[u]) == null ? void 0 : x.examples,
48
+ examples: (d = l[u]) == null ? void 0 : d.examples,
47
49
  requiredOnly: p,
48
- maxHeight: o
50
+ maxHeight: o,
51
+ selectedSecurityOptionIndex: m
49
52
  }
50
- ) : /* @__PURE__ */ y(
51
- C,
53
+ ) : /* @__PURE__ */ j(
54
+ B,
52
55
  {
53
56
  apiReferenceData: t,
54
- selectedBodyContentType: (d = l[u]) == null ? void 0 : d.contentType,
57
+ selectedBodyContentType: (T = l[u]) == null ? void 0 : T.contentType,
55
58
  baseUrl: s,
56
59
  inputs: n,
57
60
  exampleValue: i,
58
61
  requestExampleLanguages: c,
59
62
  requiredOnly: p,
60
- maxHeight: o
63
+ maxHeight: o,
64
+ selectedSecurityOptionIndex: m
61
65
  }
62
66
  );
63
- }, C = ({
67
+ }, B = ({
64
68
  baseUrl: s,
65
69
  apiReferenceData: t,
66
70
  inputs: n,
@@ -68,27 +72,29 @@ const Q = ({
68
72
  exampleValue: p,
69
73
  requestExampleLanguages: o,
70
74
  requiredOnly: m,
71
- maxHeight: i
75
+ maxHeight: f,
76
+ selectedSecurityOptionIndex: i
72
77
  }) => {
73
- const [l, u] = M(null), [f, S] = M(null);
74
- return B(() => {
78
+ const [l, u] = y(null), [h, S] = y(null);
79
+ return E(() => {
75
80
  let r = !1;
76
- const x = E({
81
+ const d = a({
77
82
  baseUrl: s,
78
83
  apiReferenceData: t,
79
84
  inputs: n,
80
85
  selectedBodyContentType: c,
81
86
  exampleData: p,
82
- requiredOnly: m
83
- }), d = o == null ? void 0 : o.reduce((e, T) => {
84
- const h = G[T];
85
- return h && e.push(h), e;
87
+ requiredOnly: m,
88
+ selectedSecurityOptionIndex: i
89
+ }), T = o == null ? void 0 : o.reduce((e, x) => {
90
+ const M = V[x];
91
+ return M && e.push(M), e;
86
92
  }, []);
87
- return I({
93
+ return w({
88
94
  apiReferenceData: t,
89
95
  pathInputs: n.path,
90
- request: x,
91
- snippetPresets: d
96
+ request: d,
97
+ snippetPresets: T
92
98
  }).then((e) => {
93
99
  r || u(e);
94
100
  }).catch((e) => {
@@ -96,52 +102,54 @@ const Q = ({
96
102
  }), () => {
97
103
  r = !0;
98
104
  };
99
- }, [s, t, n, c, p, o, m]), f || !l ? null : /* @__PURE__ */ y(A, { snippets: l, dropdown: !0, maxHeight: i });
100
- }, P = ({
105
+ }, [s, t, n, c, p, o, m]), h || !l ? null : /* @__PURE__ */ j(P, { snippets: l, dropdown: !0, maxHeight: f });
106
+ }, k = ({
101
107
  baseUrl: s,
102
108
  apiReferenceData: t,
103
109
  inputs: n,
104
110
  selectedBodyContentType: c,
105
111
  examples: p,
106
112
  requiredOnly: o,
107
- maxHeight: m
113
+ maxHeight: m,
114
+ selectedSecurityOptionIndex: f
108
115
  }) => {
109
- const [i, l] = M({}), [u, f] = M(null);
110
- return B(() => {
116
+ const [i, l] = y({}), [u, h] = y(null);
117
+ return E(() => {
111
118
  const S = n.path, r = {};
112
119
  (async () => {
113
- for (const [d, { value: e }] of Object.entries(p)) {
120
+ for (const [T, { value: e }] of Object.entries(p)) {
114
121
  if (!e) continue;
115
- const T = E({
122
+ const x = a({
116
123
  baseUrl: s,
117
124
  apiReferenceData: t,
118
125
  inputs: n,
119
126
  selectedBodyContentType: c,
120
127
  exampleData: e,
121
- requiredOnly: o
128
+ requiredOnly: o,
129
+ selectedSecurityOptionIndex: f
122
130
  });
123
131
  try {
124
- (await I({
132
+ (await w({
125
133
  apiReferenceData: t,
126
134
  pathInputs: S,
127
- request: T,
135
+ request: x,
128
136
  isMultipleRequest: !0
129
- })).forEach((j) => {
130
- r[j.filename] = {
131
- ...r[j.filename],
132
- [d]: j
137
+ })).forEach((C) => {
138
+ r[C.filename] = {
139
+ ...r[C.filename],
140
+ [T]: C
133
141
  };
134
142
  });
135
- } catch (h) {
136
- console.error(h), f(h);
143
+ } catch (M) {
144
+ console.error(M), h(M);
137
145
  return;
138
146
  }
139
147
  }
140
148
  l(r);
141
149
  })();
142
- }, [s, t, n, c, p, o]), u || Object.keys(i).length === 0 ? null : /* @__PURE__ */ y(w, { snippets: i, maxHeight: m });
150
+ }, [s, t, n, c, p, o]), u || Object.keys(i).length === 0 ? null : /* @__PURE__ */ j(G, { snippets: i, maxHeight: m });
143
151
  };
144
152
  export {
145
- Q as GeneratedRequestExample
153
+ W as GeneratedRequestExample
146
154
  };
147
155
  //# sourceMappingURL=GeneratedRequestExample.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeneratedRequestExample.js","sources":["../../../../src/api-playground-2/components/Example/GeneratedRequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs, ExampleSchema } from '@mintlify/validation';\nimport { JSX, useState, useEffect } from 'react';\n\nimport { generateRequest } from '@/api-playground-2/generators/generateRequest';\nimport { generateSnippet } from '@/api-playground-2/generators/generateSnippet';\nimport { getFirstExampleValue } from '@/api-playground-2/schemaGraph/processExamples';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { langToPresetMap, SnippetPreset } from '../../../constants/snippetPresets';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nexport type GeneratedRequestExampleParams = {\n baseUrl: string;\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n};\n\nexport const GeneratedRequestExample = ({\n baseUrl,\n apiReferenceData,\n inputs,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: GeneratedRequestExampleParams): JSX.Element | null => {\n const requestBody = apiReferenceData.dependencies?.requestBody;\n\n if (!requestBody) {\n return (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n }\n\n const firstExampleValue = getFirstExampleValue(requestBody.content);\n\n if (!firstExampleValue) return null;\n\n const examplesByContentType = Object.entries(requestBody.content).map(\n ([contentType, content]) => {\n return {\n contentType,\n examples: content.examples,\n };\n }\n );\n const selectedContentTypeIndex = 0;\n\n return examplesByContentType[selectedContentTypeIndex]?.examples.length > 1 ? (\n <MultipleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n examples={examplesByContentType[selectedContentTypeIndex]?.examples}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n ) : (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n exampleValue={firstExampleValue}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n};\n\ntype SingleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n exampleValue?: unknown;\n};\n\nconst SingleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleValue,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: SingleRequestParams) => {\n const [snippets, setSnippets] = useState<ExampleCodeSnippet[] | null>(null);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n \n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs: inputs,\n selectedBodyContentType,\n exampleData: exampleValue,\n requiredOnly,\n });\n\n const snippetPresets = requestExampleLanguages?.reduce<SnippetPreset[]>((acc, lang) => {\n const preset = langToPresetMap[lang];\n if (preset) acc.push(preset);\n return acc;\n }, []);\n\n generateSnippet({\n apiReferenceData,\n pathInputs: inputs.path,\n request,\n snippetPresets,\n })\n .then((result) => {\n if (!cancelled) {\n setSnippets(result);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(err);\n setError(err);\n }\n });\n \n return () => {\n cancelled = true;\n };\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, exampleValue, requestExampleLanguages, requiredOnly]);\n\n if (error) return null;\n if (!snippets) return null;\n\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n};\n\ntype MultipleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n examples: Record<string, ExampleSchema>;\n};\n\nconst MultipleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n examples,\n requiredOnly,\n maxHeight,\n}: MultipleRequestParams): JSX.Element | null => {\n const [nameToSnippetExamplesMap, setNameToSnippetExamplesMap] = useState<\n Record<string, Record<string, ExampleCodeSnippet>>\n >({});\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const pathInputs = inputs.path;\n const snippetMap: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n const generateAllSnippets = async () => {\n for (const [name, { value: exampleData }] of Object.entries(examples)) {\n if (!exampleData) continue;\n\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleData,\n requiredOnly,\n });\n\n try {\n const snippets = await generateSnippet({\n apiReferenceData,\n pathInputs,\n request,\n isMultipleRequest: true,\n });\n\n snippets.forEach((snippet) => {\n snippetMap[snippet.filename] = {\n ...snippetMap[snippet.filename],\n [name]: snippet,\n };\n });\n } catch (err) {\n console.error(err);\n setError(err as Error);\n return;\n }\n }\n setNameToSnippetExamplesMap(snippetMap);\n };\n\n generateAllSnippets();\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, examples, requiredOnly]);\n\n if (error) return null;\n if (Object.keys(nameToSnippetExamplesMap).length === 0) return null;\n\n return <CodeGroupSelect snippets={nameToSnippetExamplesMap} maxHeight={maxHeight} />;\n};\n"],"names":["GeneratedRequestExample","baseUrl","apiReferenceData","inputs","requestExampleLanguages","requiredOnly","maxHeight","requestBody","_a","jsx","SingleRequest","firstExampleValue","getFirstExampleValue","examplesByContentType","contentType","content","selectedContentTypeIndex","_b","MultipleRequest","_c","_d","_e","selectedBodyContentType","exampleValue","snippets","setSnippets","useState","error","setError","useEffect","cancelled","request","generateRequest","snippetPresets","acc","lang","preset","langToPresetMap","generateSnippet","result","err","CodeSnippets","examples","nameToSnippetExamplesMap","setNameToSnippetExamplesMap","pathInputs","snippetMap","name","exampleData","snippet","CodeGroupSelect"],"mappings":";;;;;;;;AAqBO,MAAMA,IAA0B,CAAC;AAAA,EACtC,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AACF,MAAyD;;AACvD,QAAMC,KAAcC,IAAAN,EAAiB,iBAAjB,gBAAAM,EAA+B;AAEnD,MAAI,CAACD;AACH,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,kBAAAR;AAAA,QACA,SAAAD;AAAA,QACA,QAAAE;AAAA,QACA,yBAAAC;AAAA,QACA,cAAAC;AAAA,QACA,WAAAC;AAAA,MAAA;AAAA,IAAA;AAKN,QAAMK,IAAoBC,EAAqBL,EAAY,OAAO;AAEl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a,KAAK,OAAO,QAAQN,CAAQ,GAAG;AACrE,YAAI,CAACM,EAAa;AAElB,cAAMjB,IAAUC,EAAgB;AAAA,UAC9B,SAAA/B;AAAA,UACA,kBAAAC;AAAA,UACA,QAAAC;AAAA,UACA,yBAAAmB;AAAA,UACA,aAAA0B;AAAA,UACA,cAAA3C;AAAA,QAAA,CACD;AAED,YAAI;AAQF,WAPiB,MAAMiC,EAAgB;AAAA,YACrC,kBAAApC;AAAA,YACA,YAAA2C;AAAA,YACA,SAAAd;AAAA,YACA,mBAAmB;AAAA,UAAA,CACpB,GAEQ,QAAQ,CAACkB,MAAY;AAC5B,YAAAH,EAAWG,EAAQ,QAAQ,IAAI;AAAA,cAC7B,GAAGH,EAAWG,EAAQ,QAAQ;AAAA,cAC9B,CAACF,CAAI,GAAGE;AAAA,YAAA;AAAA,UAEZ,CAAC;AAAA,QACH,SAAST,GAAK;AACZ,kBAAQ,MAAMA,CAAG,GACjBZ,EAASY,CAAY;AACrB;AAAA,QACF;AAAA,MACF;AACA,MAAAI,EAA4BE,CAAU;AAAA,IACxC,GAEA;AAAA,EACF,GAAG,CAAC7C,GAASC,GAAkBC,GAAQmB,GAAyBoB,GAAUrC,CAAY,CAAC,GAEnFsB,KACA,OAAO,KAAKgB,CAAwB,EAAE,WAAW,IAAU,OAExD,gBAAAlC,EAACyC,GAAA,EAAgB,UAAUP,GAA0B,WAAArC,EAAA,CAAsB;AACpF;"}
1
+ {"version":3,"file":"GeneratedRequestExample.js","sources":["../../../../src/api-playground-2/components/Example/GeneratedRequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs, ExampleSchema } from '@mintlify/validation';\nimport { JSX, useState, useEffect } from 'react';\n\nimport { generateRequest } from '@/api-playground-2/generators/generateRequest';\nimport { generateSnippet } from '@/api-playground-2/generators/generateSnippet';\nimport { getFirstExampleValue } from '@/api-playground-2/schemaGraph/processExamples';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { langToPresetMap, SnippetPreset } from '../../../constants/snippetPresets';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nexport type GeneratedRequestExampleParams = {\n baseUrl: string;\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n selectedSecurityOptionIndex: number;\n};\n\nexport const GeneratedRequestExample = ({\n baseUrl,\n apiReferenceData,\n inputs,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n selectedSecurityOptionIndex,\n}: GeneratedRequestExampleParams): JSX.Element | null => {\n const requestBody = apiReferenceData.dependencies?.requestBody;\n\n if (!requestBody) {\n return (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n />\n );\n }\n\n const firstExampleValue = getFirstExampleValue(requestBody.content);\n\n if (!firstExampleValue) return null;\n\n const examplesByContentType = Object.entries(requestBody.content).map(\n ([contentType, content]) => {\n return {\n contentType,\n examples: content.examples,\n };\n }\n );\n const selectedContentTypeIndex = 0;\n\n return examplesByContentType[selectedContentTypeIndex]?.examples.length > 1 ? (\n <MultipleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n examples={examplesByContentType[selectedContentTypeIndex]?.examples}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n />\n ) : (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n exampleValue={firstExampleValue}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n />\n );\n};\n\ntype SingleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n exampleValue?: unknown;\n};\n\nconst SingleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleValue,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n selectedSecurityOptionIndex,\n}: SingleRequestParams) => {\n const [snippets, setSnippets] = useState<ExampleCodeSnippet[] | null>(null);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n \n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs: inputs,\n selectedBodyContentType,\n exampleData: exampleValue,\n requiredOnly,\n selectedSecurityOptionIndex,\n });\n\n const snippetPresets = requestExampleLanguages?.reduce<SnippetPreset[]>((acc, lang) => {\n const preset = langToPresetMap[lang];\n if (preset) acc.push(preset);\n return acc;\n }, []);\n\n generateSnippet({\n apiReferenceData,\n pathInputs: inputs.path,\n request,\n snippetPresets,\n })\n .then((result) => {\n if (!cancelled) {\n setSnippets(result);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(err);\n setError(err);\n }\n });\n \n return () => {\n cancelled = true;\n };\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, exampleValue, requestExampleLanguages, requiredOnly]);\n\n if (error) return null;\n if (!snippets) return null;\n\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n};\n\ntype MultipleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n examples: Record<string, ExampleSchema>;\n selectedSecurityOptionIndex: number;\n};\n\nconst MultipleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n examples,\n requiredOnly,\n maxHeight,\n selectedSecurityOptionIndex,\n}: MultipleRequestParams): JSX.Element | null => {\n const [nameToSnippetExamplesMap, setNameToSnippetExamplesMap] = useState<\n Record<string, Record<string, ExampleCodeSnippet>>\n >({});\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const pathInputs = inputs.path;\n const snippetMap: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n const generateAllSnippets = async () => {\n for (const [name, { value: exampleData }] of Object.entries(examples)) {\n if (!exampleData) continue;\n\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleData,\n requiredOnly,\n selectedSecurityOptionIndex,\n });\n\n try {\n const snippets = await generateSnippet({\n apiReferenceData,\n pathInputs,\n request,\n isMultipleRequest: true,\n });\n\n snippets.forEach((snippet) => {\n snippetMap[snippet.filename] = {\n ...snippetMap[snippet.filename],\n [name]: snippet,\n };\n });\n } catch (err) {\n console.error(err);\n setError(err as Error);\n return;\n }\n }\n setNameToSnippetExamplesMap(snippetMap);\n };\n\n generateAllSnippets();\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, examples, requiredOnly]);\n\n if (error) return null;\n if (Object.keys(nameToSnippetExamplesMap).length === 0) return null;\n\n return <CodeGroupSelect snippets={nameToSnippetExamplesMap} maxHeight={maxHeight} />;\n};\n"],"names":["GeneratedRequestExample","baseUrl","apiReferenceData","inputs","requestExampleLanguages","requiredOnly","maxHeight","selectedSecurityOptionIndex","requestBody","_a","jsx","SingleRequest","firstExampleValue","getFirstExampleValue","examplesByContentType","contentType","content","selectedContentTypeIndex","_b","MultipleRequest","_c","_d","_e","selectedBodyContentType","exampleValue","snippets","setSnippets","useState","error","setError","useEffect","cancelled","request","generateRequest","snippetPresets","acc","lang","preset","langToPresetMap","generateSnippet","result","err","CodeSnippets","examples","nameToSnippetExamplesMap","setNameToSnippetExamplesMap","pathInputs","snippetMap","name","exampleData","snippet","CodeGroupSelect"],"mappings":";;;;;;;;AAsBO,MAAMA,IAA0B,CAAC;AAAA,EACtC,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,QAAAC;AAAA,E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GAAQoB,GAAyBoB,GAAUtC,CAAY,CAAC,GAEnFuB,KACA,OAAO,KAAKgB,CAAwB,EAAE,WAAW,IAAU,OAExD,gBAAAlC,EAACyC,GAAA,EAAgB,UAAUP,GAA0B,WAAAtC,EAAA,CAAsB;AACpF;"}
@@ -1,89 +1,94 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { useState as b, useEffect as q } from "react";
2
+ import { useState as q, useEffect as E } from "react";
3
3
  import { initialApiPlaygroundInputs as y } from "../../constants/index.js";
4
- import { generateSnippetMap as E } from "../../generators/generateSnippetMap.js";
5
- import { CodeGroupSelect as M } from "../../../components/content-components/CodeGroupSelect/index.js";
6
- import { CodeSnippets as O } from "../../../components/content-components/code-snippets.js";
7
- import { CodeBlock as x } from "../../../components/content-components/code-block.js";
8
- import { CodeGroup as U } from "../../../components/content-components/code-group.js";
9
- import { prismLangToDisplayLang as j } from "../../../constants/prism-languages.js";
10
- import { useApiPlaygroundDisplay as w } from "../../../hooks/useApiPlaygroundDisplay.js";
11
- import { GeneratedRequestExample as C } from "./GeneratedRequestExample.js";
4
+ import { generateSnippetMap as M } from "../../generators/generateSnippetMap.js";
5
+ import { CodeGroupSelect as O } from "../../../components/content-components/CodeGroupSelect/index.js";
6
+ import { CodeSnippets as U } from "../../../components/content-components/code-snippets.js";
7
+ import { CodeBlock as j } from "../../../components/content-components/code-block.js";
8
+ import { CodeGroup as w } from "../../../components/content-components/code-group.js";
9
+ import { prismLangToDisplayLang as x } from "../../../constants/prism-languages.js";
10
+ import { useApiPlaygroundDisplay as C } from "../../../hooks/useApiPlaygroundDisplay.js";
11
+ import { GeneratedRequestExample as L } from "./GeneratedRequestExample.js";
12
12
  const I = ({
13
13
  apiReferenceData: o,
14
- inputs: i = y,
15
- maxHeight: p
14
+ inputs: m = y,
15
+ maxHeight: p,
16
+ selectedSecurityOptionIndex: i
16
17
  }) => {
17
- var d, r, n, c, e;
18
- const u = (d = o.operation) == null ? void 0 : d.requestExamples, a = w(), m = (r = o.operation) == null ? void 0 : r.requestExampleLanguages, t = (n = o.operation) == null ? void 0 : n.requiredOnlyExamples;
18
+ var g, r, n, c, e;
19
+ const u = (g = o.operation) == null ? void 0 : g.requestExamples, a = C(), d = (r = o.operation) == null ? void 0 : r.requestExampleLanguages, s = (n = o.operation) == null ? void 0 : n.requiredOnlyExamples;
19
20
  switch ((c = o.operation) == null || c.requestExampleType, (e = o.operation) == null ? void 0 : e.requestExampleType) {
20
21
  case "mdx":
21
22
  if (!u) return null;
22
- const S = u.some((s) => s.dropdown ?? !1);
23
- return /* @__PURE__ */ l(U, { isSmallText: !0, dropdown: S, noMargins: !0, className: p, children: u.map((s, f) => /* @__PURE__ */ l(
24
- x,
23
+ const f = u.some((t) => t.dropdown ?? !1);
24
+ return /* @__PURE__ */ l(w, { isSmallText: !0, dropdown: f, noMargins: !0, className: p, children: u.map((t, b) => /* @__PURE__ */ l(
25
+ j,
25
26
  {
26
- language: s.language,
27
- fileName: s.filename,
28
- children: /* @__PURE__ */ l("span", { children: s.code })
27
+ language: t.language,
28
+ fileName: t.filename,
29
+ children: /* @__PURE__ */ l("span", { children: t.code })
29
30
  },
30
- `${s.filename}-${s.language}-${f}`
31
+ `${t.filename}-${t.language}-${b}`
31
32
  )) });
32
33
  case "codeSamples":
33
34
  return o.operation.codeSamples ? /* @__PURE__ */ l(
34
- L,
35
+ h,
35
36
  {
36
37
  apiReferenceData: o,
37
- inputs: i,
38
+ inputs: m,
38
39
  apiPlaygroundDisplay: a,
39
- requestExampleLanguages: m,
40
- requiredOnly: t,
41
- maxHeight: p
40
+ requestExampleLanguages: d,
41
+ requiredOnly: s,
42
+ maxHeight: p,
43
+ selectedSecurityOptionIndex: i
42
44
  }
43
45
  ) : null;
44
46
  case "generated":
45
- const g = o.operation.baseUrl ?? o.operation.baseUrlOptions[0];
46
- return g ? /* @__PURE__ */ l(
47
- C,
47
+ const S = o.operation.baseUrl ?? o.operation.baseUrlOptions[0];
48
+ return S ? /* @__PURE__ */ l(
49
+ L,
48
50
  {
49
51
  apiReferenceData: o,
50
- baseUrl: g,
51
- inputs: i,
52
- requestExampleLanguages: m,
53
- requiredOnly: t,
52
+ baseUrl: S,
53
+ inputs: m,
54
+ requestExampleLanguages: d,
55
+ selectedSecurityOptionIndex: i,
56
+ requiredOnly: s,
54
57
  maxHeight: p
55
58
  }
56
59
  ) : null;
57
60
  }
58
- }, L = ({
61
+ }, h = ({
59
62
  apiReferenceData: o,
60
- inputs: i,
63
+ inputs: m,
61
64
  apiPlaygroundDisplay: p,
62
- requestExampleLanguages: u,
63
- requiredOnly: a,
64
- maxHeight: m
65
+ requestExampleLanguages: i,
66
+ requiredOnly: u,
67
+ maxHeight: a,
68
+ selectedSecurityOptionIndex: d
65
69
  }) => {
66
- const [t, d] = b(null);
67
- if (q(() => {
70
+ const [s, g] = q(null);
71
+ if (E(() => {
68
72
  var r;
69
- (r = o.operation) != null && r.codeSamples && E({
73
+ (r = o.operation) != null && r.codeSamples && M({
70
74
  apiReferenceData: o,
71
75
  codeSamples: o.operation.codeSamples,
72
76
  baseUrl: o.operation.baseUrl ?? o.operation.baseUrlOptions[0],
73
77
  apiPlaygroundMode: p,
74
- requestExampleLanguages: u,
75
- requiredOnly: a,
76
- inputs: i
77
- }).then(d);
78
- }, [o, i, p, u, a]), !t) return null;
79
- if (Object.values(t).every((r) => Object.keys(r).length <= 1)) {
80
- let n = Object.values(t).flatMap((e) => Object.values(e));
78
+ requestExampleLanguages: i,
79
+ requiredOnly: u,
80
+ selectedSecurityOptionIndex: d,
81
+ inputs: m
82
+ }).then(g);
83
+ }, [o, m, p, i, u]), !s) return null;
84
+ if (Object.values(s).every((r) => Object.keys(r).length <= 1)) {
85
+ let n = Object.values(s).flatMap((e) => Object.values(e));
81
86
  return new Set(n.map((e) => e.filename)).size !== n.length && (n = n.map((e) => ({
82
87
  ...e,
83
- filename: j[e.language] ?? e.language
84
- }))), /* @__PURE__ */ l(O, { snippets: n, dropdown: !0, maxHeight: m });
88
+ filename: x[e.language] ?? e.language
89
+ }))), /* @__PURE__ */ l(U, { snippets: n, dropdown: !0, maxHeight: a });
85
90
  }
86
- return /* @__PURE__ */ l(M, { snippets: t, maxHeight: m });
91
+ return /* @__PURE__ */ l(O, { snippets: s, maxHeight: a });
87
92
  };
88
93
  export {
89
94
  I as RequestExample
@@ -1 +1 @@
1
- {"version":3,"file":"RequestExample.js","sources":["../../../../src/api-playground-2/components/Example/RequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { useState, useEffect } from 'react';\n\nimport { initialApiPlaygroundInputs } from '@/api-playground-2/constants';\nimport { generateSnippetMap } from '@/api-playground-2/generators/generateSnippetMap';\nimport type { ApiReferenceDataV2, CodeExample } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippet } from '../../../components/content-components/code-snippet';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { CodeBlock } from '../../../components/content-components/code-block';\nimport { CodeGroup } from '../../../components/content-components/code-group';\nimport { prismLangToDisplayLang } from '../../../constants/prism-languages';\nimport { useApiPlaygroundDisplay } from '../../../hooks/useApiPlaygroundDisplay';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nimport { GeneratedRequestExample } from './GeneratedRequestExample';\n\nexport const RequestExample = ({\n apiReferenceData,\n inputs = initialApiPlaygroundInputs,\n maxHeight,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n maxHeight?: string;\n}) => {\n const requestExamples = apiReferenceData.operation?.requestExamples;\n const apiPlaygroundDisplay = useApiPlaygroundDisplay();\n const requestExampleLanguages = apiReferenceData.operation?.requestExampleLanguages;\n const requiredOnly = apiReferenceData.operation?.requiredOnlyExamples;\n\n const requestExampleType = apiReferenceData.operation?.requestExampleType;\n\n switch (apiReferenceData.operation?.requestExampleType) {\n case 'mdx':\n if (!requestExamples) return null;\n const dropdown = requestExamples.some((example: CodeExample) => example.dropdown ?? false);\n return (\n <CodeGroup isSmallText dropdown={dropdown} noMargins className={maxHeight}>\n {requestExamples.map((example: CodeExample, index) => (\n <CodeBlock\n language={example.language}\n fileName={example.filename}\n key={`${example.filename}-${example.language}-${index}`}\n >\n <span>{example.code}</span>\n </CodeBlock>\n ))}\n </CodeGroup>\n );\n case 'codeSamples':\n if (!apiReferenceData.operation.codeSamples) return null;\n return (\n <CodeSamplesExample\n apiReferenceData={apiReferenceData}\n inputs={inputs}\n apiPlaygroundDisplay={apiPlaygroundDisplay}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n case 'generated':\n const baseUrl =\n apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0];\n if (!baseUrl) return null;\n return (\n <GeneratedRequestExample\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n }\n};\n\nconst CodeSamplesExample = ({\n apiReferenceData,\n inputs,\n apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundDisplay: 'none' | 'simple' | 'interactive';\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n}) => {\n const [snippetMap, setSnippetMap] = useState<Record<string, Record<string, ExampleCodeSnippet>> | null>(null);\n\n useEffect(() => {\n if (!apiReferenceData.operation?.codeSamples) return;\n\n generateSnippetMap({\n apiReferenceData,\n codeSamples: apiReferenceData.operation.codeSamples,\n baseUrl: apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0],\n apiPlaygroundMode: apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n inputs,\n }).then(setSnippetMap);\n }, [apiReferenceData, inputs, apiPlaygroundDisplay, requestExampleLanguages, requiredOnly]);\n\n if (!snippetMap) return null;\n\n if (Object.values(snippetMap).every((value) => Object.keys(value).length <= 1)) {\n const codeSnippetMap = Object.values(snippetMap);\n let snippets = codeSnippetMap.flatMap((record) => Object.values(record));\n const uniqueLabels = new Set(snippets.map((snippet) => snippet.filename));\n if (uniqueLabels.size !== snippets.length) {\n snippets = snippets.map((snippet) => ({\n ...snippet,\n filename: prismLangToDisplayLang[snippet.language] ?? snippet.language,\n }));\n }\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n }\n\n return <CodeGroupSelect snippets={snippetMap} maxHeight={maxHeight} />;\n};\n"],"names":["RequestExample","apiReferenceData","inputs","initialApiPlaygroundInputs","maxHeight","requestExamples","_a","apiPlaygroundDisplay","useApiPlaygroundDisplay","requestExampleLanguages","_b","requiredOnly","_c","_d","_e","dropdown","example","jsx","CodeGroup","index","CodeBlock","CodeSamplesExample","baseUrl","GeneratedRequestExample","snippetMap","setSnippetMap","useState","useEffect","generateSnippetMap","value","snippets","record","snippet","prismLangToDisplayLang","CodeSnippets","CodeGroupSelect"],"mappings":";;;;;;;;;;;AAiBO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,kBAAAC;AAAA,EACA,QAAAC,IAASC;AAAA,EACT,WAAAC;AACF,MAIM;;AACJ,QAAMC,KAAkBC,IAAAL,EAAiB,cAAjB,gBAAAK,EAA4B,iBAC9CC,IAAuBC,EAAA,GACvBC,KAA0BC,IAAAT,EAAiB,cAAjB,gBAAAS,EAA4B,yBACtDC,KAAeC,IAAAX,EAAiB,cAAjB,gBAAAW,EAA4B;AAIjD,WAF2BC,IAAAZ,EAAiB,cAAjB,QAAAY,EAA4B,qBAE/CC,IAAAb,EAAiB,cAAjB,gBAAAa,EAA4B,oBAAA;AAAA,IAClC,KAAK;AACH,UAAI,CAACT,EAAiB,QAAO;AAC7B,YAAMU,IAAWV,EAAgB,KAAK,CAACW,MAAyBA,EAAQ,YAAY,EAAK;AACzF,aACE,g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ACA,aAAaA,EAAiB,UAAU;AAAA,MACxC,SAASA,EAAiB,UAAU,WAAWA,EAAiB,UAAU,eAAe,CAAC;AAAA,MAC1F,mBAAmBM;AAAA,MACnB,yBAAAE;AAAA,MACA,cAAAE;AAAA,MACA,QAAAT;AAAA,IAAA,CACD,EAAE,KAAKuB,CAAa;AAAA,EACvB,GAAG,CAACxB,GAAkBC,GAAQK,GAAsBE,GAAyBE,CAAY,CAAC,GAEtF,CAACa,EAAY,QAAO;AAExB,MAAI,OAAO,OAAOA,CAAU,EAAE,MAAM,CAACK,MAAU,OAAO,KAAKA,CAAK,EAAE,UAAU,CAAC,GAAG;AAE9E,QAAIC,IADmB,OAAO,OAAON,CAAU,EACjB,QAAQ,CAACO,MAAW,OAAO,OAAOA,CAAM,CAAC;AAEvE,WADqB,IAAI,IAAID,EAAS,IAAI,CAACE,MAAYA,EAAQ,QAAQ,CAAC,EACvD,SAASF,EAAS,WACjCA,IAAWA,EAAS,IAAI,CAACE,OAAa;AAAA,MACpC,GAAGA;AAAA,MACH,UAAUC,EAAuBD,EAAQ,QAAQ,KAAKA,EAAQ;AAAA,IAAA,EAC9D,IAEG,gBAAAf,EAACiB,GAAA,EAAa,UAAAJ,GAAoB,UAAQ,IAAC,WAAA1B,GAAsB;AAAA,EAC1E;AAEA,SAAO,gBAAAa,EAACkB,GAAA,EAAgB,UAAUX,GAAY,WAAApB,EAAA,CAAsB;AACtE;"}
1
+ {"version":3,"file":"RequestExample.js","sources":["../../../../src/api-playground-2/components/Example/RequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { useState, useEffect } from 'react';\n\nimport { initialApiPlaygroundInputs } from '@/api-playground-2/constants';\nimport { generateSnippetMap } from '@/api-playground-2/generators/generateSnippetMap';\nimport type { ApiReferenceDataV2, CodeExample } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippet } from '../../../components/content-components/code-snippet';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { CodeBlock } from '../../../components/content-components/code-block';\nimport { CodeGroup } from '../../../components/content-components/code-group';\nimport { prismLangToDisplayLang } from '../../../constants/prism-languages';\nimport { useApiPlaygroundDisplay } from '../../../hooks/useApiPlaygroundDisplay';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nimport { GeneratedRequestExample } from './GeneratedRequestExample';\n\nexport const RequestExample = ({\n apiReferenceData,\n inputs = initialApiPlaygroundInputs,\n maxHeight,\n selectedSecurityOptionIndex,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n maxHeight?: string;\n selectedSecurityOptionIndex: number;\n}) => {\n const requestExamples = apiReferenceData.operation?.requestExamples;\n const apiPlaygroundDisplay = useApiPlaygroundDisplay();\n const requestExampleLanguages = apiReferenceData.operation?.requestExampleLanguages;\n const requiredOnly = apiReferenceData.operation?.requiredOnlyExamples;\n\n const requestExampleType = apiReferenceData.operation?.requestExampleType;\n\n switch (apiReferenceData.operation?.requestExampleType) {\n case 'mdx':\n if (!requestExamples) return null;\n const dropdown = requestExamples.some((example: CodeExample) => example.dropdown ?? false);\n return (\n <CodeGroup isSmallText dropdown={dropdown} noMargins className={maxHeight}>\n {requestExamples.map((example: CodeExample, index) => (\n <CodeBlock\n language={example.language}\n fileName={example.filename}\n key={`${example.filename}-${example.language}-${index}`}\n >\n <span>{example.code}</span>\n </CodeBlock>\n ))}\n </CodeGroup>\n );\n case 'codeSamples':\n if (!apiReferenceData.operation.codeSamples) return null;\n return (\n <CodeSamplesExample\n apiReferenceData={apiReferenceData}\n inputs={inputs}\n apiPlaygroundDisplay={apiPlaygroundDisplay}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n />\n );\n case 'generated':\n const baseUrl =\n apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0];\n if (!baseUrl) return null;\n return (\n <GeneratedRequestExample\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n }\n};\n\nconst CodeSamplesExample = ({\n apiReferenceData,\n inputs,\n apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n selectedSecurityOptionIndex,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundDisplay: 'none' | 'simple' | 'interactive';\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n selectedSecurityOptionIndex: number;\n}) => {\n const [snippetMap, setSnippetMap] = useState<Record<string, Record<string, ExampleCodeSnippet>> | null>(null);\n\n useEffect(() => {\n if (!apiReferenceData.operation?.codeSamples) return;\n\n generateSnippetMap({\n apiReferenceData,\n codeSamples: apiReferenceData.operation.codeSamples,\n baseUrl: apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0],\n apiPlaygroundMode: apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n selectedSecurityOptionIndex,\n inputs,\n }).then(setSnippetMap);\n }, [apiReferenceData, inputs, apiPlaygroundDisplay, requestExampleLanguages, requiredOnly]);\n\n if (!snippetMap) return null;\n\n if (Object.values(snippetMap).every((value) => Object.keys(value).length <= 1)) {\n const codeSnippetMap = Object.values(snippetMap);\n let snippets = codeSnippetMap.flatMap((record) => Object.values(record));\n const uniqueLabels = new Set(snippets.map((snippet) => snippet.filename));\n if (uniqueLabels.size !== snippets.length) {\n snippets = snippets.map((snippet) => ({\n ...snippet,\n filename: prismLangToDisplayLang[snippet.language] ?? snippet.language,\n }));\n }\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n }\n\n return <CodeGroupSelect snippets={snippetMap} maxHeight={maxHeight} />;\n};\n"],"names":["RequestExample","apiReferenceData","inputs","initialApiPlaygroundInputs","maxHeight","selectedSecurityOptionIndex","requestExamples","_a","apiPlaygroundDisplay","useApiPlaygroundDisplay","requestExampleLanguages","_b","requiredOnly","_c","_d","_e","dropdown","example","jsx","CodeGroup","index","CodeBlock","CodeSamplesExample","baseUrl","GeneratedRequestExample","snippetMap","setSnippetMap","useState","useEffect","generateSnippetMap","value","snippets","record","snippet","prismLangToDisplayLang","CodeSnippets","CodeGroupSelect"],"mappings":";;;;;;;;;;;AAiBO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,kBAAAC;AAAA,EACA,QAAAC,IAASC;AAAA,EACT,WAAAC;AAAA,EACA,6BAAAC;AACF,MAKM;;AACJ,QAAMC,KAAkBC,IAAAN,EAAiB,cAAjB,gBAAAM,EAA4B,iBAC9CC,IAAuBC,EAAA,GACvBC,KAA0BC,IAAAV,EAAiB,cAAjB,gBAAAU,EAA4B,yBACtDC,KAAeC,IAAAZ,EAAiB,cAAjB,gBAAAY,EAA4B;AAIjD,WAF2BC,IAAAb,EAAiB,cAAjB,QAAAa,EAA4B,qBAE/CC,IAAAd,EAAiB,cAAjB,gBAAAc,EAA4B,oBAAA;AAAA,IAClC,KAAK;AACH,UAAI,CAACT,EAAiB,QAAO;AAC7B,YAAMU,IAAWV,EAAgB,KAAK,CAACW,MAAyBA,EAAQ,YAAY,EAAK;AACzF,aACE,gBAAAC,EAACC,GAAA,EAAU,aAAW,IAAC,UAAAH,GAAoB,WAAS,IAAC,WAAWZ,GAC7D,UAAAE,EAAgB,IAAI,CAACW,GAAsBG,MAC1C,gBAAAF;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,UAAUJ,EAAQ;AAAA,UAClB,UAAUA,EAAQ;AAAA,UAGlB,UAAA,gBAAAC,EAAC,QAAA,EAAM,UAAAD,EAAQ,KAAA,CAAK;AAAA,QAAA;AAAA,QAFf,GAAGA,EAAQ,QAAQ,IAAIA,EAAQ,QAAQ,IAAI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AC,GAEtF,CAACa,EAAY,QAAO;AAExB,MAAI,OAAO,OAAOA,CAAU,EAAE,MAAM,CAACK,MAAU,OAAO,KAAKA,CAAK,EAAE,UAAU,CAAC,GAAG;AAE9E,QAAIC,IADmB,OAAO,OAAON,CAAU,EACjB,QAAQ,CAACO,MAAW,OAAO,OAAOA,CAAM,CAAC;AAEvE,WADqB,IAAI,IAAID,EAAS,IAAI,CAACE,MAAYA,EAAQ,QAAQ,CAAC,EACvD,SAASF,EAAS,WACjCA,IAAWA,EAAS,IAAI,CAACE,OAAa;AAAA,MACpC,GAAGA;AAAA,MACH,UAAUC,EAAuBD,EAAQ,QAAQ,KAAKA,EAAQ;AAAA,IAAA,EAC9D,IAEG,gBAAAf,EAACiB,GAAA,EAAa,UAAAJ,GAAoB,UAAQ,IAAC,WAAA3B,GAAsB;AAAA,EAC1E;AAEA,SAAO,gBAAAc,EAACkB,GAAA,EAAgB,UAAUX,GAAY,WAAArB,EAAA,CAAsB;AACtE;"}
@@ -1,4 +1,4 @@
1
- import { isObject as x, isFile as s } from "@mintlify/common";
1
+ import { isObject as x, isFile as s } from "../../common/guards.js";
2
2
  const j = (n, r, c, m) => {
3
3
  if (n !== void 0) {
4
4
  if (typeof n == "object" && n !== null && c && c.length > 0 && (n = Object.fromEntries(
@@ -1 +1 @@
1
- {"version":3,"file":"createBodyData.js","sources":["../../../src/api-playground-2/generators/createBodyData.ts"],"sourcesContent":["import { isFile, isObject } from '@mintlify/common';\nimport type { PostData } from 'har-format';\n\nexport const getPostData = (\n bodyData: unknown,\n selectedBodyContentType?: string,\n requiredProperties?: string[],\n fileProperties?: string[]\n): PostData | undefined => {\n if (bodyData === undefined) {\n return undefined;\n }\n\n if (\n typeof bodyData === 'object' &&\n bodyData !== null &&\n requiredProperties &&\n requiredProperties.length > 0\n ) {\n bodyData = Object.fromEntries(\n Object.entries(bodyData).filter(([key]) => requiredProperties.includes(key))\n );\n }\n\n // if body type is form data, convert to a list of form params\n if (\n selectedBodyContentType === 'multipart/form-data' ||\n selectedBodyContentType === 'application/x-www-form-urlencoded'\n ) {\n if (!bodyData || typeof bodyData !== 'object') {\n return undefined;\n }\n\n if (typeof bodyData === 'object' && fileProperties && fileProperties.length > 0) {\n if (isObject(bodyData)) {\n fileProperties.forEach((fieldName: string) => {\n if (!(fieldName in bodyData)) {\n bodyData[fieldName] = {\n fileName: 'example-file',\n };\n }\n });\n }\n }\n\n const getParamValue = (value: unknown) => {\n if (isFile(value)) {\n return value.name || 'file';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value, undefined, 2);\n }\n return value?.toString();\n };\n\n return {\n mimeType: selectedBodyContentType,\n params: Object.entries(bodyData).flatMap(([name, value]) => {\n if (Array.isArray(value)) {\n return value\n .filter((item) => item !== undefined && item !== null)\n .map((item, index) => {\n const paramName = value.length > 1 ? `${name}[${index}]` : name;\n if (isFile(item) && 'name' in item) {\n return {\n name: paramName,\n value: getParamValue(item),\n fileName: item.name,\n };\n } else if (fileProperties && fileProperties.includes(name)) {\n return {\n name: paramName,\n value: getParamValue(item),\n fileName: 'example-file',\n };\n }\n return {\n name: paramName,\n value: getParamValue(item),\n };\n });\n }\n\n if (isFile(value) && 'name' in value) {\n return [\n {\n name,\n value: getParamValue(value),\n fileName: value.name,\n },\n ];\n } else if (fileProperties && fileProperties.includes(name)) {\n return [\n {\n name,\n value: getParamValue(value),\n fileName: 'example-file',\n },\n ];\n }\n return [\n {\n name,\n value: getParamValue(value),\n },\n ];\n }),\n };\n }\n\n if (\n typeof bodyData === 'string' &&\n selectedBodyContentType &&\n isPlainText(selectedBodyContentType)\n ) {\n return {\n mimeType: selectedBodyContentType,\n text: bodyData,\n };\n }\n\n return {\n mimeType: 'application/json',\n text: JSON.stringify(bodyData, null, 2),\n };\n};\n\nfunction isPlainText(rawContentType: string) {\n const contentType = rawContentType.toLowerCase();\n return (\n contentType.startsWith('text/') || contentType.endsWith('+xml') || contentType.endsWith('/xml')\n );\n}\n"],"names":["getPostData","bodyData","selectedBodyContentType","requiredProperties","fileProperties","key","isObject","fieldName","getParamValue","value","isFile","name","item","index","paramName","isPlainText","rawContentType","contentType"],"mappings":";AAGO,MAAMA,IAAc,CACzBC,GACAC,GACAC,GACAC,MACyB;AACzB,MAAIH,MAAa,QAgBjB;AAAA,QAXE,OAAOA,KAAa,YACpBA,MAAa,QACbE,KACAA,EAAmB,SAAS,MAE5BF,IAAW,OAAO;AAAA,MAChB,OAAO,QAAQA,CAAQ,EAAE,OAAO,CAAC,CAACI,CAAG,MAAMF,EAAmB,SAASE,CAAG,CAAC;AAAA,IAAA,IAM7EH,MAA4B,yBAC5BA,MAA4B,qCAC5B;AACA,UAAI,CAACD,KAAY,OAAOA,KAAa;AACnC;AAGF,MAAI,OAAOA,KAAa,YAAYG,KAAkBA,EAAe,SAAS,KACxEE,EAASL,CAAQ,KACnBG,EAAe,QAAQ,CAACG,MAAsB;AAC5C,QAAMA,KAAaN,MACjBA,EAASM,CAAS,IAAI;AAAA,UACpB,UAAU;AAAA,QAAA;AAAA,MAGhB,CAAC;AAIL,YAAMC,IAAgB,CAACC,MACjBC,EAAOD,CAAK,IACPA,EAAM,QAAQ,SAEnB,OAAOA,KAAU,WACZ,KAAK,UAAUA,GAAO,QAAW,CAAC,IAEpCA,KAAA,gBAAAA,EAAO;AAGhB,aAAO;AAAA,QACL,UAAUP;AAAA,QACV,QAAQ,OAAO,QAAQD,CAAQ,EAAE,QAAQ,CAAC,CAACU,GAAMF,CAAK,MAChD,MAAM,QAAQA,CAAK,IACdA,EACJ,OAAO,CAACG,MAA+BA,KAAS,IAAI,EACpD,IAAI,CAACA,GAAMC,MAAU;AACpB,gBAAMC,IAAYL,EAAM,SAAS,IAAI,GAAGE,CAAI,IAAIE,CAAK,MAAMF;AAC3D,iBAAID,EAAOE,CAAI,KAAK,UAAUA,IACrB;AAAA,YACL,MAAME;AAAA,YACN,OAAON,EAAcI,CAAI;AAAA,YACzB,UAAUA,EAAK;AAAA,UAAA,IAERR,KAAkBA,EAAe,SAASO,CAAI,IAChD;AAAA,YACL,MAAMG;AAAA,YACN,OAAON,EAAcI,CAAI;AAAA,YACzB,UAAU;AAAA,UAAA,IAGP;AAAA,YACL,MAAME;AAAA,YACN,OAAON,EAAcI,CAAI;AAAA,UAAA;AAAA,QAE7B,CAAC,IAGDF,EAAOD,CAAK,KAAK,UAAUA,IACtB;AAAA,UACL;AAAA,YACE,MAAAE;AAAA,YACA,OAAOH,EAAcC,CAAK;AAAA,YAC1B,UAAUA,EAAM;AAAA,UAAA;AAAA,QAClB,IAEOL,KAAkBA,EAAe,SAASO,CAAI,IAChD;AAAA,UACL;AAAA,YACE,MAAAA;AAAA,YACA,OAAOH,EAAcC,CAAK;AAAA,YAC1B,UAAU;AAAA,UAAA;AAAA,QACZ,IAGG;AAAA,UACL;AAAA,YACE,MAAAE;AAAA,YACA,OAAOH,EAAcC,CAAK;AAAA,UAAA;AAAA,QAC5B,CAEH;AAAA,MAAA;AAAA,IAEL;AAEA,WACE,OAAOR,KAAa,YACpBC,KACAa,EAAYb,CAAuB,IAE5B;AAAA,MACL,UAAUA;AAAA,MACV,MAAMD;AAAA,IAAA,IAIH;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,UAAUA,GAAU,MAAM,CAAC;AAAA,IAAA;AAAA;AAE1C;AAEA,SAASc,EAAYC,GAAwB;AAC3C,QAAMC,IAAcD,EAAe,YAAA;AACnC,SACEC,EAAY,WAAW,OAAO,KAAKA,EAAY,SAAS,MAAM,KAAKA,EAAY,SAAS,MAAM;AAElG;"}
1
+ {"version":3,"file":"createBodyData.js","sources":["../../../src/api-playground-2/generators/createBodyData.ts"],"sourcesContent":["import { isFile, isObject } from '../../common/guards';\nimport type { PostData } from 'har-format';\n\nexport const getPostData = (\n bodyData: unknown,\n selectedBodyContentType?: string,\n requiredProperties?: string[],\n fileProperties?: string[]\n): PostData | undefined => {\n if (bodyData === undefined) {\n return undefined;\n }\n\n if (\n typeof bodyData === 'object' &&\n bodyData !== null &&\n requiredProperties &&\n requiredProperties.length > 0\n ) {\n bodyData = Object.fromEntries(\n Object.entries(bodyData).filter(([key]) => requiredProperties.includes(key))\n );\n }\n\n // if body type is form data, convert to a list of form params\n if (\n selectedBodyContentType === 'multipart/form-data' ||\n selectedBodyContentType === 'application/x-www-form-urlencoded'\n ) {\n if (!bodyData || typeof bodyData !== 'object') {\n return undefined;\n }\n\n if (typeof bodyData === 'object' && fileProperties && fileProperties.length > 0) {\n if (isObject(bodyData)) {\n fileProperties.forEach((fieldName: string) => {\n if (!(fieldName in bodyData)) {\n bodyData[fieldName] = {\n fileName: 'example-file',\n };\n }\n });\n }\n }\n\n const getParamValue = (value: unknown) => {\n if (isFile(value)) {\n return value.name || 'file';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value, undefined, 2);\n }\n return value?.toString();\n };\n\n return {\n mimeType: selectedBodyContentType,\n params: Object.entries(bodyData).flatMap(([name, value]) => {\n if (Array.isArray(value)) {\n return value\n .filter((item) => item !== undefined && item !== null)\n .map((item, index) => {\n const paramName = value.length > 1 ? `${name}[${index}]` : name;\n if (isFile(item) && 'name' in item) {\n return {\n name: paramName,\n value: getParamValue(item),\n fileName: item.name,\n };\n } else if (fileProperties && fileProperties.includes(name)) {\n return {\n name: paramName,\n value: getParamValue(item),\n fileName: 'example-file',\n };\n }\n return {\n name: paramName,\n value: getParamValue(item),\n };\n });\n }\n\n if (isFile(value) && 'name' in value) {\n return [\n {\n name,\n value: getParamValue(value),\n fileName: value.name,\n },\n ];\n } else if (fileProperties && fileProperties.includes(name)) {\n return [\n {\n name,\n value: getParamValue(value),\n fileName: 'example-file',\n },\n ];\n }\n return [\n {\n name,\n value: getParamValue(value),\n },\n ];\n }),\n };\n }\n\n if (\n typeof bodyData === 'string' &&\n selectedBodyContentType &&\n isPlainText(selectedBodyContentType)\n ) {\n return {\n mimeType: selectedBodyContentType,\n text: bodyData,\n };\n }\n\n return {\n mimeType: 'application/json',\n text: JSON.stringify(bodyData, null, 2),\n };\n};\n\nfunction isPlainText(rawContentType: string) {\n const contentType = rawContentType.toLowerCase();\n return (\n contentType.startsWith('text/') || contentType.endsWith('+xml') || contentType.endsWith('/xml')\n );\n}\n"],"names":["getPostData","bodyData","selectedBodyContentType","requiredProperties","fileProperties","key","isObject","fieldName","getParamValue","value","isFile","name","item","index","paramName","isPlainText","rawContentType","contentType"],"mappings":";AAGO,MAAMA,IAAc,CACzBC,GACAC,GACAC,GACAC,MACyB;AACzB,MAAIH,MAAa,QAgBjB;AAAA,QAXE,OAAOA,KAAa,YACpBA,MAAa,QACbE,KACAA,EAAmB,SAAS,MAE5BF,IAAW,OAAO;AAAA,MAChB,OAAO,QAAQA,CAAQ,EAAE,OAAO,CAAC,CAACI,CAAG,MAAMF,EAAmB,SAASE,CAAG,CAAC;AAAA,IAAA,IAM7EH,MAA4B,yBAC5BA,MAA4B,qCAC5B;AACA,UAAI,CAACD,KAAY,OAAOA,KAAa;AACnC;AAGF,MAAI,OAAOA,KAAa,YAAYG,KAAkBA,EAAe,SAAS,KACxEE,EAASL,CAAQ,KACnBG,EAAe,QAAQ,CAACG,MAAsB;AAC5C,QAAMA,KAAaN,MACjBA,EAASM,CAAS,IAAI;AAAA,UACpB,UAAU;AAAA,QAAA;AAAA,MAGhB,CAAC;AAIL,YAAMC,IAAgB,CAACC,MACjBC,EAAOD,CAAK,IACPA,EAAM,QAAQ,SAEnB,OAAOA,KAAU,WACZ,KAAK,UAAUA,GAAO,QAAW,CAAC,IAEpCA,KAAA,gBAAAA,EAAO;AAGhB,aAAO;AAAA,QACL,UAAUP;AAAA,QACV,QAAQ,OAAO,QAAQD,CAAQ,EAAE,QAAQ,CAAC,CAACU,GAAMF,CAAK,MAChD,MAAM,QAAQA,CAAK,IACdA,EACJ,OAAO,CAACG,MAA+BA,KAAS,IAAI,EACpD,IAAI,CAACA,GAAMC,MAAU;AACpB,gBAAMC,IAAYL,EAAM,SAAS,IAAI,GAAGE,CAAI,IAAIE,CAAK,MAAMF;AAC3D,iBAAID,EAAOE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