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.
- package/@types/indexes/index.d.ts +3 -3
- package/@types/indexes/with-schemas/index.d.ts +3 -3
- package/@types/persisters/persister-electric-sql/index.d.ts +12 -0
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +12 -0
- package/@types/persisters/persister-sqlite3/index.d.ts +12 -0
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +12 -0
- package/@types/ui-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/agents.md +7 -0
- package/checkpoints/index.js +4 -2
- package/checkpoints/with-schemas/index.js +4 -2
- package/index.js +37 -4
- package/metrics/index.js +2 -1
- package/metrics/with-schemas/index.js +2 -1
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/metrics/index.js +1 -1
- package/min/metrics/index.js.gz +0 -0
- package/min/metrics/with-schemas/index.js +1 -1
- package/min/metrics/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/relationships/index.js +1 -1
- package/min/relationships/index.js.gz +0 -0
- package/min/relationships/with-schemas/index.js +1 -1
- package/min/relationships/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +38 -5
- package/omni/with-schemas/index.js +38 -5
- package/package.json +5 -5
- package/queries/index.js +2 -1
- package/queries/with-schemas/index.js +2 -1
- package/readme.md +14 -14
- package/relationships/index.js +39 -9
- package/relationships/with-schemas/index.js +39 -9
- package/releases.md +72 -72
- package/synchronizers/synchronizer-local/index.js +1 -1
- package/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/with-schemas/index.js +37 -4
package/relationships/index.js
CHANGED
|
@@ -17,6 +17,14 @@ const isArray = (thing) => Array.isArray(thing);
|
|
|
17
17
|
const size = (thing) => thing.length;
|
|
18
18
|
const test = (regex, subject) => regex.test(subject);
|
|
19
19
|
|
|
20
|
+
const arrayEvery = (array, cb) => array.every(cb);
|
|
21
|
+
const arrayIsEqual = (array1, array2) =>
|
|
22
|
+
size(array1) === size(array2) &&
|
|
23
|
+
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
24
|
+
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
25
|
+
const arrayPush = (array, ...values) => array.push(...values);
|
|
26
|
+
const arrayShift = (array) => array.shift();
|
|
27
|
+
|
|
20
28
|
const collSizeN = (collSizer) => (coll) => {
|
|
21
29
|
let total = 0;
|
|
22
30
|
for (const child of coll.values()) {
|
|
@@ -34,14 +42,6 @@ const collClear = (coll) => coll.clear();
|
|
|
34
42
|
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
35
43
|
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
36
44
|
|
|
37
|
-
const arrayEvery = (array, cb) => array.every(cb);
|
|
38
|
-
const arrayIsEqual = (array1, array2) =>
|
|
39
|
-
size(array1) === size(array2) &&
|
|
40
|
-
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
41
|
-
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
42
|
-
const arrayPush = (array, ...values) => array.push(...values);
|
|
43
|
-
const arrayShift = (array) => array.shift();
|
|
44
|
-
|
|
45
45
|
const tryCatchSync = (action, onError) => {
|
|
46
46
|
try {
|
|
47
47
|
return action();
|
|
@@ -467,11 +467,21 @@ const createRelationships = getCreateFunction((store) => {
|
|
|
467
467
|
remoteTableId,
|
|
468
468
|
getRemoteRowId2,
|
|
469
469
|
) => {
|
|
470
|
+
mapForEach(mapGet(linkedRowIdsListeners, relationshipId), (firstRowId) =>
|
|
471
|
+
getLinkedRowIdsCache(relationshipId, firstRowId),
|
|
472
|
+
);
|
|
470
473
|
mapSet(remoteTableIds, relationshipId, remoteTableId);
|
|
471
474
|
setDefinitionAndListen(
|
|
472
475
|
relationshipId,
|
|
473
476
|
localTableId,
|
|
474
|
-
(
|
|
477
|
+
(
|
|
478
|
+
change,
|
|
479
|
+
changedRemoteRowIds,
|
|
480
|
+
_changedSortKeys,
|
|
481
|
+
_rowValues,
|
|
482
|
+
_sortKeys,
|
|
483
|
+
force,
|
|
484
|
+
) => {
|
|
475
485
|
const changedLocalRows = setNew();
|
|
476
486
|
const changedRemoteRows = setNew();
|
|
477
487
|
const changedLinkedRows = setNew();
|
|
@@ -516,6 +526,26 @@ const createRelationships = getCreateFunction((store) => {
|
|
|
516
526
|
},
|
|
517
527
|
);
|
|
518
528
|
change();
|
|
529
|
+
if (force) {
|
|
530
|
+
mapForEach(
|
|
531
|
+
mapGet(linkedRowIdsListeners, relationshipId),
|
|
532
|
+
(firstRowId) => {
|
|
533
|
+
const oldLinkedRowIds = getLinkedRowIds(
|
|
534
|
+
relationshipId,
|
|
535
|
+
firstRowId,
|
|
536
|
+
);
|
|
537
|
+
delLinkedRowIdsCache(relationshipId, firstRowId);
|
|
538
|
+
if (
|
|
539
|
+
!arrayIsEqual(
|
|
540
|
+
oldLinkedRowIds,
|
|
541
|
+
getLinkedRowIds(relationshipId, firstRowId),
|
|
542
|
+
)
|
|
543
|
+
) {
|
|
544
|
+
setAdd(changedLinkedRows, firstRowId);
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
);
|
|
548
|
+
}
|
|
519
549
|
collForEach(changedLocalRows, (localRowId) =>
|
|
520
550
|
callListeners(remoteRowIdListeners, [relationshipId, localRowId]),
|
|
521
551
|
);
|
|
@@ -17,6 +17,14 @@ const isArray = (thing) => Array.isArray(thing);
|
|
|
17
17
|
const size = (thing) => thing.length;
|
|
18
18
|
const test = (regex, subject) => regex.test(subject);
|
|
19
19
|
|
|
20
|
+
const arrayEvery = (array, cb) => array.every(cb);
|
|
21
|
+
const arrayIsEqual = (array1, array2) =>
|
|
22
|
+
size(array1) === size(array2) &&
|
|
23
|
+
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
24
|
+
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
25
|
+
const arrayPush = (array, ...values) => array.push(...values);
|
|
26
|
+
const arrayShift = (array) => array.shift();
|
|
27
|
+
|
|
20
28
|
const collSizeN = (collSizer) => (coll) => {
|
|
21
29
|
let total = 0;
|
|
22
30
|
for (const child of coll.values()) {
|
|
@@ -34,14 +42,6 @@ const collClear = (coll) => coll.clear();
|
|
|
34
42
|
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
35
43
|
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
36
44
|
|
|
37
|
-
const arrayEvery = (array, cb) => array.every(cb);
|
|
38
|
-
const arrayIsEqual = (array1, array2) =>
|
|
39
|
-
size(array1) === size(array2) &&
|
|
40
|
-
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
41
|
-
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
42
|
-
const arrayPush = (array, ...values) => array.push(...values);
|
|
43
|
-
const arrayShift = (array) => array.shift();
|
|
44
|
-
|
|
45
45
|
const tryCatchSync = (action, onError) => {
|
|
46
46
|
try {
|
|
47
47
|
return action();
|
|
@@ -467,11 +467,21 @@ const createRelationships = getCreateFunction((store) => {
|
|
|
467
467
|
remoteTableId,
|
|
468
468
|
getRemoteRowId2,
|
|
469
469
|
) => {
|
|
470
|
+
mapForEach(mapGet(linkedRowIdsListeners, relationshipId), (firstRowId) =>
|
|
471
|
+
getLinkedRowIdsCache(relationshipId, firstRowId),
|
|
472
|
+
);
|
|
470
473
|
mapSet(remoteTableIds, relationshipId, remoteTableId);
|
|
471
474
|
setDefinitionAndListen(
|
|
472
475
|
relationshipId,
|
|
473
476
|
localTableId,
|
|
474
|
-
(
|
|
477
|
+
(
|
|
478
|
+
change,
|
|
479
|
+
changedRemoteRowIds,
|
|
480
|
+
_changedSortKeys,
|
|
481
|
+
_rowValues,
|
|
482
|
+
_sortKeys,
|
|
483
|
+
force,
|
|
484
|
+
) => {
|
|
475
485
|
const changedLocalRows = setNew();
|
|
476
486
|
const changedRemoteRows = setNew();
|
|
477
487
|
const changedLinkedRows = setNew();
|
|
@@ -516,6 +526,26 @@ const createRelationships = getCreateFunction((store) => {
|
|
|
516
526
|
},
|
|
517
527
|
);
|
|
518
528
|
change();
|
|
529
|
+
if (force) {
|
|
530
|
+
mapForEach(
|
|
531
|
+
mapGet(linkedRowIdsListeners, relationshipId),
|
|
532
|
+
(firstRowId) => {
|
|
533
|
+
const oldLinkedRowIds = getLinkedRowIds(
|
|
534
|
+
relationshipId,
|
|
535
|
+
firstRowId,
|
|
536
|
+
);
|
|
537
|
+
delLinkedRowIdsCache(relationshipId, firstRowId);
|
|
538
|
+
if (
|
|
539
|
+
!arrayIsEqual(
|
|
540
|
+
oldLinkedRowIds,
|
|
541
|
+
getLinkedRowIds(relationshipId, firstRowId),
|
|
542
|
+
)
|
|
543
|
+
) {
|
|
544
|
+
setAdd(changedLinkedRows, firstRowId);
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
);
|
|
548
|
+
}
|
|
519
549
|
collForEach(changedLocalRows, (localRowId) =>
|
|
520
550
|
callListeners(remoteRowIdListeners, [relationshipId, localRowId]),
|
|
521
551
|
);
|