@hyperframes/studio-server 0.8.77 → 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;
@@ -47,6 +48,8 @@ interface ProjectHistoryOptions {
47
48
  onError?: (error: unknown) => void;
48
49
  /** How long an open waits for another process to close the same history (default 5 s). */
49
50
  ownerWaitMs?: number;
51
+ /** A CLI turn's window from an earlier open: writes since, within its idle limit, become the entry with its id. */
52
+ closedWindow?: ClosedWindow;
50
53
  }
51
54
  interface ClaimOptions {
52
55
  coalesceKey?: string;
@@ -57,6 +60,17 @@ interface ClaimOptions {
57
60
  interface Writing {
58
61
  writeToken?: string;
59
62
  }
63
+ interface ClosedWindow {
64
+ id: string;
65
+ who: HistoryWho;
66
+ label: string;
67
+ startedAt: number;
68
+ lastWriteAt: number;
69
+ idleMs: number;
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];
60
74
  interface HistoryListItem extends HistoryEntry {
61
75
  pinned: boolean;
62
76
  undone: boolean;
@@ -73,21 +87,22 @@ type HistoryResult = {
73
87
  };
74
88
  interface HistoryWindow {
75
89
  readonly id: string;
90
+ readonly startedAt: number;
76
91
  /** Records everything written since the window opened as one entry (null when nothing changed); after the window
77
92
  * ended by itself or by flush, returns the entry it became. */
78
93
  close(): Promise<HistoryEntry | null>;
79
94
  }
80
95
  interface ProjectHistory {
81
96
  readonly projectId: string;
82
- /** Writes until close() are one entry with the window's id; a claim cutting a file out commits that file's part
83
- * 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. */
84
99
  beginWindow(who: HistoryWho, label: string, options?: {
85
100
  idleMs?: number;
86
101
  }): Promise<HistoryWindow>;
87
102
  /**
88
103
  * For a writer that records after writing (Studio): moves the uncommitted changes to `paths` into one entry of
89
104
  * `who`'s, each cut at the `overwrote` version so earlier parts stay their writer's. Same-key claims merge until
90
- * 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.
91
106
  */
92
107
  claim(who: HistoryWho, label: string, paths: readonly string[], options?: ClaimOptions): Promise<{
93
108
  id: string;
@@ -95,26 +110,33 @@ interface ProjectHistory {
95
110
  /** A watcher saw `path` change (project-relative or absolute). */
96
111
  noteChange(path: string): void;
97
112
  list(): HistoryListItem[];
98
- /** 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. */
99
114
  step(direction: "back" | "forward", who: HistoryWho, options?: Writing): Promise<HistoryResult>;
100
- /** The entry the next step reverts, as of the last scan (a step scans first). */
101
- next(direction: "back" | "forward"): HistoryEntry | undefined;
102
- /** 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). */
103
118
  undo(id: string, options: {
104
119
  who: HistoryWho;
105
- mode?: "just-this" | "back-to-before";
120
+ mode?: UndoMode;
106
121
  } & Writing): Promise<HistoryResult>;
107
122
  /** Makes the files equal what they were right after `point` (an entry id, or START). */
108
123
  restore(point: string, who: HistoryWho, options?: Writing): Promise<HistoryEntry | null>;
109
124
  /** The files at `point` without writing anything: path to hash, read through readBlob. */
110
125
  peek(point: string): Record<string, string> | null;
126
+ checkout(entryId: string, side: HistoryEntrySide, emptyDir: string): Promise<void>;
111
127
  readBlob(hash: string): Promise<Buffer>;
112
128
  pin(id: string, pinned: boolean): void;
113
129
  onEntry(listener: (entry: HistoryEntry) => void): () => void;
114
130
  /** Takes in every pending write and commits every open window and the outside group. */
115
131
  flush(): Promise<void>;
132
+ /** True once another project stands at the folder's path: open that one's history instead. */
133
+ replacedAtPath(): boolean;
116
134
  close(): Promise<void>;
117
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
+ }
118
140
  /** Opens a project's history: every write to its files becomes an entry that can be undone or restored. */
119
141
  declare function openProjectHistory(options: ProjectHistoryOptions): Promise<ProjectHistory>;
120
142
 
@@ -409,4 +431,4 @@ declare function injectMediaCodecMapIntoHtml(html: string, projectDir: string, h
409
431
  */
410
432
  declare function injectMediaCodecMap(html: string, adapter: PreviewApiAdapter, projectDir: string, compSrcPath: string, probeCache: MediaCodecProbeCache): Promise<string>;
411
433
 
412
- export { 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, type PreviewApiAdapter as g, type ProjectHistory as h, type ProjectHistoryOptions as i, type ResolvedProject as j, type StudioSelectionResponse as k, type StudioSelectionSnapshot as l, type StudioSelectionTextField as m, injectMediaCodecMap as n, openProjectHistory as o, injectMediaCodecMapIntoHtml as p, isAutoProxyEnabled as q, proxyEtagSalt as r, resolvePreviewMediaCodecProbeCache as s };
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.77",
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.77",
68
- "@hyperframes/parsers": "0.8.77"
67
+ "@hyperframes/core": "0.8.79",
68
+ "@hyperframes/parsers": "0.8.79"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/node": "^25.0.10",