diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d3f5c73..31cc64e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.100.0" + ".": "0.101.0" } diff --git a/.stats.yml b/.stats.yml index 5fe5772..a0ee50e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 158 +configured_endpoints: 163 diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f83bc..95eb213 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.101.0](https://github.com/kernel/kernel-node-sdk/compare/v0.100.0...v0.101.0) (2026-09-11) + + +### Features + +* Add config analysis lifecycle guarantees ([2468a0a](https://github.com/kernel/kernel-node-sdk/commit/2468a0a74d674ccfce2f3f301a5ca904ac689372)) +* Brand origin TLS timeouts and classify provider failures ([1f63d03](https://github.com/kernel/kernel-node-sdk/commit/1f63d031eb68f79ea268200c035a07c4623004db)) +* Clarify proxy country defaults ([43f283c](https://github.com/kernel/kernel-node-sdk/commit/43f283c8aecfc74b8daa9145cc0b8fe7a65d7a47)) +* Expose vault access in organization entitlements ([0594999](https://github.com/kernel/kernel-node-sdk/commit/05949995501dcbccffed74f80e60a0447e0ef105)) +* Integrate configurable vault providers across API and checkout ([406359a](https://github.com/kernel/kernel-node-sdk/commit/406359ab2f748f848631a9595af2bb6eddd9cd51)) +* Limit free organizations to three vaults ([5c17e2d](https://github.com/kernel/kernel-node-sdk/commit/5c17e2d9b5ecfbbb5c2a959c1ce1112d543fbdb1)) +* Populate safe failure reasons on invocation responses ([e86903d](https://github.com/kernel/kernel-node-sdk/commit/e86903d4934f27a5a332e151b5170a9c654e26c5)) +* Return vendor guidance with config registry recommendations ([548c574](https://github.com/kernel/kernel-node-sdk/commit/548c574ecd913aff68b3342012f4478316faf040)) +* Revert vendor guidance recommendations ([6dbf3c0](https://github.com/kernel/kernel-node-sdk/commit/6dbf3c0943160861cc7410f4958c885cff2c4077)) +* Support international ISP proxy countries ([833e524](https://github.com/kernel/kernel-node-sdk/commit/833e5240c705ab73d9160f0cd9c6117e2fe726d3)) + ## [0.100.0](https://github.com/kernel/kernel-node-sdk/compare/v0.99.0...v0.100.0) (2026-09-04) diff --git a/api.md b/api.md index 4093cf9..074a955 100644 --- a/api.md +++ b/api.md @@ -433,6 +433,20 @@ Methods: - client.browserPools.flush(idOrName) -> void - client.browserPools.release(idOrName, { ...params }) -> void +# VaultProviderConfigs + +Types: + +- VaultProviderConfig + +Methods: + +- client.vaultProviderConfigs.create({ ...params }) -> VaultProviderConfig +- client.vaultProviderConfigs.retrieve(idOrName) -> VaultProviderConfig +- client.vaultProviderConfigs.update(idOrName, { ...params }) -> VaultProviderConfig +- client.vaultProviderConfigs.list({ ...params }) -> VaultProviderConfigsOffsetPagination +- client.vaultProviderConfigs.delete(idOrName) -> void + # Vaults Types: diff --git a/package.json b/package.json index a27ea1a..63ca6b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.100.0", + "version": "0.101.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 20013d6..9d98f00 100644 --- a/src/client.ts +++ b/src/client.ts @@ -136,6 +136,14 @@ import { ProxyUpdateParams, ProxyUpdateResponse, } from './resources/proxies'; +import { + VaultProviderConfig, + VaultProviderConfigCreateParams, + VaultProviderConfigListParams, + VaultProviderConfigUpdateParams, + VaultProviderConfigs, + VaultProviderConfigsOffsetPagination, +} from './resources/vault-provider-configs'; import { AuditLogEntriesPageTokenPagination, AuditLogEntry, @@ -1067,6 +1075,7 @@ export class Kernel { * Create and manage browser pools for acquiring and releasing browsers. */ browserPools: API.BrowserPools = new API.BrowserPools(this); + vaultProviderConfigs: API.VaultProviderConfigs = new API.VaultProviderConfigs(this); vaults: API.Vaults = new API.Vaults(this); /** * Create and manage credentials for authentication. @@ -1105,6 +1114,7 @@ Kernel.Telemetry = Telemetry; Kernel.Proxies = Proxies; Kernel.Extensions = Extensions; Kernel.BrowserPools = BrowserPools; +Kernel.VaultProviderConfigs = VaultProviderConfigs; Kernel.Vaults = Vaults; Kernel.Credentials = Credentials; Kernel.Projects = Projects; @@ -1263,6 +1273,15 @@ export declare namespace Kernel { type BrowserPoolReleaseParams as BrowserPoolReleaseParams, }; + export { + VaultProviderConfigs as VaultProviderConfigs, + type VaultProviderConfig as VaultProviderConfig, + type VaultProviderConfigsOffsetPagination as VaultProviderConfigsOffsetPagination, + type VaultProviderConfigCreateParams as VaultProviderConfigCreateParams, + type VaultProviderConfigUpdateParams as VaultProviderConfigUpdateParams, + type VaultProviderConfigListParams as VaultProviderConfigListParams, + }; + export { Vaults as Vaults, type Vault as Vault, diff --git a/src/resources/browsers/telemetry.ts b/src/resources/browsers/telemetry.ts index bd08cde..be14c18 100644 --- a/src/resources/browsers/telemetry.ts +++ b/src/resources/browsers/telemetry.ts @@ -4338,13 +4338,16 @@ export namespace BrowserProxyErrorEvent { * Proxy-layer error code: the X-Kernel-Proxy-Error response header value from a * branded 5xx error page served by the metro egress host-proxy. Values mirror what * the proxy emits: destination_blocked, provider_blacklisted, - * provider_unreachable, proxy_unavailable, upstream_timeout, upstream_dns_failure, - * upstream_connect_failed. Unknown header values are dropped. + * provider_unreachable, provider_rejected, origin_tls_timeout, proxy_unavailable, + * upstream_timeout, upstream_dns_failure, upstream_connect_failed. Unknown header + * values are dropped. */ code: | 'destination_blocked' | 'provider_blacklisted' | 'provider_unreachable' + | 'provider_rejected' + | 'origin_tls_timeout' | 'proxy_unavailable' | 'upstream_timeout' | 'upstream_dns_failure' diff --git a/src/resources/config-registry/config-registry.ts b/src/resources/config-registry/config-registry.ts index 8ac23ee..67f94a0 100644 --- a/src/resources/config-registry/config-registry.ts +++ b/src/resources/config-registry/config-registry.ts @@ -85,8 +85,13 @@ export interface Analysis { created_at: string; /** - * Present for failed or canceled analyses. Messages contain safe retry guidance - * rather than internal workflow errors. + * Deadline after which a still-running analysis becomes expired. + */ + expires_at: string; + + /** + * Present for failed, canceled, or expired analyses. Messages contain safe retry + * guidance rather than internal workflow errors. */ failure: Shared.ErrorModel | null; @@ -98,7 +103,7 @@ export interface Analysis { /** * Lifecycle status of a background analysis. */ - status: 'running' | 'completed' | 'failed' | 'canceled'; + status: 'running' | 'completed' | 'failed' | 'canceled' | 'expired'; } export interface AnalysisSummary { @@ -295,7 +300,8 @@ export namespace Proxy { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -316,7 +322,8 @@ export namespace Proxy { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -346,7 +353,8 @@ export namespace Proxy { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -438,7 +446,7 @@ export interface RecommendationSummary { /** * Lifecycle status of the most recently requested analysis for this exact target. */ - analysis_status: 'running' | 'completed' | 'failed' | 'canceled'; + analysis_status: 'running' | 'completed' | 'failed' | 'canceled' | 'expired'; /** * Most recent time the selected project requested an analysis for this exact diff --git a/src/resources/index.ts b/src/resources/index.ts index d1837dd..68bfca7 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -180,6 +180,14 @@ export { type ProxyListResponsesOffsetPagination, } from './proxies'; export { Telemetry } from './telemetry/telemetry'; +export { + VaultProviderConfigs, + type VaultProviderConfig, + type VaultProviderConfigCreateParams, + type VaultProviderConfigUpdateParams, + type VaultProviderConfigListParams, + type VaultProviderConfigsOffsetPagination, +} from './vault-provider-configs'; export { Vaults, type Vault, diff --git a/src/resources/invocations.ts b/src/resources/invocations.ts index 0ba6cd8..300caac 100644 --- a/src/resources/invocations.ts +++ b/src/resources/invocations.ts @@ -197,8 +197,8 @@ export namespace InvocationStateEvent { finished_at?: string | null; /** - * Output produced by the action, rendered as a JSON string. This could be: string, - * number, boolean, array, object, or null. + * The action result or detailed failure output. Often a JSON-encoded value, but + * failures may contain plain text. May contain sensitive application data. */ output?: string; @@ -208,7 +208,13 @@ export namespace InvocationStateEvent { payload?: string; /** - * Status reason + * A nonempty, customer-safe summary of the recorded failure output, always present + * when status is failed and omitted otherwise, including in the first failed + * invocation_state event. Recognized messages receive a specific summary; other + * failures receive a generic summary. Message matching does not establish whether + * the failure originated in the platform or action code. Does not include raw + * action output or internal error details. Available for historical invocations as + * well. Human-readable text, not a stable identifier for retry logic. */ status_reason?: string; } @@ -231,13 +237,18 @@ export interface InvocationCreateResponse { status: 'queued' | 'running' | 'succeeded' | 'failed'; /** - * The return value of the action that was invoked, rendered as a JSON string. This - * could be: string, number, boolean, array, object, or null. + * The action result or detailed failure output. Often a JSON-encoded value, but + * failures may contain plain text. May contain sensitive application data. */ output?: string; /** - * Status reason + * A nonempty, customer-safe summary of the recorded failure output, always present + * when status is failed and omitted otherwise. Recognized messages receive a + * specific summary; other failures receive a generic summary. Message matching + * does not establish whether the failure originated in the platform or action + * code. Does not include raw action output or internal error details. + * Human-readable text, not a stable identifier for retry logic. */ status_reason?: string; } @@ -280,8 +291,8 @@ export interface InvocationRetrieveResponse { finished_at?: string | null; /** - * Output produced by the action, rendered as a JSON string. This could be: string, - * number, boolean, array, object, or null. + * The action result or detailed failure output. Often a JSON-encoded value, but + * failures may contain plain text. May contain sensitive application data. */ output?: string; @@ -291,7 +302,13 @@ export interface InvocationRetrieveResponse { payload?: string; /** - * Status reason + * A nonempty, customer-safe summary of the recorded failure output, always present + * when status is failed and omitted otherwise, including in the first failed + * invocation_state event. Recognized messages receive a specific summary; other + * failures receive a generic summary. Message matching does not establish whether + * the failure originated in the platform or action code. Does not include raw + * action output or internal error details. Available for historical invocations as + * well. Human-readable text, not a stable identifier for retry logic. */ status_reason?: string; } @@ -334,8 +351,8 @@ export interface InvocationUpdateResponse { finished_at?: string | null; /** - * Output produced by the action, rendered as a JSON string. This could be: string, - * number, boolean, array, object, or null. + * The action result or detailed failure output. Often a JSON-encoded value, but + * failures may contain plain text. May contain sensitive application data. */ output?: string; @@ -345,7 +362,13 @@ export interface InvocationUpdateResponse { payload?: string; /** - * Status reason + * A nonempty, customer-safe summary of the recorded failure output, always present + * when status is failed and omitted otherwise, including in the first failed + * invocation_state event. Recognized messages receive a specific summary; other + * failures receive a generic summary. Message matching does not establish whether + * the failure originated in the platform or action code. Does not include raw + * action output or internal error details. Available for historical invocations as + * well. Human-readable text, not a stable identifier for retry logic. */ status_reason?: string; } @@ -388,8 +411,8 @@ export interface InvocationListResponse { finished_at?: string | null; /** - * Output produced by the action, rendered as a JSON string. This could be: string, - * number, boolean, array, object, or null. + * The action result or detailed failure output. Often a JSON-encoded value, but + * failures may contain plain text. May contain sensitive application data. */ output?: string; @@ -399,7 +422,13 @@ export interface InvocationListResponse { payload?: string; /** - * Status reason + * A nonempty, customer-safe summary of the recorded failure output, always present + * when status is failed and omitted otherwise, including in the first failed + * invocation_state event. Recognized messages receive a specific summary; other + * failures receive a generic summary. Message matching does not establish whether + * the failure originated in the platform or action code. Does not include raw + * action output or internal error details. Available for historical invocations as + * well. Human-readable text, not a stable identifier for retry logic. */ status_reason?: string; } diff --git a/src/resources/organization/entitlements.ts b/src/resources/organization/entitlements.ts index 1a5c70c..3c29cf5 100644 --- a/src/resources/organization/entitlements.ts +++ b/src/resources/organization/entitlements.ts @@ -57,6 +57,12 @@ export namespace OrgEntitlements { profiles: Features.Profiles; proxy_bypass_hosts: Features.ProxyBypassHosts; + + /** + * Whether the organization can access vaults, using the same access check as vault + * API routes. + */ + vaults: Features.Vaults; } export namespace Features { @@ -176,6 +182,17 @@ export namespace OrgEntitlements { */ enabled: boolean; } + + /** + * Whether the organization can access vaults, using the same access check as vault + * API routes. + */ + export interface Vaults { + /** + * Whether the organization is entitled to use this feature. + */ + enabled: boolean; + } } export interface Limits { @@ -195,6 +212,12 @@ export namespace OrgEntitlements { * Effective organization-wide concurrent app invocation ceiling. */ max_concurrent_invocations: number; + + /** + * Maximum non-deleted vaults allowed org-wide across all projects. Null means + * unlimited. The vaults feature flag still controls access. + */ + max_vaults: number | null; } export interface Plan { diff --git a/src/resources/organization/limits.ts b/src/resources/organization/limits.ts index 15ca385..98ed542 100644 --- a/src/resources/organization/limits.ts +++ b/src/resources/organization/limits.ts @@ -9,7 +9,7 @@ import { RequestOptions } from '../../internal/request-options'; */ export class Limits extends APIResource { /** - * Get the organization's effective limits and managed auth usage. + * Get the organization's effective limits and managed auth and vault usage. */ retrieve(options?: RequestOptions): APIPromise { return this._client.get('/org/limits', options); @@ -39,6 +39,12 @@ export interface OrgLimits { */ max_auth_connections: number | null; + /** + * Maximum non-deleted vaults allowed org-wide across all projects. Null means + * unlimited. + */ + max_vaults: number | null; + /** * Smallest health_check_interval the organization's plan accepts on a managed auth * connection. Requests below this are rejected with 400. Existing connections @@ -46,6 +52,11 @@ export interface OrgLimits { */ min_health_check_interval_seconds: number; + /** + * Current non-deleted vault count across all projects in the organization. + */ + vaults_used: number; + /** * Default maximum concurrent browsers applied to every project that has no * explicit per-project override. Null means no org-level default, so such projects diff --git a/src/resources/proxies.ts b/src/resources/proxies.ts index 9b1dfff..f366374 100644 --- a/src/resources/proxies.ts +++ b/src/resources/proxies.ts @@ -183,7 +183,8 @@ export namespace ProxyCreateResponse { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -204,7 +205,8 @@ export namespace ProxyCreateResponse { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -234,7 +236,8 @@ export namespace ProxyCreateResponse { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -344,7 +347,8 @@ export namespace ProxyRetrieveResponse { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -365,7 +369,8 @@ export namespace ProxyRetrieveResponse { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -395,7 +400,8 @@ export namespace ProxyRetrieveResponse { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -505,7 +511,8 @@ export namespace ProxyUpdateResponse { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -526,7 +533,8 @@ export namespace ProxyUpdateResponse { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -556,7 +564,8 @@ export namespace ProxyUpdateResponse { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -666,7 +675,8 @@ export namespace ProxyListResponse { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -687,7 +697,8 @@ export namespace ProxyListResponse { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -717,7 +728,8 @@ export namespace ProxyListResponse { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -827,7 +839,8 @@ export namespace ProxyCheckResponse { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -848,7 +861,8 @@ export namespace ProxyCheckResponse { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -878,7 +892,8 @@ export namespace ProxyCheckResponse { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -968,7 +983,8 @@ export namespace ProxyCreateParams { */ export interface IspProxyConfig { /** - * ISO 3166 country code. Defaults to US if not provided. + * ISO 3166 country code. Supported countries are US, GB, FR, DE, and SG. Defaults + * to US if not provided. */ country?: string; } @@ -989,7 +1005,8 @@ export namespace ProxyCreateParams { city?: string; /** - * ISO 3166 country code. + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; @@ -1019,7 +1036,8 @@ export namespace ProxyCreateParams { city?: string; /** - * ISO 3166 country code + * ISO 3166 country code. If omitted, the proxy uses the global pool without + * country targeting. */ country?: string; diff --git a/src/resources/vault-provider-configs.ts b/src/resources/vault-provider-configs.ts new file mode 100644 index 0000000..00f9219 --- /dev/null +++ b/src/resources/vault-provider-configs.ts @@ -0,0 +1,250 @@ +// 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 { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination'; +import { buildHeaders } from '../internal/headers'; +import { RequestOptions } from '../internal/request-options'; +import { path } from '../internal/utils/path'; + +export class VaultProviderConfigs extends APIResource { + /** + * Register a configuration shared across the organization's projects. Names are + * unique within the organization; duplicate names return 409 without replacing + * credentials. A configuration serves many wallets. Secret credentials are never + * returned. Requires an organization-scoped credential or dashboard + * authentication; project-scoped credentials receive 403. + * + * @example + * ```ts + * const vaultProviderConfig = + * await client.vaultProviderConfigs.create({ + * credentials: { + * client_id: 'example-client-id', + * client_secret: 'example-client-secret', + * }, + * name: 'my-link-client', + * provider: 'link', + * }); + * ``` + */ + create(body: VaultProviderConfigCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/vault-provider-configs', { body, ...options }); + } + + /** + * Look up a configuration by ID or name. Returns 404 when it does not exist in the + * organization. + * + * @example + * ```ts + * const vaultProviderConfig = + * await client.vaultProviderConfigs.retrieve('id_or_name'); + * ``` + */ + retrieve(idOrName: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/vault-provider-configs/${idOrName}`, options); + } + + /** + * Update the supplied fields; omitted fields remain unchanged. Names must remain + * unique within the organization. Requires an organization-scoped credential or + * dashboard authentication; project-scoped credentials receive 403. + * + * @example + * ```ts + * const vaultProviderConfig = + * await client.vaultProviderConfigs.update('id_or_name', { + * name: 'renamed-link-client', + * }); + * ``` + */ + update( + idOrName: string, + body: VaultProviderConfigUpdateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.patch(path`/vault-provider-configs/${idOrName}`, { body, ...options }); + } + + /** + * Secret credentials are never returned. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const vaultProviderConfig of client.vaultProviderConfigs.list()) { + * // ... + * } + * ``` + */ + list( + query: VaultProviderConfigListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/vault-provider-configs', OffsetPagination, { + query, + ...options, + }); + } + + /** + * Delete a configuration in the organization. Returns 409 while any non-deleted + * vault item references the configuration, regardless of connection status. Does + * not delete the external OAuth client or revoke unrelated grants. Requires an + * organization-scoped credential or dashboard authentication; project-scoped + * credentials receive 403. + * + * @example + * ```ts + * await client.vaultProviderConfigs.delete('id_or_name'); + * ``` + */ + delete(idOrName: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/vault-provider-configs/${idOrName}`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +export type VaultProviderConfigsOffsetPagination = OffsetPagination; + +/** + * Response schema for a Link configuration, without secret credentials. Kernel + * generates the ID and timestamps. Configuration creation uses + * VaultLinkProviderConfigRequest. + */ +export type VaultProviderConfig = + | VaultProviderConfig.VaultLinkProviderConfig + | VaultProviderConfig.VaultAgentCardProviderConfig; + +export namespace VaultProviderConfig { + /** + * Response schema for a Link configuration, without secret credentials. Kernel + * generates the ID and timestamps. Configuration creation uses + * VaultLinkProviderConfigRequest. + */ + export interface VaultLinkProviderConfig { + id: string; + + /** + * OAuth client identity; immutable. Secret credentials are never returned. + */ + client_id: string; + + created_at: string; + + /** + * Unique within the organization. + */ + name: string; + + provider: 'link'; + + updated_at: string; + } + + /** + * Response schema for an AgentCard configuration, without secret credentials. + * Kernel generates the ID and timestamps and introspects test_mode from the + * credentials. Configuration creation uses VaultAgentCardProviderConfigRequest. + */ + export interface VaultAgentCardProviderConfig { + id: string; + + client_id: string; + + created_at: string; + + name: string; + + provider: 'agentcard'; + + /** + * Introspected mode of the selected credential; true means sandbox objects. + */ + test_mode: boolean; + + updated_at: string; + } +} + +export type VaultProviderConfigCreateParams = + | VaultProviderConfigCreateParams.VaultLinkProviderConfigRequest + | VaultProviderConfigCreateParams.VaultAgentCardProviderConfigRequest; + +export declare namespace VaultProviderConfigCreateParams { + export interface VaultLinkProviderConfigRequest { + credentials: VaultLinkProviderConfigRequest.Credentials; + + /** + * Unique within the organization. + */ + name: string; + + provider: 'link'; + } + + export namespace VaultLinkProviderConfigRequest { + export interface Credentials { + client_id: string; + + client_secret: string; + } + } + + export interface VaultAgentCardProviderConfigRequest { + credentials: VaultAgentCardProviderConfigRequest.Credentials; + + /** + * Unique within the organization. + */ + name: string; + + provider: 'agentcard'; + } + + export namespace VaultAgentCardProviderConfigRequest { + export interface Credentials { + client_id: string; + + client_secret: string; + } + } +} + +export interface VaultProviderConfigUpdateParams { + /** + * Fields to update. Omitted credentials are left unchanged. A rejected update + * leaves existing credentials unchanged. + */ + credentials?: VaultProviderConfigUpdateParams.Credentials; + + /** + * Unique within the organization. + */ + name?: string; +} + +export namespace VaultProviderConfigUpdateParams { + /** + * Fields to update. Omitted credentials are left unchanged. A rejected update + * leaves existing credentials unchanged. + */ + export interface Credentials { + client_secret?: string; + } +} + +export interface VaultProviderConfigListParams extends OffsetPaginationParams {} + +export declare namespace VaultProviderConfigs { + export { + type VaultProviderConfig as VaultProviderConfig, + type VaultProviderConfigsOffsetPagination as VaultProviderConfigsOffsetPagination, + type VaultProviderConfigCreateParams as VaultProviderConfigCreateParams, + type VaultProviderConfigUpdateParams as VaultProviderConfigUpdateParams, + type VaultProviderConfigListParams as VaultProviderConfigListParams, + }; +} diff --git a/src/resources/vaults/items.ts b/src/resources/vaults/items.ts index 86aba7c..1441fe7 100644 --- a/src/resources/vaults/items.ts +++ b/src/resources/vaults/items.ts @@ -14,6 +14,13 @@ export class Items extends APIResource { * description before using it. Expanded data is fetched from the provider and is * not persisted in the vault item. Requesting an unavailable expansion returns 409 * instead of a partial item. + * + * @example + * ```ts + * const vaultItem = await client.vaults.items.retrieve('x', { + * id_or_name: 'id_or_name', + * }); + * ``` */ retrieve(key: string, params: ItemRetrieveParams, options?: RequestOptions): APIPromise { const { id_or_name, ...query } = params; @@ -21,7 +28,31 @@ export class Items extends APIResource { } /** - * Update a card specification before or between authorizations + * Requested cards accept a replacement specification. Pending issuance requests + * may update provider-supported fields on their existing request, subject to + * atomic provider approval checks; omitted optional fields remain unchanged and + * explicit empty lists clear them. Wallet/provider binding and unsupported fields + * cannot change after authorization starts. An uncertain update enters + * recovery_required and must not be retried. Checkout cards may be edited between + * authorizations. + * + * @example + * ```ts + * const vaultItem = await client.vaults.items.update('x', { + * id_or_name: 'id_or_name', + * spec: { + * provider: 'link', + * wallet: 'link-wallet', + * payment_method_id: 'pm_example', + * amount: 3000, + * currency: 'usd', + * merchant_name: 'Example Store', + * merchant_url: 'https://store.example.com', + * context: + * 'The order total changed to USD 30.00 including shipping and taxes for one notebook. Update this unapproved request rather than creating a second payment.', + * }, + * }); + * ``` */ update(key: string, params: ItemUpdateParams, options?: RequestOptions): APIPromise { const { id_or_name, ...body } = params; @@ -30,13 +61,29 @@ export class Items extends APIResource { /** * List vault items without secret values + * + * @example + * ```ts + * const vaultItems = await client.vaults.items.list( + * 'id_or_name', + * ); + * ``` */ list(idOrName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/vaults/${idOrName}/items`, options); } /** - * Delete a vault item and invalidate its secret value + * Unresolved payment operations block deletion, including operations on child + * cards of a wallet. Reconcile the original attempt with the provider or support + * first; deleting or recreating an item is not proof that a payment did not occur. + * + * @example + * ```ts + * await client.vaults.items.delete('x', { + * id_or_name: 'id_or_name', + * }); + * ``` */ delete(key: string, params: ItemDeleteParams, options?: RequestOptions): APIPromise { const { id_or_name } = params; @@ -48,6 +95,14 @@ export class Items extends APIResource { /** * List immutable audit events for a vault item + * + * @example + * ```ts + * const vaultItemEvents = await client.vaults.items.events( + * 'key', + * { id_or_name: 'id_or_name' }, + * ); + * ``` */ events(key: string, params: ItemEventsParams, options?: RequestOptions): APIPromise { const { id_or_name, ...query } = params; @@ -57,9 +112,20 @@ export class Items extends APIResource { /** * Retrieve the item first and invoke only an operation listed in * `available_operations`, following its natural-language description. Operations - * may call an external provider and can return the item's updated state. If the - * provider rate limits spend-request creation, returns HTTP 429 with code + * may call an external provider and return updated state. Link cards advertise + * authorize. AgentCard cards are created with PUT and request approval when their + * aliases are used at checkout; they do not expose this operation. If + * spend-request creation is rate limited, returns HTTP 429 with code * `spend_request_rate_limited`; stop and back off before retrying. + * + * @example + * ```ts + * const vaultItem = + * await client.vaults.items.performOperation('key', { + * id_or_name: 'id_or_name', + * type: 'authorize', + * }); + * ``` */ performOperation( key: string, @@ -71,7 +137,21 @@ export class Items extends APIResource { } /** - * Create or retrieve an identical vault item by immutable key + * Create an item under a key unique within its vault, or retrieve the existing + * item when its specification matches. An identical card PUT returns the existing + * card in any lifecycle state without polling the provider, reauthorizing, + * replacing aliases, or resetting recovery. Conflicting specifications return 409. + * Provider-specific authorization requirements and retry behavior are described in + * the item's request schema. + * + * @example + * ```ts + * const vaultItem = await client.vaults.items.upsert('x', { + * id_or_name: 'id_or_name', + * spec: { provider: 'link' }, + * type: 'card', + * }); + * ``` */ upsert(key: string, params: ItemUpsertParams, options?: RequestOptions): APIPromise { const { id_or_name, ...body } = params; @@ -279,7 +359,21 @@ export namespace CardVaultItemState { export interface LinkCardState { provider: 'link'; - status: 'requested' | 'pending_authorization' | 'ready' | 'consumed' | 'expired' | 'declined'; + /** + * recovery_required means an original provider operation has an unresolved + * outcome. Do not retry, delete, or replace it. Known references may be observed + * safely, but unknown creation without an ID and uncertain card-material retrieval + * require manual reconciliation with the provider or support. There is no reset or + * caller-asserted reconciliation operation. + */ + status: + | 'requested' + | 'pending_authorization' + | 'ready' + | 'consumed' + | 'expired' + | 'declined' + | 'recovery_required'; aliases?: ItemsAPI.VaultCardAliases; @@ -303,7 +397,13 @@ export namespace CardVaultItemState { export interface AgentCardCardState { provider: 'agentcard'; - status: 'requested' | 'ready' | 'pending_approval' | 'degraded'; + /** + * recovery_required means the original checkout outcome is unresolved. Do not + * retry, delete, or replace it. Known authorization IDs may be reconciled through + * provider observations; otherwise contact the provider or support for manual + * reconciliation. It does not mean declined or expired. + */ + status: 'requested' | 'ready' | 'pending_approval' | 'degraded' | 'recovery_required'; aliases?: ItemsAPI.VaultCardAliases; @@ -357,9 +457,12 @@ export namespace VaultItem { key: string; /** - * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard - * credential; there is no per-item test flag. user_id may only reference a user - * already enrolled by a wallet in this organization. + * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or + * select a customer-owned configuration. Mode (sandbox vs live) is determined by + * the selected credential; there is no per-item test flag. Without user_id, + * creation returns a hosted enrollment action and Kernel polls until the user + * connects. user_id may only reference a user already enrolled by a wallet in this + * organization under the same configuration. */ spec: ItemsAPI.WalletVaultItemSpec; @@ -572,9 +675,12 @@ export namespace VaultPaymentMethod { } /** - * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard - * credential; there is no per-item test flag. user_id may only reference a user - * already enrolled by a wallet in this organization. + * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or + * select a customer-owned configuration. Mode (sandbox vs live) is determined by + * the selected credential; there is no per-item test flag. Without user_id, + * creation returns a hosted enrollment action and Kernel polls until the user + * connects. user_id may only reference a user already enrolled by a wallet in this + * organization under the same configuration. */ export type WalletVaultItemSpec = | WalletVaultItemSpec.LinkWalletVaultItemSpec @@ -589,28 +695,73 @@ export namespace WalletVaultItemSpec { export namespace LinkWalletVaultItemSpec { export interface Authorization { - client: Authorization.Client; + client: Authorization.KernelManagedOAuthClient | Authorization.CustomerManagedOAuthClient; method: 'oauth'; } export namespace Authorization { - export interface Client { + export interface KernelManagedOAuthClient { type: 'kernel_managed'; } + + export interface CustomerManagedOAuthClient { + /** + * Select a provider config by ID or name. Responses return the ID. Renaming a + * config does not change existing wallet bindings; a wallet cannot switch to a + * different config after creation. + */ + provider_config: CustomerManagedOAuthClient.ProviderConfig; + + type: 'customer_managed'; + } + + export namespace CustomerManagedOAuthClient { + /** + * Select a provider config by ID or name. Responses return the ID. Renaming a + * config does not change existing wallet bindings; a wallet cannot switch to a + * different config after creation. + */ + export interface ProviderConfig { + id?: string; + + name?: string; + } + } } } /** - * AgentCard wallet. Mode (sandbox vs live) is fixed by the deployment's AgentCard - * credential; there is no per-item test flag. user_id may only reference a user - * already enrolled by a wallet in this organization. + * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or + * select a customer-owned configuration. Mode (sandbox vs live) is determined by + * the selected credential; there is no per-item test flag. Without user_id, + * creation returns a hosted enrollment action and Kernel polls until the user + * connects. user_id may only reference a user already enrolled by a wallet in this + * organization under the same configuration. */ export interface AgentCardWalletVaultItemSpec { provider: 'agentcard'; + /** + * Select an AgentCard configuration. The wallet's configuration cannot be changed + * after creation. + */ + provider_config?: AgentCardWalletVaultItemSpec.ProviderConfig; + user_id?: string; } + + export namespace AgentCardWalletVaultItemSpec { + /** + * Select an AgentCard configuration. The wallet's configuration cannot be changed + * after creation. + */ + export interface ProviderConfig { + id?: string; + + name?: string; + } + } } export type WalletVaultItemState = @@ -720,11 +871,16 @@ export declare namespace ItemUpsertParams { id_or_name: string; /** - * Body param: AgentCard wallet. Mode (sandbox vs live) is fixed by the - * deployment's AgentCard credential; there is no per-item test flag. user_id may - * only reference a user already enrolled by a wallet in this organization. + * Body param: AgentCard wallet. Omit provider_config to use Kernel-managed + * credentials, or select a customer-owned configuration. Mode (sandbox vs live) is + * determined by the selected credential; there is no per-item test flag. Without + * user_id, creation returns a hosted enrollment action and Kernel polls until the + * user connects. user_id may only reference a user already enrolled by a wallet in + * this organization under the same configuration. */ - spec: WalletVaultItemSpec; + spec: + | WalletVaultItemRequest.LinkWalletVaultItemRequestSpec + | WalletVaultItemRequest.AgentCardWalletVaultItemSpec; /** * Body param @@ -732,6 +888,150 @@ export declare namespace ItemUpsertParams { type: 'wallet'; } + export namespace WalletVaultItemRequest { + export interface LinkWalletVaultItemRequestSpec { + /** + * Kernel starts and completes the user's Link authorization flow. + */ + authorization: + | LinkWalletVaultItemRequestSpec.KernelManagedLinkAuthorizationInput + | LinkWalletVaultItemRequestSpec.ImportedLinkAuthorizationInput; + + provider: 'link'; + } + + export namespace LinkWalletVaultItemRequestSpec { + /** + * Kernel starts and completes the user's Link authorization flow. + */ + export interface KernelManagedLinkAuthorizationInput { + client: KernelManagedLinkAuthorizationInput.Client; + + method: 'oauth'; + } + + export namespace KernelManagedLinkAuthorizationInput { + export interface Client { + type: 'kernel_managed'; + } + } + + /** + * The customer's backend completes Link OAuth and supplies the resulting tokens. + * For a new wallet, Kernel verifies the access token can access Link payment + * methods without consuming or rotating the refresh token. Valid access creates a + * wallet with state.status=connected. An expired, invalid, revoked, or + * insufficiently scoped access token returns 400 and no wallet is created. Refresh + * expired tokens in your backend before importing them. A failed import does not + * modify existing wallets. After successful import, Kernel owns subsequent + * refresh-token rotation; the customer must stop refreshing this grant. Import + * does not verify the refresh token: if it or the configured client credentials + * are rejected during a later refresh, the imported wallet becomes degraded. An + * unknown refresh outcome also leaves it degraded; Kernel does not retry a refresh + * token that may already have been consumed. There is no in-place reauthorization + * operation for an imported wallet. If this imported wallet's credentials become + * unusable, obtain a fresh Link OAuth grant in your backend and create a wallet + * under a NEW wallet key. Use the new wallet for NEW cards and payments, not to + * retry an old payment whose outcome is uncertain. This does not replace the old + * grant, rebind existing cards, or resolve their payment outcomes. Retain the old + * wallet and its cards while reconciling any uncertain payments with the provider + * or support. Do not repeat an uncertain payment on the new wallet, and do not + * treat deletion as evidence that it did not execute. Deletion of the old wallet + * can remain blocked by unresolved child cards. Repeating a create for the same + * item key and non-secret spec returns the existing wallet without replacing + * tokens, even if they have rotated or the wallet needs reconnection. ID and name + * references resolving to the same config are equivalent. A different config or + * non-secret spec returns 409. This create operation does not replace an existing + * grant. + */ + export interface ImportedLinkAuthorizationInput { + client: ImportedLinkAuthorizationInput.Client; + + method: 'oauth'; + + /** + * Send the token pair from your backend. Both tokens must be from the same Link + * grant under the referenced client. Supply a currently valid access token. Kernel + * refreshes when needed after import and uses the expiry returned by Link for + * subsequent tokens. Tokens are never returned in wallet responses, events, or + * logs. + */ + tokens: ImportedLinkAuthorizationInput.Tokens; + } + + export namespace ImportedLinkAuthorizationInput { + export interface Client { + /** + * Select a provider config by ID or name. Responses return the ID. Renaming a + * config does not change existing wallet bindings; a wallet cannot switch to a + * different config after creation. + */ + provider_config: Client.ProviderConfig; + + type: 'customer_managed'; + } + + export namespace Client { + /** + * Select a provider config by ID or name. Responses return the ID. Renaming a + * config does not change existing wallet bindings; a wallet cannot switch to a + * different config after creation. + */ + export interface ProviderConfig { + id?: string; + + name?: string; + } + } + + /** + * Send the token pair from your backend. Both tokens must be from the same Link + * grant under the referenced client. Supply a currently valid access token. Kernel + * refreshes when needed after import and uses the expiry returned by Link for + * subsequent tokens. Tokens are never returned in wallet responses, events, or + * logs. + */ + export interface Tokens { + access_token: string; + + refresh_token: string; + } + } + } + + /** + * AgentCard wallet. Omit provider_config to use Kernel-managed credentials, or + * select a customer-owned configuration. Mode (sandbox vs live) is determined by + * the selected credential; there is no per-item test flag. Without user_id, + * creation returns a hosted enrollment action and Kernel polls until the user + * connects. user_id may only reference a user already enrolled by a wallet in this + * organization under the same configuration. + */ + export interface AgentCardWalletVaultItemSpec { + provider: 'agentcard'; + + /** + * Select an AgentCard configuration. The wallet's configuration cannot be changed + * after creation. + */ + provider_config?: AgentCardWalletVaultItemSpec.ProviderConfig; + + user_id?: string; + } + + export namespace AgentCardWalletVaultItemSpec { + /** + * Select an AgentCard configuration. The wallet's configuration cannot be changed + * after creation. + */ + export interface ProviderConfig { + id?: string; + + name?: string; + } + } + } + export interface CardVaultItemRequest { /** * Path param diff --git a/src/resources/vaults/vaults.ts b/src/resources/vaults/vaults.ts index 3031f0b..3558f3d 100644 --- a/src/resources/vaults/vaults.ts +++ b/src/resources/vaults/vaults.ts @@ -34,6 +34,11 @@ export class Vaults extends APIResource { /** * Get a vault + * + * @example + * ```ts + * const vault = await client.vaults.retrieve('id_or_name'); + * ``` */ retrieve(idOrName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/vaults/${idOrName}`, options); @@ -41,6 +46,14 @@ export class Vaults extends APIResource { /** * List vaults in the current project + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const vault of client.vaults.list()) { + * // ... + * } + * ``` */ list( query: VaultListParams | null | undefined = {}, @@ -50,7 +63,14 @@ export class Vaults extends APIResource { } /** - * Delete a vault and invalidate its items + * Unresolved payment operations block deletion. Reconcile the original attempt + * with the provider or support first; deleting or recreating an item is not proof + * that a payment did not occur. + * + * @example + * ```ts + * await client.vaults.delete('id_or_name'); + * ``` */ delete(idOrName: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/vaults/${idOrName}`, { @@ -60,7 +80,16 @@ export class Vaults extends APIResource { } /** - * Create or retrieve a vault by immutable name + * Free organizations can store up to 3 non-deleted vaults across all projects. + * Paid plans and active trials have no vault cap. Retrieving an existing vault by + * name succeeds even at the limit. + * + * @example + * ```ts + * const vault = await client.vaults.upsert({ + * name: 'checkout', + * }); + * ``` */ upsert(body: VaultUpsertParams, options?: RequestOptions): APIPromise { return this._client.post('/vaults', { body, ...options }); diff --git a/src/version.ts b/src/version.ts index 60f4455..bdc4cd8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.100.0'; // x-release-please-version +export const VERSION = '0.101.0'; // x-release-please-version diff --git a/tests/api-resources/vault-provider-configs.test.ts b/tests/api-resources/vault-provider-configs.test.ts new file mode 100644 index 0000000..d75ca7b --- /dev/null +++ b/tests/api-resources/vault-provider-configs.test.ts @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource vaultProviderConfigs', () => { + // Mock server tests are disabled + test.skip('create: only required params', async () => { + const responsePromise = client.vaultProviderConfigs.create({ + credentials: { client_id: 'x', client_secret: 'x' }, + name: 'name', + provider: 'link', + }); + 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('create: required and optional params', async () => { + const response = await client.vaultProviderConfigs.create({ + credentials: { client_id: 'x', client_secret: 'x' }, + name: 'name', + provider: 'link', + }); + }); + + // Mock server tests are disabled + test.skip('retrieve', async () => { + const responsePromise = client.vaultProviderConfigs.retrieve('id_or_name'); + 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('update', async () => { + const responsePromise = client.vaultProviderConfigs.update('id_or_name', {}); + 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', async () => { + const responsePromise = client.vaultProviderConfigs.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); + }); + + // Mock server tests are disabled + 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.vaultProviderConfigs.list({ limit: 1, offset: 0 }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Kernel.NotFoundError); + }); + + // Mock server tests are disabled + test.skip('delete', async () => { + const responsePromise = client.vaultProviderConfigs.delete('id_or_name'); + 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); + }); +}); diff --git a/tests/api-resources/vaults/items.test.ts b/tests/api-resources/vaults/items.test.ts index 4edda3e..9a50fbc 100644 --- a/tests/api-resources/vaults/items.test.ts +++ b/tests/api-resources/vaults/items.test.ts @@ -34,15 +34,15 @@ describe('resource items', () => { const responsePromise = client.vaults.items.update('x', { id_or_name: 'id_or_name', spec: { - amount: 1, + amount: 3000, context: - 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', - currency: 'bFx', - merchant_name: 'x', - merchant_url: 'https://example.com', - payment_method_id: 'x', + 'The order total changed to USD 30.00 including shipping and taxes for one notebook. Update this unapproved request rather than creating a second payment.', + currency: 'usd', + merchant_name: 'Example Store', + merchant_url: 'https://store.example.com', + payment_method_id: 'pm_example', provider: 'link', - wallet: 'wallet', + wallet: 'link-wallet', }, }); const rawResponse = await responsePromise.asResponse(); @@ -59,15 +59,15 @@ describe('resource items', () => { const response = await client.vaults.items.update('x', { id_or_name: 'id_or_name', spec: { - amount: 1, + amount: 3000, context: - 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', - currency: 'bFx', - merchant_name: 'x', - merchant_url: 'https://example.com', - payment_method_id: 'x', + 'The order total changed to USD 30.00 including shipping and taxes for one notebook. Update this unapproved request rather than creating a second payment.', + currency: 'usd', + merchant_name: 'Example Store', + merchant_url: 'https://store.example.com', + payment_method_id: 'pm_example', provider: 'link', - wallet: 'wallet', + wallet: 'link-wallet', expires_at: 0, line_items: [ { diff --git a/tests/api-resources/vaults/vaults.test.ts b/tests/api-resources/vaults/vaults.test.ts index b8348ef..33b899e 100644 --- a/tests/api-resources/vaults/vaults.test.ts +++ b/tests/api-resources/vaults/vaults.test.ts @@ -54,7 +54,7 @@ describe('resource vaults', () => { // Mock server tests are disabled test.skip('upsert: only required params', async () => { - const responsePromise = client.vaults.upsert({ name: 'name' }); + const responsePromise = client.vaults.upsert({ name: 'checkout' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -66,6 +66,6 @@ describe('resource vaults', () => { // Mock server tests are disabled test.skip('upsert: required and optional params', async () => { - const response = await client.vaults.upsert({ name: 'name' }); + const response = await client.vaults.upsert({ name: 'checkout' }); }); });