shelving 1.73.0 → 1.73.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/db/Changes.d.ts CHANGED
@@ -7,9 +7,10 @@ import type { Database, AsyncDatabase } from "./Database.js";
7
7
  * - If data is an object, sets the item.
8
8
  * - If data is a `DataUpdate` instance, updates the item.
9
9
  * - If data is null, deletes the item.
10
+ * - If data is undefined, skip the item.
10
11
  */
11
12
  export declare type Changes<DB extends Datas> = {
12
- [K in Key<DB> as `${K}/${string}`]: DB[K] | DataUpdate<DB[K]> | null;
13
+ [K in Key<DB> as `${K}/${string}`]: DB[K] | DataUpdate<DB[K]> | null | undefined;
13
14
  };
14
15
  /** Apply a set of changes to a synchronous database. */
15
16
  export declare function changeDatabase<T extends Datas>({ provider }: Database<T>, changes: Changes<T>): Changes<T>;
package/db/Changes.js CHANGED
@@ -12,7 +12,9 @@ export function changeAsyncDatabase({ provider }, changes) {
12
12
  export function changeProvider(provider, changes) {
13
13
  for (const [key, change] of Object.entries(changes)) {
14
14
  const [collection, id] = splitString(key, "/", 2);
15
- if (!change)
15
+ if (change === undefined)
16
+ continue;
17
+ else if (change === null)
16
18
  provider.deleteItem(collection, id);
17
19
  else if (change instanceof DataUpdate)
18
20
  provider.updateItem(collection, id, change);
@@ -25,7 +27,9 @@ export function changeProvider(provider, changes) {
25
27
  export async function changeAsyncProvider(provider, changes) {
26
28
  for (const [key, change] of Object.entries(changes)) {
27
29
  const [collection, id] = splitString(key, "/", 2);
28
- if (!change)
30
+ if (change === undefined)
31
+ continue;
32
+ else if (change === null)
29
33
  await provider.deleteItem(collection, id);
30
34
  else if (change instanceof DataUpdate)
31
35
  await provider.updateItem(collection, id, change);
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.73.0",
14
+ "version": "1.73.1",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",