diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7e23a4f..eb5abf7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.6.3" + ".": "0.6.4" } diff --git a/.stats.yml b/.stats.yml index 60f163b..9625f4e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-ff8ccba8b5409eaa1128df9027582cb63f66e8accd75e511f70b7c27ef26c9ae.yml -openapi_spec_hash: 1dbacc339695a7c78718f90f791d3f01 -config_hash: b8e1fff080fbaa22656ab0a57b591777 +configured_endpoints: 17 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2eeb61205775c5997abf8154cd6f6fe81a1e83870eff10050b17ed415aa7860b.yml +openapi_spec_hash: 63405add4a3f53718f8183cbb8c1a22f +config_hash: 00ec9df250b9dc077f8d3b93a442d252 diff --git a/CHANGELOG.md b/CHANGELOG.md index 724f56d..5c3f1a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 0.6.4 (2025-06-27) + +Full Changelog: [v0.6.3...v0.6.4](https://github.com/onkernel/kernel-node-sdk/compare/v0.6.3...v0.6.4) + +### Features + +* **api:** add GET deployments endpoint ([89b755a](https://github.com/onkernel/kernel-node-sdk/commit/89b755ab2e178f4b0dc5c62931a1fd45ff1021b7)) +* **api:** deployments ([94db12e](https://github.com/onkernel/kernel-node-sdk/commit/94db12ed7156c1c1288f37d27d3e29318317ca77)) +* **api:** manual updates ([042d683](https://github.com/onkernel/kernel-node-sdk/commit/042d6833991c6252b104d2a590ecc7d6c98dcf99)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([c9e22fd](https://github.com/onkernel/kernel-node-sdk/commit/c9e22fdadb192a655859db322fd174321001040d)) +* **client:** get fetchOptions type more reliably ([5f60c0f](https://github.com/onkernel/kernel-node-sdk/commit/5f60c0f4c555ae86fc5e6c43c09a465adca163f0)) + ## 0.6.3 (2025-06-25) Full Changelog: [v0.6.2...v0.6.3](https://github.com/onkernel/kernel-node-sdk/compare/v0.6.2...v0.6.3) diff --git a/api.md b/api.md index a8ada60..736d6e7 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ Types: +- AppAction - ErrorDetail - ErrorEvent - ErrorModel @@ -15,12 +16,14 @@ Types: - DeploymentStateEvent - DeploymentCreateResponse - DeploymentRetrieveResponse +- DeploymentListResponse - DeploymentFollowResponse Methods: - client.deployments.create({ ...params }) -> DeploymentCreateResponse - client.deployments.retrieve(id) -> DeploymentRetrieveResponse +- client.deployments.list({ ...params }) -> DeploymentListResponse - client.deployments.follow(id, { ...params }) -> DeploymentFollowResponse # Apps diff --git a/bin/check-release-environment b/bin/check-release-environment index 530e853..e4b6d58 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${NPM_TOKEN}" ]; then - errors+=("The KERNEL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi lenErrors=${#errors[@]} diff --git a/package.json b/package.json index 2b07af9..da5efcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.6.3", + "version": "0.6.4", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 8b3fbce..3b75d5b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -30,6 +30,8 @@ import { DeploymentCreateResponse, DeploymentFollowParams, DeploymentFollowResponse, + DeploymentListParams, + DeploymentListResponse, DeploymentRetrieveResponse, DeploymentStateEvent, Deployments, @@ -789,8 +791,10 @@ export declare namespace Kernel { type DeploymentStateEvent as DeploymentStateEvent, type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentRetrieveResponse as DeploymentRetrieveResponse, + type DeploymentListResponse as DeploymentListResponse, type DeploymentFollowResponse as DeploymentFollowResponse, type DeploymentCreateParams as DeploymentCreateParams, + type DeploymentListParams as DeploymentListParams, type DeploymentFollowParams as DeploymentFollowParams, }; @@ -817,6 +821,7 @@ export declare namespace Kernel { type BrowserDeleteParams as BrowserDeleteParams, }; + export type AppAction = API.AppAction; export type ErrorDetail = API.ErrorDetail; export type ErrorEvent = API.ErrorEvent; export type ErrorModel = API.ErrorModel; diff --git a/src/internal/types.ts b/src/internal/types.ts index d7928cd..b668dfc 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -7,7 +7,7 @@ export type KeysEnum = { [P in keyof Required]: true }; export type FinalizedRequestInit = RequestInit & { headers: Headers }; -type NotAny = [unknown] extends [T] ? never : T; +type NotAny = [0] extends [1 & T] ? never : T; /** * Some environments overload the global fetch function, and Parameters only gets the last signature. @@ -64,13 +64,15 @@ type OverloadedParameters = * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition */ /** @ts-ignore For users with \@types/node */ -type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with undici */ -type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with \@types/bun */ type BunRequestInit = globalThis.FetchRequestInit; -/** @ts-ignore For users with node-fetch */ -type NodeFetchRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with node-fetch@2 */ +type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ +type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users who use Deno */ type FetchRequestInit = NonNullable[1]>; /* eslint-enable */ @@ -79,7 +81,8 @@ type RequestInits = | NotAny | NotAny | NotAny - | NotAny + | NotAny + | NotAny | NotAny | NotAny; diff --git a/src/resources/apps/apps.ts b/src/resources/apps/apps.ts index 227fba8..895af23 100644 --- a/src/resources/apps/apps.ts +++ b/src/resources/apps/apps.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import * as Shared from '../shared'; import * as DeploymentsAPI from './deployments'; import { DeploymentCreateParams, @@ -39,6 +40,11 @@ export namespace AppListResponse { */ id: string; + /** + * List of actions available on the app + */ + actions: Array; + /** * Name of the application */ @@ -49,6 +55,11 @@ export namespace AppListResponse { */ deployment: string; + /** + * Environment variables configured for this app version + */ + env_vars: { [key: string]: string }; + /** * Deployment region code */ @@ -58,11 +69,6 @@ export namespace AppListResponse { * Version label for the application */ version: string; - - /** - * Environment variables configured for this app version - */ - env_vars?: { [key: string]: string }; } } diff --git a/src/resources/apps/deployments.ts b/src/resources/apps/deployments.ts index fc61979..109fa69 100644 --- a/src/resources/apps/deployments.ts +++ b/src/resources/apps/deployments.ts @@ -72,22 +72,13 @@ export namespace DeploymentCreateResponse { /** * List of actions available on the app */ - actions: Array; + actions: Array; /** * Name of the app */ name: string; } - - export namespace App { - export interface Action { - /** - * Name of the action - */ - name: string; - } - } } /** diff --git a/src/resources/deployments.ts b/src/resources/deployments.ts index 33f9dcc..6cb5672 100644 --- a/src/resources/deployments.ts +++ b/src/resources/deployments.ts @@ -38,6 +38,21 @@ export class Deployments extends APIResource { return this._client.get(path`/deployments/${id}`, options); } + /** + * List deployments. Optionally filter by application name. + * + * @example + * ```ts + * const deployments = await client.deployments.list(); + * ``` + */ + list( + query: DeploymentListParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/deployments', { query, ...options }); + } + /** * Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and * status updates for a deployment. The stream terminates automatically once the @@ -219,6 +234,55 @@ export interface DeploymentRetrieveResponse { updated_at?: string | null; } +export type DeploymentListResponse = Array; + +export namespace DeploymentListResponse { + /** + * Deployment record information. + */ + export interface DeploymentListResponseItem { + /** + * Unique identifier for the deployment + */ + id: string; + + /** + * Timestamp when the deployment was created + */ + created_at: string; + + /** + * Deployment region code + */ + region: 'aws.us-east-1a'; + + /** + * Current status of the deployment + */ + status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped'; + + /** + * Relative path to the application entrypoint + */ + entrypoint_rel_path?: string; + + /** + * Environment variables configured for this deployment + */ + env_vars?: { [key: string]: string }; + + /** + * Status reason + */ + status_reason?: string; + + /** + * Timestamp when the deployment was last updated + */ + updated_at?: string | null; + } +} + /** * Union type representing any deployment event. */ @@ -242,7 +306,7 @@ export namespace DeploymentFollowResponse { /** * List of actions available on the app */ - actions: Array; + actions: Array; /** * Name of the application @@ -274,18 +338,6 @@ export namespace DeploymentFollowResponse { */ env_vars?: { [key: string]: string }; } - - export namespace AppVersionSummaryEvent { - /** - * An action available on the app - */ - export interface Action { - /** - * Name of the action - */ - name: string; - } - } } export interface DeploymentCreateParams { @@ -321,6 +373,13 @@ export interface DeploymentCreateParams { version?: string; } +export interface DeploymentListParams { + /** + * Filter results by application name. + */ + app_name?: string; +} + export interface DeploymentFollowParams { /** * Show logs since the given time (RFC timestamps or durations like 5m). @@ -333,8 +392,10 @@ export declare namespace Deployments { type DeploymentStateEvent as DeploymentStateEvent, type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentRetrieveResponse as DeploymentRetrieveResponse, + type DeploymentListResponse as DeploymentListResponse, type DeploymentFollowResponse as DeploymentFollowResponse, type DeploymentCreateParams as DeploymentCreateParams, + type DeploymentListParams as DeploymentListParams, type DeploymentFollowParams as DeploymentFollowParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index b59024d..b48f0f0 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -16,8 +16,10 @@ export { type DeploymentStateEvent, type DeploymentCreateResponse, type DeploymentRetrieveResponse, + type DeploymentListResponse, type DeploymentFollowResponse, type DeploymentCreateParams, + type DeploymentListParams, type DeploymentFollowParams, } from './deployments'; export { diff --git a/src/resources/shared.ts b/src/resources/shared.ts index d1ac129..c44734e 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +/** + * An action available on the app + */ +export interface AppAction { + /** + * Name of the action + */ + name: string; +} + export interface ErrorDetail { /** * Lower-level error code providing more specific detail diff --git a/src/version.ts b/src/version.ts index ae4dccc..67bde7c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.6.3'; // x-release-please-version +export const VERSION = '0.6.4'; // x-release-please-version diff --git a/tests/api-resources/deployments.test.ts b/tests/api-resources/deployments.test.ts index e7fd3eb..83eb8d7 100644 --- a/tests/api-resources/deployments.test.ts +++ b/tests/api-resources/deployments.test.ts @@ -47,6 +47,26 @@ describe('resource deployments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // skipped: tests are disabled for the time being + test.skip('list', async () => { + const responsePromise = client.deployments.list(); + 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); + }); + + // skipped: tests are disabled for the time being + test.skip('list: request options and 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.deployments.list({ app_name: 'app_name' }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Kernel.NotFoundError); + }); + // skipped: currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail test.skip('follow', async () => { const responsePromise = client.deployments.follow('id');