tinybase 6.2.0-beta.3 → 6.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 (76) hide show
  1. package/@types/common/index.d.ts +295 -0
  2. package/@types/common/with-schemas/index.d.ts +375 -0
  3. package/@types/mergeable-store/index.d.ts +5 -34
  4. package/@types/mergeable-store/with-schemas/index.d.ts +5 -34
  5. package/@types/omni/with-schemas/index.d.ts +3 -3
  6. package/common/index.js +62 -3
  7. package/common/with-schemas/index.js +62 -3
  8. package/index.js +133 -86
  9. package/mergeable-store/index.js +102 -94
  10. package/mergeable-store/with-schemas/index.js +102 -94
  11. package/min/common/index.js +1 -1
  12. package/min/common/index.js.gz +0 -0
  13. package/min/common/with-schemas/index.js +1 -1
  14. package/min/common/with-schemas/index.js.gz +0 -0
  15. package/min/index.js +1 -1
  16. package/min/index.js.gz +0 -0
  17. package/min/mergeable-store/index.js +1 -1
  18. package/min/mergeable-store/index.js.gz +0 -0
  19. package/min/mergeable-store/with-schemas/index.js +1 -1
  20. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  21. package/min/omni/index.js +1 -1
  22. package/min/omni/index.js.gz +0 -0
  23. package/min/omni/with-schemas/index.js +1 -1
  24. package/min/omni/with-schemas/index.js.gz +0 -0
  25. package/min/persisters/index.js +1 -1
  26. package/min/persisters/index.js.gz +0 -0
  27. package/min/persisters/persister-pglite/index.js +1 -1
  28. package/min/persisters/persister-pglite/index.js.gz +0 -0
  29. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  30. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  31. package/min/persisters/persister-postgres/index.js +1 -1
  32. package/min/persisters/persister-postgres/index.js.gz +0 -0
  33. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  34. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  35. package/min/persisters/with-schemas/index.js +1 -1
  36. package/min/persisters/with-schemas/index.js.gz +0 -0
  37. package/min/store/index.js +1 -1
  38. package/min/store/index.js.gz +0 -0
  39. package/min/store/with-schemas/index.js +1 -1
  40. package/min/store/with-schemas/index.js.gz +0 -0
  41. package/min/ui-react-inspector/index.js +1 -1
  42. package/min/ui-react-inspector/index.js.gz +0 -0
  43. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  44. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  45. package/min/with-schemas/index.js +1 -1
  46. package/min/with-schemas/index.js.gz +0 -0
  47. package/omni/index.js +148 -101
  48. package/omni/with-schemas/index.js +148 -101
  49. package/package.json +3 -3
  50. package/persisters/index.js +9 -9
  51. package/persisters/persister-durable-object-storage/index.js +12 -12
  52. package/persisters/persister-durable-object-storage/with-schemas/index.js +12 -12
  53. package/persisters/persister-pglite/index.js +11 -11
  54. package/persisters/persister-pglite/with-schemas/index.js +11 -11
  55. package/persisters/persister-postgres/index.js +11 -11
  56. package/persisters/persister-postgres/with-schemas/index.js +11 -11
  57. package/persisters/with-schemas/index.js +9 -9
  58. package/readme.md +2 -2
  59. package/releases.md +9 -10
  60. package/store/index.js +4 -4
  61. package/store/with-schemas/index.js +4 -4
  62. package/synchronizers/index.js +7 -7
  63. package/synchronizers/synchronizer-broadcast-channel/index.js +7 -7
  64. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +7 -7
  65. package/synchronizers/synchronizer-local/index.js +7 -7
  66. package/synchronizers/synchronizer-local/with-schemas/index.js +7 -7
  67. package/synchronizers/synchronizer-ws-client/index.js +7 -7
  68. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +7 -7
  69. package/synchronizers/synchronizer-ws-server/index.js +7 -7
  70. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +7 -7
  71. package/synchronizers/synchronizer-ws-server-durable-object/index.js +7 -7
  72. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +7 -7
  73. package/synchronizers/with-schemas/index.js +7 -7
  74. package/ui-react-inspector/index.js +1 -1
  75. package/ui-react-inspector/with-schemas/index.js +1 -1
  76. package/with-schemas/index.js +133 -86
@@ -121,11 +121,11 @@ const getUniqueId = (length = 16) =>
121
121
  '',
122
122
  );
123
123
 
124
- const stampNew = (value, time) => (time ? [value, time] : [value]);
125
- const getLatestTime = (time1, time2) =>
124
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
125
+ const getLatestHlc = (hlc1, hlc2) =>
126
126
  /* istanbul ignore next */
127
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
128
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
127
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
128
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
129
129
 
130
130
  const INTEGER = /^\d+$/;
131
131
  const getPoolFunctions = () => {
@@ -511,11 +511,11 @@ const createCustomSynchronizer = (
511
511
  ([cell2, cellTime2], cellId) =>
512
512
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
513
513
  );
514
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
514
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
515
515
  });
516
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
516
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
517
517
  });
518
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
518
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
519
519
  };
520
520
  const getChangesFromOtherStore = (
521
521
  otherClientId = null,
@@ -123,11 +123,11 @@ const getUniqueId = (length = 16) =>
123
123
  '',
124
124
  );
125
125
 
126
- const stampNew = (value, time) => (time ? [value, time] : [value]);
127
- const getLatestTime = (time1, time2) =>
126
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
127
+ const getLatestHlc = (hlc1, hlc2) =>
128
128
  /* istanbul ignore next */
129
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
130
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
129
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
130
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
131
131
 
132
132
  const INTEGER = /^\d+$/;
133
133
  const getPoolFunctions = () => {
@@ -513,11 +513,11 @@ const createCustomSynchronizer = (
513
513
  ([cell2, cellTime2], cellId) =>
514
514
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
515
515
  );
516
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
516
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
517
517
  });
518
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
518
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
519
519
  });
520
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
520
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
521
521
  };
522
522
  const getChangesFromOtherStore = (
523
523
  otherClientId = null,
@@ -123,11 +123,11 @@ const getUniqueId = (length = 16) =>
123
123
  '',
124
124
  );
125
125
 
126
- const stampNew = (value, time) => (time ? [value, time] : [value]);
127
- const getLatestTime = (time1, time2) =>
126
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
127
+ const getLatestHlc = (hlc1, hlc2) =>
128
128
  /* istanbul ignore next */
129
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
130
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
129
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
130
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
131
131
 
132
132
  const INTEGER = /^\d+$/;
133
133
  const getPoolFunctions = () => {
@@ -513,11 +513,11 @@ const createCustomSynchronizer = (
513
513
  ([cell2, cellTime2], cellId) =>
514
514
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
515
515
  );
516
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
516
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
517
517
  });
518
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
518
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
519
519
  });
520
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
520
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
521
521
  };
522
522
  const getChangesFromOtherStore = (
523
523
  otherClientId = null,
@@ -150,11 +150,11 @@ const getUniqueId = (length = 16) =>
150
150
  '',
151
151
  );
152
152
 
153
- const stampNew = (value, time) => (time ? [value, time] : [value]);
154
- const getLatestTime = (time1, time2) =>
153
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
154
+ const getLatestHlc = (hlc1, hlc2) =>
155
155
  /* istanbul ignore next */
156
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
157
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
156
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
157
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
158
158
 
159
159
  const INTEGER = /^\d+$/;
160
160
  const getPoolFunctions = () => {
@@ -540,11 +540,11 @@ const createCustomSynchronizer = (
540
540
  ([cell2, cellTime2], cellId) =>
541
541
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
542
542
  );
543
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
543
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
544
544
  });
545
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
545
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
546
546
  });
547
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
547
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
548
548
  };
549
549
  const getChangesFromOtherStore = (
550
550
  otherClientId = null,
@@ -150,11 +150,11 @@ const getUniqueId = (length = 16) =>
150
150
  '',
151
151
  );
152
152
 
153
- const stampNew = (value, time) => (time ? [value, time] : [value]);
154
- const getLatestTime = (time1, time2) =>
153
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
154
+ const getLatestHlc = (hlc1, hlc2) =>
155
155
  /* istanbul ignore next */
156
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
157
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
156
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
157
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
158
158
 
159
159
  const INTEGER = /^\d+$/;
160
160
  const getPoolFunctions = () => {
@@ -540,11 +540,11 @@ const createCustomSynchronizer = (
540
540
  ([cell2, cellTime2], cellId) =>
541
541
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
542
542
  );
543
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
543
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
544
544
  });
545
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
545
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
546
546
  });
547
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
547
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
548
548
  };
549
549
  const getChangesFromOtherStore = (
550
550
  otherClientId = null,
@@ -256,11 +256,11 @@ const getUniqueId = (length = 16) =>
256
256
  '',
257
257
  );
258
258
 
259
- const stampNew = (value, time) => (time ? [value, time] : [value]);
260
- const getLatestTime = (time1, time2) =>
259
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
260
+ const getLatestHlc = (hlc1, hlc2) =>
261
261
  /* istanbul ignore next */
262
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
263
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
262
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
263
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
264
264
 
265
265
  const scheduleRunning = mapNew();
266
266
  const scheduleActions = mapNew();
@@ -551,11 +551,11 @@ const createCustomSynchronizer = (
551
551
  ([cell2, cellTime2], cellId) =>
552
552
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
553
553
  );
554
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
554
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
555
555
  });
556
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
556
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
557
557
  });
558
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
558
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
559
559
  };
560
560
  const getChangesFromOtherStore = (
561
561
  otherClientId = null,
@@ -256,11 +256,11 @@ const getUniqueId = (length = 16) =>
256
256
  '',
257
257
  );
258
258
 
259
- const stampNew = (value, time) => (time ? [value, time] : [value]);
260
- const getLatestTime = (time1, time2) =>
259
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
260
+ const getLatestHlc = (hlc1, hlc2) =>
261
261
  /* istanbul ignore next */
262
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
263
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
262
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
263
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
264
264
 
265
265
  const scheduleRunning = mapNew();
266
266
  const scheduleActions = mapNew();
@@ -551,11 +551,11 @@ const createCustomSynchronizer = (
551
551
  ([cell2, cellTime2], cellId) =>
552
552
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
553
553
  );
554
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
554
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
555
555
  });
556
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
556
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
557
557
  });
558
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
558
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
559
559
  };
560
560
  const getChangesFromOtherStore = (
561
561
  otherClientId = null,
@@ -152,11 +152,11 @@ const getUniqueId = (length = 16) =>
152
152
  '',
153
153
  );
154
154
 
155
- const stampNew = (value, time) => (time ? [value, time] : [value]);
156
- const getLatestTime = (time1, time2) =>
155
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
156
+ const getLatestHlc = (hlc1, hlc2) =>
157
157
  /* istanbul ignore next */
158
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
159
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
158
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
159
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
160
160
 
161
161
  const INTEGER = /^\d+$/;
162
162
  const getPoolFunctions = () => {
@@ -541,11 +541,11 @@ const createCustomSynchronizer = (
541
541
  ([cell2, cellTime2], cellId) =>
542
542
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
543
543
  );
544
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
544
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
545
545
  });
546
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
546
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
547
547
  });
548
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
548
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
549
549
  };
550
550
  const getChangesFromOtherStore = (
551
551
  otherClientId = null,
@@ -152,11 +152,11 @@ const getUniqueId = (length = 16) =>
152
152
  '',
153
153
  );
154
154
 
155
- const stampNew = (value, time) => (time ? [value, time] : [value]);
156
- const getLatestTime = (time1, time2) =>
155
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
156
+ const getLatestHlc = (hlc1, hlc2) =>
157
157
  /* istanbul ignore next */
158
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
159
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
158
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
159
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
160
160
 
161
161
  const INTEGER = /^\d+$/;
162
162
  const getPoolFunctions = () => {
@@ -541,11 +541,11 @@ const createCustomSynchronizer = (
541
541
  ([cell2, cellTime2], cellId) =>
542
542
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
543
543
  );
544
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
544
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
545
545
  });
546
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
546
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
547
547
  });
548
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
548
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
549
549
  };
550
550
  const getChangesFromOtherStore = (
551
551
  otherClientId = null,
@@ -121,11 +121,11 @@ const getUniqueId = (length = 16) =>
121
121
  '',
122
122
  );
123
123
 
124
- const stampNew = (value, time) => (time ? [value, time] : [value]);
125
- const getLatestTime = (time1, time2) =>
124
+ const stampNew = (value, hlc) => (hlc ? [value, hlc] : [value]);
125
+ const getLatestHlc = (hlc1, hlc2) =>
126
126
  /* istanbul ignore next */
127
- ((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
128
- const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
127
+ ((hlc1 ?? '') > (hlc2 ?? '') ? hlc1 : hlc2) ?? '';
128
+ const stampNewObj = (hlc = EMPTY_STRING) => stampNew(objNew(), hlc);
129
129
 
130
130
  const INTEGER = /^\d+$/;
131
131
  const getPoolFunctions = () => {
@@ -521,11 +521,11 @@ const createCustomSynchronizer = (
521
521
  ([cell2, cellTime2], cellId) =>
522
522
  (rowStamp[0][cellId] = stampNew(cell2, cellTime2)),
523
523
  );
524
- rowStamp[1] = getLatestTime(rowStamp[1], rowTime2);
524
+ rowStamp[1] = getLatestHlc(rowStamp[1], rowTime2);
525
525
  });
526
- tableStamp[1] = getLatestTime(tableStamp[1], tableTime2);
526
+ tableStamp[1] = getLatestHlc(tableStamp[1], tableTime2);
527
527
  });
528
- tablesStamp[1] = getLatestTime(tablesStamp[1], tablesTime2);
528
+ tablesStamp[1] = getLatestHlc(tablesStamp[1], tablesTime2);
529
529
  };
530
530
  const getChangesFromOtherStore = (
531
531
  otherClientId = null,
@@ -120,8 +120,8 @@ const arrayShift = (array) => array.shift();
120
120
 
121
121
  const object = Object;
122
122
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
123
- const objEntries = object.entries;
124
123
  const objFrozen = object.isFrozen;
124
+ const objEntries = object.entries;
125
125
  const isObject = (obj) =>
126
126
  !isUndefined(obj) &&
127
127
  ifNotUndefined(
@@ -120,8 +120,8 @@ const arrayShift = (array) => array.shift();
120
120
 
121
121
  const object = Object;
122
122
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
123
- const objEntries = object.entries;
124
123
  const objFrozen = object.isFrozen;
124
+ const objEntries = object.entries;
125
125
  const isObject = (obj) =>
126
126
  !isUndefined(obj) &&
127
127
  ifNotUndefined(