Skip to main content

View as Markdown · AI documentation index

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​

CaptureSource

gameData​

Record<string, unknown>

gameVersion​

string

passageIds​

string[] | null

Returns​

SaveSchema

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" }