@mintlify/msft-sdk 1.1.62 → 1.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
- package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +6 -5
- package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
- package/dist/api-playground/EndpointFields/components/Description.js +6 -5
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
- package/dist/api-playground-2/ApiExamples.js +19 -20
- package/dist/api-playground-2/ApiFields.js +20 -247
- package/dist/api-playground-2/EndpointHeader.js +59 -47
- package/dist/api-playground-2/OperationPage.js +70 -66
- package/dist/api-playground-2/Playground.js +67 -83
- package/dist/api-playground-2/SchemaPage.js +22 -9
- package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
- package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
- package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
- package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
- package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
- package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
- package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
- package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
- package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
- package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
- package/dist/api-playground-2/generators/createCookies.js +23 -0
- package/dist/api-playground-2/generators/createHeaders.js +53 -36
- package/dist/api-playground-2/generators/createQueryString.js +30 -0
- package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
- package/dist/api-playground-2/generators/generateRequest.js +47 -51
- package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
- package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
- package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
- package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
- package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
- package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
- package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
- package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
- package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
- package/dist/api-playground-2/schemaGraph/utils.js +185 -147
- package/dist/common/guards.js +11 -19
- package/dist/components/Api/Expandable.js +10 -9
- package/dist/components/Api/Param.js +11 -13
- package/dist/components/Api/dropdown-menu.js +10 -9
- package/dist/components/content-components/code-group.js +4 -4
- package/dist/contexts/EndpointLocationContext.js +3 -3
- package/dist/hooks/useApiParamFieldOption.js +10 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useKeyboardShortcut.js +13 -13
- package/dist/hooks/useSendPlaygroundRequest.js +14 -146
- package/dist/index.d.ts +65 -58
- package/dist/index.js +109 -111
- package/dist/openapi/generateTypeStringFromSchema.js +2 -31
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
- package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
- package/dist/api-playground/ApiPlayground/index.js +0 -67
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
- package/dist/api-playground/EndpointFields/index.js +0 -7
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
- package/dist/common/potentiallyParseOpenApiString.js +0 -24
- package/dist/common/replaceSlashIndex.js +0 -6
- package/dist/common/slugToTitle.js +0 -10
- package/dist/constants/prism-languages.js +0 -19
- package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
- package/dist/contexts/MDXContentContext.js +0 -17
- package/dist/hooks/useApiPlaygroundInputs.js +0 -6
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
- package/dist/hooks/useBaseUrlOptions.js +0 -18
- package/dist/hooks/useComponentSchemas.js +0 -9
- package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
- package/dist/hooks/useGenerateNextItems.js +0 -11
- package/dist/hooks/useGenerateNextProperties.js +0 -11
- package/dist/hooks/useMDXContent.js +0 -6
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
- package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
- package/dist/hooks/usePrefilledInputs/index.js +0 -65
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
- package/dist/hooks/useSecurityOption.js +0 -10
- package/dist/hooks/useSetDefaultValue.js +0 -63
- package/dist/openapi/filterEnums.js +0 -20
- package/dist/openapi/generateNextAdditionalProperties.js +0 -7
- package/dist/openapi/generateNextItems.js +0 -7
- package/dist/openapi/generateNextProperties.js +0 -23
- package/dist/openapi/generateOptionLabels.js +0 -20
- package/dist/openapi/generateSimpleLabels.js +0 -4
- package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
- package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
- package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
- package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
- package/dist/utils/api-playground/defaults.js +0 -15
- package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
- package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
- package/dist/utils/flattenObject.js +0 -10
|
@@ -1,141 +1,145 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { generateRequest as
|
|
4
|
-
import { generateSnippet as
|
|
5
|
-
import { getFirstExampleValue as
|
|
6
|
-
import { CodeGroupSelect as
|
|
7
|
-
import { CodeSnippets as
|
|
8
|
-
import { langToPresetMap as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useEffect as B } from "react";
|
|
3
|
+
import { generateRequest as w } from "../../generators/generateRequest.js";
|
|
4
|
+
import { generateSnippet as x } from "../../generators/generateSnippet.js";
|
|
5
|
+
import { getFirstExampleValue as C } 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 b } from "../../../constants/snippetPresets.js";
|
|
9
|
+
const X = ({
|
|
10
10
|
baseUrl: s,
|
|
11
11
|
apiReferenceData: t,
|
|
12
|
-
inputs:
|
|
13
|
-
requestExampleLanguages:
|
|
14
|
-
requiredOnly:
|
|
15
|
-
maxHeight:
|
|
16
|
-
selectedSecurityOptionIndex: f
|
|
12
|
+
inputs: o,
|
|
13
|
+
requestExampleLanguages: c,
|
|
14
|
+
requiredOnly: n,
|
|
15
|
+
maxHeight: r,
|
|
16
|
+
selectedSecurityOptionIndex: f,
|
|
17
|
+
selectedRequestBodyContentTypeIndex: p
|
|
17
18
|
}) => {
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
19
|
+
var l, e, j;
|
|
20
|
+
const m = (l = t.dependencies) == null ? void 0 : l.requestBody;
|
|
21
|
+
if (!m)
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
k,
|
|
23
24
|
{
|
|
24
25
|
apiReferenceData: t,
|
|
25
26
|
baseUrl: s,
|
|
26
|
-
inputs:
|
|
27
|
-
requestExampleLanguages:
|
|
28
|
-
requiredOnly:
|
|
29
|
-
maxHeight:
|
|
27
|
+
inputs: o,
|
|
28
|
+
requestExampleLanguages: c,
|
|
29
|
+
requiredOnly: n,
|
|
30
|
+
maxHeight: r,
|
|
30
31
|
selectedSecurityOptionIndex: f
|
|
31
32
|
}
|
|
32
33
|
);
|
|
33
|
-
const i =
|
|
34
|
+
const i = C(
|
|
35
|
+
m.content,
|
|
36
|
+
p
|
|
37
|
+
);
|
|
34
38
|
if (!i) return null;
|
|
35
|
-
const
|
|
36
|
-
([
|
|
37
|
-
contentType:
|
|
38
|
-
examples:
|
|
39
|
+
const h = Object.entries(m.content).map(
|
|
40
|
+
([S, T]) => ({
|
|
41
|
+
contentType: S,
|
|
42
|
+
examples: T.examples
|
|
39
43
|
})
|
|
40
|
-
),
|
|
41
|
-
return (
|
|
42
|
-
|
|
44
|
+
), M = (e = h[p]) == null ? void 0 : e.examples, u = (j = h[p]) == null ? void 0 : j.contentType;
|
|
45
|
+
return Object.keys(M).length > 1 ? /* @__PURE__ */ a(
|
|
46
|
+
v,
|
|
43
47
|
{
|
|
44
48
|
apiReferenceData: t,
|
|
45
|
-
selectedBodyContentType:
|
|
49
|
+
selectedBodyContentType: u,
|
|
46
50
|
baseUrl: s,
|
|
47
|
-
inputs:
|
|
48
|
-
examples:
|
|
49
|
-
requiredOnly:
|
|
50
|
-
maxHeight:
|
|
51
|
+
inputs: o,
|
|
52
|
+
examples: M,
|
|
53
|
+
requiredOnly: n,
|
|
54
|
+
maxHeight: r,
|
|
51
55
|
selectedSecurityOptionIndex: f
|
|
52
56
|
}
|
|
53
|
-
) : /* @__PURE__ */
|
|
54
|
-
|
|
57
|
+
) : /* @__PURE__ */ a(
|
|
58
|
+
k,
|
|
55
59
|
{
|
|
56
60
|
apiReferenceData: t,
|
|
57
|
-
selectedBodyContentType:
|
|
61
|
+
selectedBodyContentType: u,
|
|
58
62
|
baseUrl: s,
|
|
59
|
-
inputs:
|
|
63
|
+
inputs: o,
|
|
60
64
|
exampleValue: i,
|
|
61
|
-
requestExampleLanguages:
|
|
62
|
-
requiredOnly:
|
|
63
|
-
maxHeight:
|
|
65
|
+
requestExampleLanguages: c,
|
|
66
|
+
requiredOnly: n,
|
|
67
|
+
maxHeight: r,
|
|
64
68
|
selectedSecurityOptionIndex: f
|
|
65
69
|
}
|
|
66
70
|
);
|
|
67
|
-
},
|
|
71
|
+
}, k = ({
|
|
68
72
|
baseUrl: s,
|
|
69
73
|
apiReferenceData: t,
|
|
70
|
-
inputs:
|
|
71
|
-
selectedBodyContentType:
|
|
72
|
-
exampleValue:
|
|
73
|
-
requestExampleLanguages:
|
|
74
|
+
inputs: o,
|
|
75
|
+
selectedBodyContentType: c,
|
|
76
|
+
exampleValue: n,
|
|
77
|
+
requestExampleLanguages: r,
|
|
74
78
|
requiredOnly: f,
|
|
75
79
|
maxHeight: p,
|
|
76
|
-
selectedSecurityOptionIndex:
|
|
80
|
+
selectedSecurityOptionIndex: m
|
|
77
81
|
}) => {
|
|
78
|
-
const
|
|
82
|
+
const i = w({
|
|
79
83
|
baseUrl: s,
|
|
80
84
|
apiReferenceData: t,
|
|
81
|
-
inputs:
|
|
82
|
-
selectedBodyContentType:
|
|
83
|
-
exampleData:
|
|
85
|
+
inputs: o,
|
|
86
|
+
selectedBodyContentType: c,
|
|
87
|
+
exampleData: n,
|
|
84
88
|
requiredOnly: f,
|
|
85
|
-
selectedSecurityOptionIndex:
|
|
86
|
-
}),
|
|
87
|
-
const
|
|
88
|
-
return
|
|
89
|
-
}, []),
|
|
89
|
+
selectedSecurityOptionIndex: m
|
|
90
|
+
}), h = r == null ? void 0 : r.reduce((u, l) => {
|
|
91
|
+
const e = b[l];
|
|
92
|
+
return e && u.push(e), u;
|
|
93
|
+
}, []), M = x({
|
|
90
94
|
apiReferenceData: t,
|
|
91
|
-
pathInputs:
|
|
92
|
-
request:
|
|
93
|
-
snippetPresets:
|
|
95
|
+
pathInputs: o.path,
|
|
96
|
+
request: i,
|
|
97
|
+
snippetPresets: h
|
|
94
98
|
});
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
},
|
|
99
|
+
return /* @__PURE__ */ a(P, { snippets: M, dropdown: !0, maxHeight: p, showCopyButton: !1, noMargins: !0 });
|
|
100
|
+
}, v = ({
|
|
97
101
|
baseUrl: s,
|
|
98
102
|
apiReferenceData: t,
|
|
99
|
-
inputs:
|
|
100
|
-
selectedBodyContentType:
|
|
101
|
-
examples:
|
|
102
|
-
requiredOnly:
|
|
103
|
+
inputs: o,
|
|
104
|
+
selectedBodyContentType: c,
|
|
105
|
+
examples: n,
|
|
106
|
+
requiredOnly: r,
|
|
103
107
|
maxHeight: f,
|
|
104
108
|
selectedSecurityOptionIndex: p
|
|
105
109
|
}) => {
|
|
106
|
-
const [
|
|
107
|
-
return
|
|
108
|
-
const
|
|
110
|
+
const [m, i] = V({}), [h, M] = V(null);
|
|
111
|
+
return B(() => {
|
|
112
|
+
const u = o.path, l = {};
|
|
109
113
|
try {
|
|
110
|
-
for (const [
|
|
111
|
-
if (!
|
|
112
|
-
const
|
|
114
|
+
for (const [e, { value: j }] of Object.entries(n)) {
|
|
115
|
+
if (!j) continue;
|
|
116
|
+
const S = w({
|
|
113
117
|
baseUrl: s,
|
|
114
118
|
apiReferenceData: t,
|
|
115
|
-
inputs:
|
|
116
|
-
selectedBodyContentType:
|
|
117
|
-
exampleData:
|
|
118
|
-
requiredOnly:
|
|
119
|
+
inputs: o,
|
|
120
|
+
selectedBodyContentType: c,
|
|
121
|
+
exampleData: j,
|
|
122
|
+
requiredOnly: r,
|
|
119
123
|
selectedSecurityOptionIndex: p
|
|
120
124
|
});
|
|
121
|
-
|
|
125
|
+
x({
|
|
122
126
|
apiReferenceData: t,
|
|
123
|
-
pathInputs:
|
|
124
|
-
request:
|
|
127
|
+
pathInputs: u,
|
|
128
|
+
request: S,
|
|
125
129
|
isMultipleRequest: !0
|
|
126
|
-
}).forEach((
|
|
127
|
-
|
|
128
|
-
...
|
|
129
|
-
[
|
|
130
|
+
}).forEach((E) => {
|
|
131
|
+
l[E.filename] = {
|
|
132
|
+
...l[E.filename],
|
|
133
|
+
[e]: E
|
|
130
134
|
};
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
|
-
|
|
134
|
-
} catch (
|
|
135
|
-
console.error(
|
|
137
|
+
i(l);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.error(e), M(e);
|
|
136
140
|
}
|
|
137
|
-
}, [s, t,
|
|
141
|
+
}, [s, t, o, c, n, r, p]), h || Object.keys(m).length === 0 ? null : /* @__PURE__ */ a(G, { snippets: m, maxHeight: f });
|
|
138
142
|
};
|
|
139
143
|
export {
|
|
140
|
-
|
|
144
|
+
X as GeneratedRequestExample
|
|
141
145
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { generateResponseExampleMap as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { generateResponseExampleMap as i } from "../../generators/generateResponseExampleMap.js";
|
|
3
|
+
import { useSelectedResponseContentType as u } from "../../hooks/useSelectedResponseContentType.js";
|
|
4
|
+
import { mapResponseExamples as d } from "../../schemaGraph/utils.js";
|
|
5
|
+
import { CodeGroupSelect as j } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
6
|
+
import { CodeSnippets as b } from "../../../components/content-components/code-snippets.js";
|
|
6
7
|
const C = ({
|
|
7
|
-
apiReferenceData:
|
|
8
|
-
// TODO - Api Playground Refactor: selectedContentType here implies the example will change when a different example is selected, but that doesn't work even in v1 - should be easy to pass a real selectedContentTypeIndex here
|
|
9
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
10
|
-
selectedResponseContentType: j,
|
|
8
|
+
apiReferenceData: t,
|
|
11
9
|
maxHeight: n
|
|
12
10
|
}) => {
|
|
13
|
-
var
|
|
14
|
-
const
|
|
15
|
-
if (Object.keys(
|
|
11
|
+
var p;
|
|
12
|
+
const { selectedResponseContentTypeIndex: c } = u(), o = Object.values(((p = t.dependencies) == null ? void 0 : p.responses) ?? {});
|
|
13
|
+
if (Object.keys(o).length === 0 || Object.values(o).every((e) => Object.keys(e).length === 0))
|
|
16
14
|
return null;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const l = d(t), s = i(
|
|
16
|
+
l,
|
|
17
|
+
c
|
|
18
|
+
);
|
|
19
|
+
if (Object.values(s).every((e) => Object.keys(e).length <= 1)) {
|
|
20
|
+
const a = Object.values(s).flatMap(
|
|
21
|
+
(m) => Object.values(m)
|
|
21
22
|
);
|
|
22
|
-
return /* @__PURE__ */ r(
|
|
23
|
+
return /* @__PURE__ */ r(b, { snippets: a, maxHeight: n, noMargins: !0 });
|
|
23
24
|
}
|
|
24
|
-
return /* @__PURE__ */ r(
|
|
25
|
+
return /* @__PURE__ */ r(j, { snippets: s, maxHeight: n });
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
28
|
C as GeneratedResponseExample
|
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { initialApiPlaygroundInputs as
|
|
4
|
-
import { generateSnippetMap as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as O } from "react";
|
|
3
|
+
import { initialApiPlaygroundInputs as j } from "../../constants/index.js";
|
|
4
|
+
import { generateSnippetMap as w } from "../../generators/generateSnippetMap.js";
|
|
5
|
+
import { useSelectedBaseUrl as B } from "../../hooks/useSelectedBaseUrl.js";
|
|
6
|
+
import { useSelectedRequestBodyContentType as L } from "../../hooks/useSelectedRequestBodyContentType.js";
|
|
7
|
+
import { useSelectedSecurityOption as T } from "../../hooks/useSelectedSecurityOption.js";
|
|
8
|
+
import { CodeGroupSelect as k } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
9
|
+
import { CodeSnippet as P } from "../../../components/content-components/code-snippet.js";
|
|
10
|
+
import { CodeSnippets as v } from "../../../components/content-components/code-snippets.js";
|
|
11
|
+
import { CodeBlock as h } from "../../../components/content-components/code-block.js";
|
|
12
|
+
import { CodeGroup as b } from "../../../components/content-components/code-group.js";
|
|
13
|
+
import { shikiLangToDisplayLang as G } from "../../../constants/snippetPresets.js";
|
|
14
|
+
import { useApiPlaygroundDisplay as I } from "../../../hooks/useApiPlaygroundDisplay.js";
|
|
15
|
+
import { GeneratedRequestExample as E } from "./GeneratedRequestExample.js";
|
|
16
|
+
const N = O(
|
|
17
|
+
({
|
|
18
|
+
apiReferenceData: e,
|
|
19
|
+
inputs: u = j,
|
|
20
|
+
maxHeight: i
|
|
21
|
+
}) => {
|
|
22
|
+
var g, f, y, S, q, x;
|
|
23
|
+
const n = (g = e.operation) == null ? void 0 : g.requestExamples, { selectedRequestBodyContentTypeIndex: p } = L(), { selectedSecurityOptionIndex: a } = T(), M = I(), m = (f = e.operation) == null ? void 0 : f.requestExampleLanguages, d = (y = e.operation) == null ? void 0 : y.requiredOnlyExamples, { baseUrl: s } = B();
|
|
24
|
+
switch ((S = e.operation) == null ? void 0 : S.requestExampleType) {
|
|
25
|
+
case "mdx":
|
|
26
|
+
if (!n) return null;
|
|
27
|
+
const C = n.some((o) => o.dropdown ?? !1);
|
|
28
|
+
return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown: C, noMargins: !0, className: i, children: n.map((o, t) => /* @__PURE__ */ r(
|
|
29
|
+
h,
|
|
30
|
+
{
|
|
31
|
+
language: o.language,
|
|
32
|
+
fileName: o.filename,
|
|
33
|
+
children: /* @__PURE__ */ r("span", { children: o.code })
|
|
34
|
+
},
|
|
35
|
+
`${o.filename}-${o.language}-${t}`
|
|
36
|
+
)) });
|
|
37
|
+
case "webhook":
|
|
38
|
+
return (q = n == null ? void 0 : n[0]) != null && q.code ? /* @__PURE__ */ r(b, { isSmallText: !0, noMargins: !0, hideCodeSnippetFeedbackButton: !0, children: /* @__PURE__ */ r(h, { language: "json", filename: "Example Request Body", children: /* @__PURE__ */ r(P, { language: "json", children: (x = n[0]) == null ? void 0 : x.code }) }) }) : null;
|
|
39
|
+
case "codeSamples":
|
|
40
|
+
if (!e.operation.codeSamples) return null;
|
|
41
|
+
const c = w({
|
|
42
|
+
apiReferenceData: e,
|
|
43
|
+
codeSamples: e.operation.codeSamples,
|
|
44
|
+
baseUrl: s,
|
|
45
|
+
apiPlaygroundMode: M,
|
|
46
|
+
requestExampleLanguages: m,
|
|
47
|
+
requiredOnly: d,
|
|
48
|
+
inputs: u,
|
|
49
|
+
selectedSecurityOptionIndex: a,
|
|
50
|
+
selectedRequestBodyContentTypeIndex: p
|
|
51
|
+
});
|
|
52
|
+
if (Object.values(c).every((o) => Object.keys(o).length <= 1)) {
|
|
53
|
+
let t = Object.values(c).flatMap((l) => Object.values(l));
|
|
54
|
+
return new Set(t.map((l) => l.filename)).size !== t.length && (t = t.map((l) => ({
|
|
55
|
+
...l,
|
|
56
|
+
filename: G[l.language] ?? l.language
|
|
57
|
+
}))), /* @__PURE__ */ r(v, { snippets: t, noMargins: !0, dropdown: !0 });
|
|
44
58
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
baseUrl: o.operation.baseUrl ?? o.operation.baseUrlOptions[0],
|
|
78
|
-
apiPlaygroundMode: p,
|
|
79
|
-
requestExampleLanguages: i,
|
|
80
|
-
requiredOnly: u,
|
|
81
|
-
selectedSecurityOptionIndex: d,
|
|
82
|
-
inputs: m
|
|
83
|
-
});
|
|
84
|
-
c(n);
|
|
85
|
-
}, [o, m, p, i, u]), !s) return null;
|
|
86
|
-
if (Object.values(s).every((n) => Object.keys(n).length <= 1)) {
|
|
87
|
-
let e = Object.values(s).flatMap((r) => Object.values(r));
|
|
88
|
-
return new Set(e.map((r) => r.filename)).size !== e.length && (e = e.map((r) => ({
|
|
89
|
-
...r,
|
|
90
|
-
filename: x[r.language] ?? r.language
|
|
91
|
-
}))), /* @__PURE__ */ l(U, { snippets: e, dropdown: !0, maxHeight: a });
|
|
59
|
+
return /* @__PURE__ */ r(k, { snippets: c });
|
|
60
|
+
case "generated":
|
|
61
|
+
return s ? /* @__PURE__ */ r(
|
|
62
|
+
E,
|
|
63
|
+
{
|
|
64
|
+
apiReferenceData: e,
|
|
65
|
+
baseUrl: s,
|
|
66
|
+
inputs: u,
|
|
67
|
+
selectedSecurityOptionIndex: a,
|
|
68
|
+
requestExampleLanguages: m,
|
|
69
|
+
requiredOnly: d,
|
|
70
|
+
selectedRequestBodyContentTypeIndex: p,
|
|
71
|
+
maxHeight: i
|
|
72
|
+
}
|
|
73
|
+
) : null;
|
|
74
|
+
case "examples":
|
|
75
|
+
return !e.operation.prefillPlaygroundExamples || !s ? null : /* @__PURE__ */ r(
|
|
76
|
+
E,
|
|
77
|
+
{
|
|
78
|
+
apiReferenceData: e,
|
|
79
|
+
baseUrl: s,
|
|
80
|
+
inputs: u,
|
|
81
|
+
selectedSecurityOptionIndex: a,
|
|
82
|
+
requestExampleLanguages: m,
|
|
83
|
+
requiredOnly: d,
|
|
84
|
+
selectedRequestBodyContentTypeIndex: p,
|
|
85
|
+
maxHeight: i
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
default:
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
);
|
|
93
|
+
N.displayName = "RequestExample";
|
|
95
94
|
export {
|
|
96
|
-
|
|
95
|
+
N as RequestExample
|
|
97
96
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { memo as i } from "react";
|
|
3
|
+
import { CodeBlock as t } from "../../../components/content-components/code-block.js";
|
|
4
|
+
import { CodeGroup as d } from "../../../components/content-components/code-group.js";
|
|
5
|
+
import { GeneratedResponseExample as u } from "./GeneratedResponseExample.js";
|
|
6
|
+
const f = i(
|
|
7
|
+
({ apiReferenceData: r, maxHeight: s }) => {
|
|
8
|
+
var m, p;
|
|
9
|
+
const n = (m = r.operation) == null ? void 0 : m.responseExamples;
|
|
10
|
+
if (((p = r.operation) == null ? void 0 : p.responseExampleType) === "mdx") {
|
|
11
|
+
if (!n) return null;
|
|
12
|
+
const l = n.some((e) => e.dropdown ?? !1);
|
|
13
|
+
return /* @__PURE__ */ o(d, { isSmallText: !0, dropdown: l, noMargins: !0, className: s, children: n.map((e, a) => /* @__PURE__ */ o(t, { language: e.language, fileName: e.filename, children: /* @__PURE__ */ o("span", { children: e.code }) }, `${e.filename}-${e.language}-${a}`)) });
|
|
14
|
+
} else
|
|
15
|
+
return /* @__PURE__ */ o(u, { apiReferenceData: r, maxHeight: s });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
f.displayName = "ResponseExample";
|
|
15
19
|
export {
|
|
16
|
-
|
|
20
|
+
f as ResponseExample
|
|
17
21
|
};
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { jsxs as P, Fragment as
|
|
2
|
-
import { getParametersPerSection as
|
|
3
|
-
import { InputSectionContainer as
|
|
4
|
-
import { DifferentiatedInput as
|
|
1
|
+
import { jsxs as P, Fragment as y, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { getParametersPerSection as g, isSchemaObject as x, mapParamInToPlaygroundInputKey as I, escapeDots as j } from "../../schemaGraph/utils.js";
|
|
3
|
+
import { InputSectionContainer as o } from "./InputSectionContainer.js";
|
|
4
|
+
import { DifferentiatedInput as k } from "./inputs/DifferentiatedInput.js";
|
|
5
5
|
const K = ({
|
|
6
|
-
apiReferenceData:
|
|
6
|
+
apiReferenceData: r
|
|
7
7
|
}) => {
|
|
8
|
-
const { dependencies:
|
|
9
|
-
if (!
|
|
10
|
-
const { header: h, path: u, query:
|
|
8
|
+
const { dependencies: a } = r, { parameters: i } = a ?? {};
|
|
9
|
+
if (!i || Object.keys(i).length === 0) return null;
|
|
10
|
+
const { header: h, path: u, query: d, cookie: p } = g(r), t = (e) => {
|
|
11
11
|
if (e === void 0)
|
|
12
12
|
return null;
|
|
13
|
-
if (
|
|
14
|
-
const f = `${
|
|
13
|
+
if (x(e.schema)) {
|
|
14
|
+
const f = `${I(e.in)}.${j(e.name)}`;
|
|
15
15
|
return /* @__PURE__ */ n(
|
|
16
|
-
|
|
16
|
+
k,
|
|
17
17
|
{
|
|
18
18
|
name: e.name,
|
|
19
|
-
schema: e.schema,
|
|
19
|
+
schema: { ...e.schema, description: e.description },
|
|
20
|
+
style: e.style,
|
|
21
|
+
explode: e.explode,
|
|
20
22
|
inputKeyPrefix: f
|
|
21
23
|
},
|
|
22
24
|
e.name
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
|
-
},
|
|
26
|
-
return /* @__PURE__ */ P(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
}, s = h.map(t).filter((e) => e !== null), l = p.map(t).filter((e) => e !== null), c = u.map(t).filter((e) => e !== null), m = d.map(t).filter((e) => e !== null);
|
|
28
|
+
return /* @__PURE__ */ P(y, { children: [
|
|
29
|
+
s.length > 0 && /* @__PURE__ */ n(o, { name: "Header", children: s }),
|
|
30
|
+
l.length > 0 && /* @__PURE__ */ n(o, { name: "Cookies", children: l }),
|
|
31
|
+
c.length > 0 && /* @__PURE__ */ n(o, { name: "Path", children: c }),
|
|
32
|
+
m.length > 0 && /* @__PURE__ */ n(o, { name: "Query", children: m })
|
|
31
33
|
] });
|
|
32
34
|
};
|
|
33
35
|
export {
|