@mintlify/prebuild 1.0.1285 → 1.0.1287
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/prebuild/categorizeFilePaths.d.ts +9 -2
- package/dist/prebuild/categorizeFilePaths.js +61 -15
- package/dist/prebuild/discoverOverlayFiles.d.ts +12 -0
- package/dist/prebuild/discoverOverlayFiles.js +56 -0
- package/dist/prebuild/getOpenApiFiles.d.ts +6 -1
- package/dist/prebuild/getOpenApiFiles.js +44 -4
- package/dist/prebuild/index.d.ts +8 -0
- package/dist/prebuild/index.js +39 -2
- package/dist/prebuild/invalidSpecFiles.d.ts +1 -1
- package/dist/prebuild/invalidSpecFiles.js +5 -1
- package/dist/prebuild/update/ConfigUpdater.d.ts +234 -99
- package/dist/prebuild/update/docsConfig/generateOpenApiDivisions.d.ts +2 -1
- package/dist/prebuild/update/docsConfig/generateOpenApiDivisions.js +3 -2
- package/dist/prebuild/update/docsConfig/generateOpenApiFromDocsConfig.d.ts +4 -0
- package/dist/prebuild/update/docsConfig/generateOpenApiFromDocsConfig.js +25 -8
- package/dist/prebuild/update/docsConfig/index.d.ts +3 -2
- package/dist/prebuild/update/docsConfig/index.js +2 -2
- package/dist/prebuild/update/index.d.ts +237 -101
- package/dist/prebuild/update/index.js +2 -1
- package/dist/prebuild/update/read/getOpenApiFilesFromConfig.d.ts +2 -1
- package/dist/prebuild/update/read/getOpenApiFilesFromConfig.js +10 -18
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -58,7 +58,7 @@ const filterToImportClosure = (snippetV2Filenames, rootFilenames, fileImportsMap
|
|
|
58
58
|
}
|
|
59
59
|
return snippetV2Filenames.filter((filename) => needed.has(filename.toLowerCase()));
|
|
60
60
|
};
|
|
61
|
-
export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, disablePrefetch, strict, invalidSpecFiles, allowSourceRefs, lazyPages, pageScans, fileImportsMap, }) => {
|
|
61
|
+
export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, disablePrefetch, strict, invalidSpecFiles, allowSourceRefs, lazyPages, pageScans, fileImportsMap, overlayRegistry, }) => {
|
|
62
62
|
const mintConfigResult = await updateMintConfigFile(contentDirectoryPath, openApiFiles, localSchema, strict, invalidSpecFiles);
|
|
63
63
|
// we used the original mint config without openapi pages injected
|
|
64
64
|
// because we will do it in `updateDocsConfigFile`, this will avoid duplicated openapi pages
|
|
@@ -73,6 +73,7 @@ export const update = async ({ contentDirectoryPath, staticFilenames, openApiFil
|
|
|
73
73
|
strict,
|
|
74
74
|
invalidSpecFiles,
|
|
75
75
|
allowSourceRefs,
|
|
76
|
+
overlayRegistry,
|
|
76
77
|
});
|
|
77
78
|
let contentFilenamesToParse = contentFilenames;
|
|
78
79
|
if (lazyPages) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type OverlayRegistry } from '@mintlify/common';
|
|
1
2
|
import type { ConfigType, MintConfig, OpenApiFile } from '@mintlify/models';
|
|
2
3
|
import { DocsConfig } from '@mintlify/validation';
|
|
3
4
|
type ConfigInput<T extends ConfigType> = T extends 'docs' ? DocsConfig : MintConfig;
|
|
4
|
-
export declare const getOpenApiFilesFromConfig: <T extends ConfigType>(type: T, config: ConfigInput<T>, localSchema?: boolean) => Promise<OpenApiFile[]>;
|
|
5
|
+
export declare const getOpenApiFilesFromConfig: <T extends ConfigType>(type: T, config: ConfigInput<T>, localSchema?: boolean, overlayRegistry?: OverlayRegistry, fetchRemoteDocument?: (url: string) => Promise<unknown>) => Promise<OpenApiFile[]>;
|
|
5
6
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { getOpenApiDocumentFromUrl, isAllowedLocalSchemaUrl } from '@mintlify/common';
|
|
2
|
-
|
|
1
|
+
import { getOpenApiDocumentFromUrl, isAllowedLocalSchemaUrl, resolveOverlaysForSpec, } from '@mintlify/common';
|
|
2
|
+
import { extractOpenApiEntries } from '@mintlify/validation';
|
|
3
|
+
export const getOpenApiFilesFromConfig = async (type, config, localSchema, overlayRegistry, fetchRemoteDocument) => {
|
|
3
4
|
let openapi;
|
|
4
5
|
if (type === 'docs') {
|
|
5
6
|
openapi = config.api?.openapi;
|
|
@@ -10,28 +11,19 @@ export const getOpenApiFilesFromConfig = async (type, config, localSchema) => {
|
|
|
10
11
|
const openApiFiles = [];
|
|
11
12
|
// Download OpenApi file if url is provided
|
|
12
13
|
async function addOpenApiFileFromUrl(openapi) {
|
|
13
|
-
const
|
|
14
|
+
const overlays = overlayRegistry
|
|
15
|
+
? await resolveOverlaysForSpec(overlayRegistry, openapi)
|
|
16
|
+
: undefined;
|
|
17
|
+
const specFromUrl = await getOpenApiDocumentFromUrl(openapi, { overlays, fetchRemoteDocument });
|
|
14
18
|
openApiFiles.push({
|
|
15
19
|
filename: openapi,
|
|
16
20
|
spec: specFromUrl,
|
|
17
21
|
originalFileLocation: openapi,
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
await addOpenApiFileFromUrl(
|
|
23
|
-
}
|
|
24
|
-
else if (Array.isArray(openapi)) {
|
|
25
|
-
for (const openapiUrl of openapi) {
|
|
26
|
-
if (typeof openapiUrl === 'string' && isAllowedLocalSchemaUrl(openapiUrl, localSchema)) {
|
|
27
|
-
await addOpenApiFileFromUrl(openapiUrl);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if (typeof openapi === 'object' &&
|
|
32
|
-
'source' in openapi &&
|
|
33
|
-
isAllowedLocalSchemaUrl(openapi.source, localSchema)) {
|
|
34
|
-
await addOpenApiFileFromUrl(openapi.source);
|
|
24
|
+
for (const entry of extractOpenApiEntries(openapi)) {
|
|
25
|
+
if (isAllowedLocalSchemaUrl(entry.source, localSchema)) {
|
|
26
|
+
await addOpenApiFileFromUrl(entry.source);
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
return openApiFiles;
|