@stainless-api/docs-ui 0.1.0-beta.24 → 0.1.0-beta.26
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/breadcrumbs-D5viAm7a.d.ts +20 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/component-generics-BnrVqdQj.d.ts +29 -0
- package/dist/component-generics-Df4EDvxk.js +41 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +16 -0
- package/dist/components/chat.d.ts +14 -0
- package/dist/components/chat.js +128 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +4 -0
- package/dist/components/icons.d.ts +50 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +16 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +16 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +16 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +16 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +16 -0
- package/dist/components/scripts/dropdown.d.ts +12 -0
- package/dist/components/scripts/dropdown.js +50 -0
- package/dist/components/sdk.d.ts +3 -0
- package/dist/components/sdk.js +16 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +16 -0
- package/dist/components/snippets.d.ts +4 -0
- package/dist/components/snippets.js +16 -0
- package/dist/contexts/component-generics.d.ts +2 -0
- package/dist/contexts/component-generics.js +3 -0
- package/dist/contexts/component-types.d.ts +18 -0
- package/dist/contexts/component-types.js +1 -0
- package/dist/contexts/component.d.ts +30 -0
- package/dist/contexts/component.js +16 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +20 -0
- package/dist/contexts/index.js +16 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +4 -0
- package/dist/contexts/navigation.d.ts +3 -0
- package/dist/contexts/navigation.js +3 -0
- package/dist/contexts/search.d.ts +4 -0
- package/dist/contexts/search.js +16 -0
- package/dist/contexts/use-components.d.ts +16 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-DO0sMzym.js +2581 -0
- package/dist/docs-Cj25B-Sh.js +50 -0
- package/dist/docs-DhNaW0DE.d.ts +45 -0
- package/dist/dropdown-Dv9VAYCW.d.ts +42 -0
- package/dist/dropdown-kUhwBigR.js +38 -0
- package/dist/icons--8QR-PrL.js +222 -0
- package/dist/index-BW6OPqAo.d.ts +16 -0
- package/dist/index-BXO3gZup.d.ts +239 -0
- package/dist/index-d8_VR8Z5.d.ts +14 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +5030 -4830
- package/dist/languages/go.d.ts +13 -0
- package/dist/languages/go.js +16 -0
- package/dist/languages/http.d.ts +13 -0
- package/dist/languages/http.js +16 -0
- package/dist/languages/index.d.ts +13 -0
- package/dist/languages/index.js +16 -0
- package/dist/languages/java.d.ts +13 -0
- package/dist/languages/java.js +16 -0
- package/dist/languages/python.d.ts +13 -0
- package/dist/languages/python.js +16 -0
- package/dist/languages/ruby.d.ts +13 -0
- package/dist/languages/ruby.js +16 -0
- package/dist/languages/typescript.d.ts +13 -0
- package/dist/languages/typescript.js +16 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +16 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +3 -0
- package/dist/markdown/utils.d.ts +4 -0
- package/dist/markdown/utils.js +3 -0
- package/dist/markdown-DN8KaRR2.d.ts +21 -0
- package/dist/markdown-DunIdqFE.js +39 -0
- package/dist/mcp.cjs +983443 -0
- package/dist/md-Dg8aOyMA.js +41 -0
- package/dist/method-c3XDArUn.d.ts +70 -0
- package/dist/navigation-BSn6PX-7.d.ts +28 -0
- package/dist/navigation-CuCg3le8.js +20 -0
- package/dist/overview-D21weqVJ.d.ts +39 -0
- package/dist/pagefind-ChrPfuVv.js +15 -0
- package/dist/primitives-iB9fIrMF.d.ts +98 -0
- package/dist/properties-Ba6F_GGj.d.ts +46 -0
- package/dist/routing-BE6Vrs-z.d.ts +54 -0
- package/dist/routing-C8oZYLsf.js +189 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +4 -4
- package/dist/sdk-D2x2l6JH.d.ts +118 -0
- package/dist/search/index.d.ts +26 -0
- package/dist/search/index.js +211 -0
- package/dist/search/providers/algolia.d.ts +24 -0
- package/dist/search/providers/algolia.js +16 -0
- package/dist/search/providers/fuse.d.ts +18 -0
- package/dist/search/providers/fuse.js +31 -0
- package/dist/search/providers/pagefind.d.ts +7 -0
- package/dist/search/providers/pagefind.js +3 -0
- package/dist/search/providers/walker.d.ts +9 -0
- package/dist/search/providers/walker.js +35 -0
- package/dist/search/types.d.ts +3 -0
- package/dist/search/types.js +3 -0
- package/dist/search-KMqOU2tz.d.ts +20 -0
- package/dist/sidebar-B1X4gmY2.d.ts +35 -0
- package/dist/snippets-BApdMOXp.d.ts +45 -0
- package/dist/style-BWu-Pqcm.d.ts +182 -0
- package/dist/style-CkbsakoF.js +183 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.js +3 -0
- package/dist/styles/main.css +743 -748
- package/dist/styles/primitives.css +444 -427
- package/dist/styles/resets.css +33 -41
- package/dist/styles/search.css +265 -248
- package/dist/styles/sidebar.css +58 -60
- package/dist/styles/snippets.css +86 -88
- package/dist/styles/variables.css +86 -90
- package/dist/types-BLgvxY4i.d.ts +83 -0
- package/dist/types-DFN4M1Sp.js +34 -0
- package/dist/use-components-DI-AbT-D.js +7 -0
- package/dist/utils-B9JL_XWH.d.ts +21 -0
- package/dist/utils-BhYTrLot.js +32 -0
- package/dist/utils-ByZH9QWT.js +30 -0
- package/dist/utils-DlayebL1.d.ts +14 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/package.json +4 -4
- package/src/search/mcp.ts +8 -8
- package/dist/mcp.js +0 -15967
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-Bp6m_JJh.js";
|
|
2
|
+
import { f as parseStainlessPath } from "./routing-C8oZYLsf.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils.ts
|
|
5
|
+
var utils_exports = /* @__PURE__ */ __export({
|
|
6
|
+
flatResources: () => flatResources,
|
|
7
|
+
getResourceFromSpec: () => getResourceFromSpec,
|
|
8
|
+
isResourceEmpty: () => isResourceEmpty
|
|
9
|
+
});
|
|
10
|
+
function flatResources(resources, parents) {
|
|
11
|
+
return Object.keys(resources ?? {}).flatMap((key) => {
|
|
12
|
+
const resource = resources[key];
|
|
13
|
+
return [{
|
|
14
|
+
resource,
|
|
15
|
+
parents
|
|
16
|
+
}, ...resource.subresources ? flatResources(resource.subresources, [...parents, resource]) : []];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function getResourceFromSpec(stainlessPath, spec) {
|
|
20
|
+
if (typeof stainlessPath === "string") {
|
|
21
|
+
const parsed = parseStainlessPath(stainlessPath);
|
|
22
|
+
if (!parsed?.resource) return null;
|
|
23
|
+
stainlessPath = parsed.resource;
|
|
24
|
+
}
|
|
25
|
+
return stainlessPath.slice(1).reduce((acc, cur) => acc?.subresources?.[cur], spec.resources[stainlessPath[0]]) ?? null;
|
|
26
|
+
}
|
|
27
|
+
function isResourceEmpty(resource) {
|
|
28
|
+
return !(Object.values(resource.methods).length > 0 || Object.values(resource.models).length > 0 || Object.values(resource.subresources).length > 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { utils_exports as i, getResourceFromSpec as n, isResourceEmpty as r, flatResources as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Parser } from "htmlparser2";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/utils.ts
|
|
4
|
+
function getDecl(env, path) {
|
|
5
|
+
const decl = env.spec?.decls?.[env.language]?.[path];
|
|
6
|
+
if (decl?.kind?.endsWith("Reference")) {
|
|
7
|
+
const refId = "type" in decl && typeof decl["type"] === "object" && "$ref" in decl["type"] ? decl["type"]["$ref"] : null;
|
|
8
|
+
if (refId === path) return decl;
|
|
9
|
+
if (refId) return getDecl(env, refId);
|
|
10
|
+
}
|
|
11
|
+
return decl;
|
|
12
|
+
}
|
|
13
|
+
function getSnippet(env, path) {
|
|
14
|
+
let snippet = env.spec?.snippets?.[`${env.language}.default`]?.[path];
|
|
15
|
+
if (typeof snippet === "string" && env.transforms?.transformRequestSnippet) snippet = env.transforms.transformRequestSnippet({
|
|
16
|
+
snippet,
|
|
17
|
+
language: env.language
|
|
18
|
+
});
|
|
19
|
+
return snippet;
|
|
20
|
+
}
|
|
21
|
+
function stripMarkup(content) {
|
|
22
|
+
let output = "";
|
|
23
|
+
new Parser({ ontext(content$1) {
|
|
24
|
+
output += content$1;
|
|
25
|
+
} }).parseComplete(content);
|
|
26
|
+
return output;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getSnippet as n, stripMarkup as r, getDecl as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
declare namespace utils_d_exports {
|
|
5
|
+
export { flatResources, getResourceFromSpec, isResourceEmpty };
|
|
6
|
+
}
|
|
7
|
+
declare function flatResources(resources: Record<string, SDKJSON.Resource> | undefined, parents: SDKJSON.Resource[]): {
|
|
8
|
+
resource: SDKJSON.Resource;
|
|
9
|
+
parents: SDKJSON.Resource[];
|
|
10
|
+
}[];
|
|
11
|
+
declare function getResourceFromSpec(stainlessPath: string | string[], spec: SDKJSON.Spec): SDKJSON.Resource | null;
|
|
12
|
+
declare function isResourceEmpty(resource: SDKJSON.Resource): boolean;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { utils_d_exports as i, getResourceFromSpec as n, isResourceEmpty as r, flatResources as t };
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.26",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"htmlparser2": "^10.0.0",
|
|
25
25
|
"lucide-react": "^0.544.0",
|
|
26
26
|
"natural": "^8.0.1",
|
|
27
|
-
"@stainless-api/ui-primitives": "0.1.0-beta.
|
|
27
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.19"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^24.4.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-dom": "^19.2.0",
|
|
37
37
|
"tsx": "^4.20.3",
|
|
38
38
|
"typescript": "5.9.3",
|
|
39
|
-
"@stainless/
|
|
40
|
-
"@stainless/
|
|
39
|
+
"@stainless/eslint-config": "0.1.0-beta.0",
|
|
40
|
+
"@stainless/sdk-json": "^0.1.0-beta.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "node build.js",
|
package/src/search/mcp.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { buildIndex, search as fuseSearch } from './providers/fuse';
|
|
|
6
6
|
import { generateIndex } from './indexer';
|
|
7
7
|
import type { IndexEntry, IndexMethod } from './types';
|
|
8
8
|
import natural from 'natural';
|
|
9
|
-
import type * as SDKJSON from '
|
|
9
|
+
import type * as SDKJSON from '@stainless/sdk-json';
|
|
10
10
|
|
|
11
11
|
type Item = IndexEntry & IndexMethod;
|
|
12
12
|
|
|
@@ -21,12 +21,12 @@ export function consolidate(results: IndexEntry[]) {
|
|
|
21
21
|
const methods = new Set<string>();
|
|
22
22
|
|
|
23
23
|
for (const entry of results) {
|
|
24
|
-
const parsed = parseStainlessPath(entry.stainlessPath)
|
|
25
|
-
if (parsed.method) methods.add(parsed.routable);
|
|
26
|
-
else resources.add(parsed.routable);
|
|
24
|
+
const parsed = parseStainlessPath(entry.stainlessPath)!;
|
|
25
|
+
if (parsed.method) methods.add(parsed.routable!);
|
|
26
|
+
else resources.add(parsed.routable!);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const filtered = Array.from(methods).filter((path) => !resources.has(path.split(' >').at(0)));
|
|
29
|
+
const filtered = Array.from(methods).filter((path) => !resources.has(path.split(' >').at(0)!));
|
|
30
30
|
return [...resources, ...filtered];
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -47,9 +47,9 @@ export function render(
|
|
|
47
47
|
|
|
48
48
|
const paths = consolidate(items);
|
|
49
49
|
const output = paths.map((entry) => {
|
|
50
|
-
const parsed = parseStainlessPath(entry)
|
|
51
|
-
const resource = getResourceFromSpec(parsed.resource
|
|
52
|
-
const target = parsed.method ? resource.methods[parsed.method] : resource;
|
|
50
|
+
const parsed = parseStainlessPath(entry)!;
|
|
51
|
+
const resource = getResourceFromSpec(parsed.resource!, spec)!;
|
|
52
|
+
const target = parsed.method ? resource.methods[parsed.method]! : resource;
|
|
53
53
|
const content = renderMarkdown(env, target);
|
|
54
54
|
return [entry, content];
|
|
55
55
|
});
|