@mintlify/msft-sdk 1.1.24 → 1.1.26
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/ApiPlaygroundContext.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +46 -45
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/index.js +18 -18
- package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -1
- package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +20 -21
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +10 -11
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -1
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -1
- package/dist/api-playground/ApiPlayground/index.js +30 -30
- package/dist/api-playground/ApiPlayground/index.js.map +1 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -1
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -1
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -1
- package/dist/api-playground/EndpointFields/components/Description.js.map +1 -1
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -1
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -1
- package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -1
- package/dist/api-playground/EndpointFields/index.js.map +1 -1
- package/dist/api-playground-2/Api.js.map +1 -1
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/ApiFields.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -1
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +17 -15
- package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Example/ResponseExample.js.map +1 -1
- package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -1
- package/dist/api-playground-2/components/TypeDropdown.js.map +1 -1
- package/dist/api-playground-2/constants/index.js +12 -3
- package/dist/api-playground-2/constants/index.js.map +1 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +10 -10
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +24 -24
- package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +41 -0
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/errors.js +19 -0
- package/dist/api-playground-2/schemaGraph/errors.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js +26 -0
- package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/getDocumentProperties.js +58 -0
- package/dist/api-playground-2/schemaGraph/getDocumentProperties.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +77 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js +16 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/processExamples.js +111 -34
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js +283 -0
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/resolveGraphNode.js +61 -0
- package/dist/api-playground-2/schemaGraph/resolveGraphNode.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +149 -0
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +33 -0
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +35 -0
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/utils.js +144 -98
- package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
- package/dist/common/parseApiTargetFromMetadata.js +24 -0
- package/dist/common/parseApiTargetFromMetadata.js.map +1 -0
- package/dist/common/parseOpenApiString.js +42 -0
- package/dist/common/parseOpenApiString.js.map +1 -0
- package/dist/components/Api/ApiReferenceProvider.js +6 -15
- package/dist/components/Api/ApiReferenceProvider.js.map +1 -1
- package/dist/components/Api/ErrorBoundary.js.map +1 -1
- package/dist/components/Api/Expandable.js.map +1 -1
- package/dist/components/Api/Markdown.js.map +1 -1
- package/dist/components/Api/MethodPill.js.map +1 -1
- package/dist/components/Api/Param.js.map +1 -1
- package/dist/components/Api/colors.js.map +1 -1
- package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js.map +1 -1
- package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js.map +1 -1
- package/dist/components/content-components/CodeGroupSelect/index.js.map +1 -1
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/code-group.js.map +1 -1
- package/dist/components/content-components/code-snippet.js.map +1 -1
- package/dist/components/content-components/code-snippets.js.map +1 -1
- package/dist/components/content-components/getNodeText.js.map +1 -1
- package/dist/components/docsLayout.js +29 -27
- package/dist/components/docsLayout.js.map +1 -1
- package/dist/components/nav-tree/index.js +165 -156
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/contexts/CodeExampleLabelContext.js.map +1 -1
- package/dist/contexts/ConfigContext.js +61 -12
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/contexts/EndpointLocationContext.js.map +1 -1
- package/dist/contexts/MDXContentContext.js +0 -1
- package/dist/contexts/MDXContentContext.js.map +1 -1
- package/dist/hooks/useApiPlaygroundDisplay.js.map +1 -1
- package/dist/hooks/useApiPlaygroundInputs.js.map +1 -1
- package/dist/hooks/useBaseUrlOptions.js.map +1 -1
- package/dist/hooks/useEndpoint.js.map +1 -1
- package/dist/hooks/useKeyboardShortcut.js.map +1 -1
- package/dist/hooks/useMDXContent.js.map +1 -1
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -1
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -1
- package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -1
- package/dist/hooks/usePrefilledInputs/index.js.map +1 -1
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -1
- package/dist/hooks/useSecurityOption.js.map +1 -1
- package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
- package/dist/index.d.ts +129 -11
- package/dist/index.js +156 -144
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/hooks/useCurrentPath.js +0 -17
- package/dist/hooks/useCurrentPath.js.map +0 -1
- package/dist/utils/decodeSlug.js +0 -8
- package/dist/utils/decodeSlug.js.map +0 -1
- package/dist/utils/optionallyAddLeadingSlash.js +0 -7
- package/dist/utils/optionallyAddLeadingSlash.js.map +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { CIRCULAR_REF_KEY as b } from "../constants/index.js";
|
|
2
|
+
import { reduceExpandedSchema as h } from "./reduceCompositions.js";
|
|
3
|
+
import { sortSchemaByRequired as l } from "./sortSchemaByRequired.js";
|
|
4
|
+
import { flattenSingleOneOf as v, isSchemaObject as u, isCircularRef as j } from "./utils.js";
|
|
5
|
+
import { addUniqueKeysToSchema as p } from "./addUniqueKeysToSchema.js";
|
|
6
|
+
import { generateExamplesFromSchema as q } from "./processExamples.js";
|
|
7
|
+
import { resolveGraphNode as R, deeplyResolveGraphNode as d } from "./resolveGraphNode.js";
|
|
8
|
+
const _ = ({
|
|
9
|
+
operationId: m,
|
|
10
|
+
uuidObjectHashMap: o,
|
|
11
|
+
hashedNodeMap: n
|
|
12
|
+
}) => {
|
|
13
|
+
const e = R({
|
|
14
|
+
uuidObjectHashMap: o,
|
|
15
|
+
hashedNodeMap: n,
|
|
16
|
+
id: m
|
|
17
|
+
});
|
|
18
|
+
if (!e)
|
|
19
|
+
return;
|
|
20
|
+
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), c = e.parameters;
|
|
21
|
+
c == null || c.forEach((a) => {
|
|
22
|
+
if (typeof a != "string") return;
|
|
23
|
+
const f = B(a, o, n);
|
|
24
|
+
f && "name" in f && "in" in f && t.set(a, f);
|
|
25
|
+
});
|
|
26
|
+
let s;
|
|
27
|
+
const i = e.requestBody;
|
|
28
|
+
i && typeof i == "string" && (s = g(i, o, n), s && (s.content = q(s.content)));
|
|
29
|
+
const E = e.responses;
|
|
30
|
+
E && Object.values(E).forEach((a) => {
|
|
31
|
+
if (typeof a != "string") return;
|
|
32
|
+
const f = y(a, o, n);
|
|
33
|
+
f && f.content && (f.content = q(f.content)), f && r.set(a, f);
|
|
34
|
+
});
|
|
35
|
+
const O = {
|
|
36
|
+
operation: e,
|
|
37
|
+
parameters: Object.fromEntries(t),
|
|
38
|
+
requestBody: s,
|
|
39
|
+
responses: Object.fromEntries(r)
|
|
40
|
+
}, S = C(O, o, n);
|
|
41
|
+
return {
|
|
42
|
+
operation: e,
|
|
43
|
+
dependencies: {
|
|
44
|
+
parameters: Object.fromEntries(t),
|
|
45
|
+
requestBody: s,
|
|
46
|
+
responses: Object.fromEntries(r)
|
|
47
|
+
},
|
|
48
|
+
schemas: Object.keys(S).length > 0 ? S : void 0
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
function g(m, o, n) {
|
|
52
|
+
let e = d({
|
|
53
|
+
uuidObjectHashMap: o,
|
|
54
|
+
hashedNodeMap: n,
|
|
55
|
+
id: m
|
|
56
|
+
});
|
|
57
|
+
if (e)
|
|
58
|
+
return e = v(e), Object.values(e.content).forEach((t) => {
|
|
59
|
+
if (t.schema && u(t.schema)) {
|
|
60
|
+
let r = h({
|
|
61
|
+
schema: t.schema,
|
|
62
|
+
depth: 0,
|
|
63
|
+
location: "request"
|
|
64
|
+
});
|
|
65
|
+
r = l(r), r = p(r, ""), t.schema = r;
|
|
66
|
+
}
|
|
67
|
+
}), e;
|
|
68
|
+
}
|
|
69
|
+
function y(m, o, n) {
|
|
70
|
+
let e = d({
|
|
71
|
+
uuidObjectHashMap: o,
|
|
72
|
+
hashedNodeMap: n,
|
|
73
|
+
id: m
|
|
74
|
+
});
|
|
75
|
+
if (e)
|
|
76
|
+
return e = v(e), e.content && Object.values(e.content).forEach((t) => {
|
|
77
|
+
if (t.schema && u(t.schema)) {
|
|
78
|
+
let r = h({
|
|
79
|
+
schema: t.schema,
|
|
80
|
+
depth: 0,
|
|
81
|
+
location: "response"
|
|
82
|
+
});
|
|
83
|
+
r = l(r), r = p(r, ""), t.schema = r;
|
|
84
|
+
}
|
|
85
|
+
}), e;
|
|
86
|
+
}
|
|
87
|
+
function B(m, o, n) {
|
|
88
|
+
let e = d({
|
|
89
|
+
uuidObjectHashMap: o,
|
|
90
|
+
hashedNodeMap: n,
|
|
91
|
+
id: m
|
|
92
|
+
});
|
|
93
|
+
if (e) {
|
|
94
|
+
if (e = v(e), "schema" in e && e.schema && u(e.schema)) {
|
|
95
|
+
let t = h({
|
|
96
|
+
schema: e.schema,
|
|
97
|
+
depth: 0,
|
|
98
|
+
location: "request"
|
|
99
|
+
});
|
|
100
|
+
t = l(t), t = p(t, ""), e.schema = t;
|
|
101
|
+
}
|
|
102
|
+
return "content" in e && e.content && Object.values(e.content).forEach((t) => {
|
|
103
|
+
if (t.schema && u(t.schema)) {
|
|
104
|
+
let r = h({
|
|
105
|
+
schema: t.schema,
|
|
106
|
+
depth: 0,
|
|
107
|
+
location: "request"
|
|
108
|
+
});
|
|
109
|
+
r = l(r), r = p(r, ""), t.schema = r;
|
|
110
|
+
}
|
|
111
|
+
}), e;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function C(m, o, n, e = /* @__PURE__ */ new Set()) {
|
|
115
|
+
const t = {}, r = (c) => {
|
|
116
|
+
if (c != null) {
|
|
117
|
+
if (j(c)) {
|
|
118
|
+
const s = c[b];
|
|
119
|
+
if (!e.has(s)) {
|
|
120
|
+
e.add(s);
|
|
121
|
+
let i = d({
|
|
122
|
+
uuidObjectHashMap: o,
|
|
123
|
+
hashedNodeMap: n,
|
|
124
|
+
id: s
|
|
125
|
+
});
|
|
126
|
+
if (!i) return;
|
|
127
|
+
i = h({
|
|
128
|
+
schema: i,
|
|
129
|
+
depth: 0,
|
|
130
|
+
location: "request"
|
|
131
|
+
}), i = l(i), t[s] = i, r(i);
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (Array.isArray(c)) {
|
|
136
|
+
c.forEach(r);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (typeof c == "object")
|
|
140
|
+
for (const s of Object.values(c))
|
|
141
|
+
r(s);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return r(m), t;
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
_ as resolveOperationWithDependencies
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=resolveOperationWithDependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOperationWithDependencies.js","sources":["../../../src/api-playground-2/schemaGraph/resolveOperationWithDependencies.ts"],"sourcesContent":["import type {\n HashedNodeMap,\n HttpMethod,\n Operation,\n ParameterObject,\n RequestBodyObject,\n ResponseObject,\n ParameterOrRef,\n UUID,\n UUIDObjectHashMap,\n MediaObject,\n SchemaObject,\n} from '@mintlify/validation';\n\nimport { CIRCULAR_REF_KEY } from '@/api-playground-2/constants';\nimport { reduceExpandedSchema } from '@/api-playground-2/schemaGraph/reduceCompositions';\nimport { sortSchemaByRequired } from '@/api-playground-2/schemaGraph/sortSchemaByRequired';\nimport {\n flattenSingleOneOf,\n isSchemaObject,\n isCircularRef,\n} from '@/api-playground-2/schemaGraph/utils';\n\nimport { addUniqueKeysToSchema } from './addUniqueKeysToSchema';\nimport { generateExamplesFromSchema } from './processExamples';\nimport { deeplyResolveGraphNode, resolveGraphNode } from './resolveGraphNode';\n\nexport type ResolvedEndpoint = {\n deprecated: boolean;\n description: string;\n method: HttpMethod;\n path: string;\n request: {\n body: UUID | undefined;\n parameters: UUID[] | undefined;\n security: UUID[] | undefined;\n };\n // e.g. { '200': 'uuid-here', '400': 'uuid-here' }\n response: Record<string, UUID> | undefined;\n type: 'path' | 'webhook';\n};\n\nexport type ResolvedOperationData = {\n operation: Operation;\n dependencies: {\n parameters?: Record<UUID, ParameterObject>;\n requestBody?: RequestBodyObject;\n responses?: Record<UUID, ResponseObject>;\n };\n schemas?: Record<UUID, SchemaObject>;\n};\n\nexport const resolveOperationWithDependencies = ({\n operationId,\n uuidObjectHashMap,\n hashedNodeMap,\n}: {\n operationId: UUID;\n uuidObjectHashMap: UUIDObjectHashMap;\n hashedNodeMap: HashedNodeMap;\n}): ResolvedOperationData | undefined => {\n const operation = resolveGraphNode<Operation>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: operationId,\n });\n\n if (!operation) {\n return undefined;\n }\n\n const parameters = new Map<UUID, ParameterObject>();\n const responses = new Map<UUID, ResponseObject>();\n\n const parameterIds = operation.parameters;\n parameterIds?.forEach((paramId) => {\n if (typeof paramId !== 'string') return;\n const parameter = resolveParameter(paramId, uuidObjectHashMap, hashedNodeMap);\n if (parameter && 'name' in parameter && 'in' in parameter) {\n parameters.set(paramId, parameter);\n }\n });\n\n let requestBody: RequestBodyObject | undefined;\n const requestBodyId = operation.requestBody;\n if (requestBodyId && typeof requestBodyId === 'string') {\n requestBody = resolveRequestBody(requestBodyId, uuidObjectHashMap, hashedNodeMap);\n\n if (requestBody) {\n requestBody.content = generateExamplesFromSchema(requestBody.content);\n }\n }\n\n const responsesMap = operation.responses;\n if (responsesMap) {\n Object.values(responsesMap).forEach((responseId) => {\n if (typeof responseId !== 'string') return;\n const response = resolveResponse(responseId, uuidObjectHashMap, hashedNodeMap);\n\n if (response && response.content) {\n response.content = generateExamplesFromSchema(response.content);\n }\n\n if (response) {\n responses.set(responseId, response);\n }\n });\n }\n\n // Collect all schemas with circular references\n const allResolvedObjects = {\n operation,\n parameters: Object.fromEntries(parameters),\n requestBody,\n responses: Object.fromEntries(responses),\n };\n\n const schemas = collectCircularSchemas(allResolvedObjects, uuidObjectHashMap, hashedNodeMap);\n\n // we're using Maps above for the ergonomics, but we convert to JS objects at return time\n // for better serialization.\n return {\n operation,\n dependencies: {\n parameters: Object.fromEntries(parameters),\n requestBody,\n responses: Object.fromEntries(responses),\n },\n schemas: Object.keys(schemas).length > 0 ? schemas : undefined,\n };\n};\n\nfunction resolveRequestBody(\n requestBodyId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): RequestBodyObject | undefined {\n let requestBody = deeplyResolveGraphNode<RequestBodyObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: requestBodyId,\n });\n if (!requestBody) return undefined;\n\n requestBody = flattenSingleOneOf<RequestBodyObject>(requestBody);\n\n Object.values(requestBody.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n\n return requestBody;\n}\n\nfunction resolveResponse(\n responseId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): ResponseObject | undefined {\n let response = deeplyResolveGraphNode<ResponseObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: responseId,\n });\n if (!response) return undefined;\n\n response = flattenSingleOneOf<ResponseObject>(response);\n\n if (response.content) {\n Object.values(response.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'response',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n }\n\n return response;\n}\n\nfunction resolveParameter(\n parameterId: UUID,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap\n): ParameterOrRef | undefined {\n let parameter = deeplyResolveGraphNode<ParameterOrRef>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: parameterId,\n });\n if (!parameter) return undefined;\n\n parameter = flattenSingleOneOf<ParameterOrRef>(parameter);\n\n if ('schema' in parameter && parameter.schema && isSchemaObject(parameter.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: parameter.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (parameter as any).schema = resolvedSchema;\n }\n\n if ('content' in parameter && parameter.content) {\n Object.values(parameter.content).forEach((mediaType) => {\n if (mediaType.schema && isSchemaObject(mediaType.schema)) {\n let resolvedSchema = reduceExpandedSchema({\n schema: mediaType.schema,\n depth: 0,\n location: 'request',\n });\n resolvedSchema = sortSchemaByRequired(resolvedSchema);\n resolvedSchema = addUniqueKeysToSchema(resolvedSchema, '');\n // replace the schema id with the resolved schema\n \n (mediaType as MediaObject).schema = resolvedSchema;\n }\n });\n }\n\n return parameter;\n}\n\n/**\n * Collect all schemas that have circular references by walking through the resolved objects.\n * Returns a map of UUID -> SchemaObject for schemas that contain circular refs.\n */\nfunction collectCircularSchemas(\n obj: unknown,\n uuidObjectHashMap: UUIDObjectHashMap,\n hashedNodeMap: HashedNodeMap,\n visited = new Set<UUID>()\n): Record<UUID, SchemaObject> {\n const schemas: Record<UUID, SchemaObject> = {};\n\n const collect = (value: unknown): void => {\n if (value == null) return;\n\n // If we encounter a circular ref, collect the referenced schema\n if (isCircularRef(value)) {\n const uuid = value[CIRCULAR_REF_KEY];\n if (!visited.has(uuid)) {\n visited.add(uuid);\n let node = deeplyResolveGraphNode<SchemaObject>({\n uuidObjectHashMap,\n hashedNodeMap,\n id: uuid,\n });\n\n if (!node) return;\n\n node = reduceExpandedSchema({\n schema: node,\n depth: 0,\n location: 'request',\n });\n node = sortSchemaByRequired(node);\n\n schemas[uuid] = node;\n // Recursively collect from this schema too\n collect(node);\n }\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach(collect);\n return;\n }\n\n if (typeof value === 'object') {\n for (const v of Object.values(value)) {\n collect(v);\n }\n }\n };\n\n collect(obj);\n return schemas;\n}\n"],"names":["resolveOperationWithDependencies","operationId","uuidObjectHashMap","hashedNodeMap","operation","resolveGraphNode","parameters","responses","parameterIds","paramId","parameter","resolveParameter","requestBody","requestBodyId","resolveRequestBody","generateExamplesFromSchema","responsesMap","responseId","response","resolveResponse","allResolvedObjects","schemas","collectCircularSchemas","deeplyResolveGraphNode","flattenSingleOneOf","mediaType","isSchemaObject","resolvedSchema","reduceExpandedSchema","sortSchemaByRequired","addUniqueKeysToSchema","parameterId","obj","visited","collect","value","isCircularRef","uuid","CIRCULAR_REF_KEY","node","v"],"mappings":";;;;;;;AAoDO,MAAMA,IAAmC,CAAC;AAAA,EAC/C,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC;AACF,MAIyC;AACvC,QAAMC,IAAYC,EAA4B;AAAA,IAC5C,mBAAAH;AAAA,IACA,eAAAC;AAAA,IACA,IAAIF;AAAA,EAAA,CACL;AAED,MAAI,CAACG;AACH;AAGF,QAAME,wBAAiB,IAAA,GACjBC,wBAAgB,IAAA,GAEhBC,IAAeJ,EAAU;AAC/B,EAAAI,KAAA,QAAAA,EAAc,QAAQ,CAACC,MAAY;AACjC,QAAI,OAAOA,KAAY,SAAU;AACjC,UAAMC,IAAYC,EAAiBF,GAASP,GAAmBC,CAAa;AAC5E,IAAIO,KAAa,UAAUA,KAAa,QAAQA,KAC9CJ,EAAW,IAAIG,GAASC,CAAS;AAAA,EAErC;AAEA,MAAIE;AACJ,QAAMC,IAAgBT,EAAU;AAChC,EAAIS,KAAiB,OAAOA,KAAkB,aAC5CD,I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chema.js";
|
|
2
|
+
import { reduceExpandedSchema as n } from "./reduceCompositions.js";
|
|
3
|
+
import { deeplyResolveGraphNode as t } from "./resolveGraphNode.js";
|
|
4
|
+
import { sortSchemaByRequired as c } from "./sortSchemaByRequired.js";
|
|
5
|
+
function p(o, r) {
|
|
6
|
+
const d = r.spec.refUuidMap[o];
|
|
7
|
+
if (d)
|
|
8
|
+
return d;
|
|
9
|
+
}
|
|
10
|
+
function a({
|
|
11
|
+
schemaPath: o,
|
|
12
|
+
schemaGraphData: r
|
|
13
|
+
}) {
|
|
14
|
+
const d = p(o, r);
|
|
15
|
+
if (!d)
|
|
16
|
+
throw new Error(`no matching OpenAPI schema found with path "${o}"`);
|
|
17
|
+
let e = t({
|
|
18
|
+
uuidObjectHashMap: r.spec.uuidObjectHashMap,
|
|
19
|
+
hashedNodeMap: r.spec.hashedNodeMap,
|
|
20
|
+
id: d
|
|
21
|
+
});
|
|
22
|
+
if (!e)
|
|
23
|
+
throw new Error(`no matching OpenAPI schema found with id "${o}"`);
|
|
24
|
+
return e = n({
|
|
25
|
+
schema: e,
|
|
26
|
+
depth: 0,
|
|
27
|
+
location: "request"
|
|
28
|
+
}), e = c(e), e = i(e, ""), e;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
a as resolveSchemaWithDependencies
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=resolveSchemaWithDependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSchemaWithDependencies.js","sources":["../../../src/api-playground-2/schemaGraph/resolveSchemaWithDependencies.ts"],"sourcesContent":["import { SchemaGraphData } from '@mintlify/validation';\n\nimport { addUniqueKeysToSchema } from '@/api-playground-2/schemaGraph/addUniqueKeysToSchema';\nimport { reduceExpandedSchema } from '@/api-playground-2/schemaGraph/reduceCompositions';\nimport { deeplyResolveGraphNode } from '@/api-playground-2/schemaGraph/resolveGraphNode';\nimport { sortSchemaByRequired } from '@/api-playground-2/schemaGraph/sortSchemaByRequired';\nimport { SchemaV2 } from '@/api-playground-2/types';\n\nfunction getSchemaId(schemaString: string, graph: SchemaGraphData) {\n const schemaUuid = graph.spec.refUuidMap[schemaString];\n if (!schemaUuid) return undefined;\n return schemaUuid;\n}\n\nexport function resolveSchemaWithDependencies({\n schemaPath,\n schemaGraphData,\n}: {\n schemaPath: string;\n schemaGraphData: SchemaGraphData;\n}): SchemaV2 {\n const schemaId = getSchemaId(schemaPath, schemaGraphData);\n if (!schemaId) {\n throw new Error(`no matching OpenAPI schema found with path \"${schemaPath}\"`);\n }\n let schema = deeplyResolveGraphNode<SchemaV2>({\n uuidObjectHashMap: schemaGraphData.spec.uuidObjectHashMap,\n hashedNodeMap: schemaGraphData.spec.hashedNodeMap,\n id: schemaId,\n });\n if (!schema) {\n throw new Error(`no matching OpenAPI schema found with id \"${schemaPath}\"`);\n }\n schema = reduceExpandedSchema({\n schema,\n depth: 0,\n location: 'request',\n });\n schema = sortSchemaByRequired(schema);\n schema = addUniqueKeysToSchema(schema, '');\n\n return schema;\n}\n"],"names":["getSchemaId","schemaString","graph","schemaUuid","resolveSchemaWithDependencies","schemaPath","schemaGraphData","schemaId","schema","deeplyResolveGraphNode","reduceExpandedSchema","sortSchemaByRequired","addUniqueKeysToSchema"],"mappings":";;;;AAQA,SAASA,EAAYC,GAAsBC,GAAwB;AACjE,QAAMC,IAAaD,EAAM,KAAK,WAAWD,CAAY;AACrD,MAAKE;AACL,WAAOA;AACT;AAEO,SAASC,EAA8B;AAAA,EAC5C,YAAAC;AAAA,EACA,iBAAAC;AACF,GAGa;AACX,QAAMC,IAAWP,EAAYK,GAAYC,CAAe;AACxD,MAAI,CAACC;AACH,UAAM,IAAI,MAAM,+CAA+CF,CAAU,GAAG;AAE9E,MAAIG,IAASC,EAAiC;AAAA,IAC5C,mBAAmBH,EAAgB,KAAK;AAAA,IACxC,eAAeA,EAAgB,KAAK;AAAA,IACpC,IAAIC;AAAA,EAAA,CACL;AACD,MAAI,CAACC;AACH,UAAM,IAAI,MAAM,6CAA6CH,CAAU,GAAG;AAE5E,SAAAG,IAASE,EAAqB;AAAA,IAC5B,QAAAF;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,EAAA,CACX,GACDA,IAASG,EAAqBH,CAAM,GACpCA,IAASI,EAAsBJ,GAAQ,EAAE,GAElCA;AACT;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isSchemaObject as o } from "./utils.js";
|
|
2
|
+
const u = (r) => {
|
|
3
|
+
if (!o(r))
|
|
4
|
+
return r;
|
|
5
|
+
if (r.oneOf && Array.isArray(r.oneOf))
|
|
6
|
+
return {
|
|
7
|
+
...r,
|
|
8
|
+
oneOf: r.oneOf.map(
|
|
9
|
+
(t) => o(t) ? u(t) : t
|
|
10
|
+
)
|
|
11
|
+
};
|
|
12
|
+
if (r.type === "object" && r.properties) {
|
|
13
|
+
const t = new Set(r.required || []), d = Object.entries(r.properties).filter(
|
|
14
|
+
(e) => o(e[1])
|
|
15
|
+
).sort(([e], [i]) => {
|
|
16
|
+
const n = t.has(e), s = t.has(i);
|
|
17
|
+
return n === s ? 0 : n ? -1 : 1;
|
|
18
|
+
}), f = {};
|
|
19
|
+
return d.forEach(([e, i]) => {
|
|
20
|
+
const n = t.has(e), s = o(i) ? u(i) : i;
|
|
21
|
+
f[e] = n ? { ...s, isRequired: !0 } : s;
|
|
22
|
+
}), {
|
|
23
|
+
...r,
|
|
24
|
+
properties: f
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return r.type === "array" && o(r.items) ? {
|
|
28
|
+
...r,
|
|
29
|
+
items: u(r.items)
|
|
30
|
+
} : r;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
u as sortSchemaByRequired
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=sortSchemaByRequired.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortSchemaByRequired.js","sources":["../../../src/api-playground-2/schemaGraph/sortSchemaByRequired.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport type { ResolvedSchemaObject } from '@/api-playground-2/types';\n\n/**\n * Mutate a SchemaObject to sort its properties by whether or not they are required. Transforms\n * a schema's `required: string[]` field into individual `isRequired: true` fields on the respective\n * properties.\n */\nexport const sortSchemaByRequired = (schema: SchemaObject): ResolvedSchemaObject => {\n if (!isSchemaObject(schema)) {\n return schema;\n }\n\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return {\n ...schema,\n oneOf: schema.oneOf.map((subSchema) =>\n isSchemaObject(subSchema) ? sortSchemaByRequired(subSchema) : subSchema\n ),\n };\n }\n\n if (schema.type === 'object' && schema.properties) {\n const requiredSet = new Set(schema.required || []);\n const entries = Object.entries(schema.properties).filter(\n (entry): entry is [string, SchemaObject] => isSchemaObject(entry[1])\n );\n\n const sortedEntries = entries.sort(([nameA], [nameB]) => {\n const isRequiredA = requiredSet.has(nameA);\n const isRequiredB = requiredSet.has(nameB);\n if (isRequiredA === isRequiredB) return 0;\n return isRequiredA ? -1 : 1;\n });\n\n const sortedProperties: Record<string, SchemaObject> = {};\n sortedEntries.forEach(([name, propSchema]) => {\n const isRequired = requiredSet.has(name);\n const processedSchema = isSchemaObject(propSchema)\n ? sortSchemaByRequired(propSchema)\n : propSchema;\n\n sortedProperties[name] = isRequired\n ? { ...processedSchema, isRequired: true }\n : processedSchema;\n });\n\n return {\n ...schema,\n properties: sortedProperties,\n };\n }\n\n if (schema.type === 'array' && isSchemaObject(schema.items)) {\n return {\n ...schema,\n items: sortSchemaByRequired(schema.items),\n };\n }\n\n return schema;\n};\n"],"names":["sortSchemaByRequired","schema","isSchemaObject","subSchema","requiredSet","sortedEntries","entry","nameA","nameB","isRequiredA","isRequiredB","sortedProperties","name","propSchema","isRequired","processedSchema"],"mappings":";AAUO,MAAMA,IAAuB,CAACC,MAA+C;AAClF,MAAI,CAACC,EAAeD,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of e == "object" && e !== null &&
|
|
2
|
+
import { apiPlaygroundInputKeys as c, initialApiPlaygroundInputs as O, CIRCULAR_REF_KEY as A, stringFileFormats as S, combinationKeys as g, MAX_SCHEMA_COMBINATION_SIZE as k } from "../constants/index.js";
|
|
3
|
+
function j(e) {
|
|
4
|
+
return typeof e == "object" && e !== null && A in e && typeof e[A] == "string";
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const B = () => ({ oneOf: [] }), T = () => ({ oneOf: [{}] }), m = (e) => typeof e == "object" && e !== null && !Array.isArray(e), x = (e) => a(e) && Array.isArray(e.oneOf), a = (e) => m(e) ? "type" in e || "properties" in e || "oneOf" in e || "anyOf" in e || "allOf" in e || "items" in e || "additionalProperties" in e || "enum" in e || "const" in e || "format" in e || "pattern" in e || "minimum" in e || "maximum" in e || "minLength" in e || "maxLength" in e || "minItems" in e || "maxItems" in e || "minProperties" in e || "maxProperties" in e || "required" in e || "nullable" in e || "description" in e : !1, K = (e) => a(e) && e.type === "array";
|
|
7
|
+
function R(e) {
|
|
8
|
+
const t = Array.isArray(e.oneOf) ? e.oneOf.length : 1, n = Array.isArray(e.anyOf) ? e.anyOf.length : 1, r = Array.isArray(e.allOf) ? e.allOf.length : 1, i = [t, n, r];
|
|
9
|
+
return g.forEach((o) => {
|
|
10
|
+
if (e[o]) {
|
|
11
|
+
const u = e[o];
|
|
12
|
+
i.push(Object.keys(u).length), g.forEach((f) => {
|
|
13
|
+
if (u[f]) {
|
|
14
|
+
const p = u[f];
|
|
15
|
+
i.push(Object.keys(p).length), g.forEach((b) => {
|
|
16
|
+
if (p[b]) {
|
|
17
|
+
const P = p[b];
|
|
18
|
+
i.push(Object.keys(P).length);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}), i.reduce((o, u) => o * u, 1) > k;
|
|
25
|
+
}
|
|
26
|
+
const D = (e, t, n) => t[n] ?? e[n], v = (e, t, n, r) => e[n] !== void 0 && t[n] !== void 0 ? r(e[n], t[n]) : e[n] ?? t[n], L = (e) => e.oneOf && e.oneOf.length === 1 ? e.oneOf[0] : e, y = (e) => {
|
|
27
|
+
let t = { ...e };
|
|
28
|
+
if (t.properties && typeof t.properties == "object") {
|
|
29
|
+
const n = {};
|
|
30
|
+
for (const [r, i] of Object.entries(t.properties))
|
|
31
|
+
a(i) ? n[r] = y(i) : n[r] = i;
|
|
32
|
+
t.properties = n;
|
|
33
|
+
}
|
|
34
|
+
if ("items" in t && t.items && typeof t.items == "object" && a(t.items) && (t.items = y(t.items)), t.additionalProperties && typeof t.additionalProperties == "object" && a(t.additionalProperties) && (t.additionalProperties = y(t.additionalProperties)), t.oneOf && Array.isArray(t.oneOf) && t.oneOf.length > 1) {
|
|
35
|
+
const r = t.oneOf.map((i) => a(i) ? y(i) : i);
|
|
36
|
+
t.oneOf = r;
|
|
37
|
+
}
|
|
38
|
+
if ("oneOf" in t && t.oneOf && Array.isArray(t.oneOf) && t.oneOf.length === 1) {
|
|
39
|
+
const n = t.oneOf[0];
|
|
40
|
+
if (a(n))
|
|
41
|
+
return t = { ...t, ...n }, delete t.oneOf, y(t);
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
}, N = (e) => {
|
|
7
45
|
if (e.oneOf)
|
|
8
46
|
return "oneOf";
|
|
9
47
|
if (e.enum)
|
|
@@ -17,56 +55,56 @@ const l = (e) => typeof e == "object" && e !== null && !Array.isArray(e), p = (e
|
|
|
17
55
|
default:
|
|
18
56
|
return e.type;
|
|
19
57
|
}
|
|
20
|
-
return e.format &&
|
|
21
|
-
},
|
|
58
|
+
return e.format && S.includes(e.format) ? "file" : e.type;
|
|
59
|
+
}, $ = (e) => "enum" in e && e.enum !== void 0, F = (e) => "placeholder" in e && typeof e.placeholder == "string" ? e.placeholder : void 0, M = (e) => e.type === "string", _ = (e) => e.type === "number" || e.type === "integer", z = (e) => {
|
|
22
60
|
var n;
|
|
23
61
|
const t = {};
|
|
24
|
-
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([r,
|
|
25
|
-
var o,
|
|
26
|
-
const
|
|
27
|
-
|
|
62
|
+
return Object.entries(((n = e.operation) == null ? void 0 : n.responses) ?? {}).forEach(([r, i]) => {
|
|
63
|
+
var o, u;
|
|
64
|
+
const s = (u = (o = e.dependencies) == null ? void 0 : o.responses) == null ? void 0 : u[i];
|
|
65
|
+
s && s.content && (t[r] = s.content);
|
|
28
66
|
}), t;
|
|
29
|
-
},
|
|
30
|
-
var o,
|
|
31
|
-
const t = (
|
|
67
|
+
}, w = (e) => {
|
|
68
|
+
var o, u, f;
|
|
69
|
+
const t = (u = (o = e.dependencies) == null ? void 0 : o.requestBody) == null ? void 0 : u.content;
|
|
32
70
|
if (t === void 0)
|
|
33
|
-
return [
|
|
71
|
+
return [O];
|
|
34
72
|
const r = Object.keys(t)[0];
|
|
35
73
|
if (!r)
|
|
36
|
-
return [
|
|
37
|
-
const
|
|
38
|
-
for (const
|
|
39
|
-
"value" in
|
|
40
|
-
...
|
|
41
|
-
body:
|
|
74
|
+
return [O];
|
|
75
|
+
const i = Object.values(((f = t[r]) == null ? void 0 : f.examples) ?? {}), s = [];
|
|
76
|
+
for (const p of i)
|
|
77
|
+
"value" in p && s.push({
|
|
78
|
+
...O,
|
|
79
|
+
body: p.value
|
|
42
80
|
});
|
|
43
|
-
return
|
|
44
|
-
},
|
|
81
|
+
return s;
|
|
82
|
+
}, U = (e) => {
|
|
45
83
|
var n;
|
|
46
84
|
const t = (n = e.dependencies) == null ? void 0 : n.parameters;
|
|
47
85
|
if (t) {
|
|
48
|
-
const r = Object.values(t),
|
|
49
|
-
(
|
|
50
|
-
),
|
|
86
|
+
const r = Object.values(t), i = r.filter(
|
|
87
|
+
(f) => !("in" in f) || f.in === "header"
|
|
88
|
+
), s = r.filter((f) => f.in === "cookie"), o = r.filter((f) => f.in === "path"), u = r.filter((f) => f.in === "query");
|
|
51
89
|
return {
|
|
52
|
-
header:
|
|
90
|
+
header: i,
|
|
53
91
|
path: o,
|
|
54
|
-
query:
|
|
55
|
-
cookie:
|
|
92
|
+
query: u,
|
|
93
|
+
cookie: s
|
|
56
94
|
};
|
|
57
95
|
}
|
|
58
96
|
return { header: [], path: [], query: [], cookie: [] };
|
|
59
|
-
},
|
|
97
|
+
}, C = (e) => {
|
|
60
98
|
let t;
|
|
61
99
|
if (e)
|
|
62
100
|
return typeof e == "object" && "default" in e && (t = e.default), typeof e == "object" && "x-default" in e && (t = e["x-default"]), t;
|
|
63
|
-
},
|
|
101
|
+
}, V = (e, t, n, r) => {
|
|
64
102
|
if (t.uniqueKey) {
|
|
65
|
-
const
|
|
66
|
-
return `${e ? e + "." : ""}${t.uniqueKey}${
|
|
103
|
+
const i = n || r;
|
|
104
|
+
return `${e ? e + "." : ""}${t.uniqueKey}${i ? "." + i : ""}`;
|
|
67
105
|
} else
|
|
68
106
|
return e;
|
|
69
|
-
},
|
|
107
|
+
}, H = () => ({
|
|
70
108
|
oneOf: [
|
|
71
109
|
{
|
|
72
110
|
type: "string"
|
|
@@ -98,24 +136,24 @@ const l = (e) => typeof e == "object" && e !== null && !Array.isArray(e), p = (e
|
|
|
98
136
|
type: "null"
|
|
99
137
|
}
|
|
100
138
|
]
|
|
101
|
-
}),
|
|
102
|
-
var
|
|
103
|
-
const n = (
|
|
139
|
+
}), W = (e, t) => {
|
|
140
|
+
var i, s;
|
|
141
|
+
const n = (s = (i = e.dependencies) == null ? void 0 : i.requestBody) == null ? void 0 : s.content;
|
|
104
142
|
return n === void 0 ? void 0 : Object.keys(n)[t];
|
|
105
|
-
},
|
|
143
|
+
}, X = (e) => e.replace(/\./g, "\\."), Y = (e) => {
|
|
106
144
|
switch (e) {
|
|
107
145
|
case "header":
|
|
108
|
-
return
|
|
146
|
+
return c.header;
|
|
109
147
|
case "path":
|
|
110
|
-
return
|
|
148
|
+
return c.path;
|
|
111
149
|
case "query":
|
|
112
|
-
return
|
|
150
|
+
return c.query;
|
|
113
151
|
case "cookie":
|
|
114
|
-
return
|
|
152
|
+
return c.cookie;
|
|
115
153
|
default:
|
|
116
|
-
return
|
|
154
|
+
return c.header;
|
|
117
155
|
}
|
|
118
|
-
},
|
|
156
|
+
}, Z = (e) => {
|
|
119
157
|
const t = {
|
|
120
158
|
server: {},
|
|
121
159
|
header: {},
|
|
@@ -127,102 +165,110 @@ const l = (e) => typeof e == "object" && e !== null && !Array.isArray(e), p = (e
|
|
|
127
165
|
return Object.entries(e).forEach(([n, r]) => {
|
|
128
166
|
if (r == null)
|
|
129
167
|
return;
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
168
|
+
const i = n.split(new RegExp("(?<!\\\\)\\.")).map((f) => f.replace(/\\\./g, "."));
|
|
169
|
+
if (i.length < 2) {
|
|
132
170
|
n === "body" && (t.body = r);
|
|
133
171
|
return;
|
|
134
172
|
}
|
|
135
|
-
const [
|
|
136
|
-
!
|
|
137
|
-
t[
|
|
173
|
+
const [s, ...o] = i, u = Object.values(c);
|
|
174
|
+
!s || !u.includes(s) || (s !== c.body ? q(
|
|
175
|
+
t[s],
|
|
138
176
|
[...o],
|
|
139
177
|
r
|
|
140
|
-
) : [...o].length === 0 ? t.body = r : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}),
|
|
141
|
-
}),
|
|
142
|
-
},
|
|
143
|
-
if (!
|
|
178
|
+
) : [...o].length === 0 ? t.body = r : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}), q(t.body, o, r)));
|
|
179
|
+
}), d(t);
|
|
180
|
+
}, h = (e) => {
|
|
181
|
+
if (!m(e))
|
|
144
182
|
return !1;
|
|
145
183
|
const t = Object.keys(e);
|
|
146
184
|
return t.length === 0 ? !1 : t.every((n) => /^\d+$/.test(n));
|
|
147
|
-
},
|
|
185
|
+
}, d = (e) => {
|
|
148
186
|
if (e == null)
|
|
149
187
|
return e;
|
|
150
188
|
if (Array.isArray(e))
|
|
151
|
-
return e.map(
|
|
152
|
-
if (
|
|
153
|
-
if (
|
|
154
|
-
return Object.keys(e).sort((
|
|
189
|
+
return e.map(d);
|
|
190
|
+
if (m(e)) {
|
|
191
|
+
if (h(e))
|
|
192
|
+
return Object.keys(e).sort((i, s) => Number(i) - Number(s)).map((i) => e[i]).map(d);
|
|
155
193
|
const t = {};
|
|
156
194
|
for (const [n, r] of Object.entries(e))
|
|
157
|
-
t[n] =
|
|
195
|
+
t[n] = d(r);
|
|
158
196
|
return t;
|
|
159
197
|
}
|
|
160
198
|
return e;
|
|
161
|
-
},
|
|
199
|
+
}, q = (e, t, n) => {
|
|
162
200
|
const r = [];
|
|
163
|
-
for (let
|
|
164
|
-
const o = t[
|
|
201
|
+
for (let s = 0; s < t.length; s++) {
|
|
202
|
+
const o = t[s];
|
|
165
203
|
if (o === "oneOf") {
|
|
166
|
-
|
|
204
|
+
s++;
|
|
167
205
|
continue;
|
|
168
206
|
}
|
|
169
207
|
o === "additionalProperties" || o === "items" || o && r.push(o);
|
|
170
208
|
}
|
|
171
|
-
let
|
|
172
|
-
for (let
|
|
173
|
-
const o = r[
|
|
174
|
-
|
|
209
|
+
let i = e;
|
|
210
|
+
for (let s = 0; s < r.length; s++) {
|
|
211
|
+
const o = r[s];
|
|
212
|
+
s === r.length - 1 ? o && (i[o] = n) : (o && (!i[o] || typeof i[o] != "object") && (i[o] = {}), o && (i = i[o]));
|
|
175
213
|
}
|
|
176
|
-
},
|
|
214
|
+
}, G = (e) => e.filter((n) => "enum" in n && n.enum && "const" in n ? n.enum.includes(n.const) : !0), l = (e) => {
|
|
177
215
|
const t = {};
|
|
178
216
|
if ("uniqueKey" in e && e.uniqueKey !== void 0) {
|
|
179
|
-
const n =
|
|
217
|
+
const n = C(e);
|
|
180
218
|
if (n !== void 0) {
|
|
181
|
-
const r = `${
|
|
219
|
+
const r = `${c.body}.${e.uniqueKey}`;
|
|
182
220
|
t[r] = n;
|
|
183
221
|
}
|
|
184
222
|
}
|
|
185
223
|
if ("oneOf" in e && Array.isArray(e.oneOf) && e.oneOf.forEach((n) => {
|
|
186
|
-
if (
|
|
187
|
-
const r =
|
|
224
|
+
if (a(n)) {
|
|
225
|
+
const r = l(n);
|
|
188
226
|
Object.assign(t, r);
|
|
189
227
|
}
|
|
190
228
|
}), e.type === "object" && e.properties && Object.values(e.properties).forEach((n) => {
|
|
191
|
-
if (
|
|
192
|
-
const r =
|
|
229
|
+
if (a(n)) {
|
|
230
|
+
const r = l(n);
|
|
193
231
|
Object.assign(t, r);
|
|
194
232
|
}
|
|
195
|
-
}), e.additionalProperties && typeof e.additionalProperties == "object" &&
|
|
196
|
-
const n =
|
|
233
|
+
}), e.additionalProperties && typeof e.additionalProperties == "object" && a(e.additionalProperties)) {
|
|
234
|
+
const n = l(e.additionalProperties);
|
|
197
235
|
Object.assign(t, n);
|
|
198
236
|
}
|
|
199
|
-
if (e.type === "array" && "items" in e &&
|
|
200
|
-
const n =
|
|
237
|
+
if (e.type === "array" && "items" in e && a(e.items)) {
|
|
238
|
+
const n = l(e.items);
|
|
201
239
|
Object.assign(t, n);
|
|
202
240
|
}
|
|
203
241
|
return t;
|
|
204
242
|
};
|
|
205
243
|
export {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
244
|
+
v as combine,
|
|
245
|
+
H as convertAnySchemaToOneOfs,
|
|
246
|
+
B as createEmptyReducedSchema,
|
|
247
|
+
T as createUnknownReducedSchema,
|
|
248
|
+
X as escapeDots,
|
|
249
|
+
G as filterSchemasWithConsts,
|
|
250
|
+
y as flattenSchemaOneOfs,
|
|
251
|
+
L as flattenSingleOneOf,
|
|
252
|
+
w as generatePrefillRequestData,
|
|
253
|
+
l as getBodyDefaultsFromSchema,
|
|
254
|
+
N as getDifferentiatedType,
|
|
255
|
+
U as getParametersPerSection,
|
|
256
|
+
W as getRequestBodyContentType,
|
|
257
|
+
C as getSchemaDefault,
|
|
258
|
+
F as getSchemaPlaceholder,
|
|
259
|
+
V as getUniqueInputKey,
|
|
260
|
+
K as isArrayObject,
|
|
261
|
+
j as isCircularRef,
|
|
262
|
+
$ as isEnum,
|
|
263
|
+
_ as isNumberSchema,
|
|
264
|
+
m as isPlainRecord,
|
|
265
|
+
x as isReducedSchema,
|
|
266
|
+
a as isSchemaObject,
|
|
267
|
+
M as isStringSchema,
|
|
268
|
+
Y as mapParamInToPlaygroundInputKey,
|
|
269
|
+
z as mapResponseExamples,
|
|
270
|
+
R as shouldTruncateForSize,
|
|
271
|
+
D as takeLast,
|
|
272
|
+
Z as unflattenInputs
|
|
227
273
|
};
|
|
228
274
|
//# sourceMappingURL=utils.js.map
|