@stainless-api/docs-ui 0.1.0-beta.33 → 0.1.0-beta.35
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-BWIz-BrA.d.ts → breadcrumbs-XatIEN4h.d.ts} +2 -2
- package/dist/{component-generics-BLXXX1dz.d.ts → component-generics-CheMFObz.d.ts} +2 -2
- package/dist/components/breadcrumbs.d.ts +1 -1
- package/dist/components/breadcrumbs.js +3 -3
- package/dist/components/icons.d.ts +10 -10
- package/dist/components/index.d.ts +10 -10
- package/dist/components/index.js +3 -3
- package/dist/components/method.d.ts +1 -1
- package/dist/components/method.js +3 -3
- package/dist/components/overview.d.ts +1 -1
- package/dist/components/overview.js +3 -3
- package/dist/components/primitives.d.ts +1 -1
- package/dist/components/primitives.js +3 -3
- package/dist/components/properties.d.ts +1 -1
- package/dist/components/properties.js +3 -3
- package/dist/components/sdk.d.ts +2 -2
- package/dist/components/sdk.js +3 -3
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +3 -3
- package/dist/components/snippets.d.ts +3 -3
- package/dist/components/snippets.js +3 -3
- package/dist/contexts/component-generics.d.ts +1 -1
- package/dist/contexts/component-types.d.ts +11 -11
- package/dist/contexts/component.d.ts +14 -14
- package/dist/contexts/component.js +3 -3
- package/dist/contexts/docs.d.ts +1 -1
- package/dist/contexts/index.d.ts +18 -18
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/markdown.d.ts +1 -1
- package/dist/contexts/navigation.d.ts +2 -2
- package/dist/contexts/search.d.ts +3 -3
- package/dist/contexts/search.js +3 -3
- package/dist/contexts/use-components.d.ts +10 -10
- package/dist/{contexts-Bpupku3r.js → contexts-BsscycD4.js} +39 -6
- package/dist/{docs-CeAqG2cp.d.ts → docs-DgsQPIWJ.d.ts} +3 -3
- package/dist/{index-lRJ6GzAM.d.ts → index-BoXLd5hI.d.ts} +26 -26
- package/dist/{index-DQjgSp7S.d.ts → index-JLAhXXGX.d.ts} +6 -6
- package/dist/{index-DfX9K3qH.d.ts → index-nIbsazFr.d.ts} +8 -8
- package/dist/index.d.ts +19 -19
- package/dist/index.js +3 -3
- package/dist/languages/go.d.ts +11 -11
- package/dist/languages/go.js +3 -3
- package/dist/languages/http.d.ts +11 -11
- package/dist/languages/http.js +3 -3
- package/dist/languages/index.d.ts +11 -11
- package/dist/languages/index.js +3 -3
- package/dist/languages/java.d.ts +11 -11
- package/dist/languages/java.js +3 -3
- package/dist/languages/python.d.ts +11 -11
- package/dist/languages/python.js +3 -3
- package/dist/languages/ruby.d.ts +11 -11
- package/dist/languages/ruby.js +3 -3
- package/dist/languages/typescript.d.ts +11 -11
- package/dist/languages/typescript.js +3 -3
- package/dist/markdown/index.d.ts +3 -3
- package/dist/markdown/index.js +3 -3
- package/dist/markdown/utils.d.ts +3 -3
- package/dist/markdown/utils.js +1 -1
- package/dist/{markdown-B2ACIydo.d.ts → markdown-a5Fn1WpF.d.ts} +2 -2
- package/dist/{method-BP_Mz4r_.d.ts → method-DigRMq69.d.ts} +7 -7
- package/dist/{navigation-DQcsuSnT.d.ts → navigation-LkqNYT32.d.ts} +3 -3
- package/dist/{overview-Ds69MW_g.d.ts → overview-Df3dNUUf.d.ts} +6 -6
- package/dist/{primitives-DZjozImK.d.ts → primitives-DSeXIOUT.d.ts} +9 -9
- package/dist/{properties-DtGXYw8M.d.ts → properties-DOuwrNd-.d.ts} +4 -4
- package/dist/{routing-CHvzedJA.d.ts → routing-ByeZ2P3d.d.ts} +1 -1
- package/dist/routing.d.ts +1 -1
- package/dist/{sdk-CUDyIYiV.d.ts → sdk-DBxkJu1a.d.ts} +14 -14
- package/dist/search/index.d.ts +6 -6
- package/dist/search/index.js +3 -3
- package/dist/search/providers/algolia.d.ts +2 -2
- package/dist/search/providers/algolia.js +3 -3
- package/dist/search/providers/fuse.d.ts +2 -2
- package/dist/search/providers/fuse.js +3 -3
- package/dist/search/providers/pagefind.d.ts +2 -2
- package/dist/search/providers/walker.d.ts +2 -2
- package/dist/search/providers/walker.js +3 -3
- package/dist/search/types.d.ts +2 -2
- package/dist/{search-xIU7N2Yv.d.ts → search-arc2uMFa.d.ts} +3 -3
- package/dist/{sidebar-D3AJHVyb.d.ts → sidebar-Coj2op4S.d.ts} +5 -5
- package/dist/{snippets-8uy93yC6.d.ts → snippets-CQ0gTP8m.d.ts} +7 -7
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/{style-CPgcT0Fw.js → style-CuGfVeTo.js} +0 -6
- package/dist/{style-BEMLtSIK.d.ts → style-Dku3IzwI.d.ts} +0 -6
- package/dist/style.d.ts +1 -1
- package/dist/style.js +1 -1
- package/dist/styles/search.css +0 -117
- package/dist/{types-fEIVKcbt.d.ts → types-BKUIuYYk.d.ts} +1 -1
- package/dist/{utils-DYoSclrR.d.ts → utils-D0OXpyQu.d.ts} +2 -2
- package/dist/{utils-BCfb0F9R.js → utils-Jo_o4DX9.js} +2 -1
- package/package.json +30 -28
- package/dist/components/chat.d.ts +0 -14
- package/dist/components/chat.js +0 -142
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as ResultType, h as SearchSettings, m as SearchParams } from "./types-
|
|
1
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "./types-BKUIuYYk.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime38 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/contexts/search.d.ts
|
|
6
6
|
type SearchContextType = {
|
|
@@ -16,6 +16,6 @@ type SearchProviderProps = SearchContextType & {
|
|
|
16
16
|
declare function SearchProvider({
|
|
17
17
|
children,
|
|
18
18
|
...props
|
|
19
|
-
}: SearchProviderProps):
|
|
19
|
+
}: SearchProviderProps): react_jsx_runtime38.JSX.Element;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime33 from "react/jsx-runtime";
|
|
3
3
|
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
4
|
|
|
5
5
|
//#region src/components/sidebar.d.ts
|
|
@@ -12,25 +12,25 @@ declare function SidebarExpander({
|
|
|
12
12
|
open,
|
|
13
13
|
summary,
|
|
14
14
|
children
|
|
15
|
-
}: SidebarExpanderProps):
|
|
15
|
+
}: SidebarExpanderProps): react_jsx_runtime33.JSX.Element;
|
|
16
16
|
type SidebarMethodProps = {
|
|
17
17
|
method: SDKJSON.Method;
|
|
18
18
|
};
|
|
19
19
|
declare function SidebarMethod({
|
|
20
20
|
method
|
|
21
|
-
}: SidebarMethodProps):
|
|
21
|
+
}: SidebarMethodProps): react_jsx_runtime33.JSX.Element;
|
|
22
22
|
type SidebarResourceProps = {
|
|
23
23
|
resource: SDKJSON.Resource;
|
|
24
24
|
};
|
|
25
25
|
declare function SidebarResource({
|
|
26
26
|
resource
|
|
27
|
-
}: SidebarResourceProps):
|
|
27
|
+
}: SidebarResourceProps): react_jsx_runtime33.JSX.Element;
|
|
28
28
|
type SidebarProps = {
|
|
29
29
|
resources: SDKJSON.Resource[];
|
|
30
30
|
selectedPath?: string;
|
|
31
31
|
};
|
|
32
32
|
declare function Sidebar({
|
|
33
33
|
resources
|
|
34
|
-
}: SidebarProps):
|
|
34
|
+
}: SidebarProps): react_jsx_runtime33.JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SidebarProps as a, SidebarMethodProps as i, SidebarExpander as n, SidebarResource as o, SidebarMethod as r, SidebarResourceProps as s, Sidebar as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as TransformRequestSnippetFn } from "./sdk-
|
|
1
|
+
import { C as TransformRequestSnippetFn } from "./sdk-DBxkJu1a.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime72 from "react/jsx-runtime";
|
|
4
4
|
import * as SDKJSON from "@stainless/sdk-json";
|
|
5
5
|
|
|
6
6
|
//#region src/components/snippets.d.ts
|
|
@@ -12,7 +12,7 @@ type SnippetCodeProps = {
|
|
|
12
12
|
declare function SnippetCode({
|
|
13
13
|
content,
|
|
14
14
|
language
|
|
15
|
-
}: SnippetCodeProps):
|
|
15
|
+
}: SnippetCodeProps): react_jsx_runtime72.JSX.Element;
|
|
16
16
|
type SnippetProps = {
|
|
17
17
|
method: SDKJSON.Method;
|
|
18
18
|
requestTitle?: React$1.ReactNode;
|
|
@@ -24,23 +24,23 @@ type SnippetContainerProps = {
|
|
|
24
24
|
};
|
|
25
25
|
declare function SnippetContainer({
|
|
26
26
|
children
|
|
27
|
-
}: SnippetContainerProps):
|
|
27
|
+
}: SnippetContainerProps): react_jsx_runtime72.JSX.Element;
|
|
28
28
|
type SnippetRequestContainerProps = {
|
|
29
29
|
children?: React$1.ReactNode;
|
|
30
30
|
signature?: string;
|
|
31
31
|
};
|
|
32
32
|
declare function SnippetRequestContainer({
|
|
33
33
|
children
|
|
34
|
-
}: SnippetRequestContainerProps):
|
|
34
|
+
}: SnippetRequestContainerProps): react_jsx_runtime72.JSX.Element;
|
|
35
35
|
declare function Snippet({
|
|
36
36
|
requestTitle,
|
|
37
37
|
method,
|
|
38
38
|
transformRequestSnippet
|
|
39
|
-
}: SnippetProps):
|
|
39
|
+
}: SnippetProps): react_jsx_runtime72.JSX.Element | null;
|
|
40
40
|
declare function SnippetResponse({
|
|
41
41
|
responses
|
|
42
42
|
}: {
|
|
43
43
|
responses: SDKJSON.Method['exampleResponses'];
|
|
44
|
-
}):
|
|
44
|
+
}): react_jsx_runtime72.JSX.Element | null;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { SnippetContainerProps as a, SnippetRequestContainerProps as c, SnippetContainer as i, SnippetResponse as l, SnippetCode as n, SnippetProps as o, SnippetCodeProps as r, SnippetRequestContainer as s, Snippet as t };
|
package/dist/spec.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-ByeZ2P3d.js";
|
|
2
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
3
|
+
|
|
4
|
+
//#region src/spec.d.ts
|
|
5
|
+
type SecurityScheme = SDKJSON.Spec['security_schemes'][number];
|
|
6
|
+
interface SpecTransforms {
|
|
7
|
+
resource(resource: SDKJSON.Resource): SDKJSON.Resource;
|
|
8
|
+
method(method: SDKJSON.Method): SDKJSON.Method;
|
|
9
|
+
model(model: SDKJSON.Model): SDKJSON.Model;
|
|
10
|
+
declaration(decl: SDKJSON.DeclarationNode, language: SDKJSON.SpecLanguage): SDKJSON.DeclarationNode;
|
|
11
|
+
securityScheme(scheme: SecurityScheme): SecurityScheme;
|
|
12
|
+
snippet(snippet: string, language: string): string;
|
|
13
|
+
markdown(content?: string): string | undefined;
|
|
14
|
+
}
|
|
15
|
+
declare function defineTransforms(transforms?: Partial<SpecTransforms>): {
|
|
16
|
+
resource: (resource: SDKJSON.Resource) => SDKJSON.Resource;
|
|
17
|
+
method: (method: SDKJSON.Method) => SDKJSON.Method;
|
|
18
|
+
model: (model: SDKJSON.Model) => SDKJSON.Model;
|
|
19
|
+
declaration: (decl: SDKJSON.DeclarationNode, language: SDKJSON.SpecLanguage) => SDKJSON.DeclarationNode;
|
|
20
|
+
securityScheme: (scheme: SecurityScheme) => SecurityScheme;
|
|
21
|
+
snippet: (snippet: string, language: string) => string;
|
|
22
|
+
markdown: (content?: string) => string | undefined;
|
|
23
|
+
};
|
|
24
|
+
declare function generateNavigation(resource: Partial<SDKJSON.Resource>): {
|
|
25
|
+
title: string | undefined;
|
|
26
|
+
name: string | undefined;
|
|
27
|
+
subresources: Record<string, Partial<SDKJSON.Resource>> | undefined;
|
|
28
|
+
methods: Record<string, Partial<SDKJSON.Method>> | undefined;
|
|
29
|
+
models: Record<string, Partial<SDKJSON.Model>> | undefined;
|
|
30
|
+
stainlessPath: string | undefined;
|
|
31
|
+
terraform: {
|
|
32
|
+
Name: string;
|
|
33
|
+
QualifiedName: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
};
|
|
36
|
+
declare function generateSpecForResource(spec: SDKJSON.Spec, name: string, lang: DocsLanguage, transforms: SpecTransforms): Partial<SDKJSON.Spec>;
|
|
37
|
+
declare function transform(spec: SDKJSON.Spec, transforms: SpecTransforms): {
|
|
38
|
+
name: string;
|
|
39
|
+
lang: "node" | "go" | "python" | "terraform" | "http" | "typescript" | "ruby" | "java" | "kotlin";
|
|
40
|
+
spec: Partial<SDKJSON.Spec>;
|
|
41
|
+
}[];
|
|
42
|
+
declare function split(spec: SDKJSON.Spec, transforms?: SpecTransforms): {
|
|
43
|
+
resources: ReturnType<typeof transform>;
|
|
44
|
+
navigation: {
|
|
45
|
+
languages: ("node" | "go" | "python" | "terraform" | "http" | "typescript" | "ruby" | "java" | "kotlin")[] | undefined;
|
|
46
|
+
resources: {
|
|
47
|
+
[k: string]: {
|
|
48
|
+
title: string | undefined;
|
|
49
|
+
name: string | undefined;
|
|
50
|
+
subresources: Record<string, Partial<SDKJSON.Resource>> | undefined;
|
|
51
|
+
methods: Record<string, Partial<SDKJSON.Method>> | undefined;
|
|
52
|
+
models: Record<string, Partial<SDKJSON.Model>> | undefined;
|
|
53
|
+
stainlessPath: string | undefined;
|
|
54
|
+
terraform: {
|
|
55
|
+
Name: string;
|
|
56
|
+
QualifiedName: string;
|
|
57
|
+
} | undefined;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
declare function parseSpec(content: string): SDKJSON.Spec | undefined;
|
|
63
|
+
declare function retrieve(apiKey: string, project: string, revision: string): Promise<SDKJSON.Spec | undefined>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { SecurityScheme, SpecTransforms, defineTransforms, generateNavigation, generateSpecForResource, parseSpec, retrieve, split, transform };
|
package/dist/spec.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { n as Languages } from "./routing-8itEXLx6.js";
|
|
2
|
+
import { r as isResourceEmpty } from "./utils-2FmcHPHp.js";
|
|
3
|
+
|
|
4
|
+
//#region src/spec.ts
|
|
5
|
+
const defaultTransforms = {
|
|
6
|
+
resource: (resource) => resource,
|
|
7
|
+
method: (method) => method,
|
|
8
|
+
model: (model) => model,
|
|
9
|
+
declaration: (decl) => decl,
|
|
10
|
+
securityScheme: (scheme) => scheme,
|
|
11
|
+
snippet: (snippet) => snippet,
|
|
12
|
+
markdown: (content) => content
|
|
13
|
+
};
|
|
14
|
+
function defineTransforms(transforms = {}) {
|
|
15
|
+
return {
|
|
16
|
+
...defaultTransforms,
|
|
17
|
+
...transforms
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function removeStudioRefs(obj) {
|
|
21
|
+
if (typeof obj !== "object" || obj === null) return obj;
|
|
22
|
+
if (Array.isArray(obj)) return obj.map(removeStudioRefs);
|
|
23
|
+
const newObj = {};
|
|
24
|
+
for (const [key, value] of Object.entries(obj)) if (key !== "oasRef" && key !== "configRef") newObj[key] = removeStudioRefs(value);
|
|
25
|
+
return newObj;
|
|
26
|
+
}
|
|
27
|
+
function mapEntries({ input, fn, filter }) {
|
|
28
|
+
if (!input) return;
|
|
29
|
+
const output = {};
|
|
30
|
+
for (const [name, entry] of Object.entries(input)) {
|
|
31
|
+
if (filter && !filter(name, entry)) continue;
|
|
32
|
+
output[name] = fn ? fn(entry) : entry;
|
|
33
|
+
}
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
36
|
+
function transformRecursively(resource, transforms) {
|
|
37
|
+
return {
|
|
38
|
+
...transforms.resource(resource),
|
|
39
|
+
methods: mapEntries({
|
|
40
|
+
input: resource.methods,
|
|
41
|
+
fn: (method) => transforms.method(method)
|
|
42
|
+
}) ?? {},
|
|
43
|
+
models: mapEntries({
|
|
44
|
+
input: resource.models,
|
|
45
|
+
fn: (model) => transforms.model(model)
|
|
46
|
+
}) ?? {},
|
|
47
|
+
subresources: mapEntries({
|
|
48
|
+
input: resource.subresources,
|
|
49
|
+
fn: (sub) => transformRecursively(sub, transforms)
|
|
50
|
+
}) ?? {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function generateNavigation(resource) {
|
|
54
|
+
const { title, name, stainlessPath, terraform } = resource;
|
|
55
|
+
return {
|
|
56
|
+
title,
|
|
57
|
+
name,
|
|
58
|
+
subresources: mapEntries({
|
|
59
|
+
input: resource.subresources,
|
|
60
|
+
fn: generateNavigation
|
|
61
|
+
}),
|
|
62
|
+
methods: mapEntries({
|
|
63
|
+
input: resource.methods,
|
|
64
|
+
fn: (method) => ({
|
|
65
|
+
name: method.name,
|
|
66
|
+
stainlessPath: method.stainlessPath,
|
|
67
|
+
summary: method.summary,
|
|
68
|
+
httpMethod: method.httpMethod
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
models: mapEntries({
|
|
72
|
+
input: resource.models,
|
|
73
|
+
fn: (model) => ({
|
|
74
|
+
name: model.name,
|
|
75
|
+
stainlessPath: model.stainlessPath
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
stainlessPath,
|
|
79
|
+
terraform
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function generateSpecForResource(spec, name, lang, transforms) {
|
|
83
|
+
const resource = spec.resources[name];
|
|
84
|
+
if (!resource) throw new Error(`Invalid resource: ${name}`);
|
|
85
|
+
return {
|
|
86
|
+
resources: {
|
|
87
|
+
[name]: transformRecursively(resource, transforms),
|
|
88
|
+
...spec.resources["$shared"] ? { $shared: transformRecursively(spec.resources["$shared"], transforms) } : {}
|
|
89
|
+
},
|
|
90
|
+
security_schemes: spec.security_schemes?.map((scheme) => transforms.securityScheme(scheme)),
|
|
91
|
+
decls: { [lang]: mapEntries({
|
|
92
|
+
input: spec.decls[lang] ?? {},
|
|
93
|
+
filter: (name$1) => name$1.startsWith(resource.stainlessPath) || name$1.startsWith("(resource) $shared"),
|
|
94
|
+
fn: (decl) => transforms.declaration(decl, lang)
|
|
95
|
+
}) },
|
|
96
|
+
snippets: mapEntries({
|
|
97
|
+
input: spec.snippets,
|
|
98
|
+
filter: (name$1) => name$1.startsWith(lang),
|
|
99
|
+
fn: (snippets) => mapEntries({
|
|
100
|
+
input: snippets,
|
|
101
|
+
filter: (name$1) => name$1.startsWith(resource.stainlessPath),
|
|
102
|
+
fn: (snippet) => transforms.snippet(snippet, lang)
|
|
103
|
+
}) ?? {}
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function transform(spec, transforms) {
|
|
108
|
+
const t = {
|
|
109
|
+
...transforms,
|
|
110
|
+
declaration: (decl, lang) => transforms.declaration({
|
|
111
|
+
...decl,
|
|
112
|
+
..."docstring" in decl ? { docstring: transforms.markdown(decl.docstring) } : {}
|
|
113
|
+
}, lang),
|
|
114
|
+
method: (method) => transforms.method({
|
|
115
|
+
...method,
|
|
116
|
+
description: transforms.markdown(method.description),
|
|
117
|
+
deprecated: typeof method.deprecated === "string" ? transforms.markdown(method.deprecated) : method.deprecated
|
|
118
|
+
}),
|
|
119
|
+
securityScheme: (scheme) => transforms.securityScheme({
|
|
120
|
+
...scheme,
|
|
121
|
+
description: transforms.markdown(scheme.description)
|
|
122
|
+
})
|
|
123
|
+
};
|
|
124
|
+
const output = [];
|
|
125
|
+
for (const lang of Languages) for (const [name, resource] of Object.entries(spec.resources)) {
|
|
126
|
+
if (isResourceEmpty(resource)) continue;
|
|
127
|
+
output.push({
|
|
128
|
+
name,
|
|
129
|
+
lang,
|
|
130
|
+
spec: generateSpecForResource(spec, name, lang, t)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return output;
|
|
134
|
+
}
|
|
135
|
+
function split(spec, transforms) {
|
|
136
|
+
return {
|
|
137
|
+
resources: transform(spec, transforms ?? defineTransforms()).map(removeStudioRefs),
|
|
138
|
+
navigation: {
|
|
139
|
+
languages: spec.docs?.languages,
|
|
140
|
+
resources: Object.fromEntries(Object.entries(spec.resources).filter(([, res]) => !isResourceEmpty(res)).map(([name, res]) => [name, generateNavigation(res)]))
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function parseSpec(content) {
|
|
145
|
+
const parsed = JSON.parse(content);
|
|
146
|
+
if (parsed && typeof parsed === "object" && "kind" in parsed && parsed.kind === "spec") return parsed;
|
|
147
|
+
}
|
|
148
|
+
async function retrieve(apiKey, project, revision) {
|
|
149
|
+
const data = await (await fetch("https://app.stainless.com/api/generate/spec", {
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: {
|
|
152
|
+
Authorization: `Bearer ${apiKey}`,
|
|
153
|
+
"Content-Type": "application/json"
|
|
154
|
+
},
|
|
155
|
+
body: JSON.stringify({
|
|
156
|
+
project,
|
|
157
|
+
source: {
|
|
158
|
+
type: "git",
|
|
159
|
+
revision
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
})).json();
|
|
163
|
+
if (typeof data.spec === "string") return parseSpec(data.spec);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//#endregion
|
|
167
|
+
export { defineTransforms, generateNavigation, generateSpecForResource, parseSpec, retrieve, split, transform };
|
|
@@ -149,12 +149,6 @@ var style_default = {
|
|
|
149
149
|
SearchResultResourcePath: "stldocs-search-result-resource-path",
|
|
150
150
|
SearchResultGuideTitle: "stldocs-search-result-guide-title",
|
|
151
151
|
SearchResultGuideExcerpt: "stldocs-search-result-guide-excerpt",
|
|
152
|
-
Chat: "stldocs-chat",
|
|
153
|
-
ChatHeader: "stldocs-chat-header",
|
|
154
|
-
ChatInput: "stldocs-chat-input",
|
|
155
|
-
ChatInputButtons: "stldocs-chat-input-buttons",
|
|
156
|
-
ChatMessages: "stldocs-chat-messages",
|
|
157
|
-
ChatMessage: "stldocs-chat-message",
|
|
158
152
|
LanguageBlock: "stldocs-language-block",
|
|
159
153
|
LanguageBlockContent: "stldocs-language-block-content",
|
|
160
154
|
LanguageBlockContentIcon: "stldocs-language-block-content-icon",
|
|
@@ -149,12 +149,6 @@ declare const _default: {
|
|
|
149
149
|
readonly SearchResultResourcePath: "stldocs-search-result-resource-path";
|
|
150
150
|
readonly SearchResultGuideTitle: "stldocs-search-result-guide-title";
|
|
151
151
|
readonly SearchResultGuideExcerpt: "stldocs-search-result-guide-excerpt";
|
|
152
|
-
readonly Chat: "stldocs-chat";
|
|
153
|
-
readonly ChatHeader: "stldocs-chat-header";
|
|
154
|
-
readonly ChatInput: "stldocs-chat-input";
|
|
155
|
-
readonly ChatInputButtons: "stldocs-chat-input-buttons";
|
|
156
|
-
readonly ChatMessages: "stldocs-chat-messages";
|
|
157
|
-
readonly ChatMessage: "stldocs-chat-message";
|
|
158
152
|
readonly LanguageBlock: "stldocs-language-block";
|
|
159
153
|
readonly LanguageBlockContent: "stldocs-language-block-content";
|
|
160
154
|
readonly LanguageBlockContentIcon: "stldocs-language-block-content-icon";
|
package/dist/style.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./style-
|
|
1
|
+
import { t as _default } from "./style-Dku3IzwI.js";
|
|
2
2
|
export { _default as default };
|
package/dist/style.js
CHANGED
package/dist/styles/search.css
CHANGED
|
@@ -226,123 +226,6 @@
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
.stldocs-root #stldocs-chat {
|
|
230
|
-
display: flex;
|
|
231
|
-
flex-direction: column;
|
|
232
|
-
display: none;
|
|
233
|
-
|
|
234
|
-
.stldocs-chat-header {
|
|
235
|
-
display: flex;
|
|
236
|
-
gap: 0.5rem;
|
|
237
|
-
padding-bottom: 10px;
|
|
238
|
-
|
|
239
|
-
h5 {
|
|
240
|
-
flex-grow: 1;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.lucide-message-square-plus {
|
|
244
|
-
cursor: pointer;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
&[data-stldocs-modal-open='true'] {
|
|
249
|
-
display: flex;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.stldocs-chat-messages {
|
|
253
|
-
padding: 0 2rem;
|
|
254
|
-
overflow-y: auto;
|
|
255
|
-
flex-grow: 1;
|
|
256
|
-
|
|
257
|
-
.stldocs-loading-spinner {
|
|
258
|
-
svg {
|
|
259
|
-
animation: stldocs-spinner-rotate 1s linear infinite;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.stldocs-chat-message {
|
|
264
|
-
margin-bottom: 50px;
|
|
265
|
-
display: flex;
|
|
266
|
-
flex-direction: column;
|
|
267
|
-
gap: 1rem;
|
|
268
|
-
|
|
269
|
-
p,
|
|
270
|
-
li {
|
|
271
|
-
line-height: 150%;
|
|
272
|
-
|
|
273
|
-
code {
|
|
274
|
-
white-space: pre;
|
|
275
|
-
word-break: normal;
|
|
276
|
-
overflow-wrap: normal;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
pre {
|
|
281
|
-
background-color: rgb(30, 30, 30);
|
|
282
|
-
padding: 10px;
|
|
283
|
-
border-radius: 8px;
|
|
284
|
-
font-family: var(--stldocs-font-mono);
|
|
285
|
-
font-size: var(--stldocs-font-size-code);
|
|
286
|
-
line-height: 1.3rem;
|
|
287
|
-
white-space: pre;
|
|
288
|
-
margin-bottom: 1rem;
|
|
289
|
-
overflow-x: auto;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
table {
|
|
293
|
-
border-spacing: 10px;
|
|
294
|
-
|
|
295
|
-
thead tr {
|
|
296
|
-
font-weight: bold;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.stldocs-chat-message[data-stldocs-chat-message='user'] {
|
|
302
|
-
background-color: var(--stldocs-color-gray-6);
|
|
303
|
-
border-radius: 6px;
|
|
304
|
-
margin-left: auto;
|
|
305
|
-
padding: 12px;
|
|
306
|
-
width: 60%;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
.stldocs-chat-input {
|
|
311
|
-
border: 1px solid var(--stldocs-color-hairline);
|
|
312
|
-
background-color: var(--stldocs-color-snippet-box-bg);
|
|
313
|
-
border-radius: 8px;
|
|
314
|
-
padding: 10px;
|
|
315
|
-
display: flex;
|
|
316
|
-
gap: 1rem;
|
|
317
|
-
min-height: 100px;
|
|
318
|
-
|
|
319
|
-
textarea {
|
|
320
|
-
flex-grow: 1;
|
|
321
|
-
border: none;
|
|
322
|
-
background-color: var(--stldocs-color-snippet-box-bg);
|
|
323
|
-
outline: none;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.stldocs-chat-input-buttons {
|
|
327
|
-
display: flex;
|
|
328
|
-
flex-direction: column;
|
|
329
|
-
gap: 0.5rem;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
button {
|
|
333
|
-
padding: 0.3rem;
|
|
334
|
-
align-self: flex-start;
|
|
335
|
-
border-radius: 8px;
|
|
336
|
-
border: 1px solid var(--stldocs-color-hairline);
|
|
337
|
-
cursor: pointer;
|
|
338
|
-
|
|
339
|
-
&:hover {
|
|
340
|
-
background-color: var(--stldocs-color-gray-6);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
229
|
@keyframes stldocs-spinner-rotate {
|
|
347
230
|
100% {
|
|
348
231
|
transform: rotate(360deg);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as DocsLanguage } from "./routing-
|
|
2
|
-
import { C as TransformRequestSnippetFn } from "./sdk-
|
|
1
|
+
import { t as DocsLanguage } from "./routing-ByeZ2P3d.js";
|
|
2
|
+
import { C as TransformRequestSnippetFn } from "./sdk-DBxkJu1a.js";
|
|
3
3
|
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/utils.d.ts
|
|
@@ -11,7 +11,8 @@ function getDecl(env, path) {
|
|
|
11
11
|
return decl;
|
|
12
12
|
}
|
|
13
13
|
function getSnippet(env, path) {
|
|
14
|
-
|
|
14
|
+
const lang = env.language === "http" ? "http.curl" : `${env.language}.default`;
|
|
15
|
+
let snippet = env.spec?.snippets?.[lang]?.[path];
|
|
15
16
|
if (typeof snippet === "string" && env.transforms?.transformRequestSnippet) snippet = env.transforms.transformRequestSnippet({
|
|
16
17
|
snippet,
|
|
17
18
|
language: env.language
|
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.35",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -9,6 +9,32 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": ">=19.0.0",
|
|
14
|
+
"react-dom": ">=19.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@algolia/client-search": "^5.25.0",
|
|
18
|
+
"@markdoc/markdoc": "^0.5.4",
|
|
19
|
+
"clsx": "^2.1.1",
|
|
20
|
+
"fuse.js": "^7.1.0",
|
|
21
|
+
"htmlparser2": "^10.0.0",
|
|
22
|
+
"lucide-react": "^0.554.0",
|
|
23
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.25"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "24.10.1",
|
|
27
|
+
"@types/react": "^19.2.6",
|
|
28
|
+
"@types/react-dom": "^19.2.3",
|
|
29
|
+
"dotenv": "17.2.3",
|
|
30
|
+
"react": "^19.2.0",
|
|
31
|
+
"react-dom": "^19.2.0",
|
|
32
|
+
"tsdown": "^0.16.5",
|
|
33
|
+
"tsx": "^4.20.3",
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"@stainless/eslint-config": "0.1.0-beta.0",
|
|
36
|
+
"@stainless/sdk-json": "^0.1.0-beta.0"
|
|
37
|
+
},
|
|
12
38
|
"exports": {
|
|
13
39
|
".": {
|
|
14
40
|
"default": "./dist/index.js"
|
|
@@ -60,35 +86,11 @@
|
|
|
60
86
|
},
|
|
61
87
|
"./search/providers/*": {
|
|
62
88
|
"default": "./dist/search/providers/*.js"
|
|
89
|
+
},
|
|
90
|
+
"./spec": {
|
|
91
|
+
"default": "./dist/spec.ts"
|
|
63
92
|
}
|
|
64
93
|
},
|
|
65
|
-
"peerDependencies": {
|
|
66
|
-
"react": ">=19.0.0",
|
|
67
|
-
"react-dom": ">=19.0.0"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"@algolia/client-search": "^5.25.0",
|
|
71
|
-
"@markdoc/markdoc": "^0.5.2",
|
|
72
|
-
"ai": "4.3.19",
|
|
73
|
-
"clsx": "^2.1.1",
|
|
74
|
-
"fuse.js": "^7.1.0",
|
|
75
|
-
"htmlparser2": "^10.0.0",
|
|
76
|
-
"lucide-react": "^0.553.0",
|
|
77
|
-
"@stainless-api/ui-primitives": "0.1.0-beta.25"
|
|
78
|
-
},
|
|
79
|
-
"devDependencies": {
|
|
80
|
-
"@types/node": "24.5.1",
|
|
81
|
-
"@types/react": "^19.2.4",
|
|
82
|
-
"@types/react-dom": "^19.2.3",
|
|
83
|
-
"dotenv": "17.2.3",
|
|
84
|
-
"react": "^19.2.0",
|
|
85
|
-
"react-dom": "^19.2.0",
|
|
86
|
-
"tsdown": "^0.16.4",
|
|
87
|
-
"tsx": "^4.20.3",
|
|
88
|
-
"typescript": "5.9.3",
|
|
89
|
-
"@stainless/eslint-config": "0.1.0-beta.0",
|
|
90
|
-
"@stainless/sdk-json": "^0.1.0-beta.0"
|
|
91
|
-
},
|
|
92
94
|
"scripts": {
|
|
93
95
|
"build": "tsdown",
|
|
94
96
|
"clean": "rm -rf dist",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
//#region src/components/chat.d.ts
|
|
4
|
-
declare function Chat(): react_jsx_runtime0.JSX.Element;
|
|
5
|
-
type ChatModalProps = {
|
|
6
|
-
id?: string;
|
|
7
|
-
open?: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare function ChatModal({
|
|
10
|
-
id,
|
|
11
|
-
open: isOpen
|
|
12
|
-
}: ChatModalProps): react_jsx_runtime0.JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Chat, ChatModal, ChatModalProps };
|