tinybase 9.7.0-beta.1 → 9.7.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.
Files changed (66) hide show
  1. package/@types/indexes/index.d.ts +3 -3
  2. package/@types/indexes/with-schemas/index.d.ts +3 -3
  3. package/@types/persisters/persister-electric-sql/index.d.ts +12 -0
  4. package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +12 -0
  5. package/@types/persisters/persister-sqlite3/index.d.ts +12 -0
  6. package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +12 -0
  7. package/@types/ui-react-dom/index.d.ts +10 -10
  8. package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
  9. package/@types/ui-react-dom-charts/index.d.ts +7 -7
  10. package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
  11. package/@types/ui-react-inspector/index.d.ts +1 -1
  12. package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
  13. package/@types/ui-solid-dom/index.d.ts +10 -10
  14. package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
  15. package/@types/ui-solid-inspector/index.d.ts +1 -1
  16. package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
  17. package/@types/ui-svelte-dom/index.d.ts +10 -10
  18. package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
  19. package/@types/ui-svelte-inspector/index.d.ts +1 -1
  20. package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
  21. package/agents.md +7 -0
  22. package/checkpoints/index.js +4 -2
  23. package/checkpoints/with-schemas/index.js +4 -2
  24. package/index.js +37 -4
  25. package/metrics/index.js +2 -1
  26. package/metrics/with-schemas/index.js +2 -1
  27. package/min/checkpoints/index.js +1 -1
  28. package/min/checkpoints/index.js.gz +0 -0
  29. package/min/checkpoints/with-schemas/index.js +1 -1
  30. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  31. package/min/index.js +1 -1
  32. package/min/index.js.gz +0 -0
  33. package/min/metrics/index.js +1 -1
  34. package/min/metrics/index.js.gz +0 -0
  35. package/min/metrics/with-schemas/index.js +1 -1
  36. package/min/metrics/with-schemas/index.js.gz +0 -0
  37. package/min/omni/index.js +1 -1
  38. package/min/omni/index.js.gz +0 -0
  39. package/min/omni/with-schemas/index.js +1 -1
  40. package/min/omni/with-schemas/index.js.gz +0 -0
  41. package/min/queries/index.js +1 -1
  42. package/min/queries/index.js.gz +0 -0
  43. package/min/queries/with-schemas/index.js +1 -1
  44. package/min/queries/with-schemas/index.js.gz +0 -0
  45. package/min/relationships/index.js +1 -1
  46. package/min/relationships/index.js.gz +0 -0
  47. package/min/relationships/with-schemas/index.js +1 -1
  48. package/min/relationships/with-schemas/index.js.gz +0 -0
  49. package/min/synchronizers/synchronizer-local/index.js +1 -1
  50. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  51. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  52. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  53. package/min/with-schemas/index.js +1 -1
  54. package/min/with-schemas/index.js.gz +0 -0
  55. package/omni/index.js +38 -5
  56. package/omni/with-schemas/index.js +38 -5
  57. package/package.json +5 -5
  58. package/queries/index.js +2 -1
  59. package/queries/with-schemas/index.js +2 -1
  60. package/readme.md +14 -14
  61. package/relationships/index.js +39 -9
  62. package/relationships/with-schemas/index.js +39 -9
  63. package/releases.md +72 -72
  64. package/synchronizers/synchronizer-local/index.js +1 -1
  65. package/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  66. package/with-schemas/index.js +37 -4
@@ -1213,7 +1213,7 @@ const createLocalSynchronizer = (store, onSend, onReceive, onIgnoredError) => {
1213
1213
  send,
1214
1214
  registerReceive,
1215
1215
  destroy,
1216
- 0.01,
1216
+ 0.05,
1217
1217
  onSend,
1218
1218
  onReceive,
1219
1219
  onIgnoredError,
@@ -1213,7 +1213,7 @@ const createLocalSynchronizer = (store, onSend, onReceive, onIgnoredError) => {
1213
1213
  send,
1214
1214
  registerReceive,
1215
1215
  destroy,
1216
- 0.01,
1216
+ 0.05,
1217
1217
  onSend,
1218
1218
  onReceive,
1219
1219
  onIgnoredError,
@@ -898,7 +898,8 @@ const createCheckpoints = getCreateFunction(
898
898
  cellOrValueIsEqual(oldNew[0], newCell) &&
899
899
  collIsEmpty(mapSet(row, cellId)) &&
900
900
  collIsEmpty(mapSet(table, rowId)) &&
901
- collIsEmpty(mapSet(cellsDelta, tableId))
901
+ collIsEmpty(mapSet(cellsDelta, tableId)) &&
902
+ collIsEmpty(valuesDelta)
902
903
  ) {
903
904
  storeUnchanged();
904
905
  }
@@ -918,7 +919,8 @@ const createCheckpoints = getCreateFunction(
918
919
  oldNew[1] = newValue;
919
920
  if (
920
921
  cellOrValueIsEqual(oldNew[0], newValue) &&
921
- collIsEmpty(mapSet(valuesDelta, valueId))
922
+ collIsEmpty(mapSet(valuesDelta, valueId)) &&
923
+ collIsEmpty(cellsDelta)
922
924
  ) {
923
925
  storeUnchanged();
924
926
  }
@@ -4160,7 +4162,8 @@ const numericAggregators = mapNew([
4160
4162
  [
4161
4163
  (numbers, length) => arraySum(numbers) / length,
4162
4164
  (metric, add, length) => metric + (add - metric) / (length + 1),
4163
- (metric, remove, length) => metric + (metric - remove) / (length - 1),
4165
+ (metric, remove, length) =>
4166
+ length > 1 ? metric + (metric - remove) / (length - 1) : void 0,
4164
4167
  (metric, add, remove, length) => metric + (add - remove) / length,
4165
4168
  ],
4166
4169
  ],
@@ -5680,11 +5683,21 @@ const createRelationships = getCreateFunction((store) => {
5680
5683
  remoteTableId,
5681
5684
  getRemoteRowId2,
5682
5685
  ) => {
5686
+ mapForEach(mapGet(linkedRowIdsListeners, relationshipId), (firstRowId) =>
5687
+ getLinkedRowIdsCache(relationshipId, firstRowId),
5688
+ );
5683
5689
  mapSet(remoteTableIds, relationshipId, remoteTableId);
5684
5690
  setDefinitionAndListen(
5685
5691
  relationshipId,
5686
5692
  localTableId,
5687
- (change, changedRemoteRowIds) => {
5693
+ (
5694
+ change,
5695
+ changedRemoteRowIds,
5696
+ _changedSortKeys,
5697
+ _rowValues,
5698
+ _sortKeys,
5699
+ force,
5700
+ ) => {
5688
5701
  const changedLocalRows = setNew();
5689
5702
  const changedRemoteRows = setNew();
5690
5703
  const changedLinkedRows = setNew();
@@ -5729,6 +5742,26 @@ const createRelationships = getCreateFunction((store) => {
5729
5742
  },
5730
5743
  );
5731
5744
  change();
5745
+ if (force) {
5746
+ mapForEach(
5747
+ mapGet(linkedRowIdsListeners, relationshipId),
5748
+ (firstRowId) => {
5749
+ const oldLinkedRowIds = getLinkedRowIds(
5750
+ relationshipId,
5751
+ firstRowId,
5752
+ );
5753
+ delLinkedRowIdsCache(relationshipId, firstRowId);
5754
+ if (
5755
+ !arrayIsEqual(
5756
+ oldLinkedRowIds,
5757
+ getLinkedRowIds(relationshipId, firstRowId),
5758
+ )
5759
+ ) {
5760
+ setAdd(changedLinkedRows, firstRowId);
5761
+ }
5762
+ },
5763
+ );
5764
+ }
5732
5765
  collForEach(changedLocalRows, (localRowId) =>
5733
5766
  callListeners(remoteRowIdListeners, [relationshipId, localRowId]),
5734
5767
  );