Update Healer Man server
This commit is contained in:
1 parent
3e30af4c98
commit
97ee0c13f9
25 files changed
+576
-179
No files matched your search
@@ -32,6 +32,26 @@ export interface ContentManifest {
|
||||
readonly files: Readonly<Record<string, ContentManifestFile>>;
|
||||
}
|
||||
|
||||
/** Resolves runtime logical asset URLs to the independently installable packs that own them. */
|
||||
export function contentPackIdsForLogicalUrls(
|
||||
manifest: ContentManifest,
|
||||
logicalUrls: readonly string[],
|
||||
): readonly string[] {
|
||||
const packIds = new Set<string>();
|
||||
for (const logicalUrl of logicalUrls) {
|
||||
let pathname: string;
|
||||
try {
|
||||
pathname = new URL(logicalUrl, "https://healer-man.invalid").pathname;
|
||||
} catch {
|
||||
throw new Error(`Invalid content asset URL: ${logicalUrl}`);
|
||||
}
|
||||
const entry = manifest.files[pathname];
|
||||
if (!entry) throw new Error(`The content catalog is missing randomized asset ${pathname}.`);
|
||||
packIds.add(entry.packId);
|
||||
}
|
||||
return [...packIds].sort();
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user