@agentshouse/mdruntime 0.1.0-cef5833f6c689 → 0.1.0-cefb421089d74
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 +21 -19
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +299 -0
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +26 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +321 -0
- package/dist/adapter.d.ts +150 -81
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +20 -60
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/binary.d.ts +4 -0
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +9 -2
- package/dist/bootstrap.d.ts +9 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +204 -86
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +5 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +7 -2
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +11 -0
- package/dist/client.d.ts +35 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -62
- package/dist/collection.d.ts +26 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +28 -10
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +7 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +217 -83
- package/dist/connection.d.ts +6 -142
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +113 -5178
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +149 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +259 -0
- package/dist/conversation-row.d.ts +40 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +66 -0
- package/dist/conversation.d.ts +64 -45
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +998 -883
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +12 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +175 -0
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +20 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +14 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +47 -17
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +8 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +199 -0
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +24 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +95 -23
- package/dist/house-query.d.ts +15 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +43 -0
- package/dist/index.d.ts +36 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/install.d.ts +60 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +290 -0
- package/dist/listing.d.ts +60 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +168 -0
- package/dist/live.d.ts +8 -6
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +110 -31
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +34 -0
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +49 -0
- package/dist/media.d.ts +20 -4
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +170 -36
- package/dist/memory.d.ts +11 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +133 -32
- package/dist/messages.d.ts +38 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +105 -25
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +5 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -11
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +153 -0
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +217 -85
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +69 -0
- package/dist/outcome.d.ts +28 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +35 -2
- package/dist/overlay.d.ts +7 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +48 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +6 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +36 -0
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +22 -0
- package/dist/preparation.d.ts +46 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +344 -0
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +287 -0
- package/dist/query.d.ts +10 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +30 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +117 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +20 -9
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +323 -120
- package/dist/react.d.ts +18 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -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 +20 -5
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -10
- package/dist/reads.d.ts +39 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +178 -0
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +40 -9
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +10 -22
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +55 -0
- package/dist/replica.d.ts +10 -16
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +65 -35
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +31 -8
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +273 -66
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +220 -0
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +16 -6
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +51 -60
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +35 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -86
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +332 -228
- package/dist/saves.d.ts +34 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +457 -0
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -1
- package/dist/shared.d.ts +1 -6
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -95
- package/dist/shown.d.ts +35 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +326 -0
- 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/lanes.d.ts +28 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +103 -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/session.d.ts +41 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +26 -0
- package/dist/socket.d.ts +68 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +165 -0
- package/dist/source.d.ts +59 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +93 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +40 -0
- package/dist/store/readiness.d.ts +11 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +68 -0
- package/dist/store/records.d.ts +227 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +468 -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/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -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 +116 -151
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +174 -393
- package/dist/stored.d.ts +80 -68
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +410 -168
- package/dist/surface.d.ts +94 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +255 -0
- package/dist/sync.d.ts +21 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +557 -0
- package/dist/tables.d.ts +112 -88
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +192 -279
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +128 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +6 -12
- package/dist/wire.d.ts +81 -7
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +31 -9
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/job.d.ts +0 -14
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -28
- package/dist/log.d.ts +0 -5
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/observation.js
CHANGED
|
@@ -6,49 +6,198 @@ export function rowsOf(result) {
|
|
|
6
6
|
export function whole(message) {
|
|
7
7
|
return 'result' in message;
|
|
8
8
|
}
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const kept =
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
export function pendingChange(message) {
|
|
10
|
+
return 'pending' in message;
|
|
11
|
+
}
|
|
12
|
+
export function unchanged(change) {
|
|
13
|
+
return change.changed.length === 0 && change.removed.length === 0 && change.order === null;
|
|
14
|
+
}
|
|
15
|
+
export function keyedChange(held, keys, rows, same) {
|
|
16
|
+
const present = new Set(keys);
|
|
17
|
+
const changed = keys.flatMap((key, at) => {
|
|
18
|
+
const was = held.get(key);
|
|
19
|
+
return was !== undefined && same(was, rows[at]) ? [] : [[key, rows[at]]];
|
|
20
|
+
});
|
|
21
|
+
const removed = [];
|
|
22
|
+
const kept = [];
|
|
23
|
+
for (const key of held.keys())
|
|
24
|
+
(present.has(key) ? kept : removed).push(key);
|
|
25
|
+
const moved = kept.length !== keys.length || kept.some((key, at) => keys[at] !== key);
|
|
26
|
+
return { changed, removed, order: moved ? keys : null };
|
|
27
|
+
}
|
|
28
|
+
export function keyedAt(held, at, same) {
|
|
29
|
+
const changed = [];
|
|
30
|
+
const removed = [];
|
|
31
|
+
for (const [key, now] of at) {
|
|
32
|
+
const was = held.get(key);
|
|
33
|
+
if (was === undefined) {
|
|
34
|
+
if (now !== null)
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
else if (now === null)
|
|
38
|
+
removed.push(key);
|
|
39
|
+
else if (!same(was, now))
|
|
40
|
+
changed.push([key, now]);
|
|
41
|
+
}
|
|
42
|
+
return { changed, removed, order: null };
|
|
43
|
+
}
|
|
44
|
+
export function keyedInto(held, change) {
|
|
45
|
+
for (const key of change.removed)
|
|
46
|
+
held.delete(key);
|
|
47
|
+
for (const [key, row] of change.changed)
|
|
48
|
+
held.set(key, row);
|
|
49
|
+
if (change.order === null)
|
|
50
|
+
return;
|
|
51
|
+
const placed = change.order.map((key) => [key, held.get(key)]);
|
|
52
|
+
held.clear();
|
|
53
|
+
for (const [key, row] of placed)
|
|
54
|
+
held.set(key, row);
|
|
55
|
+
}
|
|
56
|
+
export function samePending(was, now) {
|
|
57
|
+
return was.awaits === now.awaits;
|
|
58
|
+
}
|
|
59
|
+
function keyedRows(keys, rows) {
|
|
60
|
+
const held = new Map(keys.map((key, at) => [key, rows[at]]));
|
|
61
|
+
let shown = rows;
|
|
62
|
+
return {
|
|
63
|
+
rows: () => shown,
|
|
64
|
+
apply(change) {
|
|
65
|
+
if (unchanged(change))
|
|
66
|
+
return shown;
|
|
67
|
+
keyedInto(held, change);
|
|
68
|
+
shown = [...held.values()];
|
|
69
|
+
return shown;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function heldModels(held, sent) {
|
|
74
|
+
return new Map(Object.entries(sent).map(([key, types]) => [key, held.get(key) ?? types]));
|
|
75
|
+
}
|
|
76
|
+
function namedModels(models, rooms) {
|
|
77
|
+
const named = new Set(rooms.flatMap(({ model, typedSelection }) => [model.types, typedSelection?.model.types]));
|
|
78
|
+
return new Map([...models].filter(([, types]) => named.has(types)));
|
|
79
|
+
}
|
|
80
|
+
function typed(model, models) {
|
|
81
|
+
return model.types === null ? model : { ...model, types: models.get(model.types) };
|
|
82
|
+
}
|
|
83
|
+
function appRoom({ model, typedSelection, ...room }, models) {
|
|
84
|
+
return {
|
|
85
|
+
...room,
|
|
86
|
+
model: typed(model, models),
|
|
87
|
+
typedSelection: typedSelection === null
|
|
88
|
+
? null
|
|
89
|
+
: { roots: typedSelection.roots, model: typed(typedSelection.model, models) },
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export function appRooms({ rooms, models }) {
|
|
93
|
+
const held = heldModels(new Map(), models);
|
|
94
|
+
return rooms.map((room) => appRoom(room, held));
|
|
95
|
+
}
|
|
96
|
+
function keyedRooms(first) {
|
|
97
|
+
let models = new Map();
|
|
98
|
+
let held = keyedRows([], []);
|
|
99
|
+
const whole = (listed) => {
|
|
100
|
+
models = heldModels(models, listed.models);
|
|
101
|
+
held = keyedRows(listed.rooms.map(({ locator }) => locator), listed.rooms.map((room) => appRoom(room, models)));
|
|
102
|
+
return held.rows();
|
|
29
103
|
};
|
|
30
104
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
105
|
+
value: whole(first),
|
|
106
|
+
next(message) {
|
|
107
|
+
if ('rooms' in message)
|
|
108
|
+
return whole(message);
|
|
109
|
+
const change = message;
|
|
110
|
+
const sent = heldModels(models, change.models);
|
|
111
|
+
const rows = held.apply({
|
|
112
|
+
changed: change.changed.map(([locator, room]) => [locator, appRoom(room, sent)]),
|
|
113
|
+
removed: change.removed,
|
|
114
|
+
order: change.order,
|
|
115
|
+
});
|
|
116
|
+
models = namedModels(new Map([...models, ...sent]), rows);
|
|
117
|
+
return rows;
|
|
118
|
+
},
|
|
35
119
|
};
|
|
36
120
|
}
|
|
121
|
+
function covered(readiness) {
|
|
122
|
+
return keyedRows(readiness.coverage.rooms.map(({ room }) => room), readiness.coverage.rooms);
|
|
123
|
+
}
|
|
124
|
+
function keyedReadiness(first) {
|
|
125
|
+
let held = covered(first);
|
|
126
|
+
return {
|
|
127
|
+
value: first,
|
|
128
|
+
next(message) {
|
|
129
|
+
if (!('shown' in message)) {
|
|
130
|
+
held = covered(message);
|
|
131
|
+
return message;
|
|
132
|
+
}
|
|
133
|
+
const { shown, rooms } = message;
|
|
134
|
+
return { ...shown, coverage: { ...shown.coverage, rooms: held.apply(rooms) } };
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function awaiting(pending) {
|
|
139
|
+
return keyedRows(pending.map(({ room }) => room), pending);
|
|
140
|
+
}
|
|
37
141
|
function keyedResult(first) {
|
|
38
|
-
let
|
|
142
|
+
let result = first.result;
|
|
143
|
+
let rows = keyedRows([], []);
|
|
144
|
+
let pending = awaiting([]);
|
|
145
|
+
const take = ({ result: next, keys }) => {
|
|
146
|
+
result = next;
|
|
147
|
+
if ('pending' in next)
|
|
148
|
+
pending = awaiting(next.pending);
|
|
149
|
+
else
|
|
150
|
+
rows = keyedRows(keys, rowsOf(next));
|
|
151
|
+
return result;
|
|
152
|
+
};
|
|
153
|
+
take(first);
|
|
39
154
|
return {
|
|
40
155
|
value: first.result,
|
|
41
156
|
next(message) {
|
|
42
|
-
|
|
43
|
-
|
|
157
|
+
const asked = message;
|
|
158
|
+
if (whole(asked))
|
|
159
|
+
return take(asked);
|
|
160
|
+
if (pendingChange(asked)) {
|
|
161
|
+
if ('pending' in result)
|
|
162
|
+
result = { pending: pending.apply(asked.pending) };
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
if ('pending' in result)
|
|
166
|
+
return result;
|
|
167
|
+
const kept = rows.apply(asked);
|
|
168
|
+
const coverage = asked.coverage ?? result.coverage;
|
|
169
|
+
const next = asked.next === undefined ? result.next : (asked.next ?? undefined);
|
|
170
|
+
const total = asked.total ?? result.total;
|
|
171
|
+
const window = {
|
|
172
|
+
...(next === undefined ? {} : { next }),
|
|
173
|
+
...(total === undefined ? {} : { total }),
|
|
174
|
+
};
|
|
175
|
+
result =
|
|
176
|
+
'groups' in result
|
|
177
|
+
? { groups: kept, coverage, ...window }
|
|
178
|
+
: { documents: kept, coverage, ...window };
|
|
179
|
+
return result;
|
|
44
180
|
},
|
|
45
181
|
};
|
|
46
182
|
}
|
|
183
|
+
const FOLDS = {
|
|
184
|
+
query: (first) => keyedResult(first),
|
|
185
|
+
rooms: (first) => keyedRooms(first),
|
|
186
|
+
readiness: (first) => keyedReadiness(first),
|
|
187
|
+
};
|
|
188
|
+
const WHOLE = {
|
|
189
|
+
query: (message) => whole(message),
|
|
190
|
+
rooms: (message) => 'rooms' in message,
|
|
191
|
+
readiness: (message) => !('shown' in message),
|
|
192
|
+
};
|
|
193
|
+
export function replaces(topic, message) {
|
|
194
|
+
return WHOLE[topic]?.(message) ?? true;
|
|
195
|
+
}
|
|
47
196
|
function replaced(first) {
|
|
48
197
|
return { value: first, next: (message) => message };
|
|
49
198
|
}
|
|
50
|
-
export function observed(first, stop,
|
|
51
|
-
const reducer =
|
|
199
|
+
export function observed(first, stop, topic) {
|
|
200
|
+
const reducer = (FOLDS[topic] ?? replaced)(first);
|
|
52
201
|
let value = reducer.value;
|
|
53
202
|
let open = true;
|
|
54
203
|
const listeners = new Set();
|
|
@@ -86,34 +235,29 @@ export function observed(first, stop, keyed) {
|
|
|
86
235
|
end,
|
|
87
236
|
};
|
|
88
237
|
}
|
|
89
|
-
export function opened(watch,
|
|
238
|
+
export function opened(watch, topic) {
|
|
90
239
|
return new Promise((resolve, reject) => {
|
|
91
240
|
let handle;
|
|
92
241
|
let stop = () => { };
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
stop();
|
|
105
|
-
reject(error);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
242
|
+
stop = watch((message) => {
|
|
243
|
+
if (handle !== undefined) {
|
|
244
|
+
handle.receive(message);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
handle = observed(message, () => stop(), topic);
|
|
248
|
+
resolve(handle.observation);
|
|
249
|
+
}, (error) => {
|
|
250
|
+
if (handle !== undefined)
|
|
251
|
+
return;
|
|
252
|
+
stop();
|
|
109
253
|
reject(error);
|
|
110
|
-
}
|
|
254
|
+
});
|
|
111
255
|
});
|
|
112
256
|
}
|
|
113
257
|
export function observing(watch) {
|
|
114
258
|
return (topic, ...input) => opened((deliver, fail) => watch(topic, input, (message) => {
|
|
115
259
|
deliver(structuredClone(message));
|
|
116
|
-
}, fail), topic
|
|
260
|
+
}, fail), topic);
|
|
117
261
|
}
|
|
118
262
|
export function hashed(text) {
|
|
119
263
|
let first = 0xdeadbeef;
|
|
@@ -134,10 +278,9 @@ function rowDigest(row) {
|
|
|
134
278
|
}
|
|
135
279
|
export function digestOf({ result, keys }) {
|
|
136
280
|
if ('pending' in result)
|
|
137
|
-
return { pending:
|
|
281
|
+
return { pending: new Map(result.pending.map((room) => [room.room, room])) };
|
|
138
282
|
const rows = rowsOf(result);
|
|
139
283
|
return {
|
|
140
|
-
keys,
|
|
141
284
|
rows: new Map(keys.map((key, index) => [key, rowDigest(rows[index])])),
|
|
142
285
|
coverage: JSON.stringify(result.coverage),
|
|
143
286
|
next: result.next,
|
|
@@ -145,16 +288,22 @@ export function digestOf({ result, keys }) {
|
|
|
145
288
|
};
|
|
146
289
|
}
|
|
147
290
|
export function digestApplied(digest, message) {
|
|
148
|
-
if (whole(message)
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
291
|
+
if (whole(message))
|
|
292
|
+
return digestOf(message);
|
|
293
|
+
if (pendingChange(message)) {
|
|
294
|
+
if ('pending' in digest)
|
|
295
|
+
keyedInto(digest.pending, message.pending);
|
|
296
|
+
return digest;
|
|
297
|
+
}
|
|
298
|
+
if ('pending' in digest)
|
|
299
|
+
return digest;
|
|
300
|
+
keyedInto(digest.rows, {
|
|
301
|
+
changed: message.changed.map(([key, row]) => [key, rowDigest(row)]),
|
|
302
|
+
removed: message.removed,
|
|
303
|
+
order: message.order,
|
|
304
|
+
});
|
|
155
305
|
return {
|
|
156
|
-
|
|
157
|
-
rows,
|
|
306
|
+
rows: digest.rows,
|
|
158
307
|
coverage: message.coverage === undefined ? digest.coverage : JSON.stringify(message.coverage),
|
|
159
308
|
next: message.next === undefined ? digest.next : (message.next ?? undefined),
|
|
160
309
|
total: message.total ?? digest.total,
|
|
@@ -162,35 +311,18 @@ export function digestApplied(digest, message) {
|
|
|
162
311
|
}
|
|
163
312
|
export function changeOf(previous, next) {
|
|
164
313
|
const after = next.result;
|
|
165
|
-
if ('pending' in previous
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
: next;
|
|
314
|
+
if ('pending' in previous && 'pending' in after) {
|
|
315
|
+
const pending = keyedChange(previous.pending, after.pending.map(({ room }) => room), after.pending, samePending);
|
|
316
|
+
return unchanged(pending) ? null : { pending };
|
|
169
317
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const row = later[index];
|
|
175
|
-
if (previous.rows.get(key) !== rowDigest(row))
|
|
176
|
-
changed.push([key, row]);
|
|
177
|
-
});
|
|
178
|
-
const removed = previous.keys.filter((key) => !present.has(key));
|
|
179
|
-
const kept = previous.keys.filter((key) => present.has(key));
|
|
180
|
-
const moved = kept.length !== next.keys.length || kept.some((key, index) => next.keys[index] !== key);
|
|
181
|
-
const coverage = JSON.stringify(after.coverage);
|
|
182
|
-
const covered = previous.coverage !== coverage;
|
|
318
|
+
if ('pending' in previous || 'pending' in after)
|
|
319
|
+
return next;
|
|
320
|
+
const rows = keyedChange(previous.rows, next.keys, rowsOf(after), (was, row) => was === rowDigest(row));
|
|
321
|
+
const covered = previous.coverage !== JSON.stringify(after.coverage);
|
|
183
322
|
const framing = reframed(previous, after);
|
|
184
|
-
if (
|
|
323
|
+
if (unchanged(rows) && !covered && framing === null)
|
|
185
324
|
return null;
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
changed,
|
|
189
|
-
removed,
|
|
190
|
-
order: moved ? next.keys : null,
|
|
191
|
-
...(covered ? { coverage: after.coverage } : {}),
|
|
192
|
-
...framing,
|
|
193
|
-
};
|
|
325
|
+
return { ...rows, ...(covered ? { coverage: after.coverage } : {}), ...framing };
|
|
194
326
|
}
|
|
195
327
|
function reframed(before, after) {
|
|
196
328
|
const next = before.next === after.next ? {} : { next: after.next ?? null };
|
package/dist/online.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Authorization } from './adapter.js';
|
|
2
|
+
import type { Runtime } from './runtime.js';
|
|
3
|
+
export declare function offline(runtime: Runtime): Promise<boolean>;
|
|
4
|
+
export declare function askedOnline<T extends {
|
|
5
|
+
readonly kind: string;
|
|
6
|
+
}>(runtime: Runtime, ask: (authorization: Authorization) => Promise<T>): Promise<T | null>;
|
|
7
|
+
//# sourceMappingURL=online.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"online.d.ts","sourceRoot":"","sources":["../src/online.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAOhE;AAED,wBAAsB,WAAW,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACnE,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAgBnB"}
|
package/dist/online.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { connectionNow } from './preparation.js';
|
|
2
|
+
import { refuse } from './refusal.js';
|
|
3
|
+
export async function offline(runtime) {
|
|
4
|
+
const { socket } = runtime;
|
|
5
|
+
return (socket.closed() ||
|
|
6
|
+
socket.session.now().refusal !== null ||
|
|
7
|
+
(await connectionNow(runtime)) !== 'connected');
|
|
8
|
+
}
|
|
9
|
+
export async function askedOnline(runtime, ask) {
|
|
10
|
+
const { socket } = runtime;
|
|
11
|
+
try {
|
|
12
|
+
await socket.authorize();
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const { closed, authorization, refusal } = socket.session.now();
|
|
18
|
+
if (closed || authorization === undefined || refusal !== null)
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
const answer = await ask(authorization);
|
|
22
|
+
if (answer.kind === 'revoked-authorization')
|
|
23
|
+
await refuse(runtime, 'revoked-authorization');
|
|
24
|
+
return answer;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/opened.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export type OpenedFiles = {
|
|
|
18
18
|
find(name: OpenedName): Promise<KeptBinary | null>;
|
|
19
19
|
fetch(name: OpenedName, read: () => Promise<BinaryResult>): Promise<KeptResult>;
|
|
20
20
|
};
|
|
21
|
-
export declare function openedFiles(database: RuntimeDatabase,
|
|
21
|
+
export declare function openedFiles(database: RuntimeDatabase, lost: (locator: string) => boolean): OpenedFiles;
|
|
22
22
|
//# sourceMappingURL=opened.d.ts.map
|
package/dist/opened.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opened.d.ts","sourceRoot":"","sources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,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAEhF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACjF,CAAC;AAsBF,wBAAgB,WAAW,CACzB,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACjC,WAAW,CAsFb"}
|
package/dist/opened.js
CHANGED
|
@@ -20,7 +20,7 @@ function taken(chunks, size) {
|
|
|
20
20
|
}
|
|
21
21
|
return part;
|
|
22
22
|
}
|
|
23
|
-
export function openedFiles(database,
|
|
23
|
+
export function openedFiles(database, lost) {
|
|
24
24
|
const fetching = new Map();
|
|
25
25
|
async function find(name) {
|
|
26
26
|
const held = await database.ask({ kind: 'opened.find', ...name });
|
|
@@ -36,14 +36,14 @@ export function openedFiles(database, fenced) {
|
|
|
36
36
|
let part = 0;
|
|
37
37
|
const write = async (bytes) => {
|
|
38
38
|
if (!(await database.ask({ kind: 'opened.part', key, part, bytes }))) {
|
|
39
|
-
throw new Error(
|
|
39
|
+
throw new Error();
|
|
40
40
|
}
|
|
41
41
|
part += 1;
|
|
42
42
|
};
|
|
43
43
|
try {
|
|
44
|
-
if (
|
|
44
|
+
if (lost(name.locator) ||
|
|
45
45
|
!(await database.ask({ kind: 'opened.begin', key, ...name, mediaType }))) {
|
|
46
|
-
throw new Error(
|
|
46
|
+
throw new Error();
|
|
47
47
|
}
|
|
48
48
|
for (;;) {
|
|
49
49
|
const read = await reader.read();
|
|
@@ -61,7 +61,7 @@ export function openedFiles(database, fenced) {
|
|
|
61
61
|
await write(taken(chunks, held));
|
|
62
62
|
const received = hashed.hex();
|
|
63
63
|
if (sha256 !== undefined && sha256 !== received) {
|
|
64
|
-
throw new Error(
|
|
64
|
+
throw new Error();
|
|
65
65
|
}
|
|
66
66
|
const whole = await database.ask({
|
|
67
67
|
kind: 'opened.keep',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../src/opening.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAsCxF"}
|
package/dist/opening.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { conversationsOpened } from './conversation.js';
|
|
2
|
+
import { detectStorageLoss, nextGeneration, refusedForSpace } from './durability.js';
|
|
3
|
+
import { uncaught } from './failure.js';
|
|
4
|
+
import { sweep } from './install.js';
|
|
5
|
+
import { eraseFenced } from './lost.js';
|
|
6
|
+
import { prepare } from './preparation.js';
|
|
7
|
+
import { unpair } from './queue.js';
|
|
8
|
+
import { emitRooms, emitStorageLoss, statusShown } from './shown.js';
|
|
9
|
+
export async function open(runtime, opened) {
|
|
10
|
+
const { store, socket, shell, conversations, build } = runtime;
|
|
11
|
+
if (socket.closed())
|
|
12
|
+
throw new Error('runtime closed');
|
|
13
|
+
const interrupted = await opened.fences();
|
|
14
|
+
const kept = shell.generation;
|
|
15
|
+
const storedGeneration = await opened.generation();
|
|
16
|
+
const loss = detectStorageLoss(storedGeneration, kept);
|
|
17
|
+
const generation = nextGeneration(storedGeneration, kept);
|
|
18
|
+
if (generation !== storedGeneration)
|
|
19
|
+
await opened.rememberGeneration(generation);
|
|
20
|
+
if (generation !== kept)
|
|
21
|
+
await shell.keepGeneration(generation);
|
|
22
|
+
if (loss !== null) {
|
|
23
|
+
store.device.set({ storageLoss: loss });
|
|
24
|
+
emitStorageLoss(runtime);
|
|
25
|
+
}
|
|
26
|
+
const held = await opened.opened();
|
|
27
|
+
store.device.set({
|
|
28
|
+
completedWhenOpened: (await opened.facts(['lastCompleted'])).lastCompleted !== null,
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
await opened.demote();
|
|
32
|
+
await store.ask({ kind: 'read.builds', build });
|
|
33
|
+
for (const key of held.orphans)
|
|
34
|
+
await opened.release(key);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (!refusedForSpace(error))
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (held.erasing || held.orphans.length > 0)
|
|
41
|
+
queueMicrotask(() => sweep(runtime));
|
|
42
|
+
await conversationsOpened(conversations, opened);
|
|
43
|
+
if (interrupted.length > 0) {
|
|
44
|
+
queueMicrotask(() => {
|
|
45
|
+
void eraseFenced(runtime, interrupted).catch(uncaught);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
await factsKept(runtime, opened);
|
|
49
|
+
statusShown(runtime);
|
|
50
|
+
prepare(runtime);
|
|
51
|
+
emitRooms(runtime);
|
|
52
|
+
void unpair(runtime).catch(uncaught);
|
|
53
|
+
return opened;
|
|
54
|
+
}
|
|
55
|
+
async function factsKept({ socket, adopt }, opened) {
|
|
56
|
+
const { session } = socket;
|
|
57
|
+
const { unstored } = session.now();
|
|
58
|
+
if (unstored !== null) {
|
|
59
|
+
queueMicrotask(() => {
|
|
60
|
+
void adopt(unstored).catch(uncaught);
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const { capabilities, queriesOnly } = await opened.facts(['capabilities', 'queriesOnly']);
|
|
65
|
+
if (queriesOnly.length > 0 && !session.now().roomsNamed)
|
|
66
|
+
session.set({ queriesOnly });
|
|
67
|
+
if (capabilities.length > 0)
|
|
68
|
+
socket.readyFromStore();
|
|
69
|
+
}
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, AttachResult, BinaryCopy, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
3
4
|
import type { KeptBinary, KeptResult } from './opened.js';
|
|
4
5
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
5
6
|
kind: Kind;
|
|
@@ -13,7 +14,9 @@ export type CallResult = {
|
|
|
13
14
|
kind: 'action';
|
|
14
15
|
result: unknown;
|
|
15
16
|
at?: RoomVersionAt;
|
|
16
|
-
} | Refused<'rejected'>
|
|
17
|
+
} | (Refused<'rejected'> & {
|
|
18
|
+
reset?: string;
|
|
19
|
+
}) | Refused<'undeclared'> | Failure;
|
|
17
20
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
18
21
|
kind: Failure['kind'];
|
|
19
22
|
}> | Failure;
|
|
@@ -31,12 +34,24 @@ export type BinaryLinkAnswer = {
|
|
|
31
34
|
name: string;
|
|
32
35
|
mediaType: string;
|
|
33
36
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
34
|
-
export type
|
|
35
|
-
|
|
37
|
+
export type ShownLinkAnswer = Extract<BinaryLinkAnswer, {
|
|
38
|
+
kind: 'link';
|
|
39
|
+
}> & {
|
|
40
|
+
copies: readonly BinaryCopy[];
|
|
41
|
+
};
|
|
42
|
+
type ShownRefusal = Exclude<BinaryLinkAnswer, {
|
|
43
|
+
kind: 'link';
|
|
44
|
+
}>;
|
|
45
|
+
export type HeldShownAnswer = KeptBinary | ShownLinkAnswer | ShownRefusal;
|
|
46
|
+
export type ShownAnswer = BinaryAnswer | ShownLinkAnswer | ShownRefusal;
|
|
36
47
|
export type AttachAnswer = {
|
|
37
48
|
kind: 'attached';
|
|
38
49
|
path: string;
|
|
39
50
|
} | Offline | Refused<'rejected'> | Failure;
|
|
51
|
+
export type ConversationAttachAnswer = {
|
|
52
|
+
kind: 'attached';
|
|
53
|
+
link: string;
|
|
54
|
+
} | Offline | Refused<'rejected'> | Refused<'undeclared'> | Failure;
|
|
40
55
|
export type DownloadAnswer = {
|
|
41
56
|
kind: 'started';
|
|
42
57
|
} | Refused<'rejected'> | Refused<'absent'> | Refused<'blocked'> | Failure;
|
|
@@ -54,9 +69,14 @@ export declare const UNREADABLE: Refused<'unreadable'>;
|
|
|
54
69
|
export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
55
70
|
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
56
71
|
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
72
|
+
export declare function declaredType(blob: Blob): string;
|
|
73
|
+
export declare function blobOf(binary: Extract<BinaryAnswer, {
|
|
74
|
+
kind: 'binary';
|
|
75
|
+
}>): Promise<Blob>;
|
|
57
76
|
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
58
77
|
export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
|
|
59
78
|
export declare function attachAnswer(result: AttachResult): AttachAnswer;
|
|
79
|
+
export declare function linkedAnswer(result: AttachResult): ConversationAttachAnswer;
|
|
60
80
|
export declare const ROOM_LOCKED = "room-locked";
|
|
61
81
|
export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
|
|
62
82
|
locator: string;
|
|
@@ -65,8 +85,9 @@ export type Offline = {
|
|
|
65
85
|
readonly kind: 'offline';
|
|
66
86
|
};
|
|
67
87
|
export declare const OFFLINE: Offline;
|
|
88
|
+
export declare function answeredResult(value: unknown): boolean;
|
|
68
89
|
export declare const UNCERTAIN: Failure;
|
|
69
|
-
export declare function undeclared(name: string):
|
|
90
|
+
export declare function undeclared(name: string): Refused<'undeclared'>;
|
|
70
91
|
export declare function failure(result: AdapterFailure): Failure;
|
|
71
92
|
export declare function calledResult(result: ActionResult): CallResult;
|
|
72
93
|
export declare function historyAnswer(result: HistoryResult): HistoryAnswer;
|
|
@@ -81,5 +102,7 @@ export type QueueEntry = {
|
|
|
81
102
|
} & (Submission | {
|
|
82
103
|
readonly state: 'local';
|
|
83
104
|
});
|
|
105
|
+
export declare const UNANSWERED: ActionResult;
|
|
106
|
+
export declare function handedOutcome(retries: Retries, attempt: Attempt | undefined, result: ActionResult): CallResult;
|
|
84
107
|
export {};
|
|
85
108
|
//# sourceMappingURL=outcome.d.ts.map
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAA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