@mintlify/prebuild 1.0.799 → 1.0.800
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.
|
@@ -82,31 +82,41 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
82
82
|
if ('openapi' in nav && nav.openapi !== null) {
|
|
83
83
|
const openapiProp = nav.openapi;
|
|
84
84
|
if (typeof openapiProp === 'string') {
|
|
85
|
-
return openapiProp;
|
|
85
|
+
return { source: openapiProp, directory: undefined };
|
|
86
86
|
}
|
|
87
87
|
else if (Array.isArray(openapiProp) && openapiProp.length > 0) {
|
|
88
|
-
return openapiProp[0];
|
|
88
|
+
return { source: openapiProp[0], directory: undefined };
|
|
89
89
|
}
|
|
90
90
|
else if (typeof openapiProp === 'object' &&
|
|
91
91
|
'source' in openapiProp &&
|
|
92
92
|
typeof openapiProp.source === 'string') {
|
|
93
|
-
|
|
93
|
+
const directory = 'directory' in openapiProp && typeof openapiProp.directory === 'string'
|
|
94
|
+
? openapiProp.directory
|
|
95
|
+
: undefined;
|
|
96
|
+
return {
|
|
97
|
+
source: openapiProp.source,
|
|
98
|
+
directory,
|
|
99
|
+
};
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
|
-
return undefined;
|
|
102
|
+
return { source: undefined, directory: undefined };
|
|
97
103
|
}
|
|
98
104
|
const skipBulkForNode = new Set();
|
|
99
105
|
const skipBulkForNodeId = new Set();
|
|
100
106
|
let numNodes = 0;
|
|
101
|
-
async function processNav(nav, inheritedOpenApi, openApiOwner) {
|
|
107
|
+
async function processNav(nav, inheritedOpenApi, inheritedDirectory, openApiOwner) {
|
|
102
108
|
const nodeId = numNodes++;
|
|
103
|
-
const
|
|
104
|
-
const
|
|
109
|
+
const extracted = extractOpenApiFromNav(nav);
|
|
110
|
+
const currentOpenApi = extracted.source ?? inheritedOpenApi;
|
|
111
|
+
const currentDirectory = extracted.source
|
|
112
|
+
? extracted.directory
|
|
113
|
+
: extracted.directory ?? inheritedDirectory;
|
|
114
|
+
const currentOpenApiOwner = extracted.source ? nodeId : openApiOwner;
|
|
105
115
|
let newNav = nav;
|
|
106
116
|
if ('pages' in newNav) {
|
|
107
117
|
newNav.pages = await Promise.all(newNav.pages.map(async (page) => {
|
|
108
118
|
if (typeof page === 'object' && page !== null && 'group' in page) {
|
|
109
|
-
return processNav(page, currentOpenApi, currentOpenApiOwner);
|
|
119
|
+
return processNav(page, currentOpenApi, currentDirectory, currentOpenApiOwner);
|
|
110
120
|
}
|
|
111
121
|
if (typeof page !== 'string') {
|
|
112
122
|
return page;
|
|
@@ -152,7 +162,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
152
162
|
processOpenApiWebhook(endpoint, webhookObject, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
|
|
153
163
|
openApiFilePath: openApiFile.originalFileLocation,
|
|
154
164
|
writeFiles,
|
|
155
|
-
outDir: DEFAULT_OUTPUT_DIR,
|
|
165
|
+
outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
|
|
156
166
|
outDirBasePath: path.join(targetDir ?? '', 'src', '_props'),
|
|
157
167
|
overwrite,
|
|
158
168
|
localSchema,
|
|
@@ -170,7 +180,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
170
180
|
processOpenApiPath(endpoint, { [method.toLowerCase()]: opObject }, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
|
|
171
181
|
openApiFilePath: openApiFile.originalFileLocation,
|
|
172
182
|
writeFiles,
|
|
173
|
-
outDir: DEFAULT_OUTPUT_DIR,
|
|
183
|
+
outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
|
|
174
184
|
outDirBasePath: path.join(targetDir ?? '', 'src', '_props'),
|
|
175
185
|
overwrite,
|
|
176
186
|
localSchema,
|
|
@@ -209,7 +219,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
209
219
|
const items = newNav[division];
|
|
210
220
|
newNav = {
|
|
211
221
|
...newNav,
|
|
212
|
-
[division]: await Promise.all(items.map((item) => processNav(item, currentOpenApi, currentOpenApiOwner))),
|
|
222
|
+
[division]: await Promise.all(items.map((item) => processNav(item, currentOpenApi, currentDirectory, currentOpenApiOwner))),
|
|
213
223
|
};
|
|
214
224
|
}
|
|
215
225
|
}
|
|
@@ -218,10 +228,10 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
218
228
|
}
|
|
219
229
|
return newNav;
|
|
220
230
|
}
|
|
221
|
-
const navAfterExplicit = await processNav(navigation, undefined);
|
|
231
|
+
const navAfterExplicit = await processNav(navigation, undefined, undefined, undefined);
|
|
222
232
|
async function generateBulkNav(node) {
|
|
223
233
|
let updated = node;
|
|
224
|
-
if (extractOpenApiFromNav(updated) && !skipBulkForNode.has(updated)) {
|
|
234
|
+
if (extractOpenApiFromNav(updated).source && !skipBulkForNode.has(updated)) {
|
|
225
235
|
const processed = await processOpenApiInNav(updated);
|
|
226
236
|
if (processed)
|
|
227
237
|
updated = processed;
|