1
0
Fork 0
Code Issues Pull requests Projects Releases Packages Wiki Activity Actions Pages

extract server transform and validation helpers

This commit is contained in:
super-jalawii 2026-06-27 11:10:23 -04:00
parent aea2c9d56b
commit e79bc2e339
10 changed files with 373 additions and 139 deletions

36
server/worldTransforms.d.ts vendored Normal file
View file

@ -0,0 +1,36 @@
export function sanitizeWorldId(worldId: unknown): string;
export function defaultWorldDirRel(worldId: unknown): string;
export function buildWorldChunkFileName(chunkX: unknown, chunkY: unknown): string;
export function getWorldStoragePaths(
contentRoot: string,
worldEntryOrId: string | { id?: unknown; worldDir?: unknown },
): {
worldId: string;
worldDirRel: string;
worldDirAbs: string;
worldJsonRel: string;
worldJsonAbs: string;
bookmarksRel: string;
bookmarksAbs: string;
chunksDirRel: string;
chunksDirAbs: string;
};
export function normalizeWorldIndexEntry(entry: { id?: unknown; name?: unknown; worldDir?: unknown } | null | undefined): {
id: string;
name: string;
worldDir: string;
};
export function normalizeWorldIndexPayload(payload: unknown): {
schemaVersion: number;
worlds: Array<{
id: string;
name: string;
worldDir: string;
}>;
};
export function normalizeWorldBookmark(entry: { id?: unknown; label?: unknown; x?: unknown; y?: unknown } | null | undefined, index?: number): {
id: string;
label: string;
x: number;
y: number;
};