Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ jobs:
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/steel-node'
if: |-
github.repository == 'stainless-sdks/steel-node' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/steel-node'
if: |-
github.repository == 'stainless-sdks/steel-node' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.17.0"
".": "0.18.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-45efcdf3e5ccffb6e94a86be505b24b7b4ff05d8f1a2978c2a281729af68cb82.yml
openapi_spec_hash: 9a7724672b05d44888d67b6ed0ffc7ca
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-f51ce05f6128dcdd6b500492869910d3a43737c66d0bc13c3f2e67f42362605c.yml
openapi_spec_hash: c573fb6f26d5fb14eaf92e0a107323ec
config_hash: dce4dea59023b0a00890fa654fbfffb4
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 0.18.0 (2026-03-16)

Full Changelog: [v0.17.0...v0.18.0](https://github.com/steel-dev/steel-node/compare/v0.17.0...v0.18.0)

### Features

* **api:** api update ([84d694c](https://github.com/steel-dev/steel-node/commit/84d694cc49d7d3827e4695f64104eb0bdcefaa2a))
* **api:** api update ([34de369](https://github.com/steel-dev/steel-node/commit/34de3694682b68fe48f799cc116caa9de8df215c))
* **api:** api update ([95c42cd](https://github.com/steel-dev/steel-node/commit/95c42cd171f43b25f2b527608210f4c6a0ebdba8))


### Bug Fixes

* **client:** preserve URL params already embedded in path ([8d952ca](https://github.com/steel-dev/steel-node/commit/8d952ca2518c74a8844e48b3a390e56067f531db))
* **docs/contributing:** correct pnpm link command ([e3dddca](https://github.com/steel-dev/steel-node/commit/e3dddca3f68711c46b554a84a37c5d9161c26394))
* **internal:** skip tests that depend on mock server ([d73bebe](https://github.com/steel-dev/steel-node/commit/d73bebeca00b88e47357778c9365b332c8cbd5c2))
* publish via npm registry in release script ([74f0eae](https://github.com/steel-dev/steel-node/commit/74f0eae3e6987b92dada862eb4ab2a2ba6a22465))
* publish via npm registry in release script ([700090e](https://github.com/steel-dev/steel-node/commit/700090e76c67b8f6ee44efc41da77997f1b4edce))


### Chores

* **ci:** skip uploading artifacts on stainless-internal branches ([b5503bb](https://github.com/steel-dev/steel-node/commit/b5503bb501f549a5cc1b61c6e3795af9f733fe9e))
* **internal:** codegen related update ([4e66ed3](https://github.com/steel-dev/steel-node/commit/4e66ed36fec23cc144fc4a04c2ab564c96df5afb))
* **internal:** move stringifyQuery implementation to internal function ([ff8f1d9](https://github.com/steel-dev/steel-node/commit/ff8f1d9e4b65ab114f171c93ddba59aeded03192))
* **test:** do not count install time for mock server timeout ([e42f0e2](https://github.com/steel-dev/steel-node/commit/e42f0e28af237b8c0fc3bb7d45334f6f4f5b5cb2))
* update mock server docs ([782421b](https://github.com/steel-dev/steel-node/commit/782421bbe1366c326ec5b0e61b6538701d15118f))
* update placeholder string ([c0b12a4](https://github.com/steel-dev/steel-node/commit/c0b12a4d9f1d946d3c27b819c0bbac3af17fe172))

## 0.17.0 (2026-02-06)

Full Changelog: [v0.16.0...v0.17.0](https://github.com/steel-dev/steel-node/compare/v0.16.0...v0.17.0)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ $ yarn link steel-sdk
# With pnpm
$ pnpm link --global
$ cd ../my-package
$ pnpm link -global steel-sdk
$ pnpm link --global steel-sdk
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```sh
$ npx prism mock path/to/your/openapi.yml
$ ./scripts/mock
```

```sh
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Methods:
- <code title="get /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">list</a>({ ...params }) -> SessionslistSessionsSessionsCursor</code>
- <code title="post /v1/sessions/{sessionId}/computer">client.sessions.<a href="./src/resources/sessions/sessions.ts">computer</a>(sessionId, { ...params }) -> SessionComputerResponse</code>
- <code title="get /v1/sessions/{id}/context">client.sessions.<a href="./src/resources/sessions/sessions.ts">context</a>(id) -> SessionContext</code>
- <code title="get /v1/sessions/{id}/events">client.sessions.<a href="./src/resources/sessions/sessions.ts">events</a>(id) -> SessionEventsResponse</code>
- <code title="get /v1/sessions/{id}/events">client.sessions.<a href="./src/resources/sessions/sessions.ts">events</a>(id, { ...params }) -> SessionEventsResponse</code>
- <code title="get /v1/sessions/{id}/live-details">client.sessions.<a href="./src/resources/sessions/sessions.ts">liveDetails</a>(id) -> SessionLiveDetailsResponse</code>
- <code title="post /v1/sessions/{id}/release">client.sessions.<a href="./src/resources/sessions/sessions.ts">release</a>(id) -> SessionReleaseResponse</code>
- <code title="post /v1/sessions/release">client.sessions.<a href="./src/resources/sessions/sessions.ts">releaseAll</a>() -> SessionReleaseAllResponse</code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "steel-sdk",
"version": "0.17.0",
"version": "0.18.0",
"description": "The official TypeScript library for the Steel API",
"author": "Steel <team@steel.dev>",
"types": "dist/index.d.ts",
Expand Down
13 changes: 12 additions & 1 deletion scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version

npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
# Wait for server to come online (max 30s)
echo -n "Waiting for server"
attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Prism server to start"
cat .prism.log
exit 1
fi
echo -n "."
sleep 0.1
done
Expand Down
31 changes: 10 additions & 21 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
APIConnectionTimeoutError,
APIUserAbortError,
} from './error';
import { stringifyQuery } from './internal/utils/query';
import {
kind as shimsKind,
type Readable,
Expand Down Expand Up @@ -523,32 +524,20 @@ export abstract class APIClient {
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));

const defaultQuery = this.defaultQuery();
if (!isEmptyObj(defaultQuery)) {
query = { ...defaultQuery, ...query } as Req;
const pathQuery = Object.fromEntries(url.searchParams);
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
query = { ...pathQuery, ...defaultQuery, ...query } as Req;
}

if (typeof query === 'object' && query && !Array.isArray(query)) {
url.search = this.stringifyQuery(query as Record<string, unknown>);
url.search = this.stringifyQuery(query);
}

return url.toString();
}

protected stringifyQuery(query: Record<string, unknown>): string {
return Object.entries(query)
.filter(([_, value]) => typeof value !== 'undefined')
.map(([key, value]) => {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
}
if (value === null) {
return `${encodeURIComponent(key)}=`;
}
throw new SteelError(
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
);
})
.join('&');
protected stringifyQuery(query: object | Record<string, unknown>): string {
return stringifyQuery(query);
}

async fetchWithTimeout(
Expand Down Expand Up @@ -634,9 +623,9 @@ export abstract class APIClient {
}
}

// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
// just do what it says, but otherwise calculate a default
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
// If the API asks us to wait a certain amount of time, do what it says.
// Otherwise calculate a default.
if (timeoutMillis === undefined) {
const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
SessionComputerResponse,
SessionContext,
SessionCreateParams,
SessionEventsParams,
SessionEventsResponse,
SessionListParams,
SessionLiveDetailsResponse,
Expand Down Expand Up @@ -313,6 +314,7 @@ export declare namespace Steel {
type SessionCreateParams as SessionCreateParams,
type SessionListParams as SessionListParams,
type SessionComputerParams as SessionComputerParams,
type SessionEventsParams as SessionEventsParams,
type SessionReleaseParams as SessionReleaseParams,
type SessionReleaseAllParams as SessionReleaseAllParams,
};
Expand Down
23 changes: 23 additions & 0 deletions src/internal/utils/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { SteelError } from '../../error';

/**
* Basic re-implementation of `qs.stringify` for primitive types.
*/
export function stringifyQuery(query: object | Record<string, unknown>) {
return Object.entries(query)
.filter(([_, value]) => typeof value !== 'undefined')
.map(([key, value]) => {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
}
if (value === null) {
return `${encodeURIComponent(key)}=`;
}
throw new SteelError(
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
);
})
.join('&');
}
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export {
type SessionCreateParams,
type SessionListParams,
type SessionComputerParams,
type SessionEventsParams,
type SessionReleaseParams,
type SessionReleaseAllParams,
} from './sessions/sessions';
Expand Down
1 change: 1 addition & 0 deletions src/resources/sessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
type SessionCreateParams,
type SessionListParams,
type SessionComputerParams,
type SessionEventsParams,
type SessionReleaseParams,
type SessionReleaseAllParams,
} from './sessions';
45 changes: 41 additions & 4 deletions src/resources/sessions/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,21 @@ export class Sessions extends APIResource {
/**
* This endpoint allows you to get the recorded session events in the RRWeb format
*/
events(id: string, options?: Core.RequestOptions): Core.APIPromise<SessionEventsResponse> {
return this._client.get(`/v1/sessions/${id}/events`, options);
events(
id: string,
query?: SessionEventsParams,
options?: Core.RequestOptions,
): Core.APIPromise<SessionEventsResponse>;
events(id: string, options?: Core.RequestOptions): Core.APIPromise<SessionEventsResponse>;
events(
id: string,
query: SessionEventsParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<SessionEventsResponse> {
if (isRequestOptions(query)) {
return this.events(id, {}, query);
}
return this._client.get(`/v1/sessions/${id}/events`, { query, ...options });
}

/**
Expand Down Expand Up @@ -508,9 +521,10 @@ export interface Sessionslist {
sessions: Array<Sessionslist.Session>;

/**
* Total number of sessions matching the query
* Total number of sessions matching the query. Only included for filtered queries
* (e.g. status=live).
*/
totalCount: number;
totalCount?: number;
}

export namespace Sessionslist {
Expand Down Expand Up @@ -837,6 +851,11 @@ export interface SessionCreateParams {
*/
dimensions?: SessionCreateParams.Dimensions;

/**
* Enable experimental features for the session.
*/
experimentalFeatures?: Array<string>;

/**
* Array of extension IDs to install in the session. Use ['all_ext'] to install all
* uploaded extensions.
Expand Down Expand Up @@ -2727,6 +2746,23 @@ export declare namespace SessionComputerParams {
}
}

export interface SessionEventsParams {
/**
* Compress the events
*/
compressed?: boolean;

/**
* Optional pagination limit
*/
limit?: number;

/**
* Opaque pagination token. Pass the Next-Cursor header value to get the next page.
*/
pointer?: string;
}

export interface SessionReleaseParams {}

export interface SessionReleaseAllParams {}
Expand All @@ -2749,6 +2785,7 @@ export declare namespace Sessions {
type SessionCreateParams as SessionCreateParams,
type SessionListParams as SessionListParams,
type SessionComputerParams as SessionComputerParams,
type SessionEventsParams as SessionEventsParams,
type SessionReleaseParams as SessionReleaseParams,
type SessionReleaseAllParams as SessionReleaseAllParams,
};
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.17.0'; // x-release-please-version
export const VERSION = '0.18.0'; // x-release-please-version
4 changes: 2 additions & 2 deletions tests/api-resources/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('resource extensions', () => {
await expect(
client.extensions.update(
'extensionId',
{ file: await toFile(Buffer.from('# my file contents'), 'README.md'), url: 'https://example.com' },
{ file: await toFile(Buffer.from('Example data'), 'README.md'), url: 'https://example.com' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Steel.NotFoundError);
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('resource extensions', () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.extensions.upload(
{ file: await toFile(Buffer.from('# my file contents'), 'README.md'), url: 'https://example.com' },
{ file: await toFile(Buffer.from('Example data'), 'README.md'), url: 'https://example.com' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Steel.NotFoundError);
Expand Down
7 changes: 4 additions & 3 deletions tests/api-resources/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('resource files', () => {
);
});

test('download: request options instead of params are passed correctly', async () => {
// Mock server doesn't support application/octet-stream responses
test.skip('download: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(client.files.download('path', { path: '/_stainless_unknown_path' })).rejects.toThrow(
Steel.NotFoundError,
Expand All @@ -51,7 +52,7 @@ describe('resource files', () => {

test('upload: only required params', async () => {
const responsePromise = client.files.upload({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
file: await toFile(Buffer.from('Example data'), 'README.md'),
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -64,7 +65,7 @@ describe('resource files', () => {

test('upload: required and optional params', async () => {
const response = await client.files.upload({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
file: await toFile(Buffer.from('Example data'), 'README.md'),
path: 'path',
});
});
Expand Down
Loading
Loading