Function: buildSchema()
buildSchema(
__namedParameters):SaveSchema
Defined in: schema.ts:100
Builds a comparable schema from one save state object.
Takes the version the state belongs to, the save state itself as
Game.getState() produces it, the registered passage ids (or null when the
source cannot know them), and where the state was captured from.
Parameters
__namedParameters
capturedFrom
gameData
Record<string, unknown>
gameVersion
string
passageIds
string[] | null
Returns
A schema ready to be written or diffed
Example
const schema = buildSchema({
gameVersion: "0.1.0",
gameData: { player: { health: 100 } },
passageIds: ["intro"],
capturedFrom: "code",
});
schema.paths; // { "player": "object", "player.health": "number" }