tinybase 0.9.2 → 1.0.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/LICENSE +1 -1
- package/lib/checkpoints.d.ts +38 -20
- package/lib/common.d.ts +56 -0
- package/lib/common.js +1 -0
- package/lib/common.js.gz +0 -0
- package/lib/debug/checkpoints.d.ts +38 -20
- package/lib/debug/common.d.ts +56 -0
- package/lib/debug/common.js +3 -0
- package/lib/debug/indexes.d.ts +39 -76
- package/lib/debug/indexes.js +17 -9
- package/lib/debug/metrics.d.ts +49 -20
- package/lib/debug/persisters.d.ts +207 -17
- package/lib/debug/relationships.d.ts +48 -23
- package/lib/debug/store.d.ts +184 -102
- package/lib/debug/tinybase.d.ts +1 -2
- package/lib/debug/tinybase.js +16 -8
- package/lib/debug/ui-react.d.ts +271 -163
- package/lib/debug/ui-react.js +24 -15
- package/lib/indexes.d.ts +39 -76
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.d.ts +49 -20
- package/lib/persisters.d.ts +207 -17
- package/lib/relationships.d.ts +48 -23
- package/lib/store.d.ts +184 -102
- package/lib/tinybase.d.ts +1 -2
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/ui-react.d.ts +271 -163
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/common.js +1 -0
- package/lib/umd/common.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/package.json +24 -15
- package/readme.md +13 -13
package/lib/debug/tinybase.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This everything.
|
|
2
|
+
* This is everything.
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
@@ -9,6 +9,5 @@ export * from './common';
|
|
|
9
9
|
export * from './indexes';
|
|
10
10
|
export * from './metrics';
|
|
11
11
|
export * from './persisters';
|
|
12
|
-
export * from './react';
|
|
13
12
|
export * from './relationships';
|
|
14
13
|
export * from './store';
|
package/lib/debug/tinybase.js
CHANGED
|
@@ -509,6 +509,8 @@ const createCheckpoints = getCreateFunction((store) => {
|
|
|
509
509
|
return objFreeze(checkpoints.clear());
|
|
510
510
|
});
|
|
511
511
|
|
|
512
|
+
const defaultSorter = (sortKey1, sortKey2) => (sortKey1 < sortKey2 ? -1 : 1);
|
|
513
|
+
|
|
512
514
|
const createIndexes = getCreateFunction((store) => {
|
|
513
515
|
const sliceIdsListeners = mapNew();
|
|
514
516
|
const sliceRowIdsListeners = mapNew();
|
|
@@ -541,7 +543,7 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
541
543
|
setDefinition(
|
|
542
544
|
indexId,
|
|
543
545
|
tableId,
|
|
544
|
-
(change, changedSliceIds, changedSortKeys, sliceIds, sortKeys) => {
|
|
546
|
+
(change, changedSliceIds, changedSortKeys, sliceIds, sortKeys, force) => {
|
|
545
547
|
let sliceIdsChanged = 0;
|
|
546
548
|
const changedSlices = setNew();
|
|
547
549
|
const unsortedSlices = setNew();
|
|
@@ -570,12 +572,16 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
570
572
|
}
|
|
571
573
|
});
|
|
572
574
|
change();
|
|
573
|
-
mapForEach(changedSortKeys, (rowId) =>
|
|
574
|
-
ifNotUndefined(mapGet(sliceIds, rowId), (sliceId) =>
|
|
575
|
-
setAdd(unsortedSlices, sliceId),
|
|
576
|
-
),
|
|
577
|
-
);
|
|
578
575
|
if (!collIsEmpty(sortKeys)) {
|
|
576
|
+
if (force) {
|
|
577
|
+
mapForEach(index, (sliceId) => setAdd(unsortedSlices, sliceId));
|
|
578
|
+
} else {
|
|
579
|
+
mapForEach(changedSortKeys, (rowId) =>
|
|
580
|
+
ifNotUndefined(mapGet(sliceIds, rowId), (sliceId) =>
|
|
581
|
+
setAdd(unsortedSlices, sliceId),
|
|
582
|
+
),
|
|
583
|
+
);
|
|
584
|
+
}
|
|
579
585
|
collForEach(unsortedSlices, (sliceId) => {
|
|
580
586
|
const rowIdArraySorter = (rowId1, rowId2) =>
|
|
581
587
|
rowIdSorter(
|
|
@@ -594,7 +600,7 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
594
600
|
}
|
|
595
601
|
});
|
|
596
602
|
}
|
|
597
|
-
if (sliceIdsChanged) {
|
|
603
|
+
if (sliceIdsChanged || force) {
|
|
598
604
|
if (!isUndefined(sliceIdArraySorter)) {
|
|
599
605
|
const indexArray = [...index];
|
|
600
606
|
if (!arrayIsSorted(indexArray, sliceIdArraySorter)) {
|
|
@@ -602,8 +608,11 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
602
608
|
indexId,
|
|
603
609
|
mapNew(arraySort(indexArray, sliceIdArraySorter)),
|
|
604
610
|
);
|
|
611
|
+
sliceIdsChanged = 1;
|
|
605
612
|
}
|
|
606
613
|
}
|
|
614
|
+
}
|
|
615
|
+
if (sliceIdsChanged) {
|
|
607
616
|
callListeners(sliceIdsListeners, [indexId]);
|
|
608
617
|
}
|
|
609
618
|
collForEach(changedSlices, (sliceId) =>
|
|
@@ -650,7 +659,6 @@ const createIndexes = getCreateFunction((store) => {
|
|
|
650
659
|
};
|
|
651
660
|
return objFreeze(indexes);
|
|
652
661
|
});
|
|
653
|
-
const defaultSorter = (sortKey1, sortKey2) => (sortKey1 < sortKey2 ? -1 : 1);
|
|
654
662
|
|
|
655
663
|
const aggregators = mapNew([
|
|
656
664
|
[
|