0.34.0 • Published 6 months ago

@sphereon/ssi-sdk.xstate-machine-persistence v0.34.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
6 months ago

Warning: This package still is in very early development. Breaking changes without notice will happen at this point!


A Veramo contact manager plugin. This plugin manages xstate and identity configurations to third parties and persists them. These configurations can then be used to establish a connection.

The XState Persistence Plugin for Veramo is designed to manage and persist XState machine states, allowing for durable, long-term storage of state machine snapshots. This enables applications to save, load, and delete state machine instances, facilitating seamless state management and recovery across sessions. Features:

  • Load State: Retrieve the current state of an XState machine from persistent storage.
  • Delete Expired States: Automatically remove state instances that have exceeded their lifespan, ensuring efficient use of storage.
  • Persist Machine Snapshot: Save snapshots of XState machine states, allowing for recovery and resumption of stateful processes.

Installation

To add the XState Persistence Plugin to your project, run:

yarn add @sphereon/xstate-persistence-plugin

Or if you prefer using npm:

npm install @sphereon/xstate-persistence-plugin

Usage Configuring the Plugin with Veramo

First, ensure you have Veramo set up in your project. Then, integrate the XState Persistence Plugin as follows:

import { createAgent } from '@veramo/core'
import { XStatePersistencePlugin } from '@sphereon/xstate-persistence-plugin'

const agent = createAgent({
  plugins: [
    new XStatePersistencePlugin({
      // Plugin options here
    }),
  ],
})

Persisting a Machine Snapshot

To save the current state of an XState machine:

await agent.persistMachineSnapshot({
  stateId: 'your-state-instanceId',
  type: 'YourmachineId',
  eventName: 'YOUR_EVENT_NAME',
  state: 'serialized-state-here', // Your XState machine state serialized as a string
  expiresAt: new Date('2023-01-01'), // Optional expiration date
})

Loading a State

To load the latest snapshot of a specific machine type:

const state = await agent.loadState({
  type: 'YourmachineId',
})

Deleting Expired States

To clean up expired states from the storage:

await agent.deleteExpiredMachineStates({
type: 'YourmachineId', // Optional: Specify the machine type to narrow down the deletion
});```

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs, features, or improvements.
License

This project is licensed under the MIT License.
0.30.2-next.394

1 year ago

0.30.2-next.395

1 year ago

0.30.2-fix.364

1 year ago

0.30.2-fix.363

1 year ago

0.30.2-fix.368

1 year ago

0.30.2-fix.367

1 year ago

0.30.2-next.373

1 year ago

0.31.1-fix.4

1 year ago

0.31.1-fix.5

1 year ago

0.33.0

9 months ago

0.30.2-next.148

1 year ago

0.30.2-next.145

1 year ago

0.31.1-next.4

1 year ago

0.30.2-next.390

1 year ago

0.31.0

1 year ago

0.30.2-next.191

1 year ago

0.30.2-fix.199

1 year ago

0.30.2-fix.198

1 year ago

0.30.2-next.328

1 year ago

0.30.2-next.329

1 year ago

0.32.1-next.291

9 months ago

0.32.1-next.287

9 months ago

0.30.2-fix.395

1 year ago

0.30.2-fix.393

1 year ago

0.30.2-next.365

1 year ago

0.30.2-next.367

1 year ago

0.30.2-next.362

1 year ago

0.30.2-next.363

1 year ago

0.30.2-fix.139

1 year ago

0.30.2-fix.140

1 year ago

0.31.1-fix.20

12 months ago

0.30.2-next.276

1 year ago

0.30.2-next.279

1 year ago

0.30.2-next.273

1 year ago

0.30.2-next.275

1 year ago

0.30.2-next.281

1 year ago

0.32.0

12 months ago

0.30.2-next.285

1 year ago

0.30.2-next.259

1 year ago

0.32.1-next.113

10 months ago

0.30.2-next.269

1 year ago

0.30.2-next.267

1 year ago

0.31.1-next.44

12 months ago

0.31.1-next.42

12 months ago

0.31.1-next.41

12 months ago

0.31.1-next.39

12 months ago

0.31.1-next.33

12 months ago

0.31.1-next.32

12 months ago

0.32.1-fix.160

10 months ago

0.31.1-next.30

12 months ago

0.32.1-next.161

10 months ago

0.30.2-next.297

1 year ago

0.33.1-next.3

7 months ago

0.33.1-next.2

7 months ago

0.31.1-next.62

12 months ago

0.32.1-next.54

10 months ago

0.32.1-next.157

10 months ago

0.31.1-next.60

12 months ago

0.32.1-next.150

10 months ago

0.32.1-next.141

10 months ago

0.32.1-next.145

10 months ago

0.33.1-next.73

6 months ago

0.32.1-fix.143

10 months ago

0.32.1-fix.142

10 months ago

0.33.1-next.68

7 months ago

0.30.2-next.200

1 year ago

0.31.1-next.29

12 months ago

0.31.1-next.26

12 months ago

0.31.1-next.28

12 months ago

0.31.1-next.21

12 months ago

0.31.1-next.24

12 months ago

0.31.1-next.23

12 months ago

0.31.1-next.19

12 months ago

0.31.1-next.14

1 year ago

0.31.1-next.17

12 months ago

0.31.1-next.13

1 year ago

0.34.0

6 months ago

0.30.2-fix.278

1 year ago

0.30.2-fix.270

1 year ago

0.30.2-fix.280

1 year ago

0.30.2-next.215

1 year ago

0.30.2-next.221

1 year ago

0.30.2-next.223

1 year ago

0.30.2-fix.266

1 year ago

0.30.2-fix.265

1 year ago

0.30.2-fix.263

1 year ago

0.30.2-fix.262

1 year ago

0.32.1-fix.15

12 months ago

0.32.1-next.13

12 months ago

0.32.1-next.17

12 months ago

0.32.1-next.18

11 months ago

0.32.1-next.12

12 months ago

0.32.1-next.20

11 months ago

0.30.2-fix.138

1 year ago

0.30.2-next.133

1 year ago

0.30.2-next.135

1 year ago

0.30.2-fix.136

1 year ago

0.30.2-next.129

1 year ago

0.30.2-next.125

1 year ago

0.30.2-next.103

1 year ago

0.30.2-fix.50

1 year ago

0.30.2-fix.48

1 year ago

0.30.2-fix.49

1 year ago

0.30.2-next.58

1 year ago

0.30.2-next.66

1 year ago

0.30.2-next.47

1 year ago

0.30.2-next.4

1 year ago

0.30.2-next.5

1 year ago

0.30.2-next.6

1 year ago

0.29.1-next.185

1 year ago

0.30.1

1 year ago

0.29.1-next.175

1 year ago

0.29.1-next.174

1 year ago

0.29.1-next.177

1 year ago

0.29.1-next.176

1 year ago

0.27.1-next.20

1 year ago

0.27.1-next.24

1 year ago

0.27.1-next.25

1 year ago

0.29.1-next.80

1 year ago

0.27.1-next.28

1 year ago

0.27.1-next.29

1 year ago

0.27.1-next.26

1 year ago

0.29.1-next.82

1 year ago

0.28.1-next.51

1 year ago

0.28.1-next.50

1 year ago

0.28.1-next.53

1 year ago

0.28.1-next.52

1 year ago

0.27.1-next.31

1 year ago

0.27.1-next.33

1 year ago

0.27.1-next.39

1 year ago

0.27.1-next.38

1 year ago

0.28.1-next.48

1 year ago

0.28.1-next.49

1 year ago

0.28.1-next.44

1 year ago

0.29.1-next.5

1 year ago

0.28.1-next.40

1 year ago

0.26.1-next.6

1 year ago

0.29.1-next.4

1 year ago

0.26.1-next.4

1 year ago

0.29.1-next.2

1 year ago

0.28.1-next.41

1 year ago

0.26.1-next.140

1 year ago

0.29.1-next.61

1 year ago

0.28.1-next.60

1 year ago

0.26.1-next.129

1 year ago

0.26.1-next.127

1 year ago

0.26.1-next.131

1 year ago

0.26.1-next.132

1 year ago

0.26.1-next.115

1 year ago

0.26.1-next.113

1 year ago

0.26.1-next.108

1 year ago

0.26.1-next.106

1 year ago

0.25.0

1 year ago

0.27.1-next.8

1 year ago

0.27.1-next.9

1 year ago

0.27.1-next.6

1 year ago

0.27.1-next.7

1 year ago

0.27.1-next.4

1 year ago

0.27.1-next.2

1 year ago

0.26.0

1 year ago

0.28.1-next.11

1 year ago

0.28.1-next.10

1 year ago

0.28.1-next.13

1 year ago

0.25.1-next.118

1 year ago

0.28.1-next.39

1 year ago

0.24.0

1 year ago

0.29.0

1 year ago

0.24.1-next.98

1 year ago

0.27.0

1 year ago

0.24.1-next.42

1 year ago

0.28.0

1 year ago

0.29.1-next.122

1 year ago

0.25.1-next.29

1 year ago

0.25.1-next.28

1 year ago

0.28.1-next.9

1 year ago

0.28.1-next.5

1 year ago

0.28.1-next.6

1 year ago

0.28.1-next.8

1 year ago

0.23.5-next.24

1 year ago

0.29.1-next.104

1 year ago

0.29.1-next.103

1 year ago

0.29.1-next.47

1 year ago

0.29.1-next.46

1 year ago

0.29.1-next.106

1 year ago

0.29.1-next.105

1 year ago

0.24.1-next.100

1 year ago

0.27.1-next.10

1 year ago

0.27.1-next.12

1 year ago

0.24.1-next.113

1 year ago

0.24.1-next.112

1 year ago

0.24.1-next.118

1 year ago

0.24.1-next.116

1 year ago

0.23.5-next.22

2 years ago

0.23.5-next.12

2 years ago

0.23.5-next.11

2 years ago

0.23.5-next.10

2 years ago

0.23.4

2 years ago

0.23.3-next.3

2 years ago

0.23.2-next.4

2 years ago

0.23.1-next.7

2 years ago

0.23.0

2 years ago

0.21.2-next.25

2 years ago

0.23.1-next.2

2 years ago

0.21.2-next.23

2 years ago

0.21.2-next.8

2 years ago

0.21.2-next.7

2 years ago

0.21.2-next.6

2 years ago

0.21.2-next.17

2 years ago

0.21.1

2 years ago

0.21.1-next.8

2 years ago

0.21.1-next.4

2 years ago

0.22.0

2 years ago

0.19.1-next.125

2 years ago

0.19.1-next.126

2 years ago

0.21.0

2 years ago

0.21.1-next.2

2 years ago

0.19.1-next.119

2 years ago

0.19.1-next.135

2 years ago

0.19.1-next.117

2 years ago

0.19.1-next.113

2 years ago

0.19.1-next.114

2 years ago

0.19.1-next.115

2 years ago

0.19.1-next.116

2 years ago

0.19.1-next.111

2 years ago

0.19.1-next.112

2 years ago

0.19.1-next.105

2 years ago

0.19.1-next.110

2 years ago

0.19.1-next.106

2 years ago

0.19.1-next.108

2 years ago

0.19.1-next.109

2 years ago

0.19.1-next.102

2 years ago

0.19.1-next.100

2 years ago

0.19.1-next.101

2 years ago

0.19.1-next.98

2 years ago

0.19.1-next.99

2 years ago

0.19.1-next.96

2 years ago

0.19.1-next.75

2 years ago