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:12121

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:12118

Inherited from​

LumenizeWorker.__WORKER_ENTRYPOINT_BRAND


ctx​

protected ctx: ExecutionContext<{ }>

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

Inherited from​

LumenizeWorker.ctx


env​

protected env: any

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

Inherited from​

LumenizeWorker.env

Accessors​

lmz​

Get Signature​

get lmz(): LmzApi

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

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​

connect()?​

optional connect(socket): void | Promise<void>

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

Parameters​

socket​

Socket

Returns​

void | Promise<void>

Inherited from​

LumenizeWorker.connect


ctn()​

ctn<T>(): Continuation<T>

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

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


email()?​

optional email(message): void | Promise<void>

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

Parameters​

message​

ForwardableEmailMessage

Returns​

void | Promise<void>

Inherited from​

LumenizeWorker.email


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:12123

Parameters​

request​

Request

Returns​

Response | Promise<Response>

Inherited from​

LumenizeWorker.fetch


onBeforeCall()​

onBeforeCall(): void

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

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:12125

Parameters​

batch​

MessageBatch

Returns​

void | Promise<void>

Inherited from​

LumenizeWorker.queue


scheduled()?​

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

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

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:12127

Parameters​

events​

TraceItem[]

Returns​

void | Promise<void>

Inherited from​

LumenizeWorker.tail


tailStream()?​

optional tailStream(event): TailEventHandlerType | Promise<TailEventHandlerType>

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

Parameters​

event​

TailEvent<Onset>

Returns​

TailEventHandlerType | Promise<TailEventHandlerType>

Inherited from​

LumenizeWorker.tailStream


test()?​

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

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

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:12130

Parameters​

traces​

TraceItem[]

Returns​

void | Promise<void>

Inherited from​

LumenizeWorker.trace