@stainless-api/docs-ui 0.1.0-beta.9 → 0.1.0-beta.90
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-DC2_z7nh.d.ts +25 -0
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/component-generics-DYxBWv1v.js +42 -0
- package/dist/component-generics-q-ujwX4P.d.ts +30 -0
- package/dist/components/MaskedInput.d.ts +14 -0
- package/dist/components/MaskedInput.js +74 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +62 -0
- package/dist/components/icons.d.ts +72 -0
- package/dist/components/icons.js +953 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +73 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +95 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +140 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +251 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +144 -0
- package/dist/components/sdk-sidebar.d.ts +2 -0
- package/dist/components/sdk-sidebar.js +50 -0
- package/dist/components/sdk.d.ts +2 -0
- package/dist/components/sdk.js +488 -0
- package/dist/components/snippets.d.ts +2 -0
- package/dist/components/snippets.js +184 -0
- package/dist/components/stl-sidebar.d.ts +2 -0
- package/dist/components/stl-sidebar.js +112 -0
- package/dist/contexts/component-generics.d.ts +2 -0
- package/dist/contexts/component-generics.js +2 -0
- package/dist/contexts/component-types.d.ts +6 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +20 -0
- package/dist/contexts/component.js +21 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +89 -0
- package/dist/contexts/index.d.ts +6 -0
- package/dist/contexts/index.js +43 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +62 -0
- package/dist/contexts/navigation.d.ts +2 -0
- package/dist/contexts/navigation.js +21 -0
- package/dist/contexts/use-components.d.ts +5 -0
- package/dist/contexts/use-components.js +5 -0
- package/dist/docs-DSjdvCh5.d.ts +62 -0
- package/dist/index-DFr9Mesr.d.ts +1776 -0
- package/dist/index-gGDaf6FK.d.ts +464 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8 -7542
- package/dist/languages/cli.d.ts +2 -0
- package/dist/languages/cli.js +165 -0
- package/dist/languages/csharp.d.ts +2 -0
- package/dist/languages/csharp.js +282 -0
- package/dist/languages/go.d.ts +2 -0
- package/dist/languages/go.js +302 -0
- package/dist/languages/http.d.ts +2 -0
- package/dist/languages/http.js +385 -0
- package/dist/languages/index.d.ts +2 -0
- package/dist/languages/index.js +31 -0
- package/dist/languages/java.d.ts +2 -0
- package/dist/languages/java.js +402 -0
- package/dist/languages/php.d.ts +2 -0
- package/dist/languages/php.js +311 -0
- package/dist/languages/python.d.ts +2 -0
- package/dist/languages/python.js +268 -0
- package/dist/languages/ruby.d.ts +2 -0
- package/dist/languages/ruby.js +386 -0
- package/dist/languages/terraform.d.ts +2 -0
- package/dist/languages/terraform.js +259 -0
- package/dist/languages/typescript.d.ts +2 -0
- package/dist/languages/typescript.js +448 -0
- package/dist/markdown/index.d.ts +11 -0
- package/dist/markdown/index.js +87 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +39 -0
- package/dist/markdown/printer.d.ts +13 -0
- package/dist/markdown/printer.js +74 -0
- package/dist/markdown/utils.d.ts +28 -0
- package/dist/markdown/utils.js +31 -0
- package/dist/markdown-Cwdboi_V.d.ts +33 -0
- package/dist/method-CNRMOUfn.d.ts +59 -0
- package/dist/navigation-C9ckAfpV.d.ts +29 -0
- package/dist/overview-CDvh184n.d.ts +39 -0
- package/dist/primitives-DFE_4MvV.d.ts +107 -0
- package/dist/properties-CVwrzWVa.d.ts +54 -0
- package/dist/routing-yTSG7nWM.d.ts +61 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +174 -150
- package/dist/sdk-BkW3MDco.d.ts +128 -0
- package/dist/sdk-sidebar-BpDlOMat.d.ts +15 -0
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +165 -0
- package/dist/stl-sidebar-CKrR5ZGs.d.ts +58 -0
- package/dist/style.d.ts +178 -0
- package/dist/style.js +178 -0
- package/dist/styles/main.css +765 -755
- package/dist/styles/primitives.css +359 -442
- package/dist/styles/resets.css +25 -41
- package/dist/styles/search.css +187 -270
- package/dist/styles/sidebar.css +155 -69
- package/dist/styles/variables.css +23 -89
- package/dist/styles.css +3171 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +52 -0
- package/package.json +75 -22
- package/dist/mcp.js +0 -16003
- package/dist/styles/snippets.css +0 -132
- package/src/components/breadcrumbs.tsx +0 -94
- package/src/components/chat.tsx +0 -154
- package/src/components/dropdown.tsx +0 -91
- package/src/components/icons.tsx +0 -584
- package/src/components/index.ts +0 -9
- package/src/components/method.tsx +0 -146
- package/src/components/overview.tsx +0 -160
- package/src/components/primitives.tsx +0 -284
- package/src/components/properties.tsx +0 -130
- package/src/components/scripts/dropdown.ts +0 -78
- package/src/components/sdk.tsx +0 -403
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -180
- package/src/contexts/component-generics.tsx +0 -48
- package/src/contexts/component-types.tsx +0 -5
- package/src/contexts/component.tsx +0 -32
- package/src/contexts/docs.tsx +0 -75
- package/src/contexts/index.tsx +0 -17
- package/src/contexts/markdown.tsx +0 -43
- package/src/contexts/navigation.tsx +0 -44
- package/src/contexts/search.tsx +0 -28
- package/src/contexts/use-components.tsx +0 -4
- package/src/index.ts +0 -6
- package/src/languages/go.tsx +0 -281
- package/src/languages/http.tsx +0 -321
- package/src/languages/index.ts +0 -26
- package/src/languages/java.tsx +0 -358
- package/src/languages/python.tsx +0 -255
- package/src/languages/ruby.tsx +0 -320
- package/src/languages/typescript.tsx +0 -393
- package/src/markdown/index.ts +0 -107
- package/src/markdown/md.ts +0 -45
- package/src/markdown/utils.ts +0 -49
- package/src/routing.ts +0 -238
- package/src/search/form.tsx +0 -127
- package/src/search/index.tsx +0 -1
- package/src/search/indexer.ts +0 -246
- package/src/search/mcp.ts +0 -61
- package/src/search/printer.tsx +0 -86
- package/src/search/providers/algolia.ts +0 -88
- package/src/search/providers/fuse.ts +0 -19
- package/src/search/providers/pagefind.ts +0 -17
- package/src/search/providers/walker.ts +0 -30
- package/src/search/results.tsx +0 -182
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -196
- package/src/styles/main.css +0 -986
- package/src/styles/primitives.css +0 -580
- package/src/styles/resets.css +0 -39
- package/src/styles/search.css +0 -341
- package/src/styles/sidebar.css +0 -85
- package/src/styles/snippets.css +0 -130
- package/src/styles/variables.css +0 -86
- package/src/utils.ts +0 -41
package/dist/routing.js
CHANGED
|
@@ -1,180 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { t as __exportAll } from "./chunk-pbuEa-1d.js";
|
|
2
|
+
//#region src/routing.ts
|
|
3
|
+
var routing_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
LanguageNames: () => LanguageNames,
|
|
5
|
+
Languages: () => Languages,
|
|
6
|
+
SupportedLanguageSyntaxes: () => SupportedLanguageSyntaxes,
|
|
7
|
+
expandToElement: () => expandToElement,
|
|
8
|
+
findNavigationPath: () => findNavigationPath,
|
|
9
|
+
generateMissingRouteList: () => generateMissingRouteList,
|
|
10
|
+
generateRoute: () => generateRoute,
|
|
11
|
+
generateRouteList: () => generateRouteList,
|
|
12
|
+
getLanguageSnippet: () => getLanguageSnippet,
|
|
13
|
+
getResource: () => getResource,
|
|
14
|
+
isSupportedLanguage: () => isSupportedLanguage,
|
|
15
|
+
parseRoute: () => parseRoute,
|
|
16
|
+
parseStainlessPath: () => parseStainlessPath,
|
|
17
|
+
scrollToPath: () => scrollToPath,
|
|
18
|
+
trimStainlessPath: () => trimStainlessPath,
|
|
19
|
+
updateHistory: () => updateHistory,
|
|
20
|
+
walkTree: () => walkTree
|
|
21
|
+
});
|
|
22
|
+
const Languages = [
|
|
23
|
+
"http",
|
|
24
|
+
"node",
|
|
25
|
+
"python",
|
|
26
|
+
"go",
|
|
27
|
+
"typescript",
|
|
28
|
+
"terraform",
|
|
29
|
+
"ruby",
|
|
30
|
+
"java",
|
|
31
|
+
"kotlin",
|
|
32
|
+
"csharp",
|
|
33
|
+
"php",
|
|
34
|
+
"cli"
|
|
12
35
|
];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
const SupportedLanguageSyntaxes = [
|
|
37
|
+
"http",
|
|
38
|
+
"javascript",
|
|
39
|
+
"python",
|
|
40
|
+
"go",
|
|
41
|
+
"typescript",
|
|
42
|
+
"terraform",
|
|
43
|
+
"ruby",
|
|
44
|
+
"java",
|
|
45
|
+
"kotlin",
|
|
46
|
+
"csharp",
|
|
47
|
+
"php",
|
|
48
|
+
"bash"
|
|
23
49
|
];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
const LanguageNames = {
|
|
51
|
+
http: "HTTP",
|
|
52
|
+
node: "TypeScript",
|
|
53
|
+
typescript: "TypeScript",
|
|
54
|
+
python: "Python",
|
|
55
|
+
go: "Go",
|
|
56
|
+
ruby: "Ruby",
|
|
57
|
+
java: "Java",
|
|
58
|
+
kotlin: "Kotlin",
|
|
59
|
+
terraform: "Terraform",
|
|
60
|
+
csharp: "C#",
|
|
61
|
+
php: "PHP",
|
|
62
|
+
cli: "CLI Tool"
|
|
34
63
|
};
|
|
35
64
|
function getLanguageSnippet(language) {
|
|
36
|
-
|
|
65
|
+
return language === "http" ? "http.curl" : `${language}.default`;
|
|
37
66
|
}
|
|
38
67
|
function isSupportedLanguage(language) {
|
|
39
|
-
|
|
68
|
+
return Languages.includes(language);
|
|
40
69
|
}
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
const DefaultLanguage = "http";
|
|
71
|
+
const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
|
|
43
72
|
function parseStainlessPath(stainlessPath) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
const match = stainlessPath.match(StainlessPathPattern);
|
|
74
|
+
if (!match?.groups) return null;
|
|
75
|
+
return {
|
|
76
|
+
resource: match.groups.resource?.split(".") ?? null,
|
|
77
|
+
method: match.groups.method ?? null,
|
|
78
|
+
model: match.groups.model ?? null,
|
|
79
|
+
routable: match.groups.model ? match[1] : match[0]
|
|
80
|
+
};
|
|
52
81
|
}
|
|
53
82
|
function trimStainlessPath(stainlessPath) {
|
|
54
|
-
|
|
83
|
+
return stainlessPath.replace(/ > \([^\s]+\)$/, "");
|
|
55
84
|
}
|
|
56
85
|
function getResource(stainlessPath) {
|
|
57
|
-
|
|
58
|
-
return parsed?.resource[0];
|
|
86
|
+
return parseStainlessPath(stainlessPath)?.resource?.[0];
|
|
59
87
|
}
|
|
60
88
|
function parseRoute(basePath, route) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
if (!route.startsWith(basePath)) return {
|
|
90
|
+
stainlessPath: "",
|
|
91
|
+
language: DefaultLanguage
|
|
92
|
+
};
|
|
93
|
+
if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
|
|
94
|
+
let stainlessPath = "";
|
|
95
|
+
let elements = route.slice(1).split("/");
|
|
96
|
+
let language = DefaultLanguage;
|
|
97
|
+
if (elements[0] && Languages.includes(elements[0])) {
|
|
98
|
+
language = elements[0];
|
|
99
|
+
elements = elements.slice(1);
|
|
100
|
+
}
|
|
101
|
+
while (elements.length > 0) switch (elements.shift()) {
|
|
102
|
+
case "resources":
|
|
103
|
+
stainlessPath += `(resource) ${elements.shift()}`;
|
|
104
|
+
break;
|
|
105
|
+
case "subresources":
|
|
106
|
+
stainlessPath += `.${elements.shift()}`;
|
|
107
|
+
break;
|
|
108
|
+
case "methods":
|
|
109
|
+
stainlessPath += ` > (method) ${elements.shift()}`;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
stainlessPath,
|
|
114
|
+
language
|
|
115
|
+
};
|
|
85
116
|
}
|
|
86
117
|
function generateRoute(basePath, language, stainlessPath) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
path.push(...resourcePath);
|
|
97
|
-
if (parsedPath.method) path.push("methods", parsedPath.method);
|
|
98
|
-
return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
|
|
118
|
+
const parsedPath = parseStainlessPath(stainlessPath);
|
|
119
|
+
if (!parsedPath) return null;
|
|
120
|
+
const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
|
|
121
|
+
if (language && language !== DefaultLanguage) path.push(language);
|
|
122
|
+
const resources = parsedPath.resource.flatMap((name, index) => [index > 0 ? "subresources" : "resources", name]);
|
|
123
|
+
const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
|
|
124
|
+
path.push(...resourcePath);
|
|
125
|
+
if (parsedPath.method) path.push("methods", parsedPath.method);
|
|
126
|
+
return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
|
|
99
127
|
}
|
|
100
128
|
function* walkResource(resource, path, includeModels) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
129
|
+
yield {
|
|
130
|
+
data: resource,
|
|
131
|
+
path
|
|
132
|
+
};
|
|
133
|
+
for (const data of Object.values(resource.methods)) yield {
|
|
134
|
+
data,
|
|
135
|
+
path: [
|
|
136
|
+
...path,
|
|
137
|
+
"methods",
|
|
138
|
+
data.name
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
if (includeModels) for (const data of Object.values(resource.models)) yield {
|
|
142
|
+
data,
|
|
143
|
+
path: [
|
|
144
|
+
...path,
|
|
145
|
+
"models",
|
|
146
|
+
data.name
|
|
147
|
+
]
|
|
148
|
+
};
|
|
149
|
+
for (const data of Object.values(resource.subresources ?? {})) yield* walkResource(data, [
|
|
150
|
+
...path,
|
|
151
|
+
"subresources",
|
|
152
|
+
data.name
|
|
153
|
+
]);
|
|
112
154
|
}
|
|
113
155
|
function* walkTree(spec, includeModels) {
|
|
114
|
-
|
|
115
|
-
yield* walkResource(data, ["resources", data.name], includeModels);
|
|
116
|
-
}
|
|
156
|
+
for (const data of Object.values(spec.resources)) yield* walkResource(data, ["resources", data.name], includeModels);
|
|
117
157
|
}
|
|
118
|
-
function generateRouteList({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
function generateRouteList({ spec, languages, excludeLanguages = [] }) {
|
|
159
|
+
const entries = Array.from(walkTree(spec));
|
|
160
|
+
return (languages ?? spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang)).filter((lang) => !excludeLanguages?.includes(lang)).flatMap((language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
|
|
161
|
+
title,
|
|
162
|
+
kind,
|
|
163
|
+
language,
|
|
164
|
+
stainlessPath,
|
|
165
|
+
slug: (language === "http" ? path : [language, ...path]).join("/")
|
|
166
|
+
})));
|
|
167
|
+
}
|
|
168
|
+
function generateMissingRouteList({ spec, basePath }) {
|
|
169
|
+
const entries = Array.from(walkTree(spec));
|
|
170
|
+
return (spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang)).flatMap((language) => entries.filter(({ data: { stainlessPath, ...rest } }) => {
|
|
171
|
+
if (spec.decls?.[language]?.[stainlessPath] === void 0) return rest.kind === "http_method";
|
|
172
|
+
return false;
|
|
173
|
+
}).map(({ path }) => `${basePath.endsWith("/") ? basePath.slice(0, -1) : basePath}/${language === "http" ? path.join("/") : [language, ...path].join("/")}`));
|
|
134
174
|
}
|
|
135
175
|
function findNavigationPath(items, target) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
);
|
|
143
|
-
if (path) return [item.stainlessPath, ...path];
|
|
144
|
-
}
|
|
176
|
+
for (const item of Object.values(items)) {
|
|
177
|
+
if (item.stainlessPath === target) return [item.stainlessPath];
|
|
178
|
+
if (item.kind === "http_method") continue;
|
|
179
|
+
const path = findNavigationPath([...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})], target);
|
|
180
|
+
if (path) return [item.stainlessPath, ...path];
|
|
181
|
+
}
|
|
145
182
|
}
|
|
146
183
|
function expandToElement(el) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
184
|
+
while (el) {
|
|
185
|
+
if (el instanceof HTMLDetailsElement) el.open = true;
|
|
186
|
+
el = el.parentElement;
|
|
187
|
+
}
|
|
151
188
|
}
|
|
152
189
|
function scrollToPath(stainlessPath) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
190
|
+
const el = document.getElementById(stainlessPath);
|
|
191
|
+
if (el) {
|
|
192
|
+
expandToElement(el);
|
|
193
|
+
el.scrollIntoView({ behavior: "smooth" });
|
|
194
|
+
}
|
|
158
195
|
}
|
|
159
196
|
function updateHistory(basePath, language, stainlessPath) {
|
|
160
|
-
|
|
161
|
-
|
|
197
|
+
const path = generateRoute(basePath, language, stainlessPath);
|
|
198
|
+
window.history.pushState({
|
|
199
|
+
stainlessPath,
|
|
200
|
+
language
|
|
201
|
+
}, "", path);
|
|
162
202
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Languages,
|
|
166
|
-
SupportedLanguageSyntaxes,
|
|
167
|
-
expandToElement,
|
|
168
|
-
findNavigationPath,
|
|
169
|
-
generateRoute,
|
|
170
|
-
generateRouteList,
|
|
171
|
-
getLanguageSnippet,
|
|
172
|
-
getResource,
|
|
173
|
-
isSupportedLanguage,
|
|
174
|
-
parseRoute,
|
|
175
|
-
parseStainlessPath,
|
|
176
|
-
scrollToPath,
|
|
177
|
-
trimStainlessPath,
|
|
178
|
-
updateHistory,
|
|
179
|
-
walkTree
|
|
180
|
-
};
|
|
203
|
+
//#endregion
|
|
204
|
+
export { LanguageNames, Languages, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, routing_exports as t, trimStainlessPath, updateHistory, walkTree };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { _ as SnippetLanguage, c as ID, d as Method, f as Model, o as HasStainlessPath, t as BaseDeclaration } from "./index-DFr9Mesr.js";
|
|
2
|
+
import { t as DocsLanguage } from "./routing-yTSG7nWM.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/sdk.d.ts
|
|
7
|
+
type PropertyModelContextType = {
|
|
8
|
+
modelPath?: string;
|
|
9
|
+
propertyPath?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const PropertyModelContext: React$1.Context<PropertyModelContextType>;
|
|
12
|
+
declare function usePropertyModel(): PropertyModelContextType;
|
|
13
|
+
type ReferenceNestingContextType = string[];
|
|
14
|
+
declare const ReferenceNestingContext: React$1.Context<ReferenceNestingContextType>;
|
|
15
|
+
declare function useReferenceNesting(): ReferenceNestingContextType;
|
|
16
|
+
type DeclarationParentsContextType = ReadonlySet<string>;
|
|
17
|
+
declare function useDeclarationParents(): DeclarationParentsContextType;
|
|
18
|
+
type SDKSnippetLanguagesType = Record<SnippetLanguage, {
|
|
19
|
+
name: string;
|
|
20
|
+
}>;
|
|
21
|
+
declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
|
|
22
|
+
type TransformRequestSnippetFn = ({
|
|
23
|
+
snippet,
|
|
24
|
+
language
|
|
25
|
+
}: {
|
|
26
|
+
snippet: string;
|
|
27
|
+
language: DocsLanguage;
|
|
28
|
+
}) => string;
|
|
29
|
+
type SDKChildrenProps = {
|
|
30
|
+
paths: ID[];
|
|
31
|
+
expand?: boolean;
|
|
32
|
+
depth?: number;
|
|
33
|
+
};
|
|
34
|
+
declare function SDKChildren({
|
|
35
|
+
paths,
|
|
36
|
+
expand,
|
|
37
|
+
depth
|
|
38
|
+
}: SDKChildrenProps): react_jsx_runtime0.JSX.Element;
|
|
39
|
+
type SDKDeclarationProps = {
|
|
40
|
+
path: string;
|
|
41
|
+
expand?: boolean;
|
|
42
|
+
depth?: number;
|
|
43
|
+
};
|
|
44
|
+
declare function SDKDeclaration({
|
|
45
|
+
path,
|
|
46
|
+
expand,
|
|
47
|
+
depth
|
|
48
|
+
}: SDKDeclarationProps): react_jsx_runtime0.JSX.Element;
|
|
49
|
+
type SDKConstraintsProps = {
|
|
50
|
+
constraints?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
declare function SDKConstraints({
|
|
53
|
+
constraints
|
|
54
|
+
}: SDKConstraintsProps): react_jsx_runtime0.JSX.Element | undefined;
|
|
55
|
+
type SDKIconProps = {
|
|
56
|
+
language: SnippetLanguage;
|
|
57
|
+
size?: number;
|
|
58
|
+
};
|
|
59
|
+
declare function SDKIcon({
|
|
60
|
+
language
|
|
61
|
+
}: SDKIconProps): react_jsx_runtime0.JSX.Element | null;
|
|
62
|
+
type SDKRequestTitleProps = {
|
|
63
|
+
snippetLanguage: SnippetLanguage;
|
|
64
|
+
};
|
|
65
|
+
declare function SDKRequestTitle({
|
|
66
|
+
snippetLanguage
|
|
67
|
+
}: SDKRequestTitleProps): react_jsx_runtime0.JSX.Element;
|
|
68
|
+
type SDKExampleProps = {
|
|
69
|
+
method: Partial<Method> & HasStainlessPath;
|
|
70
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
71
|
+
};
|
|
72
|
+
declare function SDKExample({
|
|
73
|
+
method,
|
|
74
|
+
transformRequestSnippet
|
|
75
|
+
}: SDKExampleProps): react_jsx_runtime0.JSX.Element;
|
|
76
|
+
type SDKMethodProps = {
|
|
77
|
+
method: Method;
|
|
78
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
79
|
+
};
|
|
80
|
+
declare function SDKMethodHeader({
|
|
81
|
+
method
|
|
82
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element;
|
|
83
|
+
declare function useStreamingResponse(method: BaseDeclaration): ID | undefined;
|
|
84
|
+
declare function SDKMethodInfo({
|
|
85
|
+
method,
|
|
86
|
+
children
|
|
87
|
+
}: SDKMethodProps & {
|
|
88
|
+
children?: React$1.ReactNode;
|
|
89
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
90
|
+
declare function SDKMethodNotImplemented({
|
|
91
|
+
method
|
|
92
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element;
|
|
93
|
+
declare function SDKMethodInfoContent(_props: SDKMethodProps): React$1.ReactNode;
|
|
94
|
+
declare function SDKMethod({
|
|
95
|
+
method,
|
|
96
|
+
transformRequestSnippet
|
|
97
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element;
|
|
98
|
+
type SDKModelProps = {
|
|
99
|
+
model: Model;
|
|
100
|
+
};
|
|
101
|
+
declare function SDKModel({
|
|
102
|
+
model
|
|
103
|
+
}: SDKModelProps): react_jsx_runtime0.JSX.Element | null;
|
|
104
|
+
type SDKReferenceProps = {
|
|
105
|
+
stainlessPath: string;
|
|
106
|
+
children?: React$1.ReactNode;
|
|
107
|
+
};
|
|
108
|
+
declare function SDKReference({
|
|
109
|
+
stainlessPath,
|
|
110
|
+
children
|
|
111
|
+
}: SDKReferenceProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null | undefined;
|
|
112
|
+
type SDKLanguageBlockProps = {
|
|
113
|
+
language: DocsLanguage;
|
|
114
|
+
version: string;
|
|
115
|
+
install: string;
|
|
116
|
+
links: {
|
|
117
|
+
repo: string;
|
|
118
|
+
docs: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
declare function SDKLanguageBlock({
|
|
122
|
+
language,
|
|
123
|
+
version,
|
|
124
|
+
install,
|
|
125
|
+
links
|
|
126
|
+
}: SDKLanguageBlockProps): react_jsx_runtime0.JSX.Element;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { useStreamingResponse as A, SDKRequestTitleProps as C, useDeclarationParents as D, TransformRequestSnippetFn as E, usePropertyModel as O, SDKRequestTitle as S, SDKSnippetLanguagesType as T, SDKMethodNotImplemented as _, ReferenceNestingContextType as a, SDKModelProps as b, SDKConstraintsProps as c, SDKIcon as d, SDKLanguageBlock as f, SDKMethodInfoContent as g, SDKMethodInfo as h, ReferenceNestingContext as i, useReferenceNesting as k, SDKDeclaration as l, SDKMethodHeader as m, PropertyModelContext as n, SDKChildren as o, SDKMethod as p, PropertyModelContextType as r, SDKConstraints as s, DeclarationParentsContextType as t, SDKExample as u, SDKMethodProps as v, SDKSnippetLanguages as w, SDKReference as x, SDKModel as y };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h as Resource } from "./index-DFr9Mesr.js";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/sdk-sidebar.d.ts
|
|
5
|
+
type SDKSidebarProps = {
|
|
6
|
+
resources: Resource[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
|
|
10
|
+
*/
|
|
11
|
+
declare function SDKSidebar({
|
|
12
|
+
resources
|
|
13
|
+
}: SDKSidebarProps): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SDKSidebarProps as n, SDKSidebar as t };
|
package/dist/spec.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { d as Method, f as Model, h as Resource, i as DeclarationNode, v as Spec, y as SpecLanguage } from "./index-DFr9Mesr.js";
|
|
2
|
+
import { t as DocsLanguage } from "./routing-yTSG7nWM.js";
|
|
3
|
+
|
|
4
|
+
//#region src/spec.d.ts
|
|
5
|
+
type SecurityScheme = Spec['security_schemes'][number];
|
|
6
|
+
interface SpecTransforms {
|
|
7
|
+
resource(resource: Resource): Resource;
|
|
8
|
+
method(method: Method): Method;
|
|
9
|
+
model(model: Model): Model;
|
|
10
|
+
declaration(decl: DeclarationNode, language: SpecLanguage): 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: Resource) => Resource;
|
|
17
|
+
method: (method: Method) => Method;
|
|
18
|
+
model: (model: Model) => Model;
|
|
19
|
+
declaration: (decl: DeclarationNode, language: SpecLanguage) => 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<Resource>): {
|
|
25
|
+
title: string | undefined;
|
|
26
|
+
name: string | undefined;
|
|
27
|
+
subresources: Record<string, Partial<Resource>> | undefined;
|
|
28
|
+
methods: Record<string, Partial<Method>> | undefined;
|
|
29
|
+
models: Record<string, Partial<Model>> | undefined;
|
|
30
|
+
stainlessPath: string | undefined;
|
|
31
|
+
terraform: {
|
|
32
|
+
Name: string;
|
|
33
|
+
QualifiedName: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
};
|
|
36
|
+
declare function generateSpecForResource(spec: Spec, name: string, lang: DocsLanguage, transforms: SpecTransforms): Partial<Spec>;
|
|
37
|
+
declare function transform(spec: Spec, transforms: SpecTransforms): {
|
|
38
|
+
name: string;
|
|
39
|
+
lang: "http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli";
|
|
40
|
+
spec: Partial<Spec>;
|
|
41
|
+
}[];
|
|
42
|
+
declare function split(spec: Spec, transforms?: SpecTransforms): {
|
|
43
|
+
resources: ReturnType<typeof transform>;
|
|
44
|
+
navigation: {
|
|
45
|
+
languages: ("http" | "node" | "python" | "go" | "typescript" | "terraform" | "ruby" | "java" | "kotlin" | "csharp" | "php" | "cli" | "sql" | "openapi")[] | undefined;
|
|
46
|
+
resources: {
|
|
47
|
+
[k: string]: {
|
|
48
|
+
title: string | undefined;
|
|
49
|
+
name: string | undefined;
|
|
50
|
+
subresources: Record<string, Partial<Resource>> | undefined;
|
|
51
|
+
methods: Record<string, Partial<Method>> | undefined;
|
|
52
|
+
models: Record<string, Partial<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): Spec | undefined;
|
|
63
|
+
declare function retrieve(apiKey: string, project: string, revision: string): Promise<Spec | undefined>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { SecurityScheme, SpecTransforms, defineTransforms, generateNavigation, generateSpecForResource, parseSpec, retrieve, split, transform };
|