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.
Files changed (44) hide show
  1. package/@types/queries/index.d.ts +333 -4
  2. package/@types/queries/with-schemas/index.d.ts +359 -4
  3. package/@types/ui-react/index.d.ts +477 -8
  4. package/@types/ui-react/with-schemas/index.d.ts +519 -8
  5. package/agents.md +34 -0
  6. package/index.js +100 -18
  7. package/min/index.js +1 -1
  8. package/min/index.js.gz +0 -0
  9. package/min/omni/index.js +1 -1
  10. package/min/omni/index.js.gz +0 -0
  11. package/min/omni/with-schemas/index.js +1 -1
  12. package/min/omni/with-schemas/index.js.gz +0 -0
  13. package/min/queries/index.js +1 -1
  14. package/min/queries/index.js.gz +0 -0
  15. package/min/queries/with-schemas/index.js +1 -1
  16. package/min/queries/with-schemas/index.js.gz +0 -0
  17. package/min/ui-react/index.js +1 -1
  18. package/min/ui-react/index.js.gz +0 -0
  19. package/min/ui-react/with-schemas/index.js +1 -1
  20. package/min/ui-react/with-schemas/index.js.gz +0 -0
  21. package/min/ui-react-dom/index.js +1 -1
  22. package/min/ui-react-dom/index.js.gz +0 -0
  23. package/min/ui-react-dom/with-schemas/index.js +1 -1
  24. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  25. package/min/ui-react-inspector/index.js +1 -1
  26. package/min/ui-react-inspector/index.js.gz +0 -0
  27. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  28. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  29. package/min/with-schemas/index.js +1 -1
  30. package/min/with-schemas/index.js.gz +0 -0
  31. package/omni/index.js +173 -48
  32. package/omni/with-schemas/index.js +173 -48
  33. package/package.json +3 -3
  34. package/queries/index.js +120 -18
  35. package/queries/with-schemas/index.js +120 -18
  36. package/readme.md +13 -13
  37. package/releases.md +40 -40
  38. package/ui-react/index.js +98 -30
  39. package/ui-react/with-schemas/index.js +98 -30
  40. package/ui-react-dom/index.js +38 -15
  41. package/ui-react-dom/with-schemas/index.js +38 -15
  42. package/ui-react-inspector/index.js +40 -17
  43. package/ui-react-inspector/with-schemas/index.js +40 -17
  44. package/with-schemas/index.js +100 -18
@@ -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 arrayFilter = (array, cb) => array.filter(cb);
65
69
 
@@ -85,16 +89,23 @@ const objToArray = (obj, cb) =>
85
89
  const objMap = (obj, cb) =>
86
90
  objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
87
91
  const objSize = (obj) => size(objIds(obj));
88
- const objIsEqual = (obj1, obj2) => {
92
+
93
+ /* istanbul ignore next */
94
+ const objIsEqual = (
95
+ obj1,
96
+ obj2,
97
+ isEqual = (value1, value2) => value1 === value2,
98
+ ) => {
89
99
  const entries1 = objEntries(obj1);
90
100
  return (
91
101
  size(entries1) === objSize(obj2) &&
92
102
  arrayEvery(entries1, ([index, value1]) =>
93
103
  isObject(value1)
94
- ? isObject(obj2[index])
104
+ ? /* istanbul ignore next */
105
+ isObject(obj2[index])
95
106
  ? objIsEqual(obj2[index], value1)
96
107
  : false
97
- : obj2[index] === value1,
108
+ : isEqual(value1, obj2[index]),
98
109
  )
99
110
  );
100
111
  };
@@ -151,7 +162,16 @@ const OFFSET_RELATIONSHIPS = 3;
151
162
  const OFFSET_QUERIES = 4;
152
163
 
153
164
  const EMPTY_ARRAY = [];
154
- const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
165
+ const DEFAULTS = [
166
+ {},
167
+ [],
168
+ [EMPTY_ARRAY, void 0, EMPTY_ARRAY],
169
+ {},
170
+ void 0,
171
+ void 0,
172
+ false,
173
+ 0,
174
+ ];
155
175
  const IS_EQUALS = [
156
176
  objIsEqual,
157
177
  arrayIsEqual,
@@ -162,6 +182,9 @@ const IS_EQUALS = [
162
182
  currentId1 === currentId2 &&
163
183
  arrayIsEqual(backwardIds1, backwardIds2) &&
164
184
  arrayIsEqual(forwardIds1, forwardIds2),
185
+ (paramValues1, paramValues2) =>
186
+ objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
187
+ arrayOrValueEqual,
165
188
  ];
166
189
  const isEqual = (thing1, thing2) => thing1 === thing2;
167
190
  const addAndDelListener = (thing, listenable, ...args) => {
@@ -173,7 +196,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
173
196
  const getResult = useCallback(
174
197
  () => {
175
198
  const nextResult =
176
- thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
199
+ thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
177
200
  ...args,
178
201
  ) ?? DEFAULTS[returnType];
179
202
  return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
@@ -187,7 +210,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
187
210
  (listener) =>
188
211
  addAndDelListener(
189
212
  thing,
190
- (returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
213
+ (returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
191
214
  ...args,
192
215
  listener,
193
216
  ),
@@ -203,7 +226,7 @@ const useSetCallback = (
203
226
  getDeps = EMPTY_ARRAY,
204
227
  then = getUndefined,
205
228
  thenDeps = EMPTY_ARRAY,
206
- methodPrefix = EMPTY_STRING,
229
+ methodPrefix,
207
230
  ...args
208
231
  ) =>
209
232
  useCallback(
@@ -234,9 +257,9 @@ const useStoreSetCallback = (
234
257
  storeOrStoreId,
235
258
  settable,
236
259
  get,
237
- getDeps = EMPTY_ARRAY,
238
- then = getUndefined,
239
- thenDeps = EMPTY_ARRAY,
260
+ getDeps,
261
+ then,
262
+ thenDeps,
240
263
  ...args
241
264
  ) =>
242
265
  useSetCallback(
@@ -279,7 +302,7 @@ const useRowCount = (tableId, storeOrStoreId) =>
279
302
  useListenable(
280
303
  ROW_COUNT,
281
304
  useStoreOrStoreById(storeOrStoreId),
282
- 5 /* Number */,
305
+ 7 /* Number */,
283
306
  [tableId],
284
307
  );
285
308
  const useRowIds = (tableId, storeOrStoreId) =>
@@ -317,7 +340,7 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
317
340
  useListenable(
318
341
  CELL,
319
342
  useStoreOrStoreById(storeOrStoreId),
320
- 3 /* CellOrValue */,
343
+ 5 /* CellOrValue */,
321
344
  [tableId, rowId, cellId],
322
345
  );
323
346
  const useValueIds = (storeOrStoreId) =>
@@ -326,7 +349,7 @@ const useValue = (valueId, storeOrStoreId) =>
326
349
  useListenable(
327
350
  VALUE,
328
351
  useStoreOrStoreById(storeOrStoreId),
329
- 3 /* CellOrValue */,
352
+ 5 /* CellOrValue */,
330
353
  [valueId],
331
354
  );
332
355
  const useSetCellCallback = (
@@ -386,7 +409,7 @@ const useRemoteRowId = (
386
409
  useListenable(
387
410
  REMOTE_ROW_ID,
388
411
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
389
- 3 /* CellOrValue */,
412
+ 5 /* CellOrValue */,
390
413
  [relationshipId, localRowId],
391
414
  );
392
415
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
@@ -402,7 +425,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
402
425
  useListenable(
403
426
  RESULT + ROW_COUNT,
404
427
  useQueriesOrQueriesById(queriesOrQueriesId),
405
- 5 /* Number */,
428
+ 7 /* Number */,
406
429
  [queryId],
407
430
  );
408
431
  const useResultRowIds = (queryId, queriesOrQueriesId) =>
@@ -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 arrayFilter = (array, cb) => array.filter(cb);
65
69
 
@@ -85,16 +89,23 @@ const objToArray = (obj, cb) =>
85
89
  const objMap = (obj, cb) =>
86
90
  objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
87
91
  const objSize = (obj) => size(objIds(obj));
88
- const objIsEqual = (obj1, obj2) => {
92
+
93
+ /* istanbul ignore next */
94
+ const objIsEqual = (
95
+ obj1,
96
+ obj2,
97
+ isEqual = (value1, value2) => value1 === value2,
98
+ ) => {
89
99
  const entries1 = objEntries(obj1);
90
100
  return (
91
101
  size(entries1) === objSize(obj2) &&
92
102
  arrayEvery(entries1, ([index, value1]) =>
93
103
  isObject(value1)
94
- ? isObject(obj2[index])
104
+ ? /* istanbul ignore next */
105
+ isObject(obj2[index])
95
106
  ? objIsEqual(obj2[index], value1)
96
107
  : false
97
- : obj2[index] === value1,
108
+ : isEqual(value1, obj2[index]),
98
109
  )
99
110
  );
100
111
  };
@@ -151,7 +162,16 @@ const OFFSET_RELATIONSHIPS = 3;
151
162
  const OFFSET_QUERIES = 4;
152
163
 
153
164
  const EMPTY_ARRAY = [];
154
- const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
165
+ const DEFAULTS = [
166
+ {},
167
+ [],
168
+ [EMPTY_ARRAY, void 0, EMPTY_ARRAY],
169
+ {},
170
+ void 0,
171
+ void 0,
172
+ false,
173
+ 0,
174
+ ];
155
175
  const IS_EQUALS = [
156
176
  objIsEqual,
157
177
  arrayIsEqual,
@@ -162,6 +182,9 @@ const IS_EQUALS = [
162
182
  currentId1 === currentId2 &&
163
183
  arrayIsEqual(backwardIds1, backwardIds2) &&
164
184
  arrayIsEqual(forwardIds1, forwardIds2),
185
+ (paramValues1, paramValues2) =>
186
+ objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
187
+ arrayOrValueEqual,
165
188
  ];
166
189
  const isEqual = (thing1, thing2) => thing1 === thing2;
167
190
  const addAndDelListener = (thing, listenable, ...args) => {
@@ -173,7 +196,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
173
196
  const getResult = useCallback(
174
197
  () => {
175
198
  const nextResult =
176
- thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
199
+ thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
177
200
  ...args,
178
201
  ) ?? DEFAULTS[returnType];
179
202
  return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
@@ -187,7 +210,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
187
210
  (listener) =>
188
211
  addAndDelListener(
189
212
  thing,
190
- (returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
213
+ (returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
191
214
  ...args,
192
215
  listener,
193
216
  ),
@@ -203,7 +226,7 @@ const useSetCallback = (
203
226
  getDeps = EMPTY_ARRAY,
204
227
  then = getUndefined,
205
228
  thenDeps = EMPTY_ARRAY,
206
- methodPrefix = EMPTY_STRING,
229
+ methodPrefix,
207
230
  ...args
208
231
  ) =>
209
232
  useCallback(
@@ -234,9 +257,9 @@ const useStoreSetCallback = (
234
257
  storeOrStoreId,
235
258
  settable,
236
259
  get,
237
- getDeps = EMPTY_ARRAY,
238
- then = getUndefined,
239
- thenDeps = EMPTY_ARRAY,
260
+ getDeps,
261
+ then,
262
+ thenDeps,
240
263
  ...args
241
264
  ) =>
242
265
  useSetCallback(
@@ -279,7 +302,7 @@ const useRowCount = (tableId, storeOrStoreId) =>
279
302
  useListenable(
280
303
  ROW_COUNT,
281
304
  useStoreOrStoreById(storeOrStoreId),
282
- 5 /* Number */,
305
+ 7 /* Number */,
283
306
  [tableId],
284
307
  );
285
308
  const useRowIds = (tableId, storeOrStoreId) =>
@@ -317,7 +340,7 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
317
340
  useListenable(
318
341
  CELL,
319
342
  useStoreOrStoreById(storeOrStoreId),
320
- 3 /* CellOrValue */,
343
+ 5 /* CellOrValue */,
321
344
  [tableId, rowId, cellId],
322
345
  );
323
346
  const useValueIds = (storeOrStoreId) =>
@@ -326,7 +349,7 @@ const useValue = (valueId, storeOrStoreId) =>
326
349
  useListenable(
327
350
  VALUE,
328
351
  useStoreOrStoreById(storeOrStoreId),
329
- 3 /* CellOrValue */,
352
+ 5 /* CellOrValue */,
330
353
  [valueId],
331
354
  );
332
355
  const useSetCellCallback = (
@@ -386,7 +409,7 @@ const useRemoteRowId = (
386
409
  useListenable(
387
410
  REMOTE_ROW_ID,
388
411
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
389
- 3 /* CellOrValue */,
412
+ 5 /* CellOrValue */,
390
413
  [relationshipId, localRowId],
391
414
  );
392
415
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
@@ -402,7 +425,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
402
425
  useListenable(
403
426
  RESULT + ROW_COUNT,
404
427
  useQueriesOrQueriesById(queriesOrQueriesId),
405
- 5 /* Number */,
428
+ 7 /* Number */,
406
429
  [queryId],
407
430
  );
408
431
  const useResultRowIds = (queryId, queriesOrQueriesId) =>
@@ -117,6 +117,10 @@ const arrayEvery = (array, cb) => array.every(cb);
117
117
  const arrayIsEqual = (array1, array2) =>
118
118
  size(array1) === size(array2) &&
119
119
  arrayEvery(array1, (value1, index) => array2[index] === value1);
120
+ const arrayOrValueEqual = (value1, value2) =>
121
+ isArray(value1) && isArray(value2)
122
+ ? arrayIsEqual(value1, value2)
123
+ : value1 === value2;
120
124
  const arraySort = (array, sorter) => array.sort(sorter);
121
125
  const arrayForEach = (array, cb) => array.forEach(cb);
122
126
  const arrayJoin = (array, sep = EMPTY_STRING) => array.join(sep);
@@ -160,16 +164,23 @@ const objMap = (obj, cb) =>
160
164
  objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
161
165
  const objSize = (obj) => size(objIds(obj));
162
166
  const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
163
- const objIsEqual = (obj1, obj2) => {
167
+
168
+ /* istanbul ignore next */
169
+ const objIsEqual = (
170
+ obj1,
171
+ obj2,
172
+ isEqual = (value1, value2) => value1 === value2,
173
+ ) => {
164
174
  const entries1 = objEntries(obj1);
165
175
  return (
166
176
  size(entries1) === objSize(obj2) &&
167
177
  arrayEvery(entries1, ([index, value1]) =>
168
178
  isObject(value1)
169
- ? isObject(obj2[index])
179
+ ? /* istanbul ignore next */
180
+ isObject(obj2[index])
170
181
  ? objIsEqual(obj2[index], value1)
171
182
  : false
172
- : obj2[index] === value1,
183
+ : isEqual(value1, obj2[index]),
173
184
  )
174
185
  );
175
186
  };
@@ -2159,7 +2170,16 @@ const OFFSET_RELATIONSHIPS = 3;
2159
2170
  const OFFSET_QUERIES = 4;
2160
2171
 
2161
2172
  const EMPTY_ARRAY = [];
2162
- const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
2173
+ const DEFAULTS = [
2174
+ {},
2175
+ [],
2176
+ [EMPTY_ARRAY, void 0, EMPTY_ARRAY],
2177
+ {},
2178
+ void 0,
2179
+ void 0,
2180
+ false,
2181
+ 0,
2182
+ ];
2163
2183
  const IS_EQUALS = [
2164
2184
  objIsEqual,
2165
2185
  arrayIsEqual,
@@ -2170,6 +2190,9 @@ const IS_EQUALS = [
2170
2190
  currentId1 === currentId2 &&
2171
2191
  arrayIsEqual(backwardIds1, backwardIds2) &&
2172
2192
  arrayIsEqual(forwardIds1, forwardIds2),
2193
+ (paramValues1, paramValues2) =>
2194
+ objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
2195
+ arrayOrValueEqual,
2173
2196
  ];
2174
2197
  const isEqual = (thing1, thing2) => thing1 === thing2;
2175
2198
  const addAndDelListener = (thing, listenable, ...args) => {
@@ -2181,7 +2204,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
2181
2204
  const getResult = useCallback(
2182
2205
  () => {
2183
2206
  const nextResult =
2184
- thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
2207
+ thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
2185
2208
  ...args,
2186
2209
  ) ?? DEFAULTS[returnType];
2187
2210
  return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
@@ -2195,7 +2218,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
2195
2218
  (listener) =>
2196
2219
  addAndDelListener(
2197
2220
  thing,
2198
- (returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
2221
+ (returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
2199
2222
  ...args,
2200
2223
  listener,
2201
2224
  ),
@@ -2211,7 +2234,7 @@ const useSetCallback = (
2211
2234
  getDeps = EMPTY_ARRAY,
2212
2235
  then = getUndefined,
2213
2236
  thenDeps = EMPTY_ARRAY,
2214
- methodPrefix = EMPTY_STRING,
2237
+ methodPrefix,
2215
2238
  ...args
2216
2239
  ) =>
2217
2240
  useCallback(
@@ -2242,9 +2265,9 @@ const useStoreSetCallback = (
2242
2265
  storeOrStoreId,
2243
2266
  settable,
2244
2267
  get,
2245
- getDeps = EMPTY_ARRAY,
2246
- then = getUndefined,
2247
- thenDeps = EMPTY_ARRAY,
2268
+ getDeps,
2269
+ then,
2270
+ thenDeps,
2248
2271
  ...args
2249
2272
  ) =>
2250
2273
  useSetCallback(
@@ -2295,7 +2318,7 @@ const useHasTables = (storeOrStoreId) =>
2295
2318
  useListenable(
2296
2319
  TABLES,
2297
2320
  useStoreOrStoreById(storeOrStoreId),
2298
- 4 /* Boolean */,
2321
+ 6 /* Boolean */,
2299
2322
  [],
2300
2323
  );
2301
2324
  const useTableCellIds = (tableId, storeOrStoreId) =>
@@ -2309,7 +2332,7 @@ const useRowCount = (tableId, storeOrStoreId) =>
2309
2332
  useListenable(
2310
2333
  ROW_COUNT,
2311
2334
  useStoreOrStoreById(storeOrStoreId),
2312
- 5 /* Number */,
2335
+ 7 /* Number */,
2313
2336
  [tableId],
2314
2337
  );
2315
2338
  const useRowIds = (tableId, storeOrStoreId) =>
@@ -2347,14 +2370,14 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
2347
2370
  useListenable(
2348
2371
  CELL,
2349
2372
  useStoreOrStoreById(storeOrStoreId),
2350
- 3 /* CellOrValue */,
2373
+ 5 /* CellOrValue */,
2351
2374
  [tableId, rowId, cellId],
2352
2375
  );
2353
2376
  const useHasValues = (storeOrStoreId) =>
2354
2377
  useListenable(
2355
2378
  VALUES,
2356
2379
  useStoreOrStoreById(storeOrStoreId),
2357
- 4 /* Boolean */,
2380
+ 6 /* Boolean */,
2358
2381
  [],
2359
2382
  );
2360
2383
  const useValueIds = (storeOrStoreId) =>
@@ -2363,7 +2386,7 @@ const useValue = (valueId, storeOrStoreId) =>
2363
2386
  useListenable(
2364
2387
  VALUE,
2365
2388
  useStoreOrStoreById(storeOrStoreId),
2366
- 3 /* CellOrValue */,
2389
+ 5 /* CellOrValue */,
2367
2390
  [valueId],
2368
2391
  );
2369
2392
  const useSetTableCallback = (
@@ -2488,7 +2511,7 @@ const useRemoteRowId = (
2488
2511
  useListenable(
2489
2512
  REMOTE_ROW_ID,
2490
2513
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
2491
- 3 /* CellOrValue */,
2514
+ 5 /* CellOrValue */,
2492
2515
  [relationshipId, localRowId],
2493
2516
  );
2494
2517
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
@@ -2504,7 +2527,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
2504
2527
  useListenable(
2505
2528
  RESULT + ROW_COUNT,
2506
2529
  useQueriesOrQueriesById(queriesOrQueriesId),
2507
- 5 /* Number */,
2530
+ 7 /* Number */,
2508
2531
  [queryId],
2509
2532
  );
2510
2533
  const useResultSortedRowIds = (
@@ -117,6 +117,10 @@ const arrayEvery = (array, cb) => array.every(cb);
117
117
  const arrayIsEqual = (array1, array2) =>
118
118
  size(array1) === size(array2) &&
119
119
  arrayEvery(array1, (value1, index) => array2[index] === value1);
120
+ const arrayOrValueEqual = (value1, value2) =>
121
+ isArray(value1) && isArray(value2)
122
+ ? arrayIsEqual(value1, value2)
123
+ : value1 === value2;
120
124
  const arraySort = (array, sorter) => array.sort(sorter);
121
125
  const arrayForEach = (array, cb) => array.forEach(cb);
122
126
  const arrayJoin = (array, sep = EMPTY_STRING) => array.join(sep);
@@ -160,16 +164,23 @@ const objMap = (obj, cb) =>
160
164
  objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
161
165
  const objSize = (obj) => size(objIds(obj));
162
166
  const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
163
- const objIsEqual = (obj1, obj2) => {
167
+
168
+ /* istanbul ignore next */
169
+ const objIsEqual = (
170
+ obj1,
171
+ obj2,
172
+ isEqual = (value1, value2) => value1 === value2,
173
+ ) => {
164
174
  const entries1 = objEntries(obj1);
165
175
  return (
166
176
  size(entries1) === objSize(obj2) &&
167
177
  arrayEvery(entries1, ([index, value1]) =>
168
178
  isObject(value1)
169
- ? isObject(obj2[index])
179
+ ? /* istanbul ignore next */
180
+ isObject(obj2[index])
170
181
  ? objIsEqual(obj2[index], value1)
171
182
  : false
172
- : obj2[index] === value1,
183
+ : isEqual(value1, obj2[index]),
173
184
  )
174
185
  );
175
186
  };
@@ -2159,7 +2170,16 @@ const OFFSET_RELATIONSHIPS = 3;
2159
2170
  const OFFSET_QUERIES = 4;
2160
2171
 
2161
2172
  const EMPTY_ARRAY = [];
2162
- const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
2173
+ const DEFAULTS = [
2174
+ {},
2175
+ [],
2176
+ [EMPTY_ARRAY, void 0, EMPTY_ARRAY],
2177
+ {},
2178
+ void 0,
2179
+ void 0,
2180
+ false,
2181
+ 0,
2182
+ ];
2163
2183
  const IS_EQUALS = [
2164
2184
  objIsEqual,
2165
2185
  arrayIsEqual,
@@ -2170,6 +2190,9 @@ const IS_EQUALS = [
2170
2190
  currentId1 === currentId2 &&
2171
2191
  arrayIsEqual(backwardIds1, backwardIds2) &&
2172
2192
  arrayIsEqual(forwardIds1, forwardIds2),
2193
+ (paramValues1, paramValues2) =>
2194
+ objIsEqual(paramValues1, paramValues2, arrayOrValueEqual),
2195
+ arrayOrValueEqual,
2173
2196
  ];
2174
2197
  const isEqual = (thing1, thing2) => thing1 === thing2;
2175
2198
  const addAndDelListener = (thing, listenable, ...args) => {
@@ -2181,7 +2204,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
2181
2204
  const getResult = useCallback(
2182
2205
  () => {
2183
2206
  const nextResult =
2184
- thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
2207
+ thing?.[(returnType == 6 /* Boolean */ ? _HAS : GET) + listenable]?.(
2185
2208
  ...args,
2186
2209
  ) ?? DEFAULTS[returnType];
2187
2210
  return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
@@ -2195,7 +2218,7 @@ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
2195
2218
  (listener) =>
2196
2219
  addAndDelListener(
2197
2220
  thing,
2198
- (returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
2221
+ (returnType == 6 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
2199
2222
  ...args,
2200
2223
  listener,
2201
2224
  ),
@@ -2211,7 +2234,7 @@ const useSetCallback = (
2211
2234
  getDeps = EMPTY_ARRAY,
2212
2235
  then = getUndefined,
2213
2236
  thenDeps = EMPTY_ARRAY,
2214
- methodPrefix = EMPTY_STRING,
2237
+ methodPrefix,
2215
2238
  ...args
2216
2239
  ) =>
2217
2240
  useCallback(
@@ -2242,9 +2265,9 @@ const useStoreSetCallback = (
2242
2265
  storeOrStoreId,
2243
2266
  settable,
2244
2267
  get,
2245
- getDeps = EMPTY_ARRAY,
2246
- then = getUndefined,
2247
- thenDeps = EMPTY_ARRAY,
2268
+ getDeps,
2269
+ then,
2270
+ thenDeps,
2248
2271
  ...args
2249
2272
  ) =>
2250
2273
  useSetCallback(
@@ -2295,7 +2318,7 @@ const useHasTables = (storeOrStoreId) =>
2295
2318
  useListenable(
2296
2319
  TABLES,
2297
2320
  useStoreOrStoreById(storeOrStoreId),
2298
- 4 /* Boolean */,
2321
+ 6 /* Boolean */,
2299
2322
  [],
2300
2323
  );
2301
2324
  const useTableCellIds = (tableId, storeOrStoreId) =>
@@ -2309,7 +2332,7 @@ const useRowCount = (tableId, storeOrStoreId) =>
2309
2332
  useListenable(
2310
2333
  ROW_COUNT,
2311
2334
  useStoreOrStoreById(storeOrStoreId),
2312
- 5 /* Number */,
2335
+ 7 /* Number */,
2313
2336
  [tableId],
2314
2337
  );
2315
2338
  const useRowIds = (tableId, storeOrStoreId) =>
@@ -2347,14 +2370,14 @@ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
2347
2370
  useListenable(
2348
2371
  CELL,
2349
2372
  useStoreOrStoreById(storeOrStoreId),
2350
- 3 /* CellOrValue */,
2373
+ 5 /* CellOrValue */,
2351
2374
  [tableId, rowId, cellId],
2352
2375
  );
2353
2376
  const useHasValues = (storeOrStoreId) =>
2354
2377
  useListenable(
2355
2378
  VALUES,
2356
2379
  useStoreOrStoreById(storeOrStoreId),
2357
- 4 /* Boolean */,
2380
+ 6 /* Boolean */,
2358
2381
  [],
2359
2382
  );
2360
2383
  const useValueIds = (storeOrStoreId) =>
@@ -2363,7 +2386,7 @@ const useValue = (valueId, storeOrStoreId) =>
2363
2386
  useListenable(
2364
2387
  VALUE,
2365
2388
  useStoreOrStoreById(storeOrStoreId),
2366
- 3 /* CellOrValue */,
2389
+ 5 /* CellOrValue */,
2367
2390
  [valueId],
2368
2391
  );
2369
2392
  const useSetTableCallback = (
@@ -2488,7 +2511,7 @@ const useRemoteRowId = (
2488
2511
  useListenable(
2489
2512
  REMOTE_ROW_ID,
2490
2513
  useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
2491
- 3 /* CellOrValue */,
2514
+ 5 /* CellOrValue */,
2492
2515
  [relationshipId, localRowId],
2493
2516
  );
2494
2517
  const useQueriesOrQueriesById = (queriesOrQueriesId) =>
@@ -2504,7 +2527,7 @@ const useResultRowCount = (queryId, queriesOrQueriesId) =>
2504
2527
  useListenable(
2505
2528
  RESULT + ROW_COUNT,
2506
2529
  useQueriesOrQueriesById(queriesOrQueriesId),
2507
- 5 /* Number */,
2530
+ 7 /* Number */,
2508
2531
  [queryId],
2509
2532
  );
2510
2533
  const useResultSortedRowIds = (