@mintlify/prebuild 1.0.1284 → 1.0.1286

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.
@@ -88,10 +88,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
88
88
  sdk?: undefined;
89
89
  root?: string | undefined;
90
90
  }, "sdk"> & {
91
- openapi?: string | string[] | {
91
+ openapi?: string | {
92
92
  source: string;
93
93
  directory?: string | undefined;
94
- } | undefined;
94
+ overlays?: string[] | undefined;
95
+ } | (string | {
96
+ source: string;
97
+ directory?: string | undefined;
98
+ overlays?: string[] | undefined;
99
+ })[] | undefined;
95
100
  asyncapi?: string | string[] | {
96
101
  source: string;
97
102
  directory?: string | undefined;
@@ -123,10 +128,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
123
128
  sdk?: undefined;
124
129
  root?: string | undefined;
125
130
  }, "sdk"> & {
126
- openapi?: string | string[] | {
131
+ openapi?: string | {
127
132
  source: string;
128
133
  directory?: string | undefined;
129
- } | undefined;
134
+ overlays?: string[] | undefined;
135
+ } | (string | {
136
+ source: string;
137
+ directory?: string | undefined;
138
+ overlays?: string[] | undefined;
139
+ })[] | undefined;
130
140
  asyncapi?: string | string[] | {
131
141
  source: string;
132
142
  directory?: string | undefined;
@@ -167,10 +177,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
167
177
  post?: string[] | undefined;
168
178
  } | undefined;
169
179
  url?: "full" | undefined;
170
- openapi?: string | string[] | {
180
+ openapi?: string | {
171
181
  source: string;
172
182
  directory?: string | undefined;
173
- } | undefined;
183
+ overlays?: string[] | undefined;
184
+ } | (string | {
185
+ source: string;
186
+ directory?: string | undefined;
187
+ overlays?: string[] | undefined;
188
+ })[] | undefined;
174
189
  playground?: {
175
190
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
176
191
  proxy?: boolean | undefined;
@@ -507,10 +522,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
507
522
  sdk?: undefined;
508
523
  root?: string | undefined;
509
524
  }, "sdk"> & {
510
- openapi?: string | string[] | {
525
+ openapi?: string | {
511
526
  source: string;
512
527
  directory?: string | undefined;
513
- } | undefined;
528
+ overlays?: string[] | undefined;
529
+ } | (string | {
530
+ source: string;
531
+ directory?: string | undefined;
532
+ overlays?: string[] | undefined;
533
+ })[] | undefined;
514
534
  asyncapi?: string | string[] | {
515
535
  source: string;
516
536
  directory?: string | undefined;
@@ -542,10 +562,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
542
562
  sdk?: undefined;
543
563
  root?: string | undefined;
544
564
  }, "sdk"> & {
545
- openapi?: string | string[] | {
565
+ openapi?: string | {
546
566
  source: string;
547
567
  directory?: string | undefined;
548
- } | undefined;
568
+ overlays?: string[] | undefined;
569
+ } | (string | {
570
+ source: string;
571
+ directory?: string | undefined;
572
+ overlays?: string[] | undefined;
573
+ })[] | undefined;
549
574
  asyncapi?: string | string[] | {
550
575
  source: string;
551
576
  directory?: string | undefined;
@@ -586,10 +611,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
586
611
  post?: string[] | undefined;
587
612
  } | undefined;
588
613
  url?: "full" | undefined;
589
- openapi?: string | string[] | {
614
+ openapi?: string | {
590
615
  source: string;
591
616
  directory?: string | undefined;
592
- } | undefined;
617
+ overlays?: string[] | undefined;
618
+ } | (string | {
619
+ source: string;
620
+ directory?: string | undefined;
621
+ overlays?: string[] | undefined;
622
+ })[] | undefined;
593
623
  playground?: {
594
624
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
595
625
  proxy?: boolean | undefined;
@@ -926,10 +956,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
926
956
  sdk?: undefined;
927
957
  root?: string | undefined;
928
958
  }, "sdk"> & {
929
- openapi?: string | string[] | {
959
+ openapi?: string | {
930
960
  source: string;
931
961
  directory?: string | undefined;
932
- } | undefined;
962
+ overlays?: string[] | undefined;
963
+ } | (string | {
964
+ source: string;
965
+ directory?: string | undefined;
966
+ overlays?: string[] | undefined;
967
+ })[] | undefined;
933
968
  asyncapi?: string | string[] | {
934
969
  source: string;
935
970
  directory?: string | undefined;
@@ -961,10 +996,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
961
996
  sdk?: undefined;
962
997
  root?: string | undefined;
963
998
  }, "sdk"> & {
964
- openapi?: string | string[] | {
999
+ openapi?: string | {
965
1000
  source: string;
966
1001
  directory?: string | undefined;
967
- } | undefined;
1002
+ overlays?: string[] | undefined;
1003
+ } | (string | {
1004
+ source: string;
1005
+ directory?: string | undefined;
1006
+ overlays?: string[] | undefined;
1007
+ })[] | undefined;
968
1008
  asyncapi?: string | string[] | {
969
1009
  source: string;
970
1010
  directory?: string | undefined;
@@ -1005,10 +1045,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1005
1045
  post?: string[] | undefined;
1006
1046
  } | undefined;
1007
1047
  url?: "full" | undefined;
1008
- openapi?: string | string[] | {
1048
+ openapi?: string | {
1009
1049
  source: string;
1010
1050
  directory?: string | undefined;
1011
- } | undefined;
1051
+ overlays?: string[] | undefined;
1052
+ } | (string | {
1053
+ source: string;
1054
+ directory?: string | undefined;
1055
+ overlays?: string[] | undefined;
1056
+ })[] | undefined;
1012
1057
  playground?: {
1013
1058
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
1014
1059
  proxy?: boolean | undefined;
@@ -1345,10 +1390,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1345
1390
  sdk?: undefined;
1346
1391
  root?: string | undefined;
1347
1392
  }, "sdk"> & {
1348
- openapi?: string | string[] | {
1393
+ openapi?: string | {
1349
1394
  source: string;
1350
1395
  directory?: string | undefined;
1351
- } | undefined;
1396
+ overlays?: string[] | undefined;
1397
+ } | (string | {
1398
+ source: string;
1399
+ directory?: string | undefined;
1400
+ overlays?: string[] | undefined;
1401
+ })[] | undefined;
1352
1402
  asyncapi?: string | string[] | {
1353
1403
  source: string;
1354
1404
  directory?: string | undefined;
@@ -1380,10 +1430,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1380
1430
  sdk?: undefined;
1381
1431
  root?: string | undefined;
1382
1432
  }, "sdk"> & {
1383
- openapi?: string | string[] | {
1433
+ openapi?: string | {
1384
1434
  source: string;
1385
1435
  directory?: string | undefined;
1386
- } | undefined;
1436
+ overlays?: string[] | undefined;
1437
+ } | (string | {
1438
+ source: string;
1439
+ directory?: string | undefined;
1440
+ overlays?: string[] | undefined;
1441
+ })[] | undefined;
1387
1442
  asyncapi?: string | string[] | {
1388
1443
  source: string;
1389
1444
  directory?: string | undefined;
@@ -1424,10 +1479,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1424
1479
  post?: string[] | undefined;
1425
1480
  } | undefined;
1426
1481
  url?: "full" | undefined;
1427
- openapi?: string | string[] | {
1482
+ openapi?: string | {
1428
1483
  source: string;
1429
1484
  directory?: string | undefined;
1430
- } | undefined;
1485
+ overlays?: string[] | undefined;
1486
+ } | (string | {
1487
+ source: string;
1488
+ directory?: string | undefined;
1489
+ overlays?: string[] | undefined;
1490
+ })[] | undefined;
1431
1491
  playground?: {
1432
1492
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
1433
1493
  proxy?: boolean | undefined;
@@ -1770,10 +1830,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1770
1830
  sdk?: undefined;
1771
1831
  root?: string | undefined;
1772
1832
  }, "sdk"> & {
1773
- openapi?: string | string[] | {
1833
+ openapi?: string | {
1774
1834
  source: string;
1775
1835
  directory?: string | undefined;
1776
- } | undefined;
1836
+ overlays?: string[] | undefined;
1837
+ } | (string | {
1838
+ source: string;
1839
+ directory?: string | undefined;
1840
+ overlays?: string[] | undefined;
1841
+ })[] | undefined;
1777
1842
  asyncapi?: string | string[] | {
1778
1843
  source: string;
1779
1844
  directory?: string | undefined;
@@ -1805,10 +1870,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1805
1870
  sdk?: undefined;
1806
1871
  root?: string | undefined;
1807
1872
  }, "sdk"> & {
1808
- openapi?: string | string[] | {
1873
+ openapi?: string | {
1809
1874
  source: string;
1810
1875
  directory?: string | undefined;
1811
- } | undefined;
1876
+ overlays?: string[] | undefined;
1877
+ } | (string | {
1878
+ source: string;
1879
+ directory?: string | undefined;
1880
+ overlays?: string[] | undefined;
1881
+ })[] | undefined;
1812
1882
  asyncapi?: string | string[] | {
1813
1883
  source: string;
1814
1884
  directory?: string | undefined;
@@ -1849,10 +1919,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1849
1919
  post?: string[] | undefined;
1850
1920
  } | undefined;
1851
1921
  url?: "full" | undefined;
1852
- openapi?: string | string[] | {
1922
+ openapi?: string | {
1853
1923
  source: string;
1854
1924
  directory?: string | undefined;
1855
- } | undefined;
1925
+ overlays?: string[] | undefined;
1926
+ } | (string | {
1927
+ source: string;
1928
+ directory?: string | undefined;
1929
+ overlays?: string[] | undefined;
1930
+ })[] | undefined;
1856
1931
  playground?: {
1857
1932
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
1858
1933
  proxy?: boolean | undefined;
@@ -2189,10 +2264,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2189
2264
  sdk?: undefined;
2190
2265
  root?: string | undefined;
2191
2266
  }, "sdk"> & {
2192
- openapi?: string | string[] | {
2267
+ openapi?: string | {
2193
2268
  source: string;
2194
2269
  directory?: string | undefined;
2195
- } | undefined;
2270
+ overlays?: string[] | undefined;
2271
+ } | (string | {
2272
+ source: string;
2273
+ directory?: string | undefined;
2274
+ overlays?: string[] | undefined;
2275
+ })[] | undefined;
2196
2276
  asyncapi?: string | string[] | {
2197
2277
  source: string;
2198
2278
  directory?: string | undefined;
@@ -2224,10 +2304,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2224
2304
  sdk?: undefined;
2225
2305
  root?: string | undefined;
2226
2306
  }, "sdk"> & {
2227
- openapi?: string | string[] | {
2307
+ openapi?: string | {
2228
2308
  source: string;
2229
2309
  directory?: string | undefined;
2230
- } | undefined;
2310
+ overlays?: string[] | undefined;
2311
+ } | (string | {
2312
+ source: string;
2313
+ directory?: string | undefined;
2314
+ overlays?: string[] | undefined;
2315
+ })[] | undefined;
2231
2316
  asyncapi?: string | string[] | {
2232
2317
  source: string;
2233
2318
  directory?: string | undefined;
@@ -2268,10 +2353,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2268
2353
  post?: string[] | undefined;
2269
2354
  } | undefined;
2270
2355
  url?: "full" | undefined;
2271
- openapi?: string | string[] | {
2356
+ openapi?: string | {
2272
2357
  source: string;
2273
2358
  directory?: string | undefined;
2274
- } | undefined;
2359
+ overlays?: string[] | undefined;
2360
+ } | (string | {
2361
+ source: string;
2362
+ directory?: string | undefined;
2363
+ overlays?: string[] | undefined;
2364
+ })[] | undefined;
2275
2365
  playground?: {
2276
2366
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
2277
2367
  proxy?: boolean | undefined;
@@ -2608,10 +2698,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2608
2698
  sdk?: undefined;
2609
2699
  root?: string | undefined;
2610
2700
  }, "sdk"> & {
2611
- openapi?: string | string[] | {
2701
+ openapi?: string | {
2612
2702
  source: string;
2613
2703
  directory?: string | undefined;
2614
- } | undefined;
2704
+ overlays?: string[] | undefined;
2705
+ } | (string | {
2706
+ source: string;
2707
+ directory?: string | undefined;
2708
+ overlays?: string[] | undefined;
2709
+ })[] | undefined;
2615
2710
  asyncapi?: string | string[] | {
2616
2711
  source: string;
2617
2712
  directory?: string | undefined;
@@ -2643,10 +2738,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2643
2738
  sdk?: undefined;
2644
2739
  root?: string | undefined;
2645
2740
  }, "sdk"> & {
2646
- openapi?: string | string[] | {
2741
+ openapi?: string | {
2647
2742
  source: string;
2648
2743
  directory?: string | undefined;
2649
- } | undefined;
2744
+ overlays?: string[] | undefined;
2745
+ } | (string | {
2746
+ source: string;
2747
+ directory?: string | undefined;
2748
+ overlays?: string[] | undefined;
2749
+ })[] | undefined;
2650
2750
  asyncapi?: string | string[] | {
2651
2751
  source: string;
2652
2752
  directory?: string | undefined;
@@ -2687,10 +2787,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2687
2787
  post?: string[] | undefined;
2688
2788
  } | undefined;
2689
2789
  url?: "full" | undefined;
2690
- openapi?: string | string[] | {
2790
+ openapi?: string | {
2691
2791
  source: string;
2692
2792
  directory?: string | undefined;
2693
- } | undefined;
2793
+ overlays?: string[] | undefined;
2794
+ } | (string | {
2795
+ source: string;
2796
+ directory?: string | undefined;
2797
+ overlays?: string[] | undefined;
2798
+ })[] | undefined;
2694
2799
  playground?: {
2695
2800
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
2696
2801
  proxy?: boolean | undefined;
@@ -3027,10 +3132,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3027
3132
  sdk?: undefined;
3028
3133
  root?: string | undefined;
3029
3134
  }, "sdk"> & {
3030
- openapi?: string | string[] | {
3135
+ openapi?: string | {
3031
3136
  source: string;
3032
3137
  directory?: string | undefined;
3033
- } | undefined;
3138
+ overlays?: string[] | undefined;
3139
+ } | (string | {
3140
+ source: string;
3141
+ directory?: string | undefined;
3142
+ overlays?: string[] | undefined;
3143
+ })[] | undefined;
3034
3144
  asyncapi?: string | string[] | {
3035
3145
  source: string;
3036
3146
  directory?: string | undefined;
@@ -3062,10 +3172,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3062
3172
  sdk?: undefined;
3063
3173
  root?: string | undefined;
3064
3174
  }, "sdk"> & {
3065
- openapi?: string | string[] | {
3175
+ openapi?: string | {
3066
3176
  source: string;
3067
3177
  directory?: string | undefined;
3068
- } | undefined;
3178
+ overlays?: string[] | undefined;
3179
+ } | (string | {
3180
+ source: string;
3181
+ directory?: string | undefined;
3182
+ overlays?: string[] | undefined;
3183
+ })[] | undefined;
3069
3184
  asyncapi?: string | string[] | {
3070
3185
  source: string;
3071
3186
  directory?: string | undefined;
@@ -3106,10 +3221,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3106
3221
  post?: string[] | undefined;
3107
3222
  } | undefined;
3108
3223
  url?: "full" | undefined;
3109
- openapi?: string | string[] | {
3224
+ openapi?: string | {
3110
3225
  source: string;
3111
3226
  directory?: string | undefined;
3112
- } | undefined;
3227
+ overlays?: string[] | undefined;
3228
+ } | (string | {
3229
+ source: string;
3230
+ directory?: string | undefined;
3231
+ overlays?: string[] | undefined;
3232
+ })[] | undefined;
3113
3233
  playground?: {
3114
3234
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
3115
3235
  proxy?: boolean | undefined;
@@ -3446,10 +3566,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3446
3566
  sdk?: undefined;
3447
3567
  root?: string | undefined;
3448
3568
  }, "sdk"> & {
3449
- openapi?: string | string[] | {
3569
+ openapi?: string | {
3450
3570
  source: string;
3451
3571
  directory?: string | undefined;
3452
- } | undefined;
3572
+ overlays?: string[] | undefined;
3573
+ } | (string | {
3574
+ source: string;
3575
+ directory?: string | undefined;
3576
+ overlays?: string[] | undefined;
3577
+ })[] | undefined;
3453
3578
  asyncapi?: string | string[] | {
3454
3579
  source: string;
3455
3580
  directory?: string | undefined;
@@ -3481,10 +3606,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3481
3606
  sdk?: undefined;
3482
3607
  root?: string | undefined;
3483
3608
  }, "sdk"> & {
3484
- openapi?: string | string[] | {
3609
+ openapi?: string | {
3485
3610
  source: string;
3486
3611
  directory?: string | undefined;
3487
- } | undefined;
3612
+ overlays?: string[] | undefined;
3613
+ } | (string | {
3614
+ source: string;
3615
+ directory?: string | undefined;
3616
+ overlays?: string[] | undefined;
3617
+ })[] | undefined;
3488
3618
  asyncapi?: string | string[] | {
3489
3619
  source: string;
3490
3620
  directory?: string | undefined;
@@ -3525,10 +3655,15 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
3525
3655
  post?: string[] | undefined;
3526
3656
  } | undefined;
3527
3657
  url?: "full" | undefined;
3528
- openapi?: string | string[] | {
3658
+ openapi?: string | {
3529
3659
  source: string;
3530
3660
  directory?: string | undefined;
3531
- } | undefined;
3661
+ overlays?: string[] | undefined;
3662
+ } | (string | {
3663
+ source: string;
3664
+ directory?: string | undefined;
3665
+ overlays?: string[] | undefined;
3666
+ })[] | undefined;
3532
3667
  playground?: {
3533
3668
  display?: "auth" | "simple" | "none" | "interactive" | undefined;
3534
3669
  proxy?: boolean | undefined;
@@ -1,7 +1,8 @@
1
+ import type { OverlayRegistry } from '@mintlify/common';
1
2
  import type { OpenApiFile, DecoratedNavigationPage } from '@mintlify/models';
2
3
  import { DocsConfig } from '@mintlify/validation';
3
4
  import type { InvalidSpecFile } from '../../invalidSpecFiles.js';
4
- export declare const generateOpenApiDivisions: (docsConfig: DocsConfig, openApiFiles: OpenApiFile[], targetDir?: string, localSchema?: boolean, invalidSpecFiles?: InvalidSpecFile[], graphqlPages?: Record<string, DecoratedNavigationPage>, deferWrites?: boolean) => Promise<{
5
+ export declare const generateOpenApiDivisions: (docsConfig: DocsConfig, openApiFiles: OpenApiFile[], targetDir?: string, localSchema?: boolean, invalidSpecFiles?: InvalidSpecFile[], graphqlPages?: Record<string, DecoratedNavigationPage>, deferWrites?: boolean, overlayRegistry?: OverlayRegistry) => Promise<{
5
6
  newDocsConfig: DocsConfig;
6
7
  pagesAcc: Record<string, DecoratedNavigationPage>;
7
8
  openApiFiles: OpenApiFile[];
@@ -2,8 +2,8 @@ import fse from 'fs-extra';
2
2
  import { getOpenApiFilesFromConfig } from '../read/getOpenApiFilesFromConfig.js';
3
3
  import { assertNoGeneratedRouteCollisions } from './generatedRouteCollisions.js';
4
4
  import { generateOpenApiFromDocsConfig } from './generateOpenApiFromDocsConfig.js';
5
- export const generateOpenApiDivisions = async (docsConfig, openApiFiles, targetDir, localSchema, invalidSpecFiles, graphqlPages, deferWrites = false) => {
6
- const openapiFilesFromDocsConfig = await getOpenApiFilesFromConfig('docs', docsConfig, localSchema);
5
+ export const generateOpenApiDivisions = async (docsConfig, openApiFiles, targetDir, localSchema, invalidSpecFiles, graphqlPages, deferWrites = false, overlayRegistry) => {
6
+ const openapiFilesFromDocsConfig = await getOpenApiFilesFromConfig('docs', docsConfig, localSchema, overlayRegistry);
7
7
  openApiFiles.push(...openapiFilesFromDocsConfig);
8
8
  const pagesAcc = {};
9
9
  const writes = [];
@@ -14,6 +14,7 @@ export const generateOpenApiDivisions = async (docsConfig, openApiFiles, targetD
14
14
  targetDir,
15
15
  localSchema,
16
16
  invalidSpecFiles,
17
+ overlayRegistry,
17
18
  ...(planWrites
18
19
  ? {
19
20
  writeFile: (filename, content) => {
@@ -1,3 +1,4 @@
1
+ import { type OverlayRegistry } from '@mintlify/common';
1
2
  import type { OpenApiFile, DecoratedNavigationPage } from '@mintlify/models';
2
3
  import { NavigationConfig } from '@mintlify/validation';
3
4
  import { type InvalidSpecFile } from '../../invalidSpecFiles.js';
@@ -9,6 +10,9 @@ export declare const generateOpenApiFromDocsConfig: (navigation: NavigationConfi
9
10
  invalidSpecFiles?: InvalidSpecFile[];
10
11
  mountPaths?: string[];
11
12
  writeFile?: (filename: string, content: string) => void | Promise<void>;
13
+ overlayRegistry?: OverlayRegistry;
14
+ /** SSRF-safe fetch override for hosted spec URLs; supplied by server environments. */
15
+ fetchRemoteDocument?: (url: string) => Promise<unknown>;
12
16
  }) => Promise<{
13
17
  newNav: NavigationConfig;
14
18
  newOpenApiFiles: OpenApiFile[];
@@ -1,4 +1,4 @@
1
- import { getOpenApiDocumentFromUrl, optionallyAddLeadingSlash, isAllowedLocalSchemaUrl, potentiallyParseOpenApiString, findNavGroup, findOpenApiPath, } from '@mintlify/common';
1
+ import { getOpenApiDocumentFromUrl, optionallyAddLeadingSlash, isAllowedLocalSchemaUrl, potentiallyParseOpenApiString, findNavGroup, findOpenApiPath, resolveOverlaysForSpec, } from '@mintlify/common';
2
2
  import { readObjectArrayProperty } from '@mintlify/common/divisions/iterateObjectArrayProperty';
3
3
  import { generateOpenApiPagesForDocsConfig } from '@mintlify/scraping';
4
4
  import { processOpenApiPath, processOpenApiWebhook, } from '@mintlify/scraping/bin/openapi/common.js';
@@ -19,7 +19,7 @@ const getMountPathForPath = (candidatePath, mountPaths) => {
19
19
  };
20
20
  const resolveMountPath = (specPath, outputDir, mountPaths) => getMountPathForPath(specPath, mountPaths) || getMountPathForPath(outputDir, mountPaths);
21
21
  export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pagesAcc, opts) => {
22
- const { overwrite, writeFiles, targetDir, localSchema, invalidSpecFiles, mountPaths = [], writeFile, } = opts;
22
+ const { overwrite, writeFiles, targetDir, localSchema, invalidSpecFiles, mountPaths = [], writeFile, overlayRegistry, fetchRemoteDocument, } = opts;
23
23
  const newOpenApiFiles = [];
24
24
  const openApiFilePromises = new Map();
25
25
  async function processOpenApiInNav(nav) {
@@ -31,7 +31,14 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
31
31
  }
32
32
  else if (Array.isArray(nav.openapi) && nav.openapi.length > 0) {
33
33
  // TODO: handle multiple openapi files
34
- openapi = nav.openapi[0];
34
+ const firstEntry = nav.openapi[0];
35
+ if (typeof firstEntry === 'string') {
36
+ openapi = firstEntry;
37
+ }
38
+ else if (firstEntry != undefined) {
39
+ openapi = firstEntry.source;
40
+ outputDir = firstEntry.directory ?? DEFAULT_OUTPUT_DIR;
41
+ }
35
42
  }
36
43
  else if (typeof nav.openapi === 'object' && 'source' in nav.openapi) {
37
44
  openapi = nav.openapi.source;
@@ -42,7 +49,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
42
49
  let openApiFile = undefined;
43
50
  if (isAllowedLocalSchemaUrl(openapi, localSchema)) {
44
51
  if (!openApiFilePromises.has(openapi)) {
45
- const promise = createOpenApiFile(openapi);
52
+ const promise = createOpenApiFile(openapi, overlayRegistry, fetchRemoteDocument);
46
53
  openApiFilePromises.set(openapi, promise);
47
54
  openApiFile = await promise;
48
55
  newOpenApiFiles.push(openApiFile);
@@ -102,7 +109,14 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
102
109
  return { source: openapiProp, directory: undefined };
103
110
  }
104
111
  else if (Array.isArray(openapiProp) && openapiProp.length > 0) {
105
- return { source: openapiProp[0], directory: undefined };
112
+ const firstEntry = openapiProp[0];
113
+ if (typeof firstEntry === 'string') {
114
+ return { source: firstEntry, directory: undefined };
115
+ }
116
+ if (firstEntry != undefined) {
117
+ return { source: firstEntry.source, directory: firstEntry.directory };
118
+ }
119
+ return { source: undefined, directory: undefined };
106
120
  }
107
121
  else if (typeof openapiProp === 'object' &&
108
122
  'source' in openapiProp &&
@@ -150,7 +164,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
150
164
  if (openapiPath) {
151
165
  if (isAllowedLocalSchemaUrl(openapiPath, localSchema)) {
152
166
  if (!openApiFilePromises.has(openapiPath)) {
153
- const promise = createOpenApiFile(openapiPath);
167
+ const promise = createOpenApiFile(openapiPath, overlayRegistry, fetchRemoteDocument);
154
168
  openApiFilePromises.set(openapiPath, promise);
155
169
  openApiFile = await promise;
156
170
  newOpenApiFiles.push(openApiFile);
@@ -318,9 +332,12 @@ function getDivisionNav(nav) {
318
332
  }
319
333
  return undefined;
320
334
  }
321
- async function createOpenApiFile(openApiUrl) {
335
+ async function createOpenApiFile(openApiUrl, overlayRegistry, fetchRemoteDocument) {
322
336
  try {
323
- const document = await getOpenApiDocumentFromUrl(openApiUrl);
337
+ const overlays = overlayRegistry
338
+ ? await resolveOverlaysForSpec(overlayRegistry, openApiUrl)
339
+ : undefined;
340
+ const document = await getOpenApiDocumentFromUrl(openApiUrl, { overlays, fetchRemoteDocument });
324
341
  return {
325
342
  filename: openApiUrl,
326
343
  spec: document,
@@ -1,9 +1,9 @@
1
- import { AsyncAPIFile } from '@mintlify/common';
1
+ import { AsyncAPIFile, type OverlayRegistry } from '@mintlify/common';
2
2
  import { OpenApiFile, DecoratedNavigationPage } from '@mintlify/models';
3
3
  import type { SdkFormat } from '@mintlify/scraping';
4
4
  import { DocsConfig } from '@mintlify/validation';
5
5
  import type { InvalidSpecFile } from '../../invalidSpecFiles.js';
6
- export declare function updateDocsConfigFile({ contentDirectoryPath, openApiFiles, asyncApiFiles, docsConfig, localSchema, disableOpenApi, strict, invalidSpecFiles, allowSourceRefs, }: {
6
+ export declare function updateDocsConfigFile({ contentDirectoryPath, openApiFiles, asyncApiFiles, docsConfig, localSchema, disableOpenApi, strict, invalidSpecFiles, allowSourceRefs, overlayRegistry, }: {
7
7
  contentDirectoryPath: string;
8
8
  openApiFiles: OpenApiFile[];
9
9
  asyncApiFiles: AsyncAPIFile[];
@@ -13,6 +13,7 @@ export declare function updateDocsConfigFile({ contentDirectoryPath, openApiFile
13
13
  strict?: boolean;
14
14
  invalidSpecFiles?: InvalidSpecFile[];
15
15
  allowSourceRefs?: boolean;
16
+ overlayRegistry?: OverlayRegistry;
16
17
  }): Promise<{
17
18
  docsConfig: DocsConfig;
18
19
  pagesAcc: Record<string, DecoratedNavigationPage>;
@@ -54,7 +54,7 @@ async function scanSdkFrontmatterMetadata(contentDirectoryPath, navigation) {
54
54
  }));
55
55
  return metadataBySlug;
56
56
  }
57
- export async function updateDocsConfigFile({ contentDirectoryPath, openApiFiles, asyncApiFiles, docsConfig, localSchema, disableOpenApi, strict, invalidSpecFiles, allowSourceRefs, }) {
57
+ export async function updateDocsConfigFile({ contentDirectoryPath, openApiFiles, asyncApiFiles, docsConfig, localSchema, disableOpenApi, strict, invalidSpecFiles, allowSourceRefs, overlayRegistry, }) {
58
58
  const configPath = await getConfigPath(contentDirectoryPath, 'docs');
59
59
  if (configPath == null && docsConfig == null) {
60
60
  throw Error(NOT_CORRECT_PATH_ERROR);
@@ -71,7 +71,7 @@ export async function updateDocsConfigFile({ contentDirectoryPath, openApiFiles,
71
71
  const graphqlResult = await generateGraphqlDivisionsFromDocsConfig(docsConfig, (source) => loadGraphqlSdlSource(source, contentDirectoryPath));
72
72
  const { newDocsConfig: docsConfigWithGraphqlPages, pagesAcc: pagesAccWithGraphqlPages } = graphqlResult;
73
73
  const { newDocsConfig: docsConfigWithOpenApiPages, pagesAcc: pagesAccWithOpenApiPages, openApiFiles: newOpenApiFiles, flushWrites: flushOpenApiWrites, } = !disableOpenApi
74
- ? await generateOpenApiDivisions(docsConfigWithGraphqlPages, openApiFiles, undefined, localSchema, invalidSpecFiles, pagesAccWithGraphqlPages, true)
74
+ ? await generateOpenApiDivisions(docsConfigWithGraphqlPages, openApiFiles, undefined, localSchema, invalidSpecFiles, pagesAccWithGraphqlPages, true, overlayRegistry)
75
75
  : {
76
76
  newDocsConfig: docsConfigWithGraphqlPages,
77
77
  pagesAcc: {},