ModelInstanceDocument stream implementation

Type Parameters

  • T = Record<string, any>


  • Stream
    • ModelInstanceDocument


  • Type Parameters

    • T = Record<string, any>


    • state$: RunningStateLike
    • api: StreamReaderWriter

    Returns ModelInstanceDocument<T>


state$: RunningStateLike
MAX_DOCUMENT_SIZE: number = 16_000_000
STREAM_TYPE_ID: number = 3


  • get allCommitIds(): CommitID[]
  • Returns CommitID[]

  • get anchorCommitIds(): CommitID[]
  • Returns CommitID[]

  • get api(): StreamReaderWriter
  • Returns StreamReaderWriter

  • get commitId(): CommitID
  • Returns CommitID

  • get id(): StreamID
  • Returns StreamID

  • get state(): StreamState<StreamMetadata>
  • Returns StreamState<StreamMetadata>

  • get tip(): CID<unknown, number, number, Version>
  • Returns CID<unknown, number, number, Version>


  • Returns Promise<AnchorStatus>

  • Set the index metadata field for the stream


    • shouldIndex: boolean

      Whether the stream should be indexed or not

    • opts: UpdateOpts = {}

      Additional options

    Returns Promise<void>

  • Parameters

    • Optional opts: LoadOpts

    Returns Promise<void>

  • Loads a Model Instance Document from a given StreamID

    Type Parameters

    • T


    • reader: StreamReader

      Interface for reading streams from ceramic network

    • streamId: string | StreamID | CommitID

      StreamID to load. Must correspond to a ModelInstanceDocument

    • opts: LoadOpts = {}

      Additional options

    Returns Promise<ModelInstanceDocument<T>>

  • Make a commit to update the document. Can be applied using the applyCommit method on the Ceramic client.

    Type Parameters

    • T


    • signer: CeramicSigner

      Interface to create signatures

    • prev: CommitID

      The CommitID of the current tip of the Stream that the update should be applied on top of.

    • oldContent: T

      The current content of the Stream.

    • newContent: T

      The new content to update the Stream with.

    • Optional header: Partial<CommitHeader>

      New commit header, used to update the stream's metadata. Metadata fields not specified will be left alone with their current values.

    Returns Promise<CeramicCommit>