Three stores, three importers and three pickers that differ only in their type are one of each (#85)
Refactoring round one: HttpFontStore/HttpSoundStore/HttpTextureStore collapse into a generic HttpFileStore over a FileStore contract; fontImport/soundImport/textureImport share assetImport with an ImportKind per sort; ImagePicker/FontPicker/SoundPicker sit on FilePicker and describe only their row. The group/comment drag logic leaves GraphCanvas for annotationDrag.ts (with its own unit test), declaredRows.ts replaces the duplicated row build in particles.ts and shaders.ts, and dead code in font/sound/compile/emission/transform/actions is gone. README: asset list, check count 958, the two-job CI, the Scenes wiki page. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
15bdfdf07a
commit
cc6db5f350
42 files changed
+1375
-1650
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* What the server answers for an upload: the content-addressed name it stored the bytes under
|
||||
* (`{sha256}.{ext}`, see `isTextureFile`/`isFontFile`/`isSoundFile`) and the caption kept beside it.
|
||||
*/
|
||||
export interface UploadedFile {
|
||||
file: string;
|
||||
/** The name the file was uploaded under, '' when the server knows none. Never a path. */
|
||||
name: string;
|
||||
bytes: number;
|
||||
}
|
||||
|
||||
/** A file the server holds, whether any project references it or not. */
|
||||
export interface StoredFile extends UploadedFile {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw bytes rather than a multipart form: the server derives name and format from the file itself,
|
||||
* so there is nothing else to send. `type` only fills the Content-Type header – the server trusts
|
||||
* the bytes, not the label – and uploading the same bytes twice yields the same file, the hash of
|
||||
* its content. `name` is the caption kept beside it; uploading the same bytes under a new name
|
||||
* renames what the pickers show.
|
||||
*/
|
||||
export interface FileStore<U extends UploadedFile = UploadedFile, S extends StoredFile = StoredFile> {
|
||||
upload(bytes: Blob | ArrayBuffer, type: string, name?: string): Promise<U>;
|
||||
list(): Promise<S[]>;
|
||||
delete(file: string): Promise<void>;
|
||||
}
|
||||
Reference in new issue
Block a user