@stainless-api/docs 0.1.0-beta.99 → 1.0.0-beta.141
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/CHANGELOG.md +401 -0
- package/ambient.d.ts +6 -0
- package/eslint-suppressions.json +22 -6
- package/{eslint.config.js → eslint.config.ts} +1 -7
- package/package.json +62 -40
- package/plugin/buildAlgoliaIndex.ts +6 -12
- package/plugin/components/SDKSelect.astro +0 -6
- package/plugin/components/SnippetCode.tsx +6 -37
- package/plugin/components/search/SearchAlgolia.astro +1 -1
- package/plugin/components/search/SearchIsland.tsx +19 -13
- package/plugin/generateAPIReferenceLink.ts +0 -40
- package/plugin/globalJs/ai-dropdown-options.ts +22 -9
- package/plugin/globalJs/code-snippets.ts +5 -5
- package/plugin/globalJs/copy.ts +20 -91
- package/plugin/globalJs/navigation.ts +13 -13
- package/plugin/globalJs/summary-selection-tweak.ts +29 -0
- package/plugin/index.ts +107 -163
- package/plugin/loadPluginConfig.ts +49 -151
- package/plugin/markdown/highlighter.ts +100 -0
- package/plugin/markdown/index.ts +39 -0
- package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +2 -0
- package/plugin/react/Routing.tsx +10 -244
- package/plugin/referencePlaceholderUtils.ts +1 -1
- package/plugin/replaceSidebarPlaceholderMiddleware.ts +1 -1
- package/plugin/routes/Docs.astro +3 -1
- package/plugin/routes/Overview.astro +14 -7
- package/plugin/routes/llms.ts +186 -0
- package/plugin/routes/markdown.ts +62 -13
- package/plugin/sidebar-utils/sidebar-builder.ts +38 -12
- package/plugin/specs/defaultSpecLoader.ts +192 -0
- package/plugin/specs/fetchSpecSSR.ts +1 -1
- package/plugin/specs/utils.ts +86 -0
- package/shared/conditionalIntegration.ts +28 -0
- package/shared/getProsePages.ts +6 -7
- package/shared/virtualModule.ts +1 -26
- package/stl-docs/aiChatExamples.ts +31 -0
- package/stl-docs/chat/docs-chat-handler.ts +17 -0
- package/stl-docs/chat/hook.ts +225 -0
- package/stl-docs/chat/schemas.ts +27 -0
- package/stl-docs/chat/ui/AiChat.module.css +591 -0
- package/stl-docs/chat/ui/AiChat.tsx +175 -0
- package/stl-docs/chat/ui/Trigger.tsx +154 -0
- package/stl-docs/chat/ui/components/ChatControls.tsx +51 -0
- package/stl-docs/chat/ui/components/ChatEmpty.tsx +42 -0
- package/stl-docs/chat/ui/components/ChatLog.tsx +93 -0
- package/stl-docs/chat/ui/components/ChatMessage.tsx +47 -0
- package/stl-docs/chat/ui/components/CodeBlock.tsx +33 -0
- package/stl-docs/chat/ui/components/MessageFeedback.tsx +106 -0
- package/stl-docs/chat/ui/components/Table.tsx +15 -0
- package/stl-docs/chat/ui/components/ToolCall.tsx +34 -0
- package/stl-docs/chat/ui/components/hljs-github.css +81 -0
- package/stl-docs/chat/ui/scroll-manager.ts +86 -0
- package/stl-docs/chat/ui/types.ts +45 -0
- package/stl-docs/components/AiChatIsland.tsx +10 -12
- package/stl-docs/components/ContentPanel.astro +9 -0
- package/stl-docs/components/Footer.astro +89 -0
- package/stl-docs/components/Header.astro +0 -5
- package/stl-docs/components/PageFrame.astro +23 -8
- package/stl-docs/components/PageSidebar.astro +11 -0
- package/stl-docs/components/StainlessLogo.svg +4 -0
- package/stl-docs/components/TwoColumnContent.astro +2 -0
- package/stl-docs/components/headers/DefaultHeader.astro +6 -8
- package/stl-docs/components/headers/StackedHeader.astro +5 -53
- package/stl-docs/components/mintlify-compat/Accordion.astro +2 -2
- package/stl-docs/components/mintlify-compat/AccordionGroup.astro +0 -4
- package/stl-docs/components/mintlify-compat/Columns.astro +2 -2
- package/stl-docs/components/mintlify-compat/Frame.astro +2 -2
- package/stl-docs/components/mintlify-compat/Tab.astro +2 -2
- package/stl-docs/components/mintlify-compat/callouts/Callout.astro +2 -2
- package/stl-docs/components/mintlify-compat/callouts/Check.astro +0 -4
- package/stl-docs/components/mintlify-compat/callouts/Danger.astro +0 -4
- package/stl-docs/components/mintlify-compat/callouts/Info.astro +0 -4
- package/stl-docs/components/mintlify-compat/callouts/Note.astro +0 -4
- package/stl-docs/components/mintlify-compat/callouts/Tip.astro +0 -4
- package/stl-docs/components/mintlify-compat/callouts/Warning.astro +0 -4
- package/stl-docs/components/nav-tabs/NavDropdown.astro +12 -7
- package/stl-docs/components/nav-tabs/NavTabs.astro +5 -3
- package/stl-docs/components/nav-tabs/buildNavLinks.ts +2 -0
- package/stl-docs/components/pagination/Pagination.astro +4 -2
- package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +2 -2
- package/stl-docs/components/pagination/PaginationLinkQuiet.astro +2 -2
- package/stl-docs/components/pagination/util.ts +3 -3
- package/stl-docs/components/sidebars/BaseSidebar.astro +72 -1
- package/stl-docs/disableCalloutSyntax.ts +1 -1
- package/stl-docs/fonts.ts +5 -5
- package/stl-docs/index.ts +76 -53
- package/stl-docs/loadStlDocsConfig.ts +38 -8
- package/stl-docs/og-image/components/OpenGraphFunctionSignature.tsx +64 -0
- package/stl-docs/og-image/components/OpenGraphImage.tsx +126 -0
- package/stl-docs/og-image/config.ts +56 -0
- package/stl-docs/og-image/image-gen/generate-api-reference-og-image.tsx +188 -0
- package/stl-docs/og-image/image-gen/generate-og-image.tsx +119 -0
- package/stl-docs/og-image/image-gen/get-logo-url.ts +47 -0
- package/stl-docs/og-image/index.ts +135 -0
- package/stl-docs/og-image/routes/add-og-image.ts +45 -0
- package/stl-docs/og-image/routes/get-api-reference-og-image.ts +36 -0
- package/stl-docs/og-image/routes/get-og-image.ts +28 -0
- package/stl-docs/og-image/theme.ts +43 -0
- package/stl-docs/og-image/utils.ts +14 -0
- package/stl-docs/proseDocSync.test.ts +74 -0
- package/stl-docs/proseDocSync.ts +344 -0
- package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +4 -12
- package/stl-docs/schema-extension.ts +12 -0
- package/stl-docs/tabsMiddleware.ts +1 -1
- package/styles/overrides.css +2 -14
- package/styles/page.css +210 -71
- package/styles/sidebar.css +30 -17
- package/styles/sl-variables.css +3 -8
- package/styles/stldocs-variables.css +2 -2
- package/styles/toc.css +8 -0
- package/tsconfig.json +1 -1
- package/virtual-module.d.ts +35 -11
- package/playground-virtual-modules.d.ts +0 -96
- package/plugin/globalJs/create-playground.shim.ts +0 -3
- package/plugin/globalJs/playground-data.shim.ts +0 -1
- package/plugin/globalJs/playground-data.ts +0 -14
- package/plugin/specs/FileCache.ts +0 -99
- package/plugin/specs/generateSpec.ts +0 -112
- package/plugin/specs/index.ts +0 -132
- package/plugin/specs/inputResolver.ts +0 -146
- package/plugin/specs/worker.ts +0 -199
- package/plugin/vendor/preview.worker.docs.js +0 -26108
- package/plugin/vendor/templates/cli.md +0 -1
- package/plugin/vendor/templates/go.md +0 -316
- package/plugin/vendor/templates/java.md +0 -89
- package/plugin/vendor/templates/kotlin.md +0 -89
- package/plugin/vendor/templates/node.md +0 -235
- package/plugin/vendor/templates/python.md +0 -251
- package/plugin/vendor/templates/ruby.md +0 -147
- package/plugin/vendor/templates/terraform.md +0 -60
- package/plugin/vendor/templates/typescript.md +0 -319
- package/scripts/vendor_deps.ts +0 -50
- package/stl-docs/components/ClientRouterHead.astro +0 -41
- package/stl-docs/components/content-panel/ContentPanel.astro +0 -42
- package/stl-docs/components/headers/SplashMobileMenuToggle.astro +0 -65
- package/stl-docs/proseSearchIndexing.ts +0 -606
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# SDK_PackageTitle API Library
|
|
2
|
-
|
|
3
|
-
[)](https://npmjs.org/package/SDK_NPMPackage) SDK_JSRShield
|
|
4
|
-
|
|
5
|
-
SDK_ReadmeOpening
|
|
6
|
-
|
|
7
|
-
SDK_ScreencastURL
|
|
8
|
-
|
|
9
|
-
SDK_DocumentationReference
|
|
10
|
-
|
|
11
|
-
SDK_GeneratedByStainless
|
|
12
|
-
|
|
13
|
-
SDK_MCPReadmeSection
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
SDK_NPMInstallInstructions
|
|
18
|
-
|
|
19
|
-
SDK_JSRInstallation
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
SDK_APIReference
|
|
24
|
-
|
|
25
|
-
<!-- prettier-ignore -->
|
|
26
|
-
```js
|
|
27
|
-
SDK_Usage
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
SDK_StreamingUsage
|
|
31
|
-
|
|
32
|
-
### Request & Response types
|
|
33
|
-
|
|
34
|
-
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
35
|
-
|
|
36
|
-
<!-- prettier-ignore -->
|
|
37
|
-
```ts
|
|
38
|
-
SDK_TypeScriptUsage
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
42
|
-
|
|
43
|
-
SDK_FileUploadsUsage
|
|
44
|
-
|
|
45
|
-
SDK_BinaryUploadsUsage
|
|
46
|
-
|
|
47
|
-
## Handling errors
|
|
48
|
-
|
|
49
|
-
When the library is unable to connect to the API,
|
|
50
|
-
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
|
|
51
|
-
a subclass of `APIError` will be thrown:
|
|
52
|
-
|
|
53
|
-
<!-- prettier-ignore -->
|
|
54
|
-
```ts
|
|
55
|
-
SDK_ErrorsExample
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Error codes are as follows:
|
|
59
|
-
|
|
60
|
-
| Status Code | Error Type |
|
|
61
|
-
| ----------- | -------------------------- |
|
|
62
|
-
| 400 | `BadRequestError` |
|
|
63
|
-
| 401 | `AuthenticationError` |
|
|
64
|
-
| 403 | `PermissionDeniedError` |
|
|
65
|
-
| 404 | `NotFoundError` |
|
|
66
|
-
| 422 | `UnprocessableEntityError` |
|
|
67
|
-
| 429 | `RateLimitError` |
|
|
68
|
-
| >=500 | `InternalServerError` |
|
|
69
|
-
| N/A | `APIConnectionError` |
|
|
70
|
-
|
|
71
|
-
### Retries
|
|
72
|
-
|
|
73
|
-
Certain errors will be automatically retried SDK_DefaultMaxRetries times by default, with a short exponential backoff.
|
|
74
|
-
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
|
75
|
-
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
|
76
|
-
|
|
77
|
-
You can use the `maxRetries` option to configure or disable this:
|
|
78
|
-
|
|
79
|
-
<!-- prettier-ignore -->
|
|
80
|
-
```js
|
|
81
|
-
SDK_RetriesExample
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Timeouts
|
|
85
|
-
|
|
86
|
-
Requests time out after SDK_HumanReadableDefaultTimeout by default. You can configure this with a `timeout` option:
|
|
87
|
-
|
|
88
|
-
<!-- prettier-ignore -->
|
|
89
|
-
```ts
|
|
90
|
-
SDK_TimeoutsExample
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
On timeout, an `APIConnectionTimeoutError` is thrown.
|
|
94
|
-
|
|
95
|
-
Note that requests which time out will be [retried twice by default](#retries).
|
|
96
|
-
|
|
97
|
-
SDK_Pagination
|
|
98
|
-
|
|
99
|
-
SDK_DefaultHeaders
|
|
100
|
-
|
|
101
|
-
## Advanced Usage
|
|
102
|
-
SDK_TreeShakingDocs
|
|
103
|
-
### Accessing raw Response data (e.g., headers)
|
|
104
|
-
|
|
105
|
-
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
|
106
|
-
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
|
|
107
|
-
|
|
108
|
-
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
|
109
|
-
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
|
|
110
|
-
|
|
111
|
-
<!-- prettier-ignore -->
|
|
112
|
-
```ts
|
|
113
|
-
SDK_RawResponseExample
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Logging
|
|
117
|
-
|
|
118
|
-
> [!IMPORTANT]
|
|
119
|
-
> All log messages are intended for debugging only. The format and content of log messages
|
|
120
|
-
> may change between releases.
|
|
121
|
-
|
|
122
|
-
#### Log levels
|
|
123
|
-
|
|
124
|
-
The log level can be configured in two ways:
|
|
125
|
-
|
|
126
|
-
1. Via the `SDK_PackageLoggingEnvVar` environment variable
|
|
127
|
-
2. Using the `logLevel` client option (overrides the environment variable if set)
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
131
|
-
|
|
132
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
133
|
-
logLevel: 'debug', // Show all log messages
|
|
134
|
-
});
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Available log levels, from most to least verbose:
|
|
138
|
-
|
|
139
|
-
- `'debug'` - Show debug messages, info, warnings, and errors
|
|
140
|
-
- `'info'` - Show info messages, warnings, and errors
|
|
141
|
-
- `'warn'` - Show warnings and errors (default)
|
|
142
|
-
- `'error'` - Show only errors
|
|
143
|
-
- `'off'` - Disable all logging
|
|
144
|
-
|
|
145
|
-
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
|
|
146
|
-
Some authentication-related headers are redacted, but sensitive data in request and response bodies
|
|
147
|
-
may still be visible.
|
|
148
|
-
|
|
149
|
-
#### Custom logger
|
|
150
|
-
|
|
151
|
-
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
|
|
152
|
-
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
|
|
153
|
-
|
|
154
|
-
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
|
|
155
|
-
below the configured level will not be sent to your logger.
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
159
|
-
import pino from 'pino';
|
|
160
|
-
|
|
161
|
-
const logger = pino();
|
|
162
|
-
|
|
163
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
164
|
-
logger: logger.child({ name: 'SDK_PackageName' }),
|
|
165
|
-
logLevel: 'debug', // Send all messages to pino, allowing it to filter
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Making custom/undocumented requests
|
|
170
|
-
|
|
171
|
-
This library is typed for convenient access to the documented API. If you need to access undocumented
|
|
172
|
-
endpoints, params, or response properties, the library can still be used.
|
|
173
|
-
|
|
174
|
-
#### Undocumented endpoints
|
|
175
|
-
|
|
176
|
-
To make requests to undocumented endpoints, you can use `SDK_ClientName.get`, `SDK_ClientName.post`, and other HTTP verbs.
|
|
177
|
-
Options on the client, such as retries, will be respected when making these requests.
|
|
178
|
-
|
|
179
|
-
```ts
|
|
180
|
-
await SDK_ClientName.post('/some/path', {
|
|
181
|
-
body: { some_prop: 'foo' },
|
|
182
|
-
query: { some_query_arg: 'bar' },
|
|
183
|
-
});
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
#### Undocumented request params
|
|
187
|
-
|
|
188
|
-
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
|
|
189
|
-
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
|
|
190
|
-
send will be sent as-is.
|
|
191
|
-
|
|
192
|
-
```ts
|
|
193
|
-
SDK_ExampleClientMethodName({
|
|
194
|
-
// ...
|
|
195
|
-
// @ts-expect-error baz is not yet public
|
|
196
|
-
baz: 'undocumented option',
|
|
197
|
-
});
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
|
|
201
|
-
extra param in the body.
|
|
202
|
-
|
|
203
|
-
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
|
|
204
|
-
options.
|
|
205
|
-
|
|
206
|
-
#### Undocumented response properties
|
|
207
|
-
|
|
208
|
-
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
|
|
209
|
-
the response object, or cast the response object to the requisite type. Like the request params, we do not
|
|
210
|
-
validate or strip extra properties from the response from the API.
|
|
211
|
-
|
|
212
|
-
### Customizing the fetch client
|
|
213
|
-
|
|
214
|
-
By default, this library expects a global `fetch` function is defined.
|
|
215
|
-
|
|
216
|
-
If you want to use a different `fetch` function, you can either polyfill the global:
|
|
217
|
-
|
|
218
|
-
```ts
|
|
219
|
-
import fetch from 'my-fetch';
|
|
220
|
-
|
|
221
|
-
globalThis.fetch = fetch;
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
Or pass it to the client:
|
|
225
|
-
|
|
226
|
-
```ts
|
|
227
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
228
|
-
import fetch from 'my-fetch';
|
|
229
|
-
|
|
230
|
-
const SDK_ClientName = new SDK_PackageName({ fetch });
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Fetch options
|
|
234
|
-
|
|
235
|
-
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
|
236
|
-
|
|
237
|
-
```ts
|
|
238
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
239
|
-
|
|
240
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
241
|
-
fetchOptions: {
|
|
242
|
-
// `RequestInit` options
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
#### Configuring proxies
|
|
248
|
-
|
|
249
|
-
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
|
250
|
-
options to requests:
|
|
251
|
-
|
|
252
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
253
|
-
|
|
254
|
-
```ts
|
|
255
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
256
|
-
import * as undici from 'undici';
|
|
257
|
-
|
|
258
|
-
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
|
259
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
260
|
-
fetchOptions: {
|
|
261
|
-
dispatcher: proxyAgent,
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
267
|
-
|
|
268
|
-
```ts
|
|
269
|
-
import SDK_PackageName from 'SDK_NPMPackage';
|
|
270
|
-
|
|
271
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
272
|
-
fetchOptions: {
|
|
273
|
-
proxy: 'http://localhost:8888',
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
279
|
-
|
|
280
|
-
```ts
|
|
281
|
-
import SDK_PackageName from 'SDK_DenoSpecifier';
|
|
282
|
-
|
|
283
|
-
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
|
284
|
-
const SDK_ClientName = new SDK_PackageName({
|
|
285
|
-
fetchOptions: {
|
|
286
|
-
client: httpClient,
|
|
287
|
-
},
|
|
288
|
-
});
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Frequently Asked Questions
|
|
292
|
-
|
|
293
|
-
## Semantic versioning
|
|
294
|
-
|
|
295
|
-
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
296
|
-
|
|
297
|
-
1. Changes that only affect static types, without breaking runtime behavior.
|
|
298
|
-
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
299
|
-
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
300
|
-
|
|
301
|
-
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
302
|
-
|
|
303
|
-
We are keen for your feedback; please open an [issue](SDK_RepoURL/issues) with questions, bugs, or suggestions.
|
|
304
|
-
|
|
305
|
-
## Requirements
|
|
306
|
-
|
|
307
|
-
TypeScript >= 4.9 is supported.
|
|
308
|
-
|
|
309
|
-
The following runtimes are supported:
|
|
310
|
-
|
|
311
|
-
SDK_SupportedRuntimes
|
|
312
|
-
|
|
313
|
-
Note that React Native is not supported at this time.
|
|
314
|
-
|
|
315
|
-
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
|
|
316
|
-
|
|
317
|
-
## Contributing
|
|
318
|
-
|
|
319
|
-
See [the contributing documentation](./CONTRIBUTING.md).
|
package/scripts/vendor_deps.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { config } from 'dotenv';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
import { Languages } from '@stainless-api/docs-ui/routing';
|
|
7
|
-
|
|
8
|
-
const DEPS_DIR = './plugin/vendor';
|
|
9
|
-
|
|
10
|
-
config();
|
|
11
|
-
|
|
12
|
-
const envSchema = z.object({
|
|
13
|
-
// absolute path to the Stainless monorepo root
|
|
14
|
-
STAINLESS_ROOT: z.string(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const env = envSchema.parse(process.env);
|
|
18
|
-
|
|
19
|
-
console.log(`Using Stainless monorepo at ${env.STAINLESS_ROOT}`);
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(DEPS_DIR)) {
|
|
22
|
-
fs.rmSync(DEPS_DIR, { recursive: true });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
fs.mkdirSync(DEPS_DIR, { recursive: true });
|
|
26
|
-
|
|
27
|
-
const previewWorkerPath = path.join(
|
|
28
|
-
env.STAINLESS_ROOT,
|
|
29
|
-
'/packages/preview-worker/dist/stainless/preview.worker.docs.js',
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const readmeTemplatePath = path.join(env.STAINLESS_ROOT, '/legacy-dir-root/templates');
|
|
33
|
-
|
|
34
|
-
fs.copyFileSync(previewWorkerPath, path.join(DEPS_DIR, 'preview.worker.docs.js'));
|
|
35
|
-
|
|
36
|
-
console.log(`✅ cp ${previewWorkerPath} -> ${path.join(DEPS_DIR, 'preview.worker.docs.js')}`);
|
|
37
|
-
|
|
38
|
-
if (fs.existsSync(readmeTemplatePath)) {
|
|
39
|
-
fs.mkdirSync(path.join(DEPS_DIR, 'templates'));
|
|
40
|
-
|
|
41
|
-
for (const language of Languages) {
|
|
42
|
-
const mdPath = path.join(readmeTemplatePath, language, 'README.md');
|
|
43
|
-
const dest = path.join(DEPS_DIR, 'templates', `${language}.md`);
|
|
44
|
-
|
|
45
|
-
if (fs.existsSync(mdPath)) {
|
|
46
|
-
fs.copyFileSync(mdPath, dest);
|
|
47
|
-
console.log(`✅ cp ${mdPath} -> ${dest}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { ClientRouter } from 'astro:transitions';
|
|
3
|
-
import Default from '@astrojs/starlight/components/Head.astro';
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<style is:global>
|
|
7
|
-
/* Disable native View Transitions animations */
|
|
8
|
-
:root::view-transition-old(root),
|
|
9
|
-
:root::view-transition-new(root) {
|
|
10
|
-
animation: none;
|
|
11
|
-
}
|
|
12
|
-
:root::view-transition-group(root) {
|
|
13
|
-
animation-duration: 0s;
|
|
14
|
-
}
|
|
15
|
-
</style>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
console.log('[EXPERIMENTAL] using client router');
|
|
19
|
-
</script>
|
|
20
|
-
<script>
|
|
21
|
-
function setNavLinksMode(doc: Document) {
|
|
22
|
-
let mode = localStorage.getItem('stl-nav-links-mode');
|
|
23
|
-
// initial guess
|
|
24
|
-
if (mode === null) {
|
|
25
|
-
mode = window.innerWidth < 1000 ? 'mobile' : 'desktop';
|
|
26
|
-
}
|
|
27
|
-
doc.documentElement.classList.add('stl-nav-links-mode-' + mode);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setNavLinksMode(document);
|
|
31
|
-
|
|
32
|
-
// https://docs.astro.build/en/guides/view-transitions/#astrobefore-swap
|
|
33
|
-
|
|
34
|
-
document.addEventListener('astro:before-swap', (event) => {
|
|
35
|
-
setNavLinksMode(event.newDocument);
|
|
36
|
-
});
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<ClientRouter />
|
|
40
|
-
|
|
41
|
-
<Default />
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<div class="content-panel sl-container stl-ui-prose">
|
|
6
|
-
<slot />
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<style>
|
|
10
|
-
@layer starlight.core {
|
|
11
|
-
.content-panel {
|
|
12
|
-
padding: 1.5rem var(--sl-content-pad-x);
|
|
13
|
-
}
|
|
14
|
-
.sl-container {
|
|
15
|
-
max-width: var(--sl-content-width);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (min-width: 72rem) {
|
|
19
|
-
.sl-container {
|
|
20
|
-
margin-inline: var(--sl-content-margin-inline, auto);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.content-panel {
|
|
26
|
-
padding: 0 var(--sl-content-pad-x) 0 var(--sl-content-pad-x);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.content-panel + .content-panel {
|
|
30
|
-
margin-top: 24px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@media (min-width: 50rem) {
|
|
34
|
-
.content-panel {
|
|
35
|
-
padding: 0 0 0 var(--sl-content-pad-x);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.stl-prose-page-nav-container {
|
|
40
|
-
padding: 1rem 0 0;
|
|
41
|
-
}
|
|
42
|
-
</style>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle';
|
|
3
|
-
import Sidebar from 'virtual:starlight/components/Sidebar';
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<div class="stl-splash-mobile-menu-toggle">
|
|
7
|
-
<MobileMenuToggle />
|
|
8
|
-
<div id="starlight__sidebar" class="sidebar sidebar-pane">
|
|
9
|
-
<div class="sidebar-content sl-flex">
|
|
10
|
-
<Sidebar />
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<style>
|
|
16
|
-
@layer starlight.core {
|
|
17
|
-
.sidebar-pane {
|
|
18
|
-
li,
|
|
19
|
-
li a,
|
|
20
|
-
li a[aria-current='page'] {
|
|
21
|
-
all: revert-layer;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
:global([aria-expanded='true']) ~ .sidebar-pane {
|
|
27
|
-
--sl-sidebar-visibility: visible;
|
|
28
|
-
}
|
|
29
|
-
.sidebar-pane {
|
|
30
|
-
visibility: var(--sl-sidebar-visibility, hidden);
|
|
31
|
-
position: fixed;
|
|
32
|
-
z-index: var(--sl-z-index-menu);
|
|
33
|
-
inset-block: var(--sl-nav-height) 0;
|
|
34
|
-
inset-inline-start: 0;
|
|
35
|
-
width: 100%;
|
|
36
|
-
overflow-y: auto;
|
|
37
|
-
left: 0;
|
|
38
|
-
|
|
39
|
-
a {
|
|
40
|
-
font-size: var(--stl-typography-scale-sm);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.sidebar-content {
|
|
45
|
-
height: 100%;
|
|
46
|
-
min-height: max-content;
|
|
47
|
-
padding: 1rem var(--sl-sidebar-pad-x) 0;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
gap: 1rem;
|
|
50
|
-
background-color: var(--stl-color-background);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@media (min-width: 50rem) {
|
|
54
|
-
.stl-splash-mobile-menu-toggle {
|
|
55
|
-
display: none;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
59
|
-
<style is:global>
|
|
60
|
-
.stl-splash-mobile-menu-toggle button {
|
|
61
|
-
position: relative;
|
|
62
|
-
top: unset;
|
|
63
|
-
inset-inline-end: unset;
|
|
64
|
-
}
|
|
65
|
-
</style>
|