Strata · API
compareSnapshot
compareSnapshot, from @niscorp/strata/check, compares a recorded snapshot with the current one. It returns the status same, missing when nothing was recorded, or changed with one diff line per difference; changed at the recorded version means a migration is required. Descriptions are not compared, so a reworded .describe() is not a change.
z.object({
label: z.string(),
tone: z.enum(['primary', 'quiet']).optional(),
}).strict()z.object({
label: z.string().describe('What it says.'),
tone: z.enum(['primary', 'quiet']).optional(),
}).strict()z.object({
text: z.string(),
tone: z.enum(['primary', 'quiet']).optional(),
}).strict(){
reworded: { status: 'same' },
renamed: {
status: 'changed',
changes: [
{
kind: 'theatre.buttons/button',
lines: [
'- properties.label',
'+ properties.text',
'- required["label"]',
'+ required["text"]',
],
},
],
},
}Runs in this page on the installed package. The input and the expected output are defined by the example.