@hatsuboshi/types
    Preparing search index...

    Class PersistentObject<I, D>Abstract

    Models that are stored into persistent repositories.

    Can be filtered using PersistentObjectFilter.

    Type Parameters

    • I extends IPersistentObject

      The Data Transfer Object (I-prefix) this model serializes to.

    • D extends IPersistentObject

      the Document-store Object (DB-prefix) this model serializes to.

    Hierarchy (View Summary)

    Implements

    Index
    • Returns the document-store representation of this object.

      Caution

      Unlike toJSON(), the resulting document-store representation may be in a significantly different shape to that of its implementing class, and it cannot be passed back into the constructor to reconstruct an equivalent instance.

      Use fromDB() instead, which reconstructs the instance and rehydrates any fields truncated by the conversion.

      Returns D

    • Returns the JSON-serializable representation of this object.

      Tip

      The result can be passed back into the constructor to reconstruct an equivalent instance.

      Returns I

      // t1 and t2 are deeply equal
      const t1: T = new T({ ... })
      const t2: T = new T(t1.toJSON())
    createdAt: string

    The time the object was created, as an ISO 8601 (RFC 3339) timestamp.

    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})$

    "2026-07-08T07:35:46.741Z"
    
    id: string

    An ID associated with the object.

    index: number = 0

    An auto-incremented index to keep object IDs unique during runtime.

    updatedAt: string

    The time the object was last updated, as an ISO 8601 (RFC 3339) timestamp.

    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})$

    "2026-07-09T14:02:11.508Z"