Repository navigation
feat(types): Add new Cloudflare Stream binding functions - #8503
dario-piotrowicz merged 3 commits into
Conversation
|
This pull request's reviews are posted as pull request reviews: see the review of |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
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/? 🙏
|
@clanky-the-clanker review |
There was a problem hiding this comment.
⚠️ Out of date: this review is of40053a8c; the pull request is now at9a03f38f. Someone with write access can commentclanky review(orclanker reviewor@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 lackclip,captions.get,StreamClipParamsand 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 optionaloptionsargument to the per-videoStreamVideoHandle.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 forStreamBindingand line 16840 forStreamScopedCaptions),index.tsand theexperimental/copies still have the old Stream surface. Runjust generate-typesand commit the result, as requested on the pull request. generateTokenplacement. The description saysenv.STREAM.generateToken(opts), but the diff only adds an optionaloptionsparameter toStreamVideoHandle.generateToken(types/defines/stream.d.ts:112).StreamBindinggets nogenerateToken. 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
40053a8 to
9d7baf5
Compare
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)