
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@isoftdata/svelte-store-crud
Advanced tools
This is a Svelte store for tracking CRUD operations.
For example, if you have a map of entities and want to track when they are created, updated, and deleted without having to add a bunch of boolean flags to each entity, this store can help.
This store's value is an object containing three maps of objects, created, updated, and deleted.
npm i @isoftdata/svelte-store-crud
makeCrudStore function. Use the CrudRuneStore class insteadCrudRuneStore<T, K>const crudStore = new CrudRuneStore<Entity, 'id'>('id')
Creates a CRUD store for tracking changes to objects of type T, tracked by a key of type K.
This has the same API as the Svelte 4 version powered by Svelte stores, except for the subscribe function as it is not needed. Since it is written with runes, all fields and functions should be reactive if referenced in an effect.
Properties on the store are described below:
Add an entity to the created map.
Add an entity to the updated map.
If you call this function with an entity whose id is in the created map, it will update it in that map instead of adding it to the updated map.
Add an entity to the deleted map.
If you call this function with an entity whose id is in the created map, that entity will be removed from the created map, and will be put in the deleted map.
If you call this function with an entity whose id is in the updated map, it will be removed from the updated map and added to the deleted map.
Removes an entity from the deleted map.
This does not add it back to the created or updated map if it was in one before
Get a list of all values in the created map
Get a list of all values in the updated map
Get a list of all values in the deleted map
Get a list of all entries in the created map
Get a list of all entries in the updated map
Get a list of all entries in the deleted map
If entity is passed, returns true if that entity is created/updated deleted. Otherwise, returns true if there are any entity changes in the store
Returns true if the passed entity is in the created map
Returns true if the passed entity is in the updated map
Returns true if the passed entity is in the deleted map
Returns the entity if it is in the created map
Returns the entity if it is in the updated map
Returns the entity if it is in the deleted map
Clear the created, updated, and deleted maps. Or, if specified, clear just one.
Groups your CRUD by another key. Useful for if you're saving your CRUD as a child of another entity and want to group it by that entity's ID
import { CrudRuneStore } from '@isoftdata/svelte-store-crud'
type Entity = {
id: string
name: string
}
const crudStore = new CrudRuneStore<Entity, 'id'>('id')
// Create an entity with id = '1'
crudStore.create({
id: '1',
name: 'Entity 1'
})
// Update an entity with id = '1'
crudStore.update({
id: '1',
name: 'Entity 1 Updated'
})
// Delete an entity with id = '1'
crudStore.delete({
id: '1',
name: 'Entity 1 Updated'
})
// In a Svelte file, get the values reactively whenever the store is updated
$inspect(crudStore.createdValues)
$inspect(crudStore.updatedValues)
$inspect(crudStore.deletedValues)
$inspect(crudStore.hasChanges())
newCrudMapCreates the map used internally in the CRUD store, but without all the store logic
doCrudDoes all the logic of adding, removing, and updating things in a "CRUD map" without all the store logic
FAQs
This is a Svelte store for tracking CRUD operations.
The npm package @isoftdata/svelte-store-crud receives a total of 90 weekly downloads. As such, @isoftdata/svelte-store-crud popularity was classified as not popular.
We found that @isoftdata/svelte-store-crud demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.