Skip to content

feat(types): Add new Cloudflare Stream binding functions - #8503

Merged
dario-piotrowicz merged 3 commits into
cloudflare:mainfrom
natewong1313:nwong/ADHOC-stream-binding-surface-updates
Nov 20, 2026
Merged

dario-piotrowicz merged 3 commits into
cloudflare:mainfrom
natewong1313:nwong/ADHOC-stream-binding-surface-updates

Conversation

@natewong1313

@natewong1313 natewong1313 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

the Stream team is adding more functionality to our binding, this updates our type definitions accordingly. we added the following

  • env.STREAM.clip(videoId, {startTimeSeconds: 0, endTimeSeconds: 10})
  • await env.STREAM.video(videoId).captions.get('en')
  • env.STREAM.generateToken(opts)

@natewong1313 natewong1313 changed the title Add new Cloudflare Stream binding surface updates feat(types): Add new Cloudflare Stream binding functions Nov 17, 2026
@natewong1313
natewong1313 marked this pull request as ready for review November 18, 2026 17:46
@natewong1313
natewong1313 requested a review from a team as a code owner November 18, 2026 17:46
@clanky-the-clanker

clanky-the-clanker Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

This pull request's reviews are posted as pull request reviews: see the review of 40053a8c.

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the PR @natewong1313 😄

This PR is missing the generated type files, could you please run just generate-types and also commit the files that get generated in generated-snapshot/? 🙏

@dario-piotrowicz

Copy link
Copy Markdown
Member

@clanky-the-clanker review

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Out of date: this review is of 40053a8c; the pull request is now at 9a03f38f. Someone with write access can comment clanky review (or clanker review or @clanky-the-clanker review) to review the new commits.

💬 Approved with comments — The type additions look sound. One WARNING: the generated snapshots under types/generated-snapshot/ were not regenerated. One QUESTION: the description puts generateToken on the binding, but the typings put it on the per-video handle.

Findings: 1 warning · 1 question (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #8503.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The generated type snapshots under `types/generated-snapshot/` were not regenerated, so they still lack `clip`, `captions.get`, `StreamClipParams` and the token option types.
- **File:** types/defines/stream.d.ts:67

## QUESTIONS (1)

### [Code Quality] The description lists `env.STREAM.generateToken(opts)` as a binding-level function, but the diff only adds an optional `options` argument to the per-video `StreamVideoHandle.generateToken`. Which shape does the runtime binding expose?
- **File:** types/defines/stream.d.ts:112

📋 Code Quality: ⚠️ 1 warning · 1 question

The generated type snapshots were not regenerated, and the description's binding-level generateToken doesn't match the per-video method the typings add.

Recommendation: 📝 Minor Comments

  • [WARNING] The generated type snapshots under types/generated-snapshot/ were not regenerated, so they still lack clip, captions.get, StreamClipParams and the token option types. (types/defines/stream.d.ts:67)
  • [QUESTION] The description lists env.STREAM.generateToken(opts) as a binding-level function, but the diff only adds an optional options argument to the per-video StreamVideoHandle.generateToken. Which shape does the runtime binding expose? (types/defines/stream.d.ts:112)
View full review
  • Generated snapshots not committed. types/generated-snapshot/index.d.ts (around line 16502 for StreamBinding and line 16840 for StreamScopedCaptions), index.ts and the experimental/ copies still have the old Stream surface. Run just generate-types and commit the result, as requested on the pull request.
  • generateToken placement. The description says env.STREAM.generateToken(opts), but the diff only adds an optional options parameter to StreamVideoHandle.generateToken (types/defines/stream.d.ts:112). StreamBinding gets no generateToken. Please confirm which shape the runtime exposes.

✅ All other checks passed

🔒 Security: ✅ LGTM

The changes are type declarations only.


📖 AGENTS.md: ✅ LGTM

The new top-level types use the Stream prefix, and no bare object types were added.


⚡ Performance: ✅ LGTM

The changes are type declarations only, with no runtime impact.


📝 Documentation: ✅ LGTM

The new JSDoc comments are clear and describe the error cases.


Reviewed commit: 40053a8c

Comment thread types/defines/stream.d.ts Resolved
@natewong1313
natewong1313 force-pushed the nwong/ADHOC-stream-binding-surface-updates branch from 40053a8 to 9d7baf5 Compare November 19, 2026 18:35
@natewong1313
natewong1313 requested review from a team as code owners November 19, 2026 18:35
@dario-piotrowicz
dario-piotrowicz merged commit c81a45d into cloudflare:main Nov 20, 2026
30 of 33 checks passed
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.

3 participants