tinybase 7.2.0-beta.2 → 7.2.0
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/queries/index.d.ts +333 -4
- package/@types/queries/with-schemas/index.d.ts +359 -4
- package/@types/ui-react/index.d.ts +477 -8
- package/@types/ui-react/with-schemas/index.d.ts +519 -8
- package/agents.md +34 -0
- package/index.js +100 -18
- package/min/index.js +1 -1
- package/min/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/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/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 +173 -48
- package/omni/with-schemas/index.js +173 -48
- package/package.json +3 -3
- package/queries/index.js +120 -18
- package/queries/with-schemas/index.js +120 -18
- package/readme.md +13 -13
- package/releases.md +40 -40
- package/ui-react/index.js +98 -30
- package/ui-react/with-schemas/index.js +98 -30
- package/ui-react-dom/index.js +38 -15
- package/ui-react-dom/with-schemas/index.js +38 -15
- package/ui-react-inspector/index.js +40 -17
- package/ui-react-inspector/with-schemas/index.js +40 -17
- package/with-schemas/index.js +100 -18
package/ui-react/index.js
CHANGED
|
@@ -60,6 +60,10 @@ const arrayEvery = (array, cb) => array.every(cb);
|
|
|
60
60
|
const arrayIsEqual = (array1, array2) =>
|
|
61
61
|
size(array1) === size(array2) &&
|
|
62
62
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
63
|
+
const arrayOrValueEqual = (value1, value2) =>
|
|
64
|
+
isArray(value1) && isArray(value2)
|
|
65
|
+
? arrayIsEqual(value1, value2)
|
|
66
|
+
: value1 === value2;
|
|
63
67
|
const arrayMap = (array, cb) => array.map(cb);
|
|
64
68
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
65
69
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
@@ -87,16 +91,23 @@ const objDel = (obj, id) => {
|
|
|
87
91
|
return obj;
|
|
88
92
|
};
|
|
89
93
|
const objSize = (obj) => size(objIds(obj));
|
|
90
|
-
|
|
94
|
+
|
|
95
|
+
/* istanbul ignore next */
|
|
96
|
+
const objIsEqual = (
|
|
97
|
+
obj1,
|
|
98
|
+
obj2,
|
|
99
|
+
isEqual = (value1, value2) => value1 === value2,
|
|
100
|
+
) => {
|
|
91
101
|
const entries1 = objEntries(obj1);
|
|
92
102
|
return (
|
|
93
103
|
size(entries1) === objSize(obj2) &&
|
|
94
104
|
arrayEvery(entries1, ([index, value1]) =>
|
|
95
105
|
isObject(value1)
|
|
96
|
-
?
|
|
106
|
+
? /* istanbul ignore next */
|
|
107
|
+
isObject(obj2[index])
|
|
97
108
|
? objIsEqual(obj2[index], value1)
|
|
98
109
|
: false
|
|
99
|
-
: obj2[index]
|
|
110
|
+
: isEqual(value1, obj2[index]),
|
|
100
111
|
)
|
|
101
112
|
);
|
|
102
113
|
};
|
|
@@ -317,7 +328,16 @@ const Provider = ({
|
|
|
317
328
|
};
|
|
318
329
|
|
|
319
330
|
const EMPTY_ARRAY = [];
|
|
320
|
-
const DEFAULTS = [
|
|
331
|
+
const DEFAULTS = [
|
|
332
|
+
{},
|
|
333
|
+
[],
|
|
334
|
+
[EMPTY_ARRAY, void 0, EMPTY_ARRAY],
|
|
335
|
+
{},
|
|
336
|
+
void 0,
|
|
337
|
+
void 0,
|
|
338
|
+
false,
|
|
339
|
+
0,
|
|
340
|
+
];
|
|
321
341
|
const IS_EQUALS = [
|
|
322
342
|
objIsEqual,
|
|
323
343
|
arrayIsEqual,
|
|
@@ -328,6 +348,9 @@ const IS_EQUALS = [
|
|
|
328
348
|
currentId1 === currentId2 &&
|
|
329
349
|
arrayIsEqual(backwardIds1, backwardIds2) &&
|
|
330
350
|
arrayIsEqual(forwardIds1, forwardIds2),
|
|
351
|
+
(paramValues1, paramValues2) =>
|
|
352
|
+
objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
|
|
353
|
+
arrayOrValueEqual,
|
|
331
354
|
];
|
|
332
355
|
const isEqual = (thing1, thing2) => thing1 === thing2;
|
|
333
356
|
const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
|
|
@@ -354,7 +377,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
354
377
|
const getResult = useCallback(
|
|
355
378
|
() => {
|
|
356
379
|
const nextResult =
|
|
357
|
-
thing?.[(returnType ==
|
|
380
|
+
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
358
381
|
...args,
|
|
359
382
|
) ?? DEFAULTS[returnType];
|
|
360
383
|
return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
|
|
@@ -368,7 +391,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
368
391
|
(listener) =>
|
|
369
392
|
addAndDelListener(
|
|
370
393
|
thing,
|
|
371
|
-
(returnType ==
|
|
394
|
+
(returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
|
|
372
395
|
...args,
|
|
373
396
|
listener,
|
|
374
397
|
),
|
|
@@ -398,7 +421,7 @@ const useSetCallback = (
|
|
|
398
421
|
getDeps = EMPTY_ARRAY,
|
|
399
422
|
then = getUndefined,
|
|
400
423
|
thenDeps = EMPTY_ARRAY,
|
|
401
|
-
methodPrefix
|
|
424
|
+
methodPrefix,
|
|
402
425
|
...args
|
|
403
426
|
) =>
|
|
404
427
|
useCallback(
|
|
@@ -429,9 +452,9 @@ const useStoreSetCallback = (
|
|
|
429
452
|
storeOrStoreId,
|
|
430
453
|
settable,
|
|
431
454
|
get,
|
|
432
|
-
getDeps
|
|
433
|
-
then
|
|
434
|
-
thenDeps
|
|
455
|
+
getDeps,
|
|
456
|
+
then,
|
|
457
|
+
thenDeps,
|
|
435
458
|
...args
|
|
436
459
|
) =>
|
|
437
460
|
useSetCallback(
|
|
@@ -448,9 +471,9 @@ const useQueriesSetCallback = (
|
|
|
448
471
|
queriesOrQueriesId,
|
|
449
472
|
settable,
|
|
450
473
|
get,
|
|
451
|
-
getDeps
|
|
452
|
-
then
|
|
453
|
-
thenDeps
|
|
474
|
+
getDeps,
|
|
475
|
+
then,
|
|
476
|
+
thenDeps,
|
|
454
477
|
...args
|
|
455
478
|
) =>
|
|
456
479
|
useSetCallback(
|
|
@@ -538,7 +561,7 @@ const useHasTables = (storeOrStoreId) =>
|
|
|
538
561
|
useListenable(
|
|
539
562
|
TABLES,
|
|
540
563
|
useStoreOrStoreById(storeOrStoreId),
|
|
541
|
-
|
|
564
|
+
6 /* Boolean */,
|
|
542
565
|
[],
|
|
543
566
|
);
|
|
544
567
|
const useTables = (storeOrStoreId) =>
|
|
@@ -546,7 +569,7 @@ const useTables = (storeOrStoreId) =>
|
|
|
546
569
|
const useTableIds = (storeOrStoreId) =>
|
|
547
570
|
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
548
571
|
const useHasTable = (tableId, storeOrStoreId) =>
|
|
549
|
-
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId),
|
|
572
|
+
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
550
573
|
tableId,
|
|
551
574
|
]);
|
|
552
575
|
const useTable = (tableId, storeOrStoreId) =>
|
|
@@ -564,14 +587,14 @@ const useHasTableCell = (tableId, cellId, storeOrStoreId) =>
|
|
|
564
587
|
useListenable(
|
|
565
588
|
TABLE + CELL,
|
|
566
589
|
useStoreOrStoreById(storeOrStoreId),
|
|
567
|
-
|
|
590
|
+
6 /* Boolean */,
|
|
568
591
|
[tableId, cellId],
|
|
569
592
|
);
|
|
570
593
|
const useRowCount = (tableId, storeOrStoreId) =>
|
|
571
594
|
useListenable(
|
|
572
595
|
ROW_COUNT,
|
|
573
596
|
useStoreOrStoreById(storeOrStoreId),
|
|
574
|
-
|
|
597
|
+
7 /* Number */,
|
|
575
598
|
[tableId],
|
|
576
599
|
);
|
|
577
600
|
const useRowIds = (tableId, storeOrStoreId) =>
|
|
@@ -606,7 +629,7 @@ const useSortedRowIds = (
|
|
|
606
629
|
]),
|
|
607
630
|
);
|
|
608
631
|
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
609
|
-
useListenable(ROW, useStoreOrStoreById(storeOrStoreId),
|
|
632
|
+
useListenable(ROW, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
610
633
|
tableId,
|
|
611
634
|
rowId,
|
|
612
635
|
]);
|
|
@@ -621,7 +644,7 @@ const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
|
621
644
|
rowId,
|
|
622
645
|
]);
|
|
623
646
|
const useHasCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
624
|
-
useListenable(CELL, useStoreOrStoreById(storeOrStoreId),
|
|
647
|
+
useListenable(CELL, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
625
648
|
tableId,
|
|
626
649
|
rowId,
|
|
627
650
|
cellId,
|
|
@@ -630,14 +653,14 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
630
653
|
useListenable(
|
|
631
654
|
CELL,
|
|
632
655
|
useStoreOrStoreById(storeOrStoreId),
|
|
633
|
-
|
|
656
|
+
5 /* CellOrValue */,
|
|
634
657
|
[tableId, rowId, cellId],
|
|
635
658
|
);
|
|
636
659
|
const useHasValues = (storeOrStoreId) =>
|
|
637
660
|
useListenable(
|
|
638
661
|
VALUES,
|
|
639
662
|
useStoreOrStoreById(storeOrStoreId),
|
|
640
|
-
|
|
663
|
+
6 /* Boolean */,
|
|
641
664
|
[],
|
|
642
665
|
);
|
|
643
666
|
const useValues = (storeOrStoreId) =>
|
|
@@ -645,14 +668,14 @@ const useValues = (storeOrStoreId) =>
|
|
|
645
668
|
const useValueIds = (storeOrStoreId) =>
|
|
646
669
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
647
670
|
const useHasValue = (valueId, storeOrStoreId) =>
|
|
648
|
-
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId),
|
|
671
|
+
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
649
672
|
valueId,
|
|
650
673
|
]);
|
|
651
674
|
const useValue = (valueId, storeOrStoreId) =>
|
|
652
675
|
useListenable(
|
|
653
676
|
VALUE,
|
|
654
677
|
useStoreOrStoreById(storeOrStoreId),
|
|
655
|
-
|
|
678
|
+
5 /* CellOrValue */,
|
|
656
679
|
[valueId],
|
|
657
680
|
);
|
|
658
681
|
const useSetTablesCallback = (
|
|
@@ -1201,7 +1224,7 @@ const useMetric = (metricId, metricsOrMetricsId) =>
|
|
|
1201
1224
|
useListenable(
|
|
1202
1225
|
METRIC,
|
|
1203
1226
|
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
1204
|
-
|
|
1227
|
+
5 /* CellOrValue */,
|
|
1205
1228
|
[metricId],
|
|
1206
1229
|
);
|
|
1207
1230
|
const useMetricListener = (
|
|
@@ -1294,7 +1317,7 @@ const useRemoteRowId = (
|
|
|
1294
1317
|
useListenable(
|
|
1295
1318
|
REMOTE_ROW_ID,
|
|
1296
1319
|
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
1297
|
-
|
|
1320
|
+
5 /* CellOrValue */,
|
|
1298
1321
|
[relationshipId, localRowId],
|
|
1299
1322
|
);
|
|
1300
1323
|
const useLocalRowIds = (
|
|
@@ -1393,7 +1416,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
|
|
|
1393
1416
|
useListenable(
|
|
1394
1417
|
RESULT + ROW_COUNT,
|
|
1395
1418
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1396
|
-
|
|
1419
|
+
7 /* Number */,
|
|
1397
1420
|
[queryId],
|
|
1398
1421
|
);
|
|
1399
1422
|
const useResultRowIds = (queryId, queriesOrQueriesId) =>
|
|
@@ -1435,7 +1458,7 @@ const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
|
|
|
1435
1458
|
useListenable(
|
|
1436
1459
|
RESULT + CELL,
|
|
1437
1460
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1438
|
-
|
|
1461
|
+
5 /* CellOrValue */,
|
|
1439
1462
|
[queryId, rowId, cellId],
|
|
1440
1463
|
);
|
|
1441
1464
|
const useResultTableListener = (
|
|
@@ -1550,6 +1573,47 @@ const useResultCellListener = (
|
|
|
1550
1573
|
listenerDeps,
|
|
1551
1574
|
[queryId, rowId, cellId],
|
|
1552
1575
|
);
|
|
1576
|
+
const useParamValues = (queryId, queriesOrQueriesId) =>
|
|
1577
|
+
useListenable(
|
|
1578
|
+
'ParamValues',
|
|
1579
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1580
|
+
3 /* ParamValues */,
|
|
1581
|
+
[queryId],
|
|
1582
|
+
);
|
|
1583
|
+
const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
1584
|
+
useListenable(
|
|
1585
|
+
'ParamValue',
|
|
1586
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1587
|
+
4 /* ParamValue */,
|
|
1588
|
+
[queryId, paramId],
|
|
1589
|
+
);
|
|
1590
|
+
const useParamValuesListener = (
|
|
1591
|
+
queryId,
|
|
1592
|
+
listener,
|
|
1593
|
+
listenerDeps,
|
|
1594
|
+
queriesOrQueriesId,
|
|
1595
|
+
) =>
|
|
1596
|
+
useListener(
|
|
1597
|
+
'ParamValues',
|
|
1598
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1599
|
+
listener,
|
|
1600
|
+
listenerDeps,
|
|
1601
|
+
[queryId],
|
|
1602
|
+
);
|
|
1603
|
+
const useParamValueListener = (
|
|
1604
|
+
queryId,
|
|
1605
|
+
paramId,
|
|
1606
|
+
listener,
|
|
1607
|
+
listenerDeps,
|
|
1608
|
+
queriesOrQueriesId,
|
|
1609
|
+
) =>
|
|
1610
|
+
useListener(
|
|
1611
|
+
'ParamValue',
|
|
1612
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1613
|
+
listener,
|
|
1614
|
+
listenerDeps,
|
|
1615
|
+
[queryId, paramId],
|
|
1616
|
+
);
|
|
1553
1617
|
const useSetParamValueCallback = (
|
|
1554
1618
|
queryId,
|
|
1555
1619
|
paramId,
|
|
@@ -1604,7 +1668,7 @@ const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
|
|
|
1604
1668
|
useListenable(
|
|
1605
1669
|
CHECKPOINT,
|
|
1606
1670
|
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
1607
|
-
|
|
1671
|
+
5 /* CellOrValue */,
|
|
1608
1672
|
[checkpointId],
|
|
1609
1673
|
);
|
|
1610
1674
|
const useSetCheckpointCallback = (
|
|
@@ -1751,7 +1815,7 @@ const usePersisterStatus = (persisterOrPersisterId) =>
|
|
|
1751
1815
|
useListenable(
|
|
1752
1816
|
STATUS,
|
|
1753
1817
|
usePersisterOrPersisterById(persisterOrPersisterId),
|
|
1754
|
-
|
|
1818
|
+
7 /* Number */,
|
|
1755
1819
|
[],
|
|
1756
1820
|
);
|
|
1757
1821
|
const usePersisterStatusListener = (
|
|
@@ -1806,7 +1870,7 @@ const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
|
1806
1870
|
useListenable(
|
|
1807
1871
|
STATUS,
|
|
1808
1872
|
useSynchronizerOrSynchronizerById(synchronizerOrSynchronizerId),
|
|
1809
|
-
|
|
1873
|
+
7 /* Number */,
|
|
1810
1874
|
[],
|
|
1811
1875
|
);
|
|
1812
1876
|
const useSynchronizerStatusListener = (
|
|
@@ -2346,6 +2410,10 @@ export {
|
|
|
2346
2410
|
useMetrics,
|
|
2347
2411
|
useMetricsIds,
|
|
2348
2412
|
useMetricsOrMetricsById,
|
|
2413
|
+
useParamValue,
|
|
2414
|
+
useParamValueListener,
|
|
2415
|
+
useParamValues,
|
|
2416
|
+
useParamValuesListener,
|
|
2349
2417
|
usePersister,
|
|
2350
2418
|
usePersisterIds,
|
|
2351
2419
|
usePersisterOrPersisterById,
|
|
@@ -60,6 +60,10 @@ const arrayEvery = (array, cb) => array.every(cb);
|
|
|
60
60
|
const arrayIsEqual = (array1, array2) =>
|
|
61
61
|
size(array1) === size(array2) &&
|
|
62
62
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
63
|
+
const arrayOrValueEqual = (value1, value2) =>
|
|
64
|
+
isArray(value1) && isArray(value2)
|
|
65
|
+
? arrayIsEqual(value1, value2)
|
|
66
|
+
: value1 === value2;
|
|
63
67
|
const arrayMap = (array, cb) => array.map(cb);
|
|
64
68
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
65
69
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
@@ -87,16 +91,23 @@ const objDel = (obj, id) => {
|
|
|
87
91
|
return obj;
|
|
88
92
|
};
|
|
89
93
|
const objSize = (obj) => size(objIds(obj));
|
|
90
|
-
|
|
94
|
+
|
|
95
|
+
/* istanbul ignore next */
|
|
96
|
+
const objIsEqual = (
|
|
97
|
+
obj1,
|
|
98
|
+
obj2,
|
|
99
|
+
isEqual = (value1, value2) => value1 === value2,
|
|
100
|
+
) => {
|
|
91
101
|
const entries1 = objEntries(obj1);
|
|
92
102
|
return (
|
|
93
103
|
size(entries1) === objSize(obj2) &&
|
|
94
104
|
arrayEvery(entries1, ([index, value1]) =>
|
|
95
105
|
isObject(value1)
|
|
96
|
-
?
|
|
106
|
+
? /* istanbul ignore next */
|
|
107
|
+
isObject(obj2[index])
|
|
97
108
|
? objIsEqual(obj2[index], value1)
|
|
98
109
|
: false
|
|
99
|
-
: obj2[index]
|
|
110
|
+
: isEqual(value1, obj2[index]),
|
|
100
111
|
)
|
|
101
112
|
);
|
|
102
113
|
};
|
|
@@ -317,7 +328,16 @@ const Provider = ({
|
|
|
317
328
|
};
|
|
318
329
|
|
|
319
330
|
const EMPTY_ARRAY = [];
|
|
320
|
-
const DEFAULTS = [
|
|
331
|
+
const DEFAULTS = [
|
|
332
|
+
{},
|
|
333
|
+
[],
|
|
334
|
+
[EMPTY_ARRAY, void 0, EMPTY_ARRAY],
|
|
335
|
+
{},
|
|
336
|
+
void 0,
|
|
337
|
+
void 0,
|
|
338
|
+
false,
|
|
339
|
+
0,
|
|
340
|
+
];
|
|
321
341
|
const IS_EQUALS = [
|
|
322
342
|
objIsEqual,
|
|
323
343
|
arrayIsEqual,
|
|
@@ -328,6 +348,9 @@ const IS_EQUALS = [
|
|
|
328
348
|
currentId1 === currentId2 &&
|
|
329
349
|
arrayIsEqual(backwardIds1, backwardIds2) &&
|
|
330
350
|
arrayIsEqual(forwardIds1, forwardIds2),
|
|
351
|
+
(paramValues1, paramValues2) =>
|
|
352
|
+
objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
|
|
353
|
+
arrayOrValueEqual,
|
|
331
354
|
];
|
|
332
355
|
const isEqual = (thing1, thing2) => thing1 === thing2;
|
|
333
356
|
const useCreate = (store, create, createDeps = EMPTY_ARRAY) => {
|
|
@@ -354,7 +377,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
354
377
|
const getResult = useCallback(
|
|
355
378
|
() => {
|
|
356
379
|
const nextResult =
|
|
357
|
-
thing?.[(returnType ==
|
|
380
|
+
thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
|
|
358
381
|
...args,
|
|
359
382
|
) ?? DEFAULTS[returnType];
|
|
360
383
|
return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
|
|
@@ -368,7 +391,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
|
|
|
368
391
|
(listener) =>
|
|
369
392
|
addAndDelListener(
|
|
370
393
|
thing,
|
|
371
|
-
(returnType ==
|
|
394
|
+
(returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
|
|
372
395
|
...args,
|
|
373
396
|
listener,
|
|
374
397
|
),
|
|
@@ -398,7 +421,7 @@ const useSetCallback = (
|
|
|
398
421
|
getDeps = EMPTY_ARRAY,
|
|
399
422
|
then = getUndefined,
|
|
400
423
|
thenDeps = EMPTY_ARRAY,
|
|
401
|
-
methodPrefix
|
|
424
|
+
methodPrefix,
|
|
402
425
|
...args
|
|
403
426
|
) =>
|
|
404
427
|
useCallback(
|
|
@@ -429,9 +452,9 @@ const useStoreSetCallback = (
|
|
|
429
452
|
storeOrStoreId,
|
|
430
453
|
settable,
|
|
431
454
|
get,
|
|
432
|
-
getDeps
|
|
433
|
-
then
|
|
434
|
-
thenDeps
|
|
455
|
+
getDeps,
|
|
456
|
+
then,
|
|
457
|
+
thenDeps,
|
|
435
458
|
...args
|
|
436
459
|
) =>
|
|
437
460
|
useSetCallback(
|
|
@@ -448,9 +471,9 @@ const useQueriesSetCallback = (
|
|
|
448
471
|
queriesOrQueriesId,
|
|
449
472
|
settable,
|
|
450
473
|
get,
|
|
451
|
-
getDeps
|
|
452
|
-
then
|
|
453
|
-
thenDeps
|
|
474
|
+
getDeps,
|
|
475
|
+
then,
|
|
476
|
+
thenDeps,
|
|
454
477
|
...args
|
|
455
478
|
) =>
|
|
456
479
|
useSetCallback(
|
|
@@ -538,7 +561,7 @@ const useHasTables = (storeOrStoreId) =>
|
|
|
538
561
|
useListenable(
|
|
539
562
|
TABLES,
|
|
540
563
|
useStoreOrStoreById(storeOrStoreId),
|
|
541
|
-
|
|
564
|
+
6 /* Boolean */,
|
|
542
565
|
[],
|
|
543
566
|
);
|
|
544
567
|
const useTables = (storeOrStoreId) =>
|
|
@@ -546,7 +569,7 @@ const useTables = (storeOrStoreId) =>
|
|
|
546
569
|
const useTableIds = (storeOrStoreId) =>
|
|
547
570
|
useListenable(TABLE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
548
571
|
const useHasTable = (tableId, storeOrStoreId) =>
|
|
549
|
-
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId),
|
|
572
|
+
useListenable(TABLE, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
550
573
|
tableId,
|
|
551
574
|
]);
|
|
552
575
|
const useTable = (tableId, storeOrStoreId) =>
|
|
@@ -564,14 +587,14 @@ const useHasTableCell = (tableId, cellId, storeOrStoreId) =>
|
|
|
564
587
|
useListenable(
|
|
565
588
|
TABLE + CELL,
|
|
566
589
|
useStoreOrStoreById(storeOrStoreId),
|
|
567
|
-
|
|
590
|
+
6 /* Boolean */,
|
|
568
591
|
[tableId, cellId],
|
|
569
592
|
);
|
|
570
593
|
const useRowCount = (tableId, storeOrStoreId) =>
|
|
571
594
|
useListenable(
|
|
572
595
|
ROW_COUNT,
|
|
573
596
|
useStoreOrStoreById(storeOrStoreId),
|
|
574
|
-
|
|
597
|
+
7 /* Number */,
|
|
575
598
|
[tableId],
|
|
576
599
|
);
|
|
577
600
|
const useRowIds = (tableId, storeOrStoreId) =>
|
|
@@ -606,7 +629,7 @@ const useSortedRowIds = (
|
|
|
606
629
|
]),
|
|
607
630
|
);
|
|
608
631
|
const useHasRow = (tableId, rowId, storeOrStoreId) =>
|
|
609
|
-
useListenable(ROW, useStoreOrStoreById(storeOrStoreId),
|
|
632
|
+
useListenable(ROW, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
610
633
|
tableId,
|
|
611
634
|
rowId,
|
|
612
635
|
]);
|
|
@@ -621,7 +644,7 @@ const useCellIds = (tableId, rowId, storeOrStoreId) =>
|
|
|
621
644
|
rowId,
|
|
622
645
|
]);
|
|
623
646
|
const useHasCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
624
|
-
useListenable(CELL, useStoreOrStoreById(storeOrStoreId),
|
|
647
|
+
useListenable(CELL, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
625
648
|
tableId,
|
|
626
649
|
rowId,
|
|
627
650
|
cellId,
|
|
@@ -630,14 +653,14 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
|
|
|
630
653
|
useListenable(
|
|
631
654
|
CELL,
|
|
632
655
|
useStoreOrStoreById(storeOrStoreId),
|
|
633
|
-
|
|
656
|
+
5 /* CellOrValue */,
|
|
634
657
|
[tableId, rowId, cellId],
|
|
635
658
|
);
|
|
636
659
|
const useHasValues = (storeOrStoreId) =>
|
|
637
660
|
useListenable(
|
|
638
661
|
VALUES,
|
|
639
662
|
useStoreOrStoreById(storeOrStoreId),
|
|
640
|
-
|
|
663
|
+
6 /* Boolean */,
|
|
641
664
|
[],
|
|
642
665
|
);
|
|
643
666
|
const useValues = (storeOrStoreId) =>
|
|
@@ -645,14 +668,14 @@ const useValues = (storeOrStoreId) =>
|
|
|
645
668
|
const useValueIds = (storeOrStoreId) =>
|
|
646
669
|
useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
|
|
647
670
|
const useHasValue = (valueId, storeOrStoreId) =>
|
|
648
|
-
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId),
|
|
671
|
+
useListenable(VALUE, useStoreOrStoreById(storeOrStoreId), 6 /* Boolean */, [
|
|
649
672
|
valueId,
|
|
650
673
|
]);
|
|
651
674
|
const useValue = (valueId, storeOrStoreId) =>
|
|
652
675
|
useListenable(
|
|
653
676
|
VALUE,
|
|
654
677
|
useStoreOrStoreById(storeOrStoreId),
|
|
655
|
-
|
|
678
|
+
5 /* CellOrValue */,
|
|
656
679
|
[valueId],
|
|
657
680
|
);
|
|
658
681
|
const useSetTablesCallback = (
|
|
@@ -1201,7 +1224,7 @@ const useMetric = (metricId, metricsOrMetricsId) =>
|
|
|
1201
1224
|
useListenable(
|
|
1202
1225
|
METRIC,
|
|
1203
1226
|
useMetricsOrMetricsById(metricsOrMetricsId),
|
|
1204
|
-
|
|
1227
|
+
5 /* CellOrValue */,
|
|
1205
1228
|
[metricId],
|
|
1206
1229
|
);
|
|
1207
1230
|
const useMetricListener = (
|
|
@@ -1294,7 +1317,7 @@ const useRemoteRowId = (
|
|
|
1294
1317
|
useListenable(
|
|
1295
1318
|
REMOTE_ROW_ID,
|
|
1296
1319
|
useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
|
|
1297
|
-
|
|
1320
|
+
5 /* CellOrValue */,
|
|
1298
1321
|
[relationshipId, localRowId],
|
|
1299
1322
|
);
|
|
1300
1323
|
const useLocalRowIds = (
|
|
@@ -1393,7 +1416,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
|
|
|
1393
1416
|
useListenable(
|
|
1394
1417
|
RESULT + ROW_COUNT,
|
|
1395
1418
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1396
|
-
|
|
1419
|
+
7 /* Number */,
|
|
1397
1420
|
[queryId],
|
|
1398
1421
|
);
|
|
1399
1422
|
const useResultRowIds = (queryId, queriesOrQueriesId) =>
|
|
@@ -1435,7 +1458,7 @@ const useResultCell = (queryId, rowId, cellId, queriesOrQueriesId) =>
|
|
|
1435
1458
|
useListenable(
|
|
1436
1459
|
RESULT + CELL,
|
|
1437
1460
|
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1438
|
-
|
|
1461
|
+
5 /* CellOrValue */,
|
|
1439
1462
|
[queryId, rowId, cellId],
|
|
1440
1463
|
);
|
|
1441
1464
|
const useResultTableListener = (
|
|
@@ -1550,6 +1573,47 @@ const useResultCellListener = (
|
|
|
1550
1573
|
listenerDeps,
|
|
1551
1574
|
[queryId, rowId, cellId],
|
|
1552
1575
|
);
|
|
1576
|
+
const useParamValues = (queryId, queriesOrQueriesId) =>
|
|
1577
|
+
useListenable(
|
|
1578
|
+
'ParamValues',
|
|
1579
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1580
|
+
3 /* ParamValues */,
|
|
1581
|
+
[queryId],
|
|
1582
|
+
);
|
|
1583
|
+
const useParamValue = (queryId, paramId, queriesOrQueriesId) =>
|
|
1584
|
+
useListenable(
|
|
1585
|
+
'ParamValue',
|
|
1586
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1587
|
+
4 /* ParamValue */,
|
|
1588
|
+
[queryId, paramId],
|
|
1589
|
+
);
|
|
1590
|
+
const useParamValuesListener = (
|
|
1591
|
+
queryId,
|
|
1592
|
+
listener,
|
|
1593
|
+
listenerDeps,
|
|
1594
|
+
queriesOrQueriesId,
|
|
1595
|
+
) =>
|
|
1596
|
+
useListener(
|
|
1597
|
+
'ParamValues',
|
|
1598
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1599
|
+
listener,
|
|
1600
|
+
listenerDeps,
|
|
1601
|
+
[queryId],
|
|
1602
|
+
);
|
|
1603
|
+
const useParamValueListener = (
|
|
1604
|
+
queryId,
|
|
1605
|
+
paramId,
|
|
1606
|
+
listener,
|
|
1607
|
+
listenerDeps,
|
|
1608
|
+
queriesOrQueriesId,
|
|
1609
|
+
) =>
|
|
1610
|
+
useListener(
|
|
1611
|
+
'ParamValue',
|
|
1612
|
+
useQueriesOrQueriesById(queriesOrQueriesId),
|
|
1613
|
+
listener,
|
|
1614
|
+
listenerDeps,
|
|
1615
|
+
[queryId, paramId],
|
|
1616
|
+
);
|
|
1553
1617
|
const useSetParamValueCallback = (
|
|
1554
1618
|
queryId,
|
|
1555
1619
|
paramId,
|
|
@@ -1604,7 +1668,7 @@ const useCheckpoint = (checkpointId, checkpointsOrCheckpointsId) =>
|
|
|
1604
1668
|
useListenable(
|
|
1605
1669
|
CHECKPOINT,
|
|
1606
1670
|
useCheckpointsOrCheckpointsById(checkpointsOrCheckpointsId),
|
|
1607
|
-
|
|
1671
|
+
5 /* CellOrValue */,
|
|
1608
1672
|
[checkpointId],
|
|
1609
1673
|
);
|
|
1610
1674
|
const useSetCheckpointCallback = (
|
|
@@ -1751,7 +1815,7 @@ const usePersisterStatus = (persisterOrPersisterId) =>
|
|
|
1751
1815
|
useListenable(
|
|
1752
1816
|
STATUS,
|
|
1753
1817
|
usePersisterOrPersisterById(persisterOrPersisterId),
|
|
1754
|
-
|
|
1818
|
+
7 /* Number */,
|
|
1755
1819
|
[],
|
|
1756
1820
|
);
|
|
1757
1821
|
const usePersisterStatusListener = (
|
|
@@ -1806,7 +1870,7 @@ const useSynchronizerStatus = (synchronizerOrSynchronizerId) =>
|
|
|
1806
1870
|
useListenable(
|
|
1807
1871
|
STATUS,
|
|
1808
1872
|
useSynchronizerOrSynchronizerById(synchronizerOrSynchronizerId),
|
|
1809
|
-
|
|
1873
|
+
7 /* Number */,
|
|
1810
1874
|
[],
|
|
1811
1875
|
);
|
|
1812
1876
|
const useSynchronizerStatusListener = (
|
|
@@ -2346,6 +2410,10 @@ export {
|
|
|
2346
2410
|
useMetrics,
|
|
2347
2411
|
useMetricsIds,
|
|
2348
2412
|
useMetricsOrMetricsById,
|
|
2413
|
+
useParamValue,
|
|
2414
|
+
useParamValueListener,
|
|
2415
|
+
useParamValues,
|
|
2416
|
+
useParamValuesListener,
|
|
2349
2417
|
usePersister,
|
|
2350
2418
|
usePersisterIds,
|
|
2351
2419
|
usePersisterOrPersisterById,
|