Skip to content

Commit ced99fb

Browse files
authored
Merge pull request #66 from stainless-api/release-please--branches--main--changes--next--components--stainless
release: 0.1.0-alpha.18
2 parents 26e3176 + fce7d40 commit ced99fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1576
-1015
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
33
{
4-
"name": "Debian",
5-
"build": {
6-
"dockerfile": "Dockerfile"
4+
"name": "Development",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
6+
"features": {
7+
"ghcr.io/devcontainers/features/node:1": {}
8+
},
9+
"postCreateCommand": "yarn install",
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"esbenp.prettier-vscode"
14+
]
15+
}
716
}
8-
9-
// Features to add to the dev container. More info: https://containers.dev/features.
10-
// "features": {},
11-
12-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13-
// "forwardPorts": [],
14-
15-
// Configure tool-specific properties.
16-
// "customizations": {},
17-
18-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
19-
// "remoteUser": "root"
2017
}

.eslintrc.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ jobs:
6363

6464
- name: Run tests
6565
run: ./scripts/test
66-

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.17"
2+
".": "0.1.0-alpha.18"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 3
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-671323594ae99d55635e335b7c0d12d5b63fab118eb6db964566f8430ca14d5f.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-efd1aba15824e770232eda85427ae9f27371fdf1e1b3dd734dcf70bef34815a8.yml

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
# Changelog
22

3+
## 0.1.0-alpha.18 (2025-03-20)
4+
5+
Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/stainless-api/builds-node-api/compare/v0.1.0-alpha.17...v0.1.0-alpha.18)
6+
7+
### ⚠ BREAKING CHANGES
8+
9+
* **client:** uri encode path parameters ([#72](https://github.com/stainless-api/builds-node-api/issues/72))
10+
11+
### Features
12+
13+
* add SKIP_BREW env var to ./scripts/bootstrap ([#92](https://github.com/stainless-api/builds-node-api/issues/92)) ([04fcfb8](https://github.com/stainless-api/builds-node-api/commit/04fcfb8ee32f275672a17d60f211d60bd7bb7f7b))
14+
* **api:** api update ([#100](https://github.com/stainless-api/builds-node-api/issues/100)) ([ea56fde](https://github.com/stainless-api/builds-node-api/commit/ea56fde9c673487f85fbaa0ccf34d872ec602510))
15+
* **client:** accept RFC6838 JSON content types ([#93](https://github.com/stainless-api/builds-node-api/issues/93)) ([2d9c17d](https://github.com/stainless-api/builds-node-api/commit/2d9c17de975b52c83ae25b58d89bfcb2a580975a))
16+
* **client:** improve logging ([#79](https://github.com/stainless-api/builds-node-api/issues/79)) ([344d664](https://github.com/stainless-api/builds-node-api/commit/344d6640e00952b1eefd06c092731923c4c02d1e))
17+
* **client:** send `X-Stainless-Timeout` header ([#71](https://github.com/stainless-api/builds-node-api/issues/71)) ([861184e](https://github.com/stainless-api/builds-node-api/commit/861184e16b2db20c4650890859f3ff5f104200c6))
18+
19+
20+
### Bug Fixes
21+
22+
* **client:** fix export map for index exports, accept BunFile ([#76](https://github.com/stainless-api/builds-node-api/issues/76)) ([3c86845](https://github.com/stainless-api/builds-node-api/commit/3c868457d188504afef265ed7b20b0712c3095a1))
23+
* **client:** fix TypeError with undefined File ([#87](https://github.com/stainless-api/builds-node-api/issues/87)) ([f712ff1](https://github.com/stainless-api/builds-node-api/commit/f712ff1637cb377319f26fad2245a1fd421770ba))
24+
* **client:** uri encode path parameters ([#72](https://github.com/stainless-api/builds-node-api/issues/72)) ([161de71](https://github.com/stainless-api/builds-node-api/commit/161de7140299d39c751cb1d18628becefc8f98bd))
25+
* **exports:** ensure resource imports don't require /index ([#95](https://github.com/stainless-api/builds-node-api/issues/95)) ([9a94183](https://github.com/stainless-api/builds-node-api/commit/9a941838ab32777f8c8fb7d26d055d9b95a8b9e1))
26+
* **internal:** add mts file + crypto shim types ([#96](https://github.com/stainless-api/builds-node-api/issues/96)) ([01eb453](https://github.com/stainless-api/builds-node-api/commit/01eb453cd93e79d458bac967524693e8453e53f9))
27+
* **internal:** clean up undefined File test ([#88](https://github.com/stainless-api/builds-node-api/issues/88)) ([e01791a](https://github.com/stainless-api/builds-node-api/commit/e01791afd6fee8c70f0b05b25aa01e5ca9c54aa9))
28+
* **internal:** return in castToError instead of throwing ([#81](https://github.com/stainless-api/builds-node-api/issues/81)) ([9e2c68d](https://github.com/stainless-api/builds-node-api/commit/9e2c68df46639d5b9d2028f9c30c65a914969428))
29+
* **tests:** manually reset node:buffer File ([#89](https://github.com/stainless-api/builds-node-api/issues/89)) ([3da1ac2](https://github.com/stainless-api/builds-node-api/commit/3da1ac2f68f34468897ad53ab439b7946a22171c))
30+
31+
32+
### Chores
33+
34+
* **client:** detect node and deno timeout errors ([#69](https://github.com/stainless-api/builds-node-api/issues/69)) ([b61f88b](https://github.com/stainless-api/builds-node-api/commit/b61f88bef6824e6aaa95dd2e4308debc3506e11d))
35+
* **client:** handle expo fetch abort errors ([#68](https://github.com/stainless-api/builds-node-api/issues/68)) ([ab3a65b](https://github.com/stainless-api/builds-node-api/commit/ab3a65b9ef6bc12abc13f9dd38b18bf21ddcdd56))
36+
* **client:** only accept standard types for file uploads ([#84](https://github.com/stainless-api/builds-node-api/issues/84)) ([5311571](https://github.com/stainless-api/builds-node-api/commit/53115711e99f859e6c3bc143d253e564b9547465))
37+
* **docs:** improve docs for withResponse/asResponse ([#91](https://github.com/stainless-api/builds-node-api/issues/91)) ([0e6d878](https://github.com/stainless-api/builds-node-api/commit/0e6d8785dc1003aba4e264f66f3b132bda7398b3))
38+
* **exports:** cleaner resource index imports ([#98](https://github.com/stainless-api/builds-node-api/issues/98)) ([633472c](https://github.com/stainless-api/builds-node-api/commit/633472ca26c6f92569c1d14d8974172ab1cf675c))
39+
* **exports:** stop using path fallbacks ([#99](https://github.com/stainless-api/builds-node-api/issues/99)) ([ea9298e](https://github.com/stainless-api/builds-node-api/commit/ea9298ec40d13ca66107444241780f91e9de5615))
40+
* **internal:** add explicit export `type` modifier ([#67](https://github.com/stainless-api/builds-node-api/issues/67)) ([15888af](https://github.com/stainless-api/builds-node-api/commit/15888afda1e5b9c04fe33d72efe158d4fe8fb048))
41+
* **internal:** codegen related update ([#74](https://github.com/stainless-api/builds-node-api/issues/74)) ([aa8d0fe](https://github.com/stainless-api/builds-node-api/commit/aa8d0feee87946224bb27514698b61f049646b9f))
42+
* **internal:** codegen related update ([#78](https://github.com/stainless-api/builds-node-api/issues/78)) ([843d32f](https://github.com/stainless-api/builds-node-api/commit/843d32f1bc9be52a51ec9e4c515ba140426ca2a2))
43+
* **internal:** constrain synckit dev dependency ([#86](https://github.com/stainless-api/builds-node-api/issues/86)) ([88ce03d](https://github.com/stainless-api/builds-node-api/commit/88ce03da09cd881e317264fc854417be067c03e3))
44+
* **internal:** fix devcontainers setup ([#80](https://github.com/stainless-api/builds-node-api/issues/80)) ([5b73626](https://github.com/stainless-api/builds-node-api/commit/5b736268ae733698616daa2e2808a9d360936acb))
45+
* **internal:** fix tests failing on node v18 ([#85](https://github.com/stainless-api/builds-node-api/issues/85)) ([4aa4e67](https://github.com/stainless-api/builds-node-api/commit/4aa4e67a3c9ef52bff63a5250e1ac1f996ef8a70))
46+
* **internal:** fix tests not always being type checked ([#77](https://github.com/stainless-api/builds-node-api/issues/77)) ([bdf4826](https://github.com/stainless-api/builds-node-api/commit/bdf4826ef152bbfe42f5bea82981d2ab8896ee52))
47+
* **internal:** minor client file refactoring ([#97](https://github.com/stainless-api/builds-node-api/issues/97)) ([b16b851](https://github.com/stainless-api/builds-node-api/commit/b16b851f0155a39ce2fa192ee666b7bed7a60f55))
48+
* **internal:** remove extra empty newlines ([#94](https://github.com/stainless-api/builds-node-api/issues/94)) ([9b8c286](https://github.com/stainless-api/builds-node-api/commit/9b8c28645b4c18ccc8e7b6daf4a5c5eb7623c551))
49+
* **internal:** remove unnecessary todo ([#82](https://github.com/stainless-api/builds-node-api/issues/82)) ([096c6fe](https://github.com/stainless-api/builds-node-api/commit/096c6fe767f28f483a4e30a855ef274304c9baef))
50+
* **internal:** remove unused `isRequestOptions()` function ([#70](https://github.com/stainless-api/builds-node-api/issues/70)) ([ea62ef5](https://github.com/stainless-api/builds-node-api/commit/ea62ef59ca827dfafd44be6a83e1a07c9be0435c))
51+
* **internal:** update eslint config ([#75](https://github.com/stainless-api/builds-node-api/issues/75)) ([957a48e](https://github.com/stainless-api/builds-node-api/commit/957a48e0d89feeacd107bf4a90b26c863232ea42))
52+
* **types:** improved go to definition on fetchOptions ([#90](https://github.com/stainless-api/builds-node-api/issues/90)) ([4652f7b](https://github.com/stainless-api/builds-node-api/commit/4652f7b19b58496b644363b02058c2d97d8b735b))
53+
* **types:** remove type-level dependency on some platform specifics ([#65](https://github.com/stainless-api/builds-node-api/issues/65)) ([7da0b05](https://github.com/stainless-api/builds-node-api/commit/7da0b055d754a96c886dd5362cfacfb74848282c))
54+
55+
56+
### Documentation
57+
58+
* update URLs from stainlessapi.com to stainless.com ([#83](https://github.com/stainless-api/builds-node-api/issues/83)) ([f1b7512](https://github.com/stainless-api/builds-node-api/commit/f1b7512436a90a9151f28f34bf264dddff481dd4))
59+
360
## 0.1.0-alpha.17 (2025-01-23)
461

562
Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/stainless-api/builds-node-api/compare/v0.1.0-alpha.16...v0.1.0-alpha.17)

README.md

Lines changed: 93 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This library provides convenient access to the Stainless REST API from server-si
66

77
The REST API documentation can be found on [app.stainlessapi.com](https://app.stainlessapi.com/docs). The full API of this library can be found in [api.md](api.md).
88

9-
It is generated with [Stainless](https://www.stainlessapi.com/).
9+
It is generated with [Stainless](https://www.stainless.com/).
1010

1111
## Installation
1212

@@ -15,7 +15,7 @@ npm install git+ssh://[email protected]:stainless-api/builds-node-api.git
1515
```
1616

1717
> [!NOTE]
18-
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install stainless`
18+
> Once this package is [published to npm](https://app.stainless.com/docs/guides/publish), this will become: `npm install stainless`
1919
2020
## Usage
2121

@@ -63,6 +63,41 @@ main();
6363

6464
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
6565

66+
## File uploads
67+
68+
Request parameters that correspond to file uploads can be passed in many different forms:
69+
70+
- `File` (or an object with the same structure)
71+
- a `fetch` `Response` (or an object with the same structure)
72+
- an `fs.ReadStream`
73+
- the return value of our `toFile` helper
74+
75+
```ts
76+
import fs from 'fs';
77+
import Stainless, { toFile } from 'stainless';
78+
79+
const client = new Stainless();
80+
81+
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
82+
await client.builds.create({ oasSpec: fs.createReadStream('/path/to/file'), projectName: 'projectName' });
83+
84+
// Or if you have the web `File` API you can pass a `File` instance:
85+
await client.builds.create({ oasSpec: new File(['my bytes'], 'file'), projectName: 'projectName' });
86+
87+
// You can also pass a `fetch` `Response`:
88+
await client.builds.create({ oasSpec: await fetch('https://somesite/file'), projectName: 'projectName' });
89+
90+
// Finally, if none of the above are convenient, you can use our `toFile` helper:
91+
await client.builds.create({
92+
oasSpec: await toFile(Buffer.from('my bytes'), 'file'),
93+
projectName: 'projectName',
94+
});
95+
await client.builds.create({
96+
oasSpec: await toFile(new Uint8Array([0, 1, 2]), 'file'),
97+
projectName: 'projectName',
98+
});
99+
```
100+
66101
## Handling errors
67102

68103
When the library is unable to connect to the API,
@@ -146,8 +181,10 @@ Note that requests which time out will be [retried twice by default](#retries).
146181
### Accessing raw Response data (e.g., headers)
147182

148183
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
184+
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.
149185

150186
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
187+
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
151188

152189
<!-- prettier-ignore -->
153190
```ts
@@ -164,6 +201,59 @@ console.log(raw.headers.get('X-My-Header'));
164201
console.log(output.commit);
165202
```
166203

204+
### Logging
205+
206+
> [!IMPORTANT]
207+
> All log messages are intended for debugging only. The format and content of log messages
208+
> may change between releases.
209+
210+
#### Log levels
211+
212+
The log level can be configured in two ways:
213+
214+
1. Via the `STAINLESS_LOG` environment variable
215+
2. Using the `logLevel` client option (overrides the environment variable if set)
216+
217+
```ts
218+
import Stainless from 'stainless';
219+
220+
const client = new Stainless({
221+
logLevel: 'debug', // Show all log messages
222+
});
223+
```
224+
225+
Available log levels, from most to least verbose:
226+
227+
- `'debug'` - Show debug messages, info, warnings, and errors
228+
- `'info'` - Show info messages, warnings, and errors
229+
- `'warn'` - Show warnings and errors (default)
230+
- `'error'` - Show only errors
231+
- `'off'` - Disable all logging
232+
233+
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
234+
Some authentication-related headers are redacted, but sensitive data in request and response bodies
235+
may still be visible.
236+
237+
#### Custom logger
238+
239+
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
240+
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.
241+
242+
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
243+
below the configured level will not be sent to your logger.
244+
245+
```ts
246+
import Stainless from 'stainless';
247+
import pino from 'pino';
248+
249+
const logger = pino();
250+
251+
const client = new Stainless({
252+
logger: logger.child({ name: 'Stainless' }),
253+
logLevel: 'debug', // Send all messages to pino, allowing it to filter
254+
});
255+
```
256+
167257
### Making custom/undocumented requests
168258

169259
This library is typed for convenient access to the documented API. If you need to access undocumented
@@ -223,33 +313,12 @@ globalThis.fetch = fetch;
223313
Or pass it to the client:
224314

225315
```ts
316+
import Stainless from 'stainless';
226317
import fetch from 'my-fetch';
227318

228319
const client = new Stainless({ fetch });
229320
```
230321

231-
### Logging and middleware
232-
233-
You may also provide a custom `fetch` function when instantiating the client,
234-
which can be used to inspect or alter the `Request` or `Response` before/after each request:
235-
236-
```ts
237-
import { fetch } from 'undici'; // as one example
238-
import Stainless from 'stainless';
239-
240-
const client = new Stainless({
241-
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
242-
console.log('About to make a request', url, init);
243-
const response = await fetch(url, init);
244-
console.log('Got response', response);
245-
return response;
246-
},
247-
});
248-
```
249-
250-
Note that if given a `STAINLESS_LOG=debug` environment variable, this library will log all requests and responses automatically.
251-
This is intended for debugging purposes only and may change in the future without notice.
252-
253322
### Fetch options
254323

255324
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.)

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Reporting Security Issues
44

5-
This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
5+
This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
66

7-
To report a security issue, please contact the Stainless team at security@stainlessapi.com.
7+
To report a security issue, please contact the Stainless team at security@stainless.com.
88

99
## Responsible Disclosure
1010

eslint.config.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// @ts-check
2+
import tseslint from 'typescript-eslint';
3+
import unusedImports from 'eslint-plugin-unused-imports';
4+
import prettier from 'eslint-plugin-prettier';
5+
6+
export default tseslint.config(
7+
{
8+
languageOptions: {
9+
parser: tseslint.parser,
10+
parserOptions: { sourceType: 'module' },
11+
},
12+
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'],
13+
ignores: ['dist/**'],
14+
plugins: {
15+
'@typescript-eslint': tseslint.plugin,
16+
'unused-imports': unusedImports,
17+
prettier,
18+
},
19+
rules: {
20+
'no-unused-vars': 'off',
21+
'prettier/prettier': 'error',
22+
'unused-imports/no-unused-imports': 'error',
23+
'no-restricted-imports': [
24+
'error',
25+
{
26+
patterns: [
27+
{
28+
regex: '^stainless(/.*)?',
29+
message: 'Use a relative import, not a package import.',
30+
},
31+
],
32+
},
33+
],
34+
},
35+
},
36+
{
37+
files: ['tests/**', 'examples/**'],
38+
rules: {
39+
'no-restricted-imports': 'off',
40+
},
41+
},
42+
);

0 commit comments

Comments
 (0)