Strata · API
upgrader.upgrade
upgrader.upgrade upgrades one stored document to the version of the code: it applies every migration between the document’s stamp and the upgrader’s, in order. It returns the upgraded document, the applied migrations and the stamp to store with the document from then on. A document whose stamp already matches the upgrader’s is returned as it was stored.
{
id: 'theatre.kit',
migrations: [
'Button: label is now text',
'Button: tone is now variant',
'Card is now Tile',
],
}{
component: 'Card',
children: [
{ component: 'Text', children: 'The Tempest' },
{
component: 'Button',
props: { label: 'Show my ticket', tone: 'primary' },
},
],
}{ nisc.nova: 2, nisc.prism: 3, theatre.kit: 0 }{
document: {
component: 'Tile',
children: [
{ component: 'Text', children: 'The Tempest' },
{
component: 'Button',
props: { text: 'Show my ticket', variant: 'filled' },
},
],
},
stamp: { nisc.nova: 2, nisc.prism: 3, theatre.kit: 3 },
applied: ['theatre.kit/1', 'theatre.kit/2', 'theatre.kit/3'],
}Runs in this page on the installed package. The input and the expected output are defined by the example.