Implement changes to worker types

This commit is contained in:
ProgrammerIn-wonderland
2026-05-29 20:50:58 -04:00
committed by GitHub
parent 5d14417afa
commit 732c44f620
2 changed files with 13 additions and 6 deletions
+4 -4
View File
@@ -13,18 +13,18 @@ import type { PuterContext } from './types/event.d.ts';
declare global {
/** The deployer's Puter context, authenticated with the worker's own credentials. */
const me: PuterContext;
/** Alias for {@link me}. */
/** @deprecated Alias for {@link me}. Will be removed at a future date. */
const my: PuterContext;
/** Alias for {@link me}. */
/** @deprecated Alias for {@link me}. Will be removed at a future date. */
const myself: PuterContext;
/** The router used to register HTTP route handlers. */
const router: Router;
/** The deployer's Puter auth token, provided as a Cloudflare secret binding. */
/** @deprecated The deployer's Puter auth token, provided as a Cloudflare secret binding. Will be removed at a future date. Use me.puter.authToken */
const puter_auth: string;
/** The Puter API endpoint, provided as a Cloudflare plaintext binding. Defaults to `https://api.puter.com`. */
/** @deprecated The Puter API endpoint, provided as a Cloudflare plaintext binding. Defaults to `https://api.puter.com`. Will be removed at a future date. use me.puter.APIOrigin */
const puter_endpoint: string;
}
+9 -2
View File
@@ -16,7 +16,7 @@ export interface PuterContext {
* methods infer it from the path literal so handlers get precisely-typed
* `params` automatically.
*/
export interface WorkerEvent<TParams extends Params = Params> {
export interface WorkerEvent<TParams extends Params = Params> extends Extendable{
request: Request;
params: TParams;
@@ -27,8 +27,15 @@ export interface WorkerEvent<TParams extends Params = Params> {
*/
user?: PuterContext;
/** Alias for {@link WorkerEvent.user}. */
/** @deprecated Alias for {@link WorkerEvent.user}. May be removed at a future date. */
requestor?: PuterContext;
/**
* The **`WorkerEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In puter workers, waitUntil() tells the worker that work is ongoing until the promise settles, and it shouldn't terminate the worker if it wants that work to complete.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(f: Promise<any>): void;
}
/**