From 54e42f1470c8a3db5ad638ccf7f6966faa6d0ad9 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 7 Apr 2026 12:01:06 +0100 Subject: [PATCH 01/14] feat: add Artifacts binding TypeScript definitions Add type definitions for the Artifacts binding to types/defines/. Defines the Artifacts interface with methods for: - Repository management: createRepo, getRepo, listRepos, deleteRepo - Fork operations: forkRepo, importFromGitHub - Token management: createToken, validateToken, listTokens, revokeToken All methods include JSDoc documentation with parameter descriptions. Ref: cloudflare/ai-agents/artifacts#2 --- types/defines/artifacts.d.ts | 185 +++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 types/defines/artifacts.d.ts diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts new file mode 100644 index 00000000000..8bea6d82003 --- /dev/null +++ b/types/defines/artifacts.d.ts @@ -0,0 +1,185 @@ +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ + +/** Information about a repository. */ +interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; +} + +/** Result of creating a repository — includes the initial access token. */ +interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} + +/** Paginated list of repositories. */ +interface ArtifactsRepoListResult { + /** Repositories in this page. */ + repos: ArtifactsRepoInfo[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} + +/** Result of creating an access token. */ +interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "rw" (read-write) or "r" (read-only). */ + scope: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} + +/** Token validation result. */ +interface ArtifactsTokenValidation { + /** Whether the token is valid for the given repository. */ + valid: boolean; + /** Token scope, if valid. */ + scope?: string; +} + +/** Token metadata (no plaintext). */ +interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "rw" or "r". */ + scope: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} + +/** Paginated list of tokens for a repository. */ +interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} + +/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +interface ArtifactsRepo { + /** Get repo info including remote URL. Returns null if repo no longer exists. */ + info(): Promise; + + // ── Tokens ── + + /** + * Create an access token for this repo. + * @param scope Token scope: "rw" (default) or "r". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + */ + createToken( + scope?: 'rw' | 'r', + ttl?: number + ): Promise; + + /** + * Validate a token against this repo. + * @param token The plaintext token. + */ + validateToken(token: string): Promise; + + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + */ + revokeToken(tokenOrId: string): Promise; + + // ── Fork ── + + /** + * Fork this repo to a new repo. + * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + */ + fork(target: { + name: string; + namespace?: string; + readOnly?: boolean; + }): Promise; +} + +/** Artifacts binding — namespace-level operations. */ +interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + create( + name: string, + opts?: { readOnly?: boolean } + ): Promise; + + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + */ + delete(name: string): Promise; + + /** + * Import a repository from an external source. + * @param name Target repository name in artifacts. + * @param source Import configuration: url, optional branch, headers, and readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + import( + name: string, + source: { + url: string; + branch?: string; + headers?: Record; + readOnly?: boolean; + } + ): Promise; +} From fc36f61e681d7ddfbde825b005a4466d4c1dc218 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 8 Apr 2026 17:49:34 +0100 Subject: [PATCH 02/14] fix: correct fork() return type to include repo handle instead of objects count --- types/defines/artifacts.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 8bea6d82003..b3bb4fd74e6 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -128,7 +128,7 @@ interface ArtifactsRepo { name: string; namespace?: string; readOnly?: boolean; - }): Promise; + }): Promise; } /** Artifacts binding — namespace-level operations. */ From 62e230bcf3fe73a2b02ce1d93cef6c24eabfc28d Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 11:54:31 +0100 Subject: [PATCH 03/14] fix: align Artifacts type definitions with actual binding API - Add missing fields to ArtifactsRepoInfo: description, defaultBranch, updatedAt, lastPushAt - Add missing fields to ArtifactsCreateRepoResult: description, defaultBranch - Fix ArtifactsRepoListResult.repos to use Omit since list() does not include remote URLs - Fix token scope values from 'rw'/'r' to 'write'/'read' to match the public Scope type - Add missing 'state' field to ArtifactsTokenInfo - Update JSDoc comments to reflect correct scope values --- types/defines/artifacts.d.ts | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index b3bb4fd74e6..fdfa8f59a7a 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -11,13 +11,21 @@ interface ArtifactsRepoInfo { id: string; /** Repository name. */ name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; /** ISO 8601 creation timestamp. */ createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. */ + /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ remote: string; } @@ -27,6 +35,10 @@ interface ArtifactsCreateRepoResult { id: string; /** Repository name. */ name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; /** HTTPS git remote URL. */ remote: string; /** Plaintext access token (only returned at creation time). */ @@ -37,8 +49,8 @@ interface ArtifactsCreateRepoResult { /** Paginated list of repositories. */ interface ArtifactsRepoListResult { - /** Repositories in this page. */ - repos: ArtifactsRepoInfo[]; + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; /** Total number of repositories in the namespace. */ total: number; /** Cursor for the next page, if there are more results. */ @@ -51,7 +63,7 @@ interface ArtifactsCreateTokenResult { id: string; /** Plaintext token (only returned at creation time). */ plaintext: string; - /** Token scope: "rw" (read-write) or "r" (read-only). */ + /** Token scope: "read" or "write". */ scope: string; /** ISO 8601 token expiry timestamp. */ expiresAt: string; @@ -69,8 +81,10 @@ interface ArtifactsTokenValidation { interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; - /** Token scope: "rw" or "r". */ + /** Token scope: "read" or "write". */ scope: string; + /** Token state: "active", "expired", or "revoked". */ + state: 'active' | 'expired' | 'revoked'; /** ISO 8601 creation timestamp. */ createdAt: string; /** ISO 8601 expiry timestamp. */ @@ -94,11 +108,11 @@ interface ArtifactsRepo { /** * Create an access token for this repo. - * @param scope Token scope: "rw" (default) or "r". + * @param scope Token scope: "write" (default) or "read". * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). */ createToken( - scope?: 'rw' | 'r', + scope?: 'write' | 'read', ttl?: number ): Promise; From f0ba2b1997fda668b6c6ba1e57ab36b947e4a193 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 12:27:56 +0100 Subject: [PATCH 04/14] chore: update generated type snapshots with Artifacts types Add Artifacts binding types to the generated snapshot files (index.d.ts and index.ts) to match bazel-generated output. --- .../experimental/index.d.ts | 193 ++++++++++++++++++ .../generated-snapshot/experimental/index.ts | 193 ++++++++++++++++++ types/generated-snapshot/latest/index.d.ts | 193 ++++++++++++++++++ types/generated-snapshot/latest/index.ts | 193 ++++++++++++++++++ 4 files changed, 772 insertions(+) diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 8413cd55a0e..77d3610d4ad 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11737,6 +11737,199 @@ declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ +/** Information about a repository. */ +interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + remote: string; +} +/** Result of creating a repository — includes the initial access token. */ +interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of repositories. */ +interface ArtifactsRepoListResult { + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} +/** Result of creating an access token. */ +interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "read" or "write". */ + scope: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Token validation result. */ +interface ArtifactsTokenValidation { + /** Whether the token is valid for the given repository. */ + valid: boolean; + /** Token scope, if valid. */ + scope?: string; +} +/** Token metadata (no plaintext). */ +interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "read" or "write". */ + scope: string; + /** Token state: "active", "expired", or "revoked". */ + state: "active" | "expired" | "revoked"; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of tokens for a repository. */ +interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} +/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +interface ArtifactsRepo { + /** Get repo info including remote URL. Returns null if repo no longer exists. */ + info(): Promise; + // ── Tokens ── + /** + * Create an access token for this repo. + * @param scope Token scope: "write" (default) or "read". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + */ + createToken( + scope?: "write" | "read", + ttl?: number, + ): Promise; + /** + * Validate a token against this repo. + * @param token The plaintext token. + */ + validateToken(token: string): Promise; + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + */ + revokeToken(tokenOrId: string): Promise; + // ── Fork ── + /** + * Fork this repo to a new repo. + * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + */ + fork(target: { + name: string; + namespace?: string; + readOnly?: boolean; + }): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} +/** Artifacts binding — namespace-level operations. */ +interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + create( + name: string, + opts?: { + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + */ + delete(name: string): Promise; + /** + * Import a repository from an external source. + * @param name Target repository name in artifacts. + * @param source Import configuration: url, optional branch, headers, and readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + import( + name: string, + source: { + url: string; + branch?: string; + headers?: Record; + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} /** * @deprecated Use the standalone AI Search Workers binding instead. * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 052b12ab32b..f7d259652a5 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11749,6 +11749,199 @@ export declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ +/** Information about a repository. */ +export interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + remote: string; +} +/** Result of creating a repository — includes the initial access token. */ +export interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of repositories. */ +export interface ArtifactsRepoListResult { + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} +/** Result of creating an access token. */ +export interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "read" or "write". */ + scope: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Token validation result. */ +export interface ArtifactsTokenValidation { + /** Whether the token is valid for the given repository. */ + valid: boolean; + /** Token scope, if valid. */ + scope?: string; +} +/** Token metadata (no plaintext). */ +export interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "read" or "write". */ + scope: string; + /** Token state: "active", "expired", or "revoked". */ + state: "active" | "expired" | "revoked"; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of tokens for a repository. */ +export interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} +/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +export interface ArtifactsRepo { + /** Get repo info including remote URL. Returns null if repo no longer exists. */ + info(): Promise; + // ── Tokens ── + /** + * Create an access token for this repo. + * @param scope Token scope: "write" (default) or "read". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + */ + createToken( + scope?: "write" | "read", + ttl?: number, + ): Promise; + /** + * Validate a token against this repo. + * @param token The plaintext token. + */ + validateToken(token: string): Promise; + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + */ + revokeToken(tokenOrId: string): Promise; + // ── Fork ── + /** + * Fork this repo to a new repo. + * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + */ + fork(target: { + name: string; + namespace?: string; + readOnly?: boolean; + }): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} +/** Artifacts binding — namespace-level operations. */ +export interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + create( + name: string, + opts?: { + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + */ + delete(name: string): Promise; + /** + * Import a repository from an external source. + * @param name Target repository name in artifacts. + * @param source Import configuration: url, optional branch, headers, and readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + import( + name: string, + source: { + url: string; + branch?: string; + headers?: Record; + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} /** * @deprecated Use the standalone AI Search Workers binding instead. * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index e0864cedde9..16b2f5836dd 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11083,6 +11083,199 @@ declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ +/** Information about a repository. */ +interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + remote: string; +} +/** Result of creating a repository — includes the initial access token. */ +interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of repositories. */ +interface ArtifactsRepoListResult { + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} +/** Result of creating an access token. */ +interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "read" or "write". */ + scope: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Token validation result. */ +interface ArtifactsTokenValidation { + /** Whether the token is valid for the given repository. */ + valid: boolean; + /** Token scope, if valid. */ + scope?: string; +} +/** Token metadata (no plaintext). */ +interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "read" or "write". */ + scope: string; + /** Token state: "active", "expired", or "revoked". */ + state: "active" | "expired" | "revoked"; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of tokens for a repository. */ +interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} +/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +interface ArtifactsRepo { + /** Get repo info including remote URL. Returns null if repo no longer exists. */ + info(): Promise; + // ── Tokens ── + /** + * Create an access token for this repo. + * @param scope Token scope: "write" (default) or "read". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + */ + createToken( + scope?: "write" | "read", + ttl?: number, + ): Promise; + /** + * Validate a token against this repo. + * @param token The plaintext token. + */ + validateToken(token: string): Promise; + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + */ + revokeToken(tokenOrId: string): Promise; + // ── Fork ── + /** + * Fork this repo to a new repo. + * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + */ + fork(target: { + name: string; + namespace?: string; + readOnly?: boolean; + }): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} +/** Artifacts binding — namespace-level operations. */ +interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + create( + name: string, + opts?: { + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + */ + delete(name: string): Promise; + /** + * Import a repository from an external source. + * @param name Target repository name in artifacts. + * @param source Import configuration: url, optional branch, headers, and readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + import( + name: string, + source: { + url: string; + branch?: string; + headers?: Record; + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} /** * @deprecated Use the standalone AI Search Workers binding instead. * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index d8e1cc3c377..0973f8618b4 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11095,6 +11095,199 @@ export declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ +/** Information about a repository. */ +export interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + remote: string; +} +/** Result of creating a repository — includes the initial access token. */ +export interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of repositories. */ +export interface ArtifactsRepoListResult { + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} +/** Result of creating an access token. */ +export interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "read" or "write". */ + scope: string; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Token validation result. */ +export interface ArtifactsTokenValidation { + /** Whether the token is valid for the given repository. */ + valid: boolean; + /** Token scope, if valid. */ + scope?: string; +} +/** Token metadata (no plaintext). */ +export interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "read" or "write". */ + scope: string; + /** Token state: "active", "expired", or "revoked". */ + state: "active" | "expired" | "revoked"; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of tokens for a repository. */ +export interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} +/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +export interface ArtifactsRepo { + /** Get repo info including remote URL. Returns null if repo no longer exists. */ + info(): Promise; + // ── Tokens ── + /** + * Create an access token for this repo. + * @param scope Token scope: "write" (default) or "read". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + */ + createToken( + scope?: "write" | "read", + ttl?: number, + ): Promise; + /** + * Validate a token against this repo. + * @param token The plaintext token. + */ + validateToken(token: string): Promise; + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + */ + revokeToken(tokenOrId: string): Promise; + // ── Fork ── + /** + * Fork this repo to a new repo. + * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + */ + fork(target: { + name: string; + namespace?: string; + readOnly?: boolean; + }): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} +/** Artifacts binding — namespace-level operations. */ +export interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + create( + name: string, + opts?: { + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + */ + delete(name: string): Promise; + /** + * Import a repository from an external source. + * @param name Target repository name in artifacts. + * @param source Import configuration: url, optional branch, headers, and readOnly flag. + * @returns Repo metadata with initial token, plus a repo handle. + */ + import( + name: string, + source: { + url: string; + branch?: string; + headers?: Record; + readOnly?: boolean; + }, + ): Promise< + ArtifactsCreateRepoResult & { + repo: ArtifactsRepo; + } + >; +} /** * @deprecated Use the standalone AI Search Workers binding instead. * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ From f73fccb76653cd2c30e35a8160ecd5f37c52e611 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 17:39:17 +0100 Subject: [PATCH 05/14] fix: apply PR review suggestions - fork(): flatten to (name, opts?) with description, readOnly, defaultBranchOnly - create(): add description and setDefaultBranch to opts - import(): restructure to params object with source and target - Flatten return types: remove '& { repo: ArtifactsRepo }' intersections - get(): add JSDoc note about transient states (import/fork in progress) - Update all 4 generated snapshot files to match --- types/defines/artifacts.d.ts | 48 +++++++++------ .../experimental/index.d.ts | 60 +++++++++---------- .../generated-snapshot/experimental/index.ts | 60 +++++++++---------- types/generated-snapshot/latest/index.d.ts | 60 +++++++++---------- types/generated-snapshot/latest/index.ts | 60 +++++++++---------- 5 files changed, 149 insertions(+), 139 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index fdfa8f59a7a..b1f33998017 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -136,13 +136,17 @@ interface ArtifactsRepo { /** * Fork this repo to a new repo. - * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). */ - fork(target: { - name: string; - namespace?: string; - readOnly?: boolean; - }): Promise; + fork( + name: string, + opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + } + ): Promise; } /** Artifacts binding — namespace-level operations. */ @@ -150,16 +154,17 @@ interface Artifacts { /** * Create a new repository with an initial access token. * @param name Repository name (alphanumeric, dots, hyphens, underscores). - * @param opts Optional: readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. */ create( name: string, - opts?: { readOnly?: boolean } - ): Promise; + opts?: { readOnly?: boolean; description?: string; setDefaultBranch?: string } + ): Promise; /** * Get a handle to an existing repository. + * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. * @returns Repo handle, or null if not found. */ @@ -183,17 +188,22 @@ interface Artifacts { /** * Import a repository from an external source. - * @param name Target repository name in artifacts. - * @param source Import configuration: url, optional branch, headers, and readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param params Import parameters: source configuration and target repository options. + * @returns Repo metadata with initial token. */ - import( - name: string, + import(params: { source: { url: string; branch?: string; - headers?: Record; - readOnly?: boolean; - } - ): Promise; + depth?: number; + }; + target: { + name: string; + opts?: { + defaultBranchOnly?: boolean; + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; } diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 77d3610d4ad..13972281c89 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11860,38 +11860,37 @@ interface ArtifactsRepo { // ── Fork ── /** * Fork this repo to a new repo. - * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). */ - fork(target: { - name: string; - namespace?: string; - readOnly?: boolean; - }): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + fork( + name: string, + opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + }, + ): Promise; } /** Artifacts binding — namespace-level operations. */ interface Artifacts { /** * Create a new repository with an initial access token. * @param name Repository name (alphanumeric, dots, hyphens, underscores). - * @param opts Optional: readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. */ create( name: string, opts?: { readOnly?: boolean; + description?: string; + setDefaultBranch?: string; }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + ): Promise; /** * Get a handle to an existing repository. + * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. * @returns Repo handle, or null if not found. */ @@ -11912,23 +11911,24 @@ interface Artifacts { delete(name: string): Promise; /** * Import a repository from an external source. - * @param name Target repository name in artifacts. - * @param source Import configuration: url, optional branch, headers, and readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param params Import parameters: source configuration and target repository options. + * @returns Repo metadata with initial token. */ - import( - name: string, + import(params: { source: { url: string; branch?: string; - headers?: Record; - readOnly?: boolean; - }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + depth?: number; + }; + target: { + name: string; + opts?: { + defaultBranchOnly?: boolean; + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index f7d259652a5..881641a1ab6 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11872,38 +11872,37 @@ export interface ArtifactsRepo { // ── Fork ── /** * Fork this repo to a new repo. - * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). */ - fork(target: { - name: string; - namespace?: string; - readOnly?: boolean; - }): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + fork( + name: string, + opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + }, + ): Promise; } /** Artifacts binding — namespace-level operations. */ export interface Artifacts { /** * Create a new repository with an initial access token. * @param name Repository name (alphanumeric, dots, hyphens, underscores). - * @param opts Optional: readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. */ create( name: string, opts?: { readOnly?: boolean; + description?: string; + setDefaultBranch?: string; }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + ): Promise; /** * Get a handle to an existing repository. + * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. * @returns Repo handle, or null if not found. */ @@ -11924,23 +11923,24 @@ export interface Artifacts { delete(name: string): Promise; /** * Import a repository from an external source. - * @param name Target repository name in artifacts. - * @param source Import configuration: url, optional branch, headers, and readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param params Import parameters: source configuration and target repository options. + * @returns Repo metadata with initial token. */ - import( - name: string, + import(params: { source: { url: string; branch?: string; - headers?: Record; - readOnly?: boolean; - }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + depth?: number; + }; + target: { + name: string; + opts?: { + defaultBranchOnly?: boolean; + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 16b2f5836dd..6bfb52e4c69 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11206,38 +11206,37 @@ interface ArtifactsRepo { // ── Fork ── /** * Fork this repo to a new repo. - * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). */ - fork(target: { - name: string; - namespace?: string; - readOnly?: boolean; - }): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + fork( + name: string, + opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + }, + ): Promise; } /** Artifacts binding — namespace-level operations. */ interface Artifacts { /** * Create a new repository with an initial access token. * @param name Repository name (alphanumeric, dots, hyphens, underscores). - * @param opts Optional: readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. */ create( name: string, opts?: { readOnly?: boolean; + description?: string; + setDefaultBranch?: string; }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + ): Promise; /** * Get a handle to an existing repository. + * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. * @returns Repo handle, or null if not found. */ @@ -11258,23 +11257,24 @@ interface Artifacts { delete(name: string): Promise; /** * Import a repository from an external source. - * @param name Target repository name in artifacts. - * @param source Import configuration: url, optional branch, headers, and readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param params Import parameters: source configuration and target repository options. + * @returns Repo metadata with initial token. */ - import( - name: string, + import(params: { source: { url: string; branch?: string; - headers?: Record; - readOnly?: boolean; - }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + depth?: number; + }; + target: { + name: string; + opts?: { + defaultBranchOnly?: boolean; + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index 0973f8618b4..f5a9a88932d 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11218,38 +11218,37 @@ export interface ArtifactsRepo { // ── Fork ── /** * Fork this repo to a new repo. - * @param target Target: name, optional namespace (defaults to this binding's namespace), optional readOnly flag. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). */ - fork(target: { - name: string; - namespace?: string; - readOnly?: boolean; - }): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + fork( + name: string, + opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + }, + ): Promise; } /** Artifacts binding — namespace-level operations. */ export interface Artifacts { /** * Create a new repository with an initial access token. * @param name Repository name (alphanumeric, dots, hyphens, underscores). - * @param opts Optional: readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. */ create( name: string, opts?: { readOnly?: boolean; + description?: string; + setDefaultBranch?: string; }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + ): Promise; /** * Get a handle to an existing repository. + * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. * @returns Repo handle, or null if not found. */ @@ -11270,23 +11269,24 @@ export interface Artifacts { delete(name: string): Promise; /** * Import a repository from an external source. - * @param name Target repository name in artifacts. - * @param source Import configuration: url, optional branch, headers, and readOnly flag. - * @returns Repo metadata with initial token, plus a repo handle. + * @param params Import parameters: source configuration and target repository options. + * @returns Repo metadata with initial token. */ - import( - name: string, + import(params: { source: { url: string; branch?: string; - headers?: Record; - readOnly?: boolean; - }, - ): Promise< - ArtifactsCreateRepoResult & { - repo: ArtifactsRepo; - } - >; + depth?: number; + }; + target: { + name: string; + opts?: { + defaultBranchOnly?: boolean; + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. From 35e8d879ff041d3cee1e606e05e7f8c8ddc5f691 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 17:41:22 +0100 Subject: [PATCH 06/14] fix: remove import(), return typed status from get() - Remove Artifacts.import() method entirely - Add ArtifactsGetRepoResult type with repo handle and status field - get() now returns { repo, status } where status is 'ready' | 'importing' | 'forking' - Update all generated snapshots --- types/defines/artifacts.d.ts | 33 ++++++------------- .../experimental/index.d.ts | 32 +++++------------- .../generated-snapshot/experimental/index.ts | 32 +++++------------- types/generated-snapshot/latest/index.d.ts | 32 +++++------------- types/generated-snapshot/latest/index.ts | 32 +++++------------- 5 files changed, 46 insertions(+), 115 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index b1f33998017..ffccf826b7a 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -99,6 +99,14 @@ interface ArtifactsTokenListResult { total: number; } +/** Result of getting a repository handle. */ +interface ArtifactsGetRepoResult { + /** The repo handle, or null if not found. */ + repo: ArtifactsRepo | null; + /** Repository status: "ready", "importing", or "forking". */ + status: 'ready' | 'importing' | 'forking'; +} + /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ @@ -164,11 +172,10 @@ interface Artifacts { /** * Get a handle to an existing repository. - * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. */ - get(name: string): Promise; + get(name: string): Promise; /** * List repositories with cursor-based pagination. @@ -186,24 +193,4 @@ interface Artifacts { */ delete(name: string): Promise; - /** - * Import a repository from an external source. - * @param params Import parameters: source configuration and target repository options. - * @returns Repo metadata with initial token. - */ - import(params: { - source: { - url: string; - branch?: string; - depth?: number; - }; - target: { - name: string; - opts?: { - defaultBranchOnly?: boolean; - description?: string; - readOnly?: boolean; - }; - }; - }): Promise; } diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 13972281c89..095242efbb3 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11830,6 +11830,13 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } +/** Result of getting a repository handle. */ +interface ArtifactsGetRepoResult { + /** The repo handle, or null if not found. */ + repo: ArtifactsRepo | null; + /** Repository status: "ready", "importing", or "forking". */ + status: "ready" | "importing" | "forking"; +} /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ @@ -11890,11 +11897,10 @@ interface Artifacts { ): Promise; /** * Get a handle to an existing repository. - * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. */ - get(name: string): Promise; + get(name: string): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. @@ -11909,26 +11915,6 @@ interface Artifacts { * @returns true if deleted, false if not found. */ delete(name: string): Promise; - /** - * Import a repository from an external source. - * @param params Import parameters: source configuration and target repository options. - * @returns Repo metadata with initial token. - */ - import(params: { - source: { - url: string; - branch?: string; - depth?: number; - }; - target: { - name: string; - opts?: { - defaultBranchOnly?: boolean; - description?: string; - readOnly?: boolean; - }; - }; - }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 881641a1ab6..29f57621d8b 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11842,6 +11842,13 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } +/** Result of getting a repository handle. */ +export interface ArtifactsGetRepoResult { + /** The repo handle, or null if not found. */ + repo: ArtifactsRepo | null; + /** Repository status: "ready", "importing", or "forking". */ + status: "ready" | "importing" | "forking"; +} /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ export interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ @@ -11902,11 +11909,10 @@ export interface Artifacts { ): Promise; /** * Get a handle to an existing repository. - * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. */ - get(name: string): Promise; + get(name: string): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. @@ -11921,26 +11927,6 @@ export interface Artifacts { * @returns true if deleted, false if not found. */ delete(name: string): Promise; - /** - * Import a repository from an external source. - * @param params Import parameters: source configuration and target repository options. - * @returns Repo metadata with initial token. - */ - import(params: { - source: { - url: string; - branch?: string; - depth?: number; - }; - target: { - name: string; - opts?: { - defaultBranchOnly?: boolean; - description?: string; - readOnly?: boolean; - }; - }; - }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 6bfb52e4c69..9f5626e8fdf 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11176,6 +11176,13 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } +/** Result of getting a repository handle. */ +interface ArtifactsGetRepoResult { + /** The repo handle, or null if not found. */ + repo: ArtifactsRepo | null; + /** Repository status: "ready", "importing", or "forking". */ + status: "ready" | "importing" | "forking"; +} /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ @@ -11236,11 +11243,10 @@ interface Artifacts { ): Promise; /** * Get a handle to an existing repository. - * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. */ - get(name: string): Promise; + get(name: string): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. @@ -11255,26 +11261,6 @@ interface Artifacts { * @returns true if deleted, false if not found. */ delete(name: string): Promise; - /** - * Import a repository from an external source. - * @param params Import parameters: source configuration and target repository options. - * @returns Repo metadata with initial token. - */ - import(params: { - source: { - url: string; - branch?: string; - depth?: number; - }; - target: { - name: string; - opts?: { - defaultBranchOnly?: boolean; - description?: string; - readOnly?: boolean; - }; - }; - }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index f5a9a88932d..50bb54aaac0 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11188,6 +11188,13 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } +/** Result of getting a repository handle. */ +export interface ArtifactsGetRepoResult { + /** The repo handle, or null if not found. */ + repo: ArtifactsRepo | null; + /** Repository status: "ready", "importing", or "forking". */ + status: "ready" | "importing" | "forking"; +} /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ export interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ @@ -11248,11 +11255,10 @@ export interface Artifacts { ): Promise; /** * Get a handle to an existing repository. - * May throw if the repo is in a transient state (e.g. "import in progress" or "fork in progress"). * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. */ - get(name: string): Promise; + get(name: string): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. @@ -11267,26 +11273,6 @@ export interface Artifacts { * @returns true if deleted, false if not found. */ delete(name: string): Promise; - /** - * Import a repository from an external source. - * @param params Import parameters: source configuration and target repository options. - * @returns Repo metadata with initial token. - */ - import(params: { - source: { - url: string; - branch?: string; - depth?: number; - }; - target: { - name: string; - opts?: { - defaultBranchOnly?: boolean; - description?: string; - readOnly?: boolean; - }; - }; - }): Promise; } /** * @deprecated Use the standalone AI Search Workers binding instead. From b7f2572b92c3a4fb7d07b8467409307275defb7a Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 17:45:20 +0100 Subject: [PATCH 07/14] fix: use discriminated union for get() result with retryAfter ArtifactsGetRepoResult is now: | { status: 'ready'; repo: ArtifactsRepo } | { status: 'not_found' } | { status: 'importing'; retryAfter: number } | { status: 'forking'; retryAfter: number } --- types/defines/artifacts.d.ts | 13 +++++----- .../experimental/index.d.ts | 24 +++++++++++++------ .../generated-snapshot/experimental/index.ts | 24 +++++++++++++------ types/generated-snapshot/latest/index.d.ts | 24 +++++++++++++------ types/generated-snapshot/latest/index.ts | 24 +++++++++++++------ 5 files changed, 74 insertions(+), 35 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index ffccf826b7a..44f96bbfe2d 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -99,13 +99,12 @@ interface ArtifactsTokenListResult { total: number; } -/** Result of getting a repository handle. */ -interface ArtifactsGetRepoResult { - /** The repo handle, or null if not found. */ - repo: ArtifactsRepo | null; - /** Repository status: "ready", "importing", or "forking". */ - status: 'ready' | 'importing' | 'forking'; -} +/** Result of getting a repository handle — discriminated union on `status`. */ +type ArtifactsGetRepoResult = + | { status: 'ready'; repo: ArtifactsRepo } + | { status: 'not_found' } + | { status: 'importing'; retryAfter: number } + | { status: 'forking'; retryAfter: number }; /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 095242efbb3..621b859cbec 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11830,13 +11830,23 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle. */ -interface ArtifactsGetRepoResult { - /** The repo handle, or null if not found. */ - repo: ArtifactsRepo | null; - /** Repository status: "ready", "importing", or "forking". */ - status: "ready" | "importing" | "forking"; -} +/** Result of getting a repository handle — discriminated union on `status`. */ +type ArtifactsGetRepoResult = + | { + status: "ready"; + repo: ArtifactsRepo; + } + | { + status: "not_found"; + } + | { + status: "importing"; + retryAfter: number; + } + | { + status: "forking"; + retryAfter: number; + }; /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 29f57621d8b..a649bf8bf14 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11842,13 +11842,23 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle. */ -export interface ArtifactsGetRepoResult { - /** The repo handle, or null if not found. */ - repo: ArtifactsRepo | null; - /** Repository status: "ready", "importing", or "forking". */ - status: "ready" | "importing" | "forking"; -} +/** Result of getting a repository handle — discriminated union on `status`. */ +export type ArtifactsGetRepoResult = + | { + status: "ready"; + repo: ArtifactsRepo; + } + | { + status: "not_found"; + } + | { + status: "importing"; + retryAfter: number; + } + | { + status: "forking"; + retryAfter: number; + }; /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ export interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 9f5626e8fdf..ad52f4906a9 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11176,13 +11176,23 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle. */ -interface ArtifactsGetRepoResult { - /** The repo handle, or null if not found. */ - repo: ArtifactsRepo | null; - /** Repository status: "ready", "importing", or "forking". */ - status: "ready" | "importing" | "forking"; -} +/** Result of getting a repository handle — discriminated union on `status`. */ +type ArtifactsGetRepoResult = + | { + status: "ready"; + repo: ArtifactsRepo; + } + | { + status: "not_found"; + } + | { + status: "importing"; + retryAfter: number; + } + | { + status: "forking"; + retryAfter: number; + }; /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index 50bb54aaac0..4a7a0a6449e 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11188,13 +11188,23 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle. */ -export interface ArtifactsGetRepoResult { - /** The repo handle, or null if not found. */ - repo: ArtifactsRepo | null; - /** Repository status: "ready", "importing", or "forking". */ - status: "ready" | "importing" | "forking"; -} +/** Result of getting a repository handle — discriminated union on `status`. */ +export type ArtifactsGetRepoResult = + | { + status: "ready"; + repo: ArtifactsRepo; + } + | { + status: "not_found"; + } + | { + status: "importing"; + retryAfter: number; + } + | { + status: "forking"; + retryAfter: number; + }; /** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ export interface ArtifactsRepo { /** Get repo info including remote URL. Returns null if repo no longer exists. */ From 56bc9daf632b99b1e7b50ae97e1ef9a9b0edd5f5 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 15 Apr 2026 19:59:54 +0100 Subject: [PATCH 08/14] fix: apply artifacts types cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename expiresAt → tokenExpiresAt on ArtifactsCreateRepoResult - Remove ArtifactsTokenValidation and validateToken() - Remove ArtifactsGetRepoResult union, get() returns ArtifactsRepo directly - Inline repo fields directly on ArtifactsRepo (no more info() method) - Restore import() with source/target params structure - Update all generated snapshots --- types/defines/artifacts.d.ts | 74 ++++++++++------- .../experimental/index.d.ts | 80 ++++++++++--------- .../generated-snapshot/experimental/index.ts | 80 ++++++++++--------- types/generated-snapshot/latest/index.d.ts | 80 ++++++++++--------- types/generated-snapshot/latest/index.ts | 80 ++++++++++--------- 5 files changed, 221 insertions(+), 173 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 44f96bbfe2d..dae50de9779 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -25,7 +25,7 @@ interface ArtifactsRepoInfo { source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + /** HTTPS git remote URL. */ remote: string; } @@ -44,7 +44,7 @@ interface ArtifactsCreateRepoResult { /** Plaintext access token (only returned at creation time). */ token: string; /** ISO 8601 token expiry timestamp. */ - expiresAt: string; + tokenExpiresAt: string; } /** Paginated list of repositories. */ @@ -69,14 +69,6 @@ interface ArtifactsCreateTokenResult { expiresAt: string; } -/** Token validation result. */ -interface ArtifactsTokenValidation { - /** Whether the token is valid for the given repository. */ - valid: boolean; - /** Token scope, if valid. */ - scope?: string; -} - /** Token metadata (no plaintext). */ interface ArtifactsTokenInfo { /** Unique token ID. */ @@ -99,17 +91,28 @@ interface ArtifactsTokenListResult { total: number; } -/** Result of getting a repository handle — discriminated union on `status`. */ -type ArtifactsGetRepoResult = - | { status: 'ready'; repo: ArtifactsRepo } - | { status: 'not_found' } - | { status: 'importing'; retryAfter: number } - | { status: 'forking'; retryAfter: number }; - -/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +/** Handle for a single repository. Returned by Artifacts.get(). */ interface ArtifactsRepo { - /** Get repo info including remote URL. Returns null if repo no longer exists. */ - info(): Promise; + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; // ── Tokens ── @@ -123,12 +126,6 @@ interface ArtifactsRepo { ttl?: number ): Promise; - /** - * Validate a token against this repo. - * @param token The plaintext token. - */ - validateToken(token: string): Promise; - /** List tokens for this repo (metadata only, no plaintext). */ listTokens(): Promise; @@ -172,9 +169,29 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. */ - get(name: string): Promise; + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; /** * List repositories with cursor-based pagination. @@ -191,5 +208,4 @@ interface Artifacts { * @returns true if deleted, false if not found. */ delete(name: string): Promise; - } diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 621b859cbec..d4ce1db5a9d 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11763,7 +11763,7 @@ interface ArtifactsRepoInfo { source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + /** HTTPS git remote URL. */ remote: string; } /** Result of creating a repository — includes the initial access token. */ @@ -11781,7 +11781,7 @@ interface ArtifactsCreateRepoResult { /** Plaintext access token (only returned at creation time). */ token: string; /** ISO 8601 token expiry timestamp. */ - expiresAt: string; + tokenExpiresAt: string; } /** Paginated list of repositories. */ interface ArtifactsRepoListResult { @@ -11803,13 +11803,6 @@ interface ArtifactsCreateTokenResult { /** ISO 8601 token expiry timestamp. */ expiresAt: string; } -/** Token validation result. */ -interface ArtifactsTokenValidation { - /** Whether the token is valid for the given repository. */ - valid: boolean; - /** Token scope, if valid. */ - scope?: string; -} /** Token metadata (no plaintext). */ interface ArtifactsTokenInfo { /** Unique token ID. */ @@ -11830,27 +11823,28 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle — discriminated union on `status`. */ -type ArtifactsGetRepoResult = - | { - status: "ready"; - repo: ArtifactsRepo; - } - | { - status: "not_found"; - } - | { - status: "importing"; - retryAfter: number; - } - | { - status: "forking"; - retryAfter: number; - }; -/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +/** Handle for a single repository. Returned by Artifacts.get(). */ interface ArtifactsRepo { - /** Get repo info including remote URL. Returns null if repo no longer exists. */ - info(): Promise; + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; // ── Tokens ── /** * Create an access token for this repo. @@ -11861,11 +11855,6 @@ interface ArtifactsRepo { scope?: "write" | "read", ttl?: number, ): Promise; - /** - * Validate a token against this repo. - * @param token The plaintext token. - */ - validateToken(token: string): Promise; /** List tokens for this repo (metadata only, no plaintext). */ listTokens(): Promise; /** @@ -11908,9 +11897,28 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. */ - get(name: string): Promise; + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index a649bf8bf14..5f7a0b65542 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11775,7 +11775,7 @@ export interface ArtifactsRepoInfo { source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + /** HTTPS git remote URL. */ remote: string; } /** Result of creating a repository — includes the initial access token. */ @@ -11793,7 +11793,7 @@ export interface ArtifactsCreateRepoResult { /** Plaintext access token (only returned at creation time). */ token: string; /** ISO 8601 token expiry timestamp. */ - expiresAt: string; + tokenExpiresAt: string; } /** Paginated list of repositories. */ export interface ArtifactsRepoListResult { @@ -11815,13 +11815,6 @@ export interface ArtifactsCreateTokenResult { /** ISO 8601 token expiry timestamp. */ expiresAt: string; } -/** Token validation result. */ -export interface ArtifactsTokenValidation { - /** Whether the token is valid for the given repository. */ - valid: boolean; - /** Token scope, if valid. */ - scope?: string; -} /** Token metadata (no plaintext). */ export interface ArtifactsTokenInfo { /** Unique token ID. */ @@ -11842,27 +11835,28 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle — discriminated union on `status`. */ -export type ArtifactsGetRepoResult = - | { - status: "ready"; - repo: ArtifactsRepo; - } - | { - status: "not_found"; - } - | { - status: "importing"; - retryAfter: number; - } - | { - status: "forking"; - retryAfter: number; - }; -/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +/** Handle for a single repository. Returned by Artifacts.get(). */ export interface ArtifactsRepo { - /** Get repo info including remote URL. Returns null if repo no longer exists. */ - info(): Promise; + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; // ── Tokens ── /** * Create an access token for this repo. @@ -11873,11 +11867,6 @@ export interface ArtifactsRepo { scope?: "write" | "read", ttl?: number, ): Promise; - /** - * Validate a token against this repo. - * @param token The plaintext token. - */ - validateToken(token: string): Promise; /** List tokens for this repo (metadata only, no plaintext). */ listTokens(): Promise; /** @@ -11920,9 +11909,28 @@ export interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. */ - get(name: string): Promise; + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index ad52f4906a9..97242b19344 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11109,7 +11109,7 @@ interface ArtifactsRepoInfo { source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + /** HTTPS git remote URL. */ remote: string; } /** Result of creating a repository — includes the initial access token. */ @@ -11127,7 +11127,7 @@ interface ArtifactsCreateRepoResult { /** Plaintext access token (only returned at creation time). */ token: string; /** ISO 8601 token expiry timestamp. */ - expiresAt: string; + tokenExpiresAt: string; } /** Paginated list of repositories. */ interface ArtifactsRepoListResult { @@ -11149,13 +11149,6 @@ interface ArtifactsCreateTokenResult { /** ISO 8601 token expiry timestamp. */ expiresAt: string; } -/** Token validation result. */ -interface ArtifactsTokenValidation { - /** Whether the token is valid for the given repository. */ - valid: boolean; - /** Token scope, if valid. */ - scope?: string; -} /** Token metadata (no plaintext). */ interface ArtifactsTokenInfo { /** Unique token ID. */ @@ -11176,27 +11169,28 @@ interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle — discriminated union on `status`. */ -type ArtifactsGetRepoResult = - | { - status: "ready"; - repo: ArtifactsRepo; - } - | { - status: "not_found"; - } - | { - status: "importing"; - retryAfter: number; - } - | { - status: "forking"; - retryAfter: number; - }; -/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +/** Handle for a single repository. Returned by Artifacts.get(). */ interface ArtifactsRepo { - /** Get repo info including remote URL. Returns null if repo no longer exists. */ - info(): Promise; + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; // ── Tokens ── /** * Create an access token for this repo. @@ -11207,11 +11201,6 @@ interface ArtifactsRepo { scope?: "write" | "read", ttl?: number, ): Promise; - /** - * Validate a token against this repo. - * @param token The plaintext token. - */ - validateToken(token: string): Promise; /** List tokens for this repo (metadata only, no plaintext). */ listTokens(): Promise; /** @@ -11254,9 +11243,28 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. */ - get(name: string): Promise; + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index 4a7a0a6449e..055706218dc 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11121,7 +11121,7 @@ export interface ArtifactsRepoInfo { source: string | null; /** Whether the repository is read-only. */ readOnly: boolean; - /** HTTPS git remote URL. Only present when returned by `ArtifactsRepo.info()`. */ + /** HTTPS git remote URL. */ remote: string; } /** Result of creating a repository — includes the initial access token. */ @@ -11139,7 +11139,7 @@ export interface ArtifactsCreateRepoResult { /** Plaintext access token (only returned at creation time). */ token: string; /** ISO 8601 token expiry timestamp. */ - expiresAt: string; + tokenExpiresAt: string; } /** Paginated list of repositories. */ export interface ArtifactsRepoListResult { @@ -11161,13 +11161,6 @@ export interface ArtifactsCreateTokenResult { /** ISO 8601 token expiry timestamp. */ expiresAt: string; } -/** Token validation result. */ -export interface ArtifactsTokenValidation { - /** Whether the token is valid for the given repository. */ - valid: boolean; - /** Token scope, if valid. */ - scope?: string; -} /** Token metadata (no plaintext). */ export interface ArtifactsTokenInfo { /** Unique token ID. */ @@ -11188,27 +11181,28 @@ export interface ArtifactsTokenListResult { /** Total number of tokens for the repository. */ total: number; } -/** Result of getting a repository handle — discriminated union on `status`. */ -export type ArtifactsGetRepoResult = - | { - status: "ready"; - repo: ArtifactsRepo; - } - | { - status: "not_found"; - } - | { - status: "importing"; - retryAfter: number; - } - | { - status: "forking"; - retryAfter: number; - }; -/** Handle for a single repository. Returned by Artifacts.create() and Artifacts.get(). */ +/** Handle for a single repository. Returned by Artifacts.get(). */ export interface ArtifactsRepo { - /** Get repo info including remote URL. Returns null if repo no longer exists. */ - info(): Promise; + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; // ── Tokens ── /** * Create an access token for this repo. @@ -11219,11 +11213,6 @@ export interface ArtifactsRepo { scope?: "write" | "read", ttl?: number, ): Promise; - /** - * Validate a token against this repo. - * @param token The plaintext token. - */ - validateToken(token: string): Promise; /** List tokens for this repo (metadata only, no plaintext). */ listTokens(): Promise; /** @@ -11266,9 +11255,28 @@ export interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle with status. Status is "ready" when usable, "importing" or "forking" when a background operation is in progress. + * @returns Repo handle, or null if not found. + */ + get(name: string): Promise; + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. */ - get(name: string): Promise; + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; /** * List repositories with cursor-based pagination. * @param opts Optional: limit (1–200, default 50), cursor for next page. From 3507b0055225b45c56d53429311c080bae5fa4fe Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 11:45:41 +0100 Subject: [PATCH 09/14] Update types/defines/artifacts.d.ts Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> --- types/defines/artifacts.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index dae50de9779..496f0a4e4ef 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -64,7 +64,7 @@ interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } From 501c7f143906781515b54fc9a0c06d9012bc0f0a Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 11:56:54 +0100 Subject: [PATCH 10/14] update `ArtifactsRepo` to extend `ArtifactsRepoInfo` --- types/defines/artifacts.d.ts | 25 +------------------ .../experimental/index.d.ts | 23 +---------------- .../generated-snapshot/experimental/index.ts | 23 +---------------- types/generated-snapshot/latest/index.d.ts | 23 +---------------- types/generated-snapshot/latest/index.ts | 23 +---------------- 5 files changed, 5 insertions(+), 112 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 496f0a4e4ef..2442bcd31cd 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -92,30 +92,7 @@ interface ArtifactsTokenListResult { } /** Handle for a single repository. Returned by Artifacts.get(). */ -interface ArtifactsRepo { - /** Unique repository ID. */ - id: string; - /** Repository name. */ - name: string; - /** Repository description, or null if not set. */ - description: string | null; - /** Default branch name (e.g. "main"). */ - defaultBranch: string; - /** ISO 8601 creation timestamp. */ - createdAt: string; - /** ISO 8601 last-updated timestamp. */ - updatedAt: string; - /** ISO 8601 timestamp of the last push, or null if never pushed. */ - lastPushAt: string | null; - /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ - source: string | null; - /** Whether the repository is read-only. */ - readOnly: boolean; - /** HTTPS git remote URL. */ - remote: string; - - // ── Tokens ── - +interface ArtifactsRepo extends ArtifactsRepoInfo { /** * Create an access token for this repo. * @param scope Token scope: "write" (default) or "read". diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index d4ce1db5a9d..6221074feab 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11824,28 +11824,7 @@ interface ArtifactsTokenListResult { total: number; } /** Handle for a single repository. Returned by Artifacts.get(). */ -interface ArtifactsRepo { - /** Unique repository ID. */ - id: string; - /** Repository name. */ - name: string; - /** Repository description, or null if not set. */ - description: string | null; - /** Default branch name (e.g. "main"). */ - defaultBranch: string; - /** ISO 8601 creation timestamp. */ - createdAt: string; - /** ISO 8601 last-updated timestamp. */ - updatedAt: string; - /** ISO 8601 timestamp of the last push, or null if never pushed. */ - lastPushAt: string | null; - /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ - source: string | null; - /** Whether the repository is read-only. */ - readOnly: boolean; - /** HTTPS git remote URL. */ - remote: string; - // ── Tokens ── +interface ArtifactsRepo extends ArtifactsRepoInfo { /** * Create an access token for this repo. * @param scope Token scope: "write" (default) or "read". diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 5f7a0b65542..bbc6019b046 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11836,28 +11836,7 @@ export interface ArtifactsTokenListResult { total: number; } /** Handle for a single repository. Returned by Artifacts.get(). */ -export interface ArtifactsRepo { - /** Unique repository ID. */ - id: string; - /** Repository name. */ - name: string; - /** Repository description, or null if not set. */ - description: string | null; - /** Default branch name (e.g. "main"). */ - defaultBranch: string; - /** ISO 8601 creation timestamp. */ - createdAt: string; - /** ISO 8601 last-updated timestamp. */ - updatedAt: string; - /** ISO 8601 timestamp of the last push, or null if never pushed. */ - lastPushAt: string | null; - /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ - source: string | null; - /** Whether the repository is read-only. */ - readOnly: boolean; - /** HTTPS git remote URL. */ - remote: string; - // ── Tokens ── +export interface ArtifactsRepo extends ArtifactsRepoInfo { /** * Create an access token for this repo. * @param scope Token scope: "write" (default) or "read". diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 97242b19344..e13b28bafe6 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11170,28 +11170,7 @@ interface ArtifactsTokenListResult { total: number; } /** Handle for a single repository. Returned by Artifacts.get(). */ -interface ArtifactsRepo { - /** Unique repository ID. */ - id: string; - /** Repository name. */ - name: string; - /** Repository description, or null if not set. */ - description: string | null; - /** Default branch name (e.g. "main"). */ - defaultBranch: string; - /** ISO 8601 creation timestamp. */ - createdAt: string; - /** ISO 8601 last-updated timestamp. */ - updatedAt: string; - /** ISO 8601 timestamp of the last push, or null if never pushed. */ - lastPushAt: string | null; - /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ - source: string | null; - /** Whether the repository is read-only. */ - readOnly: boolean; - /** HTTPS git remote URL. */ - remote: string; - // ── Tokens ── +interface ArtifactsRepo extends ArtifactsRepoInfo { /** * Create an access token for this repo. * @param scope Token scope: "write" (default) or "read". diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index 055706218dc..ebec0dec97c 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11182,28 +11182,7 @@ export interface ArtifactsTokenListResult { total: number; } /** Handle for a single repository. Returned by Artifacts.get(). */ -export interface ArtifactsRepo { - /** Unique repository ID. */ - id: string; - /** Repository name. */ - name: string; - /** Repository description, or null if not set. */ - description: string | null; - /** Default branch name (e.g. "main"). */ - defaultBranch: string; - /** ISO 8601 creation timestamp. */ - createdAt: string; - /** ISO 8601 last-updated timestamp. */ - updatedAt: string; - /** ISO 8601 timestamp of the last push, or null if never pushed. */ - lastPushAt: string | null; - /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ - source: string | null; - /** Whether the repository is read-only. */ - readOnly: boolean; - /** HTTPS git remote URL. */ - remote: string; - // ── Tokens ── +export interface ArtifactsRepo extends ArtifactsRepoInfo { /** * Create an access token for this repo. * @param scope Token scope: "write" (default) or "read". From 603862bec6745391525c1e28b3ce9fa7ddd1560e Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 12:12:53 +0100 Subject: [PATCH 11/14] Update incorrect jsdoc comment --- types/defines/artifacts.d.ts | 2 +- types/generated-snapshot/experimental/index.d.ts | 2 +- types/generated-snapshot/experimental/index.ts | 2 +- types/generated-snapshot/latest/index.d.ts | 2 +- types/generated-snapshot/latest/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 2442bcd31cd..136c19fca0b 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -146,7 +146,7 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle. */ get(name: string): Promise; diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 6221074feab..60026c340ce 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11876,7 +11876,7 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle. */ get(name: string): Promise; /** diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index bbc6019b046..f5f729d5c46 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11888,7 +11888,7 @@ export interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle. */ get(name: string): Promise; /** diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index e13b28bafe6..a20bcfd3235 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11222,7 +11222,7 @@ interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle. */ get(name: string): Promise; /** diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index ebec0dec97c..cb90d1b81fa 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11234,7 +11234,7 @@ export interface Artifacts { /** * Get a handle to an existing repository. * @param name Repository name. - * @returns Repo handle, or null if not found. + * @returns Repo handle. */ get(name: string): Promise; /** From 3798d21b4c4b8466acaac1dccdf101569282726c Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 12:20:12 +0100 Subject: [PATCH 12/14] Update types/defines/artifacts.d.ts Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> --- types/defines/artifacts.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 136c19fca0b..089d673b9ee 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -1,3 +1,7 @@ +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 + /** * Artifacts — Git-compatible file storage on Cloudflare Workers. * From ddbc54a1ec327c97a5aa07c8616ebbe27e3f3274 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 12:22:58 +0100 Subject: [PATCH 13/14] Update token scope to use strings union --- types/defines/artifacts.d.ts | 2 +- types/generated-snapshot/experimental/index.d.ts | 4 ++-- types/generated-snapshot/experimental/index.ts | 4 ++-- types/generated-snapshot/latest/index.d.ts | 4 ++-- types/generated-snapshot/latest/index.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/types/defines/artifacts.d.ts b/types/defines/artifacts.d.ts index 089d673b9ee..9d6188ab77b 100644 --- a/types/defines/artifacts.d.ts +++ b/types/defines/artifacts.d.ts @@ -78,7 +78,7 @@ interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** Token state: "active", "expired", or "revoked". */ state: 'active' | 'expired' | 'revoked'; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 60026c340ce..d10e9635f26 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11799,7 +11799,7 @@ interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11808,7 +11808,7 @@ interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index f5f729d5c46..a79f2e0fed4 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11811,7 +11811,7 @@ export interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11820,7 +11820,7 @@ export interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index a20bcfd3235..58b8177a5d7 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11145,7 +11145,7 @@ interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11154,7 +11154,7 @@ interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index cb90d1b81fa..d4966542719 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11157,7 +11157,7 @@ export interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11166,7 +11166,7 @@ export interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: string; + scope: 'read' | 'write'; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ From 0996d4f1c161a85e1818c0c2dfc2e6fea1c59f49 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 16 Apr 2026 15:23:13 +0100 Subject: [PATCH 14/14] update generated types --- types/generated-snapshot/experimental/index.d.ts | 7 +++++-- types/generated-snapshot/experimental/index.ts | 7 +++++-- types/generated-snapshot/latest/index.d.ts | 7 +++++-- types/generated-snapshot/latest/index.ts | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index d10e9635f26..f3a827dfe15 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11737,6 +11737,9 @@ declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 /** * Artifacts — Git-compatible file storage on Cloudflare Workers. * @@ -11799,7 +11802,7 @@ interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11808,7 +11811,7 @@ interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index a79f2e0fed4..7dc303c8383 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11749,6 +11749,9 @@ export declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 /** * Artifacts — Git-compatible file storage on Cloudflare Workers. * @@ -11811,7 +11814,7 @@ export interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11820,7 +11823,7 @@ export interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/latest/index.d.ts b/types/generated-snapshot/latest/index.d.ts index 58b8177a5d7..52970e2b00b 100755 --- a/types/generated-snapshot/latest/index.d.ts +++ b/types/generated-snapshot/latest/index.d.ts @@ -11083,6 +11083,9 @@ declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 /** * Artifacts — Git-compatible file storage on Cloudflare Workers. * @@ -11145,7 +11148,7 @@ interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11154,7 +11157,7 @@ interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */ diff --git a/types/generated-snapshot/latest/index.ts b/types/generated-snapshot/latest/index.ts index d4966542719..2d6ee48093e 100755 --- a/types/generated-snapshot/latest/index.ts +++ b/types/generated-snapshot/latest/index.ts @@ -11095,6 +11095,9 @@ export declare abstract class AiGateway { ): Promise; getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line } +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 /** * Artifacts — Git-compatible file storage on Cloudflare Workers. * @@ -11157,7 +11160,7 @@ export interface ArtifactsCreateTokenResult { /** Plaintext token (only returned at creation time). */ plaintext: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** ISO 8601 token expiry timestamp. */ expiresAt: string; } @@ -11166,7 +11169,7 @@ export interface ArtifactsTokenInfo { /** Unique token ID. */ id: string; /** Token scope: "read" or "write". */ - scope: 'read' | 'write'; + scope: "read" | "write"; /** Token state: "active", "expired", or "revoked". */ state: "active" | "expired" | "revoked"; /** ISO 8601 creation timestamp. */