Saxonberg Server API
    Preparing search index...

    Class ZoneApi

    Index

    Constructors

    Methods

    • Nearest Zone-class template ancestor of zone, or null at universe-root (or when zone has no templatePath, e.g., a fixture built via makeStuff without a path stamp). Skips non-Zone path segments. Lazy-clones the ancestor via StuffApi.singleton (cache-or-clone; subsequent calls are O(1)).

      The orchestration step Zone.lookupAncestorField (the polymorphic field-inheritance hook in lib/zone/Zone.ts) delegates to this helper. Lives here, not on Zone, because the walk is pure plumbing — no override seam needed, no Stuff subclass should reshape it.

      Parameters

      Returns Promise<Zone | null>

    • Does the class at classPath extend Zone? Folder classes (the folder/leaf invariant's "may have descendants" set) are exactly the Zone subclasses; this predicate is what Template.findByPath and TemplateApi.validateFolderLeaf* consult.

      Result is cached per classPath. Returns false when the class fails to import or has no prototype chain (e.g. a typoed path) — the caller's path validation surfaces those errors separately.

      Parameters

      • classPath: string

      Returns Promise<boolean>

    • Does the class at classPath extend SpatialZone? The strict subset of folder classes that stamp Stuff.zone. Non-spatial Zones (Clade) return false here even though isFolderClass returns true for them.

      Parameters

      • classPath: string

      Returns Promise<boolean>

    • Resolve the nearest spatial zone for a template path.

      Walks ancestor paths from nearest to root; returns the singleton SpatialZone at the first ancestor whose template's class extends SpatialZone. Non-spatial zone ancestors (Clades, future permission/rule scopes) are skipped — they're folders for the template-tree invariant, but not the spatial zone for the descendant.

      Returns null when:

      • The template at templatePath is itself a spatial Zone (a zone isn't inside itself).
      • No ancestor resolves to a spatial Zone template.

      Calls StuffApi.singleton(ancestor) so the second resolution for the same zone path is an O(1) cache hit; first resolution clones.

      Parameters

      • templatePath: string

        e.g. /narnia/castle/foyer

      Returns Promise<SpatialZone | null>