Skip to content

feat: add Artifacts binding TypeScript definitions#6508

Merged
dario-piotrowicz merged 16 commits intocloudflare:mainfrom
mattzcarey:feat/artifacts-binding-types
Apr 17, 2026
Merged

feat: add Artifacts binding TypeScript definitions#6508
dario-piotrowicz merged 16 commits intocloudflare:mainfrom
mattzcarey:feat/artifacts-binding-types

Conversation

@mattzcarey
Copy link
Copy Markdown
Contributor

@mattzcarey mattzcarey commented Apr 7, 2026

Summary

Add TypeScript type definitions for the Artifacts binding

Changes

New file: types/defines/artifacts.d.ts

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mattzcarey
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 7, 2026
@mattzcarey mattzcarey force-pushed the feat/artifacts-binding-types branch 8 times, most recently from 7071b12 to 23898be Compare April 8, 2026 16:49
@penalosa penalosa force-pushed the feat/artifacts-binding-types branch from 23898be to 00d8b17 Compare April 8, 2026 16:57
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 8, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing mattzcarey:feat/artifacts-binding-types (139ff03) with main (16ead14)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@mattzcarey mattzcarey force-pushed the feat/artifacts-binding-types branch 4 times, most recently from b763d83 to daeaa28 Compare April 15, 2026 10:56
@mattzcarey mattzcarey marked this pull request as ready for review April 15, 2026 11:22
@mattzcarey mattzcarey requested a review from a team as a code owner April 15, 2026 11:22
@mattzcarey mattzcarey requested a review from emily-shen April 15, 2026 11:22
@mattzcarey mattzcarey force-pushed the feat/artifacts-binding-types branch from 5eb297f to 56e4a11 Compare April 15, 2026 11:56
@mattzcarey mattzcarey requested review from a team as code owners April 15, 2026 11:56
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.86%. Comparing base (16ead14) to head (139ff03).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6508   +/-   ##
=======================================
  Coverage   70.86%   70.86%           
=======================================
  Files         438      438           
  Lines      123696   123696           
  Branches    19467    19467           
=======================================
  Hits        87660    87660           
  Misses      24510    24510           
  Partials    11526    11526           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mattzcarey mattzcarey force-pushed the feat/artifacts-binding-types branch 2 times, most recently from d0d1645 to 2b42cb6 Compare April 15, 2026 17:47
@danlapid
Copy link
Copy Markdown
Collaborator

/bonk review this pr

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

The type definitions are well-documented with solid JSDoc comments, and the naming conventions (Artifacts* prefix) follow the codebase standard. There are several issues to address before this can merge:

  • generated-snapshot/ files should not be manually edited — they must be produced by just generate-types. The hand-edited snapshots will diverge from the pipeline output and CI will likely reject them.
  • ArtifactsRepo duplicates all fields from ArtifactsRepoInfo instead of extending it — this creates a maintenance burden.
  • scope field in ArtifactsCreateTokenResult should use a string literal union to match ArtifactsTokenInfo.scope and createToken()'s parameter type.
  • get() return type should be Promise<ArtifactsRepo | null> since the JSDoc says it returns null when not found.
  • import() target.opts nesting is unnecessarily deep — consider flattening.
  • Missing type tests — other bindings (D1, AI, RPC, etc.) have type tests in types/test/types/.

This review was generated by an AI assistant and may contain inaccuracies. Please verify all suggestions before applying.

Comment thread types/generated-snapshot/experimental/index.d.ts
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts Outdated
Comment thread types/defines/artifacts.d.ts
Comment thread types/defines/artifacts.d.ts
Comment thread types/defines/artifacts.d.ts
Comment thread types/defines/artifacts.d.ts
Comment thread types/defines/artifacts.d.ts
mattzcarey and others added 10 commits April 16, 2026 15:12
Add Artifacts binding types to the generated snapshot files
(index.d.ts and index.ts) to match bazel-generated output.
- 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
- 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
ArtifactsGetRepoResult is now:
  | { status: 'ready'; repo: ArtifactsRepo }
  | { status: 'not_found' }
  | { status: 'importing'; retryAfter: number }
  | { status: 'forking'; retryAfter: number }
- 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
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
@dario-piotrowicz dario-piotrowicz force-pushed the feat/artifacts-binding-types branch from 6ae35d7 to fca1d4c Compare April 16, 2026 14:14
@dario-piotrowicz dario-piotrowicz merged commit ce15db6 into cloudflare:main Apr 17, 2026
38 of 39 checks passed
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
mattzcarey added a commit to cloudflare/cloudflare-docs that referenced this pull request Apr 17, 2026
- create() returns ArtifactsCreateRepoResult (not & { repo })
- get() returns ArtifactsRepo (throws on not found, no null)
- Remove info() — repo metadata is on the handle directly
  (ArtifactsRepo extends ArtifactsRepoInfo)
- Remove validateToken() — not in workerd types or binding
- Add import() — was missing from docs entirely
- Fix expiresAt → tokenExpiresAt in get-started example
- Add namespace note (any name works, not just 'default')
- Remove null checks on get() — it throws, not returns null

Aligned with: cloudflare/workerd#6508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants