diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5a12c39..e1a01c0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.28" + ".": "0.1.0-alpha.29" } diff --git a/.stats.yml b/.stats.yml index aba4ed0..af54321 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 13 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company/sfc-nodes-92c25ef5a0eefcd88287edd4de0589c948908f558a03a0aa15ffa961a1415845.yml +configured_endpoints: 15 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company/sfc-nodes-bef77b99228a46dabf4fa0d83d626af67a1f16adf612b90810b99591cb435dcd.yml openapi_spec_hash: e5d9664ddfbca394030b9a9e24246dc7 -config_hash: a187153315a646ecf95709ee4a223df5 +config_hash: 4ea510d6a5c84c7055b51a248a2aacbf diff --git a/CHANGELOG.md b/CHANGELOG.md index 0301686..6b3b496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.1.0-alpha.29 (2026-05-18) + +Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/sfcompute/nodes-typescript/compare/v0.1.0-alpha.28...v0.1.0-alpha.29) + +### Features + +* **api:** update config to account for breaking changes ([ec04a35](https://github.com/sfcompute/nodes-typescript/commit/ec04a35aaf436deec09b0ddade7f24007dc62ffe)) + + +### Bug Fixes + +* **sdk:** remove unused Error types causing circular imports ([48ffa1b](https://github.com/sfcompute/nodes-typescript/commit/48ffa1b53b1942798ac686fc4c87be0e06013daa)) + ## 0.1.0-alpha.28 (2026-05-17) Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/sfcompute/nodes-typescript/compare/v0.1.0-alpha.27...v0.1.0-alpha.28) diff --git a/api.md b/api.md index a66b81e..5fb1a7e 100644 --- a/api.md +++ b/api.md @@ -25,6 +25,16 @@ Methods: ## Images +Types: + +- ImageListResponse +- ImageGetResponse + +Methods: + +- client.vms.images.list({ ...params }) -> ImageListResponse +- client.vms.images.get(id) -> ImageGetResponse + # Nodes Types: diff --git a/package.json b/package.json index 1cbca5f..1a7743a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sfcompute/nodes-sdk-alpha", - "version": "0.1.0-alpha.28", + "version": "0.1.0-alpha.29", "description": "The official TypeScript library for the SFC Nodes API", "author": "SFC Nodes ", "types": "dist/index.d.ts", diff --git a/src/resources/vms/images.ts b/src/resources/vms/images.ts index f8d7a5b..4c0bf9c 100644 --- a/src/resources/vms/images.ts +++ b/src/resources/vms/images.ts @@ -1,5 +1,143 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; -export class Images extends APIResource {} +/** + * Custom machine images for instances. + */ +export class Images extends APIResource { + /** + * > ⚠️ This endpoint is in [preview](/preview/about-preview). + * + * List images in the specified workspace. Pass `sfc:workspace:sfcompute:public` as + * the workspace to list sfc-provided public images instead. + */ + list(query: ImageListParams, options?: RequestOptions): APIPromise { + return this._client.get('/preview/v2/images', { + query, + defaultBaseURL: 'https://api.sfcompute.com', + ...options, + }); + } + + /** + * > ⚠️ This endpoint is in [preview](/preview/about-preview). + * + * Retrieve an image by ID. Returns both user-owned and public images. + */ + get(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/preview/v2/images/${id}`, { + defaultBaseURL: 'https://api.sfcompute.com', + ...options, + }); + } +} + +export interface ImageListResponse { + data: Array; + + has_more: boolean; + + object: 'list'; + + cursor?: string | null; +} + +export namespace ImageListResponse { + export interface Data { + id: string; + + /** + * Unix timestamp. + */ + created_at: number; + + name: string; + + object: 'image'; + + owner: string; + + /** + * A resource path for a image resource. Format: + * sfc:image:::. + */ + resource_path: string; + + upload_status: 'started' | 'uploading' | 'completed' | 'failed' | 'revoked'; + + workspace: string; + + provider?: string | null; + + sha256?: string | null; + } +} + +export interface ImageGetResponse { + id: string; + + /** + * Unix timestamp. + */ + created_at: number; + + name: string; + + object: 'image'; + + owner: string; + + /** + * A resource path for a image resource. Format: + * sfc:image:::. + */ + resource_path: string; + + upload_status: 'started' | 'uploading' | 'completed' | 'failed' | 'revoked'; + + workspace: string; + + provider?: string | null; + + sha256?: string | null; +} + +export interface ImageListParams { + /** + * Filter by workspace. Pass `sfc:workspace:sfcompute:public` to list sfc-provided + * public images. + */ + workspace: string; + + /** + * Filter by image ID (repeatable). + */ + id?: Array; + + /** + * Cursor for backward pagination. + */ + ending_before?: string; + + /** + * Maximum number of results to return (1-200, default 50). + */ + limit?: number; + + /** + * Cursor for forward pagination (from a previous response's `cursor` field). + */ + starting_after?: string; +} + +export declare namespace Images { + export { + type ImageListResponse as ImageListResponse, + type ImageGetResponse as ImageGetResponse, + type ImageListParams as ImageListParams, + }; +} diff --git a/src/resources/vms/index.ts b/src/resources/vms/index.ts index 745d541..5678612 100644 --- a/src/resources/vms/index.ts +++ b/src/resources/vms/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Images } from './images'; +export { Images, type ImageListResponse, type ImageGetResponse, type ImageListParams } from './images'; export { Script, type UserData, diff --git a/src/resources/vms/vms.ts b/src/resources/vms/vms.ts index 5e8abbc..5e8e580 100644 --- a/src/resources/vms/vms.ts +++ b/src/resources/vms/vms.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../core/resource'; import * as ImagesAPI from './images'; -import { Images } from './images'; +import { ImageGetResponse, ImageListParams, ImageListResponse, Images } from './images'; import * as ScriptAPI from './script'; import { Script, ScriptCreateParams, ScriptCreateResponse, ScriptRetrieveResponse, UserData } from './script'; import { APIPromise } from '../../core/api-promise'; @@ -112,5 +112,10 @@ export declare namespace VMs { type ScriptCreateParams as ScriptCreateParams, }; - export { Images as Images }; + export { + Images as Images, + type ImageListResponse as ImageListResponse, + type ImageGetResponse as ImageGetResponse, + type ImageListParams as ImageListParams, + }; } diff --git a/src/version.ts b/src/version.ts index 522a9fb..2017d79 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.28'; // x-release-please-version +export const VERSION = '0.1.0-alpha.29'; // x-release-please-version diff --git a/tests/api-resources/vms/images.test.ts b/tests/api-resources/vms/images.test.ts new file mode 100644 index 0000000..941e28a --- /dev/null +++ b/tests/api-resources/vms/images.test.ts @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import SFCNodes from '@sfcompute/nodes-sdk-alpha'; + +const client = new SFCNodes({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource images', () => { + // Mock server tests are disabled + test.skip('list: only required params', async () => { + const responsePromise = client.vms.images.list({ workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('list: required and optional params', async () => { + const response = await client.vms.images.list({ + workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F', + id: ['image_k3R-nX9vLm7Qp2Yw5Jd8F'], + ending_before: 'imagec_gqXR7s0Kj5mHvE2wNpLc4Q', + limit: 1, + starting_after: 'imagec_gqXR7s0Kj5mHvE2wNpLc4Q', + }); + }); + + // Mock server tests are disabled + test.skip('get', async () => { + const responsePromise = client.vms.images.get('image_k3R-nX9vLm7Qp2Yw5Jd8F'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +});