Dossier API – updateEntity

updateEntity is used to update an existing entity. You can also publish the entity, in one atomic operation, by setting options to { publish: true }.

interface DossierClient {
updateEntity(
entity: Readonly<EntityUpdate>,
options?: EntityMutationOptions,
): PromiseResult<
EntityUpdatePayload,
"BadRequest" | "NotFound" | "NotAuthorized" | "Generic"
>;
}

interface EntityUpdate {
id: string;
info?: {
name?: string;
type?: string;
version?: number;
authKey?: string | null;
};
fields: Record<string, unknown>;
}

interface EntityMutationOptions {
publish?: boolean;
}

interface EntityUpdatePayload {
effect: "updated" | "updatedAndPublished" | "published" | "none";
entity: Entity;
}

If the entity is updated, an updateEntity or updateAndPublishEntity event is generated. If there are no changes to the entity, but it's published, a publishEntities event is generated.