Saxonberg Server API
    Preparing search index...

    Hierarchy

    • EventRegistryBase
      • default
    Index

    Constructors

    Properties

    savedPropMarshallers: Record<string, string> = {}

    Per-prop marshaller bindings. Maps prop name → marshaller templatePath. Persistent and arrives alongside savedProps during hydration. setProp / getProp consult this map to decide whether to invoke toStored / fromStored for a given value. Props without a binding here round-trip raw, the way scalar props always have.

    Auto-initialized to an empty object; populated by initProp(prop, { marshaller: '/path' }).

    savedProps?: Record<string, PropValue> = {}

    Persistent properties — STORED SHAPE. Host-internal storage; setProp applies marshaller.toStored before writing here when a marshaller is bound for the prop, and getProp applies marshaller.fromStored on read so external callers see the runtime type. The hydrator's bracket-assign deposits the raw record directly without per-key conversion — the marshaller binding lives on savedPropMarshallers and runs lazily at access time.

    stuffId: string

    Runtime ID for this object (generated using nanoid). This is NOT the MongoDB _id - it's a runtime identifier.

    transientProps: Record<string, PropValue> = {}

    Transient properties (memory only, lost on restart).

    _mixinName: string = 'PostRegistrationMixin'
    persistentFields: string[] = ...

    Persistent fields declared by this mixin. savedProps carries the raw stored shape of each persistent prop (Quantity round- trips as {value, unit}, etc.); savedPropMarshallers carries the per-prop binding from prop name to marshaller templatePath so loaded hosts know which marshaller to apply on read / write. The marshaller binding is persisted explicitly so it survives restarts without requiring the host class to re- declare the binding for every prop name.

    subscribableFields: SubscribableFieldDescriptor[] = ...

    Universal live-query subscribable fields — fields every Stuff exposes regardless of mixin composition. Currently just displayName, a derived render that delegates to Stuff.getPresentation (Named's name or Visible's shortDescription, falling through to the baked-in 'something').

    Declared here rather than in a substrate-private synthetic table because every Stuff genuinely owns the concept — there is no "what if this Stuff has no displayable identity?" case. The descriptor uses dependsOnFields to declare the leaf source fields it depends on (name, shortDescription); the substrate installs precise (FieldChangedEvent, 'field', dep) index entries automatically. Shadow lifecycle support rides on ShadowChangedEvent in changes (declared-but-unfired until the shadow subsystem wires it).

    Mixin layers above Stuff add their own subscribableFields for mixin-owned state; the substrate's prototype-chain walk hasOwnProperty-checks at every level and unions the descriptors.

    Future universal renders (pronoun, articleName, etc.) land here too. Mixin-gated renders go on the mixin that owns the gate.

    Accessors

    Methods

    • EventRegistry is a bootstrap-pinned system singleton — EventApi resolves it lazily via findByTemplatePath and assumes it stays live for the process lifetime. Refuse destruct unconditionally; forceDestruct (AdminOnly) is the escape hatch.

      Returns VetoResult

    • Check if property exists AND the caller is allowed to see it. Returns the prop's options when both are true, null otherwise.

      Single answer to "does this prop exist and can I read it?": the Get access op gates visibility, so a denied caller gets the same null as for a non-existent prop. Lets EventApi.on disambiguate "no such event / not allowed to subscribe" from "exists and emitted-but-no-payload-yet" without sentinels.

      Type Parameters

      Parameters

      Returns PropOptions<T> | null

    • Deny everything by default. Closes the bypass path where a caller obtains the registry instance and runs reg.setProp('forged.event', ...) directly: PropertiedMixin's setProp auto-initialises unknown props by calling initProp(prop) with no options, which falls back here. With deny-all defaults, the auto-init produces an inaccessible prop and the setProp returns false.

      The legitimate path is EventApi.emit/on, which calls initProp with a real EventApi.emittableBy() policy BEFORE setProp fires — so the auto-init never runs for EventApi-mediated traffic.

      Parameters

      Returns boolean

    • Destroy this object.

      Locked down by @CallSecurity(ApiOnly) — only callers under mud/api/ (in practice, StuffApi.destruct) may invoke it. @Unshadowable because the unregistration path must always run; a shadow that intercepts and skips it would leak the object into the registry forever. @Final because subclass overrides would defeat the same invariant — the loader hook throws FinalViolationError at import time on any subclass redefinition.

      Subclass cleanup belongs on the optional onDestruct() witness (consulted by StuffApi.destruct while the target is still live); refusal logic belongs on canDestruct(). This terminal destroy() is the unshadowable mark-and-unregister step only.

      Returns void

    • Read the recency timestamp. Read by the residency sweep — which calls it on the raw target (via RAW_TARGET) so the sweep's own introspection never counts as a touch.

      Returns number

    • Self-presentation — the casual-register render string for this object, the answer to "what does this Stuff call itself?" Three- step resolution:

      1. Named.name if present and non-empty — the object's proper name ("Alice", "Excalibur", "Town Square").
      2. Visible.shortDescription if present and non-empty — the object's visual identity ("a heavy oak door").
      3. The baked-in fallback (DEFAULT_PRESENTATION).

      For a Globbable stack (quantity !== 1) the count folds in as an affix — "30 coins" — pluralized via GrammarApi.pluralize (which honors host-side getPluralForm() overrides for irregulars). Named takes precedence over Visible so a Named-with-description renders by its proper name; code that needs the formal register calls getFullName() when typed as Named.

      Viewer-blind by design. This is the shared baseline every Stuff exposes; the viewer-aware naming step (recognition / identification — see docs/subsystems/belief.md) composes on top of it. Left shadowable (NOT @Final) so masking / disguise effects can override the rendered identity via a method shadow.

      Returns string

    • Build the composable Mml fragment for this object's display name — the Mml sibling of getPresentation. Mml.ref (and so every <item> / <name> / … identity tag) renders this, not a raw string, so a name joins the compose chain as a fragment like everything else. The label is the already-resolved, viewer-aware name (recognition runs in the render layer and hands it in).

      Return null for the plain default — Mml.ref then wraps the label in Mml.text, which escapes it exactly once, so player-authored names / status decoration are safe by construction and the fragment is never re-escaped downstream. Override to build a richer fragment (a TPA terminal wraps its name in <color> to tint by state). The plain-string getPresentation stays the surface for non-prose consumers (logs, context.note, MQL scalars).

      Parameters

      • _label: string

      Returns Mml | null

    • Get property value (with masks applied).

      Lazily auto-initializes prop options when savedProps carries a hydration-delivered entry but propOptions doesn't yet — otherwise the value would be unreachable through the public API (getProp returns null without a config). Auto-init uses transient: false so the prop's persistence flag matches its storage location.

      Type Parameters

      Parameters

      Returns T | null

    • Read-only view combining saved + transient properties. Saved props are returned in their RUNTIME form — marshalled props pass through marshaller.fromStored on the way out so callers see Quantity instances and friends, not the raw stored shape.

      Returns Readonly<Record<string, PropValue>>

    • Read seam. Instance method, but unwraps via ProxyApi.unwrap before reaching the # slot — this inside an instance method called through the proxy is the proxy, and the # slot lives on the raw target.

      Returns string | null

    • Check if this object has been destroyed.

      @Unshadowable: the destroyed-state read is a framework invariant — any shadow that lied about it would let consumers touch a torn-down Stuff. @Final: subclasses overriding this would defeat the same invariant; the loader hook throws FinalViolationError at import time on any subclass that redefines it.

      Returns boolean

    • Terminal onDestruct no-op. Exists so subclasses and mixins overriding onDestruct can call super.onDestruct() without the cast-to-optional-callable dance — the chain is guaranteed to bottom out here. StuffApi.destruct invokes the hook via the optional-method dispatcher in api/stuff.ts; that path still works (always finds a function on the prototype).

      Override (not extend with super) at any layer that wants cleanup; chain to super.onDestruct() from the override so intermediate layers in a mixin chain run too.

      Returns void

      Invoked by StuffApi.destruct (and forceDestruct) while the target is still live, after canDestruct passes and before shadow-detach + destroy(). Witness — the return value is ignored (it cannot veto; canDestruct is the veto seam). Override to release resources/listeners and chain super.onDestruct() so mixin layers run.

    • Iterate the well-known events and call initProp for each with the per-event policy. Runs once after registration; safe against re-entry (initProp returns false on already-existing props).

      Custom events that no one frontloads here get auto-declared on first EventApi.emit / EventApi.on with the default EventApi.emittableBy() policy. Everything is treated the same — the frontloading just lets the well-known set carry tighter per-event allowlists from the start.

      Parameters

      • Optional_context: unknown

      Returns Promise<void>

    • Set property value (auto-initializes if doesn't exist).

      If savedProps already carries an entry for this name (e.g. delivered by hydration from a seed template), auto-init treats the prop as transient: false so subsequent writes route back to savedProps rather than landing in transientProps. Without this branch, hydrated values would be silently shadowed by the first set call.

      Type Parameters

      Parameters

      Returns boolean

    • Stamp this Stuff's templatePath and re-key the byTemplatePath index so future findByTemplatePath lookups see the new path. No-op when path matches the current value.

      Locked down by @CallSecurity(ApiOnly) because flipping a Stuff's identity post-clone would break FromTemplate policies and any caller-side caching of template-path identity. @Final @Unshadowable because the index update has to run for every successful set — a subclass override that forgot the index call (or a shadow that intercepted) would silently desync byTemplatePath.

      Unwraps via ProxyApi.unwrap so the #-slot access lands on the raw target (see comment on #templatePath above).

      Parameters

      • path: string

      Returns void

    • Set the spatial zone. Gated by FromSpatialZone — only the SpatialZone class and its subclasses (CartesianZone, SphericalZone) may call this through the proxy. The addLocation / removeLocation chokepoints on the zone side are the legitimate callers; everyone else is rejected.

      Clone-time seeding from StuffApi.#cloneInner doesn't go through this method — it uses the caller-allowlisted _stampZone seam below.

      @Final @Unshadowable because the index of substrate invariants that consult getZone() (containment's cross-zone gate, Mobile.traverse, MQL scope walks) trusts the slot's value; a subclass override or shadow that lied about it could break those invariants. No legitimate subclass needs to extend this anyway — the only legitimate write paths are the SpatialZone chokepoints and clone-time.

      Parameters

      Returns void

    • Get a string representation of this idea (for debugging). Subclasses should override to provide more specific information.

      Returns string

    • Refresh the recency timestamp to now. Timestamp-fixed (no caller-supplied value). Called on the raw target by the security gate on every successful dispatch (Phase 2) and by the residency presence walk.

      Returns void