@agentshouse/mdruntime 0.1.0-ca6edc1abd618 → 0.1.0-ca8707258fdde
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.
- package/README.md +2 -2
- package/dist/acceptance.d.ts +26 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +384 -0
- package/dist/adapter.d.ts +102 -70
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +29 -47
- package/dist/bootstrap.d.ts +16 -14
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +272 -129
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +2 -0
- package/dist/client.d.ts +20 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +55 -6
- package/dist/collection.d.ts +7 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -17
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +278 -282
- package/dist/connection.d.ts +22 -44
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1600 -3577
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +47 -0
- package/dist/conversation.d.ts +27 -18
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +484 -258
- package/dist/durability.d.ts +6 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -8
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +29 -32
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +20 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/install.d.ts +86 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +62 -20
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +12 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +216 -85
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +97 -19
- package/dist/model.d.ts +8 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +5 -17
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +14 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +19 -2
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +18 -207
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +32 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +118 -0
- package/dist/reach.d.ts +18 -11
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +206 -126
- package/dist/react.d.ts +5 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +3 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +34 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +114 -86
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +35 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +33 -5
- package/dist/replica.d.ts +10 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +52 -20
- package/dist/room-draft.d.ts +21 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +98 -51
- package/dist/room-drafts.d.ts +29 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +18 -16
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +45 -153
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +22 -13
- package/dist/saves.d.ts +96 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +999 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +16 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +66 -0
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket.d.ts +43 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +96 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/watchers.d.ts +15 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +36 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +76 -158
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +117 -403
- package/dist/stored.d.ts +66 -55
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +343 -273
- package/dist/tables.d.ts +118 -65
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +199 -99
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +23 -8
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +8 -2
- package/package.json +2 -2
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/install.js
ADDED
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { attachedModel } from './attached-model.js';
|
|
2
|
+
import { bootstrapRoom } from './bootstrap.js';
|
|
3
|
+
import { refusedForSpace } from './durability.js';
|
|
4
|
+
import { NO_MODEL } from './model.js';
|
|
5
|
+
import { advancement } from './refresh.js';
|
|
6
|
+
import { NO_INSTALL, } from './store.js';
|
|
7
|
+
import { unconfirmed } from './transfer.js';
|
|
8
|
+
import { ROW_WEIGHT } from './turn.js';
|
|
9
|
+
// Bytes still arriving are reported at most this often, so readiness is not rebuilt for every chunk the network hands over while a slow link still moves the figure.
|
|
10
|
+
const ARRIVAL_REPORT_MS = 250;
|
|
11
|
+
const NOTHING_HELD = { bytes: 0 };
|
|
12
|
+
function transferGone(held) {
|
|
13
|
+
return {
|
|
14
|
+
...held,
|
|
15
|
+
transfer: null,
|
|
16
|
+
arrived: null,
|
|
17
|
+
streaming: false,
|
|
18
|
+
underived: 0,
|
|
19
|
+
unindexed: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function amountOf(held, kept) {
|
|
23
|
+
if (held.transfer !== null) {
|
|
24
|
+
const owed = held.unindexed.reduce((sum, part) => sum + part.bytes, 0);
|
|
25
|
+
return {
|
|
26
|
+
done: held.transfer.done.bytes - Math.ceil(owed),
|
|
27
|
+
total: Math.max(held.arrived ?? 0, held.transfer.done.bytes),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { done: kept, total: held.arrived ?? kept };
|
|
31
|
+
}
|
|
32
|
+
function setBack(held) {
|
|
33
|
+
const now = amountOf(held, NOTHING_HELD.bytes);
|
|
34
|
+
const earlier = held.startedOver;
|
|
35
|
+
return {
|
|
36
|
+
...held,
|
|
37
|
+
startedOver: {
|
|
38
|
+
done: Math.max(now.done, earlier?.done ?? 0),
|
|
39
|
+
total: Math.max(now.total, earlier?.total ?? 0),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function owedIndexes(held, bytes, text) {
|
|
44
|
+
if (bytes <= 0 || text <= 0)
|
|
45
|
+
return held;
|
|
46
|
+
return { ...held, unindexed: [...held.unindexed, { bytes, text }] };
|
|
47
|
+
}
|
|
48
|
+
function built(held, done, text) {
|
|
49
|
+
const owed = [...held.unindexed];
|
|
50
|
+
let left = text;
|
|
51
|
+
while (!done && left > 0 && owed.length > 0) {
|
|
52
|
+
const [first] = owed;
|
|
53
|
+
if (left >= first.text) {
|
|
54
|
+
left -= first.text;
|
|
55
|
+
owed.shift();
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
owed[0] = {
|
|
59
|
+
bytes: (first.bytes * (first.text - left)) / first.text,
|
|
60
|
+
text: first.text - left,
|
|
61
|
+
};
|
|
62
|
+
left = 0;
|
|
63
|
+
}
|
|
64
|
+
return { ...held, unindexed: done ? [] : owed };
|
|
65
|
+
}
|
|
66
|
+
function batchEnd(entries, from, bytes) {
|
|
67
|
+
let end = from;
|
|
68
|
+
let spent = 0;
|
|
69
|
+
while (end < entries.length) {
|
|
70
|
+
const size = (entries[end].content?.length ?? 0) + ROW_WEIGHT;
|
|
71
|
+
if (spent + size > bytes && end > from)
|
|
72
|
+
break;
|
|
73
|
+
spent += size;
|
|
74
|
+
end += 1;
|
|
75
|
+
}
|
|
76
|
+
return end;
|
|
77
|
+
}
|
|
78
|
+
export function installationOf(store, coverage, held) {
|
|
79
|
+
const rooms = { done: 0, total: 0 };
|
|
80
|
+
const bytes = { done: 0, total: 0 };
|
|
81
|
+
let installing = 0;
|
|
82
|
+
let downloading = false;
|
|
83
|
+
for (const { room, state } of coverage) {
|
|
84
|
+
if (state === 'unadmitted')
|
|
85
|
+
continue;
|
|
86
|
+
rooms.total += 1;
|
|
87
|
+
if (state === 'complete')
|
|
88
|
+
rooms.done += 1;
|
|
89
|
+
const install = store.installs.of(room);
|
|
90
|
+
const underway = state === 'acquiring' || (install.installing && state !== 'complete');
|
|
91
|
+
if (underway)
|
|
92
|
+
installing += 1;
|
|
93
|
+
if (underway && (install.streaming || install.arrived === null))
|
|
94
|
+
downloading = true;
|
|
95
|
+
const kept = underway ? NOTHING_HELD.bytes : (held.get(room)?.bytes ?? NOTHING_HELD.bytes);
|
|
96
|
+
const now = amountOf(install, kept);
|
|
97
|
+
const earlier = underway ? install.startedOver : null;
|
|
98
|
+
bytes.done += Math.max(now.done, earlier?.done ?? 0);
|
|
99
|
+
bytes.total += Math.max(now.total, earlier?.total ?? 0);
|
|
100
|
+
}
|
|
101
|
+
const step = installing === 0
|
|
102
|
+
? null
|
|
103
|
+
: downloading
|
|
104
|
+
? 'downloading'
|
|
105
|
+
: bytes.done < bytes.total
|
|
106
|
+
? 'writing'
|
|
107
|
+
: 'replaying';
|
|
108
|
+
return { step, rooms, bytes };
|
|
109
|
+
}
|
|
110
|
+
export function roomInFlight(store, locator) {
|
|
111
|
+
const { catching, transfer } = store.installs.of(locator);
|
|
112
|
+
return catching || transfer !== null;
|
|
113
|
+
}
|
|
114
|
+
function installing(installer, locator) {
|
|
115
|
+
installer.store.installs.change(locator, (held) => ({ ...held, installing: true }));
|
|
116
|
+
installer.queueReadiness();
|
|
117
|
+
}
|
|
118
|
+
function installed(installer, locator) {
|
|
119
|
+
if (!installer.store.installs.of(locator).installing)
|
|
120
|
+
return;
|
|
121
|
+
installer.store.installs.change(locator, (held) => ({ ...held, installing: false }));
|
|
122
|
+
installer.queueReadiness();
|
|
123
|
+
}
|
|
124
|
+
export function forgetInstall(store, locator) {
|
|
125
|
+
store.installs.change(locator, ({ installing }) => ({ ...NO_INSTALL, installing }));
|
|
126
|
+
}
|
|
127
|
+
export function caughtUpTo(installer, locator) {
|
|
128
|
+
if (!installer.store.installs.of(locator).catching)
|
|
129
|
+
return;
|
|
130
|
+
installer.store.installs.change(locator, (held) => ({ ...held, catching: false }));
|
|
131
|
+
installer.recover();
|
|
132
|
+
}
|
|
133
|
+
export function catching(store, locator) {
|
|
134
|
+
store.installs.change(locator, (held) => ({ ...held, catching: true }));
|
|
135
|
+
}
|
|
136
|
+
export function confirmedAgain(store, locator) {
|
|
137
|
+
store.installs.change(locator, (held) => ({
|
|
138
|
+
...held,
|
|
139
|
+
confirmations: held.confirmations + 1,
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
export function standingAt(store, locator, held) {
|
|
143
|
+
return { key: held?.key ?? null, confirmed: store.installs.of(locator).confirmations };
|
|
144
|
+
}
|
|
145
|
+
function standsAt(store, locator, held, from) {
|
|
146
|
+
const now = standingAt(store, locator, held);
|
|
147
|
+
return now.key === from.key && now.confirmed === from.confirmed;
|
|
148
|
+
}
|
|
149
|
+
function shownAt({ store, socket }, locator, held) {
|
|
150
|
+
const raised = store.installs.of(locator).highest ?? undefined;
|
|
151
|
+
if (held === undefined || raised === undefined)
|
|
152
|
+
return held ?? raised;
|
|
153
|
+
return socket.reads.reached(locator, held, raised) ? held : raised;
|
|
154
|
+
}
|
|
155
|
+
export function showing(system, locator, roomVersion, held) {
|
|
156
|
+
const at = shownAt(system, locator, held);
|
|
157
|
+
if (at === undefined || !system.socket.reads.reached(locator, at, roomVersion)) {
|
|
158
|
+
system.store.installs.change(locator, (room) => ({ ...room, highest: roomVersion }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export function olderThan(system, locator, roomVersion, held) {
|
|
162
|
+
const { store, socket } = system;
|
|
163
|
+
if (store.installs.of(locator).beyondHorizon)
|
|
164
|
+
return false;
|
|
165
|
+
const at = shownAt(system, locator, held);
|
|
166
|
+
return (at !== undefined &&
|
|
167
|
+
socket.reads.reached(locator, at, roomVersion) &&
|
|
168
|
+
!socket.reads.reached(locator, roomVersion, at));
|
|
169
|
+
}
|
|
170
|
+
async function older(installer, locator, roomVersion) {
|
|
171
|
+
const { store } = installer;
|
|
172
|
+
if (store.installs.of(locator).beyondHorizon)
|
|
173
|
+
return false;
|
|
174
|
+
return olderThan(installer, locator, roomVersion, (await store.record(locator))?.roomVersion);
|
|
175
|
+
}
|
|
176
|
+
export function replaced(store, locators) {
|
|
177
|
+
for (const locator of locators) {
|
|
178
|
+
store.installs.change(locator, (held) => ({ ...held, highest: null, beyondHorizon: true }));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export async function reachedBy({ store, socket }, locator, roomVersion) {
|
|
182
|
+
const held = await store.record(locator);
|
|
183
|
+
return held !== undefined && socket.reads.reached(locator, held.roomVersion, roomVersion);
|
|
184
|
+
}
|
|
185
|
+
export async function behind({ store, socket }, room) {
|
|
186
|
+
const held = (await store.record(room.locator))?.roomVersion;
|
|
187
|
+
return held !== undefined && !socket.reads.reached(room.locator, held, room.roomVersion);
|
|
188
|
+
}
|
|
189
|
+
export async function writtenAfter({ store, socket }, locator, roomVersion, path) {
|
|
190
|
+
const held = await store.record(locator);
|
|
191
|
+
if (held === undefined)
|
|
192
|
+
return false;
|
|
193
|
+
const [entry] = await (await store.open()).entries(held.key, 'confirmed', [path]);
|
|
194
|
+
const written = entry?.written ?? undefined;
|
|
195
|
+
return (written !== undefined &&
|
|
196
|
+
socket.reads.reached(locator, written, roomVersion) &&
|
|
197
|
+
!socket.reads.reached(locator, roomVersion, written));
|
|
198
|
+
}
|
|
199
|
+
async function writtenLater(installer, local, locator, key, paths, roomVersion, heldAt) {
|
|
200
|
+
if (paths.length === 0)
|
|
201
|
+
return new Set();
|
|
202
|
+
const { reached } = installer.socket.reads;
|
|
203
|
+
const behindShown = heldAt === undefined
|
|
204
|
+
? await older(installer, locator, roomVersion)
|
|
205
|
+
: olderThan(installer, locator, roomVersion, heldAt);
|
|
206
|
+
if (!behindShown)
|
|
207
|
+
return new Set();
|
|
208
|
+
const entries = await local.entries(key, 'confirmed', paths);
|
|
209
|
+
return new Set(entries.flatMap(({ path, written }) => written !== null &&
|
|
210
|
+
reached(locator, written, roomVersion) &&
|
|
211
|
+
!reached(locator, roomVersion, written)
|
|
212
|
+
? [path]
|
|
213
|
+
: []));
|
|
214
|
+
}
|
|
215
|
+
function remodel(installer, answers, held) {
|
|
216
|
+
const answer = answers?.collection;
|
|
217
|
+
if (answer === undefined)
|
|
218
|
+
return held;
|
|
219
|
+
return { collection: attachedModel(answer, installer.roomTypes) };
|
|
220
|
+
}
|
|
221
|
+
function refreshingOf(installer, local, locator, key, composition, liveness, replaying = false, heldAt) {
|
|
222
|
+
const { store } = installer;
|
|
223
|
+
const write = replaying ? store.finishingWrite : store.exclusive;
|
|
224
|
+
return {
|
|
225
|
+
turn() {
|
|
226
|
+
if (replaying)
|
|
227
|
+
installing(installer, locator);
|
|
228
|
+
},
|
|
229
|
+
prior: async (paths) => new Map((await local.entries(key, 'refreshed', paths)).map((entry) => [entry.path, entry])),
|
|
230
|
+
later: (paths, roomVersion) => writtenLater(installer, local, locator, key, paths, roomVersion, heldAt),
|
|
231
|
+
async stage(page) {
|
|
232
|
+
for (let written = 0;;) {
|
|
233
|
+
const end = batchEnd(page.entries, written, store.stageBytes());
|
|
234
|
+
const last = end === page.entries.length;
|
|
235
|
+
const entries = page.entries.slice(written, end);
|
|
236
|
+
const staged = await write(async () => {
|
|
237
|
+
if (!liveness())
|
|
238
|
+
return false;
|
|
239
|
+
await store.refreshPage(local, key, composition, last
|
|
240
|
+
? { ...page, entries }
|
|
241
|
+
: { entries, removals: [], folders: [], folderRemovals: [] });
|
|
242
|
+
return true;
|
|
243
|
+
});
|
|
244
|
+
if (!staged)
|
|
245
|
+
return false;
|
|
246
|
+
if (last)
|
|
247
|
+
return true;
|
|
248
|
+
written = end;
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
export async function pullRefresh(installer, authorized, record, liveness, hold, refresh) {
|
|
254
|
+
if (!liveness())
|
|
255
|
+
return unconfirmed;
|
|
256
|
+
const { store, journal } = installer;
|
|
257
|
+
const from = standingAt(store, record.locator, record);
|
|
258
|
+
const local = await store.open();
|
|
259
|
+
try {
|
|
260
|
+
await store.exclusive(() => local.unrefresh(record.key));
|
|
261
|
+
const result = await advancement(async (authorization, request) => {
|
|
262
|
+
hold.release();
|
|
263
|
+
try {
|
|
264
|
+
return await refresh(authorization, request);
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
hold.take();
|
|
268
|
+
}
|
|
269
|
+
}, authorized, record, (models, kept) => (liveness() ? remodel(installer, models, kept) : kept), liveness, refreshingOf(installer, local, record.locator, record.key, store.composed(record), liveness, false, record.roomVersion));
|
|
270
|
+
if (result.kind !== 'advanced') {
|
|
271
|
+
journal.record(`transfer refresh ${record.locator} ${result.kind}`);
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
journal.record(`transfer refresh ${record.locator} ${result.record.roomVersion}`);
|
|
275
|
+
return {
|
|
276
|
+
kind: 'advanced',
|
|
277
|
+
record: result.record,
|
|
278
|
+
from,
|
|
279
|
+
remodelled: result.record.model !== record.model,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
if (refusedForSpace(error))
|
|
284
|
+
return unconfirmed;
|
|
285
|
+
journal.record(`transfer refresh ${record.locator} transport-uncertainty`);
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async function abandoned(installer, local, locator) {
|
|
290
|
+
await local.abandon(locator);
|
|
291
|
+
installer.store.installs.change(locator, (held) => transferGone(setBack(held)));
|
|
292
|
+
installer.recover();
|
|
293
|
+
installer.sweep();
|
|
294
|
+
}
|
|
295
|
+
function staging(installer, local, liveness, unheld) {
|
|
296
|
+
const { store, socket } = installer;
|
|
297
|
+
const derived = async (locator, key, composition) => {
|
|
298
|
+
store.installs.change(locator, (held) => ({ ...held, underived: 0 }));
|
|
299
|
+
for (;;) {
|
|
300
|
+
if (!liveness())
|
|
301
|
+
return false;
|
|
302
|
+
const done = await store.finishingWrite(async () => liveness() ? store.rederive(local, key, composition) : null);
|
|
303
|
+
if (done === null)
|
|
304
|
+
return false;
|
|
305
|
+
store.installs.change(locator, (held) => built(held, done.done, done.text));
|
|
306
|
+
installer.queueReadiness();
|
|
307
|
+
if (done.done)
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
return {
|
|
312
|
+
held: (locator) => store.installs.of(locator).transfer,
|
|
313
|
+
async turn(locator, step) {
|
|
314
|
+
installing(installer, locator);
|
|
315
|
+
return step === 'downloading' ? socket.heldStream() : () => { };
|
|
316
|
+
},
|
|
317
|
+
unqueued: socket.unqueued,
|
|
318
|
+
queued: socket.queued,
|
|
319
|
+
arriving(locator) {
|
|
320
|
+
let ended = false;
|
|
321
|
+
return {
|
|
322
|
+
at(bytes) {
|
|
323
|
+
if (ended)
|
|
324
|
+
return;
|
|
325
|
+
store.installs.change(locator, (held) => ({
|
|
326
|
+
...held,
|
|
327
|
+
arrived: bytes,
|
|
328
|
+
streaming: true,
|
|
329
|
+
}));
|
|
330
|
+
if (!store.installs.arrivalDue(performance.now(), ARRIVAL_REPORT_MS))
|
|
331
|
+
return;
|
|
332
|
+
installer.queueReadiness();
|
|
333
|
+
},
|
|
334
|
+
end() {
|
|
335
|
+
if (ended)
|
|
336
|
+
return;
|
|
337
|
+
ended = true;
|
|
338
|
+
if (!store.installs.of(locator).streaming)
|
|
339
|
+
return;
|
|
340
|
+
store.installs.change(locator, (held) => ({ ...held, streaming: false }));
|
|
341
|
+
installer.queueReadiness();
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
},
|
|
345
|
+
streamed: socket.streamed,
|
|
346
|
+
async stage(record, page, composition) {
|
|
347
|
+
const { locator } = record;
|
|
348
|
+
installing(installer, locator);
|
|
349
|
+
if (!liveness())
|
|
350
|
+
return null;
|
|
351
|
+
const key = await store.startingWrite(async () => {
|
|
352
|
+
if (!liveness())
|
|
353
|
+
return null;
|
|
354
|
+
return local.stage(record, composition, page);
|
|
355
|
+
});
|
|
356
|
+
if (key === null || !liveness())
|
|
357
|
+
return null;
|
|
358
|
+
const before = store.installs.of(locator);
|
|
359
|
+
const prior = before.transfer?.done.bytes ?? 0;
|
|
360
|
+
const held = { ...record, key };
|
|
361
|
+
const text = page.entries.reduce((sum, entry) => sum + (entry.content?.length ?? 0), 0);
|
|
362
|
+
const owed = text + before.underived;
|
|
363
|
+
store.installs.change(locator, (room) => ({
|
|
364
|
+
...owedIndexes(room, record.done.bytes - prior, text),
|
|
365
|
+
transfer: held,
|
|
366
|
+
underived: owed,
|
|
367
|
+
}));
|
|
368
|
+
if (before.transfer === null)
|
|
369
|
+
installer.recover();
|
|
370
|
+
installing(installer, locator);
|
|
371
|
+
installer.recover();
|
|
372
|
+
if (owed < store.deriveBytes())
|
|
373
|
+
return held;
|
|
374
|
+
return (await derived(locator, key, composition)) ? held : null;
|
|
375
|
+
},
|
|
376
|
+
async resume(record, parts, composition) {
|
|
377
|
+
const { locator } = record;
|
|
378
|
+
installing(installer, locator);
|
|
379
|
+
if (!liveness())
|
|
380
|
+
return null;
|
|
381
|
+
const prior = unheld === undefined ? await store.record(locator) : undefined;
|
|
382
|
+
const published = prior !== undefined && prior.replica.selection === record.selection ? prior.key : null;
|
|
383
|
+
const kept = unheld?.staged ?? (await local.held()).staged.has(locator);
|
|
384
|
+
if (published === null && !kept)
|
|
385
|
+
return { record: null, staged: new Set() };
|
|
386
|
+
const resumed = await store.startingWrite(async () => {
|
|
387
|
+
if (!liveness())
|
|
388
|
+
return null;
|
|
389
|
+
return local.resume(record, composition, parts.map((part) => part.id), published);
|
|
390
|
+
});
|
|
391
|
+
if (resumed === null || !liveness())
|
|
392
|
+
return null;
|
|
393
|
+
const parted = new Set(resumed.staged);
|
|
394
|
+
if (resumed.key === null)
|
|
395
|
+
return { record: null, staged: parted };
|
|
396
|
+
const bytes = parts.reduce((sum, part) => sum + (parted.has(part.id) ? part.bytes : 0), 0);
|
|
397
|
+
const held = {
|
|
398
|
+
...record,
|
|
399
|
+
transfer: resumed.transfer,
|
|
400
|
+
key: resumed.key,
|
|
401
|
+
done: { bytes },
|
|
402
|
+
};
|
|
403
|
+
store.installs.change(locator, (room) => ({ ...room, transfer: held }));
|
|
404
|
+
installer.recover();
|
|
405
|
+
return { record: held, staged: parted };
|
|
406
|
+
},
|
|
407
|
+
derive: derived,
|
|
408
|
+
async refreshing(locator, key, composition) {
|
|
409
|
+
await store.exclusive(() => local.unrefresh(key));
|
|
410
|
+
return refreshingOf(installer, local, locator, key, composition, liveness, true);
|
|
411
|
+
},
|
|
412
|
+
abandon: (locator) => store.exclusive(async () => {
|
|
413
|
+
if (liveness())
|
|
414
|
+
await abandoned(installer, local, locator);
|
|
415
|
+
}),
|
|
416
|
+
setAside: async (locator) => {
|
|
417
|
+
if (!liveness())
|
|
418
|
+
return;
|
|
419
|
+
store.installs.change(locator, (held) => transferGone(setBack(held)));
|
|
420
|
+
installer.recover();
|
|
421
|
+
},
|
|
422
|
+
release: (key) => store.exclusive(async () => {
|
|
423
|
+
await local.release(key);
|
|
424
|
+
installer.sweep();
|
|
425
|
+
}),
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
export async function pullBootstrap(installer, authorized, room, local, liveness, prior, from = installer.socket.reads, unheld) {
|
|
429
|
+
if (!liveness())
|
|
430
|
+
return unconfirmed;
|
|
431
|
+
const { store, journal } = installer;
|
|
432
|
+
if (prior !== undefined) {
|
|
433
|
+
catching(store, room.locator);
|
|
434
|
+
installer.recover();
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
const result = await bootstrapRoom(from, authorized, room, { collection: prior?.model ?? installer.unheldModel(room.locator) ?? NO_MODEL }, installer.builtIn, installer.typedPaths, (models, held) => (liveness() ? remodel(installer, models, held) : held), liveness, staging(installer, local, liveness, unheld));
|
|
438
|
+
const detail = result.kind === 'staged' ? result.record.roomVersion : result.kind;
|
|
439
|
+
journal.record(`transfer bootstrap ${room.locator} ${detail}`);
|
|
440
|
+
if (result.kind === 'staged' &&
|
|
441
|
+
(await older(installer, room.locator, result.record.roomVersion))) {
|
|
442
|
+
caughtUpTo(installer, room.locator);
|
|
443
|
+
installed(installer, room.locator);
|
|
444
|
+
await abandoned(installer, local, room.locator);
|
|
445
|
+
journal.record(`transfer bootstrap ${room.locator} older than shown`);
|
|
446
|
+
return { kind: 'transport-uncertainty' };
|
|
447
|
+
}
|
|
448
|
+
if (result.kind !== 'staged') {
|
|
449
|
+
caughtUpTo(installer, room.locator);
|
|
450
|
+
installed(installer, room.locator);
|
|
451
|
+
}
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
caughtUpTo(installer, room.locator);
|
|
456
|
+
installed(installer, room.locator);
|
|
457
|
+
if (refusedForSpace(error))
|
|
458
|
+
return unconfirmed;
|
|
459
|
+
journal.record(`transfer bootstrap ${room.locator} transport-uncertainty`);
|
|
460
|
+
throw error;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
export function publish(installer, local, room, reached, landing, live) {
|
|
464
|
+
const { store } = installer;
|
|
465
|
+
const landed = store.exclusive(async () => {
|
|
466
|
+
if (!live()) {
|
|
467
|
+
caughtUpTo(installer, room.locator);
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
const work = await store.work(room.locator);
|
|
471
|
+
const prior = work.replica;
|
|
472
|
+
if (!standsAt(store, room.locator, prior?.record, landing.from)) {
|
|
473
|
+
if (landing.kind === 'refreshed') {
|
|
474
|
+
await local.unrefresh(reached.key);
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
caughtUpTo(installer, room.locator);
|
|
478
|
+
await abandoned(installer, local, room.locator);
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
const record = landing.kind === 'refreshed' && prior !== undefined
|
|
482
|
+
? {
|
|
483
|
+
...prior.record,
|
|
484
|
+
roomVersion: reached.roomVersion,
|
|
485
|
+
...(landing.remodelled ? { model: reached.model } : {}),
|
|
486
|
+
}
|
|
487
|
+
: reached;
|
|
488
|
+
let set;
|
|
489
|
+
try {
|
|
490
|
+
set = await installer.settle(local, room.locator, work, record, work.queue, landing.kind === 'refreshed'
|
|
491
|
+
? {
|
|
492
|
+
room: true,
|
|
493
|
+
view: 'refreshed',
|
|
494
|
+
commit: { refreshed: true },
|
|
495
|
+
}
|
|
496
|
+
: {
|
|
497
|
+
room: true,
|
|
498
|
+
view: landing.refreshed ? 'refreshed' : 'confirmed',
|
|
499
|
+
commit: {
|
|
500
|
+
published: { from: prior?.record.key ?? null },
|
|
501
|
+
...(landing.refreshed ? { refreshed: true } : {}),
|
|
502
|
+
},
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
catch (error) {
|
|
506
|
+
if (!refusedForSpace(error))
|
|
507
|
+
throw error;
|
|
508
|
+
caughtUpTo(installer, room.locator);
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
if (landing.kind === 'bootstrapped') {
|
|
512
|
+
installer.readied(room.locator);
|
|
513
|
+
store.installs.change(room.locator, (held) => ({
|
|
514
|
+
...transferGone(held),
|
|
515
|
+
highest: null,
|
|
516
|
+
beyondHorizon: false,
|
|
517
|
+
startedOver: null,
|
|
518
|
+
catching: false,
|
|
519
|
+
}));
|
|
520
|
+
installer.modelKept(room.locator);
|
|
521
|
+
if (prior !== undefined && prior.record.key !== record.key)
|
|
522
|
+
installer.sweep();
|
|
523
|
+
void installer.name(room.locator);
|
|
524
|
+
}
|
|
525
|
+
installer.usable(room);
|
|
526
|
+
void installer.publishChangeSet(set);
|
|
527
|
+
await installer.unpair(local);
|
|
528
|
+
void installer.statusShown();
|
|
529
|
+
if (landing.kind === 'bootstrapped' && work.queue.length > 0) {
|
|
530
|
+
installer.submitLater(room.locator);
|
|
531
|
+
}
|
|
532
|
+
return true;
|
|
533
|
+
});
|
|
534
|
+
return landing.kind === 'refreshed'
|
|
535
|
+
? landed
|
|
536
|
+
: landed.finally(() => installed(installer, room.locator));
|
|
537
|
+
}
|
package/dist/job.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type Job = {
|
|
2
|
+
readonly label: string;
|
|
3
|
+
readonly kind: 'started' | 'scheduled' | 'ended';
|
|
4
|
+
readonly state: string;
|
|
5
|
+
readonly next: string | null;
|
|
6
|
+
};
|
|
7
|
+
export type RunningJob = {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly running_since: string;
|
|
10
|
+
};
|
|
11
|
+
export type JobMarker = {
|
|
12
|
+
readonly said: string;
|
|
13
|
+
readonly at: string;
|
|
14
|
+
};
|
|
15
|
+
export type OpenJob<At = string | null> = {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly started: At;
|
|
18
|
+
};
|
|
19
|
+
export declare function jobOf(said: string): Job;
|
|
20
|
+
export declare function closeLast(open: {
|
|
21
|
+
readonly key: string;
|
|
22
|
+
}[], key: string): void;
|
|
23
|
+
export declare function markerMoved<Kept extends {
|
|
24
|
+
readonly key: string;
|
|
25
|
+
}>(open: Kept[], said: string, opened: (job: Job, key: string) => Kept | null): void;
|
|
26
|
+
export declare function openJobs<At>(markers: readonly {
|
|
27
|
+
readonly said: string;
|
|
28
|
+
readonly at: At;
|
|
29
|
+
}[]): readonly OpenJob<At>[];
|
|
30
|
+
export declare function jobsRunning(jobs: readonly RunningJob[], now: number): string[];
|
|
31
|
+
export declare function sessionEnded(jobs: readonly RunningJob[], now: number): string;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,KAAK,GAAG,GAAG;IACT,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,OAAO,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,IAAI;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC;AAQ1F,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CASvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED,wBAAgB,WAAW,CAAC,IAAI,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAC/D,IAAI,EAAE,IAAI,EAAE,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,GAC7C,IAAI,CASN;AAED,wBAAgB,QAAQ,CAAC,EAAE,EACzB,OAAO,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;CAAE,EAAE,GAC7D,SAAS,OAAO,CAAC,EAAE,CAAC,EAAE,CAQxB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAM9E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7E"}
|
package/dist/job.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const NEXT_RUN = 'next run ';
|
|
2
|
+
const MINUTE = 60_000;
|
|
3
|
+
const ENDED = 'Session ended.';
|
|
4
|
+
export function jobOf(said) {
|
|
5
|
+
const at = said.lastIndexOf(': ');
|
|
6
|
+
const label = at === -1 ? said : said.slice(0, at);
|
|
7
|
+
const state = at === -1 ? '' : said.slice(at + 2);
|
|
8
|
+
if (state === 'running')
|
|
9
|
+
return { label, kind: 'started', state, next: null };
|
|
10
|
+
if (state === 'scheduled')
|
|
11
|
+
return { label, kind: 'scheduled', state, next: null };
|
|
12
|
+
return state.startsWith(NEXT_RUN)
|
|
13
|
+
? { label, kind: 'scheduled', state, next: state.slice(NEXT_RUN.length) }
|
|
14
|
+
: { label, kind: 'ended', state, next: null };
|
|
15
|
+
}
|
|
16
|
+
export function closeLast(open, key) {
|
|
17
|
+
const at = open.map((one) => one.key).lastIndexOf(key);
|
|
18
|
+
if (at !== -1)
|
|
19
|
+
open.splice(at, 1);
|
|
20
|
+
}
|
|
21
|
+
export function markerMoved(open, said, opened) {
|
|
22
|
+
const job = jobOf(said);
|
|
23
|
+
const started = `job\u0000${job.label}`;
|
|
24
|
+
const schedule = `schedule\u0000${job.label}`;
|
|
25
|
+
if (job.kind === 'ended')
|
|
26
|
+
closeLast(open, started);
|
|
27
|
+
if (job.kind !== 'started')
|
|
28
|
+
closeLast(open, schedule);
|
|
29
|
+
if (job.kind === 'ended')
|
|
30
|
+
return;
|
|
31
|
+
const kept = opened(job, job.kind === 'started' ? started : schedule);
|
|
32
|
+
if (kept !== null)
|
|
33
|
+
open.push(kept);
|
|
34
|
+
}
|
|
35
|
+
export function openJobs(markers) {
|
|
36
|
+
const open = [];
|
|
37
|
+
for (const { said, at } of markers) {
|
|
38
|
+
markerMoved(open, said, (job, key) => job.kind === 'started' ? { key, name: job.label, started: at } : null);
|
|
39
|
+
}
|
|
40
|
+
return open.map(({ name, started }) => ({ name, started }));
|
|
41
|
+
}
|
|
42
|
+
export function jobsRunning(jobs, now) {
|
|
43
|
+
return jobs.map((job) => {
|
|
44
|
+
const since = Date.parse(job.running_since);
|
|
45
|
+
const ran = Number.isNaN(since) ? 0 : Math.floor((now - since) / MINUTE);
|
|
46
|
+
return ran >= 1 ? `${job.name} (${ran} min)` : job.name;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export function sessionEnded(jobs, now) {
|
|
50
|
+
if (jobs.length === 0)
|
|
51
|
+
return ENDED;
|
|
52
|
+
const counted = jobs.length === 1 ? '1 background job' : `${jobs.length} background jobs`;
|
|
53
|
+
return `${ENDED} ${counted} stopped: ${jobsRunning(jobs, now).join(', ')}`;
|
|
54
|
+
}
|
package/dist/live.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChangeSet } from './change-set.js';
|
|
2
2
|
import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
3
3
|
import type { PendingResult, Plan, QueryCoverage } from './query.js';
|
|
4
|
+
import type { Fail } from './reach.js';
|
|
4
5
|
import type { QueryRoom } from './tables.js';
|
|
5
6
|
export type Cover = {
|
|
6
7
|
coverage: QueryCoverage;
|
|
@@ -9,14 +10,14 @@ export type Cover = {
|
|
|
9
10
|
export type Ran = KeyedResult & {
|
|
10
11
|
readonly current: () => boolean;
|
|
11
12
|
};
|
|
12
|
-
export type Run = (plan: Plan, cover: () => Cover) => Promise<Ran>;
|
|
13
|
+
export type Run = (plan: Plan, cover: () => Promise<Cover>) => Promise<Ran>;
|
|
13
14
|
type Listener = (message: QueryMessage) => void;
|
|
14
|
-
export type LiveQueries = {
|
|
15
|
+
export type LiveQueries<H> = {
|
|
15
16
|
touched(set: ChangeSet): void;
|
|
16
17
|
recover(): void;
|
|
17
|
-
watch(plan: Plan, identity: string, cover: () => Cover, deliver: Listener): () => void;
|
|
18
|
+
watch(plan: Plan, identity: string, cover: (held: H) => Cover, deliver: Listener, failed: Fail): () => void;
|
|
18
19
|
close(): void;
|
|
19
20
|
};
|
|
20
|
-
export declare function createLiveQueries(run: Run): LiveQueries
|
|
21
|
+
export declare function createLiveQueries<H>(run: Run, holding: () => Promise<H>): LiveQueries<H>;
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=live.d.ts.map
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GAAG,aAAa,CAAC;AAE7F,MAAM,MAAM,GAAG,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE5E,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAchD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CACH,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,EACzB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,IAAI,GACX,MAAM,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAmCF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CA4HxF"}
|