npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@isoftdata/svelte-store-crud

v2.8.0

Published

This is a Svelte store for tracking CRUD operations.

Readme

Svelte Store CRUD

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.

Install

	npm i @isoftdata/svelte-store-crud

Breaking Changes

2.0.0

  • Require Svelte 5
  • Deprecate the old makeCrudStore function. Use the CrudRuneStore class instead

API

CrudRuneStore<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:

create(entity: T): void

Add an entity to the created map.

update(entity: T): void

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.

delete(entity: T): void

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.

unDelete(entity: T): void

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 createdValues(): T[]

Get a list of all values in the created map

get updatedValues(): T[]

Get a list of all values in the updated map

get deletedValues(): T[]

Get a list of all values in the deleted map

get createdEntries(): T[]

Get a list of all entries in the created map

get updatedEntries(): T[]

Get a list of all entries in the updated map

get deletedEntries(): T[]

Get a list of all entries in the deleted map

hasChanges(entity?: EntityOrId<T, K> | Array<EntityOrId<T, K>>): boolean

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

isCreated(entity: EntityOrId<T, K>): boolean

Returns true if the passed entity is in the created map

isUpdated(entity: EntityOrId<T, K>): boolean

Returns true if the passed entity is in the updated map

isDeleted(entity: EntityOrId<T, K>): boolean

Returns true if the passed entity is in the deleted map

getCreated(entity: EntityOrId<T, K>): T | undefined

Returns the entity if it is in the created map

getUpdated(entity: EntityOrId<T, K>): T | undefined

Returns the entity if it is in the updated map

getDeleted(entity: EntityOrId<T, K>): T | undefined

Returns the entity if it is in the deleted map

clear(type?: 'create' | 'update' | 'delete'): void

Clear the created, updated, and deleted maps. Or, if specified, clear just one.

groupByKey(key: EntityIdKJey<T>): CrudByKey<T>

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())

newCrudMap

Creates the map used internally in the CRUD store, but without all the store logic

doCrud

Does all the logic of adding, removing, and updating things in a "CRUD map" without all the store logic