@hyperframes/studio-server 0.8.81 → 0.8.83

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Hono } from 'hono';
2
- import { S as StudioApiAdapter, P as ProjectHistory, a as PreviewDocumentStore, M as MediaProcessingJobState } from './mediaProxyPreview-BOp3Wa9v.js';
3
- export { C as ClosedWindow, D as DEFAULT_HISTORY_ROOT, b as HISTORY_START, H as HistoryClosedError, c as HistoryEntry, d as HistoryEntrySide, e as HistoryFileChange, f as HistoryListItem, g as HistoryResult, h as HistoryWho, i as HistoryWindow, L as LintResult, j as MAX_WINDOW_IDLE_MS, k as PreviewApiAdapter, l as ProjectHistoryOptions, R as RenderJobState, m as ResolvedProject, n as StudioSelectionResponse, o as StudioSelectionSnapshot, p as StudioSelectionTextField, U as UNDO_MODES, q as UndoMode, r as openProjectHistory } from './mediaProxyPreview-BOp3Wa9v.js';
2
+ import { S as StudioApiAdapter, P as ProjectHistory, a as PreviewDocumentStore, M as MediaProcessingJobState } from './mediaProxyPreview-BMHd9G3N.js';
3
+ export { C as ClosedWindow, D as DEFAULT_HISTORY_ROOT, b as HISTORY_START, H as HistoryClosedError, c as HistoryEntry, d as HistoryEntrySide, e as HistoryFileChange, f as HistoryListItem, g as HistoryResult, h as HistoryWho, i as HistoryWindow, L as LintResult, j as MAX_WINDOW_IDLE_MS, k as PreviewApiAdapter, l as ProjectHistoryOptions, R as RenderJobState, m as ResolvedProject, n as StudioSelectionResponse, o as StudioSelectionSnapshot, p as StudioSelectionTextField, U as UNDO_MODES, q as UndoMode, r as openProjectHistory } from './mediaProxyPreview-BMHd9G3N.js';
4
4
  import { SourceMutationTarget } from './helpers/sourceMutation.js';
5
5
  export { PatchOperation, dedupeClonedCompositionId, findTargetElement, parseSourceDocument, patchElementInHtml, removeElementFromHtml, splitElementInHtml } from './helpers/sourceMutation.js';
6
6
  export { ScreenshotClip, getElementScreenshotClip } from './helpers/screenshotClip.js';
@@ -73,6 +73,32 @@ declare function historyCache(open: (projectDir: string) => Opened): {
73
73
  closeAll: () => Promise<(void | undefined)[]>;
74
74
  };
75
75
 
76
+ interface PruneOptions {
77
+ now?: number;
78
+ /** Reports what would go, with the same checks, and removes nothing. */
79
+ dryRun?: boolean;
80
+ /** Projects under this folder are scratch: their history goes as soon as they do. */
81
+ tempDir?: string;
82
+ /** One history that could not be checked or removed; the rest are still pruned. */
83
+ onError?: (error: unknown) => void;
84
+ /** Starts no further history after this long; the rest wait for the next run. */
85
+ budgetMs?: number;
86
+ }
87
+ interface ProjectHistoryRecord {
88
+ id: string;
89
+ projectDir: string;
90
+ lastUsedMs: number;
91
+ }
92
+ /** Every history whose project is still in the folder it was recorded for; reads only. */
93
+ declare function listProjectHistories(historyRoot: string): ProjectHistoryRecord[];
94
+ interface PrunedHistory {
95
+ id: string;
96
+ projectDir: string;
97
+ bytes: number;
98
+ }
99
+ /** Removes the histories whose project is gone and that no live process holds. */
100
+ declare function pruneGoneProjectHistories(historyRoot: string, options?: PruneOptions): Promise<PrunedHistory[]>;
101
+
76
102
  /** Recursively walk a directory and return relative file paths. A subfolder that is unreadable
77
103
  * or removed mid-walk is skipped; any other failure, or an unreadable `dir` itself, throws. */
78
104
  declare function walkDir(dir: string, prefix?: string): string[];
@@ -118,9 +144,9 @@ declare const PREVIEW_BUNDLE_OPTIONS: {
118
144
  readonly sceneParts: true;
119
145
  };
120
146
 
121
- /** One built preview document on disk. `salt` names the server build, so new code never reads
122
- * a document an older build wrote. A failed read or write only costs a rebuild. */
123
- declare function createPreviewDocumentStore(dir: string, salt: string): PreviewDocumentStore;
147
+ /** One built preview document under the project's `.hyperframes/preview`. `salt` names the server build, so new
148
+ * code never reads a document an older build wrote. A failed read or write only costs a rebuild. */
149
+ declare function createPreviewDocumentStore(projectDir: string, salt: string): PreviewDocumentStore;
124
150
 
125
151
  declare const MIME_TYPES: Record<string, string>;
126
152
  declare function getMimeType(path: string): string;
@@ -222,4 +248,4 @@ type BackgroundRemovalRender = (options: {
222
248
  }>;
223
249
  declare function createBackgroundRemovalJob(opts: BackgroundRemovalJobOptions, render: BackgroundRemovalRender): MediaProcessingJobState;
224
250
 
225
- export { type AppliedFileMutation, type BackgroundRemovalRender, DELETED_VERSION, type DuplicateElementResult, type FileMutationInput, type FileWriteReceipt, HistoryBusyError, HistoryIdError, MIME_TYPES, MediaProcessingJobState, PREVIEW_BUNDLE_OPTIONS, ProjectHistory, SourceMutationTarget, StudioApiAdapter, type ThumbnailOutputDimensions, affectsPreview, affectsProjectSignature, applyFileMutations, buildSubCompositionHtml, compositionsAffectedBy, consumeFileWriteReceipt, createBackgroundRemovalJob, createPreviewDocumentStore, createProjectSignature, createStudioApi, duplicateElementInHtml, fileContentVersion, getMimeType, historyCache, identifyFileWrite, requestSubPath, settledFileTag, stampProjectHfIds, thumbnailDeviceScaleFactor, walkDir };
251
+ export { type AppliedFileMutation, type BackgroundRemovalRender, DELETED_VERSION, type DuplicateElementResult, type FileMutationInput, type FileWriteReceipt, HistoryBusyError, HistoryIdError, MIME_TYPES, MediaProcessingJobState, PREVIEW_BUNDLE_OPTIONS, ProjectHistory, type ProjectHistoryRecord, type PrunedHistory, SourceMutationTarget, StudioApiAdapter, type ThumbnailOutputDimensions, affectsPreview, affectsProjectSignature, applyFileMutations, buildSubCompositionHtml, compositionsAffectedBy, consumeFileWriteReceipt, createBackgroundRemovalJob, createPreviewDocumentStore, createProjectSignature, createStudioApi, duplicateElementInHtml, fileContentVersion, getMimeType, historyCache, identifyFileWrite, listProjectHistories, pruneGoneProjectHistories, requestSubPath, settledFileTag, stampProjectHfIds, thumbnailDeviceScaleFactor, walkDir };