* Don't require auth for .ping * Finally introducing loggers * Remove file list caching from disk_space_primitives I don't think this is required anymore with the sync model * Simplification of space primitives and more tests * More reliable online status * Add .zed settings * Remove selfUpdate argument from `writeFile` no longer used - Add `sync` config schema and document sync options - Move sync config handling to client boot logic - Move BootConfig type to ui_types.ts - Remove sync env vars from server - Update documentation for sync and architecture * Improve sync logic and proxy routing for full sync state * Add BoxProxy for late-bound client and improve Lua boot - Add isMobile syscall for editor * Add concurrency to sync process and log indexing duration * Better service worker lifecycle management
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import type { SpacePrimitives } from "./space_primitives.ts";
|
|
import type { FileMeta } from "../../type/index.ts";
|
|
|
|
export class ReadOnlySpacePrimitives implements SpacePrimitives {
|
|
wrapped: SpacePrimitives;
|
|
|
|
constructor(wrapped: SpacePrimitives) {
|
|
this.wrapped = wrapped;
|
|
}
|
|
|
|
async fetchFileList(): Promise<FileMeta[]> {
|
|
return (await this.wrapped.fetchFileList()).map((f: FileMeta) => ({
|
|
...f,
|
|
perm: "ro",
|
|
}));
|
|
}
|
|
|
|
async readFile(path: string): Promise<{ meta: FileMeta; data: Uint8Array }> {
|
|
const { meta, data } = await this.wrapped.readFile(path);
|
|
return {
|
|
meta: {
|
|
...meta,
|
|
perm: "ro",
|
|
},
|
|
data,
|
|
};
|
|
}
|
|
|
|
async getFileMeta(path: string, observing?: boolean): Promise<FileMeta> {
|
|
const meta = await this.wrapped.getFileMeta(path, observing);
|
|
return {
|
|
...meta,
|
|
perm: "ro",
|
|
};
|
|
}
|
|
|
|
writeFile(): Promise<FileMeta> {
|
|
throw new Error("Read only space, not allowed to write");
|
|
}
|
|
|
|
deleteFile(): Promise<void> {
|
|
throw new Error("Read only space, not allowed to delete");
|
|
}
|
|
}
|