diff options
| author | Fuwn <[email protected]> | 2026-04-18 09:34:05 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-04-18 09:34:05 +0000 |
| commit | 9452e64710cec25ed7b3cbade10a55b61472f5f7 (patch) | |
| tree | 5ac14542ef9bbfa51fb287d28819271ad4a85d21 | |
| parent | Revert "fix(api): drop unused redirect query param from oauth refresh" (diff) | |
| download | due.moe-9452e64710cec25ed7b3cbade10a55b61472f5f7.tar.xz due.moe-9452e64710cec25ed7b3cbade10a55b61472f5f7.zip | |
refactor(naming): replace banned ctx abbreviation with full names
CLAUDE.md prohibits abbreviations like ctx in identifiers. Rename the
Cloudflare Worker ExecutionContext parameter to executionContext in the
proxy worker (handleMangaChapterCounts, fetch, scheduled), and alias
Trigger.dev's destructured { ctx } to taskContext in the notifications
scheduled task. The external property name on Trigger.dev's params
object is library-defined and remains ctx on the wire.
Verified: proxy worker still boots under local wrangler dev and all
routes (OPTIONS, POST /manga/chapter-counts, forwardProxyRequest) still
respond identically.
| -rw-r--r-- | apps/proxy/src/index.js | 12 | ||||
| -rw-r--r-- | src/trigger/notifications.ts | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apps/proxy/src/index.js b/apps/proxy/src/index.js index fa2503b5..e6ed8690 100644 --- a/apps/proxy/src/index.js +++ b/apps/proxy/src/index.js @@ -242,7 +242,7 @@ const recommendedVolumeText = (volumeChapterBoundaries, progress) => { return recommended; }; -const handleMangaChapterCounts = async (request, env, ctx) => { +const handleMangaChapterCounts = async (request, env, executionContext) => { if (!hasSupabaseConfig(env)) return jsonResponse( request, @@ -300,7 +300,7 @@ const handleMangaChapterCounts = async (request, env, ctx) => { ); if (queueableRows.length) - ctx.waitUntil( + executionContext.waitUntil( Promise.all(queueBootstrap(env, queueableRows)).catch((error) => { if (!isMangadexIdConstraintConflict(error)) throw error; }), @@ -375,14 +375,14 @@ const handleMangaSync = async (request, env) => { }; export default { - async fetch(request, env, ctx) { + async fetch(request, env, executionContext) { try { const url = new URL(request.url); if (request.method === "OPTIONS") return handleOptions(request); if (url.pathname === "/manga/chapter-counts" && request.method === "POST") - return handleMangaChapterCounts(request, env, ctx); + return handleMangaChapterCounts(request, env, executionContext); if ( url.pathname === "/manga/native-chapter-counts" && @@ -409,9 +409,9 @@ export default { } }, - async scheduled(_controller, env, ctx) { + async scheduled(_controller, env, executionContext) { if (!hasSupabaseConfig(env)) return; - ctx.waitUntil(syncMangadexIndex(env)); + executionContext.waitUntil(syncMangadexIndex(env)); }, }; diff --git a/src/trigger/notifications.ts b/src/trigger/notifications.ts index 30a50a12..e36f913f 100644 --- a/src/trigger/notifications.ts +++ b/src/trigger/notifications.ts @@ -25,9 +25,9 @@ const subscriptionEndpoint = (subscription: unknown) => export const notificationsTask = schedules.task({ id: "notifications", - run: async (_payload, { ctx }) => { - const environment = ctx.environment.slug; - const triggerProjectReference = ctx.project.ref; + run: async (_payload, { ctx: taskContext }) => { + const environment = taskContext.environment.slug; + const triggerProjectReference = taskContext.project.ref; const supabase = createClient( ( await envvars.retrieve( |