@mintlify/prebuild 1.0.1349 → 1.0.1351
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/update/ConfigUpdater.d.ts +36 -18
- package/dist/prebuild/update/docsConfig/generateGraphqlDivisions.d.ts +1 -0
- package/dist/prebuild/update/docsConfig/generateGraphqlDivisions.js +91 -42
- package/dist/prebuild/update/index.d.ts +36 -18
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -87,7 +87,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
87
87
|
hidden?: boolean | undefined;
|
|
88
88
|
sdk?: undefined;
|
|
89
89
|
root?: string | undefined;
|
|
90
|
-
}, "sdk"> & {
|
|
90
|
+
}, "graphql" | "sdk"> & {
|
|
91
91
|
openapi?: string | {
|
|
92
92
|
source: string;
|
|
93
93
|
directory?: string | undefined;
|
|
@@ -103,6 +103,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
103
103
|
} | undefined;
|
|
104
104
|
} & {
|
|
105
105
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
106
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
106
107
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
107
108
|
})[];
|
|
108
109
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -127,7 +128,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
127
128
|
hidden?: boolean | undefined;
|
|
128
129
|
sdk?: undefined;
|
|
129
130
|
root?: string | undefined;
|
|
130
|
-
}, "sdk"> & {
|
|
131
|
+
}, "graphql" | "sdk"> & {
|
|
131
132
|
openapi?: string | {
|
|
132
133
|
source: string;
|
|
133
134
|
directory?: string | undefined;
|
|
@@ -143,6 +144,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
143
144
|
} | undefined;
|
|
144
145
|
} & {
|
|
145
146
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
147
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
146
148
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
147
149
|
}))[];
|
|
148
150
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -525,7 +527,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
525
527
|
hidden?: boolean | undefined;
|
|
526
528
|
sdk?: undefined;
|
|
527
529
|
root?: string | undefined;
|
|
528
|
-
}, "sdk"> & {
|
|
530
|
+
}, "graphql" | "sdk"> & {
|
|
529
531
|
openapi?: string | {
|
|
530
532
|
source: string;
|
|
531
533
|
directory?: string | undefined;
|
|
@@ -541,6 +543,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
541
543
|
} | undefined;
|
|
542
544
|
} & {
|
|
543
545
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
546
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
544
547
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
545
548
|
})[];
|
|
546
549
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -565,7 +568,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
565
568
|
hidden?: boolean | undefined;
|
|
566
569
|
sdk?: undefined;
|
|
567
570
|
root?: string | undefined;
|
|
568
|
-
}, "sdk"> & {
|
|
571
|
+
}, "graphql" | "sdk"> & {
|
|
569
572
|
openapi?: string | {
|
|
570
573
|
source: string;
|
|
571
574
|
directory?: string | undefined;
|
|
@@ -581,6 +584,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
581
584
|
} | undefined;
|
|
582
585
|
} & {
|
|
583
586
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
587
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
584
588
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
585
589
|
}))[];
|
|
586
590
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -963,7 +967,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
963
967
|
hidden?: boolean | undefined;
|
|
964
968
|
sdk?: undefined;
|
|
965
969
|
root?: string | undefined;
|
|
966
|
-
}, "sdk"> & {
|
|
970
|
+
}, "graphql" | "sdk"> & {
|
|
967
971
|
openapi?: string | {
|
|
968
972
|
source: string;
|
|
969
973
|
directory?: string | undefined;
|
|
@@ -979,6 +983,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
979
983
|
} | undefined;
|
|
980
984
|
} & {
|
|
981
985
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
986
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
982
987
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
983
988
|
})[];
|
|
984
989
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -1003,7 +1008,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1003
1008
|
hidden?: boolean | undefined;
|
|
1004
1009
|
sdk?: undefined;
|
|
1005
1010
|
root?: string | undefined;
|
|
1006
|
-
}, "sdk"> & {
|
|
1011
|
+
}, "graphql" | "sdk"> & {
|
|
1007
1012
|
openapi?: string | {
|
|
1008
1013
|
source: string;
|
|
1009
1014
|
directory?: string | undefined;
|
|
@@ -1019,6 +1024,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1019
1024
|
} | undefined;
|
|
1020
1025
|
} & {
|
|
1021
1026
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
1027
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
1022
1028
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
1023
1029
|
}))[];
|
|
1024
1030
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -1401,7 +1407,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1401
1407
|
hidden?: boolean | undefined;
|
|
1402
1408
|
sdk?: undefined;
|
|
1403
1409
|
root?: string | undefined;
|
|
1404
|
-
}, "sdk"> & {
|
|
1410
|
+
}, "graphql" | "sdk"> & {
|
|
1405
1411
|
openapi?: string | {
|
|
1406
1412
|
source: string;
|
|
1407
1413
|
directory?: string | undefined;
|
|
@@ -1417,6 +1423,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1417
1423
|
} | undefined;
|
|
1418
1424
|
} & {
|
|
1419
1425
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
1426
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
1420
1427
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
1421
1428
|
})[];
|
|
1422
1429
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -1441,7 +1448,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1441
1448
|
hidden?: boolean | undefined;
|
|
1442
1449
|
sdk?: undefined;
|
|
1443
1450
|
root?: string | undefined;
|
|
1444
|
-
}, "sdk"> & {
|
|
1451
|
+
}, "graphql" | "sdk"> & {
|
|
1445
1452
|
openapi?: string | {
|
|
1446
1453
|
source: string;
|
|
1447
1454
|
directory?: string | undefined;
|
|
@@ -1457,6 +1464,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1457
1464
|
} | undefined;
|
|
1458
1465
|
} & {
|
|
1459
1466
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
1467
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
1460
1468
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
1461
1469
|
}))[];
|
|
1462
1470
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -1845,7 +1853,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1845
1853
|
hidden?: boolean | undefined;
|
|
1846
1854
|
sdk?: undefined;
|
|
1847
1855
|
root?: string | undefined;
|
|
1848
|
-
}, "sdk"> & {
|
|
1856
|
+
}, "graphql" | "sdk"> & {
|
|
1849
1857
|
openapi?: string | {
|
|
1850
1858
|
source: string;
|
|
1851
1859
|
directory?: string | undefined;
|
|
@@ -1861,6 +1869,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1861
1869
|
} | undefined;
|
|
1862
1870
|
} & {
|
|
1863
1871
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
1872
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
1864
1873
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
1865
1874
|
})[];
|
|
1866
1875
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -1885,7 +1894,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1885
1894
|
hidden?: boolean | undefined;
|
|
1886
1895
|
sdk?: undefined;
|
|
1887
1896
|
root?: string | undefined;
|
|
1888
|
-
}, "sdk"> & {
|
|
1897
|
+
}, "graphql" | "sdk"> & {
|
|
1889
1898
|
openapi?: string | {
|
|
1890
1899
|
source: string;
|
|
1891
1900
|
directory?: string | undefined;
|
|
@@ -1901,6 +1910,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
1901
1910
|
} | undefined;
|
|
1902
1911
|
} & {
|
|
1903
1912
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
1913
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
1904
1914
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
1905
1915
|
}))[];
|
|
1906
1916
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -2283,7 +2293,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2283
2293
|
hidden?: boolean | undefined;
|
|
2284
2294
|
sdk?: undefined;
|
|
2285
2295
|
root?: string | undefined;
|
|
2286
|
-
}, "sdk"> & {
|
|
2296
|
+
}, "graphql" | "sdk"> & {
|
|
2287
2297
|
openapi?: string | {
|
|
2288
2298
|
source: string;
|
|
2289
2299
|
directory?: string | undefined;
|
|
@@ -2299,6 +2309,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2299
2309
|
} | undefined;
|
|
2300
2310
|
} & {
|
|
2301
2311
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
2312
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
2302
2313
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
2303
2314
|
})[];
|
|
2304
2315
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -2323,7 +2334,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2323
2334
|
hidden?: boolean | undefined;
|
|
2324
2335
|
sdk?: undefined;
|
|
2325
2336
|
root?: string | undefined;
|
|
2326
|
-
}, "sdk"> & {
|
|
2337
|
+
}, "graphql" | "sdk"> & {
|
|
2327
2338
|
openapi?: string | {
|
|
2328
2339
|
source: string;
|
|
2329
2340
|
directory?: string | undefined;
|
|
@@ -2339,6 +2350,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2339
2350
|
} | undefined;
|
|
2340
2351
|
} & {
|
|
2341
2352
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
2353
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
2342
2354
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
2343
2355
|
}))[];
|
|
2344
2356
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -2721,7 +2733,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2721
2733
|
hidden?: boolean | undefined;
|
|
2722
2734
|
sdk?: undefined;
|
|
2723
2735
|
root?: string | undefined;
|
|
2724
|
-
}, "sdk"> & {
|
|
2736
|
+
}, "graphql" | "sdk"> & {
|
|
2725
2737
|
openapi?: string | {
|
|
2726
2738
|
source: string;
|
|
2727
2739
|
directory?: string | undefined;
|
|
@@ -2737,6 +2749,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2737
2749
|
} | undefined;
|
|
2738
2750
|
} & {
|
|
2739
2751
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
2752
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
2740
2753
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
2741
2754
|
})[];
|
|
2742
2755
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -2761,7 +2774,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2761
2774
|
hidden?: boolean | undefined;
|
|
2762
2775
|
sdk?: undefined;
|
|
2763
2776
|
root?: string | undefined;
|
|
2764
|
-
}, "sdk"> & {
|
|
2777
|
+
}, "graphql" | "sdk"> & {
|
|
2765
2778
|
openapi?: string | {
|
|
2766
2779
|
source: string;
|
|
2767
2780
|
directory?: string | undefined;
|
|
@@ -2777,6 +2790,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
2777
2790
|
} | undefined;
|
|
2778
2791
|
} & {
|
|
2779
2792
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
2793
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
2780
2794
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
2781
2795
|
}))[];
|
|
2782
2796
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -3159,7 +3173,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3159
3173
|
hidden?: boolean | undefined;
|
|
3160
3174
|
sdk?: undefined;
|
|
3161
3175
|
root?: string | undefined;
|
|
3162
|
-
}, "sdk"> & {
|
|
3176
|
+
}, "graphql" | "sdk"> & {
|
|
3163
3177
|
openapi?: string | {
|
|
3164
3178
|
source: string;
|
|
3165
3179
|
directory?: string | undefined;
|
|
@@ -3175,6 +3189,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3175
3189
|
} | undefined;
|
|
3176
3190
|
} & {
|
|
3177
3191
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
3192
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
3178
3193
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
3179
3194
|
})[];
|
|
3180
3195
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -3199,7 +3214,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3199
3214
|
hidden?: boolean | undefined;
|
|
3200
3215
|
sdk?: undefined;
|
|
3201
3216
|
root?: string | undefined;
|
|
3202
|
-
}, "sdk"> & {
|
|
3217
|
+
}, "graphql" | "sdk"> & {
|
|
3203
3218
|
openapi?: string | {
|
|
3204
3219
|
source: string;
|
|
3205
3220
|
directory?: string | undefined;
|
|
@@ -3215,6 +3230,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3215
3230
|
} | undefined;
|
|
3216
3231
|
} & {
|
|
3217
3232
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
3233
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
3218
3234
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
3219
3235
|
}))[];
|
|
3220
3236
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -3597,7 +3613,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3597
3613
|
hidden?: boolean | undefined;
|
|
3598
3614
|
sdk?: undefined;
|
|
3599
3615
|
root?: string | undefined;
|
|
3600
|
-
}, "sdk"> & {
|
|
3616
|
+
}, "graphql" | "sdk"> & {
|
|
3601
3617
|
openapi?: string | {
|
|
3602
3618
|
source: string;
|
|
3603
3619
|
directory?: string | undefined;
|
|
@@ -3613,6 +3629,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3613
3629
|
} | undefined;
|
|
3614
3630
|
} & {
|
|
3615
3631
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
3632
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
3616
3633
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
3617
3634
|
})[];
|
|
3618
3635
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -3637,7 +3654,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3637
3654
|
hidden?: boolean | undefined;
|
|
3638
3655
|
sdk?: undefined;
|
|
3639
3656
|
root?: string | undefined;
|
|
3640
|
-
}, "sdk"> & {
|
|
3657
|
+
}, "graphql" | "sdk"> & {
|
|
3641
3658
|
openapi?: string | {
|
|
3642
3659
|
source: string;
|
|
3643
3660
|
directory?: string | undefined;
|
|
@@ -3653,6 +3670,7 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
|
|
|
3653
3670
|
} | undefined;
|
|
3654
3671
|
} & {
|
|
3655
3672
|
sdk?: import("zod").TypeOf<typeof import("@mintlify/validation").sdkSchema>;
|
|
3673
|
+
graphql?: import("zod").TypeOf<typeof import("@mintlify/validation").graphqlSchema>;
|
|
3656
3674
|
pages?: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").PageOrGroupNavigation<"default">[];
|
|
3657
3675
|
}))[];
|
|
3658
3676
|
directory?: "none" | "card" | "accordion" | undefined;
|
|
@@ -2,6 +2,7 @@ import type { DecoratedNavigationPage, GraphqlReference, GraphqlTarget } from '@
|
|
|
2
2
|
import type { DocsConfig } from '@mintlify/validation';
|
|
3
3
|
export type GeneratedGraphqlPage = {
|
|
4
4
|
slug: string;
|
|
5
|
+
directory: string;
|
|
5
6
|
title: string;
|
|
6
7
|
description?: string;
|
|
7
8
|
deprecated?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseGraphqlSelector, resolveGraphqlOperation, } from '@mintlify/common';
|
|
1
2
|
import { parseGraphqlSdl } from '@mintlify/scraping';
|
|
2
3
|
import fse from 'fs-extra';
|
|
3
4
|
import { open } from 'node:fs/promises';
|
|
@@ -12,21 +13,47 @@ function graphqlConfig(config) {
|
|
|
12
13
|
? { source: config, directory: DEFAULT_OUTPUT_DIR }
|
|
13
14
|
: { source: config.source, directory: config.directory ?? DEFAULT_OUTPUT_DIR };
|
|
14
15
|
}
|
|
15
|
-
function makePage(source, directory, kind, entry) {
|
|
16
|
+
function makePage(source, directory, kind, name, entry) {
|
|
16
17
|
const section = kind === 'query' ? 'queries' : kind === 'mutation' ? 'mutations' : 'types';
|
|
18
|
+
const sectionPath = path.posix.join(directory, section);
|
|
17
19
|
return {
|
|
18
|
-
slug: path.posix.join(
|
|
19
|
-
|
|
20
|
+
slug: path.posix.join(sectionPath, ...name.split('.')),
|
|
21
|
+
directory: path.posix.dirname(sectionPath),
|
|
22
|
+
title: name,
|
|
20
23
|
...('description' in entry && entry.description ? { description: entry.description } : {}),
|
|
21
24
|
...(kind !== 'type' && 'deprecationReason' in entry && entry.deprecationReason != null
|
|
22
25
|
? { deprecated: true }
|
|
23
26
|
: {}),
|
|
24
27
|
tag: kind === 'type' && 'kind' in entry ? entry.kind.toUpperCase() : kind.toUpperCase(),
|
|
25
|
-
target: { source, kind, name
|
|
28
|
+
target: { source, kind, name },
|
|
26
29
|
};
|
|
27
30
|
}
|
|
31
|
+
const DOCUMENTED_TYPE_KINDS = [
|
|
32
|
+
'object',
|
|
33
|
+
'input',
|
|
34
|
+
'interface',
|
|
35
|
+
'union',
|
|
36
|
+
'enum',
|
|
37
|
+
];
|
|
38
|
+
function isDocumentedType(reference, type) {
|
|
39
|
+
const roots = [reference.queryType, reference.mutationType, reference.subscriptionType];
|
|
40
|
+
return !roots.includes(type.name) && DOCUMENTED_TYPE_KINDS.includes(type.kind);
|
|
41
|
+
}
|
|
42
|
+
function makeSelectedPage(reference, source, directory, selector) {
|
|
43
|
+
const label = `GraphQL ${selector.kind} ${selector.name}`;
|
|
44
|
+
if (selector.kind === 'type') {
|
|
45
|
+
const type = reference.types.find(({ name }) => name === selector.name);
|
|
46
|
+
if (!type || !isDocumentedType(reference, type)) {
|
|
47
|
+
throw new Error(`${label} not found in ${source}`);
|
|
48
|
+
}
|
|
49
|
+
return makePage(source, directory, 'type', selector.name, type);
|
|
50
|
+
}
|
|
51
|
+
const resolved = resolveGraphqlOperation(reference, selector);
|
|
52
|
+
if (!resolved)
|
|
53
|
+
throw new Error(`${label} not found in ${source}`);
|
|
54
|
+
return makePage(source, directory, selector.kind, selector.name, resolved.field);
|
|
55
|
+
}
|
|
28
56
|
function generatePages(reference, source, directory) {
|
|
29
|
-
const roots = new Set([reference.queryType, reference.mutationType, reference.subscriptionType].filter((name) => name !== undefined));
|
|
30
57
|
const typeByName = new Map(reference.types.map((type) => [type.name, type]));
|
|
31
58
|
const queryType = reference.queryType ? typeByName.get(reference.queryType) : undefined;
|
|
32
59
|
const mutationType = reference.mutationType ? typeByName.get(reference.mutationType) : undefined;
|
|
@@ -44,21 +71,16 @@ function generatePages(reference, source, directory) {
|
|
|
44
71
|
queries: queryFields
|
|
45
72
|
.slice()
|
|
46
73
|
.sort(byName)
|
|
47
|
-
.map((field) => makePage(source, directory, 'query', field)),
|
|
74
|
+
.map((field) => makePage(source, directory, 'query', field.name, field)),
|
|
48
75
|
mutations: mutationFields
|
|
49
76
|
.slice()
|
|
50
77
|
.sort(byName)
|
|
51
|
-
.map((field) => makePage(source, directory, 'mutation', field)),
|
|
78
|
+
.map((field) => makePage(source, directory, 'mutation', field.name, field)),
|
|
52
79
|
types: reference.types
|
|
53
|
-
.filter((type) =>
|
|
54
|
-
(type.kind === 'object' ||
|
|
55
|
-
type.kind === 'input' ||
|
|
56
|
-
type.kind === 'interface' ||
|
|
57
|
-
type.kind === 'union' ||
|
|
58
|
-
type.kind === 'enum'))
|
|
80
|
+
.filter((type) => isDocumentedType(reference, type))
|
|
59
81
|
.slice()
|
|
60
82
|
.sort(byName)
|
|
61
|
-
.map((type) => makePage(source, directory, 'type', type)),
|
|
83
|
+
.map((type) => makePage(source, directory, 'type', type.name, type)),
|
|
62
84
|
};
|
|
63
85
|
}
|
|
64
86
|
function mdxStub(page) {
|
|
@@ -76,6 +98,7 @@ export async function generateGraphqlDivisionsFromDocsConfig(docsConfig, loadSou
|
|
|
76
98
|
const references = new Map();
|
|
77
99
|
const parsedReferences = new Map();
|
|
78
100
|
const pagesByRouteKey = new Map();
|
|
101
|
+
const bulkSuppressed = new Set();
|
|
79
102
|
async function load(source) {
|
|
80
103
|
let pending = references.get(source);
|
|
81
104
|
if (!pending) {
|
|
@@ -88,36 +111,63 @@ export async function generateGraphqlDivisionsFromDocsConfig(docsConfig, loadSou
|
|
|
88
111
|
}
|
|
89
112
|
return pending;
|
|
90
113
|
}
|
|
91
|
-
|
|
114
|
+
function register(page) {
|
|
115
|
+
const routeKey = getGraphqlRouteKey(page.slug);
|
|
116
|
+
const existingPage = pagesByRouteKey.get(routeKey);
|
|
117
|
+
if (existingPage &&
|
|
118
|
+
(existingPage.slug !== page.slug ||
|
|
119
|
+
existingPage.target.source !== page.target.source ||
|
|
120
|
+
existingPage.target.kind !== page.target.kind ||
|
|
121
|
+
existingPage.target.name !== page.target.name)) {
|
|
122
|
+
throw new Error(`Multiple GraphQL references generate colliding routes "${existingPage.slug}" and "${page.slug}"`);
|
|
123
|
+
}
|
|
124
|
+
pagesByRouteKey.set(routeKey, page);
|
|
125
|
+
}
|
|
126
|
+
async function processPage(page, scope) {
|
|
127
|
+
if (!scope)
|
|
128
|
+
return page;
|
|
129
|
+
const selector = parseGraphqlSelector(page);
|
|
130
|
+
if (!selector)
|
|
131
|
+
return page;
|
|
132
|
+
const generated = makeSelectedPage(await load(scope.source), scope.source, scope.directory, selector);
|
|
133
|
+
register(generated);
|
|
134
|
+
bulkSuppressed.add(scope.owner);
|
|
135
|
+
return generated.slug;
|
|
136
|
+
}
|
|
137
|
+
async function processChildren(node, scope) {
|
|
138
|
+
return Object.fromEntries(await Promise.all(Object.entries(node).map(async ([key, entry]) => {
|
|
139
|
+
if (key !== 'pages' || !Array.isArray(entry)) {
|
|
140
|
+
return [key, await processNode(entry, scope)];
|
|
141
|
+
}
|
|
142
|
+
const pages = await Promise.all(entry.map((page) => typeof page === 'string' ? processPage(page, scope) : processNode(page, scope)));
|
|
143
|
+
return [key, pages];
|
|
144
|
+
})));
|
|
145
|
+
}
|
|
146
|
+
async function processNode(value, scope) {
|
|
92
147
|
if (Array.isArray(value))
|
|
93
|
-
return Promise.all(value.map(processNode));
|
|
148
|
+
return Promise.all(value.map((item) => processNode(item, scope)));
|
|
94
149
|
if (typeof value !== 'object' || value === null)
|
|
95
150
|
return value;
|
|
96
|
-
const node = value;
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
existingPage.target.name !== page.target.name)) {
|
|
114
|
-
throw new Error(`Multiple GraphQL references generate colliding routes "${existingPage.slug}" and "${page.slug}"`);
|
|
115
|
-
}
|
|
116
|
-
pagesByRouteKey.set(routeKey, page);
|
|
117
|
-
}
|
|
118
|
-
return { ...tab, groups: [...(tab.groups ?? []), ...groups] };
|
|
151
|
+
const { graphql, ...node } = value;
|
|
152
|
+
if (graphql === undefined)
|
|
153
|
+
return processChildren(node, scope);
|
|
154
|
+
const { source, directory } = graphqlConfig(graphql);
|
|
155
|
+
const processed = await processChildren(node, { source, directory, owner: value });
|
|
156
|
+
if (bulkSuppressed.has(value))
|
|
157
|
+
return processed;
|
|
158
|
+
const generated = generatePages(await load(source), source, directory);
|
|
159
|
+
const groups = [
|
|
160
|
+
{ group: 'Queries', pages: generated.queries.map(({ slug }) => slug) },
|
|
161
|
+
{ group: 'Mutations', pages: generated.mutations.map(({ slug }) => slug) },
|
|
162
|
+
{ group: 'Types', pages: generated.types.map(({ slug }) => slug) },
|
|
163
|
+
].filter(({ pages }) => pages.length > 0);
|
|
164
|
+
[...generated.queries, ...generated.mutations, ...generated.types].forEach(register);
|
|
165
|
+
if ('group' in processed) {
|
|
166
|
+
const pages = Array.isArray(processed.pages) ? processed.pages : [];
|
|
167
|
+
return { ...processed, pages: [...pages, ...groups] };
|
|
119
168
|
}
|
|
120
|
-
|
|
169
|
+
const existingGroups = Array.isArray(processed.groups) ? processed.groups : [];
|
|
170
|
+
return { ...processed, groups: [...existingGroups, ...groups] };
|
|
121
171
|
}
|
|
122
172
|
const navigation = await processNode(docsConfig.navigation);
|
|
123
173
|
const generatedPages = [...pagesByRouteKey.values()].sort((left, right) => getGeneratedRouteKey(left.slug).localeCompare(getGeneratedRouteKey(right.slug)) ||
|
|
@@ -245,11 +295,10 @@ export async function writeGraphqlArtifacts(result, targetDir) {
|
|
|
245
295
|
const artifacts = {
|
|
246
296
|
references: result.parsedReferences,
|
|
247
297
|
pages: Object.fromEntries(result.generatedPages.map((page) => {
|
|
248
|
-
const directory = path.posix.dirname(path.posix.dirname(page.slug));
|
|
249
298
|
const routes = Object.fromEntries(result.generatedPages
|
|
250
299
|
.filter((generatedPage) => generatedPage.target.source === page.target.source &&
|
|
251
300
|
generatedPage.target.kind === 'type' &&
|
|
252
|
-
|
|
301
|
+
generatedPage.directory === page.directory)
|
|
253
302
|
.map((generatedPage) => [generatedPage.target.name, `/${generatedPage.slug}`]));
|
|
254
303
|
return [page.slug, { target: page.target, routes }];
|
|
255
304
|
})),
|