tinybase 5.4.0 → 5.4.2

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 (203) hide show
  1. package/@types/mergeable-store/index.d.cts +5 -2
  2. package/@types/mergeable-store/index.d.ts +5 -2
  3. package/@types/mergeable-store/with-schemas/index.d.cts +8 -3
  4. package/@types/mergeable-store/with-schemas/index.d.ts +8 -3
  5. package/@types/persisters/index.d.cts +6 -2
  6. package/@types/persisters/index.d.ts +6 -2
  7. package/@types/persisters/with-schemas/index.d.cts +12 -4
  8. package/@types/persisters/with-schemas/index.d.ts +12 -4
  9. package/@types/store/index.d.cts +20 -2
  10. package/@types/store/index.d.ts +20 -2
  11. package/@types/store/with-schemas/index.d.cts +23 -3
  12. package/@types/store/with-schemas/index.d.ts +23 -3
  13. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +5 -2
  14. package/@types/synchronizers/synchronizer-ws-server/index.d.ts +5 -2
  15. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +5 -2
  16. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +5 -2
  17. package/@types/ui-react/index.d.cts +42 -0
  18. package/@types/ui-react/index.d.ts +42 -0
  19. package/@types/ui-react/with-schemas/index.d.cts +48 -0
  20. package/@types/ui-react/with-schemas/index.d.ts +48 -0
  21. package/cjs/es6/index.cjs +6 -3
  22. package/cjs/es6/mergeable-store/index.cjs +6 -3
  23. package/cjs/es6/mergeable-store/with-schemas/index.cjs +6 -3
  24. package/cjs/es6/min/index.cjs +1 -1
  25. package/cjs/es6/min/index.cjs.gz +0 -0
  26. package/cjs/es6/min/mergeable-store/index.cjs +1 -1
  27. package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
  28. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
  29. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  30. package/cjs/es6/min/store/index.cjs +1 -1
  31. package/cjs/es6/min/store/index.cjs.gz +0 -0
  32. package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
  33. package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
  34. package/cjs/es6/min/ui-react/index.cjs +1 -1
  35. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  36. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  37. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  38. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  39. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  40. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  41. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  42. package/cjs/es6/min/with-schemas/index.cjs +1 -1
  43. package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
  44. package/cjs/es6/store/index.cjs +6 -3
  45. package/cjs/es6/store/with-schemas/index.cjs +6 -3
  46. package/cjs/es6/ui-react/index.cjs +26 -0
  47. package/cjs/es6/ui-react/with-schemas/index.cjs +26 -0
  48. package/cjs/es6/ui-react-inspector/index.cjs +6 -3
  49. package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +6 -3
  50. package/cjs/es6/with-schemas/index.cjs +6 -3
  51. package/cjs/index.cjs +6 -3
  52. package/cjs/mergeable-store/index.cjs +6 -3
  53. package/cjs/mergeable-store/with-schemas/index.cjs +6 -3
  54. package/cjs/min/index.cjs +1 -1
  55. package/cjs/min/index.cjs.gz +0 -0
  56. package/cjs/min/mergeable-store/index.cjs +1 -1
  57. package/cjs/min/mergeable-store/index.cjs.gz +0 -0
  58. package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
  59. package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  60. package/cjs/min/store/index.cjs +1 -1
  61. package/cjs/min/store/index.cjs.gz +0 -0
  62. package/cjs/min/store/with-schemas/index.cjs +1 -1
  63. package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
  64. package/cjs/min/ui-react/index.cjs +1 -1
  65. package/cjs/min/ui-react/index.cjs.gz +0 -0
  66. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  67. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  68. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  69. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  70. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  71. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  72. package/cjs/min/with-schemas/index.cjs +1 -1
  73. package/cjs/min/with-schemas/index.cjs.gz +0 -0
  74. package/cjs/store/index.cjs +6 -3
  75. package/cjs/store/with-schemas/index.cjs +6 -3
  76. package/cjs/ui-react/index.cjs +3 -0
  77. package/cjs/ui-react/with-schemas/index.cjs +3 -0
  78. package/cjs/ui-react-inspector/index.cjs +6 -3
  79. package/cjs/ui-react-inspector/with-schemas/index.cjs +6 -3
  80. package/cjs/with-schemas/index.cjs +6 -3
  81. package/es6/index.js +6 -3
  82. package/es6/mergeable-store/index.js +6 -3
  83. package/es6/mergeable-store/with-schemas/index.js +6 -3
  84. package/es6/min/index.js +1 -1
  85. package/es6/min/index.js.gz +0 -0
  86. package/es6/min/mergeable-store/index.js +1 -1
  87. package/es6/min/mergeable-store/index.js.gz +0 -0
  88. package/es6/min/mergeable-store/with-schemas/index.js +1 -1
  89. package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  90. package/es6/min/store/index.js +1 -1
  91. package/es6/min/store/index.js.gz +0 -0
  92. package/es6/min/store/with-schemas/index.js +1 -1
  93. package/es6/min/store/with-schemas/index.js.gz +0 -0
  94. package/es6/min/ui-react/index.js +1 -1
  95. package/es6/min/ui-react/index.js.gz +0 -0
  96. package/es6/min/ui-react/with-schemas/index.js +1 -1
  97. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  98. package/es6/min/ui-react-inspector/index.js +1 -1
  99. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  100. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  101. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  102. package/es6/min/with-schemas/index.js +1 -1
  103. package/es6/min/with-schemas/index.js.gz +0 -0
  104. package/es6/store/index.js +6 -3
  105. package/es6/store/with-schemas/index.js +6 -3
  106. package/es6/ui-react/index.js +26 -0
  107. package/es6/ui-react/with-schemas/index.js +26 -0
  108. package/es6/ui-react-inspector/index.js +6 -3
  109. package/es6/ui-react-inspector/with-schemas/index.js +6 -3
  110. package/es6/with-schemas/index.js +6 -3
  111. package/index.js +6 -3
  112. package/mergeable-store/index.js +6 -3
  113. package/mergeable-store/with-schemas/index.js +6 -3
  114. package/min/index.js +1 -1
  115. package/min/index.js.gz +0 -0
  116. package/min/mergeable-store/index.js +1 -1
  117. package/min/mergeable-store/index.js.gz +0 -0
  118. package/min/mergeable-store/with-schemas/index.js +1 -1
  119. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  120. package/min/store/index.js +1 -1
  121. package/min/store/index.js.gz +0 -0
  122. package/min/store/with-schemas/index.js +1 -1
  123. package/min/store/with-schemas/index.js.gz +0 -0
  124. package/min/ui-react/index.js +1 -1
  125. package/min/ui-react/index.js.gz +0 -0
  126. package/min/ui-react/with-schemas/index.js +1 -1
  127. package/min/ui-react/with-schemas/index.js.gz +0 -0
  128. package/min/ui-react-inspector/index.js +1 -1
  129. package/min/ui-react-inspector/index.js.gz +0 -0
  130. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  131. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  132. package/min/with-schemas/index.js +1 -1
  133. package/min/with-schemas/index.js.gz +0 -0
  134. package/package.json +5 -5
  135. package/readme.md +14 -14
  136. package/releases.md +25 -25
  137. package/store/index.js +6 -3
  138. package/store/with-schemas/index.js +6 -3
  139. package/ui-react/index.js +3 -0
  140. package/ui-react/with-schemas/index.js +3 -0
  141. package/ui-react-inspector/index.js +6 -3
  142. package/ui-react-inspector/with-schemas/index.js +6 -3
  143. package/umd/es6/index.js +6 -3
  144. package/umd/es6/mergeable-store/index.js +6 -3
  145. package/umd/es6/mergeable-store/with-schemas/index.js +6 -3
  146. package/umd/es6/min/index.js +1 -1
  147. package/umd/es6/min/index.js.gz +0 -0
  148. package/umd/es6/min/mergeable-store/index.js +1 -1
  149. package/umd/es6/min/mergeable-store/index.js.gz +0 -0
  150. package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
  151. package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  152. package/umd/es6/min/store/index.js +1 -1
  153. package/umd/es6/min/store/index.js.gz +0 -0
  154. package/umd/es6/min/store/with-schemas/index.js +1 -1
  155. package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
  156. package/umd/es6/min/ui-react/index.js +1 -1
  157. package/umd/es6/min/ui-react/index.js.gz +0 -0
  158. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  159. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  160. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  161. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  162. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  163. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  164. package/umd/es6/min/with-schemas/index.js +1 -1
  165. package/umd/es6/min/with-schemas/index.js.gz +0 -0
  166. package/umd/es6/store/index.js +6 -3
  167. package/umd/es6/store/with-schemas/index.js +6 -3
  168. package/umd/es6/ui-react/index.js +26 -0
  169. package/umd/es6/ui-react/with-schemas/index.js +26 -0
  170. package/umd/es6/ui-react-inspector/index.js +6 -3
  171. package/umd/es6/ui-react-inspector/with-schemas/index.js +6 -3
  172. package/umd/es6/with-schemas/index.js +6 -3
  173. package/umd/index.js +6 -3
  174. package/umd/mergeable-store/index.js +6 -3
  175. package/umd/mergeable-store/with-schemas/index.js +6 -3
  176. package/umd/min/index.js +1 -1
  177. package/umd/min/index.js.gz +0 -0
  178. package/umd/min/mergeable-store/index.js +1 -1
  179. package/umd/min/mergeable-store/index.js.gz +0 -0
  180. package/umd/min/mergeable-store/with-schemas/index.js +1 -1
  181. package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
  182. package/umd/min/store/index.js +1 -1
  183. package/umd/min/store/index.js.gz +0 -0
  184. package/umd/min/store/with-schemas/index.js +1 -1
  185. package/umd/min/store/with-schemas/index.js.gz +0 -0
  186. package/umd/min/ui-react/index.js +1 -1
  187. package/umd/min/ui-react/index.js.gz +0 -0
  188. package/umd/min/ui-react/with-schemas/index.js +1 -1
  189. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  190. package/umd/min/ui-react-inspector/index.js +1 -1
  191. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  192. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  193. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  194. package/umd/min/with-schemas/index.js +1 -1
  195. package/umd/min/with-schemas/index.js.gz +0 -0
  196. package/umd/store/index.js +6 -3
  197. package/umd/store/with-schemas/index.js +6 -3
  198. package/umd/ui-react/index.js +3 -0
  199. package/umd/ui-react/with-schemas/index.js +3 -0
  200. package/umd/ui-react-inspector/index.js +6 -3
  201. package/umd/ui-react-inspector/with-schemas/index.js +6 -3
  202. package/umd/with-schemas/index.js +6 -3
  203. package/with-schemas/index.js +6 -3
@@ -1066,9 +1066,12 @@
1066
1066
  const getSchemaJson = () =>
1067
1067
  jsonStringWithMap([tablesSchemaMap, valuesSchemaMap]);
1068
1068
  const setContent = (content) =>
1069
- fluentTransaction(() =>
1070
- validateContent(content) ? setValidContent(content) : 0,
1071
- );
1069
+ fluentTransaction(() => {
1070
+ const content2 = isFunction(content) ? content() : content;
1071
+ if (validateContent(content2)) {
1072
+ setValidContent(content2);
1073
+ }
1074
+ });
1072
1075
  const setTables = (tables) =>
1073
1076
  fluentTransaction(() =>
1074
1077
  validateTables(tables) ? setValidTables(tables) : 0,
@@ -151,6 +151,7 @@
151
151
  ? objGet(contextValue[offset * 2 + 1] ?? {}, id)
152
152
  : id;
153
153
  };
154
+ const useThings = (offset) => ({...useContext(Context)[offset * 2 + 1]});
154
155
  const useThingOrThingById = (thingOrThingId, offset) => {
155
156
  const thing = useThing(thingOrThingId, offset);
156
157
  return isUndefined(thingOrThingId) || isString(thingOrThingId)
@@ -168,6 +169,7 @@
168
169
  objIds(useContext(Context)[offset * 2 + 1] ?? {});
169
170
  const useStoreIds = () => useThingIds(0 /* Store */);
170
171
  const useStore = (id) => useThing(id, 0 /* Store */);
172
+ const useStores = () => useThings(0 /* Store */);
171
173
  const useStoreOrStoreById = (storeOrStoreId) =>
172
174
  useThingOrThingById(storeOrStoreId, 0 /* Store */);
173
175
  const useProvideStore = (storeId, store) =>
@@ -2256,6 +2258,7 @@
2256
2258
  exports.useStore = useStore;
2257
2259
  exports.useStoreIds = useStoreIds;
2258
2260
  exports.useStoreOrStoreById = useStoreOrStoreById;
2261
+ exports.useStores = useStores;
2259
2262
  exports.useSynchronizer = useSynchronizer;
2260
2263
  exports.useSynchronizerIds = useSynchronizerIds;
2261
2264
  exports.useSynchronizerOrSynchronizerById = useSynchronizerOrSynchronizerById;
@@ -151,6 +151,7 @@
151
151
  ? objGet(contextValue[offset * 2 + 1] ?? {}, id)
152
152
  : id;
153
153
  };
154
+ const useThings = (offset) => ({...useContext(Context)[offset * 2 + 1]});
154
155
  const useThingOrThingById = (thingOrThingId, offset) => {
155
156
  const thing = useThing(thingOrThingId, offset);
156
157
  return isUndefined(thingOrThingId) || isString(thingOrThingId)
@@ -168,6 +169,7 @@
168
169
  objIds(useContext(Context)[offset * 2 + 1] ?? {});
169
170
  const useStoreIds = () => useThingIds(0 /* Store */);
170
171
  const useStore = (id) => useThing(id, 0 /* Store */);
172
+ const useStores = () => useThings(0 /* Store */);
171
173
  const useStoreOrStoreById = (storeOrStoreId) =>
172
174
  useThingOrThingById(storeOrStoreId, 0 /* Store */);
173
175
  const useProvideStore = (storeId, store) =>
@@ -2256,6 +2258,7 @@
2256
2258
  exports.useStore = useStore;
2257
2259
  exports.useStoreIds = useStoreIds;
2258
2260
  exports.useStoreOrStoreById = useStoreOrStoreById;
2261
+ exports.useStores = useStores;
2259
2262
  exports.useSynchronizer = useSynchronizer;
2260
2263
  exports.useSynchronizerIds = useSynchronizerIds;
2261
2264
  exports.useSynchronizerOrSynchronizerById = useSynchronizerOrSynchronizerById;
@@ -2739,9 +2739,12 @@
2739
2739
  const getSchemaJson = () =>
2740
2740
  jsonStringWithMap([tablesSchemaMap, valuesSchemaMap]);
2741
2741
  const setContent = (content) =>
2742
- fluentTransaction(() =>
2743
- validateContent(content) ? setValidContent(content) : 0,
2744
- );
2742
+ fluentTransaction(() => {
2743
+ const content2 = isFunction(content) ? content() : content;
2744
+ if (validateContent(content2)) {
2745
+ setValidContent(content2);
2746
+ }
2747
+ });
2745
2748
  const setTables = (tables) =>
2746
2749
  fluentTransaction(() =>
2747
2750
  validateTables(tables) ? setValidTables(tables) : 0,
@@ -2739,9 +2739,12 @@
2739
2739
  const getSchemaJson = () =>
2740
2740
  jsonStringWithMap([tablesSchemaMap, valuesSchemaMap]);
2741
2741
  const setContent = (content) =>
2742
- fluentTransaction(() =>
2743
- validateContent(content) ? setValidContent(content) : 0,
2744
- );
2742
+ fluentTransaction(() => {
2743
+ const content2 = isFunction(content) ? content() : content;
2744
+ if (validateContent(content2)) {
2745
+ setValidContent(content2);
2746
+ }
2747
+ });
2745
2748
  const setTables = (tables) =>
2746
2749
  fluentTransaction(() =>
2747
2750
  validateTables(tables) ? setValidTables(tables) : 0,
@@ -2635,9 +2635,12 @@
2635
2635
  const getSchemaJson = () =>
2636
2636
  jsonStringWithMap([tablesSchemaMap, valuesSchemaMap]);
2637
2637
  const setContent = (content) =>
2638
- fluentTransaction(() =>
2639
- validateContent(content) ? setValidContent(content) : 0,
2640
- );
2638
+ fluentTransaction(() => {
2639
+ const content2 = isFunction(content) ? content() : content;
2640
+ if (validateContent(content2)) {
2641
+ setValidContent(content2);
2642
+ }
2643
+ });
2641
2644
  const setTables = (tables) =>
2642
2645
  fluentTransaction(() =>
2643
2646
  validateTables(tables) ? setValidTables(tables) : 0,
@@ -2572,9 +2572,12 @@ const createStore = () => {
2572
2572
  const getSchemaJson = () =>
2573
2573
  jsonStringWithMap([tablesSchemaMap, valuesSchemaMap]);
2574
2574
  const setContent = (content) =>
2575
- fluentTransaction(() =>
2576
- validateContent(content) ? setValidContent(content) : 0,
2577
- );
2575
+ fluentTransaction(() => {
2576
+ const content2 = isFunction(content) ? content() : content;
2577
+ if (validateContent(content2)) {
2578
+ setValidContent(content2);
2579
+ }
2580
+ });
2578
2581
  const setTables = (tables) =>
2579
2582
  fluentTransaction(() =>
2580
2583
  validateTables(tables) ? setValidTables(tables) : 0,