@verdant-web/store 3.3.1 → 3.4.0-next.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 (338) hide show
  1. package/dist/bundle/index.js +8 -8
  2. package/dist/bundle/index.js.map +4 -4
  3. package/dist/esm/BackoffScheduler.js.map +1 -1
  4. package/dist/esm/IDBService.js.map +1 -1
  5. package/dist/esm/UndoHistory.js.map +1 -1
  6. package/dist/esm/__tests__/documents.test.js.map +1 -1
  7. package/dist/esm/__tests__/queries.test.js.map +1 -1
  8. package/dist/esm/backup.js.map +1 -1
  9. package/dist/esm/client/Client.js +7 -0
  10. package/dist/esm/client/Client.js.map +1 -1
  11. package/dist/esm/client/ClientDescriptor.js.map +1 -1
  12. package/dist/esm/entities/Entity.js.map +1 -1
  13. package/dist/esm/entities/EntityCache.js.map +1 -1
  14. package/dist/esm/entities/EntityMetadata.js.map +1 -1
  15. package/dist/esm/entities/EntityStore.js.map +1 -1
  16. package/dist/esm/entities/OperationBatcher.js.map +1 -1
  17. package/dist/esm/files/EntityFile.js.map +1 -1
  18. package/dist/esm/files/FileManager.js +3 -0
  19. package/dist/esm/files/FileManager.js.map +1 -1
  20. package/dist/esm/files/FileStorage.js.map +1 -1
  21. package/dist/esm/files/utils.js.map +1 -1
  22. package/dist/esm/idb.js.map +1 -1
  23. package/dist/esm/metadata/AckInfoStore.js.map +1 -1
  24. package/dist/esm/metadata/LocalReplicaStore.js.map +1 -1
  25. package/dist/esm/metadata/MessageCreator.js.map +1 -1
  26. package/dist/esm/metadata/Metadata.js +7 -4
  27. package/dist/esm/metadata/Metadata.js.map +1 -1
  28. package/dist/esm/metadata/OperationsStore.js.map +1 -1
  29. package/dist/esm/metadata/SchemaStore.js.map +1 -1
  30. package/dist/esm/metadata/openMetadataDatabase.js.map +1 -1
  31. package/dist/esm/migration/db.js.map +1 -1
  32. package/dist/esm/migration/openDatabase.js.map +1 -1
  33. package/dist/esm/migration/paths.js.map +1 -1
  34. package/dist/esm/queries/BaseQuery.js.map +1 -1
  35. package/dist/esm/queries/QueryCache.js.map +1 -1
  36. package/dist/esm/queries/QueryableStorage.js.map +1 -1
  37. package/dist/esm/queries/dbQueries.js.map +1 -1
  38. package/dist/esm/queries/keys.js.map +1 -1
  39. package/dist/esm/queries/ranges.js.map +1 -1
  40. package/dist/esm/queries/utils.js.map +1 -1
  41. package/dist/esm/sync/FileSync.js.map +1 -1
  42. package/dist/esm/sync/Heartbeat.js.map +1 -1
  43. package/dist/esm/sync/PresenceManager.js.map +1 -1
  44. package/dist/esm/sync/PushPullSync.js.map +1 -1
  45. package/dist/esm/sync/ServerSyncEndpointProvider.js.map +1 -1
  46. package/dist/esm/sync/Sync.js.map +1 -1
  47. package/dist/esm/sync/WebSocketSync.js.map +1 -1
  48. package/package.json +9 -10
  49. package/src/client/Client.ts +8 -1
  50. package/src/files/FileManager.ts +4 -0
  51. package/src/metadata/Metadata.ts +11 -7
  52. package/src/sync/Sync.ts +2 -2
  53. package/dist/cjs/BackoffScheduler.d.ts +0 -19
  54. package/dist/cjs/BackoffScheduler.js +0 -45
  55. package/dist/cjs/BackoffScheduler.js.map +0 -1
  56. package/dist/cjs/DocumentManager.d.ts +0 -28
  57. package/dist/cjs/DocumentManager.js +0 -45
  58. package/dist/cjs/DocumentManager.js.map +0 -1
  59. package/dist/cjs/FakeWeakRef.d.ts +0 -11
  60. package/dist/cjs/FakeWeakRef.js +0 -19
  61. package/dist/cjs/FakeWeakRef.js.map +0 -1
  62. package/dist/cjs/IDBService.d.ts +0 -30
  63. package/dist/cjs/IDBService.js +0 -101
  64. package/dist/cjs/IDBService.js.map +0 -1
  65. package/dist/cjs/UndoHistory.d.ts +0 -16
  66. package/dist/cjs/UndoHistory.js +0 -55
  67. package/dist/cjs/UndoHistory.js.map +0 -1
  68. package/dist/cjs/__tests__/batching.test.d.ts +0 -1
  69. package/dist/cjs/__tests__/batching.test.js +0 -47
  70. package/dist/cjs/__tests__/batching.test.js.map +0 -1
  71. package/dist/cjs/__tests__/documents.test.d.ts +0 -1
  72. package/dist/cjs/__tests__/documents.test.js +0 -468
  73. package/dist/cjs/__tests__/documents.test.js.map +0 -1
  74. package/dist/cjs/__tests__/fixtures/testStorage.d.ts +0 -76
  75. package/dist/cjs/__tests__/fixtures/testStorage.js +0 -96
  76. package/dist/cjs/__tests__/fixtures/testStorage.js.map +0 -1
  77. package/dist/cjs/__tests__/legacyOids.test.d.ts +0 -1
  78. package/dist/cjs/__tests__/legacyOids.test.js +0 -354
  79. package/dist/cjs/__tests__/legacyOids.test.js.map +0 -1
  80. package/dist/cjs/__tests__/mutations.test.d.ts +0 -1
  81. package/dist/cjs/__tests__/mutations.test.js +0 -48
  82. package/dist/cjs/__tests__/mutations.test.js.map +0 -1
  83. package/dist/cjs/__tests__/queries.test.d.ts +0 -1
  84. package/dist/cjs/__tests__/queries.test.js +0 -323
  85. package/dist/cjs/__tests__/queries.test.js.map +0 -1
  86. package/dist/cjs/__tests__/setup/indexedDB.d.ts +0 -1
  87. package/dist/cjs/__tests__/setup/indexedDB.js +0 -16
  88. package/dist/cjs/__tests__/setup/indexedDB.js.map +0 -1
  89. package/dist/cjs/__tests__/undo.test.d.ts +0 -1
  90. package/dist/cjs/__tests__/undo.test.js +0 -94
  91. package/dist/cjs/__tests__/undo.test.js.map +0 -1
  92. package/dist/cjs/backup.d.ts +0 -10
  93. package/dist/cjs/backup.js +0 -58
  94. package/dist/cjs/backup.js.map +0 -1
  95. package/dist/cjs/client/Client.d.ts +0 -120
  96. package/dist/cjs/client/Client.js +0 -300
  97. package/dist/cjs/client/Client.js.map +0 -1
  98. package/dist/cjs/client/ClientDescriptor.d.ts +0 -76
  99. package/dist/cjs/client/ClientDescriptor.js +0 -213
  100. package/dist/cjs/client/ClientDescriptor.js.map +0 -1
  101. package/dist/cjs/client/constants.d.ts +0 -1
  102. package/dist/cjs/client/constants.js +0 -5
  103. package/dist/cjs/client/constants.js.map +0 -1
  104. package/dist/cjs/constants.d.ts +0 -1
  105. package/dist/cjs/constants.js +0 -5
  106. package/dist/cjs/constants.js.map +0 -1
  107. package/dist/cjs/context.d.ts +0 -38
  108. package/dist/cjs/context.js +0 -3
  109. package/dist/cjs/context.js.map +0 -1
  110. package/dist/cjs/entities/Entity.d.ts +0 -148
  111. package/dist/cjs/entities/Entity.js +0 -711
  112. package/dist/cjs/entities/Entity.js.map +0 -1
  113. package/dist/cjs/entities/Entity.test.d.ts +0 -1
  114. package/dist/cjs/entities/Entity.test.js +0 -194
  115. package/dist/cjs/entities/Entity.test.js.map +0 -1
  116. package/dist/cjs/entities/EntityCache.d.ts +0 -15
  117. package/dist/cjs/entities/EntityCache.js +0 -39
  118. package/dist/cjs/entities/EntityCache.js.map +0 -1
  119. package/dist/cjs/entities/EntityMetadata.d.ts +0 -68
  120. package/dist/cjs/entities/EntityMetadata.js +0 -261
  121. package/dist/cjs/entities/EntityMetadata.js.map +0 -1
  122. package/dist/cjs/entities/EntityStore.d.ts +0 -80
  123. package/dist/cjs/entities/EntityStore.js +0 -352
  124. package/dist/cjs/entities/EntityStore.js.map +0 -1
  125. package/dist/cjs/entities/OperationBatcher.d.ts +0 -52
  126. package/dist/cjs/entities/OperationBatcher.js +0 -165
  127. package/dist/cjs/entities/OperationBatcher.js.map +0 -1
  128. package/dist/cjs/entities/types.d.ts +0 -103
  129. package/dist/cjs/entities/types.js +0 -3
  130. package/dist/cjs/entities/types.js.map +0 -1
  131. package/dist/cjs/files/EntityFile.d.ts +0 -35
  132. package/dist/cjs/files/EntityFile.js +0 -81
  133. package/dist/cjs/files/EntityFile.js.map +0 -1
  134. package/dist/cjs/files/FileManager.d.ts +0 -46
  135. package/dist/cjs/files/FileManager.js +0 -174
  136. package/dist/cjs/files/FileManager.js.map +0 -1
  137. package/dist/cjs/files/FileStorage.d.ts +0 -39
  138. package/dist/cjs/files/FileStorage.js +0 -110
  139. package/dist/cjs/files/FileStorage.js.map +0 -1
  140. package/dist/cjs/files/utils.d.ts +0 -10
  141. package/dist/cjs/files/utils.js +0 -62
  142. package/dist/cjs/files/utils.js.map +0 -1
  143. package/dist/cjs/files/utils.test.d.ts +0 -1
  144. package/dist/cjs/files/utils.test.js +0 -81
  145. package/dist/cjs/files/utils.test.js.map +0 -1
  146. package/dist/cjs/idb.d.ts +0 -13
  147. package/dist/cjs/idb.js +0 -158
  148. package/dist/cjs/idb.js.map +0 -1
  149. package/dist/cjs/index.d.ts +0 -23
  150. package/dist/cjs/index.js +0 -25
  151. package/dist/cjs/index.js.map +0 -1
  152. package/dist/cjs/metadata/AckInfoStore.d.ts +0 -10
  153. package/dist/cjs/metadata/AckInfoStore.js +0 -26
  154. package/dist/cjs/metadata/AckInfoStore.js.map +0 -1
  155. package/dist/cjs/metadata/BaselinesStore.d.ts +0 -40
  156. package/dist/cjs/metadata/BaselinesStore.js +0 -106
  157. package/dist/cjs/metadata/BaselinesStore.js.map +0 -1
  158. package/dist/cjs/metadata/LocalReplicaStore.d.ts +0 -18
  159. package/dist/cjs/metadata/LocalReplicaStore.js +0 -62
  160. package/dist/cjs/metadata/LocalReplicaStore.js.map +0 -1
  161. package/dist/cjs/metadata/MessageCreator.d.ts +0 -19
  162. package/dist/cjs/metadata/MessageCreator.js +0 -128
  163. package/dist/cjs/metadata/MessageCreator.js.map +0 -1
  164. package/dist/cjs/metadata/Metadata.d.ts +0 -134
  165. package/dist/cjs/metadata/Metadata.js +0 -405
  166. package/dist/cjs/metadata/Metadata.js.map +0 -1
  167. package/dist/cjs/metadata/OperationsStore.d.ts +0 -62
  168. package/dist/cjs/metadata/OperationsStore.js +0 -179
  169. package/dist/cjs/metadata/OperationsStore.js.map +0 -1
  170. package/dist/cjs/metadata/SchemaStore.d.ts +0 -9
  171. package/dist/cjs/metadata/SchemaStore.js +0 -39
  172. package/dist/cjs/metadata/SchemaStore.js.map +0 -1
  173. package/dist/cjs/metadata/openMetadataDatabase.d.ts +0 -19
  174. package/dist/cjs/metadata/openMetadataDatabase.js +0 -220
  175. package/dist/cjs/metadata/openMetadataDatabase.js.map +0 -1
  176. package/dist/cjs/migration/db.d.ts +0 -8
  177. package/dist/cjs/migration/db.js +0 -112
  178. package/dist/cjs/migration/db.js.map +0 -1
  179. package/dist/cjs/migration/errors.d.ts +0 -5
  180. package/dist/cjs/migration/errors.js +0 -12
  181. package/dist/cjs/migration/errors.js.map +0 -1
  182. package/dist/cjs/migration/openDatabase.d.ts +0 -20
  183. package/dist/cjs/migration/openDatabase.js +0 -468
  184. package/dist/cjs/migration/openDatabase.js.map +0 -1
  185. package/dist/cjs/migration/paths.d.ts +0 -6
  186. package/dist/cjs/migration/paths.js +0 -53
  187. package/dist/cjs/migration/paths.js.map +0 -1
  188. package/dist/cjs/migration/paths.test.d.ts +0 -1
  189. package/dist/cjs/migration/paths.test.js +0 -91
  190. package/dist/cjs/migration/paths.test.js.map +0 -1
  191. package/dist/cjs/queries/BaseQuery.d.ts +0 -53
  192. package/dist/cjs/queries/BaseQuery.js +0 -148
  193. package/dist/cjs/queries/BaseQuery.js.map +0 -1
  194. package/dist/cjs/queries/CollectionQueries.d.ts +0 -55
  195. package/dist/cjs/queries/CollectionQueries.js +0 -92
  196. package/dist/cjs/queries/CollectionQueries.js.map +0 -1
  197. package/dist/cjs/queries/FindAllQuery.d.ts +0 -12
  198. package/dist/cjs/queries/FindAllQuery.js +0 -44
  199. package/dist/cjs/queries/FindAllQuery.js.map +0 -1
  200. package/dist/cjs/queries/FindInfiniteQuery.d.ts +0 -19
  201. package/dist/cjs/queries/FindInfiniteQuery.js +0 -70
  202. package/dist/cjs/queries/FindInfiniteQuery.js.map +0 -1
  203. package/dist/cjs/queries/FindOneQuery.d.ts +0 -12
  204. package/dist/cjs/queries/FindOneQuery.js +0 -43
  205. package/dist/cjs/queries/FindOneQuery.js.map +0 -1
  206. package/dist/cjs/queries/FindPageQuery.d.ts +0 -24
  207. package/dist/cjs/queries/FindPageQuery.js +0 -77
  208. package/dist/cjs/queries/FindPageQuery.js.map +0 -1
  209. package/dist/cjs/queries/GetQuery.d.ts +0 -10
  210. package/dist/cjs/queries/GetQuery.js +0 -30
  211. package/dist/cjs/queries/GetQuery.js.map +0 -1
  212. package/dist/cjs/queries/QueryCache.d.ts +0 -17
  213. package/dist/cjs/queries/QueryCache.js +0 -46
  214. package/dist/cjs/queries/QueryCache.js.map +0 -1
  215. package/dist/cjs/queries/QueryableStorage.d.ts +0 -20
  216. package/dist/cjs/queries/QueryableStorage.js +0 -94
  217. package/dist/cjs/queries/QueryableStorage.js.map +0 -1
  218. package/dist/cjs/queries/dbQueries.d.ts +0 -22
  219. package/dist/cjs/queries/dbQueries.js +0 -136
  220. package/dist/cjs/queries/dbQueries.js.map +0 -1
  221. package/dist/cjs/queries/keys.d.ts +0 -10
  222. package/dist/cjs/queries/keys.js +0 -34
  223. package/dist/cjs/queries/keys.js.map +0 -1
  224. package/dist/cjs/queries/ranges.d.ts +0 -2
  225. package/dist/cjs/queries/ranges.js +0 -70
  226. package/dist/cjs/queries/ranges.js.map +0 -1
  227. package/dist/cjs/queries/types.d.ts +0 -6
  228. package/dist/cjs/queries/types.js +0 -3
  229. package/dist/cjs/queries/types.js.map +0 -1
  230. package/dist/cjs/queries/utils.d.ts +0 -3
  231. package/dist/cjs/queries/utils.js +0 -25
  232. package/dist/cjs/queries/utils.js.map +0 -1
  233. package/dist/cjs/sync/FileSync.d.ts +0 -24
  234. package/dist/cjs/sync/FileSync.js +0 -87
  235. package/dist/cjs/sync/FileSync.js.map +0 -1
  236. package/dist/cjs/sync/Heartbeat.d.ts +0 -25
  237. package/dist/cjs/sync/Heartbeat.js +0 -64
  238. package/dist/cjs/sync/Heartbeat.js.map +0 -1
  239. package/dist/cjs/sync/PresenceManager.d.ts +0 -55
  240. package/dist/cjs/sync/PresenceManager.js +0 -126
  241. package/dist/cjs/sync/PresenceManager.js.map +0 -1
  242. package/dist/cjs/sync/PushPullSync.d.ts +0 -39
  243. package/dist/cjs/sync/PushPullSync.js +0 -159
  244. package/dist/cjs/sync/PushPullSync.js.map +0 -1
  245. package/dist/cjs/sync/ServerSyncEndpointProvider.d.ts +0 -34
  246. package/dist/cjs/sync/ServerSyncEndpointProvider.js +0 -69
  247. package/dist/cjs/sync/ServerSyncEndpointProvider.js.map +0 -1
  248. package/dist/cjs/sync/Sync.d.ts +0 -160
  249. package/dist/cjs/sync/Sync.js +0 -293
  250. package/dist/cjs/sync/Sync.js.map +0 -1
  251. package/dist/cjs/sync/WebSocketSync.d.ts +0 -44
  252. package/dist/cjs/sync/WebSocketSync.js +0 -221
  253. package/dist/cjs/sync/WebSocketSync.js.map +0 -1
  254. package/dist/cjs/types.d.ts +0 -12
  255. package/dist/cjs/types.js +0 -3
  256. package/dist/cjs/types.js.map +0 -1
  257. package/dist/cjs/utils/Disposable.d.ts +0 -6
  258. package/dist/cjs/utils/Disposable.js +0 -19
  259. package/dist/cjs/utils/Disposable.js.map +0 -1
  260. package/dist/cjs/utils/Resolvable.d.ts +0 -8
  261. package/dist/cjs/utils/Resolvable.js +0 -23
  262. package/dist/cjs/utils/Resolvable.js.map +0 -1
  263. package/dist/cjs/vanilla.d.ts +0 -1
  264. package/dist/cjs/vanilla.js +0 -28
  265. package/dist/cjs/vanilla.js.map +0 -1
  266. package/dist/esm/BackoffScheduler.d.ts +0 -19
  267. package/dist/esm/DocumentManager.d.ts +0 -28
  268. package/dist/esm/FakeWeakRef.d.ts +0 -11
  269. package/dist/esm/IDBService.d.ts +0 -30
  270. package/dist/esm/UndoHistory.d.ts +0 -16
  271. package/dist/esm/__tests__/batching.test.d.ts +0 -1
  272. package/dist/esm/__tests__/documents.test.d.ts +0 -1
  273. package/dist/esm/__tests__/fixtures/testStorage.d.ts +0 -76
  274. package/dist/esm/__tests__/legacyOids.test.d.ts +0 -1
  275. package/dist/esm/__tests__/mutations.test.d.ts +0 -1
  276. package/dist/esm/__tests__/queries.test.d.ts +0 -1
  277. package/dist/esm/__tests__/setup/indexedDB.d.ts +0 -1
  278. package/dist/esm/__tests__/undo.test.d.ts +0 -1
  279. package/dist/esm/backup.d.ts +0 -10
  280. package/dist/esm/client/Client.d.ts +0 -120
  281. package/dist/esm/client/ClientDescriptor.d.ts +0 -76
  282. package/dist/esm/client/constants.d.ts +0 -1
  283. package/dist/esm/constants.d.ts +0 -1
  284. package/dist/esm/context.d.ts +0 -38
  285. package/dist/esm/entities/Entity.d.ts +0 -148
  286. package/dist/esm/entities/Entity.test.d.ts +0 -1
  287. package/dist/esm/entities/EntityCache.d.ts +0 -15
  288. package/dist/esm/entities/EntityMetadata.d.ts +0 -68
  289. package/dist/esm/entities/EntityStore.d.ts +0 -80
  290. package/dist/esm/entities/OperationBatcher.d.ts +0 -52
  291. package/dist/esm/entities/types.d.ts +0 -103
  292. package/dist/esm/files/EntityFile.d.ts +0 -35
  293. package/dist/esm/files/FileManager.d.ts +0 -46
  294. package/dist/esm/files/FileStorage.d.ts +0 -39
  295. package/dist/esm/files/utils.d.ts +0 -10
  296. package/dist/esm/files/utils.test.d.ts +0 -1
  297. package/dist/esm/idb.d.ts +0 -13
  298. package/dist/esm/index.d.ts +0 -23
  299. package/dist/esm/metadata/AckInfoStore.d.ts +0 -10
  300. package/dist/esm/metadata/BaselinesStore.d.ts +0 -40
  301. package/dist/esm/metadata/LocalReplicaStore.d.ts +0 -18
  302. package/dist/esm/metadata/MessageCreator.d.ts +0 -19
  303. package/dist/esm/metadata/Metadata.d.ts +0 -134
  304. package/dist/esm/metadata/OperationsStore.d.ts +0 -62
  305. package/dist/esm/metadata/SchemaStore.d.ts +0 -9
  306. package/dist/esm/metadata/openMetadataDatabase.d.ts +0 -19
  307. package/dist/esm/migration/db.d.ts +0 -8
  308. package/dist/esm/migration/errors.d.ts +0 -5
  309. package/dist/esm/migration/openDatabase.d.ts +0 -20
  310. package/dist/esm/migration/paths.d.ts +0 -6
  311. package/dist/esm/migration/paths.test.d.ts +0 -1
  312. package/dist/esm/queries/BaseQuery.d.ts +0 -53
  313. package/dist/esm/queries/CollectionQueries.d.ts +0 -55
  314. package/dist/esm/queries/FindAllQuery.d.ts +0 -12
  315. package/dist/esm/queries/FindInfiniteQuery.d.ts +0 -19
  316. package/dist/esm/queries/FindOneQuery.d.ts +0 -12
  317. package/dist/esm/queries/FindPageQuery.d.ts +0 -24
  318. package/dist/esm/queries/GetQuery.d.ts +0 -10
  319. package/dist/esm/queries/QueryCache.d.ts +0 -17
  320. package/dist/esm/queries/QueryableStorage.d.ts +0 -20
  321. package/dist/esm/queries/dbQueries.d.ts +0 -22
  322. package/dist/esm/queries/keys.d.ts +0 -10
  323. package/dist/esm/queries/ranges.d.ts +0 -2
  324. package/dist/esm/queries/types.d.ts +0 -6
  325. package/dist/esm/queries/utils.d.ts +0 -3
  326. package/dist/esm/sync/FileSync.d.ts +0 -24
  327. package/dist/esm/sync/Heartbeat.d.ts +0 -25
  328. package/dist/esm/sync/PresenceManager.d.ts +0 -55
  329. package/dist/esm/sync/PushPullSync.d.ts +0 -39
  330. package/dist/esm/sync/ServerSyncEndpointProvider.d.ts +0 -34
  331. package/dist/esm/sync/Sync.d.ts +0 -160
  332. package/dist/esm/sync/WebSocketSync.d.ts +0 -44
  333. package/dist/esm/types.d.ts +0 -12
  334. package/dist/esm/utils/Disposable.d.ts +0 -6
  335. package/dist/esm/utils/Resolvable.d.ts +0 -8
  336. package/dist/esm/vanilla.d.ts +0 -1
  337. package/dist/tsconfig-cjs.tsbuildinfo +0 -1
  338. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,120 +0,0 @@
1
- import { EventSubscriber, Migration } from '@verdant-web/common';
2
- import { Context } from '../context.js';
3
- import { DocumentManager } from '../DocumentManager.js';
4
- import { FileManagerConfig } from '../files/FileManager.js';
5
- import { ExportData, Metadata } from '../metadata/Metadata.js';
6
- import { EntityStore } from '../entities/EntityStore.js';
7
- import { ServerSyncOptions, Sync } from '../sync/Sync.js';
8
- import { CollectionQueries } from '../queries/CollectionQueries.js';
9
- import { ReturnedFileData } from '../files/FileStorage.js';
10
- interface ClientConfig<Presence = any> {
11
- syncConfig?: ServerSyncOptions<Presence>;
12
- migrations: Migration[];
13
- files?: FileManagerConfig;
14
- }
15
- export type ClientWithCollections = Client & {
16
- [key: string]: CollectionQueries<any, any, any>;
17
- };
18
- export declare class Client<Presence = any, Profile = any> extends EventSubscriber<{
19
- /**
20
- * Called when a change from a future version of the application has
21
- * been witnessed. These changes are not applied but it indicates
22
- * the app has been updated and a peer is using a newer version.
23
- * You should listen to this event and prompt the user to reload
24
- * their client, or reload it for them.
25
- *
26
- * This event may be called multiple times.
27
- */
28
- futureSeen: () => void;
29
- }> {
30
- private config;
31
- private context;
32
- readonly meta: Metadata;
33
- private _entities;
34
- private _queryCache;
35
- private _documentManager;
36
- private _fileManager;
37
- private _closed;
38
- readonly collectionNames: string[];
39
- private _sync;
40
- get sync(): Sync<Presence, Profile>;
41
- get entities(): EntityStore;
42
- get documentManager(): DocumentManager<any>;
43
- constructor(config: ClientConfig, context: Context, components: {
44
- meta: Metadata;
45
- });
46
- private addData;
47
- get documentDb(): IDBDatabase;
48
- get metaDb(): IDBDatabase;
49
- get schema(): import("@verdant-web/common").StorageSchema<{
50
- [k: string]: import("@verdant-web/common").StorageCollectionSchema<import("@verdant-web/common").StorageFieldsSchema, import("@verdant-web/common").StorageSyntheticIndices<import("@verdant-web/common").StorageFieldsSchema>, import("@verdant-web/common").CollectionCompoundIndices<import("@verdant-web/common").StorageFieldsSchema, import("@verdant-web/common").StorageSyntheticIndices<import("@verdant-web/common").StorageFieldsSchema>>>;
51
- }>;
52
- get namespace(): string;
53
- get undoHistory(): import("../UndoHistory.js").UndoHistory;
54
- /**
55
- * Batch multiple operations together to be executed in a single transaction.
56
- * The changes made will not be included in the same undo history step as
57
- * any other changes made outside of the batch. You can also disable undo
58
- * for your batch to omit changes from undo history.
59
- *
60
- * Provide a batch name to apply multiple changes to the same batch
61
- * across different invocations. Batches will automatically flush after
62
- * a short delay or if they reach a maximum size.
63
- */
64
- get batch(): ({ undoable, batchName, max, timeout, }?: {
65
- undoable?: boolean | undefined;
66
- batchName?: string | undefined;
67
- max?: number | null | undefined;
68
- timeout?: number | null | undefined;
69
- }) => import("../entities/OperationBatcher.js").OperationBatch;
70
- stats: () => Promise<{
71
- collections: Record<string, {
72
- count: number;
73
- size: number;
74
- }>;
75
- meta: {
76
- operationsSize: {
77
- count: number;
78
- size: number;
79
- };
80
- baselinesSize: {
81
- count: number;
82
- size: number;
83
- };
84
- };
85
- storage: StorageEstimate | undefined;
86
- totalMetaSize: number;
87
- totalCollectionsSize: number;
88
- metaToDataRatio: number;
89
- quotaUsage: number | undefined;
90
- }>;
91
- close: () => Promise<void>;
92
- __dangerous__resetLocal: () => Promise<void>;
93
- export: ({ downloadRemoteFiles }?: {
94
- downloadRemoteFiles?: boolean | undefined;
95
- }) => Promise<{
96
- data: ExportData;
97
- fileData: Omit<ReturnedFileData, "file">[];
98
- files: File[];
99
- }>;
100
- private getFileExportName;
101
- private parseFileExportname;
102
- import: ({ data, fileData, files, }: {
103
- data: ExportData;
104
- fileData: Array<Omit<ReturnedFileData, 'file'>>;
105
- files: File[];
106
- }) => Promise<void>;
107
- /**
108
- * Export all data, then re-import it. This might resolve
109
- * some issues with the local database, but it should
110
- * only be done as a second-to-last resort. The last resort
111
- * would be __dangerous__resetLocal on ClientDescriptor, which
112
- * clears all local data.
113
- *
114
- * Unlike __dangerous__resetLocal, this method allows local-only
115
- * clients to recover data, whereas __dangerous__resetLocal only
116
- * lets networked clients recover from the server.
117
- */
118
- __dangerous__hardReset: () => Promise<void>;
119
- }
120
- export {};
@@ -1,76 +0,0 @@
1
- import { Migration, StorageSchema } from '@verdant-web/common';
2
- import { FileManagerConfig } from '../files/FileManager.js';
3
- import { ServerSyncOptions } from '../sync/Sync.js';
4
- import { UndoHistory } from '../UndoHistory.js';
5
- import { Client } from './Client.js';
6
- import { METADATA_VERSION_KEY } from './constants.js';
7
- export interface ClientDescriptorOptions<Presence = any, Profile = any> {
8
- /** The schema used to create this client */
9
- schema: StorageSchema<any>;
10
- /** Migrations, in order, to upgrade to each successive version of the schema */
11
- migrations: Migration<any>[];
12
- /** Provide a sync config to turn on synchronization with a server */
13
- sync?: ServerSyncOptions<Profile, Presence>;
14
- /** Optionally override the IndexedDB implementation */
15
- indexedDb?: IDBFactory;
16
- /**
17
- * Namespaces are used to separate data from different clients in IndexedDB.
18
- */
19
- namespace: string;
20
- /**
21
- * Provide your own UndoHistory to have a unified undo system across multiple
22
- * clients if you so desire.
23
- */
24
- undoHistory?: UndoHistory;
25
- /**
26
- * Provide a log function to log internal debug messages
27
- */
28
- log?: (...args: any[]) => void;
29
- disableRebasing?: boolean;
30
- /**
31
- * Provide a specific schema number to override the schema version
32
- * in the database. This is useful for testing migrations or recovering
33
- * from a mistakenly deployed incorrect schema. A specific version is required
34
- * so that you don't leave this on accidentally for all new schemas.
35
- */
36
- overrideSchemaConflict?: number;
37
- /**
38
- * Configuration for file management
39
- */
40
- files?: FileManagerConfig;
41
- /**
42
- * Enables experimental WeakRef usage to cull documents
43
- * from cache that aren't being used. This is a performance
44
- * optimization which has been tested under all Verdant's test
45
- * suites but I still want to keep testing it in the real world
46
- * before turning it on.
47
- */
48
- EXPERIMENTAL_weakRefs?: boolean;
49
- [METADATA_VERSION_KEY]?: number;
50
- }
51
- /**
52
- * Since storage initialization is async, this class wraps the core
53
- * Storage creation promise and exposes some metadata which can
54
- * be useful immediately.
55
- */
56
- export declare class ClientDescriptor<Presence = any, Profile = any, ClientImpl extends Client = Client> {
57
- private readonly init;
58
- private readonly _readyPromise;
59
- private resolveReady;
60
- private rejectReady;
61
- private _resolvedValue;
62
- private _initializing;
63
- private _namespace;
64
- get namespace(): string;
65
- constructor(init: ClientDescriptorOptions<Presence, Profile>);
66
- private initialize;
67
- private initializeDatabases;
68
- private initializeWIPDatabases;
69
- private cleanupWIPDatabases;
70
- get current(): ClientImpl | undefined;
71
- get readyPromise(): Promise<ClientImpl>;
72
- get schema(): StorageSchema<any>;
73
- open: () => Promise<ClientImpl>;
74
- close: () => Promise<void>;
75
- __dangerous__resetLocal: () => Promise<void>;
76
- }
@@ -1 +0,0 @@
1
- export declare const METADATA_VERSION_KEY: unique symbol;
@@ -1 +0,0 @@
1
- export declare const TEST_API = "__unsafe__test_api__";
@@ -1,38 +0,0 @@
1
- import { EventSubscriber, Migration, ObjectIdentifier, StorageSchema } from '@verdant-web/common';
2
- import { UndoHistory } from './UndoHistory.js';
3
- /**
4
- * Common components utilized across various client
5
- * services.
6
- */
7
- export interface Context {
8
- namespace: string;
9
- metaDb: IDBDatabase;
10
- documentDb: IDBDatabase;
11
- undoHistory: UndoHistory;
12
- schema: StorageSchema;
13
- log: (...args: any[]) => void;
14
- entityEvents: EventSubscriber<{
15
- collectionsChanged: (names: string[]) => void;
16
- documentChanged: (oid: ObjectIdentifier) => void;
17
- }>;
18
- internalEvents: EventSubscriber<{
19
- documentDbChanged: (db: IDBDatabase) => void;
20
- }>;
21
- globalEvents: EventSubscriber<{
22
- /**
23
- * A change from a future version of the application has been
24
- * witnessed. These changes are not applied but it indicates
25
- * the app has been updated and we should prompt the user
26
- * to reload or have their app user manually reload.
27
- *
28
- * The parameter is the timestamp of the future change.
29
- */
30
- futureSeen: (timestamp: string) => void;
31
- }>;
32
- weakRef<T extends object>(value: T): WeakRef<T>;
33
- migrations: Migration<any>[];
34
- /**
35
- * Get the current logical timestamp
36
- */
37
- getNow(): string;
38
- }
@@ -1,148 +0,0 @@
1
- import { EntityValidationProblem, EventSubscriber, ObjectIdentifier, PatchCreator, StorageFieldSchema } from '@verdant-web/common';
2
- import { Context } from '../context.js';
3
- import { FileManager } from '../files/FileManager.js';
4
- import { EntityCache } from './EntityCache.js';
5
- import { EntityFamilyMetadata, EntityMetadataView } from './EntityMetadata.js';
6
- import { BaseEntityValue, DataFromInit, EntityChange, EntityEvents, ListEntity, ListItemInit, ListItemValue, ObjectEntity } from './types.js';
7
- import { EntityStoreEvents } from './EntityStore.js';
8
- export interface EntityInit {
9
- oid: ObjectIdentifier;
10
- schema: StorageFieldSchema;
11
- entityFamily?: EntityCache;
12
- metadataFamily: EntityFamilyMetadata;
13
- parent?: Entity;
14
- ctx: Context;
15
- files: FileManager;
16
- readonlyKeys?: string[];
17
- fieldPath?: (string | number)[];
18
- patchCreator: PatchCreator;
19
- events: EntityStoreEvents;
20
- }
21
- export declare class Entity<Init = any, KeyValue extends BaseEntityValue = any, Snapshot extends any = DataFromInit<Init>> extends EventSubscriber<EntityEvents> implements ObjectEntity<Init, KeyValue, Snapshot>, ListEntity<Init, KeyValue, Snapshot> {
22
- readonly oid: ObjectIdentifier;
23
- private readonlyKeys;
24
- private fieldPath;
25
- private entityFamily;
26
- private metadataFamily;
27
- private schema;
28
- private parent;
29
- private ctx;
30
- private files;
31
- private patchCreator;
32
- private events;
33
- private _viewData;
34
- private validationError;
35
- private cachedDeepUpdatedAt;
36
- private wasDeletedLastChange;
37
- private cachedView;
38
- constructor({ oid, schema, entityFamily: childCache, parent, ctx, metadataFamily, readonlyKeys, files, patchCreator, events, }: EntityInit);
39
- private onAdd;
40
- private onReplace;
41
- private onResetAll;
42
- private get metadata();
43
- /**
44
- * The view of this Entity, not including nested
45
- * entities (that's the snapshot - see #getSnapshot())
46
- *
47
- * Nested entities are represented by refs.
48
- */
49
- private get viewData();
50
- /** convenience getter for viewData.view */
51
- private get rawView();
52
- /**
53
- * An Entity's View includes the rendering of its underlying data,
54
- * connecting of children where refs were, and validation
55
- * and pruning according to schema.
56
- */
57
- private get view();
58
- private childIsNull;
59
- get uid(): string;
60
- get deleted(): boolean;
61
- get invalid(): boolean;
62
- get isList(): any;
63
- get updatedAt(): number;
64
- get deepUpdatedAt(): number;
65
- /**
66
- * @internal - this is relevant to Verdant's system, not users.
67
- *
68
- * Indicates whether this document is from an outdated version
69
- * of the schema - which means it cannot be used until it is upgraded.
70
- */
71
- get isOutdatedVersion(): boolean;
72
- /**
73
- * Pruning - when entities have invalid children, we 'prune' that
74
- * data up to the nearest prunable point - a nullable field,
75
- * or a list.
76
- */
77
- protected validate: (...args: unknown[]) => EntityValidationProblem | undefined;
78
- private viewWithMappedChildren;
79
- /**
80
- * A current snapshot of this Entity's data, including nested
81
- * Entities.
82
- */
83
- getSnapshot: () => any;
84
- private addPendingOperations;
85
- private addConfirmedData;
86
- private replaceAllData;
87
- private resetAllData;
88
- private change;
89
- protected deepChange: (target: Entity, ev: EntityChange) => void;
90
- private getChild;
91
- /**
92
- * Gets a value from this Entity. If the value
93
- * is an object, it will be wrapped in another
94
- * Entity.
95
- */
96
- get: <Key extends keyof KeyValue>(key: Key) => KeyValue[Key];
97
- private processInputValue;
98
- private getDeleteMode;
99
- /**
100
- * Returns the referent value of an item in the list, used for
101
- * operations which act on items. if the item is an object,
102
- * it will attempt to create an OID reference to it. If it
103
- * is a primitive, it will return the primitive.
104
- */
105
- private getItemRefValue;
106
- set: <Key extends keyof Init>(key: Key, value: Init[Key]) => void;
107
- /**
108
- * Returns a destructured version of this Entity, where child
109
- * Entities are accessible at their respective keys.
110
- */
111
- getAll: () => KeyValue;
112
- delete: (key: any) => void;
113
- keys: () => string[];
114
- entries: () => [string, Exclude<KeyValue[keyof KeyValue], undefined>][];
115
- values: () => Exclude<KeyValue[keyof KeyValue], undefined>[];
116
- update: (data: any, { merge, replaceSubObjects, }?: {
117
- replaceSubObjects?: boolean | undefined;
118
- merge?: boolean | undefined;
119
- }) => void;
120
- get length(): number;
121
- push: (value: ListItemInit<Init>) => void;
122
- insert: (index: number, value: ListItemInit<Init>) => void;
123
- move: (from: number, to: number) => void;
124
- moveItem: (item: ListItemValue<KeyValue>, to: number) => void;
125
- add: (value: ListItemValue<KeyValue>) => void;
126
- removeAll: (item: ListItemValue<KeyValue>) => void;
127
- removeFirst: (item: ListItemValue<KeyValue>) => void;
128
- removeLast: (item: ListItemValue<KeyValue>) => void;
129
- [Symbol.iterator](): {
130
- next: () => {
131
- readonly value: ListItemValue<KeyValue>;
132
- readonly done: false;
133
- } | {
134
- readonly value: undefined;
135
- readonly done: true;
136
- };
137
- };
138
- map: <U>(callback: (value: ListItemValue<KeyValue>, index: number) => U) => U[];
139
- filter: (callback: (value: ListItemValue<KeyValue>, index: number) => boolean) => ListItemValue<KeyValue>[];
140
- has: (value: ListItemValue<KeyValue>) => boolean;
141
- forEach: (callback: (value: ListItemValue<KeyValue>, index: number) => void) => void;
142
- some: (predicate: (value: ListItemValue<KeyValue>) => boolean) => boolean;
143
- every: (predicate: (value: ListItemValue<KeyValue>) => boolean) => boolean;
144
- find: (predicate: (value: ListItemValue<KeyValue>) => boolean) => ListItemValue<KeyValue> | undefined;
145
- includes: (value: ListItemValue<KeyValue>) => boolean;
146
- __getViewData__: (oid: ObjectIdentifier, type: 'confirmed' | 'pending') => EntityMetadataView;
147
- __getFamilyOids__: () => string[];
148
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { Entity, EntityInit } from './Entity.js';
2
- import { EntityFile } from '../files/EntityFile.js';
3
- import { ObjectIdentifier } from '@verdant-web/common';
4
- export declare class EntityCache {
5
- private cache;
6
- constructor({ initial }?: {
7
- initial?: Entity[];
8
- });
9
- get: (init: EntityInit) => Entity;
10
- has: (oid: ObjectIdentifier) => boolean;
11
- getFile: (id: string, options: {
12
- downloadRemote: boolean;
13
- }) => EntityFile;
14
- getCached: (oid: string) => Entity<any, any, any> | EntityFile | undefined;
15
- }
@@ -1,68 +0,0 @@
1
- import { DocumentBaseline, ObjectIdentifier, Operation } from '@verdant-web/common';
2
- import { Context } from '../context.js';
3
- import { EntityChange } from './types.js';
4
- export type EntityMetadataView = {
5
- view: any;
6
- fromOlderVersion: boolean;
7
- deleted: boolean;
8
- empty: boolean;
9
- updatedAt: number;
10
- };
11
- export declare class EntityMetadata {
12
- private ctx;
13
- private baseline;
14
- private confirmedOperations;
15
- private pendingOperations;
16
- readonly oid: string;
17
- constructor({ oid, ctx, confirmedOperations, pendingOperations, baseline, }: {
18
- oid: ObjectIdentifier;
19
- ctx: Context;
20
- confirmedOperations?: Operation[];
21
- pendingOperations?: Operation[];
22
- baseline?: DocumentBaseline;
23
- });
24
- /**
25
- * Compute the current view of the entity.
26
- */
27
- computeView: (omitPending?: boolean) => EntityMetadataView;
28
- addBaseline: (baseline: DocumentBaseline) => void;
29
- /**
30
- * @returns total number of new operations added
31
- */
32
- addConfirmedOperations: (operations: Operation[]) => number;
33
- addPendingOperation: (operation: Operation) => void;
34
- private applyOperations;
35
- }
36
- /**
37
- * Represents the metadata for a group of entities underneath a Document.
38
- * Metadata is separated out this way so that these classes can be
39
- * garbage collected when the root Document goes out of scope.
40
- */
41
- export declare class EntityFamilyMetadata {
42
- private ctx;
43
- private entities;
44
- private onPendingOperations;
45
- private rootOid;
46
- constructor({ ctx, onPendingOperations, rootOid, }: {
47
- ctx: Context;
48
- onPendingOperations: (ops: Operation[]) => void;
49
- rootOid: ObjectIdentifier;
50
- });
51
- get: (oid: ObjectIdentifier) => EntityMetadata;
52
- getAllOids: () => string[];
53
- addConfirmedData: ({ baselines, operations, isLocal, }: {
54
- baselines?: DocumentBaseline<any>[] | undefined;
55
- operations?: Record<string, Operation[]> | undefined;
56
- isLocal?: boolean | undefined;
57
- }) => EntityChange[];
58
- /**
59
- * Adds local, unconfirmed operations to the system.
60
- * The API is different here to streamline for the way
61
- * local changes are usually handled, as a list.
62
- */
63
- addPendingData: (operations: Operation[]) => EntityChange[];
64
- replaceAllData: ({ operations, baselines, }: {
65
- operations?: Record<string, Operation[]> | undefined;
66
- baselines?: DocumentBaseline<any>[] | undefined;
67
- }) => EntityChange[];
68
- }
@@ -1,80 +0,0 @@
1
- import { DocumentBaseline, ObjectIdentifier, Operation } from '@verdant-web/common';
2
- import { Context } from '../context.js';
3
- import { Metadata } from '../metadata/Metadata.js';
4
- import { Entity } from './Entity.js';
5
- import { Disposable } from '../utils/Disposable.js';
6
- import { FileManager } from '../files/FileManager.js';
7
- import { WeakEvent } from 'weak-event';
8
- import { abort } from 'process';
9
- export type EntityStoreEventData = {
10
- oid: ObjectIdentifier;
11
- operations?: Record<string, Operation[]>;
12
- baselines?: DocumentBaseline[];
13
- isLocal: boolean;
14
- };
15
- export type EntityStoreEvents = {
16
- add: WeakEvent<EntityStore, EntityStoreEventData>;
17
- replace: WeakEvent<EntityStore, EntityStoreEventData>;
18
- resetAll: WeakEvent<EntityStore, void>;
19
- };
20
- type IncomingData = {
21
- operations?: Operation[];
22
- baselines?: DocumentBaseline[];
23
- reset?: boolean;
24
- isLocal?: boolean;
25
- };
26
- export declare class EntityStore extends Disposable {
27
- private ctx;
28
- private meta;
29
- private files;
30
- private batcher;
31
- private queryableStorage;
32
- private events;
33
- private cache;
34
- private pendingEntityPromises;
35
- private abortDataQueueController;
36
- private ongoingResetPromise;
37
- private entityFinalizationRegistry;
38
- constructor({ ctx, meta, files, }: {
39
- ctx: Context;
40
- meta: Metadata;
41
- files: FileManager;
42
- });
43
- get batch(): ({ undoable, batchName, max, timeout, }?: {
44
- undoable?: boolean | undefined;
45
- batchName?: string | undefined;
46
- max?: number | null | undefined;
47
- timeout?: number | null | undefined;
48
- }) => import("./OperationBatcher.js").OperationBatch;
49
- get flushAllBatches(): () => Promise<any[]>;
50
- addData: (data: IncomingData) => Promise<void>;
51
- private resetData;
52
- private processData;
53
- hydrate: (oid: string, opts?: {
54
- abort: AbortSignal;
55
- }) => Promise<Entity | null>;
56
- destroy: () => Promise<void>;
57
- /**
58
- * Creates a new Entity with the given initial data.
59
- */
60
- create: (initial: any, oid: ObjectIdentifier, { undoable }?: {
61
- undoable?: boolean | undefined;
62
- }) => Promise<Entity<any, any, any>>;
63
- deleteAll: (oids: ObjectIdentifier[], options?: {
64
- undoable?: boolean;
65
- }) => Promise<void>;
66
- delete: (oid: ObjectIdentifier, options?: {
67
- undoable?: boolean;
68
- }) => Promise<void>;
69
- private getCollectionSchema;
70
- /**
71
- * Constructs an entity from an OID, but does not load it.
72
- */
73
- private constructEntity;
74
- private onPendingOperations;
75
- /**
76
- * Loads initial Entity data from storage
77
- */
78
- private loadEntity;
79
- }
80
- export {};
@@ -1,52 +0,0 @@
1
- import { Operation } from '@verdant-web/common';
2
- import { Metadata } from '../metadata/Metadata.js';
3
- import { Context } from '../context.js';
4
- import type { EntityStore } from './EntityStore.js';
5
- import { Entity } from './Entity.js';
6
- export interface OperationBatch {
7
- run: (fn: () => void) => this;
8
- /** @deprecated - use commit() */
9
- flush: () => Promise<void>;
10
- commit: () => Promise<void>;
11
- discard: () => void;
12
- }
13
- export declare class OperationBatcher {
14
- private batcher;
15
- private currentBatchKey;
16
- private defaultBatchTimeout;
17
- private meta;
18
- private ctx;
19
- private entities;
20
- constructor({ batchTimeout, meta, ctx, entities, }: {
21
- batchTimeout?: number;
22
- meta: Metadata;
23
- ctx: Context;
24
- entities: EntityStore;
25
- });
26
- get isDefaultBatch(): boolean;
27
- private flushOperations;
28
- /**
29
- * Immediately flushes operations to storage / sync.
30
- * Providing source to second arg skips hydrating related
31
- * Entity from storage, which is useful when that Entity
32
- * isn't in storage (i.e. still creating) or just to speed
33
- * up the commit.
34
- */
35
- commitOperations: (operations: Operation[], meta: {
36
- undoable?: boolean;
37
- source?: Entity;
38
- }) => Promise<void>;
39
- /**
40
- * Adds operations to the active batch.
41
- */
42
- addOperations: (operations: Operation[]) => void;
43
- batch: ({ undoable, batchName, max, timeout, }?: {
44
- undoable?: boolean | undefined;
45
- batchName?: string | undefined;
46
- max?: number | null | undefined;
47
- timeout?: number | null | undefined;
48
- }) => OperationBatch;
49
- flushAll: () => Promise<any[]>;
50
- private createUndo;
51
- private getInverseOperations;
52
- }