@agentshouse/mdruntime 0.1.0-c26a54071744b → 0.1.0-c27d511fb284d
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 +18 -16
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -22
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +51 -28
- package/dist/adapter.d.ts +136 -29
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -7
- package/dist/{binary.d.ts → attachment.d.ts} +8 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +15 -0
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +347 -0
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +6 -2
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +2 -4
- package/dist/client.d.ts +20 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -57
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -9
- 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 +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -42
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +14 -14
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +19 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -8
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +29 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +241 -177
- package/dist/declaration.js +3 -3
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +30 -8
- 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 +2 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +25 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +111 -34
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +75 -31
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +102 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +20 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/install.d.ts +9 -3
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +44 -46
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +40 -29
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +181 -34
- package/dist/memory.d.ts +7 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +63 -23
- package/dist/messages.d.ts +17 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +29 -10
- 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 +10 -7
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +5 -8
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- 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 +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +20 -10
- package/dist/outcome.d.ts +30 -13
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +21 -6
- package/dist/overlay.d.ts +20 -9
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +110 -41
- package/dist/parts.d.ts +3 -0
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +31 -5
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +198 -87
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +116 -71
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -1
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +54 -39
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +162 -38
- package/dist/react.d.ts +6 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +23 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +18 -10
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +17 -6
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +5 -5
- package/dist/room-draft.d.ts +29 -4
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +239 -18
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +12 -7
- 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 +11 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +24 -10
- 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 +5 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +107 -57
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +79 -43
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +2 -2
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -9
- package/dist/source.d.ts +7 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +15 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +30 -8
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +70 -26
- 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.d.ts +15 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +12 -5
- package/dist/stored.d.ts +41 -16
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +215 -57
- package/dist/surface.d.ts +13 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +57 -26
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +52 -35
- package/dist/tables.d.ts +28 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +95 -326
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +3 -4
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +50 -10
- package/dist/wire.d.ts +36 -17
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +20 -14
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
- package/dist/binary.js +0 -8
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM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IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC,CAAC;AAmBN,MAAM,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAsM9F,wBAAiB,iBAAiB,CAChC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,YAAY,GACpB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAOtC;AA4ED,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,wBAAiB,WAAW,CAC1B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,YAAY,GACpB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAItC;AA4uCD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,GAAG,IAAI,CAKxF;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE7F"}
|
package/dist/save.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { apply, ARRAY_INDEX, ATTACHMENT, create,
|
|
2
|
-
import { immutable, leaving, queuedFile, departure, } from './change.js';
|
|
3
|
-
import { collectionOf, definitionsAt, documentsOf, governing, } from './collection.js';
|
|
1
|
+
import { apply, ARRAY_INDEX, ATTACHMENT, create, links, parse, pointerSegments, references, relative, relativize, retarget, roomReferences, serialize, target, } from '@agentshouse/mdmodel';
|
|
2
|
+
import { immutable, isPart, leaving, queuedFile, departure, } from './change.js';
|
|
3
|
+
import { collectionOf, definitionsAt, documentsOf, governing, typeAt, UNTYPED, } from './collection.js';
|
|
4
4
|
import { changeBatchIdentity, roomDraftRevision } from './identity.js';
|
|
5
5
|
import { composed, overlaying } from './overlay.js';
|
|
6
6
|
import { ancestors } from './paths.js';
|
|
7
7
|
import { entriesIn, sorting } from './shared.js';
|
|
8
|
-
import { changedParts, changesOf, moveTarget, withdrawnDrafts, } from './room-draft.js';
|
|
8
|
+
import { applyParts, changedParts, changesOf, moveTarget, partsBetween, withdrawnDrafts, } from './room-draft.js';
|
|
9
9
|
import { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
10
10
|
import { validatedCollection } from './validation.js';
|
|
11
11
|
function refuse(code, file, location, line) {
|
|
@@ -52,48 +52,6 @@ function repointed(document, definition, from, to, moves, settled) {
|
|
|
52
52
|
const next = applied.document;
|
|
53
53
|
return [...names].map((name) => ({ kind: 'field', path: from, name, value: next.fields[name] }));
|
|
54
54
|
}
|
|
55
|
-
function edited(document, changes, definition) {
|
|
56
|
-
const parts = new Map();
|
|
57
|
-
for (const change of changes) {
|
|
58
|
-
if (change.kind === 'field')
|
|
59
|
-
parts.set(`field ${change.name}`, {
|
|
60
|
-
kind: 'field',
|
|
61
|
-
name: change.name,
|
|
62
|
-
value: change.value,
|
|
63
|
-
prior: document.fields[change.name],
|
|
64
|
-
});
|
|
65
|
-
if (change.kind === 'preamble')
|
|
66
|
-
parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
|
|
67
|
-
if (change.kind === 'section')
|
|
68
|
-
parts.set(`section ${change.name}`, {
|
|
69
|
-
kind: 'section',
|
|
70
|
-
name: change.name,
|
|
71
|
-
value: change.value,
|
|
72
|
-
prior: document.sections[change.name] ?? '',
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
if (parts.size === 0)
|
|
76
|
-
return document;
|
|
77
|
-
const applied = apply(document, [...parts.values()], definition);
|
|
78
|
-
return applied.outcome === 'applied' ? applied.document : document;
|
|
79
|
-
}
|
|
80
|
-
function bodies(path, before, after) {
|
|
81
|
-
const changes = [];
|
|
82
|
-
for (const [name, value] of Object.entries(after.fields)) {
|
|
83
|
-
if (equalValue(before.fields[name], value))
|
|
84
|
-
continue;
|
|
85
|
-
changes.push({ kind: 'field', path, name, value });
|
|
86
|
-
}
|
|
87
|
-
if (after.preamble !== before.preamble) {
|
|
88
|
-
changes.push({ kind: 'preamble', path, value: after.preamble });
|
|
89
|
-
}
|
|
90
|
-
for (const [name, value] of Object.entries(after.sections)) {
|
|
91
|
-
if (before.sections[name] === value)
|
|
92
|
-
continue;
|
|
93
|
-
changes.push({ kind: 'section', path, name, value });
|
|
94
|
-
}
|
|
95
|
-
return changes;
|
|
96
|
-
}
|
|
97
55
|
function relinks(path, moved, before, moves, definition) {
|
|
98
56
|
const changes = [];
|
|
99
57
|
for (const link of links(before, path)) {
|
|
@@ -116,7 +74,7 @@ function relinks(path, moved, before, moves, definition) {
|
|
|
116
74
|
if (before.type === undefined) {
|
|
117
75
|
return { kind: 'changes', changes: [{ kind: 'replace', path, content: serialize(after) }] };
|
|
118
76
|
}
|
|
119
|
-
return { kind: 'changes', changes:
|
|
77
|
+
return { kind: 'changes', changes: partsBetween(path, before, after) };
|
|
120
78
|
}
|
|
121
79
|
function partKey(change) {
|
|
122
80
|
return change.kind === 'section' || change.kind === 'field'
|
|
@@ -168,9 +126,10 @@ function* rewrites(changes, visible) {
|
|
|
168
126
|
const repointing = repointed(document, definition, path, moved, moves, settled);
|
|
169
127
|
added.push(...repointing);
|
|
170
128
|
const own = parts.get(path) ?? [];
|
|
129
|
+
const edited = applyParts(document, own.map((index) => merged[index]), definition);
|
|
171
130
|
const relinked = moved === path && own.length === 0 && cannotLink(document.content, names)
|
|
172
131
|
? { kind: 'changes', changes: [] }
|
|
173
|
-
: relinks(path, moved, edited
|
|
132
|
+
: relinks(path, moved, edited.outcome === 'applied' ? edited.document : document, moves, definition);
|
|
174
133
|
if (relinked.kind === 'refused')
|
|
175
134
|
return relinked;
|
|
176
135
|
const keyed = new Map();
|
|
@@ -248,7 +207,7 @@ function rewritten(path, document, changes, definition) {
|
|
|
248
207
|
const after = applied.document;
|
|
249
208
|
if (document.type === undefined)
|
|
250
209
|
return [{ kind: 'replace', path, content: serialize(after) }];
|
|
251
|
-
return
|
|
210
|
+
return partsBetween(path, document, after);
|
|
252
211
|
}
|
|
253
212
|
function roomPathOf(handle, path) {
|
|
254
213
|
return `/rooms/${handle}/${path}`;
|
|
@@ -458,7 +417,7 @@ function* preconditionsOf(changes, visible, bases) {
|
|
|
458
417
|
};
|
|
459
418
|
for (const change of changes) {
|
|
460
419
|
yield ROW_WEIGHT;
|
|
461
|
-
if (change
|
|
420
|
+
if (isPart(change)) {
|
|
462
421
|
const based = bases.find((base) => sameTarget(base, change));
|
|
463
422
|
if (based !== undefined) {
|
|
464
423
|
add(based);
|
|
@@ -613,9 +572,6 @@ function relativeChange(change, input) {
|
|
|
613
572
|
function unqueueable(file) {
|
|
614
573
|
return refuse('unknown-revision', file);
|
|
615
574
|
}
|
|
616
|
-
function isPart(change) {
|
|
617
|
-
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
618
|
-
}
|
|
619
575
|
function touched(change) {
|
|
620
576
|
return change.kind === 'move' ? [change.path, change.to] : [change.path];
|
|
621
577
|
}
|
|
@@ -642,29 +598,7 @@ function unapplied(changes, visible, composition) {
|
|
|
642
598
|
function partsResult(content, path, changes, composition) {
|
|
643
599
|
const definitions = definitionsAt(composition, path);
|
|
644
600
|
const parsed = parse(content, path, definitions);
|
|
645
|
-
|
|
646
|
-
return null;
|
|
647
|
-
const document = parsed.document;
|
|
648
|
-
const parts = new Map();
|
|
649
|
-
for (const change of changes) {
|
|
650
|
-
if (change.kind === 'field')
|
|
651
|
-
parts.set(`field ${change.name}`, {
|
|
652
|
-
kind: 'field',
|
|
653
|
-
name: change.name,
|
|
654
|
-
value: change.value,
|
|
655
|
-
prior: document.fields[change.name],
|
|
656
|
-
});
|
|
657
|
-
else if (change.kind === 'section')
|
|
658
|
-
parts.set(`section ${change.name}`, {
|
|
659
|
-
kind: 'section',
|
|
660
|
-
name: change.name,
|
|
661
|
-
value: change.value,
|
|
662
|
-
prior: document.sections[change.name] ?? '',
|
|
663
|
-
});
|
|
664
|
-
else
|
|
665
|
-
parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
|
|
666
|
-
}
|
|
667
|
-
return apply(document, [...parts.values()], definitions(document.type));
|
|
601
|
+
return parsed.ok ? applyParts(parsed.document, changes, definitions(parsed.document.type)) : null;
|
|
668
602
|
}
|
|
669
603
|
function settledParts(changes, deferred, composition) {
|
|
670
604
|
for (const [held, parts] of deferred) {
|
|
@@ -883,11 +817,8 @@ function* limiting(queue, batch, limits, state) {
|
|
|
883
817
|
const limited = yield* exceeding(limits, batch.changes, rewritten.changes, yield* state(queue.slice(0, at + 1)));
|
|
884
818
|
return limited?.refusal ?? null;
|
|
885
819
|
}
|
|
886
|
-
function
|
|
887
|
-
|
|
888
|
-
return false;
|
|
889
|
-
const parsed = parse(content);
|
|
890
|
-
return parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any';
|
|
820
|
+
function typedContent(composition, path, content) {
|
|
821
|
+
return (content !== undefined && (typeAt(composition, path, parse(content)) ?? UNTYPED) !== UNTYPED);
|
|
891
822
|
}
|
|
892
823
|
function touchedLibrary(resulting, touched, composition) {
|
|
893
824
|
const entries = touched
|
|
@@ -907,9 +838,9 @@ function touchedLibrary(resulting, touched, composition) {
|
|
|
907
838
|
if (binaries.has(path))
|
|
908
839
|
known.set(path, { type: undefined, binary: true });
|
|
909
840
|
else if (content !== undefined && content !== null) {
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
known.set(path, { type
|
|
841
|
+
const type = typeAt(composition, path, parse(content, path, definitionsAt(composition, path)));
|
|
842
|
+
if (type !== undefined)
|
|
843
|
+
known.set(path, { type, binary: false });
|
|
913
844
|
await pace(content.length + ROW_WEIGHT);
|
|
914
845
|
}
|
|
915
846
|
}
|
|
@@ -927,7 +858,7 @@ async function judging(visible, resulting, composition, validate, removed, touch
|
|
|
927
858
|
for (const path of touched) {
|
|
928
859
|
const before = visible.documents[path];
|
|
929
860
|
const after = resulting.documents[path];
|
|
930
|
-
if (
|
|
861
|
+
if (typedContent(composition, path, before) || typedContent(composition, path, after))
|
|
931
862
|
typedPaths.push(path);
|
|
932
863
|
await pace((before?.length ?? 0) + (after?.length ?? 0) + ROW_WEIGHT);
|
|
933
864
|
}
|
|
@@ -1166,7 +1097,7 @@ function unreadable(saved, visible, composition) {
|
|
|
1166
1097
|
const path = saved.find(({ path: at, parts }) => (parts.fields !== undefined ||
|
|
1167
1098
|
parts.sections !== undefined ||
|
|
1168
1099
|
parts.preamble !== undefined) &&
|
|
1169
|
-
|
|
1100
|
+
typedContent(composition, at, visible.documents[at]) &&
|
|
1170
1101
|
governing(composition, at).status === 'unavailable')?.path;
|
|
1171
1102
|
return path === undefined ? null : refuse('model-unavailable', path);
|
|
1172
1103
|
}
|
package/dist/saves.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
2
|
-
import
|
|
2
|
+
import type { ConversationFiles } from './conversation.js';
|
|
3
|
+
import { type AttachAnswer, type AttachmentLinkAnswer, type HeldAttachmentAnswer, type HeldShownAnswer } from './outcome.js';
|
|
3
4
|
import { type RoomDraftParts } from './room-draft.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
5
6
|
import { type SaveRefusal } from './save.js';
|
|
@@ -18,9 +19,9 @@ export type SavedParts = {
|
|
|
18
19
|
readonly path: string;
|
|
19
20
|
readonly parts: RoomDraftParts;
|
|
20
21
|
};
|
|
21
|
-
export type
|
|
22
|
-
read(room: string, path: string, revision?: string): Promise<
|
|
23
|
-
link(room: string, path: string, revision?: string): Promise<
|
|
22
|
+
export type AttachmentSurface = {
|
|
23
|
+
read(room: string, path: string, revision?: string): Promise<HeldAttachmentAnswer>;
|
|
24
|
+
link(room: string, path: string, revision?: string): Promise<AttachmentLinkAnswer>;
|
|
24
25
|
show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
|
|
25
26
|
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
26
27
|
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
@@ -28,5 +29,6 @@ export type BinaryFileSurface = {
|
|
|
28
29
|
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
29
30
|
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
30
31
|
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
31
|
-
export declare function
|
|
32
|
+
export declare function conversationFiles(runtime: Runtime): ConversationFiles;
|
|
33
|
+
export declare function attachmentSurface(runtime: Runtime): AttachmentSurface;
|
|
32
34
|
//# sourceMappingURL=saves.d.ts.map
|
package/dist/saves.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saves.d.ts","sourceRoot":"","sources":["../src/saves.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"saves.d.ts","sourceRoot":"","sources":["../src/saves.ts"],"names":[],"mappings":"AAUA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAI3D,OAAO,EASL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAGzB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAatB,OAAO,EAQL,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC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AChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,OAAO,CAAC,UAAU,CAAC,CAsCrB;AAuBD,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,OAAO,CAAC,UAAU,CAAC,CAyBrB;AAuOD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAK9F;AA+RD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKrE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAQrE"}
|
package/dist/saves.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isImageType, parse } from '@agentshouse/mdmodel';
|
|
2
|
+
import { attachmentRecord } from './attachment.js';
|
|
3
|
+
import { changeSet } from './change-set.js';
|
|
3
4
|
import { queuedFile } from './change.js';
|
|
4
|
-
import { available } from './collection.js';
|
|
5
|
+
import { available, definitionsAt, typeAt } from './collection.js';
|
|
5
6
|
import { runtimeError } from './failure.js';
|
|
6
7
|
import { attachedFile } from './file.js';
|
|
8
|
+
import { roomDraftRevision } from './identity.js';
|
|
7
9
|
import { compositionFor } from './listing.js';
|
|
8
10
|
import { scoped } from './models.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { absentAttachment, attachAnswer, attachmentAnswer, attachmentLinkAnswer, failure, linkedAnswer, OFFLINE, UNCERTAIN, } from './outcome.js';
|
|
12
|
+
import { sameAttachment } from './overlay.js';
|
|
11
13
|
import { ancestors } from './paths.js';
|
|
12
14
|
import { connectionNow } from './preparation.js';
|
|
13
15
|
import { append, sliceAt, withdrawable } from './queue.js';
|
|
14
16
|
import { entryAt, replaying, slicing, } from './replica.js';
|
|
15
|
-
import {
|
|
17
|
+
import { attachmentBase, changesOf, held, heldFile, joinedOver, moveTarget, readSavedParts, } from './room-draft.js';
|
|
16
18
|
import { refuse } from './refusal.js';
|
|
17
19
|
import { visibleOf } from './room-drafts.js';
|
|
18
20
|
import { destination, planSave, } from './save.js';
|
|
@@ -43,9 +45,24 @@ export function saveRoomDrafts(runtime, locator, named, writtenBy) {
|
|
|
43
45
|
if (!saved.some((draft) => draft.path === path))
|
|
44
46
|
saved.push({ path, parts: record.parts });
|
|
45
47
|
}
|
|
46
|
-
|
|
48
|
+
const result = await loaded(runtime, locator, replica, saved, new Set(saved.map(({ path }) => path)), [], writtenBy);
|
|
49
|
+
if (result.outcome !== 'refused' || result.code !== 'changed-underneath')
|
|
50
|
+
return result;
|
|
51
|
+
return joinedUnderneath(runtime, locator, saved.map(({ path }) => drafts.get(path)), result);
|
|
47
52
|
});
|
|
48
53
|
}
|
|
54
|
+
async function joinedUnderneath({ store }, locator, records, refused) {
|
|
55
|
+
const visible = (await visibleOf(store, locator, records.map(({ path }) => path)));
|
|
56
|
+
const joined = records.flatMap((record) => {
|
|
57
|
+
const join = joinedOver(record.parts, record.marks, record.path, visible);
|
|
58
|
+
return join === null ? [] : [{ ...record, ...join, revision: roomDraftRevision() }];
|
|
59
|
+
});
|
|
60
|
+
if (joined.length === 0)
|
|
61
|
+
return refused;
|
|
62
|
+
await (await store.open()).commit({ rooms: [], writes: [{ locator, roomDrafts: joined }] });
|
|
63
|
+
await store.changed(changeSet(locator, { drafts: joined.map(({ path }) => path) }));
|
|
64
|
+
return refused;
|
|
65
|
+
}
|
|
49
66
|
export function saveParts(runtime, locator, named, writtenBy) {
|
|
50
67
|
const { store } = runtime;
|
|
51
68
|
return store.exclusive(async () => {
|
|
@@ -60,7 +77,7 @@ export function saveParts(runtime, locator, named, writtenBy) {
|
|
|
60
77
|
for (const { path, parts } of read) {
|
|
61
78
|
const file = parts.file === undefined
|
|
62
79
|
? undefined
|
|
63
|
-
: await heldFile(parts.file.blob, parts.file.base === undefined ?
|
|
80
|
+
: await heldFile(parts.file.blob, parts.file.base === undefined ? attachmentBase(visible, path) : parts.file.base);
|
|
64
81
|
if (parts.file !== undefined && file !== undefined) {
|
|
65
82
|
files.push({ key: file.localId, blob: parts.file.blob });
|
|
66
83
|
}
|
|
@@ -142,7 +159,7 @@ async function loaded(runtime, locator, replica, saved, consumed, files, written
|
|
|
142
159
|
}
|
|
143
160
|
function textDiffers(left, right) {
|
|
144
161
|
return ((left?.content ?? undefined) !== (right?.content ?? undefined) ||
|
|
145
|
-
!
|
|
162
|
+
!sameAttachment(left?.binary ?? undefined, right?.binary ?? undefined));
|
|
146
163
|
}
|
|
147
164
|
function textOf(entry) {
|
|
148
165
|
if (entry === null)
|
|
@@ -159,13 +176,16 @@ function lookupOf(local, key, view) {
|
|
|
159
176
|
]));
|
|
160
177
|
};
|
|
161
178
|
}
|
|
162
|
-
function declaredOf(entry) {
|
|
179
|
+
function declaredOf(composition, path, entry) {
|
|
163
180
|
if (entry.binary !== null)
|
|
164
181
|
return { type: undefined, binary: true };
|
|
165
|
-
const
|
|
166
|
-
return {
|
|
182
|
+
const content = entry.content ?? '';
|
|
183
|
+
return {
|
|
184
|
+
type: typeAt(composition, path, parse(content, path, definitionsAt(composition, path))),
|
|
185
|
+
binary: false,
|
|
186
|
+
};
|
|
167
187
|
}
|
|
168
|
-
function overriddenLookup(lookup, overrides) {
|
|
188
|
+
function overriddenLookup(composition, lookup, overrides) {
|
|
169
189
|
return async (paths) => {
|
|
170
190
|
const known = new Map(await lookup(paths.filter((path) => !overrides.has(path))));
|
|
171
191
|
for (const path of paths) {
|
|
@@ -175,7 +195,7 @@ function overriddenLookup(lookup, overrides) {
|
|
|
175
195
|
if (entry === null)
|
|
176
196
|
known.delete(path);
|
|
177
197
|
else
|
|
178
|
-
known.set(path, declaredOf(entry));
|
|
198
|
+
known.set(path, declaredOf(composition, path, entry));
|
|
179
199
|
}
|
|
180
200
|
return known;
|
|
181
201
|
};
|
|
@@ -196,10 +216,12 @@ function validatorOf(runtime, record, confirmedLayer) {
|
|
|
196
216
|
if (textOf(was) !== textOf(now))
|
|
197
217
|
changes.push({ path, was: textOf(was), now: textOf(now) });
|
|
198
218
|
}
|
|
199
|
-
|
|
200
|
-
|
|
219
|
+
const composition = compositionFor(runtime, record);
|
|
220
|
+
return validatedNeighbourhood(changes, composition, {
|
|
221
|
+
lookup: overriddenLookup(composition, lookupOf(local, record.key, 'confirmed'), overrides),
|
|
201
222
|
texts: textsOf(local, record.key, 'confirmed'),
|
|
202
223
|
referrers: referrersOf(local, record.key, 'confirmed'),
|
|
224
|
+
holders: (sought) => local.holders(record.key, 'confirmed', sought),
|
|
203
225
|
});
|
|
204
226
|
};
|
|
205
227
|
}
|
|
@@ -229,8 +251,8 @@ export function batchFile(store, batch) {
|
|
|
229
251
|
return (await store.open()).file(localId, change?.kind === 'binary' ? change.mediaType : '');
|
|
230
252
|
};
|
|
231
253
|
}
|
|
232
|
-
async function
|
|
233
|
-
const { store, socket, presence
|
|
254
|
+
async function transferAttachment(runtime, request, transfer, answer) {
|
|
255
|
+
const { store, socket, presence } = runtime;
|
|
234
256
|
const { session } = socket;
|
|
235
257
|
if (socket.closed() || session.now().refusal !== null)
|
|
236
258
|
return UNCERTAIN;
|
|
@@ -247,12 +269,10 @@ async function transferBinary(runtime, request, transfer, answer) {
|
|
|
247
269
|
if (closed || authorization === undefined || refusal !== null)
|
|
248
270
|
return UNCERTAIN;
|
|
249
271
|
const since = presence.losses();
|
|
250
|
-
journal.record(`transfer binary ${request.locator} ${request.path}`);
|
|
251
272
|
try {
|
|
252
273
|
const result = await transfer(authorization);
|
|
253
274
|
const settled = result;
|
|
254
|
-
|
|
255
|
-
if (presence.lostSince(request.locator, since))
|
|
275
|
+
if (request.locator !== null && presence.lostSince(request.locator, since))
|
|
256
276
|
return failure({ kind: 'room-not-readable', locator: request.locator });
|
|
257
277
|
if (settled.kind === 'scoped-refusal') {
|
|
258
278
|
const room = await store.record(settled.locator);
|
|
@@ -264,23 +284,22 @@ async function transferBinary(runtime, request, transfer, answer) {
|
|
|
264
284
|
return answer(result);
|
|
265
285
|
}
|
|
266
286
|
catch {
|
|
267
|
-
journal.record('outcome binary transport-uncertainty');
|
|
268
287
|
return UNCERTAIN;
|
|
269
288
|
}
|
|
270
289
|
}
|
|
271
|
-
function
|
|
290
|
+
function fetchAttachment(runtime, request, name) {
|
|
272
291
|
const { store, socket } = runtime;
|
|
273
|
-
return
|
|
292
|
+
return transferAttachment(runtime, request, (authorization) => store.opened.fetch(name, () => socket.binary(authorization, request)), attachmentAnswer);
|
|
274
293
|
}
|
|
275
|
-
async function
|
|
294
|
+
async function readAttachment(runtime, request, name) {
|
|
276
295
|
if (runtime.socket.closed())
|
|
277
296
|
return UNCERTAIN;
|
|
278
297
|
const held = await runtime.store.opened.find(name);
|
|
279
298
|
if (held !== null)
|
|
280
299
|
return held;
|
|
281
|
-
return
|
|
300
|
+
return fetchAttachment(runtime, request, name);
|
|
282
301
|
}
|
|
283
|
-
async function
|
|
302
|
+
async function attachmentPath(store, locator, path, revision) {
|
|
284
303
|
if (revision !== undefined)
|
|
285
304
|
return { kind: 'path', locator, path, revision };
|
|
286
305
|
const replica = await store.replica(locator);
|
|
@@ -293,7 +312,7 @@ async function binaryPath(store, locator, path, revision) {
|
|
|
293
312
|
return null;
|
|
294
313
|
if (held.binary.state === 'pending')
|
|
295
314
|
return { kind: 'pending', localId: held.binary.localId };
|
|
296
|
-
const record =
|
|
315
|
+
const record = attachmentRecord(path, held.binary, held.revision ?? undefined);
|
|
297
316
|
if (record.state !== 'accepted')
|
|
298
317
|
return null;
|
|
299
318
|
const queued = replica.queue.flatMap((batch) => batch.changes);
|
|
@@ -321,17 +340,17 @@ async function binaryPath(store, locator, path, revision) {
|
|
|
321
340
|
revision: record.revision,
|
|
322
341
|
};
|
|
323
342
|
}
|
|
324
|
-
async function
|
|
343
|
+
async function askedAttachment({ store, socket }, locator, path, revision) {
|
|
325
344
|
await socket.ready;
|
|
326
345
|
const drafted = (await store.draft(locator, path))?.parts.file;
|
|
327
346
|
return drafted !== undefined && drafted.localId === revision
|
|
328
347
|
? { kind: 'pending', localId: revision }
|
|
329
|
-
:
|
|
348
|
+
: attachmentPath(store, locator, path, revision);
|
|
330
349
|
}
|
|
331
|
-
async function
|
|
350
|
+
async function pendingAttachment(store, locator, path, localId) {
|
|
332
351
|
const facts = await queuedFacts(store, locator, path, localId);
|
|
333
352
|
return facts === null
|
|
334
|
-
?
|
|
353
|
+
? absentAttachment(path)
|
|
335
354
|
: {
|
|
336
355
|
kind: 'binary',
|
|
337
356
|
file: localId,
|
|
@@ -339,13 +358,13 @@ async function pendingBinary(store, locator, path, localId) {
|
|
|
339
358
|
mediaType: facts.mediaType,
|
|
340
359
|
};
|
|
341
360
|
}
|
|
342
|
-
async function
|
|
343
|
-
const asked = await
|
|
361
|
+
async function readAttachmentPath(runtime, locator, path, revision) {
|
|
362
|
+
const asked = await askedAttachment(runtime, locator, path, revision);
|
|
344
363
|
if (asked === null)
|
|
345
|
-
return
|
|
364
|
+
return absentAttachment(path);
|
|
346
365
|
if (asked.kind === 'pending')
|
|
347
|
-
return
|
|
348
|
-
return
|
|
366
|
+
return pendingAttachment(runtime.store, locator, path, asked.localId);
|
|
367
|
+
return readAttachment(runtime, asked, { locator, path: asked.path, revision: asked.revision });
|
|
349
368
|
}
|
|
350
369
|
async function heldMediaType(store, locator, path) {
|
|
351
370
|
const replica = await store.record(locator);
|
|
@@ -353,23 +372,42 @@ async function heldMediaType(store, locator, path) {
|
|
|
353
372
|
return held === undefined ? store.attached.of(locator, path)?.mediaType : held.binary?.mediaType;
|
|
354
373
|
}
|
|
355
374
|
function linkOf(runtime, asked, held) {
|
|
356
|
-
return
|
|
375
|
+
return transferAttachment(runtime, asked, (authorization) => runtime.socket.link(authorization, asked), (result) => attachmentLinkAnswer(result, held));
|
|
357
376
|
}
|
|
358
|
-
async function
|
|
377
|
+
async function linkAttachmentPath(runtime, locator, path, revision) {
|
|
359
378
|
const { store, socket } = runtime;
|
|
360
379
|
await socket.ready;
|
|
361
|
-
const asked = await
|
|
380
|
+
const asked = await attachmentPath(store, locator, path, revision);
|
|
362
381
|
if (asked === null || asked.kind === 'pending')
|
|
363
|
-
return
|
|
382
|
+
return absentAttachment(path);
|
|
364
383
|
return linkOf(runtime, asked, revision === undefined ? await heldMediaType(store, locator, path) : undefined);
|
|
365
384
|
}
|
|
366
|
-
|
|
385
|
+
function shownImage(runtime, asked, name) {
|
|
386
|
+
const { store, socket } = runtime;
|
|
387
|
+
return new Promise((answer) => {
|
|
388
|
+
void transferAttachment(runtime, asked, (authorization) => store.opened.fetch(name, async () => {
|
|
389
|
+
const read = await socket.binary(authorization, asked);
|
|
390
|
+
const copies = read.kind === 'binary' ? (read.copies ?? []) : [];
|
|
391
|
+
if (read.kind === 'binary' && read.url !== undefined && copies.length > 0) {
|
|
392
|
+
answer({
|
|
393
|
+
kind: 'link',
|
|
394
|
+
url: read.url,
|
|
395
|
+
name: asked.path.slice(asked.path.lastIndexOf('/') + 1),
|
|
396
|
+
mediaType: read.mediaType,
|
|
397
|
+
copies,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return read;
|
|
401
|
+
}), attachmentAnswer).then(answer);
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
async function showAttachmentPath(runtime, locator, path, revision) {
|
|
367
405
|
const { store } = runtime;
|
|
368
|
-
const asked = await
|
|
406
|
+
const asked = await askedAttachment(runtime, locator, path, revision);
|
|
369
407
|
if (asked === null)
|
|
370
|
-
return
|
|
408
|
+
return absentAttachment(path);
|
|
371
409
|
if (asked.kind === 'pending')
|
|
372
|
-
return
|
|
410
|
+
return pendingAttachment(store, locator, path, asked.localId);
|
|
373
411
|
if (runtime.socket.closed())
|
|
374
412
|
return UNCERTAIN;
|
|
375
413
|
const name = { locator, path: asked.path, revision: asked.revision };
|
|
@@ -377,11 +415,12 @@ async function showBinaryPath(runtime, locator, path, revision) {
|
|
|
377
415
|
if (kept !== null)
|
|
378
416
|
return kept;
|
|
379
417
|
const mediaType = await heldMediaType(store, locator, path);
|
|
380
|
-
if (mediaType
|
|
381
|
-
return
|
|
382
|
-
|
|
418
|
+
if (mediaType !== undefined && isImageType(mediaType))
|
|
419
|
+
return shownImage(runtime, asked, name);
|
|
420
|
+
const linked = await linkOf(runtime, asked, revision === undefined ? mediaType : undefined);
|
|
421
|
+
return linked.kind === 'link' ? { ...linked, copies: [] } : linked;
|
|
383
422
|
}
|
|
384
|
-
async function
|
|
423
|
+
async function attachFile(runtime, locator, file, answer) {
|
|
385
424
|
const { store, socket } = runtime;
|
|
386
425
|
await socket.ready;
|
|
387
426
|
await socket.firstDiscovery;
|
|
@@ -391,23 +430,34 @@ async function attachBinary(runtime, locator, file) {
|
|
|
391
430
|
socket.session.now().refusal !== null)
|
|
392
431
|
return OFFLINE;
|
|
393
432
|
const request = await attachedFile(locator, file);
|
|
394
|
-
return
|
|
433
|
+
return transferAttachment(runtime, { locator }, async (held) => {
|
|
395
434
|
const result = await socket.attach(held, request);
|
|
396
|
-
if (result.kind === 'attached') {
|
|
435
|
+
if (result.kind === 'attached' && locator !== null) {
|
|
397
436
|
store.attached.hold(locator, result.path, {
|
|
398
437
|
revision: result.revision,
|
|
399
438
|
mediaType: request.mediaType,
|
|
400
439
|
});
|
|
401
440
|
}
|
|
402
441
|
return result;
|
|
403
|
-
},
|
|
442
|
+
}, answer);
|
|
443
|
+
}
|
|
444
|
+
async function keyedAttachment(runtime, link) {
|
|
445
|
+
await runtime.socket.ready;
|
|
446
|
+
const asked = { kind: 'key', link };
|
|
447
|
+
return transferAttachment(runtime, { locator: null }, (authorization) => runtime.socket.link(authorization, asked), (result) => attachmentLinkAnswer(result));
|
|
448
|
+
}
|
|
449
|
+
export function conversationFiles(runtime) {
|
|
450
|
+
return {
|
|
451
|
+
attach: (file) => attachFile(runtime, null, file, linkedAnswer),
|
|
452
|
+
attachment: (link) => keyedAttachment(runtime, link),
|
|
453
|
+
};
|
|
404
454
|
}
|
|
405
|
-
export function
|
|
455
|
+
export function attachmentSurface(runtime) {
|
|
406
456
|
return {
|
|
407
457
|
part: runtime.store.part,
|
|
408
|
-
read: (room, path, revision) =>
|
|
409
|
-
link: (room, path, revision) =>
|
|
410
|
-
show: (room, path, revision) =>
|
|
411
|
-
attach: (room, file) =>
|
|
458
|
+
read: (room, path, revision) => readAttachmentPath(runtime, room, path, revision),
|
|
459
|
+
link: (room, path, revision) => linkAttachmentPath(runtime, room, path, revision),
|
|
460
|
+
show: (room, path, revision) => showAttachmentPath(runtime, room, path, revision),
|
|
461
|
+
attach: (room, file) => attachFile(runtime, room, file, attachAnswer),
|
|
412
462
|
};
|
|
413
463
|
}
|
package/dist/seed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAwB,KAAK,WAAW,EAAqB,MAAM,kBAAkB,CAAC;AAC7F,OAAO,KAAK,EAAE,IAAI,EAA4C,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,C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observation.js';
|
|
3
3
|
import { documentKey } from './rows.js';
|
|
4
4
|
const seedTopic = (key) => `seed\u0000${key}`;
|
|
5
5
|
function plain(value) {
|
|
@@ -130,7 +130,7 @@ export function watchSeeded(runtime, plan, deliver, watch) {
|
|
|
130
130
|
const watcher = store.watch(seedTopic(plan.key), shown);
|
|
131
131
|
const stop = watch((cover, held) => seedBehind(runtime, plan, cover, held), (message) => {
|
|
132
132
|
const answered = message;
|
|
133
|
-
pending = whole(answered)
|
|
133
|
+
pending = whole(answered) ? 'pending' in answered.result : pendingChange(answered);
|
|
134
134
|
if (pending && store.seeds.of(plan.key) !== undefined) {
|
|
135
135
|
shown();
|
|
136
136
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GACtC,OAAO,CAET;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAOnF"}
|