From ef030c7943f1f048be47d0ad18b186880648c157 Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <3838shah@gmail.com> Date: Wed, 19 Aug 2026 14:13:46 -0400 Subject: [PATCH] add dynamic worker create event --- src/backend/clients/event/types.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/backend/clients/event/types.ts b/src/backend/clients/event/types.ts index 812b8472e..f76029418 100644 --- a/src/backend/clients/event/types.ts +++ b/src/backend/clients/event/types.ts @@ -338,6 +338,18 @@ export type EventMap = { // is pricing workers that came into existence, not deploys. 'worker.create': { actor: Actor; workerName: string }; + // The same announcement for worker code that lives inside a hosted site + // and is deployed on demand rather than by an explicit call. Such a worker + // has no row of ours to key on, so what stands in for "genuinely new" is + // the absence of any prior record that it ran — which is why it is + // announced separately, and identified by where its source lives rather + // than by a worker name. + 'worker.dynamic.create': { + actor: Actor; + subdomain: string; + worker: string; + }; + // ---- Outer / GUI broadcast ---- 'outer.cacheUpdate': { cacheKey: string[]; @@ -540,10 +552,11 @@ export type EventKey = keyof EventMap & string; // Generates a wildcard for every non-final dot-separated prefix of K. export type WildcardPrefixes = K extends `${infer Head}.${infer Tail}` - ? | `${Head}.*` - | (Tail extends `${string}.${string}` - ? `${Head}.${WildcardPrefixes}` - : never) + ? + | `${Head}.*` + | (Tail extends `${string}.${string}` + ? `${Head}.${WildcardPrefixes}` + : never) : never; export type ListenKey = EventKey | WildcardPrefixes;