attachLabel(
args: {entity:LixEntityCanonical|LixEntity;label: {id:string; };lix:Pick<Lix,"db">;versionId?:string; }):Promise<void>
Attaches a label to an entity (creates mapping).
This function allows any entity in the system to be labeled, enabling universal labeling across all entity types. By default the label is attached in the active version, but a specific version can be provided when labeling global or historical entities.
// Label a bundle entity in the active version
await attachLabel({
lix,
entity: {
entity_id: "bundle123",
schema_key: "inlang_bundle",
file_id: "messages.json"
},
label: { id: "needs-translation-label-id" }
});// Label a change set that lives in the global version
await attachLabel({
lix,
entity: {
entity_id: "cs123",
schema_key: "lix_change_set",
file_id: "lix"
},
label: { id: "reviewed-label-id" },
versionId: "global"
});| Parameter | Type |
|---|---|
args | { entity: LixEntityCanonical | LixEntity; label: { id: string; }; lix: Pick<Lix, "db">; versionId?: string; } |
args.entity | LixEntityCanonical | LixEntity |
args.label | { id: string; } |
args.label.id | string |
args.lix | Pick<Lix, "db"> |
args.versionId? | string |
Promise<void>