Function: createEntityThread()

createEntityThread(args: { entity: LixEntityCanonical | LixEntity; lix: Pick<Lix, "db">; thread: { id: string; }; versionId?: string; }): Promise<void>

Creates a mapping between an entity and a thread.

This function allows any entity in the system to have discussion threads, enabling universal commenting across all entity types.

Examples

// Add thread to a markdown paragraph
await createEntityThread({
  lix,
  entity: {
    entity_id: "para_123",
    schema_key: "markdown_paragraph",
    file_id: "README.md"
  },
  thread: { id: "thread_001" }
});
// Add thread to a CSV cell
await createEntityThread({
  lix,
  entity: {
    entity_id: "row_789~column_2",
    schema_key: "csv_cell",
    file_id: "data.csv"
  },
  thread: { id: "thread_002" }
});
// Add thread to a change set
await createEntityThread({
  lix,
  entity: {
    entity_id: "cs123",
    schema_key: "lix_change_set",
    file_id: "lix"
  },
  thread: { id: "thread_003" }
});

Parameters

ParameterType
args{ entity: LixEntityCanonical | LixEntity; lix: Pick<Lix, "db">; thread: { id: string; }; versionId?: string; }
args.entityLixEntityCanonical | LixEntity
args.lixPick<Lix, "db">
args.thread{ id: string; }
args.thread.idstring
args.versionId?string

Returns

Promise<void>