1
0

feat: add private profile media and realtime contracts

This commit is contained in:
2026-08-11 19:21:49 -07:00
parent a2a52bfdae
commit 1c37ef8f3e
22 changed files with 2321 additions and 8 deletions
+11
View File
@@ -23,6 +23,8 @@ export interface ActorProfile {
skinTone?: string;
primaryColor?: string;
accentColor?: string;
hairColor?: string;
bodyShape?: "slim" | "average" | "broad";
};
}
@@ -202,6 +204,8 @@ function copyProfile(profile: ActorProfile): ActorProfile {
...(profile.appearance.skinTone === undefined ? {} : { skinTone: profile.appearance.skinTone }),
...(profile.appearance.primaryColor === undefined ? {} : { primaryColor: profile.appearance.primaryColor }),
...(profile.appearance.accentColor === undefined ? {} : { accentColor: profile.appearance.accentColor }),
...(profile.appearance.hairColor === undefined ? {} : { hairColor: profile.appearance.hairColor }),
...(profile.appearance.bodyShape === undefined ? {} : { bodyShape: profile.appearance.bodyShape }),
}
: undefined;
return {
@@ -227,10 +231,17 @@ function checkedIdentity(identity: ActorIdentity): Readonly<ActorIdentity> {
profile.appearance?.skinTone,
profile.appearance?.primaryColor,
profile.appearance?.accentColor,
profile.appearance?.hairColor,
];
if (strings.some((item) => item !== undefined && typeof item !== "string")) {
throw new RangeError("actor profile fields must be strings");
}
if (
profile.appearance?.bodyShape !== undefined &&
profile.appearance.bodyShape !== "slim" &&
profile.appearance.bodyShape !== "average" &&
profile.appearance.bodyShape !== "broad"
) throw new RangeError("actor body shape is invalid");
const copy: ActorIdentity = {
id: identity.id,
displayName: identity.displayName,
+2
View File
@@ -124,6 +124,8 @@ function buildActor(kind: ActorKind, identity: Readonly<ActorIdentity>): RiggedA
...(color(appearance?.skinTone) === undefined ? {} : { skinTone: color(appearance?.skinTone) }),
...(color(appearance?.primaryColor) === undefined ? {} : { outfitColor: color(appearance?.primaryColor) }),
...(color(appearance?.accentColor) === undefined ? {} : { accentColor: color(appearance?.accentColor) }),
...(color(appearance?.hairColor) === undefined ? {} : { hairColor: color(appearance?.hairColor) }),
...(appearance?.bodyShape === undefined ? {} : { bodyShape: appearance.bodyShape }),
}),
};
}