Stone.js API
    Preparing search index...

    Web-standard (WinterCG Fetch) adapter for Stone.js.

    Unlike a server adapter, run() does not start a listener — it returns a Fetch handler (request, executionContext?) => Promise<Response>, exactly what every WinterCG runtime expects. Wire it once and deploy the same build to Cloudflare Workers, Deno, Bun, Vercel Edge or Netlify Edge.

    const handle = await FetchAdapter.create(blueprint).run<FetchEventHandlerFunction>()
    export default { fetch: handle } // Cloudflare / Deno / Bun / Edge

    Hierarchy

    • Adapter<
          Request,
          Response,
          FetchExecutionContext,
          IncomingHttpEvent,
          IncomingHttpEventOptions,
          OutgoingHttpResponse,
          FetchAdapterContext,
      >
      • FetchAdapter
    Index
    • Create an Adapter.

      Parameters

      • blueprint: IBlueprint

        The blueprint to create the adapter.

      Returns FetchAdapter

    blueprint: IBlueprint
    hooks: AdapterHookType<FetchAdapterContext, Response>
    middleware: AdapterMixedPipeType<FetchAdapterContext, Response>[]
    resolvedErrorHandlers: Record<
        string,
        IAdapterErrorHandler<RawEventType, RawResponseType, ExecutionContextType>,
    >
    • Build the raw response.

      Parameters

      • context: FetchAdapterContext

        The event context.

      • OptionaleventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<Response>

      The raw response wrapper.

    • Handle a single Web Request, producing a Web Response.

      Parameters

      • rawEvent: Request

        The incoming request.

      • executionContext: FetchExecutionContext

        The runtime-provided context (e.g. Cloudflare env/ctx).

      Returns Promise<Response>

      The response.

    • Execute the event handler lifecycle hooks.

      Parameters

      • hook: KernelHookName

        The hook to execute.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<void>

    • Execute adapter lifecycle hooks.

      Parameters

      • name: AdapterHookName

        The hook's name.

      • Optionalcontext: FetchAdapterContext

        The event context.

      • Optionalerror: any

        The error to handle.

      Returns Promise<void>

    • Handle error.

      Parameters

      Returns Promise<AdapterEventBuilderType<Response>>

      The raw response.

    • Handle the event.

      Parameters

      • context: FetchAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<IAdapterEventBuilder<RawResponseOptions, IRawResponseWrapper<Response>>>

      The raw response wrapper.

    • Create pipeline options for the Adapter.

      Returns PipelineOptions<FetchAdapterContext, AdapterEventBuilderType<Response>>

      The pipeline options for transforming the event.

    • Lifecycle hook run once before the first request.

      Returns Promise<void>

    • Get the error handler for the given error.

      Parameters

      • error: Error

        The error to get the handler for.

      Returns IAdapterErrorHandler<Request, Response, FetchExecutionContext>

      The error handler.

      IntegrationError

    • Get the event handler for the adapter.

      Returns AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

      The event handler for the adapter.

      If the event handler is missing.

    • Send the raw event through the destination.

      Parameters

      • context: FetchAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<Response>

      Platform-specific response.

      IntegrationError

    • Validate the context and event handler.

      Parameters

      • context: FetchAdapterContext

        The context to validate.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to validate.

      Returns void

      IntegrationError

    • Parameters

      • blueprint: IBlueprint

        The application blueprint.

      Returns FetchAdapter

      A new adapter instance.