github statelyai/xstate @xstate/codemod@0.1.0-beta.2

pre-release37 minutes ago

Patch Changes

  • 3cbcc3f: Serialized output no longer uses field names that start with $ or _. Stores such as Convex reject both prefixes, and MongoDB restricts $-prefixed field names, so persisted snapshots, systemTransition snapshots and effect descriptors could not be stored without rewriting them.

    Before After Where
    { $actor: address, incarnation } { '@actor': address, incarnation } SerializedActorRef: persisted context, systemTransition snapshots, effect descriptors, sendTo targets, dead letters, @xstate/effect actor toJSON()
    _nextTimerId nextTimerId Persisted snapshots, systemTransition snapshots
    _nextActorIds nextActorIds Persisted snapshots, systemTransition snapshots
    _stateInputs stateInputs systemTransition snapshots (persisted snapshots already used stateInputs)
    { $error: name, message } { '@error': name, message } systemTransition snapshots, @xstate/test traces
    { $stateNode: id }, { $systemMapper: key } { '@stateNode': id }, { '@systemMapper': key } systemTransition snapshots
    // Before
    { $actor: 'order/worker', incarnation: 'a:1' }
    // After
    { '@actor': 'order/worker', incarnation: 'a:1' }

    snapshot.toJSON() no longer includes the private _nextTimerId and _nextActorIds counters.

    Snapshots written by 6.0.0-beta.1 with the old field names still restore: restoreActor, restoreMachineSnapshot and systemTransition read both shapes. New snapshots use only the new names. Schemas that validate persisted snapshots (for example with machineVersions) must use the new names.

  • Updated dependencies [c558afa]

  • Updated dependencies [c70dd85]

  • Updated dependencies [975ba72]

  • Updated dependencies [0ebc550]

  • Updated dependencies [bbc8797]

  • Updated dependencies [757b605]

  • Updated dependencies [3cbcc3f]

  • Updated dependencies [bcd3840]

    • xstate@6.0.0-beta.2

Don't miss a new xstate release

NewReleases is sending notifications on new releases.