extract server transform and validation helpers
This commit is contained in:
parent
aea2c9d56b
commit
e79bc2e339
10 changed files with 373 additions and 139 deletions
36
server/worldTransforms.d.ts
vendored
Normal file
36
server/worldTransforms.d.ts
vendored
Normal 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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue