Files
Tom MoorandClaude Fable 5.1 7bd59ba1b3 fix: History "Current version" entry never finishes loading (#13669)
* fix: Current version history entry loads forever

Assigning the primary key on a built Revision is a silent no-op in
Sequelize, so revisions.info returned a random UUID instead of the
synthetic latest id the client waits for.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix: Apply policies from fetchLatest response

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 18:40:27 -04:00

22 lines
658 B
TypeScript

export class RevisionHelper {
/**
* Get a static id for the latest revision of a document.
*
* @param documentId The document to generate an ID for.
* @returns The ID of the latest revision of the document.
*/
static latestId(documentId?: string) {
return documentId ? `latest-${documentId}` : "";
}
/**
* Extract the document id from a latest revision id.
*
* @param id The revision id to inspect.
* @returns The document id if the id is a latest revision id, otherwise undefined.
*/
static documentIdFromLatestId(id: string) {
return id.startsWith("latest-") ? id.slice("latest-".length) : undefined;
}
}