@fireproof/core 0.20.0-dev-preview-63 → 0.20.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 (407) hide show
  1. package/deno/index.d.ts +7 -0
  2. package/deno/index.js +66 -0
  3. package/deno/index.js.map +1 -0
  4. package/deno/metafile-esm.json +1 -0
  5. package/deno.json +2 -2
  6. package/index.cjs +7268 -0
  7. package/index.cjs.map +1 -0
  8. package/index.d.cts +2742 -0
  9. package/index.d.ts +2742 -15
  10. package/index.js +7267 -14
  11. package/index.js.map +1 -1
  12. package/indexeddb/index.cjs +218 -0
  13. package/indexeddb/index.cjs.map +1 -0
  14. package/indexeddb/index.d.cts +30 -0
  15. package/indexeddb/index.d.ts +30 -0
  16. package/indexeddb/index.js +195 -0
  17. package/indexeddb/index.js.map +1 -0
  18. package/indexeddb/metafile-cjs.json +1 -0
  19. package/indexeddb/metafile-esm.json +1 -0
  20. package/metafile-cjs.json +1 -0
  21. package/metafile-esm.json +1 -0
  22. package/node/index.cjs +97 -0
  23. package/node/index.cjs.map +1 -0
  24. package/node/index.d.cts +7 -0
  25. package/node/index.d.ts +7 -0
  26. package/node/index.js +64 -0
  27. package/node/index.js.map +1 -0
  28. package/node/metafile-cjs.json +1 -0
  29. package/node/metafile-esm.json +1 -0
  30. package/package.json +17 -20
  31. package/react/index.cjs +296 -0
  32. package/react/index.cjs.map +1 -0
  33. package/react/{img-file.d.ts → index.d.cts} +53 -6
  34. package/react/index.d.ts +336 -4
  35. package/react/index.js +262 -3
  36. package/react/index.js.map +1 -1
  37. package/react/metafile-cjs.json +1 -0
  38. package/react/metafile-esm.json +1 -0
  39. package/tests/blockstore/loader.test.ts +1 -1
  40. package/tests/blockstore/store.test.ts +4 -9
  41. package/tests/fireproof/attachable.test.ts +3 -3
  42. package/tests/react/use-fireproof-db-switch.test.tsx +91 -0
  43. package/tests/www/gallery.html +132 -0
  44. package/tests/www/iife.html +42 -0
  45. package/tests/www/todo-aws.html +232 -0
  46. package/tests/www/todo-ipfs.html +213 -0
  47. package/tests/www/todo-local.html +214 -0
  48. package/tests/www/todo-netlify.html +227 -0
  49. package/tests/www/todo.html +254 -0
  50. package/apply-head-queue.d.ts +0 -18
  51. package/apply-head-queue.d.ts.map +0 -1
  52. package/apply-head-queue.js +0 -47
  53. package/apply-head-queue.js.map +0 -1
  54. package/blockstore/attachable-store.d.ts +0 -17
  55. package/blockstore/attachable-store.d.ts.map +0 -1
  56. package/blockstore/attachable-store.js +0 -295
  57. package/blockstore/attachable-store.js.map +0 -1
  58. package/blockstore/commit-queue.d.ts +0 -12
  59. package/blockstore/commit-queue.d.ts.map +0 -1
  60. package/blockstore/commit-queue.js +0 -52
  61. package/blockstore/commit-queue.js.map +0 -1
  62. package/blockstore/commitor.d.ts +0 -21
  63. package/blockstore/commitor.d.ts.map +0 -1
  64. package/blockstore/commitor.js +0 -104
  65. package/blockstore/commitor.js.map +0 -1
  66. package/blockstore/connect-raw.d.ts +0 -2
  67. package/blockstore/connect-raw.d.ts.map +0 -1
  68. package/blockstore/connect-raw.js +0 -2
  69. package/blockstore/connect-raw.js.map +0 -1
  70. package/blockstore/connection-base.d.ts +0 -2
  71. package/blockstore/connection-base.d.ts.map +0 -1
  72. package/blockstore/connection-base.js +0 -2
  73. package/blockstore/connection-base.js.map +0 -1
  74. package/blockstore/encrypt-helpers.d.ts +0 -2
  75. package/blockstore/encrypt-helpers.d.ts.map +0 -1
  76. package/blockstore/encrypt-helpers.js +0 -2
  77. package/blockstore/encrypt-helpers.js.map +0 -1
  78. package/blockstore/fp-envelope.d.ts +0 -32
  79. package/blockstore/fp-envelope.d.ts.map +0 -1
  80. package/blockstore/fp-envelope.js +0 -14
  81. package/blockstore/fp-envelope.js.map +0 -1
  82. package/blockstore/gateway.d.ts +0 -20
  83. package/blockstore/gateway.d.ts.map +0 -1
  84. package/blockstore/gateway.js +0 -2
  85. package/blockstore/gateway.js.map +0 -1
  86. package/blockstore/index.d.ts +0 -16
  87. package/blockstore/index.d.ts.map +0 -1
  88. package/blockstore/index.js +0 -16
  89. package/blockstore/index.js.map +0 -1
  90. package/blockstore/interceptor-gateway.d.ts +0 -29
  91. package/blockstore/interceptor-gateway.d.ts.map +0 -1
  92. package/blockstore/interceptor-gateway.js +0 -137
  93. package/blockstore/interceptor-gateway.js.map +0 -1
  94. package/blockstore/loader-helpers.d.ts +0 -4
  95. package/blockstore/loader-helpers.d.ts.map +0 -1
  96. package/blockstore/loader-helpers.js +0 -16
  97. package/blockstore/loader-helpers.js.map +0 -1
  98. package/blockstore/loader.d.ts +0 -45
  99. package/blockstore/loader.d.ts.map +0 -1
  100. package/blockstore/loader.js +0 -352
  101. package/blockstore/loader.js.map +0 -1
  102. package/blockstore/register-store-protocol.d.ts +0 -22
  103. package/blockstore/register-store-protocol.d.ts.map +0 -1
  104. package/blockstore/register-store-protocol.js +0 -114
  105. package/blockstore/register-store-protocol.js.map +0 -1
  106. package/blockstore/serde-gateway.d.ts +0 -78
  107. package/blockstore/serde-gateway.d.ts.map +0 -1
  108. package/blockstore/serde-gateway.js +0 -2
  109. package/blockstore/serde-gateway.js.map +0 -1
  110. package/blockstore/store-factory.d.ts +0 -11
  111. package/blockstore/store-factory.d.ts.map +0 -1
  112. package/blockstore/store-factory.js +0 -105
  113. package/blockstore/store-factory.js.map +0 -1
  114. package/blockstore/store-remote.d.ts +0 -2
  115. package/blockstore/store-remote.d.ts.map +0 -1
  116. package/blockstore/store-remote.js +0 -2
  117. package/blockstore/store-remote.js.map +0 -1
  118. package/blockstore/store.d.ts +0 -82
  119. package/blockstore/store.d.ts.map +0 -1
  120. package/blockstore/store.js +0 -438
  121. package/blockstore/store.js.map +0 -1
  122. package/blockstore/task-manager.d.ts +0 -19
  123. package/blockstore/task-manager.d.ts.map +0 -1
  124. package/blockstore/task-manager.js +0 -50
  125. package/blockstore/task-manager.js.map +0 -1
  126. package/blockstore/transaction.d.ts +0 -64
  127. package/blockstore/transaction.d.ts.map +0 -1
  128. package/blockstore/transaction.js +0 -249
  129. package/blockstore/transaction.js.map +0 -1
  130. package/blockstore/types.d.ts +0 -400
  131. package/blockstore/types.d.ts.map +0 -1
  132. package/blockstore/types.js +0 -55
  133. package/blockstore/types.js.map +0 -1
  134. package/blockstore/uri-interceptor.d.ts +0 -19
  135. package/blockstore/uri-interceptor.d.ts.map +0 -1
  136. package/blockstore/uri-interceptor.js +0 -61
  137. package/blockstore/uri-interceptor.js.map +0 -1
  138. package/bundle-not-impl.d.ts +0 -2
  139. package/bundle-not-impl.d.ts.map +0 -1
  140. package/bundle-not-impl.js +0 -4
  141. package/bundle-not-impl.js.map +0 -1
  142. package/cli/main.js +0 -26114
  143. package/context.d.ts +0 -7
  144. package/context.d.ts.map +0 -1
  145. package/context.js +0 -15
  146. package/context.js.map +0 -1
  147. package/crdt-clock.d.ts +0 -27
  148. package/crdt-clock.d.ts.map +0 -1
  149. package/crdt-clock.js +0 -140
  150. package/crdt-clock.js.map +0 -1
  151. package/crdt-helpers.d.ts +0 -16
  152. package/crdt-helpers.d.ts.map +0 -1
  153. package/crdt-helpers.js +0 -316
  154. package/crdt-helpers.js.map +0 -1
  155. package/crdt.d.ts +0 -34
  156. package/crdt.d.ts.map +0 -1
  157. package/crdt.js +0 -131
  158. package/crdt.js.map +0 -1
  159. package/database.d.ts +0 -34
  160. package/database.d.ts.map +0 -1
  161. package/database.js +0 -121
  162. package/database.js.map +0 -1
  163. package/index.d.ts.map +0 -1
  164. package/indexer-helpers.d.ts +0 -69
  165. package/indexer-helpers.d.ts.map +0 -1
  166. package/indexer-helpers.js +0 -135
  167. package/indexer-helpers.js.map +0 -1
  168. package/indexer.d.ts +0 -25
  169. package/indexer.d.ts.map +0 -1
  170. package/indexer.js +0 -231
  171. package/indexer.js.map +0 -1
  172. package/ledger.d.ts +0 -56
  173. package/ledger.d.ts.map +0 -1
  174. package/ledger.js +0 -224
  175. package/ledger.js.map +0 -1
  176. package/protocols/cloud/http-connection.d.ts +0 -25
  177. package/protocols/cloud/http-connection.d.ts.map +0 -1
  178. package/protocols/cloud/http-connection.js +0 -153
  179. package/protocols/cloud/http-connection.js.map +0 -1
  180. package/protocols/cloud/index.d.ts +0 -10
  181. package/protocols/cloud/index.d.ts.map +0 -1
  182. package/protocols/cloud/index.js +0 -10
  183. package/protocols/cloud/index.js.map +0 -1
  184. package/protocols/cloud/msg-raw-connection-base.d.ts +0 -16
  185. package/protocols/cloud/msg-raw-connection-base.d.ts.map +0 -1
  186. package/protocols/cloud/msg-raw-connection-base.js +0 -22
  187. package/protocols/cloud/msg-raw-connection-base.js.map +0 -1
  188. package/protocols/cloud/msg-types-data.d.ts +0 -36
  189. package/protocols/cloud/msg-types-data.d.ts.map +0 -1
  190. package/protocols/cloud/msg-types-data.js +0 -38
  191. package/protocols/cloud/msg-types-data.js.map +0 -1
  192. package/protocols/cloud/msg-types-meta.d.ts +0 -41
  193. package/protocols/cloud/msg-types-meta.d.ts.map +0 -1
  194. package/protocols/cloud/msg-types-meta.js +0 -98
  195. package/protocols/cloud/msg-types-meta.js.map +0 -1
  196. package/protocols/cloud/msg-types-wal.d.ts +0 -33
  197. package/protocols/cloud/msg-types-wal.d.ts.map +0 -1
  198. package/protocols/cloud/msg-types-wal.js +0 -38
  199. package/protocols/cloud/msg-types-wal.js.map +0 -1
  200. package/protocols/cloud/msg-types.d.ts +0 -279
  201. package/protocols/cloud/msg-types.d.ts.map +0 -1
  202. package/protocols/cloud/msg-types.js +0 -278
  203. package/protocols/cloud/msg-types.js.map +0 -1
  204. package/protocols/cloud/msger.d.ts +0 -79
  205. package/protocols/cloud/msger.d.ts.map +0 -1
  206. package/protocols/cloud/msger.js +0 -198
  207. package/protocols/cloud/msger.js.map +0 -1
  208. package/protocols/cloud/ws-connection.d.ts +0 -29
  209. package/protocols/cloud/ws-connection.d.ts.map +0 -1
  210. package/protocols/cloud/ws-connection.js +0 -163
  211. package/protocols/cloud/ws-connection.js.map +0 -1
  212. package/protocols/index.d.ts +0 -2
  213. package/protocols/index.d.ts.map +0 -1
  214. package/protocols/index.js +0 -2
  215. package/protocols/index.js.map +0 -1
  216. package/react/img-file.d.ts.map +0 -1
  217. package/react/img-file.js +0 -58
  218. package/react/img-file.js.map +0 -1
  219. package/react/index.d.ts.map +0 -1
  220. package/react/types.d.ts +0 -43
  221. package/react/types.d.ts.map +0 -1
  222. package/react/types.js +0 -2
  223. package/react/types.js.map +0 -1
  224. package/react/use-all-docs.d.ts +0 -4
  225. package/react/use-all-docs.d.ts.map +0 -1
  226. package/react/use-all-docs.js +0 -19
  227. package/react/use-all-docs.js.map +0 -1
  228. package/react/use-changes.d.ts +0 -4
  229. package/react/use-changes.d.ts.map +0 -1
  230. package/react/use-changes.js +0 -19
  231. package/react/use-changes.js.map +0 -1
  232. package/react/use-document.d.ts +0 -4
  233. package/react/use-document.d.ts.map +0 -1
  234. package/react/use-document.js +0 -99
  235. package/react/use-document.js.map +0 -1
  236. package/react/use-fireproof.d.ts +0 -6
  237. package/react/use-fireproof.d.ts.map +0 -1
  238. package/react/use-fireproof.js +0 -15
  239. package/react/use-fireproof.js.map +0 -1
  240. package/react/use-live-query.d.ts +0 -4
  241. package/react/use-live-query.d.ts.map +0 -1
  242. package/react/use-live-query.js +0 -38
  243. package/react/use-live-query.js.map +0 -1
  244. package/react/utils.d.ts +0 -2
  245. package/react/utils.d.ts.map +0 -1
  246. package/react/utils.js +0 -4
  247. package/react/utils.js.map +0 -1
  248. package/runtime/files.d.ts +0 -12
  249. package/runtime/files.d.ts.map +0 -1
  250. package/runtime/files.js +0 -29
  251. package/runtime/files.js.map +0 -1
  252. package/runtime/gateways/cloud/gateway.d.ts +0 -44
  253. package/runtime/gateways/cloud/gateway.d.ts.map +0 -1
  254. package/runtime/gateways/cloud/gateway.js +0 -496
  255. package/runtime/gateways/cloud/gateway.js.map +0 -1
  256. package/runtime/gateways/def-serde-gateway.d.ts +0 -19
  257. package/runtime/gateways/def-serde-gateway.d.ts.map +0 -1
  258. package/runtime/gateways/def-serde-gateway.js +0 -73
  259. package/runtime/gateways/def-serde-gateway.js.map +0 -1
  260. package/runtime/gateways/file/deno/deno-filesystem.d.ts +0 -27
  261. package/runtime/gateways/file/deno/deno-filesystem.d.ts.map +0 -1
  262. package/runtime/gateways/file/deno/deno-filesystem.js +0 -51
  263. package/runtime/gateways/file/deno/deno-filesystem.js.map +0 -1
  264. package/runtime/gateways/file/deno/get-sys-file-system.d.ts +0 -4
  265. package/runtime/gateways/file/deno/get-sys-file-system.d.ts.map +0 -1
  266. package/runtime/gateways/file/deno/get-sys-file-system.js +0 -11
  267. package/runtime/gateways/file/deno/get-sys-file-system.js.map +0 -1
  268. package/runtime/gateways/file/deno/index.d.ts +0 -2
  269. package/runtime/gateways/file/deno/index.d.ts.map +0 -1
  270. package/runtime/gateways/file/deno/index.js +0 -2
  271. package/runtime/gateways/file/deno/index.js.map +0 -1
  272. package/runtime/gateways/file/gateway-impl.d.ts +0 -18
  273. package/runtime/gateways/file/gateway-impl.d.ts.map +0 -1
  274. package/runtime/gateways/file/gateway-impl.js +0 -121
  275. package/runtime/gateways/file/gateway-impl.js.map +0 -1
  276. package/runtime/gateways/file/index.d.ts +0 -3
  277. package/runtime/gateways/file/index.d.ts.map +0 -1
  278. package/runtime/gateways/file/index.js +0 -3
  279. package/runtime/gateways/file/index.js.map +0 -1
  280. package/runtime/gateways/file/key-bag-file.d.ts +0 -19
  281. package/runtime/gateways/file/key-bag-file.d.ts.map +0 -1
  282. package/runtime/gateways/file/key-bag-file.js +0 -40
  283. package/runtime/gateways/file/key-bag-file.js.map +0 -1
  284. package/runtime/gateways/file/node/get-sys-file-system.d.ts +0 -4
  285. package/runtime/gateways/file/node/get-sys-file-system.d.ts.map +0 -1
  286. package/runtime/gateways/file/node/get-sys-file-system.js +0 -11
  287. package/runtime/gateways/file/node/get-sys-file-system.js.map +0 -1
  288. package/runtime/gateways/file/node/index.d.ts +0 -2
  289. package/runtime/gateways/file/node/index.d.ts.map +0 -1
  290. package/runtime/gateways/file/node/index.js +0 -2
  291. package/runtime/gateways/file/node/index.js.map +0 -1
  292. package/runtime/gateways/file/node/node-filesystem.d.ts +0 -32
  293. package/runtime/gateways/file/node/node-filesystem.d.ts.map +0 -1
  294. package/runtime/gateways/file/node/node-filesystem.js +0 -37
  295. package/runtime/gateways/file/node/node-filesystem.js.map +0 -1
  296. package/runtime/gateways/file/node/to-array-buffer.d.ts +0 -2
  297. package/runtime/gateways/file/node/to-array-buffer.d.ts.map +0 -1
  298. package/runtime/gateways/file/node/to-array-buffer.js +0 -12
  299. package/runtime/gateways/file/node/to-array-buffer.js.map +0 -1
  300. package/runtime/gateways/file/sys-file-system-factory.d.ts +0 -4
  301. package/runtime/gateways/file/sys-file-system-factory.d.ts.map +0 -1
  302. package/runtime/gateways/file/sys-file-system-factory.js +0 -13
  303. package/runtime/gateways/file/sys-file-system-factory.js.map +0 -1
  304. package/runtime/gateways/file/utils.d.ts +0 -5
  305. package/runtime/gateways/file/utils.d.ts.map +0 -1
  306. package/runtime/gateways/file/utils.js +0 -27
  307. package/runtime/gateways/file/utils.js.map +0 -1
  308. package/runtime/gateways/file/version.d.ts +0 -2
  309. package/runtime/gateways/file/version.d.ts.map +0 -1
  310. package/runtime/gateways/file/version.js +0 -2
  311. package/runtime/gateways/file/version.js.map +0 -1
  312. package/runtime/gateways/fp-envelope-serialize.d.ts +0 -50
  313. package/runtime/gateways/fp-envelope-serialize.d.ts.map +0 -1
  314. package/runtime/gateways/fp-envelope-serialize.js +0 -141
  315. package/runtime/gateways/fp-envelope-serialize.js.map +0 -1
  316. package/runtime/gateways/index.d.ts +0 -6
  317. package/runtime/gateways/index.d.ts.map +0 -1
  318. package/runtime/gateways/index.js +0 -6
  319. package/runtime/gateways/index.js.map +0 -1
  320. package/runtime/gateways/indexeddb/gateway-impl.d.ts +0 -22
  321. package/runtime/gateways/indexeddb/gateway-impl.d.ts.map +0 -1
  322. package/runtime/gateways/indexeddb/gateway-impl.js +0 -147
  323. package/runtime/gateways/indexeddb/gateway-impl.js.map +0 -1
  324. package/runtime/gateways/indexeddb/index.d.ts +0 -6
  325. package/runtime/gateways/indexeddb/index.d.ts.map +0 -1
  326. package/runtime/gateways/indexeddb/index.js +0 -6
  327. package/runtime/gateways/indexeddb/index.js.map +0 -1
  328. package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts +0 -15
  329. package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts.map +0 -1
  330. package/runtime/gateways/indexeddb/key-bag-indexeddb.js +0 -42
  331. package/runtime/gateways/indexeddb/key-bag-indexeddb.js.map +0 -1
  332. package/runtime/gateways/indexeddb-version.d.ts +0 -2
  333. package/runtime/gateways/indexeddb-version.d.ts.map +0 -1
  334. package/runtime/gateways/indexeddb-version.js +0 -2
  335. package/runtime/gateways/indexeddb-version.js.map +0 -1
  336. package/runtime/gateways/memory/gateway.d.ts +0 -18
  337. package/runtime/gateways/memory/gateway.d.ts.map +0 -1
  338. package/runtime/gateways/memory/gateway.js +0 -58
  339. package/runtime/gateways/memory/gateway.js.map +0 -1
  340. package/runtime/gateways/memory/version.d.ts +0 -2
  341. package/runtime/gateways/memory/version.d.ts.map +0 -1
  342. package/runtime/gateways/memory/version.js +0 -2
  343. package/runtime/gateways/memory/version.js.map +0 -1
  344. package/runtime/index.d.ts +0 -13
  345. package/runtime/index.d.ts.map +0 -1
  346. package/runtime/index.js +0 -13
  347. package/runtime/index.js.map +0 -1
  348. package/runtime/key-bag-memory.d.ts +0 -12
  349. package/runtime/key-bag-memory.d.ts.map +0 -1
  350. package/runtime/key-bag-memory.js +0 -23
  351. package/runtime/key-bag-memory.js.map +0 -1
  352. package/runtime/key-bag.d.ts +0 -85
  353. package/runtime/key-bag.d.ts.map +0 -1
  354. package/runtime/key-bag.js +0 -415
  355. package/runtime/key-bag.js.map +0 -1
  356. package/runtime/keyed-crypto.d.ts +0 -19
  357. package/runtime/keyed-crypto.d.ts.map +0 -1
  358. package/runtime/keyed-crypto.js +0 -192
  359. package/runtime/keyed-crypto.js.map +0 -1
  360. package/runtime/memory-sys-container.d.ts +0 -2
  361. package/runtime/memory-sys-container.d.ts.map +0 -1
  362. package/runtime/memory-sys-container.js +0 -2
  363. package/runtime/memory-sys-container.js.map +0 -1
  364. package/runtime/meta-key-hack.d.ts +0 -42
  365. package/runtime/meta-key-hack.d.ts.map +0 -1
  366. package/runtime/meta-key-hack.js +0 -201
  367. package/runtime/meta-key-hack.js.map +0 -1
  368. package/runtime/sts-service/index.d.ts +0 -40
  369. package/runtime/sts-service/index.d.ts.map +0 -1
  370. package/runtime/sts-service/index.js +0 -102
  371. package/runtime/sts-service/index.js.map +0 -1
  372. package/runtime/sys-container.d.ts +0 -2
  373. package/runtime/sys-container.d.ts.map +0 -1
  374. package/runtime/sys-container.js +0 -2
  375. package/runtime/sys-container.js.map +0 -1
  376. package/runtime/wait-pr-multiformats/block.d.ts +0 -47
  377. package/runtime/wait-pr-multiformats/block.d.ts.map +0 -1
  378. package/runtime/wait-pr-multiformats/block.js +0 -64
  379. package/runtime/wait-pr-multiformats/block.js.map +0 -1
  380. package/runtime/wait-pr-multiformats/codec-interface.d.ts +0 -29
  381. package/runtime/wait-pr-multiformats/codec-interface.d.ts.map +0 -1
  382. package/runtime/wait-pr-multiformats/codec-interface.js +0 -2
  383. package/runtime/wait-pr-multiformats/codec-interface.js.map +0 -1
  384. package/runtime/wait-pr-multiformats/index.d.ts +0 -3
  385. package/runtime/wait-pr-multiformats/index.d.ts.map +0 -1
  386. package/runtime/wait-pr-multiformats/index.js +0 -3
  387. package/runtime/wait-pr-multiformats/index.js.map +0 -1
  388. package/types.d.ts +0 -427
  389. package/types.d.ts.map +0 -1
  390. package/types.js +0 -54
  391. package/types.js.map +0 -1
  392. package/use-fireproof/index.d.ts +0 -3
  393. package/use-fireproof/index.d.ts.map +0 -1
  394. package/use-fireproof/index.js +0 -3
  395. package/use-fireproof/index.js.map +0 -1
  396. package/utils.d.ts +0 -36
  397. package/utils.d.ts.map +0 -1
  398. package/utils.js +0 -379
  399. package/utils.js.map +0 -1
  400. package/version.d.ts +0 -2
  401. package/version.d.ts.map +0 -1
  402. package/version.js +0 -4
  403. package/version.js.map +0 -1
  404. package/write-queue.d.ts +0 -9
  405. package/write-queue.d.ts.map +0 -1
  406. package/write-queue.js +0 -70
  407. package/write-queue.js.map +0 -1
@@ -0,0 +1,254 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Fireproof Test</title>
7
+ <script src="index.global.js"></script>
8
+ <script src="partykit.global.js"></script>
9
+ <script type="text/javascript">
10
+ function todoApp() {
11
+ const actorTag = Math.random().toString(36).substring(2, 7);
12
+ const { fireproof, index } = Fireproof;
13
+ const { connect } = Connect;
14
+
15
+ // console.log('connect', connect)
16
+
17
+ let dbName;
18
+ let db;
19
+ let cx;
20
+
21
+ let dbUnsubscribe = false;
22
+
23
+ function setupDb(name, newDb, newConn) {
24
+ const input = document.querySelector("#todo");
25
+ input.disabled = true;
26
+
27
+ if (dbUnsubscribe) {
28
+ dbUnsubscribe();
29
+ }
30
+ if (newDb) {
31
+ // console.log('new db', newDb, newConn)
32
+ name = newDb.name;
33
+ dbName = newDb.name;
34
+ db = newDb;
35
+ cx = newConn;
36
+ const input = document.querySelector("#list");
37
+ input.value = dbName;
38
+ } else {
39
+ dbName = name;
40
+ db = fireproof(name, { autoCompact: 100, threshold: 50000 });
41
+ cx = connect(db);
42
+ cx.loaded.then(async () => {
43
+ const span = document.querySelector("#cxInfo");
44
+ console.log("cx", cx);
45
+ span.innerText = `📡 ${cx.url.toString()}`;
46
+ });
47
+ }
48
+
49
+ window.db = db;
50
+ window.cx = cx;
51
+
52
+ db.changes([], { limit: 1 }).then((changes) => {
53
+ if (changes.clock.length > 0) {
54
+ input.disabled = false;
55
+ } else {
56
+ cx.loaded.then(async () => {
57
+ input.disabled = false;
58
+ });
59
+ }
60
+ });
61
+
62
+ dbUnsubscribe = db.subscribe(redraw);
63
+ return db;
64
+ }
65
+
66
+ let doing;
67
+ const redraw = async () => {
68
+ if (doing) {
69
+ return doing;
70
+ }
71
+ doing = doRedraw().finally(() => (doing = null));
72
+ return doing;
73
+ };
74
+ window.redraw = redraw;
75
+
76
+ let compactor = "🚗";
77
+ function drawInfo() {
78
+ document.querySelector("#carLog").innerText = ` ⏰ ${db._crdt.clock.head.length} ${compactor} ${
79
+ cx.loader.carLog.length
80
+ } 📩 ${1}`;
81
+ }
82
+ const doRedraw = async () => {
83
+ drawInfo();
84
+ const result = await db.allDocs().catch((e) => {
85
+ console.error("allDocs error", e, ` ⏰ ${db._crdt.clock.head.length} ${compactor} ${cx.loader.carLog.length} 📩 ${1}`);
86
+ return { rows: [] };
87
+ });
88
+ drawInfo();
89
+ document.querySelector("ul").innerHTML = "";
90
+ for (const row of result.rows) {
91
+ // const doc = await db.get(row.id);
92
+ const doc = row.value;
93
+ const checkbox = document.createElement("input");
94
+ checkbox.setAttribute("type", "checkbox");
95
+ if (doc.completed) {
96
+ checkbox.setAttribute("checked", true);
97
+ }
98
+ checkbox.onchange = async (e) => {
99
+ e.target.indeterminate = true;
100
+ const clicks = doc.clicks || 0;
101
+ doc.clicks = clicks + 1;
102
+ doc.completed = !doc.completed;
103
+ await db.put(doc);
104
+ };
105
+ const textSpan = document.createElement("span");
106
+ textSpan.innerText = `${doc.actor}:${doc.clicks || 0} ${doc.task}`;
107
+ const li = document.createElement("li");
108
+ li.appendChild(checkbox);
109
+ li.appendChild(textSpan);
110
+ document.querySelector("ul").appendChild(li);
111
+ }
112
+ };
113
+
114
+ async function initialize() {
115
+ ps = new URLSearchParams(location.search);
116
+ const listQ = ps.get("list");
117
+ setupDb(listQ || "my-list");
118
+ const input = document.querySelector("#list");
119
+ input.value = dbName;
120
+ redraw();
121
+ }
122
+
123
+ async function openDashboard(e) {
124
+ db.openDashboard();
125
+ }
126
+ window.openDashboard = openDashboard;
127
+
128
+ async function changeList(e) {
129
+ e.preventDefault();
130
+ const input = document.querySelector("#list");
131
+ dbName = input.value;
132
+ history.pushState(null, "", location.pathname + "?list=" + encodeURIComponent(dbName));
133
+ setupDb(dbName);
134
+ redraw();
135
+ }
136
+ window.changeList = changeList;
137
+
138
+ async function createTodoClick(e) {
139
+ e.preventDefault();
140
+ const input = document.querySelector("#todo");
141
+ input.disabled = true;
142
+ const ok = await db.put({
143
+ actor: actorTag,
144
+ created: Date.now(),
145
+ task: input.value,
146
+ completed: false,
147
+ });
148
+ input.disabled = false;
149
+ input.value = "";
150
+ }
151
+ window.createTodoClick = createTodoClick;
152
+
153
+ let worker;
154
+ async function startWorker() {
155
+ const button = document.querySelector("#robot");
156
+ button.innerText = "🦾";
157
+ const dcs = await db.allDocs();
158
+ console.log("start worker", dcs.rows.length);
159
+ // worker = setInterval(async () => {
160
+ // dcs.rows.map((r) => db.put({ ...r.value, clicks: (r.value.clicks || 0) + 1, completed: Math.random() > 0.5 }))
161
+ // }, 5000)
162
+ goWorker(dcs);
163
+ }
164
+ const goWorker = (dcs) => {
165
+ const timeout =
166
+ 10 +
167
+ Math.pow(db._crdt.clock.head.length + cx.loader.taskManager.queue.length, 2) *
168
+ (Math.floor(Math.random() * 1000) + 1000);
169
+ // console.log('go worker', timeout/ 1000)
170
+ worker = setTimeout(async () => {
171
+ await Promise.all(
172
+ dcs.rows.slice(0, 5).map((r) => {
173
+ r.value.clicks = r.value.clicks || 0;
174
+ r.value.clicks += 1;
175
+ r.value.completed = Math.random() > 0.5;
176
+ db.put({ ...r.value });
177
+ }),
178
+ );
179
+ goWorker(await db.allDocs());
180
+ }, timeout);
181
+ };
182
+
183
+ const stopWorker = () => {
184
+ const button = document.querySelector("#robot");
185
+ button.innerText = "🤖";
186
+ console.log("stop worker");
187
+ clearTimeout(worker);
188
+ };
189
+ const toggleWorker = (e) => {
190
+ e.preventDefault();
191
+ if (worker) {
192
+ stopWorker();
193
+ } else {
194
+ startWorker(e);
195
+ }
196
+ };
197
+ window.toggleWorker = toggleWorker;
198
+
199
+ async function writeStorm(e) {
200
+ e.preventDefault();
201
+ compactor = "🐦‍🔥";
202
+ drawInfo();
203
+
204
+ const dcs = await db.allDocs();
205
+ const lastRow = dcs.rows[dcs.rows.length - 1];
206
+ const theDoc = lastRow.value;
207
+ for (let i = 0; i < 50; i++) {
208
+ theDoc.clicks = (theDoc.clicks || 0) + 1;
209
+ theDoc.completed = !theDoc.completed;
210
+ await db.put(theDoc);
211
+ }
212
+
213
+ drawInfo();
214
+ compactor = "🚗";
215
+ }
216
+ window.writeStorm = writeStorm;
217
+
218
+ async function doCompact(e) {
219
+ e.preventDefault();
220
+ compactor = "🚕";
221
+ drawInfo();
222
+ await db.compact();
223
+ drawInfo();
224
+ compactor = "🚗";
225
+ }
226
+ window.doCompact = doCompact;
227
+
228
+ window.onload = initialize;
229
+ window.db = db;
230
+ }
231
+
232
+ todoApp();
233
+ </script>
234
+ </head>
235
+
236
+ <body>
237
+ <h1><a href="https://use-fireproof.com/">Fireproof</a> Test App</h1>
238
+ Ledger:
239
+ <input title="Change list" type="text" name="list" id="list" />
240
+ <button onclick="changeList(event)">Switch</button>
241
+
242
+ <p>This version of the Fireprof test app uses PartyKit as the storage backend. Refresh is automatic and live.</p>
243
+
244
+ <button id="rocket" onclick="writeStorm(event)">🚀</button>
245
+ <button id="robot" onclick="toggleWorker(event)">🤖</button>
246
+ <span id="carLog" onclick="doCompact(event)"></span>
247
+ <span id="cxInfo"></span>
248
+
249
+ <h3>Todos</h3>
250
+ <input title="Create a todo" type="text" name="todo" id="todo" />
251
+ <button onclick="createTodoClick(event)">Create Todo</button>
252
+ <ul></ul>
253
+ </body>
254
+ </html>
@@ -1,18 +0,0 @@
1
- import { Logger } from "@adviser/cement";
2
- import { ClockHead, DocTypes, DocUpdate } from "./types.js";
3
- type ApplyHeadWorkerFunction = (newHead: ClockHead, prevHead: ClockHead, localUpdates: boolean) => Promise<void>;
4
- interface ApplyHeadTask<T extends DocTypes> {
5
- readonly newHead: ClockHead;
6
- readonly prevHead: ClockHead;
7
- readonly updates?: DocUpdate<T>[];
8
- }
9
- export interface ApplyHeadQueue<T extends DocTypes> {
10
- push(task: ApplyHeadTask<T>): AsyncGenerator<{
11
- readonly updates: DocUpdate<T>[];
12
- readonly all: boolean;
13
- }, void, unknown>;
14
- size(): number;
15
- }
16
- export declare function applyHeadQueue<T extends DocTypes>(worker: ApplyHeadWorkerFunction, logger: Logger): ApplyHeadQueue<T>;
17
- export {};
18
- //# sourceMappingURL=apply-head-queue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apply-head-queue.d.ts","sourceRoot":"","sources":["../../../src/apply-head-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5D,KAAK,uBAAuB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjH,UAAU,aAAa,CAAC,CAAC,SAAS,QAAQ;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,QAAQ;IAChD,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,CAC1C;QACE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;KACvB,EACD,IAAI,EACJ,OAAO,CACR,CAAC;IACF,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAgDrH"}
@@ -1,47 +0,0 @@
1
- export function applyHeadQueue(worker, logger) {
2
- const queue = [];
3
- let isProcessing = false;
4
- async function* process() {
5
- if (isProcessing || queue.length === 0)
6
- return;
7
- isProcessing = true;
8
- const allUpdates = [];
9
- try {
10
- while (queue.length > 0) {
11
- queue.sort((a, b) => (b.updates ? 1 : -1));
12
- const task = queue.shift();
13
- if (!task)
14
- continue;
15
- await worker(task.newHead, task.prevHead, task.updates !== undefined).catch((e) => {
16
- throw logger.Error().Err(e).Msg("int_applyHead worker error").AsError();
17
- });
18
- if (task.updates) {
19
- allUpdates.push(...task.updates);
20
- }
21
- if (!queue.some((t) => t.updates) || task.updates) {
22
- const allTasksHaveUpdates = queue.every((task) => task.updates !== null);
23
- yield { updates: allUpdates, all: allTasksHaveUpdates };
24
- allUpdates.length = 0;
25
- }
26
- }
27
- }
28
- finally {
29
- isProcessing = false;
30
- const generator = process();
31
- let result = await generator.next();
32
- while (!result.done) {
33
- result = await generator.next();
34
- }
35
- }
36
- }
37
- return {
38
- push(task) {
39
- queue.push(task);
40
- return process();
41
- },
42
- size() {
43
- return queue.length;
44
- },
45
- };
46
- }
47
- //# sourceMappingURL=apply-head-queue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apply-head-queue.js","sourceRoot":"","sources":["../../../src/apply-head-queue.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,cAAc,CAAqB,MAA+B,EAAE,MAAc;IAChG,MAAM,KAAK,GAAuB,EAAE,CAAC;IACrC,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,KAAK,SAAS,CAAC,CAAC,OAAO;QACrB,IAAI,YAAY,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC/C,YAAY,GAAG,IAAI,CAAC;QACpB,MAAM,UAAU,GAAmB,EAAE,CAAC;QACtC,IAAI,C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O,EAAE,CAAC;YAC5B,IAAI,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;YACpC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpB,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,IAAsB;YACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC;QACD,IAAI;YACF,OAAO,KAAK,CAAC,MAAM,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,17 +0,0 @@
1
- import { CoerceURI } from "@adviser/cement";
2
- import { Attached, Attachable, GatewayUrlsParam } from "../types.js";
3
- import { AttachedStores, Loadable, ActiveStore, DataAndMetaStore, LocalActiveStore } from "./types.js";
4
- export declare function createAttachedStores(urlOrGup: CoerceURI | GatewayUrlsParam, arOrLoadable: AttachedStores | Loadable, name?: string): Promise<Attached>;
5
- export declare class AttachedRemotesImpl implements AttachedStores {
6
- private readonly _remotes;
7
- readonly loadable: Loadable;
8
- _local?: Attached;
9
- constructor(loadable: Loadable);
10
- forRemotes(action: (store: ActiveStore) => Promise<unknown>): Promise<void>;
11
- remotes(): ActiveStore[];
12
- local(): LocalActiveStore;
13
- activate(store: DataAndMetaStore | CoerceURI): ActiveStore;
14
- detach(): Promise<void>;
15
- attach(attached: Attachable): Promise<Attached>;
16
- }
17
- //# sourceMappingURL=attachable-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachable-store.d.ts","sourceRoot":"","sources":["../../../../src/blockstore/attachable-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAsB,gBAAgB,EAAwC,MAAM,aAAa,CAAC;AAE/H,OAAO,EACL,cAAc,EACd,QAAQ,EAER,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAejB,MAAM,YAAY,CAAC;AA+MpB,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,SAAS,GAAG,gBAAgB,EACtC,YAAY,EAAE,cAAc,GAAG,QAAQ,EACvC,IAAI,SAAU,GACb,OAAO,CAAC,QAAQ,CAAC,CA0BnB;AAED,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAE5D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAK5B,MAAM,CAAC,EAAE,QAAQ,CAAC;gBAEN,QAAQ,EAAE,QAAQ;IAI9B,UAAU,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,OAAO,IAAI,WAAW,EAAE;IAQxB,KAAK,IAAI,gBAAgB;IAOzB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,WAAW;IAyBpD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvB,MAAM,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;CAkFtD"}
@@ -1,295 +0,0 @@
1
- import { KeyedResolvOnce, isCoerceURI, URI } from "@adviser/cement";
2
- import { DataAndMetaAndWalAndBaseStore, PARAM } from "../types.js";
3
- import { toStoreRuntime } from "./store-factory.js";
4
- import { MetaActiveStore, WALActiveStore, FileActiveStore, CarActiveStore, } from "./types.js";
5
- import { ensureURIDefaults, toSortedArray } from "../utils.js";
6
- class AttachedImpl {
7
- constructor(gws, stores, unreg) {
8
- this.gatewayUrls = gws;
9
- this.stores = new DataAndMetaAndWalAndBaseStore(stores);
10
- this.unreg = unreg;
11
- }
12
- async detach() {
13
- const toClose = [this.stores.car.close(), this.stores.file.close(), this.stores.meta.close()];
14
- if (this.stores.wal) {
15
- toClose.push(this.stores.wal.close());
16
- }
17
- await Promise.all(toClose);
18
- this.unreg();
19
- }
20
- status() {
21
- return "attached";
22
- }
23
- }
24
- class FileActiveStoreImpl extends FileActiveStore {
25
- constructor(ref, active, attached) {
26
- super();
27
- this.ref = ref;
28
- this.active = active;
29
- this.xattached = attached;
30
- }
31
- local() {
32
- return this.xattached.local();
33
- }
34
- remotes() {
35
- return this.xattached.remotes();
36
- }
37
- }
38
- class CarActiveStoreImpl extends CarActiveStore {
39
- constructor(ref, active, attached) {
40
- super();
41
- this.ref = ref;
42
- this.active = active;
43
- this.xattached = attached;
44
- }
45
- local() {
46
- return this.xattached.local();
47
- }
48
- remotes() {
49
- return [this.active, ...this.xattached.remotes().filter((i) => i !== this.active)];
50
- }
51
- }
52
- class CarAttachedStoresImpl {
53
- constructor(attached) {
54
- this.attached = attached;
55
- }
56
- local() {
57
- return this.attached.local().active.car;
58
- }
59
- remotes() {
60
- return this.attached.remotes().map(({ active }) => active.car);
61
- }
62
- }
63
- class FileAttachedStoresImpl {
64
- constructor(attached) {
65
- this.attached = attached;
66
- }
67
- local() {
68
- return this.attached.local().active.file;
69
- }
70
- remotes() {
71
- return this.attached.remotes().map(({ active }) => active.file);
72
- }
73
- }
74
- class MetaActiveStoreImpl extends MetaActiveStore {
75
- constructor(ref, active, attached) {
76
- super();
77
- this.ref = ref;
78
- this.active = active;
79
- this.xattached = attached;
80
- }
81
- local() {
82
- return this.xattached.local();
83
- }
84
- remotes() {
85
- return [this.active, ...this.xattached.remotes().filter((i) => i !== this.active)];
86
- }
87
- }
88
- class MetaAttachedStoresImpl {
89
- constructor(attached) {
90
- this.attached = attached;
91
- }
92
- local() {
93
- return this.attached.local().active.meta;
94
- }
95
- remotes() {
96
- return this.attached.remotes().map(({ active }) => active.meta);
97
- }
98
- }
99
- class WALActiveStoreImpl extends WALActiveStore {
100
- constructor(ref, active, attached) {
101
- super();
102
- this.ref = ref;
103
- this.active = active;
104
- this.xattached = attached;
105
- }
106
- local() {
107
- return this.xattached.local();
108
- }
109
- remotes() {
110
- return this.xattached.remotes();
111
- }
112
- }
113
- class WALAttachedStoresImpl {
114
- constructor(attached) {
115
- this.attached = attached;
116
- }
117
- local() {
118
- return this.attached.local().active.wal;
119
- }
120
- remotes() {
121
- return (this.attached
122
- .remotes()
123
- .filter(({ active }) => active.wal)
124
- .map(({ active }) => active.wal));
125
- }
126
- }
127
- class ActiveStoreImpl {
128
- constructor(active, attached) {
129
- this.active = active;
130
- this.xattached = attached;
131
- }
132
- local() {
133
- return this.xattached.local();
134
- }
135
- remotes() {
136
- return this.xattached.remotes();
137
- }
138
- baseStores() {
139
- const bs = [this.active.car, this.active.file, this.active.meta];
140
- if (this.active.wal) {
141
- bs.push(this.active.wal);
142
- }
143
- return bs;
144
- }
145
- carStore() {
146
- return new CarActiveStoreImpl(this, this.active.car, new CarAttachedStoresImpl(this.xattached));
147
- }
148
- fileStore() {
149
- return new FileActiveStoreImpl(this, this.active.file, new FileAttachedStoresImpl(this.xattached));
150
- }
151
- metaStore() {
152
- return new MetaActiveStoreImpl(this, this.active.meta, new MetaAttachedStoresImpl(this.xattached));
153
- }
154
- walStore() {
155
- if (!this.active.wal) {
156
- throw this.xattached.loadable.sthis.logger.Error().Msg("wal store not set").AsError();
157
- }
158
- return new WALActiveStoreImpl(this, this.active.wal, new WALAttachedStoresImpl(this.xattached));
159
- }
160
- }
161
- function isLoadable(unknown) {
162
- return !!unknown.sthis && !!unknown.attachedStores;
163
- }
164
- export async function createAttachedStores(urlOrGup, arOrLoadable, name = "local") {
165
- let ar;
166
- if (!isLoadable(arOrLoadable)) {
167
- ar = arOrLoadable;
168
- }
169
- else {
170
- ar = arOrLoadable.attachedStores;
171
- }
172
- let gup;
173
- if (!urlOrGup) {
174
- throw new Error("urlOrGup is required");
175
- }
176
- if (isCoerceURI(urlOrGup)) {
177
- const url = urlOrGup;
178
- gup = {
179
- car: { url },
180
- file: { url },
181
- meta: { url },
182
- wal: { url },
183
- };
184
- }
185
- else {
186
- gup = urlOrGup;
187
- }
188
- return await ar.attach({
189
- name,
190
- prepare: async () => gup,
191
- });
192
- }
193
- export class AttachedRemotesImpl {
194
- constructor(loadable) {
195
- this._remotes = new KeyedResolvOnce();
196
- this.loadable = loadable;
197
- }
198
- forRemotes(action) {
199
- return Promise.all(this.remotes().map((i) => action(i))).then(() => undefined);
200
- }
201
- remotes() {
202
- return this._remotes
203
- .values()
204
- .filter(({ value }) => value.isOk() && !value.Ok().stores.wal)
205
- .map(({ value }) => value.Ok().stores)
206
- .map((i) => this.activate(i));
207
- }
208
- local() {
209
- if (!this._local) {
210
- throw this.loadable.sthis.logger.Error().Msg("local store not set").AsError();
211
- }
212
- return new ActiveStoreImpl(this._local.stores, this);
213
- }
214
- activate(store) {
215
- if (isCoerceURI(store)) {
216
- const activateUrl = URI.from(store);
217
- let maxScore = 0;
218
- let maxStore;
219
- for (const { value } of this._remotes.values()) {
220
- if (value.isErr()) {
221
- continue;
222
- }
223
- for (const url of value.Ok().stores.baseStores.map((i) => i.url())) {
224
- const mr = url.match(activateUrl);
225
- if (mr.score > maxScore) {
226
- maxScore = mr.score;
227
- maxStore = value.Ok().stores;
228
- }
229
- }
230
- }
231
- if (!maxStore) {
232
- throw this.loadable.sthis.logger.Error().Url(activateUrl).Msg("no store found").AsError();
233
- }
234
- store = maxStore;
235
- }
236
- return new ActiveStoreImpl(store, this);
237
- }
238
- async detach() {
239
- await Promise.all(this._remotes.values().map(async ({ value: rvalue }) => {
240
- if (rvalue.isOk()) {
241
- await rvalue.Ok().detach();
242
- }
243
- }));
244
- }
245
- async attach(attached) {
246
- const gwp = await attached.prepare();
247
- const gws = {
248
- car: {
249
- ...gwp.car,
250
- url: ensureURIDefaults(this.loadable.sthis, { name: attached.name, local: this._local?.gatewayUrls.car.url.getParam(PARAM.NAME) }, undefined, URI.from(gwp.car.url), "car"),
251
- },
252
- file: {
253
- ...gwp.file,
254
- url: ensureURIDefaults(this.loadable.sthis, { name: attached.name, local: this._local?.gatewayUrls.file.url.getParam(PARAM.NAME) }, undefined, URI.from(gwp.file.url), "file", { file: true }),
255
- },
256
- meta: {
257
- ...gwp.meta,
258
- url: ensureURIDefaults(this.loadable.sthis, { name: attached.name, local: this._local?.gatewayUrls.meta.url.getParam(PARAM.NAME) }, undefined, URI.from(gwp.meta.url), "meta"),
259
- },
260
- wal: gwp.wal
261
- ? {
262
- ...gwp.wal,
263
- url: ensureURIDefaults(this.loadable.sthis, { name: attached.name, local: this._local?.gatewayUrls.wal?.url.getParam(PARAM.NAME) }, undefined, URI.from(gwp.wal.url), "wal"),
264
- }
265
- : undefined,
266
- };
267
- const key = JSON.stringify(toSortedArray({
268
- carUrl: gws.car.url.toString(),
269
- filesUrl: gws.file.url.toString(),
270
- metaUrl: gws.meta.url.toString(),
271
- walUrl: gws.wal?.url.toString(),
272
- }));
273
- return this._remotes.get(key).once(async () => {
274
- const rt = toStoreRuntime(this.loadable.sthis);
275
- const result = new AttachedImpl(gws, await rt.makeStores({
276
- byStore: gws,
277
- loader: this.loadable,
278
- }), () => {
279
- this._remotes.unget(key);
280
- });
281
- if (result.stores.wal) {
282
- if (this._local) {
283
- throw this.loadable.sthis.logger
284
- .Error()
285
- .Any({ urls: result.gatewayUrls })
286
- .Msg("local store could only set once")
287
- .AsError();
288
- }
289
- this._local = result;
290
- }
291
- return result;
292
- });
293
- }
294
- }
295
- //# sourceMappingURL=attachable-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachable-store.js","sourceRoot":"","sources":["../../../../src/blockstore/attachable-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,WAAW,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAA8D,6BAA6B,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/H,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EASL,eAAe,EACf,cAAc,EAKd,eAAe,EACf,cAAc,GAKf,MAAM,YAAY,CAAC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,GAAG,CAAC,QAAQ,EAAE;YAC9B,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YAChC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;SAChC,CAAC,CACH,CAAC;QAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC5C,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,IAAI,YAAY,CAC7B,GAAG,EACH,MAAM,EAAE,CAAC,UAAU,CAAC;gBAClB,OAAO,EAAE,GAAG;gBACZ,MAAM,EAAE,IAAI,CAAC,QAAQ;aACtB,CAAC,EACF,GAAG,EAAE;gBACH,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC,CACF,CAAC;YACF,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;gBACtB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;oBAChB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM;yBAC7B,KAAK,EAAE;yBACP,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;yBACjC,GAAG,CAAC,iCAAiC,CAAC;yBACtC,OAAO,EAAE,CAAC;gBACf,CAAC;gBACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACvB,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { Future } from "@adviser/cement";
2
- type QueueFunction<T = void> = () => Promise<T>;
3
- export declare class CommitQueue<T = void> {
4
- readonly queue: QueueFunction<void>[];
5
- processing: boolean;
6
- readonly _waitIdleItems: Set<Future<void>>;
7
- waitIdle(): Promise<void>;
8
- enqueue(fn: QueueFunction<T>): Promise<T>;
9
- processNext(): void;
10
- }
11
- export {};
12
- //# sourceMappingURL=commit-queue.d.ts.map