@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.
Files changed (162) hide show
  1. package/dist/breadcrumbs-DC2_z7nh.d.ts +25 -0
  2. package/dist/chunk-pbuEa-1d.js +13 -0
  3. package/dist/component-generics-DYxBWv1v.js +42 -0
  4. package/dist/component-generics-q-ujwX4P.d.ts +30 -0
  5. package/dist/components/MaskedInput.d.ts +14 -0
  6. package/dist/components/MaskedInput.js +74 -0
  7. package/dist/components/breadcrumbs.d.ts +2 -0
  8. package/dist/components/breadcrumbs.js +62 -0
  9. package/dist/components/icons.d.ts +72 -0
  10. package/dist/components/icons.js +953 -0
  11. package/dist/components/index.d.ts +10 -0
  12. package/dist/components/index.js +73 -0
  13. package/dist/components/method.d.ts +2 -0
  14. package/dist/components/method.js +95 -0
  15. package/dist/components/overview.d.ts +2 -0
  16. package/dist/components/overview.js +140 -0
  17. package/dist/components/primitives.d.ts +2 -0
  18. package/dist/components/primitives.js +251 -0
  19. package/dist/components/properties.d.ts +2 -0
  20. package/dist/components/properties.js +144 -0
  21. package/dist/components/sdk-sidebar.d.ts +2 -0
  22. package/dist/components/sdk-sidebar.js +50 -0
  23. package/dist/components/sdk.d.ts +2 -0
  24. package/dist/components/sdk.js +488 -0
  25. package/dist/components/snippets.d.ts +2 -0
  26. package/dist/components/snippets.js +184 -0
  27. package/dist/components/stl-sidebar.d.ts +2 -0
  28. package/dist/components/stl-sidebar.js +112 -0
  29. package/dist/contexts/component-generics.d.ts +2 -0
  30. package/dist/contexts/component-generics.js +2 -0
  31. package/dist/contexts/component-types.d.ts +6 -0
  32. package/dist/contexts/component-types.js +0 -0
  33. package/dist/contexts/component.d.ts +20 -0
  34. package/dist/contexts/component.js +21 -0
  35. package/dist/contexts/docs.d.ts +2 -0
  36. package/dist/contexts/docs.js +89 -0
  37. package/dist/contexts/index.d.ts +6 -0
  38. package/dist/contexts/index.js +43 -0
  39. package/dist/contexts/markdown.d.ts +2 -0
  40. package/dist/contexts/markdown.js +62 -0
  41. package/dist/contexts/navigation.d.ts +2 -0
  42. package/dist/contexts/navigation.js +21 -0
  43. package/dist/contexts/use-components.d.ts +5 -0
  44. package/dist/contexts/use-components.js +5 -0
  45. package/dist/docs-DSjdvCh5.d.ts +62 -0
  46. package/dist/index-DFr9Mesr.d.ts +1776 -0
  47. package/dist/index-gGDaf6FK.d.ts +464 -0
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.js +8 -7542
  50. package/dist/languages/cli.d.ts +2 -0
  51. package/dist/languages/cli.js +165 -0
  52. package/dist/languages/csharp.d.ts +2 -0
  53. package/dist/languages/csharp.js +282 -0
  54. package/dist/languages/go.d.ts +2 -0
  55. package/dist/languages/go.js +302 -0
  56. package/dist/languages/http.d.ts +2 -0
  57. package/dist/languages/http.js +385 -0
  58. package/dist/languages/index.d.ts +2 -0
  59. package/dist/languages/index.js +31 -0
  60. package/dist/languages/java.d.ts +2 -0
  61. package/dist/languages/java.js +402 -0
  62. package/dist/languages/php.d.ts +2 -0
  63. package/dist/languages/php.js +311 -0
  64. package/dist/languages/python.d.ts +2 -0
  65. package/dist/languages/python.js +268 -0
  66. package/dist/languages/ruby.d.ts +2 -0
  67. package/dist/languages/ruby.js +386 -0
  68. package/dist/languages/terraform.d.ts +2 -0
  69. package/dist/languages/terraform.js +259 -0
  70. package/dist/languages/typescript.d.ts +2 -0
  71. package/dist/languages/typescript.js +448 -0
  72. package/dist/markdown/index.d.ts +11 -0
  73. package/dist/markdown/index.js +87 -0
  74. package/dist/markdown/md.d.ts +15 -0
  75. package/dist/markdown/md.js +39 -0
  76. package/dist/markdown/printer.d.ts +13 -0
  77. package/dist/markdown/printer.js +74 -0
  78. package/dist/markdown/utils.d.ts +28 -0
  79. package/dist/markdown/utils.js +31 -0
  80. package/dist/markdown-Cwdboi_V.d.ts +33 -0
  81. package/dist/method-CNRMOUfn.d.ts +59 -0
  82. package/dist/navigation-C9ckAfpV.d.ts +29 -0
  83. package/dist/overview-CDvh184n.d.ts +39 -0
  84. package/dist/primitives-DFE_4MvV.d.ts +107 -0
  85. package/dist/properties-CVwrzWVa.d.ts +54 -0
  86. package/dist/routing-yTSG7nWM.d.ts +61 -0
  87. package/dist/routing.d.ts +2 -0
  88. package/dist/routing.js +174 -150
  89. package/dist/sdk-BkW3MDco.d.ts +128 -0
  90. package/dist/sdk-sidebar-BpDlOMat.d.ts +15 -0
  91. package/dist/spec.d.ts +65 -0
  92. package/dist/spec.js +165 -0
  93. package/dist/stl-sidebar-CKrR5ZGs.d.ts +58 -0
  94. package/dist/style.d.ts +178 -0
  95. package/dist/style.js +178 -0
  96. package/dist/styles/main.css +765 -755
  97. package/dist/styles/primitives.css +359 -442
  98. package/dist/styles/resets.css +25 -41
  99. package/dist/styles/search.css +187 -270
  100. package/dist/styles/sidebar.css +155 -69
  101. package/dist/styles/variables.css +23 -89
  102. package/dist/styles.css +3171 -0
  103. package/dist/utils.d.ts +20 -0
  104. package/dist/utils.js +52 -0
  105. package/package.json +75 -22
  106. package/dist/mcp.js +0 -16003
  107. package/dist/styles/snippets.css +0 -132
  108. package/src/components/breadcrumbs.tsx +0 -94
  109. package/src/components/chat.tsx +0 -154
  110. package/src/components/dropdown.tsx +0 -91
  111. package/src/components/icons.tsx +0 -584
  112. package/src/components/index.ts +0 -9
  113. package/src/components/method.tsx +0 -146
  114. package/src/components/overview.tsx +0 -160
  115. package/src/components/primitives.tsx +0 -284
  116. package/src/components/properties.tsx +0 -130
  117. package/src/components/scripts/dropdown.ts +0 -78
  118. package/src/components/sdk.tsx +0 -403
  119. package/src/components/sidebar.tsx +0 -99
  120. package/src/components/snippets.tsx +0 -180
  121. package/src/contexts/component-generics.tsx +0 -48
  122. package/src/contexts/component-types.tsx +0 -5
  123. package/src/contexts/component.tsx +0 -32
  124. package/src/contexts/docs.tsx +0 -75
  125. package/src/contexts/index.tsx +0 -17
  126. package/src/contexts/markdown.tsx +0 -43
  127. package/src/contexts/navigation.tsx +0 -44
  128. package/src/contexts/search.tsx +0 -28
  129. package/src/contexts/use-components.tsx +0 -4
  130. package/src/index.ts +0 -6
  131. package/src/languages/go.tsx +0 -281
  132. package/src/languages/http.tsx +0 -321
  133. package/src/languages/index.ts +0 -26
  134. package/src/languages/java.tsx +0 -358
  135. package/src/languages/python.tsx +0 -255
  136. package/src/languages/ruby.tsx +0 -320
  137. package/src/languages/typescript.tsx +0 -393
  138. package/src/markdown/index.ts +0 -107
  139. package/src/markdown/md.ts +0 -45
  140. package/src/markdown/utils.ts +0 -49
  141. package/src/routing.ts +0 -238
  142. package/src/search/form.tsx +0 -127
  143. package/src/search/index.tsx +0 -1
  144. package/src/search/indexer.ts +0 -246
  145. package/src/search/mcp.ts +0 -61
  146. package/src/search/printer.tsx +0 -86
  147. package/src/search/providers/algolia.ts +0 -88
  148. package/src/search/providers/fuse.ts +0 -19
  149. package/src/search/providers/pagefind.ts +0 -17
  150. package/src/search/providers/walker.ts +0 -30
  151. package/src/search/results.tsx +0 -182
  152. package/src/search/state.ts +0 -64
  153. package/src/search/types.ts +0 -116
  154. package/src/style.ts +0 -196
  155. package/src/styles/main.css +0 -986
  156. package/src/styles/primitives.css +0 -580
  157. package/src/styles/resets.css +0 -39
  158. package/src/styles/search.css +0 -341
  159. package/src/styles/sidebar.css +0 -85
  160. package/src/styles/snippets.css +0 -130
  161. package/src/styles/variables.css +0 -86
  162. package/src/utils.ts +0 -41
package/dist/routing.js CHANGED
@@ -1,180 +1,204 @@
1
- // src/routing.ts
2
- var Languages = [
3
- "http",
4
- "node",
5
- "python",
6
- "go",
7
- "typescript",
8
- "terraform",
9
- "ruby",
10
- "java",
11
- "kotlin"
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
- var SupportedLanguageSyntaxes = [
14
- "http",
15
- "javascript",
16
- "python",
17
- "go",
18
- "typescript",
19
- "terraform",
20
- "ruby",
21
- "java",
22
- "kotlin"
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
- var LanguageNames = {
25
- http: "HTTP",
26
- node: "TypeScript",
27
- typescript: "TypeScript",
28
- python: "Python",
29
- go: "Go",
30
- ruby: "Ruby",
31
- java: "Java",
32
- kotlin: "Kotlin",
33
- terraform: "Terraform"
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
- return language === "http" ? "http.curl" : `${language}.default`;
65
+ return language === "http" ? "http.curl" : `${language}.default`;
37
66
  }
38
67
  function isSupportedLanguage(language) {
39
- return Languages.includes(language);
68
+ return Languages.includes(language);
40
69
  }
41
- var DefaultLanguage = "http";
42
- var StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
70
+ const DefaultLanguage = "http";
71
+ const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
43
72
  function parseStainlessPath(stainlessPath) {
44
- const match = stainlessPath.match(StainlessPathPattern);
45
- if (!match) return null;
46
- return {
47
- resource: match.groups.resource.split("."),
48
- method: match.groups.method ?? null,
49
- model: match.groups.model ?? null,
50
- routable: match.groups.model ? match[1] : match[0]
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
- return stainlessPath.replace(/ > \([^\s]+\)$/, "");
83
+ return stainlessPath.replace(/ > \([^\s]+\)$/, "");
55
84
  }
56
85
  function getResource(stainlessPath) {
57
- const parsed = parseStainlessPath(stainlessPath);
58
- return parsed?.resource[0];
86
+ return parseStainlessPath(stainlessPath)?.resource?.[0];
59
87
  }
60
88
  function parseRoute(basePath, route) {
61
- if (!route.startsWith(basePath)) return { stainlessPath: "", language: DefaultLanguage };
62
- if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
63
- let stainlessPath = "";
64
- let elements = route.slice(1).split("/");
65
- let language = DefaultLanguage;
66
- if (elements[0] && Languages.includes(elements[0])) {
67
- language = elements[0];
68
- elements = elements.slice(1);
69
- }
70
- while (elements.length > 0) {
71
- const element = elements.shift();
72
- switch (element) {
73
- case "resources":
74
- stainlessPath += `(resource) ${elements.shift()}`;
75
- break;
76
- case "subresources":
77
- stainlessPath += `.${elements.shift()}`;
78
- break;
79
- case "methods":
80
- stainlessPath += ` > (method) ${elements.shift()}`;
81
- break;
82
- }
83
- }
84
- return { stainlessPath, language };
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
- const parsedPath = parseStainlessPath(stainlessPath);
88
- if (!parsedPath) return null;
89
- const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
90
- if (language && language !== DefaultLanguage) path.push(language);
91
- const resources = parsedPath.resource.flatMap((name, index) => [
92
- index > 0 ? "subresources" : "resources",
93
- name
94
- ]);
95
- const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
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
- yield { data: resource, path };
102
- for (const data of Object.values(resource.methods)) {
103
- yield { data, path: [...path, "methods", data.name] };
104
- }
105
- if (includeModels)
106
- for (const data of Object.values(resource.models)) {
107
- yield { data, path: [...path, "models", data.name] };
108
- }
109
- for (const data of Object.values(resource.subresources ?? {})) {
110
- yield* walkResource(data, [...path, "subresources", data.name]);
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
- for (const data of Object.values(spec.resources)) {
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
- spec,
120
- languages,
121
- excludeLanguages = []
122
- }) {
123
- const entries = Array.from(walkTree(spec));
124
- const langs = languages ?? spec.docs?.languages ?? ["http"];
125
- return langs.filter((lang) => Languages.includes(lang) && lang !== "terraform").filter((lang) => !excludeLanguages?.includes(lang)).flatMap(
126
- (language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
127
- title,
128
- kind,
129
- language,
130
- stainlessPath,
131
- slug: (language === "http" ? path : [language, ...path]).join("/")
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
- for (const item of Object.values(items)) {
137
- if (item.stainlessPath === target) return [item.stainlessPath];
138
- if (item.kind === "http_method") continue;
139
- const path = findNavigationPath(
140
- [...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})],
141
- target
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
- while (el) {
148
- if (el.tagName === "DETAILS") el["open"] = true;
149
- el = el.parentElement;
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
- const el = document.getElementById(stainlessPath);
154
- if (el) {
155
- expandToElement(el);
156
- el.scrollIntoView({ behavior: "smooth" });
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
- const path = generateRoute(basePath, language, stainlessPath);
161
- window.history.pushState({ stainlessPath, language }, "", path);
197
+ const path = generateRoute(basePath, language, stainlessPath);
198
+ window.history.pushState({
199
+ stainlessPath,
200
+ language
201
+ }, "", path);
162
202
  }
163
- export {
164
- LanguageNames,
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 };