Saxonberg Server API
    Preparing search index...

    Base for MongoDB-backed records. NOT in the Stuff hierarchy.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _id?: string

    MongoDB ObjectId (undefined until saved).

    boardScopedName: string | null = null

    For grain: 'topic' — the board-scoped handle segment. Null for venues.

    createdAt: Date

    Created timestamp (set on construction).

    grain: SubjectGrain = 'venue'

    Board-grain venue vs thread-grain promoted topic.

    groupRef: string = ''

    Audience binding (lifted from Channel.groupRef). Empty = open. 'managed:<id>' for the curated case, or any GroupProvider ref.

    lifecycleClass: SubjectLifecycle = 'standing'

    Cycle 1 is always 'standing'; the ephemeral lifecycle is deferred.

    manifestations: SubjectManifestation[] = []

    The lit surfaces — 1..4, at most one of each kind.

    owner: string = ''

    Player reference of the creator — the mutation gate (lifted from Channel.owner).

    parentSubject: string | null = null

    For grain: 'topic' — the _id of the parent (board) subject. Null for venues.

    state: SubjectState = 'active'

    'active' until the deferred archive cascade flips it.

    title: string = ''

    Addressing handle. Flat-global + unique for venues; board-scoped for topics.

    updatedAt: Date

    Last updated timestamp (set on every save).

    collectionName: Collections = Collections.ForumSubjects

    Collection name (must be overridden in subclass).

    persistentFields: string[] = ...

    Methods

    • Load data from a MongoDB document into this object.

      Symmetric to toDocument: marshallers transform their assigned fields' raw values via fromStored before bracket-assign hits the runtime setter.

      Parameters

      • doc: Record<string, unknown>

      Returns void

    • Save this object to MongoDB. Updates updatedAt automatically.

      Pre-resolves any registered field marshallers via the async resolver before the sync toDocument walk; the sync resolver lookup inside toDocument then always hits a populated cache.

      Returns Promise<void>

    • Convert this object to a plain document for MongoDB.

      Marshallers (declared via static fieldMarshallers on a mixin or class) intercept their assigned fields: the runtime value-object value is passed through marshaller.toStored before being written into the doc. Fields without a marshaller pass through bracket-read unchanged.

      Returns Record<string, unknown>

    • Wire the marshaller-resolution seam once at boot (and in tests). Keeps Document free of a StuffApi import while still reaching the Idea-rooted marshaller instances. sync mirrors StuffApi.findByTemplatePath (returns the registered instance or undefined); async mirrors StuffApi.singleton (resolves / lazy-clones the instance, warming the cache sync then hits).

      Parameters

      • sync: SyncMarshallerResolver
      • async: AsyncMarshallerResolver

      Returns void