@oimdb/core 1.0.3 → 1.0.5
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 +31 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +31 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -563,6 +563,12 @@ var OIMCollectionStoreMapDriven = class extends OIMCollectionStore {
|
|
|
563
563
|
countAll() {
|
|
564
564
|
return this.entities.size;
|
|
565
565
|
}
|
|
566
|
+
clear() {
|
|
567
|
+
this.entities.clear();
|
|
568
|
+
}
|
|
569
|
+
getAllPks() {
|
|
570
|
+
return Array.from(this.entities.keys());
|
|
571
|
+
}
|
|
566
572
|
};
|
|
567
573
|
|
|
568
574
|
// src/core/OIMEntityUpdaterFactory.ts
|
|
@@ -614,6 +620,19 @@ var OIMCollection = class {
|
|
|
614
620
|
this.store.removeManyByPks(pks);
|
|
615
621
|
this.emitter.emit(0 /* UPDATE */, { pks });
|
|
616
622
|
}
|
|
623
|
+
clear() {
|
|
624
|
+
this.store.clear();
|
|
625
|
+
this.emitter.emit(0 /* UPDATE */, { pks: [] });
|
|
626
|
+
}
|
|
627
|
+
countAll() {
|
|
628
|
+
return this.store.countAll();
|
|
629
|
+
}
|
|
630
|
+
getAll() {
|
|
631
|
+
return this.store.getAll();
|
|
632
|
+
}
|
|
633
|
+
getAllPks() {
|
|
634
|
+
return this.store.getAllPks();
|
|
635
|
+
}
|
|
617
636
|
upsertOneWithoutNotifications(entity) {
|
|
618
637
|
const pk = this.selectPk(entity);
|
|
619
638
|
const existingEntity = this.store.getOneByPk(pk);
|
|
@@ -694,6 +713,18 @@ var OIMReactiveCollection = class {
|
|
|
694
713
|
getManyByPks(pks) {
|
|
695
714
|
return this.collection.getManyByPks(pks);
|
|
696
715
|
}
|
|
716
|
+
clear() {
|
|
717
|
+
this.collection.clear();
|
|
718
|
+
}
|
|
719
|
+
countAll() {
|
|
720
|
+
return this.collection.countAll();
|
|
721
|
+
}
|
|
722
|
+
getAll() {
|
|
723
|
+
return this.collection.getAll();
|
|
724
|
+
}
|
|
725
|
+
getAllPks() {
|
|
726
|
+
return this.collection.getAllPks();
|
|
727
|
+
}
|
|
697
728
|
};
|
|
698
729
|
|
|
699
730
|
// src/core/OIMIndexManual.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,9 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
|
|
|
7
7
|
abstract getOneByPk(pk: TPk): TEntity | undefined;
|
|
8
8
|
abstract getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
9
9
|
abstract getAll(): TEntity[];
|
|
10
|
+
abstract getAllPks(): TPk[];
|
|
10
11
|
abstract countAll(): number;
|
|
12
|
+
abstract clear(): void;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
type TOIMEventHandler<T> = (payload: T) => void;
|
|
@@ -325,6 +327,10 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
|
|
|
325
327
|
upsertMany(entities: TEntity[]): void;
|
|
326
328
|
removeOne(entity: TEntity): void;
|
|
327
329
|
removeMany(entities: TEntity[]): void;
|
|
330
|
+
clear(): void;
|
|
331
|
+
countAll(): number;
|
|
332
|
+
getAll(): TEntity[];
|
|
333
|
+
getAllPks(): TPk[];
|
|
328
334
|
protected upsertOneWithoutNotifications(entity: TEntity): TPk;
|
|
329
335
|
}
|
|
330
336
|
|
|
@@ -361,6 +367,10 @@ declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk>
|
|
|
361
367
|
removeOne(entity: TEntity): void;
|
|
362
368
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
363
369
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
370
|
+
clear(): void;
|
|
371
|
+
countAll(): number;
|
|
372
|
+
getAll(): TEntity[];
|
|
373
|
+
getAllPks(): TPk[];
|
|
364
374
|
}
|
|
365
375
|
|
|
366
376
|
/**
|
|
@@ -417,6 +427,8 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
|
|
|
417
427
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
418
428
|
getAll(): TEntity[];
|
|
419
429
|
countAll(): number;
|
|
430
|
+
clear(): void;
|
|
431
|
+
getAllPks(): TPk[];
|
|
420
432
|
}
|
|
421
433
|
|
|
422
434
|
type TOIMComparator<TEntity extends object> = (a: TEntity, b: TEntity) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
|
|
|
7
7
|
abstract getOneByPk(pk: TPk): TEntity | undefined;
|
|
8
8
|
abstract getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
9
9
|
abstract getAll(): TEntity[];
|
|
10
|
+
abstract getAllPks(): TPk[];
|
|
10
11
|
abstract countAll(): number;
|
|
12
|
+
abstract clear(): void;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
type TOIMEventHandler<T> = (payload: T) => void;
|
|
@@ -325,6 +327,10 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
|
|
|
325
327
|
upsertMany(entities: TEntity[]): void;
|
|
326
328
|
removeOne(entity: TEntity): void;
|
|
327
329
|
removeMany(entities: TEntity[]): void;
|
|
330
|
+
clear(): void;
|
|
331
|
+
countAll(): number;
|
|
332
|
+
getAll(): TEntity[];
|
|
333
|
+
getAllPks(): TPk[];
|
|
328
334
|
protected upsertOneWithoutNotifications(entity: TEntity): TPk;
|
|
329
335
|
}
|
|
330
336
|
|
|
@@ -361,6 +367,10 @@ declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk>
|
|
|
361
367
|
removeOne(entity: TEntity): void;
|
|
362
368
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
363
369
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
370
|
+
clear(): void;
|
|
371
|
+
countAll(): number;
|
|
372
|
+
getAll(): TEntity[];
|
|
373
|
+
getAllPks(): TPk[];
|
|
364
374
|
}
|
|
365
375
|
|
|
366
376
|
/**
|
|
@@ -417,6 +427,8 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
|
|
|
417
427
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
418
428
|
getAll(): TEntity[];
|
|
419
429
|
countAll(): number;
|
|
430
|
+
clear(): void;
|
|
431
|
+
getAllPks(): TPk[];
|
|
420
432
|
}
|
|
421
433
|
|
|
422
434
|
type TOIMComparator<TEntity extends object> = (a: TEntity, b: TEntity) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -508,6 +508,12 @@ var OIMCollectionStoreMapDriven = class extends OIMCollectionStore {
|
|
|
508
508
|
countAll() {
|
|
509
509
|
return this.entities.size;
|
|
510
510
|
}
|
|
511
|
+
clear() {
|
|
512
|
+
this.entities.clear();
|
|
513
|
+
}
|
|
514
|
+
getAllPks() {
|
|
515
|
+
return Array.from(this.entities.keys());
|
|
516
|
+
}
|
|
511
517
|
};
|
|
512
518
|
|
|
513
519
|
// src/core/OIMEntityUpdaterFactory.ts
|
|
@@ -559,6 +565,19 @@ var OIMCollection = class {
|
|
|
559
565
|
this.store.removeManyByPks(pks);
|
|
560
566
|
this.emitter.emit(0 /* UPDATE */, { pks });
|
|
561
567
|
}
|
|
568
|
+
clear() {
|
|
569
|
+
this.store.clear();
|
|
570
|
+
this.emitter.emit(0 /* UPDATE */, { pks: [] });
|
|
571
|
+
}
|
|
572
|
+
countAll() {
|
|
573
|
+
return this.store.countAll();
|
|
574
|
+
}
|
|
575
|
+
getAll() {
|
|
576
|
+
return this.store.getAll();
|
|
577
|
+
}
|
|
578
|
+
getAllPks() {
|
|
579
|
+
return this.store.getAllPks();
|
|
580
|
+
}
|
|
562
581
|
upsertOneWithoutNotifications(entity) {
|
|
563
582
|
const pk = this.selectPk(entity);
|
|
564
583
|
const existingEntity = this.store.getOneByPk(pk);
|
|
@@ -639,6 +658,18 @@ var OIMReactiveCollection = class {
|
|
|
639
658
|
getManyByPks(pks) {
|
|
640
659
|
return this.collection.getManyByPks(pks);
|
|
641
660
|
}
|
|
661
|
+
clear() {
|
|
662
|
+
this.collection.clear();
|
|
663
|
+
}
|
|
664
|
+
countAll() {
|
|
665
|
+
return this.collection.countAll();
|
|
666
|
+
}
|
|
667
|
+
getAll() {
|
|
668
|
+
return this.collection.getAll();
|
|
669
|
+
}
|
|
670
|
+
getAllPks() {
|
|
671
|
+
return this.collection.getAllPks();
|
|
672
|
+
}
|
|
642
673
|
};
|
|
643
674
|
|
|
644
675
|
// src/core/OIMIndexManual.ts
|