Documentation
    Preparing search index...

    Function createResourceService

    • Create a NAP-RESOURCE reference service.

      Implements the NAP-RESOURCE request/response protocol: resource.info, resource.bytes, resource.bytesMany, resource.cancel, and their result/error envelopes.

      The runtime resolver is validated at construction. Runtime-bound approvals cover the exact resource URL and each resolver-reported HTTP(S) or WebSocket hop.

      Returns a ServiceHandler (no publishValues-style surface — resource has no shell-initiated push beyond the response/error path).

      Parameters

      Returns ResourceService

      ServiceHandler to register via runtime.registerService('resource', handler)

      import { createResourceService } from '@kehto/services';

      const svc = createResourceService({
      fetch: (url, init) => runtimeResources.resolve(url, init),
      });
      runtime.registerService('resource', svc);