#551 Saved views: shareable, forkable separations of a timeline, with an API for scripts and AI
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#551
- pull request
- state:merged
Saved views (#550): a configuration of separations, disjoins and unions, saved as a **view of a timeline**. A view can be shared, made the timeline's default, forked or duplicated, and reassigned to another timeline as a template. API keys can create views, so scripts and AI assistants can build them. This is stacked on #549 (disjoins and unions). I'll retarget it to `main` once #549 merges. ## What it does - **Saved views on the server** (`oc_saved_views`): - each has a title, a description and a separation of one timeline; - **private** (the owner and members) or **public** (anyone who can read its timeline); - shared with named accounts as viewers or editors, like timelines; - only the owner shares it, changes who can see it, or deletes it. - **Fork and duplicate:** - fork makes a private copy that remembers its source; - duplicate makes a copy with no link back. - **Reassign** to any timeline you can read, so views work as templates. Tags and moments the new timeline lacks are ignored. A timeline's deletion leaves its views as views of no timeline, until their owners reassign them. - **Default views follow the view.** A timeline's `view` can name a saved view by `id`, and the server then shows that view as it is now. The timeline keeps a copy of the separation, used by exports and once the view is deleted or moved. A saved `id` is kept only for one of the timeline's views that the saver can read. - **Files keep views of their own:** - desktop files, browser drafts and `.ochx` carry a `views` list; - the desktop store keeps it; - creating a server timeline from such a file makes them the creator's private saved views, with the default remapped. - **Editor:** - a **Views** button lists views as cards: Open (the bar reads `View: …`), Make default, Edit… (optionally replacing its separations with what's shown), Share… (visibility, link, members), Fork, Duplicate, Delete; - **Save what is shown as a view…**, and **Update "…" with what is shown**; - **Your views of other timelines**: Copy here / Move here; - `?view= ` on a timeline's page opens it in that view. - **Programmatic API:** - endpoints: `GET /api/timelines/{id}/views`, and under `/api/views`: create, read, change, delete, fork, duplicate, members; - **API keys reach `/api/views`** with the timeline scopes; - OpenAPI has a **Views** tag and the `SavedView`, `ViewSeparation` and `SavedViewEntry` schemas; - `docs/views.md` gives the full JSON for separations, disjoins and unions, with examples, and `llms.txt` links it for agents. ## Not included - Exports of server timelines carry the default view's copy, but not the list of saved views. Exports are cached per revision, and each reader can see different views. - Making a view the default is a timeline setting, saved with the timeline, as before. ## Tests - `saved-views-postgres.mjs` (new, in CI) covers: - private, public, and shared with an editor; - who may edit, share or delete; - fork and duplicate; - reassigning, including refused targets; - the default following its view and keeping its copy; - views adopted from a file; - a deleted timeline leaving its views. - `views-live-postgres.mjs` (new, in CI) runs on the real server: - an API key makes a view with disjoins and unions, and a circle is refused with a 400; - the owner opens it, saves another from what's shown, shares it and makes the default, and saves; - a reader sees both views and forks the public one; - the default follows an API change; - `?view=` opens a view. - `views-browser.mjs` (new, in the browser suite) covers a file's views: opened, saved, made default and followed, edited, duplicated, deleted, kept by exports. - **Unit:** - view IDs and `validateSavedViews`, documents and the editor's index; - API key scopes on `/api/views`; - OpenAPI. - **Rust:** the desktop store round-trips `views`. - **Locally:** `views-postgres.mjs` and `durations-postgres.mjs` still pass. `contents.tes… https://github.com/openchronology/timeline-app/pull/551
Related
- #549 Let separations disjoin and unite: from or into any track, at a time, a moment, or their first or last
- #550 Saved views: named, shareable configurations of separations
- #553 Separate by an entity's relationships beside separations by tags
- Merge pull request #551 from openchronology/feature/views