Skip to content

Commit a68f100

Browse files
release: 0.5.0 (#39)
* feat(api): manual updates (#38) * feat(client): improve logging (#40) * release: 0.5.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 73b681c commit a68f100

21 files changed

+559
-1337
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.0"
2+
".": "0.5.0"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-064a191bc556bcab46bb5d612c844437e1a4aef5981a4a99ab7f825a96ede4fa.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3655d5ad0ac3e228c1519af70dbf3d0bfa3c47a2d06d4cac92a650da051b49a6.yml

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.5.0 (2025-02-21)
4+
5+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.4.0...v0.5.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([#38](https://github.com/gitpod-io/gitpod-sdk-typescript/issues/38)) ([56c63d2](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/56c63d2b9185af120ba39e37a9a5bb2516cf33d6))
10+
* **client:** improve logging ([#40](https://github.com/gitpod-io/gitpod-sdk-typescript/issues/40)) ([65d2c1f](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/65d2c1f8660acb73bcf781ced4729f969cd31296))
11+
312
## 0.4.0 (2025-02-21)
413

514
Full Changelog: [v0.3.1...v0.4.0](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.3.1...v0.4.0)

README.md

+54-22
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,59 @@ console.log(raw.headers.get('X-My-Header'));
187187
console.log(response.organizationId);
188188
```
189189

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

192245
This library is typed for convenient access to the documented API. If you need to access undocumented
@@ -246,33 +299,12 @@ globalThis.fetch = fetch;
246299
Or pass it to the client:
247300

248301
```ts
302+
import Gitpod from '@gitpod/sdk';
249303
import fetch from 'my-fetch';
250304

251305
const client = new Gitpod({ fetch });
252306
```
253307

254-
### Logging and middleware
255-
256-
You may also provide a custom `fetch` function when instantiating the client,
257-
which can be used to inspect or alter the `Request` or `Response` before/after each request:
258-
259-
```ts
260-
import { fetch } from 'undici'; // as one example
261-
import Gitpod from '@gitpod/sdk';
262-
263-
const client = new Gitpod({
264-
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
265-
console.log('About to make a request', url, init);
266-
const response = await fetch(url, init);
267-
console.log('Got response', response);
268-
return response;
269-
},
270-
});
271-
```
272-
273-
Note that if given a `GITPOD_LOG=debug` environment variable, this library will log all requests and responses automatically.
274-
This is intended for debugging purposes only and may change in the future without notice.
275-
276308
### Fetch options
277309

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitpod/sdk",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "The official TypeScript library for the Gitpod API",
55
"author": "Gitpod <[email protected]>",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)