TileDocument stream implementation

Type Parameters

  • T = Record<string, any>

Hierarchy

  • Stream
    • TileDocument

Constructors

  • Type Parameters

    • T = Record<string, any>

    Parameters

    • state$: RunningStateLike
    • api: StreamReaderWriter

    Returns TileDocument<T>

Properties

state$: RunningStateLike
STREAM_TYPE_ID: number = 0
STREAM_TYPE_NAME: string = 'tile'

Accessors

  • 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>

Methods

  • Make a commit to update the document

    Parameters

    • context: IntoSigner

      Object containing the DID making (and signing) the commit

    • newContent: undefined | null | T
    • Optional newMetadata: TileMetadataArgs

    Returns Promise<CeramicCommit>

  • Makes this document read-only. After this has been called any future attempts to call mutation methods on the instance will throw.

    Returns void

  • Update the contents of an existing Tile document based on a JSON-patch diff from the existing contents to the desired new contents

    Parameters

    • jsonPatch: Operation[]

      JSON patch diff of document contents

    • opts: UpdateOpts = {}

      Additional options

    Returns Promise<void>

  • Returns Promise<AnchorStatus>

  • Parameters

    • Optional opts: LoadOpts

    Returns Promise<void>

  • Update an existing Tile document.

    Parameters

    • content: undefined | null | T

      New content to replace old content

    • Optional metadata: TileMetadataArgs

      Changes to make to the metadata. Only fields that are specified will be changed.

    • opts: UpdateOpts = {}

      Additional options

    Returns Promise<void>

  • Creates a Tile document.

    Type Parameters

    • T

    Parameters

    • ceramic: StreamWriter

      Interface to write to ceramic network

    • content: undefined | null | T

      Genesis contents. If 'null', then no signature is required to make the genesis commit

    • Optional metadata: TileMetadataArgs

      Genesis metadata

    • opts: CreateOpts = {}

      Additional options

    Returns Promise<TileDocument<T>>

  • Create Tile document from genesis commit

    Type Parameters

    • T

    Parameters

    • ceramic: StreamWriter

      Interface to write to ceramic network

    • genesisCommit: GenesisCommit

      Genesis commit (first commit in document log)

    • opts: CreateOpts = {}

      Additional options

    Returns Promise<TileDocument<T>>

  • Loads a Tile document from a given StreamID

    Type Parameters

    • T

    Parameters

    • ceramic: StreamReader

      Interface for reading streams from ceramic network

    • streamId: string | CommitID | StreamID

      StreamID to load. Must correspond to a TileDocument

    • opts: LoadOpts = {}

      Additional options

    Returns Promise<TileDocument<T>>

  • Create genesis commit.

    Type Parameters

    • T

    Parameters

    • context: IntoSigner

      Object containing the DID making (and signing) the commit

    • content: undefined | null | T

      genesis content

    • metadata: undefined | null | TileMetadataArgs

      genesis metadata

    Returns Promise<CeramicCommit>