@hyperframes/studio-server 0.8.78 → 0.8.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ interface HistoryFileChange {
15
15
  before: string | null;
16
16
  after: string | null;
17
17
  }
18
+ type HistoryEntrySide = "before" | "after";
18
19
  interface HistoryEntry {
19
20
  id: string;
20
21
  who: HistoryWho;
@@ -68,6 +69,8 @@ interface ClosedWindow {
68
69
  idleMs: number;
69
70
  }
70
71
  declare const MAX_WINDOW_IDLE_MS: number;
72
+ declare const UNDO_MODES: readonly ["just-this", "back-to-before", "keep-later-edits"];
73
+ type UndoMode = (typeof UNDO_MODES)[number];
71
74
  interface HistoryListItem extends HistoryEntry {
72
75
  pinned: boolean;
73
76
  undone: boolean;
@@ -91,15 +94,15 @@ interface HistoryWindow {
91
94
  }
92
95
  interface ProjectHistory {
93
96
  readonly projectId: string;
94
- /** Writes until close() are one entry with the window's id; a claim cutting a file out commits that file's part
95
- * first (fresh id), returned by close() if nothing else remained. Idle windows end; overlaps go to the newest. */
97
+ /** Writes until close() are one entry with the window's id; another writer or an operation meanwhile commits the
98
+ * part so far first (fresh id), returned by close() if nothing else remained. Overlaps go to the newest. */
96
99
  beginWindow(who: HistoryWho, label: string, options?: {
97
100
  idleMs?: number;
98
101
  }): Promise<HistoryWindow>;
99
102
  /**
100
103
  * For a writer that records after writing (Studio): moves the uncommitted changes to `paths` into one entry of
101
104
  * `who`'s, each cut at the `overwrote` version so earlier parts stay their writer's. Same-key claims merge until
102
- * another key, `idleMs` idle, or any operation. Null when nothing was claimed or a drag nets to nothing.
105
+ * another key, idle, an operation, a window, or another write. Null when nothing was claimed or a drag nets to 0.
103
106
  */
104
107
  claim(who: HistoryWho, label: string, paths: readonly string[], options?: ClaimOptions): Promise<{
105
108
  id: string;
@@ -107,26 +110,33 @@ interface ProjectHistory {
107
110
  /** A watcher saw `path` change (project-relative or absolute). */
108
111
  noteChange(path: string): void;
109
112
  list(): HistoryListItem[];
110
- /** Cmd+Z (back) and Cmd+Shift+Z (forward), whoever made the change; `writeToken` labels the writes' echo. */
113
+ /** Cmd+Z (back) and Cmd+Shift+Z (forward) over `who`'s own and outside changes; `writeToken` labels the echo. */
111
114
  step(direction: "back" | "forward", who: HistoryWho, options?: Writing): Promise<HistoryResult>;
112
- /** The entry the next step reverts, as of the last scan (a step scans first). */
113
- next(direction: "back" | "forward"): HistoryEntry | undefined;
114
- /** A conflict (a file changed since) returns the choice; pass `mode` to take one. */
115
+ /** The entry `who`'s next step reverts, pending changes included, as of the last scan (a step scans first). */
116
+ next(direction: "back" | "forward", who: HistoryWho): HistoryEntry | undefined;
117
+ /** A file changed since returns a conflict; `mode` takes a choice (keep-later-edits: null when none is left). */
115
118
  undo(id: string, options: {
116
119
  who: HistoryWho;
117
- mode?: "just-this" | "back-to-before";
120
+ mode?: UndoMode;
118
121
  } & Writing): Promise<HistoryResult>;
119
122
  /** Makes the files equal what they were right after `point` (an entry id, or START). */
120
123
  restore(point: string, who: HistoryWho, options?: Writing): Promise<HistoryEntry | null>;
121
124
  /** The files at `point` without writing anything: path to hash, read through readBlob. */
122
125
  peek(point: string): Record<string, string> | null;
126
+ checkout(entryId: string, side: HistoryEntrySide, emptyDir: string): Promise<void>;
123
127
  readBlob(hash: string): Promise<Buffer>;
124
128
  pin(id: string, pinned: boolean): void;
125
129
  onEntry(listener: (entry: HistoryEntry) => void): () => void;
126
130
  /** Takes in every pending write and commits every open window and the outside group. */
127
131
  flush(): Promise<void>;
132
+ /** True once another project stands at the folder's path: open that one's history instead. */
133
+ replacedAtPath(): boolean;
128
134
  close(): Promise<void>;
129
135
  }
136
+ /** A call on a history that was closed, or whose folder is now another project. */
137
+ declare class HistoryClosedError extends Error {
138
+ constructor(message: string);
139
+ }
130
140
  /** Opens a project's history: every write to its files becomes an entry that can be undone or restored. */
131
141
  declare function openProjectHistory(options: ProjectHistoryOptions): Promise<ProjectHistory>;
132
142
 
@@ -421,4 +431,4 @@ declare function injectMediaCodecMapIntoHtml(html: string, projectDir: string, h
421
431
  */
422
432
  declare function injectMediaCodecMap(html: string, adapter: PreviewApiAdapter, projectDir: string, compSrcPath: string, probeCache: MediaCodecProbeCache): Promise<string>;
423
433
 
424
- export { type ClosedWindow as C, DEFAULT_HISTORY_ROOT as D, type HistoryEntry as H, type LintResult as L, type MediaProcessingJobState as M, type PreviewDocumentStore as P, type RenderJobState as R, type StudioApiAdapter as S, START as a, type HistoryFileChange as b, type HistoryListItem as c, type HistoryResult as d, type HistoryWho as e, type HistoryWindow as f, MAX_WINDOW_IDLE_MS as g, type PreviewApiAdapter as h, type ProjectHistory as i, type ProjectHistoryOptions as j, type ResolvedProject as k, type StudioSelectionResponse as l, type StudioSelectionSnapshot as m, type StudioSelectionTextField as n, openProjectHistory as o, injectMediaCodecMap as p, injectMediaCodecMapIntoHtml as q, isAutoProxyEnabled as r, proxyEtagSalt as s, resolvePreviewMediaCodecProbeCache as t };
434
+ export { type ClosedWindow as C, DEFAULT_HISTORY_ROOT as D, HistoryClosedError as H, type LintResult as L, type MediaProcessingJobState as M, type ProjectHistory as P, type RenderJobState as R, type StudioApiAdapter as S, UNDO_MODES as U, type PreviewDocumentStore as a, START as b, type HistoryEntry as c, type HistoryEntrySide as d, type HistoryFileChange as e, type HistoryListItem as f, type HistoryResult as g, type HistoryWho as h, type HistoryWindow as i, MAX_WINDOW_IDLE_MS as j, type PreviewApiAdapter as k, type ProjectHistoryOptions as l, type ResolvedProject as m, type StudioSelectionResponse as n, type StudioSelectionSnapshot as o, type StudioSelectionTextField as p, type UndoMode as q, openProjectHistory as r, injectMediaCodecMap as s, injectMediaCodecMapIntoHtml as t, isAutoProxyEnabled as u, proxyEtagSalt as v, resolvePreviewMediaCodecProbeCache as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio-server",
3
- "version": "0.8.78",
3
+ "version": "0.8.79",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -64,8 +64,8 @@
64
64
  "linkedom": "^0.18.12",
65
65
  "postcss": "^8.5.8",
66
66
  "postcss-selector-parser": "^7.1.2",
67
- "@hyperframes/core": "0.8.78",
68
- "@hyperframes/parsers": "0.8.78"
67
+ "@hyperframes/core": "0.8.79",
68
+ "@hyperframes/parsers": "0.8.79"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/node": "^25.0.10",