@oimdb/core 1.0.3 → 1.0.4

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/dist/index.cjs CHANGED
@@ -563,6 +563,9 @@ var OIMCollectionStoreMapDriven = class extends OIMCollectionStore {
563
563
  countAll() {
564
564
  return this.entities.size;
565
565
  }
566
+ clear() {
567
+ this.entities.clear();
568
+ }
566
569
  };
567
570
 
568
571
  // src/core/OIMEntityUpdaterFactory.ts
@@ -614,6 +617,16 @@ var OIMCollection = class {
614
617
  this.store.removeManyByPks(pks);
615
618
  this.emitter.emit(0 /* UPDATE */, { pks });
616
619
  }
620
+ clear() {
621
+ this.store.clear();
622
+ this.emitter.emit(0 /* UPDATE */, { pks: [] });
623
+ }
624
+ countAll() {
625
+ return this.store.countAll();
626
+ }
627
+ getAll() {
628
+ return this.store.getAll();
629
+ }
617
630
  upsertOneWithoutNotifications(entity) {
618
631
  const pk = this.selectPk(entity);
619
632
  const existingEntity = this.store.getOneByPk(pk);
package/dist/index.d.cts CHANGED
@@ -8,6 +8,7 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
8
8
  abstract getManyByPks(pks: readonly TPk[]): TEntity[];
9
9
  abstract getAll(): TEntity[];
10
10
  abstract countAll(): number;
11
+ abstract clear(): void;
11
12
  }
12
13
 
13
14
  type TOIMEventHandler<T> = (payload: T) => void;
@@ -325,6 +326,9 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
325
326
  upsertMany(entities: TEntity[]): void;
326
327
  removeOne(entity: TEntity): void;
327
328
  removeMany(entities: TEntity[]): void;
329
+ clear(): void;
330
+ countAll(): number;
331
+ getAll(): TEntity[];
328
332
  protected upsertOneWithoutNotifications(entity: TEntity): TPk;
329
333
  }
330
334
 
@@ -417,6 +421,7 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
417
421
  getManyByPks(pks: readonly TPk[]): TEntity[];
418
422
  getAll(): TEntity[];
419
423
  countAll(): number;
424
+ clear(): void;
420
425
  }
421
426
 
422
427
  type TOIMComparator<TEntity extends object> = (a: TEntity, b: TEntity) => boolean;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
8
8
  abstract getManyByPks(pks: readonly TPk[]): TEntity[];
9
9
  abstract getAll(): TEntity[];
10
10
  abstract countAll(): number;
11
+ abstract clear(): void;
11
12
  }
12
13
 
13
14
  type TOIMEventHandler<T> = (payload: T) => void;
@@ -325,6 +326,9 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
325
326
  upsertMany(entities: TEntity[]): void;
326
327
  removeOne(entity: TEntity): void;
327
328
  removeMany(entities: TEntity[]): void;
329
+ clear(): void;
330
+ countAll(): number;
331
+ getAll(): TEntity[];
328
332
  protected upsertOneWithoutNotifications(entity: TEntity): TPk;
329
333
  }
330
334
 
@@ -417,6 +421,7 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
417
421
  getManyByPks(pks: readonly TPk[]): TEntity[];
418
422
  getAll(): TEntity[];
419
423
  countAll(): number;
424
+ clear(): void;
420
425
  }
421
426
 
422
427
  type TOIMComparator<TEntity extends object> = (a: TEntity, b: TEntity) => boolean;
package/dist/index.js CHANGED
@@ -508,6 +508,9 @@ var OIMCollectionStoreMapDriven = class extends OIMCollectionStore {
508
508
  countAll() {
509
509
  return this.entities.size;
510
510
  }
511
+ clear() {
512
+ this.entities.clear();
513
+ }
511
514
  };
512
515
 
513
516
  // src/core/OIMEntityUpdaterFactory.ts
@@ -559,6 +562,16 @@ var OIMCollection = class {
559
562
  this.store.removeManyByPks(pks);
560
563
  this.emitter.emit(0 /* UPDATE */, { pks });
561
564
  }
565
+ clear() {
566
+ this.store.clear();
567
+ this.emitter.emit(0 /* UPDATE */, { pks: [] });
568
+ }
569
+ countAll() {
570
+ return this.store.countAll();
571
+ }
572
+ getAll() {
573
+ return this.store.getAll();
574
+ }
562
575
  upsertOneWithoutNotifications(entity) {
563
576
  const pk = this.selectPk(entity);
564
577
  const existingEntity = this.store.getOneByPk(pk);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oimdb/core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Core in-memory data library with type-safe indices, reactive subscriptions, and event processing",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",