Skip to main content

Class: FetchExecutorEntrypoint

Defined in: fetch/src/fetch-executor-entrypoint.ts:32

Extends

  • LumenizeWorker

Constructors

Constructor

new FetchExecutorEntrypoint(ctx, env): FetchExecutorEntrypoint

Defined in: fetch/test/worker-configuration.d.ts:7768

Parameters

ctx

ExecutionContext

env

any

Returns

FetchExecutorEntrypoint

Inherited from

LumenizeWorker.constructor

Properties

__WORKER_ENTRYPOINT_BRAND

__WORKER_ENTRYPOINT_BRAND: never

Defined in: fetch/test/worker-configuration.d.ts:7765

Inherited from

LumenizeWorker.__WORKER_ENTRYPOINT_BRAND


ctx

protected ctx: ExecutionContext<{ }>

Defined in: fetch/test/worker-configuration.d.ts:7766

Inherited from

LumenizeWorker.ctx


env

protected env: any

Defined in: fetch/test/worker-configuration.d.ts:7767

Inherited from

LumenizeWorker.env

Accessors

lmz

Get Signature

get lmz(): LmzApi

Defined in: mesh/src/lumenize-worker.ts:63

Access Lumenize infrastructure: identity and RPC methods

Provides clean abstraction over identity management and RPC infrastructure:

  • Identity: bindingName, type (instanceName/id always undefined for Workers)
  • RPC: callRaw(), call()

Properties use closure storage (no persistence across requests). Identity is set automatically from envelope metadata when receiving mesh calls.

See

Usage Examples - Complete tested examples

Returns

LmzApi

Inherited from

LumenizeWorker.lmz

Methods

ctn()

ctn<T>(): Continuation<T>

Defined in: mesh/src/lumenize-worker.ts:97

Create a continuation for method chaining

Continuations enable building method chains that can be:

  • Executed remotely via RPC
  • Passed as parameters to other methods
  • Used with nested operation markers for result substitution

Usage:

  • Remote calls: this.ctn<RemoteDO>().method(args)
  • Local handlers: this.ctn().handleResult(remoteResult)
  • Nesting: Use remote continuation as handler parameter

Type Parameters

T

T = FetchExecutorEntrypoint

Returns

Continuation<T>

Example

// Remote continuation
const remote = this.ctn<UserDO>().getUserData(userId);

// Handler continuation with nested marker
const handler = this.ctn().processData(remote);

// Make call
await this.lmz.call('USER_DO', userId, remote, handler);

See

Usage Examples - Complete tested examples

Inherited from

LumenizeWorker.ctn


executeFetch()

executeFetch(message): Promise<void>

Defined in: fetch/src/fetch-executor-entrypoint.ts:49

Execute an external fetch request

Called by origin DO directly via RPC. Returns immediately, then executes fetch in background. Calls back to origin DO's svc.fetch.__handleProxyFetchResult() via OCAN.

Flow:

  1. Quick RPC acknowledgment (microseconds)
  2. Origin DO continues (alarm is scheduled)
  3. Fetch executes in background (CPU billing)
  4. Result delivered to origin DO's internal handler method
  5. Origin DO cancels alarm atomically to get continuation

Parameters

message

FetchMessage

Fetch message with preprocessed continuation

Returns

Promise<void>


fetch()?

optional fetch(request): Response | Promise<Response>

Defined in: fetch/test/worker-configuration.d.ts:7769

Parameters

request

Request

Returns

Response | Promise<Response>

Inherited from

LumenizeWorker.fetch


onBeforeCall()

onBeforeCall(): void

Defined in: mesh/src/lumenize-worker.ts:132

Lifecycle hook called before each incoming mesh call is executed

Override this method to:

  • Validate authentication/authorization based on this.lmz.callContext
  • Populate callContext.state with computed data
  • Add logging or tracing metadata
  • Reject unauthorized calls by throwing an error

This hook is called BEFORE the operation chain is executed. The callContext is available via this.lmz.callContext.

Important: If you override this, remember to call super.onBeforeCall() to ensure any parent class logic is also executed.

Returns

void

Example

class AuthWorker extends LumenizeWorker<Env> {
onBeforeCall(): void {
super.onBeforeCall();

const { originAuth, callChain } = this.lmz.callContext;

// Only allow internal mesh calls (no client origin)
if (callChain[0].type === 'LumenizeClient') {
throw new Error('Direct client access not allowed');
}
}
}

Inherited from

LumenizeWorker.onBeforeCall


queue()?

optional queue(batch): void | Promise<void>

Defined in: fetch/test/worker-configuration.d.ts:7773

Parameters

batch

MessageBatch<unknown>

Returns

void | Promise<void>

Inherited from

LumenizeWorker.queue


scheduled()?

optional scheduled(controller): void | Promise<void>

Defined in: fetch/test/worker-configuration.d.ts:7772

Parameters

controller

ScheduledController

Returns

void | Promise<void>

Inherited from

LumenizeWorker.scheduled


tail()?

optional tail(events): void | Promise<void>

Defined in: fetch/test/worker-configuration.d.ts:7770

Parameters

events

TraceItem[]

Returns

void | Promise<void>

Inherited from

LumenizeWorker.tail


test()?

optional test(controller): void | Promise<void>

Defined in: fetch/test/worker-configuration.d.ts:7774

Parameters

controller

TestController

Returns

void | Promise<void>

Inherited from

LumenizeWorker.test


trace()?

optional trace(traces): void | Promise<void>

Defined in: fetch/test/worker-configuration.d.ts:7771

Parameters

traces

TraceItem[]

Returns

void | Promise<void>

Inherited from

LumenizeWorker.trace