@verdant-web/store 2.7.7-next.0 → 2.7.7

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 (696) hide show
  1. package/dist/cjs/BackoffScheduler.d.ts +19 -19
  2. package/dist/cjs/BackoffScheduler.js +44 -44
  3. package/dist/cjs/DocumentManager.d.ts +28 -31
  4. package/dist/cjs/DocumentManager.js +44 -44
  5. package/dist/cjs/FakeWeakRef.d.ts +11 -11
  6. package/dist/cjs/FakeWeakRef.js +18 -18
  7. package/dist/cjs/IDBService.d.ts +9 -9
  8. package/dist/cjs/IDBService.js +63 -63
  9. package/dist/cjs/UndoHistory.d.ts +16 -16
  10. package/dist/cjs/UndoHistory.js +50 -50
  11. package/dist/cjs/__tests__/batching.test.d.ts +1 -1
  12. package/dist/cjs/__tests__/batching.test.js +44 -44
  13. package/dist/cjs/__tests__/documents.test.d.ts +1 -1
  14. package/dist/cjs/__tests__/documents.test.js +415 -415
  15. package/dist/cjs/__tests__/fixtures/testStorage.d.ts +123 -123
  16. package/dist/cjs/__tests__/fixtures/testStorage.js +117 -117
  17. package/dist/cjs/__tests__/legacyOids.test.d.ts +1 -1
  18. package/dist/cjs/__tests__/legacyOids.test.js +290 -290
  19. package/dist/cjs/__tests__/mutations.test.d.ts +1 -1
  20. package/dist/cjs/__tests__/mutations.test.js +41 -41
  21. package/dist/cjs/__tests__/queries.test.d.ts +1 -1
  22. package/dist/cjs/__tests__/queries.test.js +318 -318
  23. package/dist/cjs/__tests__/setup/indexedDB.d.ts +1 -1
  24. package/dist/cjs/__tests__/setup/indexedDB.js +3 -3
  25. package/dist/cjs/__tests__/undo.test.d.ts +1 -1
  26. package/dist/cjs/__tests__/undo.test.js +86 -86
  27. package/dist/cjs/client/Client.d.ts +99 -98
  28. package/dist/cjs/client/Client.js +227 -227
  29. package/dist/cjs/client/ClientDescriptor.d.ts +76 -76
  30. package/dist/cjs/client/ClientDescriptor.js +197 -197
  31. package/dist/cjs/client/constants.d.ts +1 -1
  32. package/dist/cjs/client/constants.js +4 -4
  33. package/dist/cjs/constants.d.ts +1 -1
  34. package/dist/cjs/constants.js +4 -4
  35. package/dist/cjs/context.d.ts +29 -29
  36. package/dist/cjs/context.js +2 -2
  37. package/dist/cjs/entities/DocumentFamiliyCache.d.ts +90 -90
  38. package/dist/cjs/entities/DocumentFamiliyCache.js +282 -282
  39. package/dist/cjs/entities/Entity.d.ts +206 -206
  40. package/dist/cjs/entities/Entity.js +520 -520
  41. package/dist/cjs/entities/EntityStore.d.ts +85 -85
  42. package/dist/cjs/entities/EntityStore.js +479 -479
  43. package/dist/cjs/files/EntityFile.d.ts +31 -31
  44. package/dist/cjs/files/EntityFile.js +76 -76
  45. package/dist/cjs/files/FileManager.d.ts +42 -42
  46. package/dist/cjs/files/FileManager.js +152 -152
  47. package/dist/cjs/files/FileStorage.d.ts +28 -28
  48. package/dist/cjs/files/FileStorage.js +104 -104
  49. package/dist/cjs/files/utils.d.ts +8 -8
  50. package/dist/cjs/files/utils.js +55 -55
  51. package/dist/cjs/files/utils.test.d.ts +1 -1
  52. package/dist/cjs/files/utils.test.js +80 -80
  53. package/dist/cjs/idb.d.ts +11 -11
  54. package/dist/cjs/idb.js +111 -111
  55. package/dist/cjs/index.d.ts +21 -21
  56. package/dist/cjs/index.js +23 -23
  57. package/dist/cjs/metadata/AckInfoStore.d.ts +10 -10
  58. package/dist/cjs/metadata/AckInfoStore.js +25 -25
  59. package/dist/cjs/metadata/BaselinesStore.d.ts +33 -33
  60. package/dist/cjs/metadata/BaselinesStore.js +89 -89
  61. package/dist/cjs/metadata/LocalReplicaStore.d.ts +17 -17
  62. package/dist/cjs/metadata/LocalReplicaStore.js +47 -47
  63. package/dist/cjs/metadata/MessageCreator.d.ts +19 -19
  64. package/dist/cjs/metadata/MessageCreator.js +127 -127
  65. package/dist/cjs/metadata/Metadata.d.ts +112 -112
  66. package/dist/cjs/metadata/Metadata.js +352 -352
  67. package/dist/cjs/metadata/OperationsStore.d.ts +53 -53
  68. package/dist/cjs/metadata/OperationsStore.js +152 -152
  69. package/dist/cjs/metadata/SchemaStore.d.ts +9 -9
  70. package/dist/cjs/metadata/SchemaStore.js +38 -38
  71. package/dist/cjs/metadata/openMetadataDatabase.d.ts +19 -19
  72. package/dist/cjs/metadata/openMetadataDatabase.js +219 -219
  73. package/dist/cjs/migration/db.d.ts +8 -8
  74. package/dist/cjs/migration/db.js +111 -111
  75. package/dist/cjs/migration/errors.d.ts +5 -5
  76. package/dist/cjs/migration/errors.js +11 -11
  77. package/dist/cjs/migration/openDatabase.d.ts +20 -20
  78. package/dist/cjs/migration/openDatabase.js +428 -428
  79. package/dist/cjs/migration/paths.d.ts +6 -6
  80. package/dist/cjs/migration/paths.js +52 -52
  81. package/dist/cjs/migration/paths.test.d.ts +1 -1
  82. package/dist/cjs/migration/paths.test.js +90 -90
  83. package/dist/cjs/queries/BaseQuery.d.ts +53 -53
  84. package/dist/cjs/queries/BaseQuery.js +135 -135
  85. package/dist/cjs/queries/CollectionQueries.d.ts +55 -55
  86. package/dist/cjs/queries/CollectionQueries.js +91 -91
  87. package/dist/cjs/queries/FindAllQuery.d.ts +12 -12
  88. package/dist/cjs/queries/FindAllQuery.js +42 -42
  89. package/dist/cjs/queries/FindInfiniteQuery.d.ts +19 -19
  90. package/dist/cjs/queries/FindInfiniteQuery.js +69 -69
  91. package/dist/cjs/queries/FindOneQuery.d.ts +12 -12
  92. package/dist/cjs/queries/FindOneQuery.js +42 -42
  93. package/dist/cjs/queries/FindPageQuery.d.ts +24 -24
  94. package/dist/cjs/queries/FindPageQuery.js +76 -76
  95. package/dist/cjs/queries/GetQuery.d.ts +10 -10
  96. package/dist/cjs/queries/GetQuery.js +29 -29
  97. package/dist/cjs/queries/QueryCache.d.ts +16 -16
  98. package/dist/cjs/queries/QueryCache.js +41 -41
  99. package/dist/cjs/queries/dbQueries.d.ts +22 -22
  100. package/dist/cjs/queries/dbQueries.js +125 -125
  101. package/dist/cjs/queries/keys.d.ts +10 -10
  102. package/dist/cjs/queries/keys.js +33 -33
  103. package/dist/cjs/queries/ranges.d.ts +2 -2
  104. package/dist/cjs/queries/ranges.js +69 -69
  105. package/dist/cjs/queries/types.d.ts +6 -6
  106. package/dist/cjs/queries/types.js +2 -2
  107. package/dist/cjs/queries/utils.d.ts +3 -3
  108. package/dist/cjs/queries/utils.js +24 -24
  109. package/dist/cjs/sync/FileSync.d.ts +23 -23
  110. package/dist/cjs/sync/FileSync.js +84 -84
  111. package/dist/cjs/sync/Heartbeat.d.ts +25 -25
  112. package/dist/cjs/sync/Heartbeat.js +63 -63
  113. package/dist/cjs/sync/PresenceManager.d.ts +43 -43
  114. package/dist/cjs/sync/PresenceManager.js +119 -119
  115. package/dist/cjs/sync/PushPullSync.d.ts +36 -36
  116. package/dist/cjs/sync/PushPullSync.js +143 -143
  117. package/dist/cjs/sync/ServerSyncEndpointProvider.d.ts +27 -27
  118. package/dist/cjs/sync/ServerSyncEndpointProvider.js +64 -64
  119. package/dist/cjs/sync/Sync.d.ts +146 -146
  120. package/dist/cjs/sync/Sync.js +270 -270
  121. package/dist/cjs/sync/WebSocketSync.d.ts +41 -41
  122. package/dist/cjs/sync/WebSocketSync.js +190 -190
  123. package/dist/cjs/types.d.ts +12 -12
  124. package/dist/cjs/types.js +2 -2
  125. package/dist/cjs/utils/Disposable.d.ts +6 -6
  126. package/dist/cjs/utils/Disposable.js +18 -18
  127. package/dist/cjs/utils/Resolvable.d.ts +8 -8
  128. package/dist/cjs/utils/Resolvable.js +22 -22
  129. package/dist/cjs/vanilla.d.ts +1 -1
  130. package/dist/cjs/vanilla.js +27 -27
  131. package/dist/esm/BackoffScheduler.d.ts +19 -19
  132. package/dist/esm/BackoffScheduler.js +39 -39
  133. package/dist/esm/DocumentManager.d.ts +28 -28
  134. package/dist/esm/DocumentManager.js +40 -40
  135. package/dist/esm/FakeWeakRef.d.ts +11 -11
  136. package/dist/esm/FakeWeakRef.js +14 -14
  137. package/dist/esm/IDBService.d.ts +9 -9
  138. package/dist/esm/IDBService.js +59 -59
  139. package/dist/esm/UndoHistory.d.ts +16 -16
  140. package/dist/esm/UndoHistory.js +46 -46
  141. package/dist/esm/__tests__/batching.test.d.ts +1 -1
  142. package/dist/esm/__tests__/batching.test.js +42 -42
  143. package/dist/esm/__tests__/documents.test.d.ts +1 -1
  144. package/dist/esm/__tests__/documents.test.js +413 -413
  145. package/dist/esm/__tests__/fixtures/testStorage.d.ts +123 -123
  146. package/dist/esm/__tests__/fixtures/testStorage.js +113 -113
  147. package/dist/esm/__tests__/legacyOids.test.d.ts +1 -1
  148. package/dist/esm/__tests__/legacyOids.test.js +288 -288
  149. package/dist/esm/__tests__/mutations.test.d.ts +1 -1
  150. package/dist/esm/__tests__/mutations.test.js +39 -39
  151. package/dist/esm/__tests__/queries.test.d.ts +1 -1
  152. package/dist/esm/__tests__/queries.test.js +316 -316
  153. package/dist/esm/__tests__/setup/indexedDB.d.ts +1 -1
  154. package/dist/esm/__tests__/setup/indexedDB.js +1 -1
  155. package/dist/esm/__tests__/undo.test.d.ts +1 -1
  156. package/dist/esm/__tests__/undo.test.js +84 -84
  157. package/dist/esm/client/Client.d.ts +99 -99
  158. package/dist/esm/client/Client.js +223 -223
  159. package/dist/esm/client/ClientDescriptor.d.ts +76 -76
  160. package/dist/esm/client/ClientDescriptor.js +193 -193
  161. package/dist/esm/client/constants.d.ts +1 -1
  162. package/dist/esm/client/constants.js +1 -1
  163. package/dist/esm/constants.d.ts +1 -1
  164. package/dist/esm/constants.js +1 -1
  165. package/dist/esm/context.d.ts +29 -29
  166. package/dist/esm/context.js +1 -1
  167. package/dist/esm/entities/DocumentFamiliyCache.d.ts +90 -90
  168. package/dist/esm/entities/DocumentFamiliyCache.js +278 -278
  169. package/dist/esm/entities/Entity.d.ts +206 -206
  170. package/dist/esm/entities/Entity.js +515 -515
  171. package/dist/esm/entities/EntityStore.d.ts +85 -85
  172. package/dist/esm/entities/EntityStore.js +475 -475
  173. package/dist/esm/files/EntityFile.d.ts +31 -31
  174. package/dist/esm/files/EntityFile.js +72 -72
  175. package/dist/esm/files/FileManager.d.ts +42 -42
  176. package/dist/esm/files/FileManager.js +148 -148
  177. package/dist/esm/files/FileStorage.d.ts +28 -28
  178. package/dist/esm/files/FileStorage.js +99 -99
  179. package/dist/esm/files/utils.d.ts +8 -8
  180. package/dist/esm/files/utils.js +46 -46
  181. package/dist/esm/files/utils.test.d.ts +1 -1
  182. package/dist/esm/files/utils.test.js +78 -78
  183. package/dist/esm/idb.d.ts +11 -11
  184. package/dist/esm/idb.js +100 -100
  185. package/dist/esm/index.d.ts +21 -21
  186. package/dist/esm/index.js +12 -12
  187. package/dist/esm/metadata/AckInfoStore.d.ts +10 -10
  188. package/dist/esm/metadata/AckInfoStore.js +21 -21
  189. package/dist/esm/metadata/BaselinesStore.d.ts +33 -33
  190. package/dist/esm/metadata/BaselinesStore.js +85 -85
  191. package/dist/esm/metadata/LocalReplicaStore.d.ts +17 -17
  192. package/dist/esm/metadata/LocalReplicaStore.js +40 -40
  193. package/dist/esm/metadata/MessageCreator.d.ts +19 -19
  194. package/dist/esm/metadata/MessageCreator.js +123 -123
  195. package/dist/esm/metadata/Metadata.d.ts +112 -112
  196. package/dist/esm/metadata/Metadata.js +348 -348
  197. package/dist/esm/metadata/OperationsStore.d.ts +53 -53
  198. package/dist/esm/metadata/OperationsStore.js +148 -148
  199. package/dist/esm/metadata/SchemaStore.d.ts +9 -9
  200. package/dist/esm/metadata/SchemaStore.js +34 -34
  201. package/dist/esm/metadata/openMetadataDatabase.d.ts +19 -19
  202. package/dist/esm/metadata/openMetadataDatabase.js +214 -214
  203. package/dist/esm/migration/db.d.ts +8 -8
  204. package/dist/esm/migration/db.js +103 -103
  205. package/dist/esm/migration/errors.d.ts +5 -5
  206. package/dist/esm/migration/errors.js +7 -7
  207. package/dist/esm/migration/openDatabase.d.ts +20 -20
  208. package/dist/esm/migration/openDatabase.js +423 -423
  209. package/dist/esm/migration/paths.d.ts +6 -6
  210. package/dist/esm/migration/paths.js +48 -48
  211. package/dist/esm/migration/paths.test.d.ts +1 -1
  212. package/dist/esm/migration/paths.test.js +88 -88
  213. package/dist/esm/queries/BaseQuery.d.ts +53 -53
  214. package/dist/esm/queries/BaseQuery.js +131 -131
  215. package/dist/esm/queries/CollectionQueries.d.ts +55 -55
  216. package/dist/esm/queries/CollectionQueries.js +87 -87
  217. package/dist/esm/queries/FindAllQuery.d.ts +12 -12
  218. package/dist/esm/queries/FindAllQuery.js +38 -38
  219. package/dist/esm/queries/FindInfiniteQuery.d.ts +19 -19
  220. package/dist/esm/queries/FindInfiniteQuery.js +65 -65
  221. package/dist/esm/queries/FindOneQuery.d.ts +12 -12
  222. package/dist/esm/queries/FindOneQuery.js +38 -38
  223. package/dist/esm/queries/FindPageQuery.d.ts +24 -24
  224. package/dist/esm/queries/FindPageQuery.js +72 -72
  225. package/dist/esm/queries/GetQuery.d.ts +10 -10
  226. package/dist/esm/queries/GetQuery.js +25 -25
  227. package/dist/esm/queries/QueryCache.d.ts +16 -16
  228. package/dist/esm/queries/QueryCache.js +37 -37
  229. package/dist/esm/queries/dbQueries.d.ts +22 -22
  230. package/dist/esm/queries/dbQueries.js +119 -119
  231. package/dist/esm/queries/keys.d.ts +10 -10
  232. package/dist/esm/queries/keys.js +29 -29
  233. package/dist/esm/queries/ranges.d.ts +2 -2
  234. package/dist/esm/queries/ranges.js +65 -65
  235. package/dist/esm/queries/types.d.ts +6 -6
  236. package/dist/esm/queries/types.js +1 -1
  237. package/dist/esm/queries/utils.d.ts +3 -3
  238. package/dist/esm/queries/utils.js +19 -19
  239. package/dist/esm/sync/FileSync.d.ts +23 -23
  240. package/dist/esm/sync/FileSync.js +80 -80
  241. package/dist/esm/sync/Heartbeat.d.ts +25 -25
  242. package/dist/esm/sync/Heartbeat.js +59 -59
  243. package/dist/esm/sync/PresenceManager.d.ts +43 -43
  244. package/dist/esm/sync/PresenceManager.js +115 -115
  245. package/dist/esm/sync/PushPullSync.d.ts +36 -36
  246. package/dist/esm/sync/PushPullSync.js +139 -139
  247. package/dist/esm/sync/ServerSyncEndpointProvider.d.ts +27 -27
  248. package/dist/esm/sync/ServerSyncEndpointProvider.js +57 -57
  249. package/dist/esm/sync/Sync.d.ts +146 -146
  250. package/dist/esm/sync/Sync.js +265 -265
  251. package/dist/esm/sync/{WebsocketSync.d.ts → WebSocketSync.d.ts} +41 -41
  252. package/dist/esm/sync/{WebsocketSync.js → WebSocketSync.js} +186 -186
  253. package/dist/esm/types.d.ts +12 -12
  254. package/dist/esm/types.js +1 -1
  255. package/dist/esm/utils/Disposable.d.ts +6 -6
  256. package/dist/esm/utils/Disposable.js +14 -14
  257. package/dist/esm/utils/Resolvable.d.ts +8 -8
  258. package/dist/esm/utils/Resolvable.js +18 -18
  259. package/dist/esm/vanilla.d.ts +1 -1
  260. package/dist/esm/vanilla.js +2 -2
  261. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  262. package/dist/tsconfig.tsbuildinfo +1 -1
  263. package/package.json +2 -2
  264. package/dist/cjs/AckInfoStore.d.ts +0 -10
  265. package/dist/cjs/AckInfoStore.js +0 -26
  266. package/dist/cjs/AckInfoStore.js.map +0 -1
  267. package/dist/cjs/BaselinesStore.d.ts +0 -10
  268. package/dist/cjs/BaselinesStore.js +0 -36
  269. package/dist/cjs/BaselinesStore.js.map +0 -1
  270. package/dist/cjs/Entity.d.ts +0 -96
  271. package/dist/cjs/Entity.js +0 -345
  272. package/dist/cjs/Entity.js.map +0 -1
  273. package/dist/cjs/EntityStore.d.ts +0 -36
  274. package/dist/cjs/EntityStore.js +0 -172
  275. package/dist/cjs/EntityStore.js.map +0 -1
  276. package/dist/cjs/LocalHistoryStore.d.ts +0 -15
  277. package/dist/cjs/LocalHistoryStore.js +0 -53
  278. package/dist/cjs/LocalHistoryStore.js.map +0 -1
  279. package/dist/cjs/LocalReplicaStore.d.ts +0 -13
  280. package/dist/cjs/LocalReplicaStore.js +0 -49
  281. package/dist/cjs/LocalReplicaStore.js.map +0 -1
  282. package/dist/cjs/MessageCreator.d.ts +0 -19
  283. package/dist/cjs/MessageCreator.js +0 -104
  284. package/dist/cjs/MessageCreator.js.map +0 -1
  285. package/dist/cjs/Metadata.d.ts +0 -91
  286. package/dist/cjs/Metadata.js +0 -250
  287. package/dist/cjs/Metadata.js.map +0 -1
  288. package/dist/cjs/OperationsStore.d.ts +0 -38
  289. package/dist/cjs/OperationsStore.js +0 -146
  290. package/dist/cjs/OperationsStore.js.map +0 -1
  291. package/dist/cjs/PresenceManager.d.ts +0 -30
  292. package/dist/cjs/PresenceManager.js +0 -89
  293. package/dist/cjs/PresenceManager.js.map +0 -1
  294. package/dist/cjs/Query.d.ts +0 -26
  295. package/dist/cjs/Query.js +0 -86
  296. package/dist/cjs/Query.js.map +0 -1
  297. package/dist/cjs/QueryMaker.d.ts +0 -18
  298. package/dist/cjs/QueryMaker.js +0 -98
  299. package/dist/cjs/QueryMaker.js.map +0 -1
  300. package/dist/cjs/QueryStore.d.ts +0 -38
  301. package/dist/cjs/QueryStore.js +0 -146
  302. package/dist/cjs/QueryStore.js.map +0 -1
  303. package/dist/cjs/SchemaStore.d.ts +0 -9
  304. package/dist/cjs/SchemaStore.js +0 -35
  305. package/dist/cjs/SchemaStore.js.map +0 -1
  306. package/dist/cjs/Storage.d.ts +0 -147
  307. package/dist/cjs/Storage.js +0 -346
  308. package/dist/cjs/Storage.js.map +0 -1
  309. package/dist/cjs/Sync.d.ts +0 -117
  310. package/dist/cjs/Sync.js +0 -561
  311. package/dist/cjs/Sync.js.map +0 -1
  312. package/dist/cjs/SyncHarness.d.ts +0 -45
  313. package/dist/cjs/SyncHarness.js +0 -110
  314. package/dist/cjs/SyncHarness.js.map +0 -1
  315. package/dist/cjs/indexes.d.ts +0 -3
  316. package/dist/cjs/indexes.js +0 -20
  317. package/dist/cjs/indexes.js.map +0 -1
  318. package/dist/cjs/metadata/LocalHistoryStore.d.ts +0 -15
  319. package/dist/cjs/metadata/LocalHistoryStore.js +0 -53
  320. package/dist/cjs/metadata/LocalHistoryStore.js.map +0 -1
  321. package/dist/cjs/openDocumentDatabase.d.ts +0 -12
  322. package/dist/cjs/openDocumentDatabase.js +0 -432
  323. package/dist/cjs/openDocumentDatabase.js.map +0 -1
  324. package/dist/cjs/queries/LiveQuery.d.ts +0 -28
  325. package/dist/cjs/queries/LiveQuery.js +0 -96
  326. package/dist/cjs/queries/LiveQuery.js.map +0 -1
  327. package/dist/cjs/queries/LiveQueryMaker.d.ts +0 -15
  328. package/dist/cjs/queries/LiveQueryMaker.js +0 -42
  329. package/dist/cjs/queries/LiveQueryMaker.js.map +0 -1
  330. package/dist/cjs/queries/LiveQueryStore.d.ts +0 -33
  331. package/dist/cjs/queries/LiveQueryStore.js +0 -85
  332. package/dist/cjs/queries/LiveQueryStore.js.map +0 -1
  333. package/dist/cjs/queries/Query.d.ts +0 -18
  334. package/dist/cjs/queries/Query.js +0 -36
  335. package/dist/cjs/queries/Query.js.map +0 -1
  336. package/dist/cjs/queries/QueryMaker.d.ts +0 -14
  337. package/dist/cjs/queries/QueryMaker.js +0 -42
  338. package/dist/cjs/queries/QueryMaker.js.map +0 -1
  339. package/dist/cjs/queries/QueryStore.d.ts +0 -35
  340. package/dist/cjs/queries/QueryStore.js +0 -130
  341. package/dist/cjs/queries/QueryStore.js.map +0 -1
  342. package/dist/cjs/queries2/BaseQuery.d.ts +0 -39
  343. package/dist/cjs/queries2/BaseQuery.js +0 -99
  344. package/dist/cjs/queries2/BaseQuery.js.map +0 -1
  345. package/dist/cjs/queries2/CollectionQueries.d.ts +0 -55
  346. package/dist/cjs/queries2/CollectionQueries.js +0 -83
  347. package/dist/cjs/queries2/CollectionQueries.js.map +0 -1
  348. package/dist/cjs/queries2/FindAllQuery.d.ts +0 -11
  349. package/dist/cjs/queries2/FindAllQuery.js +0 -34
  350. package/dist/cjs/queries2/FindAllQuery.js.map +0 -1
  351. package/dist/cjs/queries2/FindInfiniteQuery.d.ts +0 -18
  352. package/dist/cjs/queries2/FindInfiniteQuery.js +0 -61
  353. package/dist/cjs/queries2/FindInfiniteQuery.js.map +0 -1
  354. package/dist/cjs/queries2/FindOneQuery.d.ts +0 -11
  355. package/dist/cjs/queries2/FindOneQuery.js +0 -34
  356. package/dist/cjs/queries2/FindOneQuery.js.map +0 -1
  357. package/dist/cjs/queries2/FindPageQuery.d.ts +0 -23
  358. package/dist/cjs/queries2/FindPageQuery.js +0 -68
  359. package/dist/cjs/queries2/FindPageQuery.js.map +0 -1
  360. package/dist/cjs/queries2/GetQuery.d.ts +0 -10
  361. package/dist/cjs/queries2/GetQuery.js +0 -30
  362. package/dist/cjs/queries2/GetQuery.js.map +0 -1
  363. package/dist/cjs/queries2/QueryCache.d.ts +0 -16
  364. package/dist/cjs/queries2/QueryCache.js +0 -40
  365. package/dist/cjs/queries2/QueryCache.js.map +0 -1
  366. package/dist/cjs/queries2/dbQueries.d.ts +0 -22
  367. package/dist/cjs/queries2/dbQueries.js +0 -126
  368. package/dist/cjs/queries2/dbQueries.js.map +0 -1
  369. package/dist/cjs/queries2/keys.d.ts +0 -10
  370. package/dist/cjs/queries2/keys.js +0 -34
  371. package/dist/cjs/queries2/keys.js.map +0 -1
  372. package/dist/cjs/queries2/ranges.d.ts +0 -2
  373. package/dist/cjs/queries2/ranges.js +0 -70
  374. package/dist/cjs/queries2/ranges.js.map +0 -1
  375. package/dist/cjs/queries2/types.d.ts +0 -6
  376. package/dist/cjs/queries2/types.js +0 -3
  377. package/dist/cjs/queries2/types.js.map +0 -1
  378. package/dist/cjs/queries2/utils.d.ts +0 -1
  379. package/dist/cjs/queries2/utils.js +0 -20
  380. package/dist/cjs/queries2/utils.js.map +0 -1
  381. package/dist/cjs/reactives/DocumentFamiliyCache.d.ts +0 -47
  382. package/dist/cjs/reactives/DocumentFamiliyCache.js +0 -211
  383. package/dist/cjs/reactives/DocumentFamiliyCache.js.map +0 -1
  384. package/dist/cjs/reactives/Entity.d.ts +0 -191
  385. package/dist/cjs/reactives/Entity.js +0 -463
  386. package/dist/cjs/reactives/Entity.js.map +0 -1
  387. package/dist/cjs/reactives/EntityStore.d.ts +0 -84
  388. package/dist/cjs/reactives/EntityStore.js +0 -422
  389. package/dist/cjs/reactives/EntityStore.js.map +0 -1
  390. package/dist/cjs/reactives/FakeWeakRef.d.ts +0 -11
  391. package/dist/cjs/reactives/FakeWeakRef.js +0 -19
  392. package/dist/cjs/reactives/FakeWeakRef.js.map +0 -1
  393. package/dist/cjs/v2/AckInfoStore.d.ts +0 -10
  394. package/dist/cjs/v2/AckInfoStore.js +0 -26
  395. package/dist/cjs/v2/AckInfoStore.js.map +0 -1
  396. package/dist/cjs/v2/BaselinesStore.d.ts +0 -10
  397. package/dist/cjs/v2/BaselinesStore.js +0 -36
  398. package/dist/cjs/v2/BaselinesStore.js.map +0 -1
  399. package/dist/cjs/v2/DocumentManager.d.ts +0 -19
  400. package/dist/cjs/v2/DocumentManager.js +0 -47
  401. package/dist/cjs/v2/DocumentManager.js.map +0 -1
  402. package/dist/cjs/v2/Entity.d.ts +0 -87
  403. package/dist/cjs/v2/Entity.js +0 -305
  404. package/dist/cjs/v2/Entity.js.map +0 -1
  405. package/dist/cjs/v2/EntityStore.d.ts +0 -37
  406. package/dist/cjs/v2/EntityStore.js +0 -165
  407. package/dist/cjs/v2/EntityStore.js.map +0 -1
  408. package/dist/cjs/v2/IDBService.d.ts +0 -7
  409. package/dist/cjs/v2/IDBService.js +0 -26
  410. package/dist/cjs/v2/IDBService.js.map +0 -1
  411. package/dist/cjs/v2/LocalHistoryStore.d.ts +0 -15
  412. package/dist/cjs/v2/LocalHistoryStore.js +0 -53
  413. package/dist/cjs/v2/LocalHistoryStore.js.map +0 -1
  414. package/dist/cjs/v2/LocalReplicaStore.d.ts +0 -14
  415. package/dist/cjs/v2/LocalReplicaStore.js +0 -49
  416. package/dist/cjs/v2/LocalReplicaStore.js.map +0 -1
  417. package/dist/cjs/v2/MessageCreator.d.ts +0 -19
  418. package/dist/cjs/v2/MessageCreator.js +0 -99
  419. package/dist/cjs/v2/MessageCreator.js.map +0 -1
  420. package/dist/cjs/v2/Metadata.d.ts +0 -90
  421. package/dist/cjs/v2/Metadata.js +0 -251
  422. package/dist/cjs/v2/Metadata.js.map +0 -1
  423. package/dist/cjs/v2/OperationsStore.d.ts +0 -38
  424. package/dist/cjs/v2/OperationsStore.js +0 -146
  425. package/dist/cjs/v2/OperationsStore.js.map +0 -1
  426. package/dist/cjs/v2/PresenceManager.d.ts +0 -24
  427. package/dist/cjs/v2/PresenceManager.js +0 -73
  428. package/dist/cjs/v2/PresenceManager.js.map +0 -1
  429. package/dist/cjs/v2/Query.d.ts +0 -24
  430. package/dist/cjs/v2/Query.js +0 -79
  431. package/dist/cjs/v2/Query.js.map +0 -1
  432. package/dist/cjs/v2/QueryMaker.d.ts +0 -16
  433. package/dist/cjs/v2/QueryMaker.js +0 -84
  434. package/dist/cjs/v2/QueryMaker.js.map +0 -1
  435. package/dist/cjs/v2/QueryStore.d.ts +0 -26
  436. package/dist/cjs/v2/QueryStore.js +0 -136
  437. package/dist/cjs/v2/QueryStore.js.map +0 -1
  438. package/dist/cjs/v2/SchemaStore.d.ts +0 -9
  439. package/dist/cjs/v2/SchemaStore.js +0 -35
  440. package/dist/cjs/v2/SchemaStore.js.map +0 -1
  441. package/dist/cjs/v2/Storage.d.ts +0 -80
  442. package/dist/cjs/v2/Storage.js +0 -154
  443. package/dist/cjs/v2/Storage.js.map +0 -1
  444. package/dist/cjs/v2/Sync.d.ts +0 -42
  445. package/dist/cjs/v2/Sync.js +0 -98
  446. package/dist/cjs/v2/Sync.js.map +0 -1
  447. package/dist/cjs/v2/SyncHarness.d.ts +0 -45
  448. package/dist/cjs/v2/SyncHarness.js +0 -110
  449. package/dist/cjs/v2/SyncHarness.js.map +0 -1
  450. package/dist/cjs/v2/__tests__/documents.test.d.ts +0 -1
  451. package/dist/cjs/v2/__tests__/documents.test.js +0 -185
  452. package/dist/cjs/v2/__tests__/documents.test.js.map +0 -1
  453. package/dist/cjs/v2/__tests__/fixtures/testStorage.d.ts +0 -189
  454. package/dist/cjs/v2/__tests__/fixtures/testStorage.js +0 -93
  455. package/dist/cjs/v2/__tests__/fixtures/testStorage.js.map +0 -1
  456. package/dist/cjs/v2/__tests__/queries.test.d.ts +0 -1
  457. package/dist/cjs/v2/__tests__/queries.test.js +0 -92
  458. package/dist/cjs/v2/__tests__/queries.test.js.map +0 -1
  459. package/dist/cjs/v2/__tests__/setup/indexedDB.d.ts +0 -1
  460. package/dist/cjs/v2/__tests__/setup/indexedDB.js +0 -4
  461. package/dist/cjs/v2/__tests__/setup/indexedDB.js.map +0 -1
  462. package/dist/cjs/v2/constants.d.ts +0 -1
  463. package/dist/cjs/v2/constants.js +0 -5
  464. package/dist/cjs/v2/constants.js.map +0 -1
  465. package/dist/cjs/v2/idb.d.ts +0 -6
  466. package/dist/cjs/v2/idb.js +0 -71
  467. package/dist/cjs/v2/idb.js.map +0 -1
  468. package/dist/cjs/v2/index.d.ts +0 -6
  469. package/dist/cjs/v2/index.js +0 -14
  470. package/dist/cjs/v2/index.js.map +0 -1
  471. package/dist/cjs/v2/indexes.d.ts +0 -3
  472. package/dist/cjs/v2/indexes.js +0 -20
  473. package/dist/cjs/v2/indexes.js.map +0 -1
  474. package/dist/cjs/v2/openDocumentDatabase.d.ts +0 -9
  475. package/dist/cjs/v2/openDocumentDatabase.js +0 -100
  476. package/dist/cjs/v2/openDocumentDatabase.js.map +0 -1
  477. package/dist/cjs/v2/types.d.ts +0 -3
  478. package/dist/cjs/v2/types.js +0 -3
  479. package/dist/cjs/v2/types.js.map +0 -1
  480. package/dist/esm/AckInfoStore.d.ts +0 -10
  481. package/dist/esm/AckInfoStore.js +0 -22
  482. package/dist/esm/AckInfoStore.js.map +0 -1
  483. package/dist/esm/BaselinesStore.d.ts +0 -10
  484. package/dist/esm/BaselinesStore.js +0 -32
  485. package/dist/esm/BaselinesStore.js.map +0 -1
  486. package/dist/esm/Entity.d.ts +0 -96
  487. package/dist/esm/Entity.js +0 -337
  488. package/dist/esm/Entity.js.map +0 -1
  489. package/dist/esm/EntityStore.d.ts +0 -36
  490. package/dist/esm/EntityStore.js +0 -168
  491. package/dist/esm/EntityStore.js.map +0 -1
  492. package/dist/esm/LocalHistoryStore.d.ts +0 -15
  493. package/dist/esm/LocalHistoryStore.js +0 -49
  494. package/dist/esm/LocalHistoryStore.js.map +0 -1
  495. package/dist/esm/LocalReplicaStore.d.ts +0 -13
  496. package/dist/esm/LocalReplicaStore.js +0 -42
  497. package/dist/esm/LocalReplicaStore.js.map +0 -1
  498. package/dist/esm/MessageCreator.d.ts +0 -19
  499. package/dist/esm/MessageCreator.js +0 -97
  500. package/dist/esm/MessageCreator.js.map +0 -1
  501. package/dist/esm/Metadata.d.ts +0 -91
  502. package/dist/esm/Metadata.js +0 -245
  503. package/dist/esm/Metadata.js.map +0 -1
  504. package/dist/esm/OperationsStore.d.ts +0 -38
  505. package/dist/esm/OperationsStore.js +0 -142
  506. package/dist/esm/OperationsStore.js.map +0 -1
  507. package/dist/esm/PresenceManager.d.ts +0 -30
  508. package/dist/esm/PresenceManager.js +0 -85
  509. package/dist/esm/PresenceManager.js.map +0 -1
  510. package/dist/esm/Query.d.ts +0 -26
  511. package/dist/esm/Query.js +0 -82
  512. package/dist/esm/Query.js.map +0 -1
  513. package/dist/esm/QueryMaker.d.ts +0 -18
  514. package/dist/esm/QueryMaker.js +0 -94
  515. package/dist/esm/QueryMaker.js.map +0 -1
  516. package/dist/esm/QueryStore.d.ts +0 -38
  517. package/dist/esm/QueryStore.js +0 -142
  518. package/dist/esm/QueryStore.js.map +0 -1
  519. package/dist/esm/SchemaStore.d.ts +0 -9
  520. package/dist/esm/SchemaStore.js +0 -31
  521. package/dist/esm/SchemaStore.js.map +0 -1
  522. package/dist/esm/Storage.d.ts +0 -147
  523. package/dist/esm/Storage.js +0 -341
  524. package/dist/esm/Storage.js.map +0 -1
  525. package/dist/esm/Sync.d.ts +0 -117
  526. package/dist/esm/Sync.js +0 -553
  527. package/dist/esm/Sync.js.map +0 -1
  528. package/dist/esm/SyncHarness.d.ts +0 -45
  529. package/dist/esm/SyncHarness.js +0 -105
  530. package/dist/esm/SyncHarness.js.map +0 -1
  531. package/dist/esm/indexes.d.ts +0 -3
  532. package/dist/esm/indexes.js +0 -15
  533. package/dist/esm/indexes.js.map +0 -1
  534. package/dist/esm/metadata/LocalHistoryStore.d.ts +0 -15
  535. package/dist/esm/metadata/LocalHistoryStore.js +0 -49
  536. package/dist/esm/metadata/LocalHistoryStore.js.map +0 -1
  537. package/dist/esm/openDocumentDatabase.d.ts +0 -12
  538. package/dist/esm/openDocumentDatabase.js +0 -428
  539. package/dist/esm/openDocumentDatabase.js.map +0 -1
  540. package/dist/esm/queries/LiveQuery.d.ts +0 -28
  541. package/dist/esm/queries/LiveQuery.js +0 -92
  542. package/dist/esm/queries/LiveQuery.js.map +0 -1
  543. package/dist/esm/queries/LiveQueryMaker.d.ts +0 -15
  544. package/dist/esm/queries/LiveQueryMaker.js +0 -38
  545. package/dist/esm/queries/LiveQueryMaker.js.map +0 -1
  546. package/dist/esm/queries/LiveQueryStore.d.ts +0 -33
  547. package/dist/esm/queries/LiveQueryStore.js +0 -81
  548. package/dist/esm/queries/LiveQueryStore.js.map +0 -1
  549. package/dist/esm/queries/Query.d.ts +0 -18
  550. package/dist/esm/queries/Query.js +0 -32
  551. package/dist/esm/queries/Query.js.map +0 -1
  552. package/dist/esm/queries/QueryMaker.d.ts +0 -14
  553. package/dist/esm/queries/QueryMaker.js +0 -38
  554. package/dist/esm/queries/QueryMaker.js.map +0 -1
  555. package/dist/esm/queries/QueryStore.d.ts +0 -35
  556. package/dist/esm/queries/QueryStore.js +0 -126
  557. package/dist/esm/queries/QueryStore.js.map +0 -1
  558. package/dist/esm/queries2/BaseQuery.d.ts +0 -39
  559. package/dist/esm/queries2/BaseQuery.js +0 -95
  560. package/dist/esm/queries2/BaseQuery.js.map +0 -1
  561. package/dist/esm/queries2/CollectionQueries.d.ts +0 -55
  562. package/dist/esm/queries2/CollectionQueries.js +0 -79
  563. package/dist/esm/queries2/CollectionQueries.js.map +0 -1
  564. package/dist/esm/queries2/FindAllQuery.d.ts +0 -11
  565. package/dist/esm/queries2/FindAllQuery.js +0 -30
  566. package/dist/esm/queries2/FindAllQuery.js.map +0 -1
  567. package/dist/esm/queries2/FindInfiniteQuery.d.ts +0 -18
  568. package/dist/esm/queries2/FindInfiniteQuery.js +0 -57
  569. package/dist/esm/queries2/FindInfiniteQuery.js.map +0 -1
  570. package/dist/esm/queries2/FindOneQuery.d.ts +0 -11
  571. package/dist/esm/queries2/FindOneQuery.js +0 -30
  572. package/dist/esm/queries2/FindOneQuery.js.map +0 -1
  573. package/dist/esm/queries2/FindPageQuery.d.ts +0 -23
  574. package/dist/esm/queries2/FindPageQuery.js +0 -64
  575. package/dist/esm/queries2/FindPageQuery.js.map +0 -1
  576. package/dist/esm/queries2/GetQuery.d.ts +0 -10
  577. package/dist/esm/queries2/GetQuery.js +0 -26
  578. package/dist/esm/queries2/GetQuery.js.map +0 -1
  579. package/dist/esm/queries2/QueryCache.d.ts +0 -16
  580. package/dist/esm/queries2/QueryCache.js +0 -36
  581. package/dist/esm/queries2/QueryCache.js.map +0 -1
  582. package/dist/esm/queries2/dbQueries.d.ts +0 -22
  583. package/dist/esm/queries2/dbQueries.js +0 -120
  584. package/dist/esm/queries2/dbQueries.js.map +0 -1
  585. package/dist/esm/queries2/keys.d.ts +0 -10
  586. package/dist/esm/queries2/keys.js +0 -30
  587. package/dist/esm/queries2/keys.js.map +0 -1
  588. package/dist/esm/queries2/ranges.d.ts +0 -2
  589. package/dist/esm/queries2/ranges.js +0 -66
  590. package/dist/esm/queries2/ranges.js.map +0 -1
  591. package/dist/esm/queries2/types.d.ts +0 -6
  592. package/dist/esm/queries2/types.js +0 -2
  593. package/dist/esm/queries2/types.js.map +0 -1
  594. package/dist/esm/queries2/utils.d.ts +0 -1
  595. package/dist/esm/queries2/utils.js +0 -16
  596. package/dist/esm/queries2/utils.js.map +0 -1
  597. package/dist/esm/reactives/DocumentFamiliyCache.d.ts +0 -47
  598. package/dist/esm/reactives/DocumentFamiliyCache.js +0 -207
  599. package/dist/esm/reactives/DocumentFamiliyCache.js.map +0 -1
  600. package/dist/esm/reactives/Entity.d.ts +0 -191
  601. package/dist/esm/reactives/Entity.js +0 -458
  602. package/dist/esm/reactives/Entity.js.map +0 -1
  603. package/dist/esm/reactives/EntityStore.d.ts +0 -84
  604. package/dist/esm/reactives/EntityStore.js +0 -418
  605. package/dist/esm/reactives/EntityStore.js.map +0 -1
  606. package/dist/esm/reactives/FakeWeakRef.d.ts +0 -11
  607. package/dist/esm/reactives/FakeWeakRef.js +0 -15
  608. package/dist/esm/reactives/FakeWeakRef.js.map +0 -1
  609. package/dist/esm/v2/AckInfoStore.d.ts +0 -10
  610. package/dist/esm/v2/AckInfoStore.js +0 -22
  611. package/dist/esm/v2/AckInfoStore.js.map +0 -1
  612. package/dist/esm/v2/BaselinesStore.d.ts +0 -10
  613. package/dist/esm/v2/BaselinesStore.js +0 -32
  614. package/dist/esm/v2/BaselinesStore.js.map +0 -1
  615. package/dist/esm/v2/DocumentManager.d.ts +0 -19
  616. package/dist/esm/v2/DocumentManager.js +0 -43
  617. package/dist/esm/v2/DocumentManager.js.map +0 -1
  618. package/dist/esm/v2/Entity.d.ts +0 -91
  619. package/dist/esm/v2/Entity.js +0 -305
  620. package/dist/esm/v2/Entity.js.map +0 -1
  621. package/dist/esm/v2/EntityStore.d.ts +0 -37
  622. package/dist/esm/v2/EntityStore.js +0 -166
  623. package/dist/esm/v2/EntityStore.js.map +0 -1
  624. package/dist/esm/v2/IDBService.d.ts +0 -7
  625. package/dist/esm/v2/IDBService.js +0 -22
  626. package/dist/esm/v2/IDBService.js.map +0 -1
  627. package/dist/esm/v2/LocalHistoryStore.d.ts +0 -15
  628. package/dist/esm/v2/LocalHistoryStore.js +0 -49
  629. package/dist/esm/v2/LocalHistoryStore.js.map +0 -1
  630. package/dist/esm/v2/LocalReplicaStore.d.ts +0 -14
  631. package/dist/esm/v2/LocalReplicaStore.js +0 -42
  632. package/dist/esm/v2/LocalReplicaStore.js.map +0 -1
  633. package/dist/esm/v2/MessageCreator.d.ts +0 -19
  634. package/dist/esm/v2/MessageCreator.js +0 -92
  635. package/dist/esm/v2/MessageCreator.js.map +0 -1
  636. package/dist/esm/v2/Metadata.d.ts +0 -90
  637. package/dist/esm/v2/Metadata.js +0 -246
  638. package/dist/esm/v2/Metadata.js.map +0 -1
  639. package/dist/esm/v2/OperationsStore.d.ts +0 -38
  640. package/dist/esm/v2/OperationsStore.js +0 -142
  641. package/dist/esm/v2/OperationsStore.js.map +0 -1
  642. package/dist/esm/v2/PresenceManager.d.ts +0 -24
  643. package/dist/esm/v2/PresenceManager.js +0 -69
  644. package/dist/esm/v2/PresenceManager.js.map +0 -1
  645. package/dist/esm/v2/Query.d.ts +0 -24
  646. package/dist/esm/v2/Query.js +0 -75
  647. package/dist/esm/v2/Query.js.map +0 -1
  648. package/dist/esm/v2/QueryMaker.d.ts +0 -16
  649. package/dist/esm/v2/QueryMaker.js +0 -80
  650. package/dist/esm/v2/QueryMaker.js.map +0 -1
  651. package/dist/esm/v2/QueryStore.d.ts +0 -26
  652. package/dist/esm/v2/QueryStore.js +0 -132
  653. package/dist/esm/v2/QueryStore.js.map +0 -1
  654. package/dist/esm/v2/SchemaStore.d.ts +0 -9
  655. package/dist/esm/v2/SchemaStore.js +0 -31
  656. package/dist/esm/v2/SchemaStore.js.map +0 -1
  657. package/dist/esm/v2/Storage.d.ts +0 -80
  658. package/dist/esm/v2/Storage.js +0 -149
  659. package/dist/esm/v2/Storage.js.map +0 -1
  660. package/dist/esm/v2/Sync.d.ts +0 -42
  661. package/dist/esm/v2/Sync.js +0 -94
  662. package/dist/esm/v2/Sync.js.map +0 -1
  663. package/dist/esm/v2/SyncHarness.d.ts +0 -45
  664. package/dist/esm/v2/SyncHarness.js +0 -105
  665. package/dist/esm/v2/SyncHarness.js.map +0 -1
  666. package/dist/esm/v2/__tests__/documents.test.d.ts +0 -1
  667. package/dist/esm/v2/__tests__/documents.test.js +0 -208
  668. package/dist/esm/v2/__tests__/documents.test.js.map +0 -1
  669. package/dist/esm/v2/__tests__/fixtures/testStorage.d.ts +0 -223
  670. package/dist/esm/v2/__tests__/fixtures/testStorage.js +0 -106
  671. package/dist/esm/v2/__tests__/fixtures/testStorage.js.map +0 -1
  672. package/dist/esm/v2/__tests__/queries.test.d.ts +0 -1
  673. package/dist/esm/v2/__tests__/queries.test.js +0 -90
  674. package/dist/esm/v2/__tests__/queries.test.js.map +0 -1
  675. package/dist/esm/v2/__tests__/setup/indexedDB.d.ts +0 -1
  676. package/dist/esm/v2/__tests__/setup/indexedDB.js +0 -2
  677. package/dist/esm/v2/__tests__/setup/indexedDB.js.map +0 -1
  678. package/dist/esm/v2/constants.d.ts +0 -1
  679. package/dist/esm/v2/constants.js +0 -2
  680. package/dist/esm/v2/constants.js.map +0 -1
  681. package/dist/esm/v2/idb.d.ts +0 -6
  682. package/dist/esm/v2/idb.js +0 -65
  683. package/dist/esm/v2/idb.js.map +0 -1
  684. package/dist/esm/v2/index.d.ts +0 -6
  685. package/dist/esm/v2/index.js +0 -5
  686. package/dist/esm/v2/index.js.map +0 -1
  687. package/dist/esm/v2/indexes.d.ts +0 -3
  688. package/dist/esm/v2/indexes.js +0 -15
  689. package/dist/esm/v2/indexes.js.map +0 -1
  690. package/dist/esm/v2/openDocumentDatabase.d.ts +0 -9
  691. package/dist/esm/v2/openDocumentDatabase.js +0 -96
  692. package/dist/esm/v2/openDocumentDatabase.js.map +0 -1
  693. package/dist/esm/v2/types.d.ts +0 -3
  694. package/dist/esm/v2/types.js +0 -2
  695. package/dist/esm/v2/types.js.map +0 -1
  696. /package/dist/esm/sync/{WebsocketSync.js.map → WebSocketSync.js.map} +0 -0
@@ -1,355 +1,355 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Metadata = void 0;
4
- const common_1 = require("@verdant-web/common");
5
- const AckInfoStore_js_1 = require("./AckInfoStore.js");
6
- const BaselinesStore_js_1 = require("./BaselinesStore.js");
7
- const idb_js_1 = require("../idb.js");
8
- const LocalReplicaStore_js_1 = require("./LocalReplicaStore.js");
9
- const MessageCreator_js_1 = require("./MessageCreator.js");
10
- const OperationsStore_js_1 = require("./OperationsStore.js");
11
- const SchemaStore_js_1 = require("./SchemaStore.js");
12
- class Metadata extends common_1.EventSubscriber {
13
- constructor({ disableRebasing, context, }) {
14
- super();
15
- this.time = new common_1.HybridLogicalClockTimestampProvider();
16
- this.disableRebasing = false;
17
- /**
18
- * indicates the client is shutting down and we should stop
19
- * accessing the database.
20
- */
21
- this._closing = false;
22
- this.setContext = (context) => {
23
- this.context = context;
24
- };
25
- this.close = () => {
26
- this._closing = true;
27
- };
28
- /**
29
- * Methods for accessing data
30
- */
31
- this.createTransaction = (stores) => {
32
- return this.db.transaction(stores, 'readwrite');
33
- };
34
- /**
35
- * Gets the OID and every sub-object OID for a given document.
36
- * Includes any sub-objects that are not referenced by the root object
37
- * but still happen to be in storage.
38
- */
39
- this.getAllDocumentRelatedOids = async (oid) => {
40
- const oids = new Set();
41
- const documentOid = (0, common_1.getOidRoot)(oid);
42
- (0, common_1.assert)(documentOid === oid, 'Must be root document OID');
43
- oids.add(documentOid);
44
- // readwrite mode to block on other write transactions
45
- const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
46
- await Promise.all([
47
- this.baselines.iterateOverAllForDocument(documentOid, (baseline) => {
48
- oids.add(baseline.oid);
49
- }, { transaction }),
50
- this.operations.iterateOverAllOperationsForDocument(documentOid, (patch) => {
51
- oids.add(patch.oid);
52
- }, { transaction }),
53
- ]);
54
- return Array.from(oids);
55
- };
56
- this.getDocumentSnapshot = async (oid, options = {}) => {
57
- const documentOid = (0, common_1.getOidRoot)(oid);
58
- (0, common_1.assert)(documentOid === oid, 'Must be root document OID');
59
- const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
60
- const baselines = await this.baselines.getAllForDocument(documentOid, {
61
- transaction,
62
- });
63
- const objectMap = new Map();
64
- for (const baseline of baselines) {
65
- if (baseline.snapshot) {
66
- (0, common_1.assignOid)(baseline.snapshot, baseline.oid);
67
- }
68
- objectMap.set(baseline.oid, baseline.snapshot);
69
- }
70
- await this.operations.iterateOverAllOperationsForDocument(documentOid, (op) => {
71
- const obj = objectMap.get(op.oid) || undefined;
72
- const newObj = (0, common_1.applyPatch)(obj, op.data);
73
- if (newObj) {
74
- (0, common_1.assignOid)(newObj, op.oid);
75
- }
76
- objectMap.set(op.oid, newObj);
77
- }, {
78
- transaction,
79
- // only apply operations up to the current time
80
- to: options.to || this.now,
81
- });
82
- const root = objectMap.get(documentOid);
83
- if (root) {
84
- (0, common_1.substituteRefsWithObjects)(root, objectMap);
85
- }
86
- return root;
87
- };
88
- /**
89
- * Methods for writing data
90
- */
91
- /**
92
- * Acks that we have seen a timestamp to the server
93
- * and stores it as our local ackedLogicalTime if it's
94
- * greater than our current ackedLogicalTime.
95
- */
96
- this.ack = async (timestamp) => {
97
- const localReplicaInfo = await this.localReplica.get();
98
- // can't ack timestamps from the future.
99
- if (timestamp > this.now)
100
- return;
101
- this.emit('message', {
102
- type: 'ack',
103
- replicaId: localReplicaInfo.id,
104
- timestamp,
105
- });
106
- if (!this._closing &&
107
- (!localReplicaInfo.ackedLogicalTime ||
108
- timestamp > localReplicaInfo.ackedLogicalTime)) {
109
- this.localReplica.update({ ackedLogicalTime: timestamp });
110
- }
111
- };
112
- /**
113
- * Applies a patch to the document and stores it in the database.
114
- * @returns the oldest local history timestamp
115
- */
116
- this.insertLocalOperation = async (operations) => {
117
- if (operations.length === 0)
118
- return;
119
- // await this.rebaseLock;
120
- this.log(`Inserting ${operations.length} local operations`);
121
- // add local flag, in place.
122
- for (const operation of operations) {
123
- operation.isLocal = true;
124
- }
125
- await this.operations.addOperations(operations);
126
- const message = await this.messageCreator.createOperation({ operations });
127
- this.emit('message', message);
128
- // we can now enqueue and check for rebase opportunities
129
- this.tryAutonomousRebase();
130
- };
131
- /**
132
- * Inserts remote operations. This does not affect local history.
133
- * @returns a list of affected document OIDs
134
- */
135
- this.insertRemoteOperations = async (operations) => {
136
- if (operations.length === 0)
137
- return [];
138
- // await this.rebaseLock;
139
- this.log(`Inserting ${operations.length} remote operations`);
140
- const affectedDocumentOids = await this.operations.addOperations(operations.map((patch) => (Object.assign(Object.assign({}, patch), { isLocal: false }))));
141
- this.ack(operations[operations.length - 1].timestamp);
142
- return affectedDocumentOids;
143
- };
144
- this.insertRemoteBaselines = async (baselines) => {
145
- if (baselines.length === 0)
146
- return [];
147
- this.log(`Inserting ${baselines.length} remote baselines`);
148
- await this.baselines.setAll(baselines);
149
- // this.ack(baselines[baselines.length - 1].timestamp);
150
- const affectedOidSet = new Set();
151
- baselines.forEach((baseline) => {
152
- affectedOidSet.add((0, common_1.getOidRoot)(baseline.oid));
153
- });
154
- return Array.from(affectedOidSet);
155
- };
156
- this.updateLastSynced = async (timestamp) => {
157
- if (this._closing)
158
- return;
159
- return this.localReplica.update({
160
- lastSyncedLogicalTime: timestamp,
161
- });
162
- };
163
- this.lastSyncedTimestamp = async () => {
164
- const localReplicaInfo = await this.localReplica.get();
165
- return localReplicaInfo.lastSyncedLogicalTime;
166
- };
167
- this.tryAutonomousRebase = async () => {
168
- if (this.disableRebasing)
169
- return;
170
- const localReplicaInfo = await this.localReplica.get();
171
- if (localReplicaInfo.lastSyncedLogicalTime)
172
- return; // cannot autonomously rebase if we've synced
173
- // but if we have never synced... we can rebase everything!
174
- await this.runRebase(this.now);
175
- };
176
- /**
177
- * Attempt to autonomously rebase local documents without server intervention.
178
- * This can currently only happen for a client who has never synced before.
179
- * The goal is to allow local-only clients to compress their history to exactly
180
- * their undo stack.
181
- */
182
- this.runRebase = async (globalAckTimestamp) => {
183
- if (this._closing)
184
- return;
185
- // find all operations before the global ack
186
- let lastTimestamp;
187
- const toRebase = new Set();
188
- const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
189
- let operationCount = 0;
190
- await this.operations.iterateOverAllOperations((patch) => {
191
- toRebase.add(patch.oid);
192
- lastTimestamp = patch.timestamp;
193
- operationCount++;
194
- }, {
195
- before: globalAckTimestamp,
196
- transaction,
197
- });
198
- if (!toRebase.size) {
199
- this.log('Cannot rebase, no operations prior to', globalAckTimestamp);
200
- return;
201
- }
202
- if (this._closing) {
203
- return;
204
- }
205
- // rebase each affected document
206
- let newBaselines = [];
207
- for (const oid of toRebase) {
208
- newBaselines.push(await this.rebase(oid, lastTimestamp || globalAckTimestamp, transaction));
209
- }
210
- this.emit('rebase', newBaselines);
211
- };
212
- this.rebase = async (oid, upTo, providedTx) => {
213
- // including replica Id for testing I guess
214
- const replicaId = (await this.localReplica.get()).id;
215
- this.log('[', replicaId, ']', 'Rebasing', oid, 'up to', upTo);
216
- const transaction = providedTx ||
217
- this.db.transaction(['operations', 'baselines'], 'readwrite');
218
- const baseline = await this.baselines.get(oid, { transaction });
219
- let current = (baseline === null || baseline === void 0 ? void 0 : baseline.snapshot) || undefined;
220
- let operationsApplied = 0;
221
- const deletedRefs = [];
222
- await this.operations.iterateOverAllOperationsForEntity(oid, (patch, store) => {
223
- // FIXME: this seems like the wrong place to do this
224
- // but it's here as a safety measure...
225
- if (!baseline || patch.timestamp > baseline.timestamp) {
226
- current = (0, common_1.applyPatch)(current, patch.data, deletedRefs);
227
- }
228
- // delete all prior operations to the baseline
229
- operationsApplied++;
230
- store.delete(patch.oid_timestamp);
231
- }, {
232
- to: upTo,
233
- transaction,
234
- });
235
- if (current) {
236
- (0, common_1.assignOid)(current, oid);
237
- }
238
- const newBaseline = {
239
- oid,
240
- snapshot: current,
241
- timestamp: upTo,
242
- };
243
- if (newBaseline.snapshot) {
244
- await this.baselines.set(newBaseline, { transaction });
245
- }
246
- else {
247
- await this.baselines.delete(oid, { transaction });
248
- }
249
- this.log('successfully rebased', oid, 'up to', upTo, ':', current, 'and deleted', operationsApplied, 'operations');
250
- // cleanup deleted refs
251
- if (deletedRefs.length) {
252
- const fileRefs = deletedRefs.filter(common_1.isFileRef);
253
- if (fileRefs.length) {
254
- this.emit('filesDeleted', fileRefs);
255
- }
256
- }
257
- return newBaseline;
258
- };
259
- this.reset = async () => {
260
- await this.operations.reset();
261
- await this.baselines.reset();
262
- await this.localReplica.reset();
263
- };
264
- this.updateSchema = async (schema, overrideConflict) => {
265
- const storedSchema = await this.schema.get();
266
- if (storedSchema) {
267
- // version changes will be handled by migration routines in
268
- // the actual idb database loading code (see: initializeDatabases)
269
- // but this check determines if the schema has been changed without
270
- // a version change. if so, it will error.
271
- if (overrideConflict === storedSchema.version &&
272
- storedSchema.version === schema.version &&
273
- JSON.stringify(storedSchema) !== JSON.stringify(schema)) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Metadata = void 0;
4
+ const common_1 = require("@verdant-web/common");
5
+ const AckInfoStore_js_1 = require("./AckInfoStore.js");
6
+ const BaselinesStore_js_1 = require("./BaselinesStore.js");
7
+ const idb_js_1 = require("../idb.js");
8
+ const LocalReplicaStore_js_1 = require("./LocalReplicaStore.js");
9
+ const MessageCreator_js_1 = require("./MessageCreator.js");
10
+ const OperationsStore_js_1 = require("./OperationsStore.js");
11
+ const SchemaStore_js_1 = require("./SchemaStore.js");
12
+ class Metadata extends common_1.EventSubscriber {
13
+ constructor({ disableRebasing, context, }) {
14
+ super();
15
+ this.time = new common_1.HybridLogicalClockTimestampProvider();
16
+ this.disableRebasing = false;
17
+ /**
18
+ * indicates the client is shutting down and we should stop
19
+ * accessing the database.
20
+ */
21
+ this._closing = false;
22
+ this.setContext = (context) => {
23
+ this.context = context;
24
+ };
25
+ this.close = () => {
26
+ this._closing = true;
27
+ };
28
+ /**
29
+ * Methods for accessing data
30
+ */
31
+ this.createTransaction = (stores) => {
32
+ return this.db.transaction(stores, 'readwrite');
33
+ };
34
+ /**
35
+ * Gets the OID and every sub-object OID for a given document.
36
+ * Includes any sub-objects that are not referenced by the root object
37
+ * but still happen to be in storage.
38
+ */
39
+ this.getAllDocumentRelatedOids = async (oid) => {
40
+ const oids = new Set();
41
+ const documentOid = (0, common_1.getOidRoot)(oid);
42
+ (0, common_1.assert)(documentOid === oid, 'Must be root document OID');
43
+ oids.add(documentOid);
44
+ // readwrite mode to block on other write transactions
45
+ const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
46
+ await Promise.all([
47
+ this.baselines.iterateOverAllForDocument(documentOid, (baseline) => {
48
+ oids.add(baseline.oid);
49
+ }, { transaction }),
50
+ this.operations.iterateOverAllOperationsForDocument(documentOid, (patch) => {
51
+ oids.add(patch.oid);
52
+ }, { transaction }),
53
+ ]);
54
+ return Array.from(oids);
55
+ };
56
+ this.getDocumentSnapshot = async (oid, options = {}) => {
57
+ const documentOid = (0, common_1.getOidRoot)(oid);
58
+ (0, common_1.assert)(documentOid === oid, 'Must be root document OID');
59
+ const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
60
+ const baselines = await this.baselines.getAllForDocument(documentOid, {
61
+ transaction,
62
+ });
63
+ const objectMap = new Map();
64
+ for (const baseline of baselines) {
65
+ if (baseline.snapshot) {
66
+ (0, common_1.assignOid)(baseline.snapshot, baseline.oid);
67
+ }
68
+ objectMap.set(baseline.oid, baseline.snapshot);
69
+ }
70
+ await this.operations.iterateOverAllOperationsForDocument(documentOid, (op) => {
71
+ const obj = objectMap.get(op.oid) || undefined;
72
+ const newObj = (0, common_1.applyPatch)(obj, op.data);
73
+ if (newObj) {
74
+ (0, common_1.assignOid)(newObj, op.oid);
75
+ }
76
+ objectMap.set(op.oid, newObj);
77
+ }, {
78
+ transaction,
79
+ // only apply operations up to the current time
80
+ to: options.to || this.now,
81
+ });
82
+ const root = objectMap.get(documentOid);
83
+ if (root) {
84
+ (0, common_1.substituteRefsWithObjects)(root, objectMap);
85
+ }
86
+ return root;
87
+ };
88
+ /**
89
+ * Methods for writing data
90
+ */
91
+ /**
92
+ * Acks that we have seen a timestamp to the server
93
+ * and stores it as our local ackedLogicalTime if it's
94
+ * greater than our current ackedLogicalTime.
95
+ */
96
+ this.ack = async (timestamp) => {
97
+ const localReplicaInfo = await this.localReplica.get();
98
+ // can't ack timestamps from the future.
99
+ if (timestamp > this.now)
100
+ return;
101
+ this.emit('message', {
102
+ type: 'ack',
103
+ replicaId: localReplicaInfo.id,
104
+ timestamp,
105
+ });
106
+ if (!this._closing &&
107
+ (!localReplicaInfo.ackedLogicalTime ||
108
+ timestamp > localReplicaInfo.ackedLogicalTime)) {
109
+ this.localReplica.update({ ackedLogicalTime: timestamp });
110
+ }
111
+ };
112
+ /**
113
+ * Applies a patch to the document and stores it in the database.
114
+ * @returns the oldest local history timestamp
115
+ */
116
+ this.insertLocalOperation = async (operations) => {
117
+ if (operations.length === 0)
118
+ return;
119
+ // await this.rebaseLock;
120
+ this.log(`Inserting ${operations.length} local operations`);
121
+ // add local flag, in place.
122
+ for (const operation of operations) {
123
+ operation.isLocal = true;
124
+ }
125
+ await this.operations.addOperations(operations);
126
+ const message = await this.messageCreator.createOperation({ operations });
127
+ this.emit('message', message);
128
+ // we can now enqueue and check for rebase opportunities
129
+ this.tryAutonomousRebase();
130
+ };
131
+ /**
132
+ * Inserts remote operations. This does not affect local history.
133
+ * @returns a list of affected document OIDs
134
+ */
135
+ this.insertRemoteOperations = async (operations) => {
136
+ if (operations.length === 0)
137
+ return [];
138
+ // await this.rebaseLock;
139
+ this.log(`Inserting ${operations.length} remote operations`);
140
+ const affectedDocumentOids = await this.operations.addOperations(operations.map((patch) => (Object.assign(Object.assign({}, patch), { isLocal: false }))));
141
+ this.ack(operations[operations.length - 1].timestamp);
142
+ return affectedDocumentOids;
143
+ };
144
+ this.insertRemoteBaselines = async (baselines) => {
145
+ if (baselines.length === 0)
146
+ return [];
147
+ this.log(`Inserting ${baselines.length} remote baselines`);
148
+ await this.baselines.setAll(baselines);
149
+ // this.ack(baselines[baselines.length - 1].timestamp);
150
+ const affectedOidSet = new Set();
151
+ baselines.forEach((baseline) => {
152
+ affectedOidSet.add((0, common_1.getOidRoot)(baseline.oid));
153
+ });
154
+ return Array.from(affectedOidSet);
155
+ };
156
+ this.updateLastSynced = async (timestamp) => {
157
+ if (this._closing)
158
+ return;
159
+ return this.localReplica.update({
160
+ lastSyncedLogicalTime: timestamp,
161
+ });
162
+ };
163
+ this.lastSyncedTimestamp = async () => {
164
+ const localReplicaInfo = await this.localReplica.get();
165
+ return localReplicaInfo.lastSyncedLogicalTime;
166
+ };
167
+ this.tryAutonomousRebase = async () => {
168
+ if (this.disableRebasing)
169
+ return;
170
+ const localReplicaInfo = await this.localReplica.get();
171
+ if (localReplicaInfo.lastSyncedLogicalTime)
172
+ return; // cannot autonomously rebase if we've synced
173
+ // but if we have never synced... we can rebase everything!
174
+ await this.runRebase(this.now);
175
+ };
176
+ /**
177
+ * Attempt to autonomously rebase local documents without server intervention.
178
+ * This can currently only happen for a client who has never synced before.
179
+ * The goal is to allow local-only clients to compress their history to exactly
180
+ * their undo stack.
181
+ */
182
+ this.runRebase = async (globalAckTimestamp) => {
183
+ if (this._closing)
184
+ return;
185
+ // find all operations before the global ack
186
+ let lastTimestamp;
187
+ const toRebase = new Set();
188
+ const transaction = this.db.transaction(['baselines', 'operations'], 'readwrite');
189
+ let operationCount = 0;
190
+ await this.operations.iterateOverAllOperations((patch) => {
191
+ toRebase.add(patch.oid);
192
+ lastTimestamp = patch.timestamp;
193
+ operationCount++;
194
+ }, {
195
+ before: globalAckTimestamp,
196
+ transaction,
197
+ });
198
+ if (!toRebase.size) {
199
+ this.log('Cannot rebase, no operations prior to', globalAckTimestamp);
200
+ return;
201
+ }
202
+ if (this._closing) {
203
+ return;
204
+ }
205
+ // rebase each affected document
206
+ let newBaselines = [];
207
+ for (const oid of toRebase) {
208
+ newBaselines.push(await this.rebase(oid, lastTimestamp || globalAckTimestamp, transaction));
209
+ }
210
+ this.emit('rebase', newBaselines);
211
+ };
212
+ this.rebase = async (oid, upTo, providedTx) => {
213
+ // including replica Id for testing I guess
214
+ const replicaId = (await this.localReplica.get()).id;
215
+ this.log('[', replicaId, ']', 'Rebasing', oid, 'up to', upTo);
216
+ const transaction = providedTx ||
217
+ this.db.transaction(['operations', 'baselines'], 'readwrite');
218
+ const baseline = await this.baselines.get(oid, { transaction });
219
+ let current = (baseline === null || baseline === void 0 ? void 0 : baseline.snapshot) || undefined;
220
+ let operationsApplied = 0;
221
+ const deletedRefs = [];
222
+ await this.operations.iterateOverAllOperationsForEntity(oid, (patch, store) => {
223
+ // FIXME: this seems like the wrong place to do this
224
+ // but it's here as a safety measure...
225
+ if (!baseline || patch.timestamp > baseline.timestamp) {
226
+ current = (0, common_1.applyPatch)(current, patch.data, deletedRefs);
227
+ }
228
+ // delete all prior operations to the baseline
229
+ operationsApplied++;
230
+ store.delete(patch.oid_timestamp);
231
+ }, {
232
+ to: upTo,
233
+ transaction,
234
+ });
235
+ if (current) {
236
+ (0, common_1.assignOid)(current, oid);
237
+ }
238
+ const newBaseline = {
239
+ oid,
240
+ snapshot: current,
241
+ timestamp: upTo,
242
+ };
243
+ if (newBaseline.snapshot) {
244
+ await this.baselines.set(newBaseline, { transaction });
245
+ }
246
+ else {
247
+ await this.baselines.delete(oid, { transaction });
248
+ }
249
+ this.log('successfully rebased', oid, 'up to', upTo, ':', current, 'and deleted', operationsApplied, 'operations');
250
+ // cleanup deleted refs
251
+ if (deletedRefs.length) {
252
+ const fileRefs = deletedRefs.filter(common_1.isFileRef);
253
+ if (fileRefs.length) {
254
+ this.emit('filesDeleted', fileRefs);
255
+ }
256
+ }
257
+ return newBaseline;
258
+ };
259
+ this.reset = async () => {
260
+ await this.operations.reset();
261
+ await this.baselines.reset();
262
+ await this.localReplica.reset();
263
+ };
264
+ this.updateSchema = async (schema, overrideConflict) => {
265
+ const storedSchema = await this.schema.get();
266
+ if (storedSchema) {
267
+ // version changes will be handled by migration routines in
268
+ // the actual idb database loading code (see: initializeDatabases)
269
+ // but this check determines if the schema has been changed without
270
+ // a version change. if so, it will error.
271
+ if (overrideConflict === storedSchema.version &&
272
+ storedSchema.version === schema.version &&
273
+ JSON.stringify(storedSchema) !== JSON.stringify(schema)) {
274
274
  console.error(`Schema mismatch for version ${schema.version}
275
275
  ${JSON.stringify(storedSchema)}
276
- ${JSON.stringify(schema)}`);
277
- throw new Error('Schema has changed without a version change! Any changes to your schema must be accompanied by a change in schema version and a migration routine.');
278
- }
279
- }
280
- await this.schema.set(schema);
281
- };
282
- this.setGlobalAck = async (timestamp) => {
283
- if (this._closing)
284
- return;
285
- await this.ackInfo.setGlobalAck(timestamp);
286
- if (!this.disableRebasing) {
287
- await this.runRebase(timestamp);
288
- }
289
- };
290
- this.export = async () => {
291
- const db = this.db;
292
- const [baselines, operations] = await (0, idb_js_1.getAllFromObjectStores)(db, [
293
- 'baselines',
294
- 'operations',
295
- ]);
296
- const localReplica = await this.localReplica.get();
297
- const schema = await this.schema.get();
298
- if (!schema) {
299
- throw new Error('Cannot export Client data before initializing');
300
- }
301
- return {
302
- operations,
303
- baselines,
304
- localReplica,
305
- schema,
306
- };
307
- };
308
- /**
309
- * Resets local metadata and clears operation/baseline stores.
310
- * DOES NOT add operations/baselines - this should be done
311
- * through the normal higher level systems.
312
- */
313
- this.resetFrom = async (data) => {
314
- const db = this.db;
315
- const transaction = db.transaction(['baselines', 'operations', 'info'], 'readwrite');
316
- await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('baselines').clear());
317
- await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('operations').clear());
318
- await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('info').clear());
319
- await this.localReplica.update({
320
- ackedLogicalTime: data.localReplica.ackedLogicalTime,
321
- lastSyncedLogicalTime: data.localReplica.lastSyncedLogicalTime,
322
- }, { transaction });
323
- };
324
- this.stats = async () => {
325
- const db = this.db;
326
- const operationsSize = await (0, idb_js_1.getSizeOfObjectStore)(db, 'operations');
327
- const baselinesSize = await (0, idb_js_1.getSizeOfObjectStore)(db, 'baselines');
328
- return {
329
- operationsSize,
330
- baselinesSize,
331
- };
332
- };
333
- this.context = context;
334
- this.schema = new SchemaStore_js_1.SchemaStore(context.metaDb, context.schema.version);
335
- this.operations = new OperationsStore_js_1.OperationsStore(this.db);
336
- this.baselines = new BaselinesStore_js_1.BaselinesStore(this.db);
337
- this.localReplica = new LocalReplicaStore_js_1.LocalReplicaStore(this.db);
338
- this.ackInfo = new AckInfoStore_js_1.AckInfoStore(this.db);
339
- this.messageCreator = new MessageCreator_js_1.MessageCreator(this);
340
- this.patchCreator = new common_1.PatchCreator(() => this.now);
341
- if (disableRebasing)
342
- this.disableRebasing = disableRebasing;
343
- }
344
- get db() {
345
- return this.context.metaDb;
346
- }
347
- get log() {
348
- return this.context.log;
349
- }
350
- get now() {
351
- return this.time.now(this.schema.currentVersion);
352
- }
353
- }
354
- exports.Metadata = Metadata;
276
+ ${JSON.stringify(schema)}`);
277
+ throw new Error('Schema has changed without a version change! Any changes to your schema must be accompanied by a change in schema version and a migration routine.');
278
+ }
279
+ }
280
+ await this.schema.set(schema);
281
+ };
282
+ this.setGlobalAck = async (timestamp) => {
283
+ if (this._closing)
284
+ return;
285
+ await this.ackInfo.setGlobalAck(timestamp);
286
+ if (!this.disableRebasing) {
287
+ await this.runRebase(timestamp);
288
+ }
289
+ };
290
+ this.export = async () => {
291
+ const db = this.db;
292
+ const [baselines, operations] = await (0, idb_js_1.getAllFromObjectStores)(db, [
293
+ 'baselines',
294
+ 'operations',
295
+ ]);
296
+ const localReplica = await this.localReplica.get();
297
+ const schema = await this.schema.get();
298
+ if (!schema) {
299
+ throw new Error('Cannot export Client data before initializing');
300
+ }
301
+ return {
302
+ operations,
303
+ baselines,
304
+ localReplica,
305
+ schema,
306
+ };
307
+ };
308
+ /**
309
+ * Resets local metadata and clears operation/baseline stores.
310
+ * DOES NOT add operations/baselines - this should be done
311
+ * through the normal higher level systems.
312
+ */
313
+ this.resetFrom = async (data) => {
314
+ const db = this.db;
315
+ const transaction = db.transaction(['baselines', 'operations', 'info'], 'readwrite');
316
+ await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('baselines').clear());
317
+ await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('operations').clear());
318
+ await (0, idb_js_1.storeRequestPromise)(transaction.objectStore('info').clear());
319
+ await this.localReplica.update({
320
+ ackedLogicalTime: data.localReplica.ackedLogicalTime,
321
+ lastSyncedLogicalTime: data.localReplica.lastSyncedLogicalTime,
322
+ }, { transaction });
323
+ };
324
+ this.stats = async () => {
325
+ const db = this.db;
326
+ const operationsSize = await (0, idb_js_1.getSizeOfObjectStore)(db, 'operations');
327
+ const baselinesSize = await (0, idb_js_1.getSizeOfObjectStore)(db, 'baselines');
328
+ return {
329
+ operationsSize,
330
+ baselinesSize,
331
+ };
332
+ };
333
+ this.context = context;
334
+ this.schema = new SchemaStore_js_1.SchemaStore(context.metaDb, context.schema.version);
335
+ this.operations = new OperationsStore_js_1.OperationsStore(this.db);
336
+ this.baselines = new BaselinesStore_js_1.BaselinesStore(this.db);
337
+ this.localReplica = new LocalReplicaStore_js_1.LocalReplicaStore(this.db);
338
+ this.ackInfo = new AckInfoStore_js_1.AckInfoStore(this.db);
339
+ this.messageCreator = new MessageCreator_js_1.MessageCreator(this);
340
+ this.patchCreator = new common_1.PatchCreator(() => this.now);
341
+ if (disableRebasing)
342
+ this.disableRebasing = disableRebasing;
343
+ }
344
+ get db() {
345
+ return this.context.metaDb;
346
+ }
347
+ get log() {
348
+ return this.context.log;
349
+ }
350
+ get now() {
351
+ return this.time.now(this.schema.currentVersion);
352
+ }
353
+ }
354
+ exports.Metadata = Metadata;
355
355
  //# sourceMappingURL=Metadata.js.map