🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@isoftdata/svelte-store-crud

Package Overview
Dependencies
Maintainers
11
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/svelte-store-crud - npm Package Compare versions

Comparing version
2.4.0
to
2.5.0
+3
-1
dist/store.svelte.d.ts

@@ -9,2 +9,3 @@ import type { ConditionalKeys, Simplify } from 'type-fest';

export type CrudMap<T> = Record<CrudMapKey, EntityMap<T>>;
type ArrayCrudMap<T> = Record<CrudMapKey, Array<T>>;
/** Creates a new CRUD Map, without the rest of the store logic */

@@ -51,3 +52,4 @@ export declare const newCrudMap: <T>() => CrudMap<T>;

constructor(idKey: K);
set(value: CrudMap<T> | MapCrudMap<T>): void;
set(value: CrudMap<T> | MapCrudMap<T> | ArrayCrudMap<T>): void;
static getValuesForSet<T>(values: EntityMap<T> | Map<EntityIdValue<T>, T> | Array<T>): Array<T>;
create(entity: T | T[]): void;

@@ -54,0 +56,0 @@ update(entity: T | T[]): void;

@@ -152,6 +152,15 @@ import { writable } from 'svelte/store';

this.clear();
this.create(value.created instanceof Map ? Array.from(value.created.values()) : Object.values(value.created));
this.update(value.updated instanceof Map ? Array.from(value.updated.values()) : Object.values(value.updated));
this.delete(value.deleted instanceof Map ? Array.from(value.deleted.values()) : Object.values(value.deleted));
this.create(CrudRuneStore.getValuesForSet(value.created));
this.update(CrudRuneStore.getValuesForSet(value.updated));
this.delete(CrudRuneStore.getValuesForSet(value.deleted));
}
static getValuesForSet(values) {
if (values instanceof Map) {
return Array.from(values.values());
}
else if (Array.isArray(values)) {
return values;
}
return Object.values(values);
}
create(entity) {

@@ -158,0 +167,0 @@ this.#updateEntity(entity, 'created');

{
"name": "@isoftdata/svelte-store-crud",
"version": "2.4.0",
"version": "2.5.0",
"files": [

@@ -5,0 +5,0 @@ "dist",