diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fd66c340..d383ae01 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.89.0" + ".": "0.90.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dd4f59e..c479fe96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.90.0](https://github.com/kernel/kernel-node-sdk/compare/v0.89.0...v0.90.0) (2026-08-12) + + +### Features + +* Preserve canonical managed auth input metadata ([42d9a61](https://github.com/kernel/kernel-node-sdk/commit/42d9a61609bfee41832ed1f27ef107bb224ab797)) +* Support project selection by ID or name ([38f0fae](https://github.com/kernel/kernel-node-sdk/commit/38f0fae987b96d5d908b74d08ad71cea6ed67697)) + ## [0.89.0](https://github.com/kernel/kernel-node-sdk/compare/v0.88.0...v0.89.0) (2026-08-12) diff --git a/api.md b/api.md index a9d7b50a..d5f215a9 100644 --- a/api.md +++ b/api.md @@ -384,10 +384,10 @@ Types: Methods: - client.projects.create({ ...params }) -> Project -- client.projects.retrieve(id) -> Project -- client.projects.update(id, { ...params }) -> Project +- client.projects.retrieve(idOrName) -> Project +- client.projects.update(idOrName, { ...params }) -> Project - client.projects.list({ ...params }) -> ProjectsOffsetPagination -- client.projects.delete(id) -> void +- client.projects.delete(idOrName) -> void ## Limits @@ -398,8 +398,8 @@ Types: Methods: -- client.projects.limits.retrieve(id) -> ProjectLimits -- client.projects.limits.update(id, { ...params }) -> ProjectLimits +- client.projects.limits.retrieve(idOrName) -> ProjectLimits +- client.projects.limits.update(idOrName, { ...params }) -> ProjectLimits # Organization diff --git a/package.json b/package.json index 20483c59..888ea742 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.89.0", + "version": "0.90.0", "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 d8a4dd52..b06fcc05 100644 --- a/src/client.ts +++ b/src/client.ts @@ -205,6 +205,8 @@ export interface ClientOptions { projectID?: string | null | undefined; + project?: string | null | undefined; + /** * Specifies the environment to use for the API. * @@ -289,6 +291,7 @@ export interface ClientOptions { export class Kernel { apiKey: string; projectID: string | null; + project: string | null; baseURL: string; maxRetries: number; @@ -309,6 +312,7 @@ export class Kernel { * * @param {string | undefined} [opts.apiKey=process.env['KERNEL_API_KEY'] ?? undefined] * @param {string | null | undefined} [opts.projectID] + * @param {string | null | undefined} [opts.project] * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API. * @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.onkernel.com/] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. @@ -322,6 +326,7 @@ export class Kernel { baseURL = readEnv('KERNEL_BASE_URL'), apiKey = readEnv('KERNEL_API_KEY'), projectID = null, + project = null, ...opts }: ClientOptions = {}) { // Check for Bun runtime in a way that avoids type errors if Bun is not defined @@ -345,6 +350,7 @@ export class Kernel { const options: ClientOptions = { apiKey, projectID, + project, ...opts, baseURL, environment: opts.environment ?? 'production', @@ -393,6 +399,7 @@ export class Kernel { this.apiKey = apiKey; this.projectID = projectID; + this.project = project; } /** @@ -411,6 +418,7 @@ export class Kernel { fetchOptions: this.fetchOptions, apiKey: this.apiKey, projectID: this.projectID, + project: this.project, ...options, }); client.browserRouteCache = this.browserRouteCache; @@ -888,6 +896,7 @@ export class Kernel { ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), 'X-Kernel-Project-Id': this.projectID, + 'X-Kernel-Project': this.project, }, await this.authHeaders(options), this._options.defaultHeaders, diff --git a/src/resources/auth/connections.ts b/src/resources/auth/connections.ts index 30cb2805..4c78cd73 100644 --- a/src/resources/auth/connections.ts +++ b/src/resources/auth/connections.ts @@ -648,11 +648,42 @@ export namespace ManagedAuth { | 'account' | 'other'; + /** + * Context captured for a choice. + */ + context?: string | null; + /** * Additional context for the choice. */ description?: string | null; + /** + * Display text captured for a choice. + */ + display_text?: string | null; + + /** + * Masked phone number or email address shown for an MFA choice. + */ + masked_destination?: string | null; + + /** + * Semantic MFA method. Choice id remains the stable identity of the exact option + * selected. + */ + mfa_type?: + | 'sms' + | 'call' + | 'email' + | 'totp' + | 'push' + | 'password' + | 'passkey' + | 'switch' + | 'other' + | null; + /** * Selector for the visible choice, when available. */ @@ -754,6 +785,11 @@ export namespace ManagedAuth { */ type: 'identifier' | 'password' | 'code' | 'totp_code' | 'totp_secret' | 'text'; + /** + * Context shown near the field, including a masked code destination. + */ + hint?: string; + /** * Human-readable label shown to the user. */ @@ -1697,11 +1733,42 @@ export namespace ConnectionFollowResponse { | 'account' | 'other'; + /** + * Context captured for a choice. + */ + context?: string | null; + /** * Additional context for the choice. */ description?: string | null; + /** + * Display text captured for a choice. + */ + display_text?: string | null; + + /** + * Masked phone number or email address shown for an MFA choice. + */ + masked_destination?: string | null; + + /** + * Semantic MFA method. Choice id remains the stable identity of the exact option + * selected. + */ + mfa_type?: + | 'sms' + | 'call' + | 'email' + | 'totp' + | 'push' + | 'password' + | 'passkey' + | 'switch' + | 'other' + | null; + /** * Selector for the visible choice, when available. */ @@ -1774,6 +1841,11 @@ export namespace ConnectionFollowResponse { */ type: 'identifier' | 'password' | 'code' | 'totp_code' | 'totp_secret' | 'text'; + /** + * Context shown near the field, including a masked code destination. + */ + hint?: string; + /** * Human-readable label shown to the user. */ diff --git a/src/resources/projects/limits.ts b/src/resources/projects/limits.ts index ae16b9f1..a706d9a2 100644 --- a/src/resources/projects/limits.ts +++ b/src/resources/projects/limits.ts @@ -18,12 +18,12 @@ export class Limits extends APIResource { * @example * ```ts * const projectLimits = await client.projects.limits.retrieve( - * 'id', + * 'id_or_name', * ); * ``` */ - retrieve(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/org/projects/${id}/limits`, options); + retrieve(idOrName: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/org/projects/${idOrName}/limits`, options); } /** @@ -34,12 +34,12 @@ export class Limits extends APIResource { * @example * ```ts * const projectLimits = await client.projects.limits.update( - * 'id', + * 'id_or_name', * ); * ``` */ - update(id: string, body: LimitUpdateParams, options?: RequestOptions): APIPromise { - return this._client.patch(path`/org/projects/${id}/limits`, { body, ...options }); + update(idOrName: string, body: LimitUpdateParams, options?: RequestOptions): APIPromise { + return this._client.patch(path`/org/projects/${idOrName}/limits`, { body, ...options }); } } diff --git a/src/resources/projects/projects.ts b/src/resources/projects/projects.ts index a7124204..2eed7f7c 100644 --- a/src/resources/projects/projects.ts +++ b/src/resources/projects/projects.ts @@ -36,11 +36,13 @@ export class Projects extends APIResource { * * @example * ```ts - * const project = await client.projects.retrieve('id'); + * const project = await client.projects.retrieve( + * 'id_or_name', + * ); * ``` */ - retrieve(id: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/org/projects/${id}`, options); + retrieve(idOrName: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/org/projects/${idOrName}`, options); } /** @@ -48,11 +50,11 @@ export class Projects extends APIResource { * * @example * ```ts - * const project = await client.projects.update('id'); + * const project = await client.projects.update('id_or_name'); * ``` */ - update(id: string, body: ProjectUpdateParams, options?: RequestOptions): APIPromise { - return this._client.patch(path`/org/projects/${id}`, { body, ...options }); + update(idOrName: string, body: ProjectUpdateParams, options?: RequestOptions): APIPromise { + return this._client.patch(path`/org/projects/${idOrName}`, { body, ...options }); } /** @@ -78,11 +80,11 @@ export class Projects extends APIResource { * * @example * ```ts - * await client.projects.delete('id'); + * await client.projects.delete('id_or_name'); * ``` */ - delete(id: string, options?: RequestOptions): APIPromise { - return this._client.delete(path`/org/projects/${id}`, { + delete(idOrName: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/org/projects/${idOrName}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); @@ -93,7 +95,7 @@ export type ProjectsOffsetPagination = OffsetPagination; export interface CreateProjectRequest { /** - * Project name (1-255 Unicode code points) + * Project name (1-255 Unicode code points; cannot contain `/` or `%`) */ name: string; } @@ -127,7 +129,7 @@ export interface Project { export interface UpdateProjectRequest { /** - * New project name (1-255 Unicode code points) + * New project name (1-255 Unicode code points; cannot contain `/` or `%`) */ name?: string; @@ -139,14 +141,14 @@ export interface UpdateProjectRequest { export interface ProjectCreateParams { /** - * Project name (1-255 Unicode code points) + * Project name (1-255 Unicode code points; cannot contain `/` or `%`) */ name: string; } export interface ProjectUpdateParams { /** - * New project name (1-255 Unicode code points) + * New project name (1-255 Unicode code points; cannot contain `/` or `%`) */ name?: string; diff --git a/src/version.ts b/src/version.ts index 2a87eb59..f99c21e4 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.89.0'; // x-release-please-version +export const VERSION = '0.90.0'; // x-release-please-version diff --git a/tests/api-resources/projects/limits.test.ts b/tests/api-resources/projects/limits.test.ts index 61b40cae..23baf360 100644 --- a/tests/api-resources/projects/limits.test.ts +++ b/tests/api-resources/projects/limits.test.ts @@ -10,7 +10,7 @@ const client = new Kernel({ describe('resource limits', () => { // Mock server tests are disabled test.skip('retrieve', async () => { - const responsePromise = client.projects.limits.retrieve('id'); + const responsePromise = client.projects.limits.retrieve('id_or_name'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,7 +22,7 @@ describe('resource limits', () => { // Mock server tests are disabled test.skip('update', async () => { - const responsePromise = client.projects.limits.update('id', {}); + const responsePromise = client.projects.limits.update('id_or_name', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; diff --git a/tests/api-resources/projects/projects.test.ts b/tests/api-resources/projects/projects.test.ts index f4be4431..eacb3305 100644 --- a/tests/api-resources/projects/projects.test.ts +++ b/tests/api-resources/projects/projects.test.ts @@ -27,7 +27,7 @@ describe('resource projects', () => { // Mock server tests are disabled test.skip('retrieve', async () => { - const responsePromise = client.projects.retrieve('id'); + const responsePromise = client.projects.retrieve('id_or_name'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -39,7 +39,7 @@ describe('resource projects', () => { // Mock server tests are disabled test.skip('update', async () => { - const responsePromise = client.projects.update('id', {}); + const responsePromise = client.projects.update('id_or_name', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -79,7 +79,7 @@ describe('resource projects', () => { // Mock server tests are disabled test.skip('delete', async () => { - const responsePromise = client.projects.delete('id'); + const responsePromise = client.projects.delete('id_or_name'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise;