From 08606715ac674e6653500d247a2ffd8c99610f35 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 06:48:22 +0000 Subject: [PATCH] chore(deps-major): migrate typescript to 6.0.3 2026-06-29 * Bump `typescript` to 6.0.3, `zod` to ^4, and `@types/node` to latest. * Fix Zod 4 type errors (`z.record(z.any())` to `z.record(z.string(), z.any())`). * Fix strict TypeScript 6 overlap validation (`env as unknown as DynamicEnv`). * Remove obsolete `@ts-expect-error` in AI prompt code. * Match explicit `Cloudflare.Env` enum type string union for `RESEND_DOMAIN_KEYS` in the `Env` wrapper. * Suppress `baseUrl` warning in `tsconfig.cloudflare.json`. Co-authored-by: ericmaster <389548+ericmaster@users.noreply.github.com> --- package-lock.json | 104 ++++++++++++++++++++++---------------- package.json | 13 +++-- tsconfig.cloudflare.json | 1 + workers/index.ts | 2 +- workers/lib/ai.ts | 2 +- workers/lib/resendKeys.ts | 6 +-- workers/types.ts | 2 +- 7 files changed, 76 insertions(+), 54 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4064b219..d213d862 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "react-router": "^7.18.0", "remark-gfm": "^4.0.1", "workers-ai-provider": "^3.2.0", - "zod": "^3.25.76", + "zod": "^4.4.3", "zustand": "^5.0.14" }, "devDependencies": { @@ -44,11 +44,11 @@ "@react-router/dev": "^7.18.0", "@tailwindcss/vite": "^4.3.1", "@types/dompurify": "^3.0.5", - "@types/node": "^20.19.37", + "@types/node": "^26.0.1", "@types/react": "^19.2.17", "@types/react-dom": "^19.1.2", "tailwindcss": "^4.3.1", - "typescript": "^5.8.3", + "typescript": "^6.0.3", "vite": "^6.3.3", "vite-tsconfig-paths": "^5.1.4", "wrangler": "^4.101.0" @@ -858,7 +858,6 @@ "version": "4.20260617.1", "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20260617.1.tgz", "integrity": "sha512-HdbP3CNcdMZBwegitFDjWvzv+6wPkFXvV9gBXMnf6RjV2Cy3W8TJL3IhSEGul0S6F1DHjnucP7lrpIsvkzNEjA==", - "dev": true, "license": "MIT OR Apache-2.0" }, "node_modules/@cspotcode/source-map-support": { @@ -3492,20 +3491,19 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.19.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz", - "integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==", + "version": "26.0.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.0.1.tgz", + "integrity": "sha512-fc3KiUoBt6kie0N9bIW3E47vZsuaMf0PM2AaUpLCLT0s/LvX1nxAim6Fc049cNxODPpGm6qRAuUOB86SkRuPQw==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.21.0" + "undici-types": "~8.3.0" } }, "node_modules/@types/react": { "version": "19.2.17", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz", "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", - "dev": true, "license": "MIT", "dependencies": { "csstype": "^3.2.2" @@ -3515,7 +3513,6 @@ "version": "19.2.3", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^19.2.0" @@ -4142,7 +4139,6 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true, "license": "MIT" }, "node_modules/date-fns": { @@ -4395,6 +4391,17 @@ "node": ">= 0.4" } }, + "node_modules/echarts": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-6.1.0.tgz", + "integrity": "sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "2.3.0", + "zrender": "6.1.0" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -7945,34 +7952,11 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "dev": true, - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==", - "dev": true, - "license": "0BSD", - "optional": true + "license": "0BSD" }, "node_modules/type-is": { "version": "2.0.1", @@ -8014,9 +7998,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -8038,9 +8022,9 @@ } }, "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", "dev": true, "license": "MIT" }, @@ -8374,6 +8358,28 @@ } } }, + "node_modules/vite-tsconfig-paths/node_modules/tsconfck": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", + "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", + "deprecated": "unmaintained", + "dev": true, + "license": "MIT", + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/w3c-keyname": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", @@ -9073,9 +9079,9 @@ } }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" @@ -9090,6 +9096,16 @@ "zod": "^3.25 || ^4" } }, + "node_modules/zrender": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-6.1.0.tgz", + "integrity": "sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ==", + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "tslib": "2.3.0" + } + }, "node_modules/zustand": { "version": "5.0.14", "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.14.tgz", diff --git a/package.json b/package.json index 1f53c3cc..016b8163 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,12 @@ "type": "module", "cloudflare": { "label": "Agentic Inbox", - "products": ["Workers", "Durable Objects", "R2", "Workers AI"], + "products": [ + "Workers", + "Durable Objects", + "R2", + "Workers AI" + ], "bindings": { "DOMAINS": { "description": "Your domain with [Email Routing](https://developers.cloudflare.com/email-routing/) enabled (e.g. `example.com`). For multiple domains, pass a comma-separated list (e.g. `example.com,another.com`). After deploying, create a catch-all Email Routing rule pointing to this Worker for each domain." @@ -50,7 +55,7 @@ "react-router": "^7.18.0", "remark-gfm": "^4.0.1", "workers-ai-provider": "^3.2.0", - "zod": "^3.25.76", + "zod": "^4.4.3", "zustand": "^5.0.14" }, "overrides": { @@ -88,11 +93,11 @@ "@react-router/dev": "^7.18.0", "@tailwindcss/vite": "^4.3.1", "@types/dompurify": "^3.0.5", - "@types/node": "^20.19.37", + "@types/node": "^26.0.1", "@types/react": "^19.2.17", "@types/react-dom": "^19.1.2", "tailwindcss": "^4.3.1", - "typescript": "^5.8.3", + "typescript": "^6.0.3", "vite": "^6.3.3", "vite-tsconfig-paths": "^5.1.4", "wrangler": "^4.101.0" diff --git a/tsconfig.cloudflare.json b/tsconfig.cloudflare.json index cd936409..6ac552db 100644 --- a/tsconfig.cloudflare.json +++ b/tsconfig.cloudflare.json @@ -21,6 +21,7 @@ "module": "ES2022", "moduleResolution": "bundler", "jsx": "react-jsx", + "ignoreDeprecations": "6.0", "baseUrl": ".", "rootDirs": [".", "./.react-router/types"], "paths": { diff --git a/workers/index.ts b/workers/index.ts index fdd9d1ee..4270910b 100644 --- a/workers/index.ts +++ b/workers/index.ts @@ -29,7 +29,7 @@ type AppContext = Context; const CreateMailboxBody = z.object({ email: z.string().email(), name: z.string().min(1), - settings: z.record(z.any()).optional(), // unvalidated — agentSystemPrompt goes straight to AI + settings: z.record(z.string(), z.any()).optional(), // unvalidated — agentSystemPrompt goes straight to AI }); const DraftBody = z.object({ diff --git a/workers/lib/ai.ts b/workers/lib/ai.ts index 78ac4ddd..908236f8 100644 --- a/workers/lib/ai.ts +++ b/workers/lib/ai.ts @@ -29,7 +29,7 @@ export async function isPromptInjection(ai: Ai, bodyHtml: string | null | undefi try { const response = (await ai.run( - // @ts-expect-error — model string not in generated union + "@cf/meta/llama-3.1-8b-instruct-fast", { messages: [ diff --git a/workers/lib/resendKeys.ts b/workers/lib/resendKeys.ts index eef955da..2dd2ef0f 100644 --- a/workers/lib/resendKeys.ts +++ b/workers/lib/resendKeys.ts @@ -50,7 +50,7 @@ export function domainFromAddress( /** Parse `RESEND_DOMAIN_KEYS` into a domain→prefix map. Malformed/empty → {}. */ export function parseResendDomainKeys(env: Env): Record { - const raw = (env as DynamicEnv).RESEND_DOMAIN_KEYS; + const raw = (env as unknown as DynamicEnv).RESEND_DOMAIN_KEYS; if (!raw) return {}; try { const parsed = JSON.parse(raw) as unknown; @@ -78,7 +78,7 @@ export function resolveResendApiKey( const domain = domainFromAddress(from); const prefix = parseResendDomainKeys(env)[domain]; if (prefix) { - const key = (env as DynamicEnv)[`${prefix}_API_KEY`]; + const key = (env as unknown as DynamicEnv)[`${prefix}_API_KEY`]; if (key) return key; console.error( `RESEND_DOMAIN_KEYS maps ${domain} → ${prefix} but ${prefix}_API_KEY is unset; falling back to RESEND_API_KEY`, @@ -97,7 +97,7 @@ export function resendWebhookSecrets(env: Env): string[] { const secrets: string[] = []; if (env.RESEND_WEBHOOK_SECRET) secrets.push(env.RESEND_WEBHOOK_SECRET); for (const prefix of Object.values(parseResendDomainKeys(env))) { - const s = (env as DynamicEnv)[`${prefix}_WEBHOOK_SECRET`]; + const s = (env as unknown as DynamicEnv)[`${prefix}_WEBHOOK_SECRET`]; if (s) secrets.push(s); } return secrets; diff --git a/workers/types.ts b/workers/types.ts index e706e530..4c9fea67 100644 --- a/workers/types.ts +++ b/workers/types.ts @@ -24,7 +24,7 @@ export interface Env extends Cloudflare.Env { // verification) — both Worker secrets. Unmapped domains use RESEND_API_KEY / // RESEND_WEBHOOK_SECRET. The dynamically-named secrets are not declared here; // see lib/resendKeys.ts. Leave unset for a single shared Resend account. - RESEND_DOMAIN_KEYS?: string; + RESEND_DOMAIN_KEYS: Cloudflare.Env["RESEND_DOMAIN_KEYS"]; // NOTE: the `DELIVERY_MAP` KV binding (Resend `re_…` id → {mailboxId, // emailId, threadId}) is declared in wrangler.jsonc and therefore generated // into Cloudflare.Env by `wrangler types` — do not redeclare it here.