chore(api): refactor container name to AppContainer#1995
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the API’s Cloudflare Container/Durable Object class and binding naming from TikTokContainer/TIKTOK_CONTAINER to AppContainer/APP_CONTAINER, updating the Worker export surface and runtime env validation accordingly.
Changes:
- Renamed the container class export to
AppContainerand updated imports/exports accordingly. - Renamed the Durable Object binding key to
APP_CONTAINERand updated runtime env validation + TikTok generation route usage. - Updated
wrangler.jsonccontainer/DO configuration to useAppContainer(but also modified the migrations list).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/api/wrangler.jsonc | Renames container + DO binding and adjusts migrations configuration. |
| packages/api/test/generate-from-tiktok.test.ts | Updates test comment referencing the container class name. |
| packages/api/src/utils/env-validation.ts | Renames validated binding from TIKTOK_CONTAINER to APP_CONTAINER and updates types/merging. |
| packages/api/src/routes/packTemplates/generateFromTikTok.ts | Uses APP_CONTAINER binding when calling getContainer. |
| packages/api/src/index.ts | Re-exports the renamed container class for Wrangler binding. |
| packages/api/src/containers/index.ts | Updates barrel export to AppContainer. |
| packages/api/src/containers/AppContainer.ts | Renames the container class to AppContainer. |
|
|
||
| // Get the container instance using the binding | ||
| const container = getContainer(TIKTOK_CONTAINER as any); | ||
| const container = getContainer(APP_CONTAINER as any); |
There was a problem hiding this comment.
Avoid casting APP_CONTAINER to any when calling getContainer. APP_CONTAINER is already typed in ValidatedEnv, so prefer passing it directly or casting to the specific expected container binding type (via unknown if needed) to preserve type safety.
| const container = getContainer(APP_CONTAINER as any); | |
| const container = getContainer(APP_CONTAINER); |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.