shelving 1.75.0 → 1.76.0

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.
@@ -5,7 +5,7 @@ import type { SortList } from "../constraint/SortConstraint.js";
5
5
  import type { ItemData, AsyncItem, Item } from "./Item.js";
6
6
  import type { AsyncDatabase, Database } from "./Database.js";
7
7
  import type { AsyncQuery, Query } from "./Query.js";
8
- import type { ItemChanges, WriteChange } from "./Change.js";
8
+ import type { AddChange, ItemChanges, WriteChange } from "./Change.js";
9
9
  /** Reference to a collection in a synchronous or asynchronous provider. */
10
10
  declare abstract class BaseCollection<T extends Datas = Datas, K extends Key<T> = Key<T>> {
11
11
  abstract readonly db: Database<T> | AsyncDatabase<T>;
@@ -18,6 +18,8 @@ declare abstract class BaseCollection<T extends Datas = Datas, K extends Key<T>
18
18
  abstract add(data: T[K]): string | Promise<string>;
19
19
  /** Run a set of changes on this database. */
20
20
  abstract change(...changes: Nullish<WriteChange<T, K>>[]): ItemChanges<T, K> | Promise<ItemChanges<T, K>>;
21
+ /** Get an add change for this collection. */
22
+ getAdd(data: T[K]): AddChange<T, K>;
21
23
  toString(): K;
22
24
  }
23
25
  /** Reference to a collection in a synchronous provider. */
package/db/Collection.js CHANGED
@@ -1,5 +1,9 @@
1
1
  /** Reference to a collection in a synchronous or asynchronous provider. */
2
2
  class BaseCollection {
3
+ /** Get an add change for this collection. */
4
+ getAdd(data) {
5
+ return { action: "ADD", collection: this.collection, data };
6
+ }
3
7
  // Implement toString()
4
8
  toString() {
5
9
  return this.collection;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.75.0",
14
+ "version": "1.76.0",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",