Skip to content
Open
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
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.1.0-alpha.31"
".": "0.1.0-alpha.32"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company/sfc-nodes-679b42a61deffd275fd9e01d6e2c0024540cd0059f4cc01bb52cc2876aaff3af.yml
openapi_spec_hash: 8c3eea1499910eb3683d774fe1a21f79
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company/sfc-nodes-58790875b9aca7481caf8eadc7c5235d56b2134a0733e4a76ac32c5fe97ac9fa.yml
openapi_spec_hash: 345ddd17750fb97c4ab7c9156b89e541
config_hash: 8457a42ab599fb499cdacdb3ff40cfe9
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.1.0-alpha.32 (2026-07-01)

Full Changelog: [v0.1.0-alpha.31...v0.1.0-alpha.32](https://github.com/sfcompute/nodes-typescript/compare/v0.1.0-alpha.31...v0.1.0-alpha.32)

### Features

* **api:** api update ([5e5179e](https://github.com/sfcompute/nodes-typescript/commit/5e5179e1706895ba15ab49a5cd6ab6e3bf7aff2d))
* **api:** api update ([9af0bc4](https://github.com/sfcompute/nodes-typescript/commit/9af0bc4c3845a3666b132927c36b564f276ef5d4))
* **api:** api update ([41d0397](https://github.com/sfcompute/nodes-typescript/commit/41d039709d0b6a83adaf223ff3ec8f08619b3bd8))
* **api:** api update ([35f91a2](https://github.com/sfcompute/nodes-typescript/commit/35f91a27ce035bbf213c19243ce481312855641d))


### Bug Fixes

* **client:** send content-type header for requests with an omitted optional body ([7246bb9](https://github.com/sfcompute/nodes-typescript/commit/7246bb916cb644bca7fd48e6bd9ba1f66f64ad53))


### Chores

* **internal:** codegen related update ([f6cf9d5](https://github.com/sfcompute/nodes-typescript/commit/f6cf9d5c39d45df96bee9673184fb5f955c69dd3))

## 0.1.0-alpha.31 (2026-05-19)

Full Changelog: [v0.1.0-alpha.30...v0.1.0-alpha.31](https://github.com/sfcompute/nodes-typescript/compare/v0.1.0-alpha.30...v0.1.0-alpha.31)
Expand Down
43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const client = new SFCNodes({
bearerToken: process.env['SFC_NODES_BEARER_TOKEN'], // This is the default and can be omitted
});

const listResponseNode = await client.nodes.list();
const images = await client.vms.images.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' });

console.log(listResponseNode.data);
console.log(images.data);
```

### Request & Response types
Expand All @@ -43,7 +43,8 @@ const client = new SFCNodes({
bearerToken: process.env['SFC_NODES_BEARER_TOKEN'], // This is the default and can be omitted
});

const listResponseNode: SFCNodes.ListResponseNode = await client.nodes.list();
const params: SFCNodes.VMs.ImageListParams = { workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' };
const images: SFCNodes.VMs.ImageListResponse = await client.vms.images.list(params);
```

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
Expand All @@ -56,15 +57,17 @@ a subclass of `APIError` will be thrown:

<!-- prettier-ignore -->
```ts
const listResponseNode = await client.nodes.list().catch(async (err) => {
if (err instanceof SFCNodes.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
const images = await client.vms.images
.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' })
.catch(async (err) => {
if (err instanceof SFCNodes.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
```

Error codes are as follows:
Expand Down Expand Up @@ -96,7 +99,7 @@ const client = new SFCNodes({
});

// Or, configure per-request:
await client.nodes.list({
await client.vms.images.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' }, {
maxRetries: 5,
});
```
Expand All @@ -113,7 +116,7 @@ const client = new SFCNodes({
});

// Override per-request:
await client.nodes.list({
await client.vms.images.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -136,13 +139,17 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
```ts
const client = new SFCNodes();

const response = await client.nodes.list().asResponse();
const response = await client.vms.images
.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' })
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: listResponseNode, response: raw } = await client.nodes.list().withResponse();
const { data: images, response: raw } = await client.vms.images
.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(listResponseNode.data);
console.log(images.data);
```

### Logging
Expand Down Expand Up @@ -222,7 +229,7 @@ parameter. This library doesn't validate at runtime that the request matches the
send will be sent as-is.

```ts
client.nodes.list({
client.vms.images.list({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
Expand Down
54 changes: 0 additions & 54 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
# VMs

Types:

- <code><a href="./src/resources/vms/vms.ts">VMLogsResponse</a></code>
- <code><a href="./src/resources/vms/vms.ts">VMSSHResponse</a></code>

Methods:

- <code title="get /v0/vms/logs2">client.vms.<a href="./src/resources/vms/vms.ts">logs</a>({ ...params }) -> VMLogsResponse</code>
- <code title="get /v0/vms/ssh">client.vms.<a href="./src/resources/vms/vms.ts">ssh</a>({ ...params }) -> VMSSHResponse</code>

## Script

Types:

- <code><a href="./src/resources/vms/script.ts">UserData</a></code>
- <code><a href="./src/resources/vms/script.ts">ScriptCreateResponse</a></code>
- <code><a href="./src/resources/vms/script.ts">ScriptRetrieveResponse</a></code>

Methods:

- <code title="post /v0/vms/script">client.vms.script.<a href="./src/resources/vms/script.ts">create</a>({ ...params }) -> ScriptCreateResponse</code>
- <code title="get /v0/vms/script">client.vms.script.<a href="./src/resources/vms/script.ts">retrieve</a>() -> ScriptRetrieveResponse</code>

## Images

Types:
Expand All @@ -37,37 +16,4 @@ Methods:

# Nodes

Types:

- <code><a href="./src/resources/nodes.ts">AcceleratorType</a></code>
- <code><a href="./src/resources/nodes.ts">CreateNodesRequest</a></code>
- <code><a href="./src/resources/nodes.ts">ErrorContent</a></code>
- <code><a href="./src/resources/nodes.ts">ErrorDetail</a></code>
- <code><a href="./src/resources/nodes.ts">ErrorType</a></code>
- <code><a href="./src/resources/nodes.ts">ExtendNodeRequest</a></code>
- <code><a href="./src/resources/nodes.ts">ListResponseNode</a></code>
- <code><a href="./src/resources/nodes.ts">Node</a></code>
- <code><a href="./src/resources/nodes.ts">NodeType</a></code>
- <code><a href="./src/resources/nodes.ts">Status</a></code>

Methods:

- <code title="post /v1/nodes">client.nodes.<a href="./src/resources/nodes.ts">create</a>({ ...params }) -> ListResponseNode</code>
- <code title="get /v1/nodes">client.nodes.<a href="./src/resources/nodes.ts">list</a>({ ...params }) -> ListResponseNode</code>
- <code title="delete /v1/nodes/{id}">client.nodes.<a href="./src/resources/nodes.ts">delete</a>(id) -> void</code>
- <code title="patch /v1/nodes/{id}/extend">client.nodes.<a href="./src/resources/nodes.ts">extend</a>(id, { ...params }) -> Node</code>
- <code title="get /v1/nodes/{id}">client.nodes.<a href="./src/resources/nodes.ts">get</a>(id) -> Node</code>
- <code title="put /v1/nodes/{id}/redeploy">client.nodes.<a href="./src/resources/nodes.ts">redeploy</a>(id, { ...params }) -> Node</code>
- <code title="patch /v1/nodes/{id}/release">client.nodes.<a href="./src/resources/nodes.ts">release</a>(id) -> Node</code>

# Zones

Types:

- <code><a href="./src/resources/zones.ts">ZoneListResponse</a></code>
- <code><a href="./src/resources/zones.ts">ZoneGetResponse</a></code>

Methods:

- <code title="get /v0/zones">client.zones.<a href="./src/resources/zones.ts">list</a>() -> ZoneListResponse</code>
- <code title="get /v0/zones/{id}">client.zones.<a href="./src/resources/zones.ts">get</a>(id) -> ZoneGetResponse</code>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sfcompute/nodes-sdk-alpha",
"version": "0.1.0-alpha.31",
"version": "0.1.0-alpha.32",
"description": "The official TypeScript library for the SFC Nodes API",
"author": "SFC Nodes <hello@sfcompute.com>",
"types": "dist/index.d.ts",
Expand Down
79 changes: 17 additions & 62 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,9 @@ import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
import { APIPromise } from './core/api-promise';
import {
AcceleratorType,
CreateNodesRequest,
ErrorContent,
ErrorDetail,
ErrorType,
ExtendNodeRequest,
ListResponseNode,
Node,
NodeCreateParams,
NodeExtendParams,
NodeListParams,
NodeRedeployParams,
NodeType,
Nodes,
Status,
} from './resources/nodes';
import { ZoneGetResponse, ZoneListResponse, Zones } from './resources/zones';
import { VMLogsParams, VMLogsResponse, VMSSHParams, VMSSHResponse, VMs } from './resources/vms/vms';
import { Nodes } from './resources/nodes';
import { Zones } from './resources/zones';
import { VMs } from './resources/vms/vms';
import { type Fetch } from './internal/builtin-types';
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
Expand Down Expand Up @@ -687,11 +671,19 @@ export class SFCNodes {
return () => controller.abort();
}

private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
private buildBody({ options }: { options: FinalRequestOptions }): {
bodyHeaders: HeadersLike;
body: BodyInit | undefined;
} {
const { body, headers: rawHeaders } = options;
if (!body) {
// A resource method always passes a `body` key when its operation defines a
// request body, even if the caller omitted an optional body param. Keep the
// content-type for those, and only elide it for operations with no body at
// all (e.g. GET/DELETE).
if (body == null && 'body' in options) {
return this.#encoder({ body, headers: buildHeaders([rawHeaders]) });
}
return { bodyHeaders: undefined, body: undefined };
}
const headers = buildHeaders([rawHeaders]);
Expand Down Expand Up @@ -751,19 +743,8 @@ export class SFCNodes {

static toFile = Uploads.toFile;

/**
* Manage your Virtual Machines.
*/
vms: API.VMs = new API.VMs(this);
/**
* Manage compute nodes. Create, list, extend, and release nodes for your workloads.
*/
nodes: API.Nodes = new API.Nodes(this);
/**
* Zones represent physically colocated datacenters.
* Use these endpoints to discover available zones and their capacity,
* hardware specifications, and regional information.
*/
zones: API.Zones = new API.Zones(this);
}

Expand All @@ -774,35 +755,9 @@ SFCNodes.Zones = Zones;
export declare namespace SFCNodes {
export type RequestOptions = Opts.RequestOptions;

export {
VMs as VMs,
type VMLogsResponse as VMLogsResponse,
type VMSSHResponse as VMSSHResponse,
type VMLogsParams as VMLogsParams,
type VMSSHParams as VMSSHParams,
};

export {
Nodes as Nodes,
type AcceleratorType as AcceleratorType,
type CreateNodesRequest as CreateNodesRequest,
type ErrorContent as ErrorContent,
type ErrorDetail as ErrorDetail,
type ErrorType as ErrorType,
type ExtendNodeRequest as ExtendNodeRequest,
type ListResponseNode as ListResponseNode,
type Node as Node,
type NodeType as NodeType,
type Status as Status,
type NodeCreateParams as NodeCreateParams,
type NodeListParams as NodeListParams,
type NodeExtendParams as NodeExtendParams,
type NodeRedeployParams as NodeRedeployParams,
};

export {
Zones as Zones,
type ZoneListResponse as ZoneListResponse,
type ZoneGetResponse as ZoneGetResponse,
};
export { VMs as VMs };

export { Nodes as Nodes };

export { Zones as Zones };
}
22 changes: 3 additions & 19 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
Nodes,
type AcceleratorType,
type CreateNodesRequest,
type ErrorContent,
type ErrorDetail,
type ErrorType,
type ExtendNodeRequest,
type ListResponseNode,
type Node,
type NodeType,
type Status,
type NodeCreateParams,
type NodeListParams,
type NodeExtendParams,
type NodeRedeployParams,
} from './nodes';
export { VMs, type VMLogsResponse, type VMSSHResponse, type VMLogsParams, type VMSSHParams } from './vms/vms';
export { Zones, type ZoneListResponse, type ZoneGetResponse } from './zones';
export { Nodes } from './nodes';
export { VMs } from './vms/vms';
export { Zones } from './zones';
Loading
Loading