Javascript SDK

VersionLink

Reference a specific version of a record.

const versionLink = {
  entity: "alice.baq.run",
  recordId: "23f2e13ee0424209a471a6bc3b7819f9",
  versionHash: "55f91f26ce2d4ca9836fff702a4ac38c84274f12fa6a40528f039e3b78b9bd47",
};
  • new(entity, recordId, versionHash): VersionLink

    • Create a new version link from an entity, record ID, and version hash.
  • entity Entity

    • Current entity representing the target record’s initial author.
  • originalEntity Entity optional

    • Entity that represented the target record’s initial author at the time the referencing record version was created, if different.
  • recordId RecordId

    • Unique identifier of the record within the scope of its initial author.
  • versionHash VersionHash

Linking to a specific version is useful when we want the linked data to be immutable. Here we create a Bookmark record with a link to a specific version of a blog post record.

import {VersionLink} from "@baqhub/sdk";
import {BookmarkRecord} from "./baq/bookmarkRecord.js";

const blogVersionLink = VersionLink.new(
  "baq.news.io",
  "46edb6353d83434caa7d297668ec057e",
  "8fa743e7285f46cfbd4532b39cfdc8bcde4acbe054f04cc98e2bf16517255459"
);

const bookmarkRecord = BookmarkRecord.new("taylor.baq.run", {
  target: blogVersionLink,
});
© 2024 Quentez