@mintlify/msft-sdk 1.1.68 → 1.1.69
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/README.md +82 -2
- package/dist/index.d.ts +58 -0
- package/dist/index.js +116 -110
- package/dist/openapi/convertOpenApiSpecToHrefMap.js +20 -0
- package/dist/openapi/convertOpenApiSpecToNav.js +44 -0
- package/dist/openapi/loadAndConvertOpenApiSpec.js +14 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -52,13 +52,93 @@ import { DocsPage } from "@mintlify/msft-sdk";
|
|
|
52
52
|
|
|
53
53
|
## Core Exports
|
|
54
54
|
|
|
55
|
+
### Documentation Components
|
|
55
56
|
- `DocsPage` - Main documentation page component
|
|
57
|
+
- `ApiPage` - API reference page component
|
|
58
|
+
- `DocsLayout` - Layout with navigation sidebar
|
|
56
59
|
- `MDXRenderer` - Standalone MDX renderer
|
|
57
|
-
- `convertHtmlToMdx` - Convert HTML to MDX
|
|
58
|
-
- `serializeMdx` - Compile MDX to React components
|
|
59
60
|
- `NavTree`, `TableOfContents` - Navigation components
|
|
60
61
|
- `allComponents` - All available MDX components
|
|
61
62
|
|
|
63
|
+
### Content Processing
|
|
64
|
+
- `convertHtmlToMdx` - Convert HTML to MDX
|
|
65
|
+
- `serializeMdx` - Compile MDX to React components
|
|
66
|
+
|
|
67
|
+
### OpenAPI Utilities
|
|
68
|
+
- `convertOpenApiSpecToGraph` - Convert OpenAPI spec to schema graph data
|
|
69
|
+
- `convertOpenApiSpecToNav` - Generate navigation structure from OpenAPI spec
|
|
70
|
+
- `convertOpenApiSpecToHrefMap` - Create href-to-endpoint lookup map
|
|
71
|
+
|
|
72
|
+
## OpenAPI Integration
|
|
73
|
+
|
|
74
|
+
The SDK provides utilities for working with OpenAPI specifications:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import {
|
|
78
|
+
convertOpenApiSpecToGraph,
|
|
79
|
+
convertOpenApiSpecToNav,
|
|
80
|
+
convertOpenApiSpecToHrefMap,
|
|
81
|
+
getApiReferenceDataFromGraph,
|
|
82
|
+
ApiPage,
|
|
83
|
+
} from "@mintlify/msft-sdk";
|
|
84
|
+
import openApiSpec from "./my-openapi-spec.json";
|
|
85
|
+
|
|
86
|
+
// Convert spec to schema graph (required for API rendering)
|
|
87
|
+
const graphData = convertOpenApiSpecToGraph(openApiSpec, {
|
|
88
|
+
filename: "my-api.json",
|
|
89
|
+
originalFileLocation: "my-api.json",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Generate navigation from OpenAPI spec
|
|
93
|
+
const navData = convertOpenApiSpecToNav(openApiSpec);
|
|
94
|
+
|
|
95
|
+
// Create href-to-endpoint map for routing
|
|
96
|
+
const hrefMap = convertOpenApiSpecToHrefMap(openApiSpec);
|
|
97
|
+
|
|
98
|
+
// Get API reference data for a specific endpoint
|
|
99
|
+
const apiReferenceData = getApiReferenceDataFromGraph({
|
|
100
|
+
metadata: {
|
|
101
|
+
title: "Create User",
|
|
102
|
+
description: "Create a new user",
|
|
103
|
+
openapi: "post /users",
|
|
104
|
+
},
|
|
105
|
+
schemaGraphData: graphData,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Render the API page
|
|
109
|
+
<ApiPage
|
|
110
|
+
apiReferenceData={apiReferenceData}
|
|
111
|
+
pageMetadata={metadata}
|
|
112
|
+
theme="light"
|
|
113
|
+
/>;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
### Running Tests
|
|
119
|
+
|
|
120
|
+
This project uses [Vitest](https://vitest.dev/) for testing.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Run tests once
|
|
124
|
+
npm test
|
|
125
|
+
|
|
126
|
+
# Run tests in watch mode
|
|
127
|
+
npm run test:watch
|
|
128
|
+
|
|
129
|
+
# Run tests with coverage
|
|
130
|
+
npm run test:coverage
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Test Structure
|
|
134
|
+
|
|
135
|
+
Tests are located in the `tests/` directory and are organized as follows:
|
|
136
|
+
|
|
137
|
+
- `tests/fixtures/` - Test fixtures including OpenAPI specs and expected outputs
|
|
138
|
+
- `tests/*.test.ts` - Test files for various conversion functions
|
|
139
|
+
|
|
140
|
+
The test fixtures are kept outside of the `src/` directory to ensure they're not bundled with the package.
|
|
141
|
+
|
|
62
142
|
## License
|
|
63
143
|
|
|
64
144
|
MIT © Mintlify, Inc.
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,15 @@ export declare const ApiFields: NamedExoticComponent< {
|
|
|
100
100
|
pageMetadata: PageMetaTags;
|
|
101
101
|
}>;
|
|
102
102
|
|
|
103
|
+
export declare interface ApiNavStructure {
|
|
104
|
+
items: NavItem_2[];
|
|
105
|
+
metadata: {
|
|
106
|
+
generated_from: string;
|
|
107
|
+
spec_title: string;
|
|
108
|
+
spec_version: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
export declare function ApiPage({ theme, className, pathname, markdownContent, allPages, baseUrl, LinkComponent, contextMenu, contextMenuEnabled, apiReferenceData, pageMetadata, playgroundDisplay, requestEndpointUrl, fileRequestEndpointUrl, }: ApiPageProps): JSX_2.Element;
|
|
104
113
|
|
|
105
114
|
declare interface ApiPageProps {
|
|
@@ -287,6 +296,37 @@ export declare function convertHtmlToMdx(html: string, options?: ConvertOptions)
|
|
|
287
296
|
mdxExtracts: MdxExtracts;
|
|
288
297
|
}>;
|
|
289
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Converts an OpenAPI specification object to schema graph format.
|
|
301
|
+
*
|
|
302
|
+
* @param spec - The OpenAPI specification object (will be validated as OpenAPI 3.0 or 3.1)
|
|
303
|
+
* @param options - Optional configuration
|
|
304
|
+
* @param options.filename - The filename for the spec (defaults to 'openapi.json')
|
|
305
|
+
* @param options.originalFileLocation - The original file location (defaults to filename)
|
|
306
|
+
* @returns SchemaGraphData - The converted schema graph structure
|
|
307
|
+
* @throws Error if the spec is not a valid OpenAPI 3.0 or 3.1 document
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* import { convertOpenApiSpecToGraph } from '@mintlify/msft-sdk';
|
|
312
|
+
* import openApiSpec from './azure-openapi.json';
|
|
313
|
+
*
|
|
314
|
+
* const graphData = convertOpenApiSpecToGraph(openApiSpec, {
|
|
315
|
+
* filename: 'azure-openapi.json'
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
export declare function convertOpenApiSpecToGraph(spec: unknown, options?: {
|
|
320
|
+
filename?: string;
|
|
321
|
+
originalFileLocation?: string;
|
|
322
|
+
}): SchemaGraphData;
|
|
323
|
+
|
|
324
|
+
export declare function convertOpenApiSpecToHrefMap(spec: unknown, options?: {
|
|
325
|
+
baseHref?: string;
|
|
326
|
+
}): HrefToEndpointMap;
|
|
327
|
+
|
|
328
|
+
export declare function convertOpenApiSpecToNav(spec: unknown): ApiNavStructure;
|
|
329
|
+
|
|
290
330
|
export declare interface ConvertOptions {
|
|
291
331
|
metadata?: Record<string, unknown>;
|
|
292
332
|
mdxExtracts?: MdxExtracts;
|
|
@@ -539,6 +579,12 @@ declare type EndpointHeaderProps = {
|
|
|
539
579
|
children?: React.ReactNode;
|
|
540
580
|
};
|
|
541
581
|
|
|
582
|
+
export declare interface EndpointInfo {
|
|
583
|
+
path: string;
|
|
584
|
+
title: string;
|
|
585
|
+
description?: string;
|
|
586
|
+
}
|
|
587
|
+
|
|
542
588
|
export declare function extractHeadings(): (tree: Node_2, file: unknown) => void;
|
|
543
589
|
|
|
544
590
|
export declare function generateLlmsFullTxt(pages: LlmsPageConfig[], baseUrl: string): Promise<string>;
|
|
@@ -569,6 +615,10 @@ declare interface HeadingProps {
|
|
|
569
615
|
|
|
570
616
|
export declare const Home: () => JSX_2.Element;
|
|
571
617
|
|
|
618
|
+
export declare interface HrefToEndpointMap {
|
|
619
|
+
[href: string]: EndpointInfo;
|
|
620
|
+
}
|
|
621
|
+
|
|
572
622
|
export declare function isElement<T extends ElementType = Element_2>(node: ElementType | undefined, key?: keyof T, element?: string): node is T & {
|
|
573
623
|
data?: {
|
|
574
624
|
meta?: unknown;
|
|
@@ -687,6 +737,14 @@ export declare interface NavItem {
|
|
|
687
737
|
method?: string;
|
|
688
738
|
}
|
|
689
739
|
|
|
740
|
+
declare interface NavItem_2 {
|
|
741
|
+
toc_title: string;
|
|
742
|
+
href?: string;
|
|
743
|
+
description?: string;
|
|
744
|
+
method?: string;
|
|
745
|
+
children?: NavItem_2[];
|
|
746
|
+
}
|
|
747
|
+
|
|
690
748
|
export declare function NavTree({ navTree, activeId, className, activeHref, theme, bottomLinks, anchors, }: NavTreeProps): JSX_2.Element | null;
|
|
691
749
|
|
|
692
750
|
export declare interface NavTreeData {
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,15 @@ import { DocsLayout as p } from "./components/docsLayout.js";
|
|
|
3
3
|
import { MDXRenderer as a } from "./components/mdx-renderer.js";
|
|
4
4
|
import { PlainTextPage as n } from "./components/plain-text-page.js";
|
|
5
5
|
import { createDefaultComponents as l, defaultComponents as i } from "./components/content-components/default-components.js";
|
|
6
|
-
import { ComponentsProvider as d, useComponents as
|
|
7
|
-
import { NavTree as
|
|
8
|
-
import { useApiReference as
|
|
9
|
-
import { ApiReferenceContext as
|
|
10
|
-
import { TableOfContents as
|
|
11
|
-
import { PivotAwareTOC as
|
|
12
|
-
import { PageContextMenu as
|
|
6
|
+
import { ComponentsProvider as d, useComponents as c } from "./context/components-context.js";
|
|
7
|
+
import { NavTree as g } from "./components/nav-tree/index.js";
|
|
8
|
+
import { useApiReference as T } from "./components/Api/ApiReferenceProvider.js";
|
|
9
|
+
import { ApiReferenceContext as y, ApiReferenceContext2 as v, ApiReferenceProvider as A, ApiReferenceProvider2 as b, DeploymentMetadataContext as H, DeploymentMetadataProvider as h, DocsConfigContext as D, DocsConfigProvider as R, PageContext as M, PageProvider as S } from "./contexts/ConfigContext.js";
|
|
10
|
+
import { TableOfContents as O } from "./components/toc/index.js";
|
|
11
|
+
import { PivotAwareTOC as L } from "./components/toc/pivot-aware-toc.js";
|
|
12
|
+
import { PageContextMenu as F } from "./components/page-context-menu.js";
|
|
13
13
|
import { copyMarkdownToClipboard as Z, getPageMarkdown as z, useMarkdownCopy as E } from "./hooks/useMarkdownCopy.js";
|
|
14
|
-
import { generateLlmsFullTxt as
|
|
14
|
+
import { generateLlmsFullTxt as G, generateLlmsTxt as X } from "./utils/generate-llms-txt.js";
|
|
15
15
|
import { getNodeText as J } from "./utils/get-node-text.js";
|
|
16
16
|
import { capitalize as j } from "./utils/string.js";
|
|
17
17
|
import { cn as Q } from "./utils/cn.js";
|
|
@@ -23,147 +23,153 @@ import { extractHeadings as ae } from "./plugins/extract-headings.js";
|
|
|
23
23
|
import { rehypeRemoveHtmlComments as ne, removeHtmlComments as fe } from "./plugins/sanitize/remove-html-comments.js";
|
|
24
24
|
import { Api as ie } from "./api-playground-2/Api.js";
|
|
25
25
|
import { OperationPage as de } from "./api-playground-2/OperationPage.js";
|
|
26
|
-
import { SchemaPage as
|
|
27
|
-
import { ApiExamples as
|
|
28
|
-
import { ApiFields as
|
|
29
|
-
import { Playground as
|
|
30
|
-
import { EndpointHeader as
|
|
26
|
+
import { SchemaPage as Ce } from "./api-playground-2/SchemaPage.js";
|
|
27
|
+
import { ApiExamples as Pe } from "./api-playground-2/ApiExamples.js";
|
|
28
|
+
import { ApiFields as ue } from "./api-playground-2/ApiFields.js";
|
|
29
|
+
import { Playground as ve } from "./api-playground-2/Playground.js";
|
|
30
|
+
import { EndpointHeader as be } from "./api-playground-2/EndpointHeader.js";
|
|
31
31
|
import { ApiPlaygroundContext as he, ApiPlaygroundContext as De } from "./api-playground-2/contexts/ApiPlaygroundContext.js";
|
|
32
32
|
import { usePlaygroundInputsStore as Me } from "./api-playground-2/hooks/usePlaygroundInputsStore.js";
|
|
33
|
-
import { useSendPlaygroundRequest as
|
|
34
|
-
import { useInitializeInputs as
|
|
35
|
-
import { useCopyPathWithInputs as
|
|
36
|
-
import { useSelectedSecurityOption as
|
|
33
|
+
import { useSendPlaygroundRequest as ke } from "./api-playground-2/hooks/useSendPlaygroundRequest.js";
|
|
34
|
+
import { useInitializeInputs as we } from "./api-playground-2/hooks/useInitializeInputs.js";
|
|
35
|
+
import { useCopyPathWithInputs as Ne } from "./api-playground-2/hooks/useCopyPathWithInputs.js";
|
|
36
|
+
import { useSelectedSecurityOption as Ie } from "./api-playground-2/hooks/useSelectedSecurityOption.js";
|
|
37
37
|
import { addApiReferenceDataFromMdxAndDocsConfig as ze } from "./api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js";
|
|
38
38
|
import { processSecurityOptions as Be } from "./api-playground-2/schemaGraph/processSecurityOptions.js";
|
|
39
|
-
import { getApiReferenceDataFromGraph as
|
|
39
|
+
import { getApiReferenceDataFromGraph as Xe } from "./api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js";
|
|
40
40
|
import { ApiPage as Je } from "./components/apiPage.js";
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
41
|
+
import { convertOpenApiSpecToGraph as je } from "./openapi/loadAndConvertOpenApiSpec.js";
|
|
42
|
+
import { convertOpenApiSpecToNav as Qe } from "./openapi/convertOpenApiSpecToNav.js";
|
|
43
|
+
import { convertOpenApiSpecToHrefMap as Ve } from "./openapi/convertOpenApiSpecToHrefMap.js";
|
|
44
|
+
import { CodeBlock as _e } from "./components/content-components/code-block.js";
|
|
45
|
+
import { Heading as eo } from "./components/content-components/heading.js";
|
|
46
|
+
import { Link as ro } from "./components/content-components/link.js";
|
|
47
|
+
import { Callout as po } from "./components/content-components/callouts.js";
|
|
48
|
+
import { ZonePivot as ao } from "./components/content-components/zone-pivots/zone-pivot.js";
|
|
49
|
+
import { ZoneTarget as no } from "./components/content-components/zone-pivots/zone-target.js";
|
|
50
|
+
import { ZonePivotProvider as lo } from "./components/content-components/zone-pivots/zone-pivot-context.js";
|
|
51
|
+
import { ZonePivotSelector as so } from "./components/content-components/zone-pivots/zone-pivot-selector.js";
|
|
52
|
+
import { ParamName as Co } from "./components/content-components/param-name.js";
|
|
53
|
+
import { Tabs as Po } from "./components/content-components/tabs/tabs.js";
|
|
54
|
+
import { Tab as uo } from "./components/content-components/tabs/tab.js";
|
|
55
|
+
import { Details as vo, Summary as Ao } from "./components/content-components/details/details.js";
|
|
56
|
+
import { Table as Ho, TableBody as ho, TableCaption as Do, TableCell as Ro, TableFooter as Mo, TableHead as So, TableHeader as ko, TableRow as Oo } from "./components/content-components/table/index.js";
|
|
57
|
+
import { LaTeX as Lo } from "./components/content-components/latex.js";
|
|
58
|
+
import { allComponents as Fo } from "./components/content-components/all-components.js";
|
|
59
|
+
import { Home as Zo } from "./components/content-components/home.js";
|
|
60
|
+
import { MobileNavTree as Eo } from "./components/nav-tree/mobile-nav.js";
|
|
61
|
+
import { rehypeCodeblocks as Go } from "./plugins/rehype/rehype-code-blocks.js";
|
|
62
|
+
import { remarkHeadingIds as qo } from "./plugins/remark/remark-heading-ids.js";
|
|
63
|
+
import { sanitizePreTags as Wo } from "./plugins/sanitize/rehype-pre-to-mdx-fence.js";
|
|
64
|
+
import { rehypeCallouts as Ko } from "./plugins/sanitize/rehype-callouts.js";
|
|
65
|
+
import { rehypeParamName as Uo } from "./plugins/sanitize/rehype-param-name.js";
|
|
66
|
+
import { rehypeTabs as Yo } from "./plugins/sanitize/rehype-tabs.js";
|
|
67
|
+
import { rehypeDetails as $o } from "./plugins/sanitize/rehype-details.js";
|
|
68
|
+
import { rehypeHeadingIds as or } from "./plugins/sanitize/rehype-heading-ids.js";
|
|
69
|
+
import { rehypeZonePivots as tr } from "./plugins/sanitize/rehype-zone-pivots.js";
|
|
70
|
+
import { mdxJsxFlowElementHandler as mr, rehypeRemark as ar } from "./plugins/sanitize/rehype-remark.js";
|
|
71
|
+
import { rehypeLatex as nr } from "./plugins/sanitize/rehype-latex.js";
|
|
72
|
+
import { tableCellHandler as lr, tableHandler as ir, tableRowHandler as sr } from "./plugins/sanitize/rehype-table-align.js";
|
|
70
73
|
export {
|
|
71
74
|
ie as Api,
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
Pe as ApiExamples,
|
|
76
|
+
ue as ApiFields,
|
|
74
77
|
Je as ApiPage,
|
|
75
78
|
he as ApiPlaygroundContext,
|
|
76
79
|
De as ApiPlaygroundContextLegacy,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
y as ApiReferenceContext,
|
|
81
|
+
v as ApiReferenceContext2,
|
|
82
|
+
A as ApiReferenceProvider,
|
|
83
|
+
b as ApiReferenceProvider2,
|
|
84
|
+
po as Callout,
|
|
85
|
+
_e as CodeBlock,
|
|
83
86
|
d as ComponentsProvider,
|
|
84
87
|
H as DeploymentMetadataContext,
|
|
85
88
|
h as DeploymentMetadataProvider,
|
|
86
|
-
|
|
89
|
+
vo as Details,
|
|
87
90
|
D as DocsConfigContext,
|
|
88
91
|
R as DocsConfigProvider,
|
|
89
92
|
p as DocsLayout,
|
|
90
93
|
r as DocsPage,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
be as EndpointHeader,
|
|
95
|
+
eo as Heading,
|
|
96
|
+
Zo as Home,
|
|
97
|
+
Lo as LaTeX,
|
|
98
|
+
ro as Link,
|
|
96
99
|
a as MDXRenderer,
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
Eo as MobileNavTree,
|
|
101
|
+
g as NavTree,
|
|
99
102
|
de as OperationPage,
|
|
100
103
|
M as PageContext,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
F as PageContextMenu,
|
|
105
|
+
S as PageProvider,
|
|
106
|
+
Co as ParamName,
|
|
107
|
+
L as PivotAwareTOC,
|
|
105
108
|
n as PlainTextPage,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
109
|
+
ve as Playground,
|
|
110
|
+
Ce as SchemaPage,
|
|
111
|
+
Ao as Summary,
|
|
112
|
+
uo as Tab,
|
|
113
|
+
Ho as Table,
|
|
114
|
+
ho as TableBody,
|
|
115
|
+
Do as TableCaption,
|
|
116
|
+
Ro as TableCell,
|
|
117
|
+
Mo as TableFooter,
|
|
118
|
+
So as TableHead,
|
|
119
|
+
ko as TableHeader,
|
|
120
|
+
O as TableOfContents,
|
|
121
|
+
Oo as TableRow,
|
|
122
|
+
Po as Tabs,
|
|
123
|
+
ao as ZonePivot,
|
|
124
|
+
lo as ZonePivotProvider,
|
|
125
|
+
so as ZonePivotSelector,
|
|
126
|
+
no as ZoneTarget,
|
|
124
127
|
ze as addApiReferenceDataFromMdxAndDocsConfig,
|
|
125
|
-
|
|
128
|
+
Fo as allComponents,
|
|
126
129
|
j as capitalize,
|
|
127
130
|
V as cleanTitle,
|
|
128
131
|
Q as cn,
|
|
129
132
|
re as convertHtmlToMdx,
|
|
133
|
+
je as convertOpenApiSpecToGraph,
|
|
134
|
+
Ve as convertOpenApiSpecToHrefMap,
|
|
135
|
+
Qe as convertOpenApiSpecToNav,
|
|
130
136
|
Z as copyMarkdownToClipboard,
|
|
131
137
|
l as createDefaultComponents,
|
|
132
138
|
i as defaultComponents,
|
|
133
139
|
ae as extractHeadings,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
G as generateLlmsFullTxt,
|
|
141
|
+
X as generateLlmsTxt,
|
|
142
|
+
Xe as getApiReferenceDataFromGraph,
|
|
137
143
|
_ as getClassNames,
|
|
138
144
|
J as getNodeText,
|
|
139
145
|
z as getPageMarkdown,
|
|
140
146
|
$ as getTextContent,
|
|
141
147
|
ee as isElement,
|
|
142
|
-
|
|
148
|
+
mr as mdxJsxFlowElementHandler,
|
|
143
149
|
Be as processSecurityOptions,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
Ko as rehypeCallouts,
|
|
151
|
+
Go as rehypeCodeblocks,
|
|
152
|
+
$o as rehypeDetails,
|
|
153
|
+
or as rehypeHeadingIds,
|
|
154
|
+
nr as rehypeLatex,
|
|
155
|
+
Uo as rehypeParamName,
|
|
156
|
+
ar as rehypeRemark,
|
|
151
157
|
ne as rehypeRemoveHtmlComments,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
Yo as rehypeTabs,
|
|
159
|
+
tr as rehypeZonePivots,
|
|
160
|
+
qo as remarkHeadingIds,
|
|
155
161
|
fe as removeHtmlComments,
|
|
156
|
-
|
|
162
|
+
Wo as sanitizePreTags,
|
|
157
163
|
pe as serializeMdx,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
lr as tableCellHandler,
|
|
165
|
+
ir as tableHandler,
|
|
166
|
+
sr as tableRowHandler,
|
|
167
|
+
T as useApiReference,
|
|
168
|
+
c as useComponents,
|
|
169
|
+
Ne as useCopyPathWithInputs,
|
|
170
|
+
we as useInitializeInputs,
|
|
165
171
|
E as useMarkdownCopy,
|
|
166
172
|
Me as usePlaygroundInputsStore,
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
Ie as useSelectedSecurityOption,
|
|
174
|
+
ke as useSendPlaygroundRequest
|
|
169
175
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isOpenAPIV3orV31Document as b } from "@mintlify/validation";
|
|
2
|
+
function w(t, r) {
|
|
3
|
+
if (!b(t))
|
|
4
|
+
throw new Error("Invalid OpenAPI document: must be OpenAPI 3.0 or 3.1");
|
|
5
|
+
const p = (r == null ? void 0 : r.baseHref) || "api-reference", a = {};
|
|
6
|
+
return t.paths && Object.entries(t.paths).forEach(([g, n]) => {
|
|
7
|
+
n && Object.entries(n).forEach(([o, s]) => {
|
|
8
|
+
if (!["get", "post", "put", "delete", "patch", "options", "head"].includes(o.toLowerCase()) || !s || typeof s != "object") return;
|
|
9
|
+
const e = s, c = e.summary || "", f = e.description, i = (e.tags && e.tags.length > 0 ? e.tags : ["General"])[0].toLowerCase().replace(/\s+/g, "-"), u = c.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, ""), l = `${p}/${i}/${u}`, h = `${g}/${o.toLowerCase()}`;
|
|
10
|
+
a[l] = {
|
|
11
|
+
path: h,
|
|
12
|
+
title: c,
|
|
13
|
+
...f && { description: f }
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}), a;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
w as convertOpenApiSpecToHrefMap
|
|
20
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isOpenAPIV3orV31Document as d } from "@mintlify/validation";
|
|
2
|
+
function _(t) {
|
|
3
|
+
var p, f;
|
|
4
|
+
if (!d(t))
|
|
5
|
+
throw new Error("Invalid OpenAPI document: must be OpenAPI 3.0 or 3.1");
|
|
6
|
+
const a = [], r = {};
|
|
7
|
+
return t.paths && Object.entries(t.paths).forEach(([i, s]) => {
|
|
8
|
+
s && Object.entries(s).forEach(([e, c]) => {
|
|
9
|
+
if (!["get", "post", "put", "delete", "patch", "options", "head"].includes(e.toLowerCase()) || !c || typeof c != "object") return;
|
|
10
|
+
const o = c, h = o.summary || "", l = o.description;
|
|
11
|
+
(o.tags && o.tags.length > 0 ? o.tags : ["General"]).forEach((n) => {
|
|
12
|
+
r[n] || (r[n] = []);
|
|
13
|
+
const u = n.toLowerCase().replace(/\s+/g, "-"), m = h.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
14
|
+
r[n].push({
|
|
15
|
+
toc_title: h,
|
|
16
|
+
description: l,
|
|
17
|
+
href: `${u}/${m}`,
|
|
18
|
+
method: e.toUpperCase(),
|
|
19
|
+
path: i
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}), Object.entries(r).forEach(([i, s]) => {
|
|
24
|
+
a.push({
|
|
25
|
+
toc_title: i,
|
|
26
|
+
children: s.map((e) => ({
|
|
27
|
+
toc_title: e.toc_title,
|
|
28
|
+
description: e.description,
|
|
29
|
+
href: e.href,
|
|
30
|
+
method: e.method.toLowerCase()
|
|
31
|
+
}))
|
|
32
|
+
});
|
|
33
|
+
}), {
|
|
34
|
+
items: a,
|
|
35
|
+
metadata: {
|
|
36
|
+
generated_from: "openapi",
|
|
37
|
+
spec_title: ((p = t.info) == null ? void 0 : p.title) || "API Documentation",
|
|
38
|
+
spec_version: ((f = t.info) == null ? void 0 : f.version) || "1.0.0"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
_ as convertOpenApiSpecToNav
|
|
44
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isOpenAPIV3orV31Document as i, openApiToSchemaGraph as o } from "@mintlify/validation";
|
|
2
|
+
function l(r, e) {
|
|
3
|
+
if (!i(r))
|
|
4
|
+
throw new Error("Invalid OpenAPI document: must be OpenAPI 3.0 or 3.1");
|
|
5
|
+
const n = JSON.parse(JSON.stringify(r)), a = (e == null ? void 0 : e.filename) ?? "openapi.json", c = (e == null ? void 0 : e.originalFileLocation) ?? a;
|
|
6
|
+
return o({
|
|
7
|
+
spec: n,
|
|
8
|
+
filename: a,
|
|
9
|
+
originalFileLocation: c
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
l as convertOpenApiSpecToGraph
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/msft-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.69",
|
|
4
4
|
"description": "Lightweight SDK for Microsoft documentation with MDX rendering",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"dev": "vite build --watch",
|
|
37
37
|
"lint": "eslint .",
|
|
38
38
|
"lint:fix": "eslint . --fix",
|
|
39
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
39
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest watch",
|
|
42
|
+
"test:coverage": "vitest run --coverage"
|
|
40
43
|
},
|
|
41
44
|
"keywords": [
|
|
42
45
|
"microsoft",
|