@agentshouse/mdruntime 0.1.0-c8f07dbee1c62 → 0.1.0-c8f16d1da438a

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 (307) hide show
  1. package/README.md +21 -19
  2. package/dist/acceptance.d.ts +0 -3
  3. package/dist/acceptance.d.ts.map +1 -1
  4. package/dist/acceptance.js +75 -165
  5. package/dist/act-lanes.d.ts +30 -0
  6. package/dist/act-lanes.d.ts.map +1 -0
  7. package/dist/act-lanes.js +225 -0
  8. package/dist/actions.d.ts +8 -2
  9. package/dist/actions.d.ts.map +1 -1
  10. package/dist/actions.js +171 -75
  11. package/dist/adapter.d.ts +147 -67
  12. package/dist/adapter.d.ts.map +1 -1
  13. package/dist/attached-model.d.ts +0 -1
  14. package/dist/attached-model.d.ts.map +1 -1
  15. package/dist/attached-model.js +2 -7
  16. package/dist/authored.d.ts +88 -0
  17. package/dist/authored.d.ts.map +1 -0
  18. package/dist/authored.js +347 -0
  19. package/dist/binary.d.ts +6 -2
  20. package/dist/binary.d.ts.map +1 -1
  21. package/dist/binary.js +10 -3
  22. package/dist/bootstrap.d.ts +1 -1
  23. package/dist/bootstrap.d.ts.map +1 -1
  24. package/dist/bootstrap.js +6 -18
  25. package/dist/chain.d.ts +1 -1
  26. package/dist/chain.d.ts.map +1 -1
  27. package/dist/chain.js +5 -2
  28. package/dist/change-set.d.ts +4 -0
  29. package/dist/change-set.d.ts.map +1 -1
  30. package/dist/change-set.js +6 -0
  31. package/dist/change.d.ts +6 -2
  32. package/dist/change.d.ts.map +1 -1
  33. package/dist/change.js +7 -2
  34. package/dist/chat-types.d.ts +0 -2
  35. package/dist/chat-types.d.ts.map +1 -1
  36. package/dist/chat-types.js +2 -4
  37. package/dist/client.d.ts +23 -22
  38. package/dist/client.d.ts.map +1 -1
  39. package/dist/client.js +55 -68
  40. package/dist/collection.d.ts +27 -4
  41. package/dist/collection.d.ts.map +1 -1
  42. package/dist/collection.js +34 -10
  43. package/dist/column.d.ts +5 -0
  44. package/dist/column.d.ts.map +1 -0
  45. package/dist/column.js +9 -0
  46. package/dist/compile.d.ts +4 -1
  47. package/dist/compile.d.ts.map +1 -1
  48. package/dist/compile.js +100 -62
  49. package/dist/connection.d.ts +1 -1
  50. package/dist/connection.d.ts.map +1 -1
  51. package/dist/connection.js +41 -27
  52. package/dist/context.d.ts.map +1 -1
  53. package/dist/context.js +1 -1
  54. package/dist/conversation-live.d.ts +149 -0
  55. package/dist/conversation-live.d.ts.map +1 -0
  56. package/dist/conversation-live.js +259 -0
  57. package/dist/conversation-row.d.ts +8 -1
  58. package/dist/conversation-row.d.ts.map +1 -1
  59. package/dist/conversation-row.js +20 -7
  60. package/dist/conversation.d.ts +64 -49
  61. package/dist/conversation.d.ts.map +1 -1
  62. package/dist/conversation.js +987 -1035
  63. package/dist/declaration.d.ts +10 -0
  64. package/dist/declaration.d.ts.map +1 -0
  65. package/dist/declaration.js +24 -0
  66. package/dist/discovery.d.ts +3 -1
  67. package/dist/discovery.d.ts.map +1 -1
  68. package/dist/discovery.js +47 -47
  69. package/dist/download.d.ts +6 -0
  70. package/dist/download.d.ts.map +1 -0
  71. package/dist/download.js +42 -0
  72. package/dist/durability.d.ts +5 -0
  73. package/dist/durability.d.ts.map +1 -1
  74. package/dist/durability.js +7 -0
  75. package/dist/entry.d.ts +16 -1
  76. package/dist/entry.d.ts.map +1 -1
  77. package/dist/entry.js +75 -30
  78. package/dist/expectation.d.ts +26 -13
  79. package/dist/expectation.d.ts.map +1 -1
  80. package/dist/expectation.js +72 -19
  81. package/dist/failure.d.ts +3 -0
  82. package/dist/failure.d.ts.map +1 -1
  83. package/dist/failure.js +8 -0
  84. package/dist/figures.d.ts +1 -0
  85. package/dist/figures.d.ts.map +1 -1
  86. package/dist/figures.js +6 -4
  87. package/dist/file.d.ts +1 -1
  88. package/dist/file.d.ts.map +1 -1
  89. package/dist/file.js +3 -2
  90. package/dist/host.d.ts +24 -4
  91. package/dist/host.d.ts.map +1 -1
  92. package/dist/host.js +108 -32
  93. package/dist/house-query.d.ts +24 -0
  94. package/dist/house-query.d.ts.map +1 -0
  95. package/dist/house-query.js +82 -0
  96. package/dist/index.d.ts +24 -13
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +17 -7
  99. package/dist/install.d.ts +10 -6
  100. package/dist/install.d.ts.map +1 -1
  101. package/dist/install.js +93 -116
  102. package/dist/lifecycle.d.ts +2 -2
  103. package/dist/lifecycle.d.ts.map +1 -1
  104. package/dist/lifecycle.js +79 -56
  105. package/dist/listing.d.ts +29 -22
  106. package/dist/listing.d.ts.map +1 -1
  107. package/dist/listing.js +71 -78
  108. package/dist/live.d.ts +19 -3
  109. package/dist/live.d.ts.map +1 -1
  110. package/dist/live.js +97 -39
  111. package/dist/loaded.d.ts +7 -0
  112. package/dist/loaded.d.ts.map +1 -0
  113. package/dist/loaded.js +46 -0
  114. package/dist/locks.d.ts +2 -4
  115. package/dist/locks.d.ts.map +1 -1
  116. package/dist/locks.js +12 -39
  117. package/dist/lost.d.ts.map +1 -1
  118. package/dist/lost.js +11 -23
  119. package/dist/media.d.ts +20 -4
  120. package/dist/media.d.ts.map +1 -1
  121. package/dist/media.js +170 -36
  122. package/dist/memory.d.ts +10 -4
  123. package/dist/memory.d.ts.map +1 -1
  124. package/dist/memory.js +99 -37
  125. package/dist/messages.d.ts +17 -6
  126. package/dist/messages.d.ts.map +1 -1
  127. package/dist/messages.js +39 -38
  128. package/dist/modal.d.ts +2 -0
  129. package/dist/modal.d.ts.map +1 -0
  130. package/dist/modal.js +11 -0
  131. package/dist/model.d.ts +4 -3
  132. package/dist/model.d.ts.map +1 -1
  133. package/dist/model.js +6 -5
  134. package/dist/models.d.ts +4 -8
  135. package/dist/models.d.ts.map +1 -1
  136. package/dist/models.js +97 -137
  137. package/dist/name.d.ts +0 -1
  138. package/dist/name.d.ts.map +1 -1
  139. package/dist/name.js +3 -7
  140. package/dist/observation.d.ts +29 -12
  141. package/dist/observation.d.ts.map +1 -1
  142. package/dist/observation.js +217 -85
  143. package/dist/online.d.ts +7 -0
  144. package/dist/online.d.ts.map +1 -0
  145. package/dist/online.js +29 -0
  146. package/dist/opened.d.ts +1 -1
  147. package/dist/opened.d.ts.map +1 -1
  148. package/dist/opened.js +5 -5
  149. package/dist/opening.d.ts.map +1 -1
  150. package/dist/opening.js +24 -11
  151. package/dist/outcome.d.ts +24 -4
  152. package/dist/outcome.d.ts.map +1 -1
  153. package/dist/outcome.js +33 -3
  154. package/dist/overlay.d.ts +9 -5
  155. package/dist/overlay.d.ts.map +1 -1
  156. package/dist/overlay.js +37 -24
  157. package/dist/page-metadata.d.ts +8 -0
  158. package/dist/page-metadata.d.ts.map +1 -0
  159. package/dist/page-metadata.js +19 -0
  160. package/dist/parts.d.ts +5 -58
  161. package/dist/parts.d.ts.map +1 -1
  162. package/dist/parts.js +28 -110
  163. package/dist/paths.d.ts +1 -0
  164. package/dist/paths.d.ts.map +1 -1
  165. package/dist/paths.js +22 -0
  166. package/dist/preparation.d.ts +33 -7
  167. package/dist/preparation.d.ts.map +1 -1
  168. package/dist/preparation.js +210 -92
  169. package/dist/presence.d.ts +58 -0
  170. package/dist/presence.d.ts.map +1 -0
  171. package/dist/presence.js +231 -0
  172. package/dist/queries.d.ts +2 -2
  173. package/dist/queries.d.ts.map +1 -1
  174. package/dist/queries.js +137 -79
  175. package/dist/query.d.ts +2 -3
  176. package/dist/query.d.ts.map +1 -1
  177. package/dist/questions.d.ts +1 -5
  178. package/dist/questions.d.ts.map +1 -1
  179. package/dist/questions.js +3 -8
  180. package/dist/queue.d.ts +40 -0
  181. package/dist/queue.d.ts.map +1 -0
  182. package/dist/queue.js +480 -0
  183. package/dist/reach.d.ts +15 -6
  184. package/dist/reach.d.ts.map +1 -1
  185. package/dist/reach.js +184 -40
  186. package/dist/react.d.ts +11 -1
  187. package/dist/react.d.ts.map +1 -1
  188. package/dist/react.js +33 -1
  189. package/dist/readiness.d.ts +20 -5
  190. package/dist/readiness.d.ts.map +1 -1
  191. package/dist/readiness.js +17 -10
  192. package/dist/reads.d.ts +5 -2
  193. package/dist/reads.d.ts.map +1 -1
  194. package/dist/reads.js +33 -5
  195. package/dist/recovery.d.ts +4 -1
  196. package/dist/recovery.d.ts.map +1 -1
  197. package/dist/recovery.js +31 -8
  198. package/dist/reference-forms.d.ts +4 -0
  199. package/dist/reference-forms.d.ts.map +1 -0
  200. package/dist/reference-forms.js +74 -0
  201. package/dist/refresh.d.ts +1 -1
  202. package/dist/refresh.js +6 -6
  203. package/dist/refusal.d.ts.map +1 -1
  204. package/dist/refusal.js +5 -6
  205. package/dist/replica.d.ts +5 -10
  206. package/dist/replica.d.ts.map +1 -1
  207. package/dist/replica.js +17 -19
  208. package/dist/retried.d.ts +30 -0
  209. package/dist/retried.d.ts.map +1 -0
  210. package/dist/retried.js +72 -0
  211. package/dist/room-draft.d.ts +31 -8
  212. package/dist/room-draft.d.ts.map +1 -1
  213. package/dist/room-draft.js +278 -68
  214. package/dist/room-drafts.d.ts.map +1 -1
  215. package/dist/room-drafts.js +28 -22
  216. package/dist/room-list.d.ts +10 -0
  217. package/dist/room-list.d.ts.map +1 -0
  218. package/dist/room-list.js +45 -0
  219. package/dist/rows.d.ts +11 -2
  220. package/dist/rows.d.ts.map +1 -1
  221. package/dist/rows.js +27 -14
  222. package/dist/running.d.ts +5 -0
  223. package/dist/running.d.ts.map +1 -0
  224. package/dist/running.js +10 -0
  225. package/dist/runtime.d.ts +15 -20
  226. package/dist/runtime.d.ts.map +1 -1
  227. package/dist/save.d.ts +43 -86
  228. package/dist/save.d.ts.map +1 -1
  229. package/dist/save.js +324 -223
  230. package/dist/saves.d.ts +6 -42
  231. package/dist/saves.d.ts.map +1 -1
  232. package/dist/saves.js +177 -718
  233. package/dist/seed.d.ts.map +1 -1
  234. package/dist/seed.js +4 -5
  235. package/dist/shared.d.ts +0 -5
  236. package/dist/shared.d.ts.map +1 -1
  237. package/dist/shared.js +4 -90
  238. package/dist/shown.d.ts +9 -5
  239. package/dist/shown.d.ts.map +1 -1
  240. package/dist/shown.js +99 -67
  241. package/dist/socket/lanes.d.ts +12 -4
  242. package/dist/socket/lanes.d.ts.map +1 -1
  243. package/dist/socket/lanes.js +34 -8
  244. package/dist/socket/session.d.ts +4 -2
  245. package/dist/socket/session.d.ts.map +1 -1
  246. package/dist/socket/session.js +3 -0
  247. package/dist/socket.d.ts +4 -6
  248. package/dist/socket.d.ts.map +1 -1
  249. package/dist/socket.js +6 -16
  250. package/dist/source.d.ts +7 -7
  251. package/dist/source.d.ts.map +1 -1
  252. package/dist/source.js +20 -6
  253. package/dist/store/installs.d.ts +2 -2
  254. package/dist/store/installs.d.ts.map +1 -1
  255. package/dist/store/installs.js +10 -4
  256. package/dist/store/readiness.d.ts +5 -4
  257. package/dist/store/readiness.d.ts.map +1 -1
  258. package/dist/store/readiness.js +28 -12
  259. package/dist/store/records.d.ts +26 -9
  260. package/dist/store/records.d.ts.map +1 -1
  261. package/dist/store/records.js +92 -26
  262. package/dist/store/rooms-shown.d.ts +8 -0
  263. package/dist/store/rooms-shown.d.ts.map +1 -0
  264. package/dist/store/rooms-shown.js +13 -0
  265. package/dist/store/space.d.ts +1 -1
  266. package/dist/store/space.d.ts.map +1 -1
  267. package/dist/store/space.js +0 -2
  268. package/dist/store/watchers.js +1 -2
  269. package/dist/store.d.ts +26 -16
  270. package/dist/store.d.ts.map +1 -1
  271. package/dist/store.js +50 -18
  272. package/dist/stored.d.ts +40 -15
  273. package/dist/stored.d.ts.map +1 -1
  274. package/dist/stored.js +236 -66
  275. package/dist/surface.d.ts +15 -9
  276. package/dist/surface.d.ts.map +1 -1
  277. package/dist/surface.js +71 -38
  278. package/dist/sync.d.ts +4 -3
  279. package/dist/sync.d.ts.map +1 -1
  280. package/dist/sync.js +136 -110
  281. package/dist/tables.d.ts +31 -58
  282. package/dist/tables.d.ts.map +1 -1
  283. package/dist/tables.js +100 -334
  284. package/dist/tallies.d.ts.map +1 -1
  285. package/dist/tallies.js +6 -7
  286. package/dist/validation.d.ts +2 -0
  287. package/dist/validation.d.ts.map +1 -1
  288. package/dist/validation.js +51 -11
  289. package/dist/wire.d.ts +71 -12
  290. package/dist/wire.d.ts.map +1 -1
  291. package/dist/wire.js +30 -14
  292. package/package.json +4 -3
  293. package/dist/attempt.d.ts +0 -16
  294. package/dist/attempt.d.ts.map +0 -1
  295. package/dist/attempt.js +0 -70
  296. package/dist/job.d.ts +0 -33
  297. package/dist/job.d.ts.map +0 -1
  298. package/dist/job.js +0 -54
  299. package/dist/log.d.ts +0 -6
  300. package/dist/log.d.ts.map +0 -1
  301. package/dist/log.js +0 -14
  302. package/dist/socket/rooms.d.ts +0 -43
  303. package/dist/socket/rooms.d.ts.map +0 -1
  304. package/dist/socket/rooms.js +0 -90
  305. package/dist/store/fences.d.ts +0 -16
  306. package/dist/store/fences.d.ts.map +0 -1
  307. package/dist/store/fences.js +0 -26
@@ -1,6 +1,23 @@
1
1
  import { composedOf } from '../collection.js';
2
2
  import { binaryLocalId } from '../identity.js';
3
+ import { lockingMode } from '../presence.js';
4
+ import { readsRuntime } from '../tables.js';
3
5
  const FILE = '\u0000file';
6
+ const UNSTATED = {
7
+ lastCompleted: null,
8
+ providerLimits: [],
9
+ capabilities: [],
10
+ member: null,
11
+ timeZone: null,
12
+ targets: {},
13
+ conversationList: null,
14
+ agentList: null,
15
+ conversationCursor: null,
16
+ chatPins: [],
17
+ readUntil: null,
18
+ roomList: null,
19
+ queriesOnly: [],
20
+ };
4
21
  function batchFacts(batch) {
5
22
  return { paths: batch.changes.map(({ path }) => path), moving: batch.between !== undefined };
6
23
  }
@@ -94,7 +111,37 @@ function roomOf(row) {
94
111
  function json(value, fallback) {
95
112
  return value === undefined ? fallback : JSON.parse(value);
96
113
  }
97
- export function openRuntimeStore(authored) {
114
+ function coverOf(kept, answer) {
115
+ const { log, whole, rooms, removed, queues } = answer;
116
+ const queued = new Map(queues.map(({ locator, ids }) => [locator, ids]));
117
+ const fresh = whole || kept === null || kept.log.token !== log.token;
118
+ if (!fresh && log.at < kept.log.at)
119
+ return kept;
120
+ const held = fresh ? { rooms: new Map(), locking: new Set() } : kept;
121
+ for (const locator of removed) {
122
+ held.rooms.delete(locator);
123
+ held.locking.delete(locator);
124
+ }
125
+ for (const { locator, ...room } of rooms) {
126
+ held.rooms.set(locator, room);
127
+ if (lockingMode(room.offline))
128
+ held.locking.add(locator);
129
+ else
130
+ held.locking.delete(locator);
131
+ }
132
+ return { log, rooms: held.rooms, locking: held.locking, queues: queued };
133
+ }
134
+ export function openRuntimeStore(database) {
135
+ let written = 0;
136
+ let covered = null;
137
+ let kept = null;
138
+ const authored = {
139
+ ask(request) {
140
+ if (!readsRuntime(request))
141
+ written += 1;
142
+ return database.ask(request);
143
+ },
144
+ };
98
145
  const keys = new WeakMap();
99
146
  const read = async (key, type) => {
100
147
  const blob = await authored.ask({ kind: 'authored.file', key, type });
@@ -131,12 +178,24 @@ export function openRuntimeStore(authored) {
131
178
  })),
132
179
  };
133
180
  },
134
- async covering() {
135
- const { rooms, queues } = await authored.ask({ kind: 'replica.covering' });
136
- return {
137
- rooms: new Map(rooms.map(({ locator, ...room }) => [locator, room])),
138
- queues: new Map(queues.map(({ locator, ids }) => [locator, ids])),
181
+ covering() {
182
+ if (covered?.at === written)
183
+ return covered.cover;
184
+ const held = {
185
+ at: written,
186
+ cover: authored
187
+ .ask({ kind: 'replica.covering', since: kept?.log ?? null })
188
+ .then((answer) => {
189
+ kept = coverOf(kept, answer);
190
+ return kept;
191
+ }),
139
192
  };
193
+ covered = held;
194
+ held.cover.catch(() => {
195
+ if (covered === held)
196
+ covered = null;
197
+ });
198
+ return held.cover;
140
199
  },
141
200
  offline(locator) {
142
201
  return authored.ask({ kind: 'replica.offline', locator });
@@ -182,18 +241,13 @@ export function openRuntimeStore(authored) {
182
241
  const { state, room } = await authored.ask({ kind: 'authored.pending', locator, id });
183
242
  return { state: state === null ? undefined : JSON.parse(state), room };
184
243
  },
185
- async facts() {
186
- const held = await authored.ask({ kind: 'replica.facts' });
187
- return {
188
- lastCompleted: json(held.lastCompleted, null),
189
- providerLimits: json(held.providerLimits, []),
190
- capabilities: json(held.capabilities, []),
191
- member: json(held.member, null),
192
- targets: json(held.targets, {}),
193
- conversationList: json(held.conversationList, null),
194
- conversationCursor: json(held.conversationCursor, null),
195
- };
196
- },
244
+ facts: (async (names) => {
245
+ const held = await authored.ask({ kind: 'replica.facts', names: names ?? null });
246
+ return Object.fromEntries((names ?? Object.keys(UNSTATED)).map((name) => [
247
+ name,
248
+ json(held[name], UNSTATED[name]),
249
+ ]));
250
+ }),
197
251
  async presentation(app) {
198
252
  const held = await authored.ask({ kind: 'replica.presentation', app });
199
253
  return held === null ? undefined : JSON.parse(held);
@@ -201,8 +255,11 @@ export function openRuntimeStore(authored) {
201
255
  async demote() {
202
256
  await authored.ask({ kind: 'replica.demote' });
203
257
  },
204
- query(plan, rooms, budget) {
205
- return authored.ask({ kind: 'replica.query', plan, rooms, budget });
258
+ query(plan, rooms, follows, budget) {
259
+ return authored.ask({ kind: 'replica.query', plan, rooms, follows, budget });
260
+ },
261
+ named(plan, rooms, handles) {
262
+ return authored.ask({ kind: 'replica.named', plan, rooms, handles });
206
263
  },
207
264
  changes(keys) {
208
265
  return keys.reduce((total, key) => total + (changed.get(key) ?? 0), 0);
@@ -216,8 +273,11 @@ export function openRuntimeStore(authored) {
216
273
  referrers(key, view, targets) {
217
274
  return authored.ask({ kind: 'replica.referrers', key, view, targets });
218
275
  },
219
- folders(key, view, paths) {
220
- return authored.ask({ kind: 'replica.folders', key, view, paths });
276
+ holders(key, view, sought) {
277
+ return authored.ask({ kind: 'replica.holders', key, view, sought });
278
+ },
279
+ folders(key, paths) {
280
+ return authored.ask({ kind: 'replica.folders', key, paths });
221
281
  },
222
282
  typedWithin(key, view, roots, within) {
223
283
  return authored.ask({ kind: 'replica.typedWithin', key, view, roots, within });
@@ -337,11 +397,17 @@ export function openRuntimeStore(authored) {
337
397
  conversationRows(conversations) {
338
398
  return authored.ask({ kind: 'conversation.rows', conversations });
339
399
  },
340
- jobMarkers(conversation) {
341
- return authored.ask({ kind: 'conversation.jobs', conversation });
400
+ conversationFacts() {
401
+ return authored.ask({ kind: 'conversation.facts' });
402
+ },
403
+ async keepConversationFact(fact) {
404
+ await authored.ask({ kind: 'conversation.fact', ...fact });
405
+ },
406
+ storedConversations() {
407
+ return authored.ask({ kind: 'conversation.stored' });
342
408
  },
343
- async dropConversations(conversations) {
344
- await authored.ask({ kind: 'conversation.drop', conversations });
409
+ dropConversations(conversations) {
410
+ return authored.ask({ kind: 'conversation.drop', conversations });
345
411
  },
346
412
  async chatDrafts() {
347
413
  const records = await authored.ask({ kind: 'authored.chatDrafts' });
@@ -0,0 +1,8 @@
1
+ import type { ListedEntry, Listing } from '../listing.js';
2
+ export type RoomsShown = {
3
+ now(): Listing | null;
4
+ show(listing: Listing | null): void;
5
+ patch(entries: readonly ListedEntry[]): void;
6
+ };
7
+ export declare function createRoomsShown(): RoomsShown;
8
+ //# sourceMappingURL=rooms-shown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms-shown.d.ts","sourceRoot":"","sources":["../../src/store/rooms-shown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,IAAI,OAAO,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,UAAU,CAW7C"}
@@ -0,0 +1,13 @@
1
+ export function createRoomsShown() {
2
+ let shown = null;
3
+ return {
4
+ now: () => shown,
5
+ show(listing) {
6
+ shown = listing === null ? null : new Map(listing);
7
+ },
8
+ patch(entries) {
9
+ for (const entry of entries)
10
+ shown?.set(entry.locator, entry);
11
+ },
12
+ };
13
+ }
@@ -4,7 +4,7 @@ export type Space = {
4
4
  fill(): boolean;
5
5
  probing(): boolean;
6
6
  probeEachMinute(): void;
7
- probe(): Promise<boolean>;
7
+ probe(): Promise<void>;
8
8
  stop(): void;
9
9
  };
10
10
  export declare function createSpace(database: RuntimeDatabase, freed: () => void): Space;
@@ -1 +1 @@
1
- {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/store/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,IAAI,OAAO,CAAC;IAChB,IAAI,IAAI,OAAO,CAAC;IAChB,OAAO,IAAI,OAAO,CAAC;IACnB,eAAe,IAAI,IAAI,CAAC;IACxB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,IAAI,IAAI,IAAI,CAAC;CACd,CAAC;AAEF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,KAAK,CA4C/E"}
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/store/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,IAAI,OAAO,CAAC;IAChB,IAAI,IAAI,OAAO,CAAC;IAChB,OAAO,IAAI,OAAO,CAAC;IACnB,eAAe,IAAI,IAAI,CAAC;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,IAAI,CAAC;CACd,CAAC;AAEF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,KAAK,CA0C/E"}
@@ -12,10 +12,8 @@ export function createSpace(database, freed) {
12
12
  probing = null;
13
13
  freed();
14
14
  }
15
- return true;
16
15
  }, () => {
17
16
  testing = null;
18
- return false;
19
17
  });
20
18
  return testing;
21
19
  }
@@ -17,8 +17,7 @@ export function createWatchers(unpublished) {
17
17
  const owing = { value: add(undefined), shown: Promise.resolve() };
18
18
  owed.set(topic, owing);
19
19
  owing.shown = publication(async () => {
20
- if (owed.get(topic) === owing)
21
- owed.delete(topic);
20
+ owed.delete(topic);
22
21
  await work(owing.value);
23
22
  });
24
23
  return owing.shown;
package/dist/store.d.ts CHANGED
@@ -4,26 +4,26 @@ import { type Cell } from './cell.js';
4
4
  import type { ChangeBatch } from './change.js';
5
5
  import type { ChangeSet } from './change-set.js';
6
6
  import type { Composition } from './collection.js';
7
- import type { ReadinessWatch } from './preparation.js';
7
+ import type { ReadinessShowing, ReadinessWatch } from './preparation.js';
8
8
  import type { Persistence } from './readiness.js';
9
- import type { Listing } from './listing.js';
9
+ import type { Retries } from './retried.js';
10
10
  import type { Seeded } from './seed.js';
11
11
  import type { ModelState } from './model.js';
12
12
  import { type OpenedFiles } from './opened.js';
13
13
  import { type HeldReplica, type ReplicaRecord } from './replica.js';
14
- import type { RoomDraftRecord } from './room-draft.js';
14
+ import type { ReturnReason, RoomDraftRecord } from './room-draft.js';
15
15
  import { type SyncStatus } from './status.js';
16
16
  import type { RuntimeDatabase } from './tables.js';
17
- import { type Fences } from './store/fences.js';
18
17
  import { type Installs } from './store/installs.js';
19
- import { type HeldCover, type PendingState, type RuntimeStore } from './store/records.js';
18
+ import { type HeldCover, type HeldStatus, type PendingState, type RuntimeStore } from './store/records.js';
20
19
  import { type ReadinessQueue } from './store/readiness.js';
21
20
  import { type RoomHeld } from './store/room-held.js';
21
+ import { type RoomsShown } from './store/rooms-shown.js';
22
22
  import { type Space } from './store/space.js';
23
23
  import { type Watcher, type Watching } from './store/watchers.js';
24
24
  import { createWrites, type InstallHold } from './store/writes.js';
25
- export { NO_INSTALL, type RoomInstall } from './store/installs.js';
26
- export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
25
+ export type { RoomInstall } from './store/installs.js';
26
+ export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, ConversationFact, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
27
27
  export type { InstallHold } from './store/writes.js';
28
28
  export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
29
29
  export type Stored = {
@@ -39,7 +39,10 @@ export type Work = {
39
39
  readonly queue: readonly ChangeBatch[];
40
40
  readonly states: ReadonlyMap<string, PendingState>;
41
41
  };
42
- type LandedAhead = Readonly<Record<string, string | undefined>>;
42
+ type HeldConflict = {
43
+ readonly revisions: Readonly<Record<string, string | undefined>>;
44
+ readonly returned: ReturnReason | null;
45
+ };
43
46
  type AttachedFile = {
44
47
  readonly revision: string;
45
48
  readonly mediaType: string;
@@ -49,16 +52,16 @@ type Seeds = {
49
52
  keep(key: string, seed: Seeded): void;
50
53
  drop(key: string): void;
51
54
  };
52
- export type Device = {
55
+ type Device = {
53
56
  readonly persistence: Persistence;
54
57
  readonly storageLoss: string | null;
55
- readonly heldWhenOpened: boolean;
58
+ readonly completedWhenOpened: boolean;
56
59
  readonly preparing: boolean;
57
60
  readonly sweeping: boolean;
58
61
  readonly unpreparedDemand: ReadonlySet<string>;
62
+ readonly unpreparable: ReadonlySet<string>;
59
63
  readonly establishing: ReadonlySet<string>;
60
64
  readonly status: SyncStatus;
61
- readonly roomsShown: Listing | null;
62
65
  };
63
66
  type StoreOptions = {
64
67
  readonly database: RuntimeDatabase;
@@ -66,19 +69,24 @@ type StoreOptions = {
66
69
  readonly builtIn: ModelState;
67
70
  readonly typedPaths: readonly TypedPath[];
68
71
  readonly persistence: Persistence;
72
+ readonly retries: Retries;
73
+ lost(locator: string): boolean;
74
+ losing(): boolean;
69
75
  opening(records: RuntimeStore): Promise<RuntimeStore>;
70
76
  unpublished(error: unknown): void;
71
77
  changed(set: ChangeSet): Promise<void>;
72
- deliverReadiness(owed: readonly ReadinessWatch[]): Promise<void>;
78
+ deliverReadiness(owed: readonly ReadinessWatch[], rooms: ReadonlySet<string> | null): Promise<void>;
73
79
  spaceFreed(): void;
74
80
  };
75
81
  export type Store = {
76
82
  readonly device: Cell<Device>;
83
+ readonly roomsShown: RoomsShown;
77
84
  readonly space: Space;
78
- readonly readiness: ReadinessQueue<ReadinessWatch>;
85
+ readonly readiness: ReadinessQueue<ReadinessWatch, ReadinessShowing>;
79
86
  ask: RuntimeDatabase['ask'];
80
87
  changed(set: ChangeSet): Promise<void>;
81
88
  open(): Promise<RuntimeStore>;
89
+ needed(): boolean;
82
90
  durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
83
91
  exclusive<T>(work: () => Promise<T>): Promise<T>;
84
92
  gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
@@ -95,21 +103,23 @@ export type Store = {
95
103
  work(locator: string): Promise<Work>;
96
104
  replica(locator: string): Promise<Held | undefined>;
97
105
  covering(): Promise<HeldCover>;
106
+ status(): Promise<HeldStatus>;
107
+ queued(): Promise<readonly string[]>;
98
108
  drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
99
109
  draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
100
- composed(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>): Composition;
110
+ composed(record: Pick<ReplicaRecord, 'model' | 'declaration'>): Composition;
101
111
  publication(work: () => Promise<void>): Promise<void>;
102
112
  owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
103
113
  watch(topic: string, notify: (value: unknown) => void): Watcher;
104
114
  watching(topic: string, which?: Watching): readonly Watcher[];
105
115
  tell(topic: string, value: unknown): void;
106
- readonly fences: Fences;
107
116
  readonly installs: Installs;
108
117
  readonly seeds: Seeds;
109
- readonly landed: RoomHeld<LandedAhead>;
118
+ readonly conflicted: RoomHeld<HeldConflict>;
110
119
  readonly attached: RoomHeld<AttachedFile>;
111
120
  readonly opened: OpenedFiles;
112
121
  part(file: string, part: number): Promise<Uint8Array | null>;
122
+ prepareAgain(locator?: string): void;
113
123
  forget(locator: string): void;
114
124
  close(): void;
115
125
  };
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE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K,OAAO,CAAC,IAAI,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,OAAO,EAAE,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC7D,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAMF,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,KAAK,CA4LxD"}
package/dist/store.js CHANGED
@@ -3,45 +3,59 @@ import { createCell } from './cell.js';
3
3
  import { openedFiles } from './opened.js';
4
4
  import { compositionOf } from './replica.js';
5
5
  import { STARTING } from './status.js';
6
- import { createFences } from './store/fences.js';
7
- import { createInstalls } from './store/installs.js';
6
+ import { createInstalls, NO_INSTALL } from './store/installs.js';
8
7
  import { openRuntimeStore, } from './store/records.js';
9
8
  import { createReadinessQueue } from './store/readiness.js';
10
9
  import { createRoomHeld } from './store/room-held.js';
10
+ import { createRoomsShown } from './store/rooms-shown.js';
11
11
  import { createSpace } from './store/space.js';
12
12
  import { createWatchers } from './store/watchers.js';
13
13
  import { createWrites } from './store/writes.js';
14
- export { NO_INSTALL } from './store/installs.js';
14
+ const OPENING = 'store';
15
15
  export function createStore(options) {
16
16
  const writes = createWrites();
17
17
  const watchers = createWatchers(options.unpublished);
18
- const fences = createFences();
18
+ const { lost } = options;
19
19
  const installs = createInstalls();
20
20
  const seeds = new Map();
21
- const landed = createRoomHeld();
21
+ const conflicted = createRoomHeld();
22
22
  const attached = createRoomHeld();
23
23
  const typesHeld = new Map();
24
24
  const device = createCell({
25
25
  persistence: options.persistence,
26
26
  storageLoss: null,
27
- heldWhenOpened: false,
27
+ completedWhenOpened: false,
28
28
  preparing: false,
29
29
  sweeping: false,
30
30
  unpreparedDemand: new Set(),
31
+ unpreparable: new Set(),
31
32
  establishing: new Set(),
32
33
  status: STARTING,
33
- roomsShown: null,
34
34
  });
35
35
  const space = createSpace(options.database, options.spaceFreed);
36
36
  const readiness = createReadinessQueue(options.deliverReadiness, options.unpublished);
37
37
  let opening;
38
+ let needed = false;
38
39
  function open() {
39
- opening ??= options.opening(openRuntimeStore(options.database)).catch((error) => {
40
+ needed = true;
41
+ opening ??= options.opening(openRuntimeStore(options.database)).then((opened) => {
42
+ options.retries.succeeded('database', OPENING);
43
+ return opened;
44
+ }, (error) => {
40
45
  opening = undefined;
46
+ options.retries.failed('database', OPENING, error);
41
47
  throw error;
42
48
  });
43
49
  return opening;
44
50
  }
51
+ function prepareAgain(locator) {
52
+ const { unpreparable } = device.now();
53
+ device.set({
54
+ unpreparable: locator === undefined
55
+ ? new Set()
56
+ : new Set([...unpreparable].filter((held) => held !== locator)),
57
+ });
58
+ }
45
59
  function typed(locator, persisted) {
46
60
  if (persisted.status === 'unavailable')
47
61
  return persisted;
@@ -59,14 +73,14 @@ export function createStore(options) {
59
73
  async function rooms(locators) {
60
74
  const held = await (await open()).rooms(locators);
61
75
  return new Map(held
62
- .filter(({ record }) => !fences.has(record.locator))
76
+ .filter(({ record }) => !lost(record.locator))
63
77
  .map(({ record, indexed, documents }) => [
64
78
  record.locator,
65
79
  { record: recordOf(record), indexed, documents },
66
80
  ]));
67
81
  }
68
82
  async function work(locator) {
69
- if (fences.has(locator))
83
+ if (lost(locator))
70
84
  return { replica: undefined, queue: [], states: new Map() };
71
85
  const { room, queue } = await (await open()).room(locator);
72
86
  const batches = queue.map(({ batch }) => batch);
@@ -81,15 +95,17 @@ export function createStore(options) {
81
95
  }
82
96
  async function drafts(locator, paths) {
83
97
  const held = await (await open()).roomDrafts(locator, paths);
84
- return held.filter((record) => !fences.has(record.locator));
98
+ return held.filter((record) => !lost(record.locator));
85
99
  }
86
100
  return {
87
101
  device,
102
+ roomsShown: createRoomsShown(),
88
103
  space,
89
104
  readiness,
90
105
  ask: options.database.ask,
91
106
  changed: options.changed,
92
107
  open,
108
+ needed: () => needed,
93
109
  durably: (work) => writes.exclusive(async () => {
94
110
  const local = await open();
95
111
  return work(local);
@@ -110,20 +126,33 @@ export function createStore(options) {
110
126
  replica: async (locator) => (await work(locator)).replica,
111
127
  async covering() {
112
128
  const held = await (await open()).covering();
129
+ if (!options.losing())
130
+ return held;
131
+ return {
132
+ rooms: new Map([...held.rooms].filter(([locator]) => !lost(locator))),
133
+ locking: new Set([...held.locking].filter((locator) => !lost(locator))),
134
+ queues: new Map([...held.queues].filter(([locator]) => !lost(locator))),
135
+ };
136
+ },
137
+ async status() {
138
+ const held = await (await open()).status();
113
139
  return {
114
- rooms: new Map([...held.rooms].filter(([locator]) => !fences.has(locator))),
115
- queues: new Map([...held.queues].filter(([locator]) => !fences.has(locator))),
140
+ queued: held.queued.filter((locator) => !lost(locator)),
141
+ lastCompleted: held.lastCompleted,
142
+ unsent: held.unsent.filter(({ room }) => !lost(room)),
143
+ resets: held.resets.filter(({ locator }) => !lost(locator)),
144
+ returned: held.returned.filter(({ locator }) => !lost(locator)),
116
145
  };
117
146
  },
147
+ queued: async () => (await (await open()).queued()).filter((locator) => !lost(locator)),
118
148
  drafts,
119
149
  draft: async (locator, path) => (await drafts(locator, [path]))[0],
120
- composed: (record) => compositionOf(record, options.builtIn, options.typedPaths),
150
+ composed: ({ model, declaration }) => compositionOf(model, declaration.typedSelection, options.builtIn, options.typedPaths),
121
151
  publication: watchers.publication,
122
152
  owing: watchers.owing,
123
153
  watch: watchers.watch,
124
154
  watching: watchers.watching,
125
155
  tell: watchers.tell,
126
- fences,
127
156
  installs,
128
157
  seeds: {
129
158
  of: (key) => seeds.get(key),
@@ -134,14 +163,17 @@ export function createStore(options) {
134
163
  seeds.delete(key);
135
164
  },
136
165
  },
137
- landed,
166
+ conflicted,
138
167
  attached,
139
- opened: openedFiles(options.database, fences.has),
168
+ opened: openedFiles(options.database, lost),
169
+ prepareAgain,
140
170
  part: (file, part) => options.database.ask({ kind: 'file.part', key: file, part }),
141
171
  forget(locator) {
142
172
  typesHeld.delete(locator);
143
- landed.forget(locator);
173
+ conflicted.forget(locator);
144
174
  attached.forget(locator);
175
+ installs.change(locator, ({ installing }) => ({ ...NO_INSTALL, installing }));
176
+ prepareAgain(locator);
145
177
  },
146
178
  close() {
147
179
  space.stop();
package/dist/stored.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { SavedFacts, HeadChange } from './adapter.js';
2
2
  import { type Composed, type Composition } from './collection.js';
3
3
  import type { HeldBinary } from './overlay.js';
4
+ import { type Sought } from './rows.js';
4
5
  import type { Connection } from './tables.js';
6
+ export declare const ROOM_HANDLE: (alias: string) => string;
5
7
  export declare const REPLICA_TABLES: readonly string[];
6
8
  export type View = 'confirmed' | 'visible' | 'refreshed';
7
9
  export type StoredEntry = {
@@ -21,6 +23,11 @@ export type OverlayEntry = StoredEntry & {
21
23
  export type HeldEntry = StoredEntry & {
22
24
  readonly type: string | null;
23
25
  };
26
+ export type ValuedEntry = {
27
+ readonly path: string;
28
+ readonly type: string;
29
+ readonly fields: Readonly<Record<string, unknown>>;
30
+ };
24
31
  export type TypedEntry = {
25
32
  readonly path: string;
26
33
  readonly type: string | null;
@@ -30,6 +37,10 @@ export type Referrer = {
30
37
  readonly path: string;
31
38
  readonly target: string;
32
39
  };
40
+ export type { Sought };
41
+ export type Holder = Sought & {
42
+ readonly path: string;
43
+ };
33
44
  export type HeldRoomRow = {
34
45
  readonly locator: string;
35
46
  readonly key: number;
@@ -47,17 +58,28 @@ export type HeldRoomWork = {
47
58
  readonly state: string;
48
59
  }[];
49
60
  };
50
- export type Covering = {
51
- readonly rooms: readonly {
52
- readonly locator: string;
53
- readonly key: number;
54
- readonly transfer: string;
55
- readonly roomVersion: string;
56
- readonly indexed: boolean;
57
- readonly documents: number;
58
- readonly bytes: number;
59
- readonly offline: string;
60
- }[];
61
+ export type CoverLog = {
62
+ readonly token: string;
63
+ readonly at: number;
64
+ };
65
+ export type CoveredRow = {
66
+ readonly locator: string;
67
+ readonly handle: string;
68
+ readonly key: number;
69
+ readonly transfer: string;
70
+ readonly roomVersion: string;
71
+ readonly indexed: boolean;
72
+ readonly documents: number;
73
+ readonly bytes: number;
74
+ readonly offline: string;
75
+ };
76
+ export type CoveredRooms = {
77
+ readonly log: CoverLog;
78
+ readonly whole: boolean;
79
+ readonly rooms: readonly CoveredRow[];
80
+ readonly removed: readonly string[];
81
+ };
82
+ export type Covering = CoveredRooms & {
61
83
  readonly queues: readonly {
62
84
  readonly locator: string;
63
85
  readonly ids: readonly string[];
@@ -94,7 +116,8 @@ export type Committed = {
94
116
  readonly changed: Readonly<Record<string, readonly string[] | null>>;
95
117
  readonly indexed: Readonly<Record<string, boolean>>;
96
118
  };
97
- export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
119
+ export declare function entered(connection: Connection, locator: string, composition: Composition, entries: readonly StoredEntry[]): number;
120
+ export declare function enteredValues(connection: Connection, locator: string, composition: Composition, documents: readonly ValuedEntry[]): number;
98
121
  export declare function stage(connection: Connection, request: {
99
122
  readonly locator: string;
100
123
  readonly transfer: string;
@@ -138,19 +161,21 @@ export declare function rederive(connection: Connection, key: number, composed:
138
161
  };
139
162
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
140
163
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
164
+ export declare function holders(connection: Connection, key: number, view: View, sought: readonly Sought[]): Holder[];
141
165
  export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
142
- export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
166
+ export declare function folders(connection: Connection, key: number, list: readonly string[]): string[];
143
167
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
144
168
  export declare function opened(connection: Connection): ReplicaOpened;
145
169
  export declare function heldRooms(connection: Connection, locators: readonly string[] | null): readonly HeldRoomRow[];
146
170
  export declare function heldRoom(connection: Connection, locator: string): HeldRoomRow | null;
147
171
  export declare function overlaid(connection: Connection, key: number): readonly string[];
148
- export declare function covering(connection: Connection): Covering['rooms'];
172
+ export declare function covering(connection: Connection, since: CoverLog | null): CoveredRooms;
149
173
  export declare function offlineMode(connection: Connection, locator: string): string | null;
150
174
  export declare function stagedLocators(connection: Connection): readonly string[];
151
175
  export declare function heldLocators(connection: Connection): readonly string[];
152
176
  export declare function demoted(connection: Connection): null;
153
- export declare function facts(connection: Connection): Readonly<Record<string, string>>;
177
+ export declare function facts(connection: Connection, names: readonly string[] | null): Readonly<Record<string, string>>;
154
178
  export declare function presentation(connection: Connection, app: string): string | null;
179
+ export declare function tablesOf(statements: readonly string[]): readonly string[];
155
180
  export declare function ended(connection: Connection): void;
156
181
  //# sourceMappingURL=stored.d.ts.map