Skip to content

Commit 396460a

Browse files
release: 0.1.0-alpha.19 (#30)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent b8dd909 commit 396460a

File tree

8 files changed

+75
-11
lines changed

8 files changed

+75
-11
lines changed

.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.18"
2+
".": "0.1.0-alpha.19"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-3ed2b55187b3b17772db0e76c4007d8828b37fdf49a87fb664cdf994db49cb42.yml
3-
openapi_spec_hash: 749a02e6ffc075b8d4e70a7a7800286a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-f5f616455c00f00755e37240a294c96c2353b63aa8238d54f03ff16831f321f3.yml
3+
openapi_spec_hash: 5d24f0033a95eabe54df671a80d0d91f
44
config_hash: 6b29dc1aa86a29d01a2db850fd9b2bf0

CHANGELOG.md

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

3+
## 0.1.0-alpha.19 (2025-10-02)
4+
5+
Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/sfcompute/nodes-typescript/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)
6+
7+
### Features
8+
9+
* **api:** api update ([15676d7](https://github.com/sfcompute/nodes-typescript/commit/15676d70865603989b24b71d217f712c8f48ed21))
10+
311
## 0.1.0-alpha.18 (2025-10-02)
412

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

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,60 @@ const listResponseNode: SFCNodes.ListResponseNode = await client.nodes.list();
4848

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

51+
## File uploads
52+
53+
Request parameters that correspond to file uploads can be passed in many different forms:
54+
55+
- `File` (or an object with the same structure)
56+
- a `fetch` `Response` (or an object with the same structure)
57+
- an `fs.ReadStream`
58+
- the return value of our `toFile` helper
59+
60+
```ts
61+
import fs from 'fs';
62+
import SFCNodes, { toFile } from '@sfcompute/nodes-sdk-alpha';
63+
64+
const client = new SFCNodes();
65+
66+
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
67+
await client.nodes.create({
68+
desired_count: 1,
69+
max_price_per_node_hour: 1000,
70+
zone: 'hayesvalley',
71+
cloud_init_user_data: fs.createReadStream('/path/to/file'),
72+
});
73+
74+
// Or if you have the web `File` API you can pass a `File` instance:
75+
await client.nodes.create({
76+
desired_count: 1,
77+
max_price_per_node_hour: 1000,
78+
zone: 'hayesvalley',
79+
cloud_init_user_data: new File(['my bytes'], 'file'),
80+
});
81+
82+
// You can also pass a `fetch` `Response`:
83+
await client.nodes.create({
84+
desired_count: 1,
85+
max_price_per_node_hour: 1000,
86+
zone: 'hayesvalley',
87+
cloud_init_user_data: await fetch('https://somesite/file'),
88+
});
89+
90+
// Finally, if none of the above are convenient, you can use our `toFile` helper:
91+
await client.nodes.create({
92+
desired_count: 1,
93+
max_price_per_node_hour: 1000,
94+
zone: 'hayesvalley',
95+
cloud_init_user_data: await toFile(Buffer.from('my bytes'), 'file'),
96+
});
97+
await client.nodes.create({
98+
desired_count: 1,
99+
max_price_per_node_hour: 1000,
100+
zone: 'hayesvalley',
101+
cloud_init_user_data: await toFile(new Uint8Array([0, 1, 2]), 'file'),
102+
});
103+
```
104+
51105
## Handling errors
52106

53107
When the library is unable to connect to the API,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sfcompute/nodes-sdk-alpha",
3-
"version": "0.1.0-alpha.18",
3+
"version": "0.1.0-alpha.19",
44
"description": "The official TypeScript library for the SFC Nodes API",
55
"author": "SFC Nodes <[email protected]>",
66
"types": "dist/index.d.ts",

src/resources/nodes.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { APIResource } from '../core/resource';
44
import * as NodesAPI from './nodes';
55
import { APIPromise } from '../core/api-promise';
6+
import { type Uploadable } from '../core/uploads';
67
import { RequestOptions } from '../internal/request-options';
78
import { path } from '../internal/utils/path';
89

@@ -110,7 +111,7 @@ export interface CreateNodesRequest {
110111
/**
111112
* User script to be executed during the VM's boot process
112113
*/
113-
cloud_init_user_data?: Array<number>;
114+
cloud_init_user_data?: Uploadable;
114115

115116
/**
116117
* End time as Unix timestamp in seconds If provided, end time must be aligned to
@@ -439,7 +440,7 @@ export interface NodeCreateParams {
439440
/**
440441
* User script to be executed during the VM's boot process
441442
*/
442-
cloud_init_user_data?: Array<number>;
443+
cloud_init_user_data?: Uploadable;
443444

444445
/**
445446
* End time as Unix timestamp in seconds If provided, end time must be aligned to
@@ -495,9 +496,10 @@ export interface NodeExtendParams {
495496

496497
export interface NodeRedeployParams {
497498
/**
498-
* Update the cloud init user data for VMs running on this node
499+
* Update the cloud init user data for VMs running on this node Data should be
500+
* base64 encoded
499501
*/
500-
cloud_init_user_data?: Array<number>;
502+
cloud_init_user_data?: Uploadable;
501503

502504
/**
503505
* Redeploy node with this VM image ID

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '0.1.0-alpha.18'; // x-release-please-version
1+
export const VERSION = '0.1.0-alpha.19'; // x-release-please-version

tests/api-resources/nodes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import SFCNodes from '@sfcompute/nodes-sdk-alpha';
3+
import SFCNodes, { toFile } from '@sfcompute/nodes-sdk-alpha';
44

55
const client = new SFCNodes({
66
bearerToken: 'My Bearer Token',
@@ -30,7 +30,7 @@ describe('resource nodes', () => {
3030
desired_count: 1,
3131
max_price_per_node_hour: 1000,
3232
zone: 'hayesvalley',
33-
cloud_init_user_data: [0],
33+
cloud_init_user_data: await toFile(Buffer.from('# my file contents'), 'README.md'),
3434
end_at: 0,
3535
image_id: 'vmi_1234567890abcdef',
3636
names: ['cuda-crunch'],

0 commit comments

Comments
 (0)