@agentshouse/mdruntime 0.1.0-cef76ea952695 → 0.1.0-cefb45338245d
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 +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +72 -158
- 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 +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +174 -75
- package/dist/adapter.d.ts +149 -34
- 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/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +347 -0
- package/dist/binary.d.ts +6 -2
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +10 -3
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- 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 +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 +22 -23
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -66
- package/dist/collection.d.ts +27 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +34 -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 +4 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +87 -43
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +36 -27
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +25 -11
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +23 -11
- 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 +43 -11
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +312 -184
- 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 +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +47 -47
- 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 +5 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +22 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +91 -34
- package/dist/expectation.d.ts +25 -14
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +51 -20
- package/dist/failure.d.ts +2 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- 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 +24 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +108 -32
- 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/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -8
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +89 -108
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +74 -54
- package/dist/listing.d.ts +29 -22
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +71 -79
- 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 +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +10 -38
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +167 -33
- package/dist/memory.d.ts +10 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +98 -37
- package/dist/messages.d.ts +17 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +34 -13
- 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 +4 -3
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +94 -138
- 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 +1 -1
- 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 +21 -12
- package/dist/outcome.d.ts +24 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +33 -3
- package/dist/overlay.d.ts +9 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +37 -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 +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +207 -96
- 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 +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +136 -78
- package/dist/query.d.ts +2 -2
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -8
- 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 +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +182 -38
- package/dist/react.d.ts +11 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +28 -5
- package/dist/readiness.d.ts +20 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -10
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +9 -4
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- 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 +6 -6
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -4
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +16 -18
- 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 +30 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +275 -65
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +11 -6
- 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 +27 -14
- 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 +13 -19
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +43 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +314 -223
- package/dist/saves.d.ts +6 -42
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +176 -718
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -4
- package/dist/shown.d.ts +9 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +93 -57
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- 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 +4 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +4 -14
- package/dist/source.d.ts +7 -7
- 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 +24 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +68 -22
- 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 +25 -15
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +50 -18
- package/dist/stored.d.ts +39 -14
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +217 -59
- package/dist/surface.d.ts +14 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +65 -34
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +127 -102
- 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 +1 -2
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +51 -11
- package/dist/wire.d.ts +71 -12
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +30 -14
- package/package.json +4 -4
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -5
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -7
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -44
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
package/dist/room-draft.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApplyResult, type Definition, type DefinitionOf, type Document } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { HeadChange, ProviderRefusal } from './adapter.js';
|
|
2
3
|
import type { Open } from './open.js';
|
|
3
|
-
import type { Change, Precondition } from './change.js';
|
|
4
|
+
import type { Change, PartChange, Precondition } from './change.js';
|
|
4
5
|
import type { VisibleLayer } from './replica.js';
|
|
5
6
|
export type FieldValue = {
|
|
6
7
|
readonly value: unknown;
|
|
@@ -93,12 +94,27 @@ export type ReturnReason = ProviderRefusal & {
|
|
|
93
94
|
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
94
95
|
};
|
|
95
96
|
export declare function returnedBy(): ReturnReason;
|
|
97
|
+
type Mark = {
|
|
98
|
+
readonly change: HeadChange | null;
|
|
99
|
+
};
|
|
100
|
+
export type Marks = {
|
|
101
|
+
readonly fields?: Readonly<Record<string, Mark & {
|
|
102
|
+
readonly current: FieldValue;
|
|
103
|
+
}>>;
|
|
104
|
+
readonly sections?: Readonly<Record<string, Mark>>;
|
|
105
|
+
readonly preamble?: Mark;
|
|
106
|
+
readonly markdown?: Mark;
|
|
107
|
+
readonly file?: Mark & {
|
|
108
|
+
readonly current: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
96
111
|
export type RoomDraft = {
|
|
97
112
|
readonly room: string;
|
|
98
113
|
readonly path: string;
|
|
99
114
|
readonly revision: string;
|
|
100
115
|
readonly parts: HeldParts;
|
|
101
116
|
readonly changedUnderneath: ChangedUnderneath;
|
|
117
|
+
readonly marks: Marks;
|
|
102
118
|
readonly returned: ReturnReason | null;
|
|
103
119
|
};
|
|
104
120
|
export type RoomDraftWrite = {
|
|
@@ -119,6 +135,7 @@ export type RoomDraftRecord = {
|
|
|
119
135
|
readonly path: string;
|
|
120
136
|
readonly revision: string;
|
|
121
137
|
readonly parts: HeldParts;
|
|
138
|
+
readonly marks: Marks;
|
|
122
139
|
readonly returned: ReturnReason | null;
|
|
123
140
|
};
|
|
124
141
|
export type SavedDraft = {
|
|
@@ -132,6 +149,15 @@ export declare function underneath(parts: HeldParts, path: string, visible: Visi
|
|
|
132
149
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
133
150
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
134
151
|
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
152
|
+
export declare function marksOver(kept: Marks, under: Marks): Marks;
|
|
153
|
+
export declare function heldMarks(marks: Marks, parts: HeldParts): Marks;
|
|
154
|
+
export declare function partsBetween(path: string, before: Document, after: Document): PartChange[];
|
|
155
|
+
export declare function applyParts(document: Document, changes: readonly Change[], definition: Definition | undefined): ApplyResult;
|
|
156
|
+
type Joined = {
|
|
157
|
+
readonly parts: HeldParts;
|
|
158
|
+
readonly marks: Marks;
|
|
159
|
+
};
|
|
160
|
+
export declare function joinedOver(parts: HeldParts, marks: Marks, path: string, visible: VisibleLayer): Joined | null;
|
|
135
161
|
export declare function lineEnded(text: string): string;
|
|
136
162
|
export type TextParts = {
|
|
137
163
|
readonly fields?: Readonly<Record<string, {
|
|
@@ -144,8 +170,8 @@ export type TextParts = {
|
|
|
144
170
|
readonly value: string;
|
|
145
171
|
};
|
|
146
172
|
};
|
|
147
|
-
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
148
|
-
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
173
|
+
export declare function partsAfter(markdown: string, parts: TextParts, definitions?: DefinitionOf): string | null;
|
|
174
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): HeldParts | null;
|
|
149
175
|
export declare function moveTarget(move: {
|
|
150
176
|
readonly to: string;
|
|
151
177
|
}): string;
|
|
@@ -167,7 +193,6 @@ export declare function changesOf(path: string, parts: HeldParts): {
|
|
|
167
193
|
changes: readonly Change[];
|
|
168
194
|
bases: readonly Precondition[];
|
|
169
195
|
};
|
|
170
|
-
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
171
196
|
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
172
197
|
export {};
|
|
173
198
|
//# sourceMappingURL=room-draft.d.ts.map
|
package/dist/room-draft.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-draft.d.ts","sourceRoot":"","sources":["../src/room-draft.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"room-draft.d.ts","sourceRoot":"","sources":["../src/room-draft.ts"],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MAAM,CAGhE;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,GACnE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,EAAE,CAYtE;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,GACnE;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,CAgB1F;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GACf;IAAE,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,CA2ChE;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,SAAS,UAAU,EAAE,CAqBvB"}
|
package/dist/room-draft.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { apply,
|
|
1
|
+
import { apply, create, documentValue, equalValue, parse, serialize, } from '@agentshouse/mdmodel';
|
|
2
|
+
import { definitionsAt, governing } from './collection.js';
|
|
2
3
|
import { runtimeError } from './failure.js';
|
|
3
4
|
import { sha256 } from './digest.js';
|
|
5
|
+
import { declaredType } from './outcome.js';
|
|
4
6
|
import { binaryLocalId } from './identity.js';
|
|
5
7
|
import { normalize } from './paths.js';
|
|
6
8
|
export function returnedBy() {
|
|
@@ -32,14 +34,14 @@ function entries(value, at, each) {
|
|
|
32
34
|
read[name] = each(item, `${at}.${name}`);
|
|
33
35
|
return read;
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
37
|
+
function documentValueAt(item, at) {
|
|
38
|
+
return documentValue(item) ? item : malformed(at, 'a document value');
|
|
37
39
|
}
|
|
38
40
|
function fieldValue(value, at) {
|
|
39
41
|
if (value === null)
|
|
40
42
|
return null;
|
|
41
|
-
if (!plain(value) || !Object.hasOwn(value, 'value') || !
|
|
42
|
-
malformed(at, '{ value } with a
|
|
43
|
+
if (!plain(value) || !Object.hasOwn(value, 'value') || !documentValue(value.value)) {
|
|
44
|
+
malformed(at, '{ value } with a document value, or null where the document lacks it');
|
|
43
45
|
}
|
|
44
46
|
return { value: value.value };
|
|
45
47
|
}
|
|
@@ -58,7 +60,7 @@ function creationOf(value, at) {
|
|
|
58
60
|
malformed(`${at}.type`, 'a type name, or markdown in place of type, fields and sections');
|
|
59
61
|
return {
|
|
60
62
|
type: value.type,
|
|
61
|
-
fields: entries(value.fields, `${at}.fields`,
|
|
63
|
+
fields: entries(value.fields, `${at}.fields`, documentValueAt),
|
|
62
64
|
sections: entries(value.sections, `${at}.sections`, text),
|
|
63
65
|
};
|
|
64
66
|
}
|
|
@@ -72,7 +74,7 @@ const PART_NAMES = [
|
|
|
72
74
|
'removal',
|
|
73
75
|
'file',
|
|
74
76
|
];
|
|
75
|
-
const NAMED_PARTS = `a part named ${PART_NAMES.slice(0, -1).join(', ')} or ${PART_NAMES.
|
|
77
|
+
const NAMED_PARTS = `a part named ${PART_NAMES.slice(0, -1).join(', ')} or ${PART_NAMES.slice(-1).join('')}`;
|
|
76
78
|
export function readParts(value, path) {
|
|
77
79
|
if (!plain(value))
|
|
78
80
|
malformed(path, 'an object of parts');
|
|
@@ -82,8 +84,8 @@ export function readParts(value, path) {
|
|
|
82
84
|
const parts = {};
|
|
83
85
|
if (value.fields !== undefined) {
|
|
84
86
|
parts.fields = entries(value.fields, `${path} fields`, (item, at) => {
|
|
85
|
-
if (!plain(item) || !Object.hasOwn(item, 'value') || !
|
|
86
|
-
malformed(at, '{ value, base } with a
|
|
87
|
+
if (!plain(item) || !Object.hasOwn(item, 'value') || !documentValue(item.value)) {
|
|
88
|
+
malformed(at, '{ value, base } with a document value');
|
|
87
89
|
}
|
|
88
90
|
return item.base === undefined
|
|
89
91
|
? { value: item.value }
|
|
@@ -255,8 +257,10 @@ export function underneath(parts, path, visible) {
|
|
|
255
257
|
const markdown = visible?.documents[path] ?? null;
|
|
256
258
|
const document = visible?.collection.document(path);
|
|
257
259
|
const report = {};
|
|
260
|
+
const unread = document?.type !== undefined &&
|
|
261
|
+
governing(visible.collection.composition, path).status === 'unavailable';
|
|
258
262
|
const fields = {};
|
|
259
|
-
for (const [name, part] of named(parts.fields)) {
|
|
263
|
+
for (const [name, part] of unread ? [] : named(parts.fields)) {
|
|
260
264
|
const current = document !== undefined && Object.hasOwn(document.fields, name)
|
|
261
265
|
? { value: document.fields[name] }
|
|
262
266
|
: null;
|
|
@@ -266,7 +270,7 @@ export function underneath(parts, path, visible) {
|
|
|
266
270
|
if (Object.keys(fields).length > 0)
|
|
267
271
|
report.fields = fields;
|
|
268
272
|
const sections = {};
|
|
269
|
-
for (const [name, part] of named(parts.sections)) {
|
|
273
|
+
for (const [name, part] of unread ? [] : named(parts.sections)) {
|
|
270
274
|
const current = document !== undefined && Object.hasOwn(document.sections, name)
|
|
271
275
|
? document.sections[name]
|
|
272
276
|
: null;
|
|
@@ -276,8 +280,9 @@ export function underneath(parts, path, visible) {
|
|
|
276
280
|
if (Object.keys(sections).length > 0)
|
|
277
281
|
report.sections = sections;
|
|
278
282
|
const preamble = document?.preamble ?? null;
|
|
279
|
-
if (parts.preamble !== undefined && preamble !== parts.preamble.base)
|
|
283
|
+
if (!unread && parts.preamble !== undefined && preamble !== parts.preamble.base) {
|
|
280
284
|
report.preamble = preamble;
|
|
285
|
+
}
|
|
281
286
|
if (parts.markdown !== undefined && markdown !== parts.markdown.base)
|
|
282
287
|
report.markdown = markdown;
|
|
283
288
|
if (parts.creation !== undefined && markdown !== null)
|
|
@@ -293,13 +298,12 @@ export function underneath(parts, path, visible) {
|
|
|
293
298
|
}
|
|
294
299
|
return report;
|
|
295
300
|
}
|
|
296
|
-
const UNTYPED_MEDIA_TYPE = 'application/octet-stream';
|
|
297
301
|
export async function heldFile(blob, base) {
|
|
298
302
|
return {
|
|
299
303
|
localId: binaryLocalId(),
|
|
300
304
|
...(blob instanceof File ? { name: blob.name } : {}),
|
|
301
305
|
byteLength: blob.size,
|
|
302
|
-
mediaType: blob
|
|
306
|
+
mediaType: declaredType(blob),
|
|
303
307
|
sha256: await sha256(blob),
|
|
304
308
|
base,
|
|
305
309
|
};
|
|
@@ -323,6 +327,224 @@ export function changedParts(path, parts, visible) {
|
|
|
323
327
|
...(report.file === undefined || made ? [] : [{ path, part: 'file' }]),
|
|
324
328
|
];
|
|
325
329
|
}
|
|
330
|
+
function marksOf(fields, sections, rest) {
|
|
331
|
+
return {
|
|
332
|
+
...(Object.keys(fields).length === 0 ? {} : { fields }),
|
|
333
|
+
...(Object.keys(sections).length === 0 ? {} : { sections }),
|
|
334
|
+
...(rest.preamble === undefined ? {} : { preamble: rest.preamble }),
|
|
335
|
+
...(rest.markdown === undefined ? {} : { markdown: rest.markdown }),
|
|
336
|
+
...(rest.file === undefined ? {} : { file: rest.file }),
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
export function marksOver(kept, under) {
|
|
340
|
+
return marksOf({ ...under.fields, ...kept.fields }, { ...under.sections, ...kept.sections }, {
|
|
341
|
+
preamble: kept.preamble ?? under.preamble,
|
|
342
|
+
markdown: kept.markdown ?? under.markdown,
|
|
343
|
+
file: kept.file ?? under.file,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
export function heldMarks(marks, parts) {
|
|
347
|
+
const whole = parts.markdown !== undefined;
|
|
348
|
+
const heldIn = (record, part) => Object.fromEntries(named(record).filter(([name]) => whole || own(part, name) !== undefined));
|
|
349
|
+
return marksOf(heldIn(marks.fields, parts.fields), heldIn(marks.sections, parts.sections), {
|
|
350
|
+
preamble: whole || parts.preamble !== undefined ? marks.preamble : undefined,
|
|
351
|
+
markdown: whole ? marks.markdown : undefined,
|
|
352
|
+
file: parts.file === undefined ? undefined : marks.file,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function followedBy(first, then) {
|
|
356
|
+
const kept = first.replace(/(?:\r?\n)+$/u, '');
|
|
357
|
+
return kept.trim() === '' ? then : `${kept}\n\n${then.replace(/^(?:\r?\n)+/u, '')}`;
|
|
358
|
+
}
|
|
359
|
+
function bothSides(current, value) {
|
|
360
|
+
return lineEnded(current) === lineEnded(value) ? value : followedBy(current, value);
|
|
361
|
+
}
|
|
362
|
+
export function partsBetween(path, before, after) {
|
|
363
|
+
const changes = [];
|
|
364
|
+
for (const name of new Set([...Object.keys(before.fields), ...Object.keys(after.fields)])) {
|
|
365
|
+
const value = own(after.fields, name);
|
|
366
|
+
if (!equalValue(own(before.fields, name), value)) {
|
|
367
|
+
changes.push({ kind: 'field', path, name, value });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (after.preamble !== before.preamble) {
|
|
371
|
+
changes.push({ kind: 'preamble', path, value: after.preamble });
|
|
372
|
+
}
|
|
373
|
+
for (const [name, value] of Object.entries(after.sections)) {
|
|
374
|
+
if (own(before.sections, name) !== value)
|
|
375
|
+
changes.push({ kind: 'section', path, name, value });
|
|
376
|
+
}
|
|
377
|
+
return changes;
|
|
378
|
+
}
|
|
379
|
+
export function applyParts(document, changes, definition) {
|
|
380
|
+
const parts = new Map();
|
|
381
|
+
for (const change of changes) {
|
|
382
|
+
if (change.kind === 'field')
|
|
383
|
+
parts.set(`field ${change.name}`, {
|
|
384
|
+
kind: 'field',
|
|
385
|
+
name: change.name,
|
|
386
|
+
value: change.value,
|
|
387
|
+
prior: own(document.fields, change.name),
|
|
388
|
+
});
|
|
389
|
+
if (change.kind === 'preamble')
|
|
390
|
+
parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
|
|
391
|
+
if (change.kind === 'section')
|
|
392
|
+
parts.set(`section ${change.name}`, {
|
|
393
|
+
kind: 'section',
|
|
394
|
+
name: change.name,
|
|
395
|
+
value: change.value,
|
|
396
|
+
prior: own(document.sections, change.name),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
if (parts.size === 0)
|
|
400
|
+
return { outcome: 'applied', document };
|
|
401
|
+
return apply(document, [...parts.values()], definition);
|
|
402
|
+
}
|
|
403
|
+
function wholeJoined(part, current, path, composition, change) {
|
|
404
|
+
const definitions = definitionsAt(composition, path);
|
|
405
|
+
const read = (text) => {
|
|
406
|
+
const parsed = parse(text, path, definitions);
|
|
407
|
+
return parsed.ok ? parsed.document : undefined;
|
|
408
|
+
};
|
|
409
|
+
const base = read(part.base);
|
|
410
|
+
const mine = read(part.value);
|
|
411
|
+
const now = read(current);
|
|
412
|
+
if (base === undefined ||
|
|
413
|
+
mine === undefined ||
|
|
414
|
+
now === undefined ||
|
|
415
|
+
mine.type !== base.type ||
|
|
416
|
+
now.type !== base.type ||
|
|
417
|
+
Object.keys(base.sections).some((name) => !Object.hasOwn(mine.sections, name))) {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
const definition = definitions(base.type);
|
|
421
|
+
const changes = partsBetween(path, base, mine);
|
|
422
|
+
const again = applyParts(base, changes, definition);
|
|
423
|
+
if (again.outcome !== 'applied' || serialize(again.document) !== part.value)
|
|
424
|
+
return null;
|
|
425
|
+
const fields = {};
|
|
426
|
+
const sections = {};
|
|
427
|
+
let preamble;
|
|
428
|
+
const over = [];
|
|
429
|
+
for (const one of changes) {
|
|
430
|
+
if (one.kind === 'field') {
|
|
431
|
+
const held = own(now.fields, one.name);
|
|
432
|
+
if (!equalValue(held, own(base.fields, one.name)) && !equalValue(held, one.value)) {
|
|
433
|
+
fields[one.name] = { current: held === undefined ? null : { value: held }, change };
|
|
434
|
+
}
|
|
435
|
+
over.push(one);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
if (one.kind === 'preamble') {
|
|
439
|
+
const value = now.preamble === base.preamble ? one.value : bothSides(now.preamble, one.value);
|
|
440
|
+
if (value !== one.value)
|
|
441
|
+
preamble = { change };
|
|
442
|
+
over.push({ ...one, value });
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
const prior = own(base.sections, one.name);
|
|
446
|
+
const held = own(now.sections, one.name);
|
|
447
|
+
if (held === undefined && prior !== undefined)
|
|
448
|
+
return null;
|
|
449
|
+
const value = held === undefined || held === prior ? one.value : bothSides(held, one.value);
|
|
450
|
+
if (value !== one.value)
|
|
451
|
+
sections[one.name] = { change };
|
|
452
|
+
over.push({ ...one, value });
|
|
453
|
+
}
|
|
454
|
+
const joined = applyParts(now, over, definition);
|
|
455
|
+
if (joined.outcome !== 'applied')
|
|
456
|
+
return null;
|
|
457
|
+
return {
|
|
458
|
+
value: serialize(joined.document),
|
|
459
|
+
marks: marksOf(fields, sections, { preamble }),
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
export function joinedOver(parts, marks, path, visible) {
|
|
463
|
+
const report = underneath(parts, path, visible);
|
|
464
|
+
const change = visible.changes[path] ?? null;
|
|
465
|
+
const next = { ...parts };
|
|
466
|
+
const fields = {};
|
|
467
|
+
const sections = {};
|
|
468
|
+
const rest = {};
|
|
469
|
+
let rebased = false;
|
|
470
|
+
const text = (value, current, mark) => {
|
|
471
|
+
const joined = bothSides(current, value);
|
|
472
|
+
if (joined !== value)
|
|
473
|
+
mark();
|
|
474
|
+
return { value: joined, base: current };
|
|
475
|
+
};
|
|
476
|
+
const now = visible.collection.document(path);
|
|
477
|
+
if (now !== undefined) {
|
|
478
|
+
for (const [name, current] of named(report.fields)) {
|
|
479
|
+
const { value } = parts.fields[name];
|
|
480
|
+
next.fields = { ...next.fields, [name]: { value, base: current } };
|
|
481
|
+
if (!sameField(current, { value }))
|
|
482
|
+
fields[name] = { current, change };
|
|
483
|
+
rebased = true;
|
|
484
|
+
}
|
|
485
|
+
const removed = [];
|
|
486
|
+
for (const [name, current] of named(report.sections)) {
|
|
487
|
+
if (current === null) {
|
|
488
|
+
removed.push(name);
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
const joined = text(parts.sections[name].value, current, () => {
|
|
492
|
+
sections[name] = { change };
|
|
493
|
+
});
|
|
494
|
+
next.sections = { ...next.sections, [name]: joined };
|
|
495
|
+
rebased = true;
|
|
496
|
+
}
|
|
497
|
+
if (typeof report.preamble === 'string') {
|
|
498
|
+
next.preamble = text(parts.preamble.value, report.preamble, () => {
|
|
499
|
+
rest.preamble = { change };
|
|
500
|
+
});
|
|
501
|
+
rebased = true;
|
|
502
|
+
}
|
|
503
|
+
const whole = removed.length === 0
|
|
504
|
+
? null
|
|
505
|
+
: applyParts(now, changesOf(path, next).changes, definitionsAt(visible.collection.composition, path)(now.type));
|
|
506
|
+
if (whole?.outcome === 'applied') {
|
|
507
|
+
delete next.fields;
|
|
508
|
+
delete next.sections;
|
|
509
|
+
delete next.preamble;
|
|
510
|
+
next.markdown = { value: serialize(whole.document), base: visible.documents[path] };
|
|
511
|
+
for (const name of removed)
|
|
512
|
+
sections[name] = { change };
|
|
513
|
+
rebased = true;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (typeof report.markdown === 'string' && parts.markdown !== undefined) {
|
|
517
|
+
const current = report.markdown;
|
|
518
|
+
const whole = wholeJoined(parts.markdown, current, path, visible.collection.composition, change);
|
|
519
|
+
const value = whole?.value ?? bothSides(current, parts.markdown.value);
|
|
520
|
+
next.markdown = { value, base: current };
|
|
521
|
+
if (whole !== null) {
|
|
522
|
+
Object.assign(fields, whole.marks.fields);
|
|
523
|
+
Object.assign(sections, whole.marks.sections);
|
|
524
|
+
if (whole.marks.preamble !== undefined)
|
|
525
|
+
rest.preamble = whole.marks.preamble;
|
|
526
|
+
}
|
|
527
|
+
else if (value !== parts.markdown.value)
|
|
528
|
+
rest.markdown = { change };
|
|
529
|
+
rebased = true;
|
|
530
|
+
}
|
|
531
|
+
if (typeof report.move === 'string' && parts.move !== undefined) {
|
|
532
|
+
next.move = { ...parts.move, base: report.move };
|
|
533
|
+
rebased = true;
|
|
534
|
+
}
|
|
535
|
+
if (typeof report.removal === 'string' && parts.removal !== undefined) {
|
|
536
|
+
next.removal = { base: report.removal };
|
|
537
|
+
rebased = true;
|
|
538
|
+
}
|
|
539
|
+
if (typeof report.file === 'string' && parts.file !== undefined && parts.file.base !== null) {
|
|
540
|
+
next.file = { ...parts.file, base: report.file };
|
|
541
|
+
if (visible.binaries[path]?.sha256 !== parts.file.sha256) {
|
|
542
|
+
rest.file = { current: report.file, change };
|
|
543
|
+
}
|
|
544
|
+
rebased = true;
|
|
545
|
+
}
|
|
546
|
+
return rebased ? { parts: next, marks: marksOver(marksOf(fields, sections, rest), marks) } : null;
|
|
547
|
+
}
|
|
326
548
|
function joined(existing, returned) {
|
|
327
549
|
const merged = { ...existing };
|
|
328
550
|
for (const [name, part] of named(returned))
|
|
@@ -333,30 +555,42 @@ function joined(existing, returned) {
|
|
|
333
555
|
export function lineEnded(text) {
|
|
334
556
|
return text === '' || text.endsWith('\n') ? text : `${text}\n`;
|
|
335
557
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
value: part.value,
|
|
344
|
-
prior: undefined,
|
|
345
|
-
})));
|
|
346
|
-
return next.outcome === 'applied' ? serialize(next.document) : malformed();
|
|
558
|
+
function written(start, changes, definition) {
|
|
559
|
+
const next = apply(start, changes, definition);
|
|
560
|
+
return next.outcome === 'applied' ? next.document : malformed();
|
|
561
|
+
}
|
|
562
|
+
function empty(definition) {
|
|
563
|
+
const parsed = parse('', '', definition);
|
|
564
|
+
return parsed.ok ? parsed.document : malformed();
|
|
347
565
|
}
|
|
348
|
-
export function partsAfter(markdown, parts) {
|
|
566
|
+
export function partsAfter(markdown, parts, definitions) {
|
|
349
567
|
const fields = named(parts.fields);
|
|
568
|
+
const sections = named(parts.sections);
|
|
569
|
+
if (fields.length === 0 && sections.length === 0 && parts.preamble === undefined)
|
|
570
|
+
return markdown;
|
|
571
|
+
const whole = parse(markdown, '', definitions);
|
|
572
|
+
const type = whole.ok ? whole.document.type : undefined;
|
|
573
|
+
const definition = definitions?.(type);
|
|
574
|
+
if (type !== undefined && definition === undefined)
|
|
575
|
+
return null;
|
|
576
|
+
const valued = fields.length === 0
|
|
577
|
+
? empty(definition)
|
|
578
|
+
: written(create(type, definition), fields.map(([name, part]) => ({
|
|
579
|
+
kind: 'field',
|
|
580
|
+
name,
|
|
581
|
+
value: part.value,
|
|
582
|
+
prior: undefined,
|
|
583
|
+
})), definition);
|
|
584
|
+
const head = parts.preamble === undefined
|
|
585
|
+
? valued
|
|
586
|
+
: written(valued, [{ kind: 'preamble', value: lineEnded(parts.preamble.value), prior: valued.preamble }], definition);
|
|
350
587
|
const pieces = [
|
|
351
|
-
...(fields.length === 0 ? [] : [
|
|
352
|
-
...(
|
|
353
|
-
...named(parts.sections).map(([name, part]) => `## ${name}\n${part.value}`),
|
|
588
|
+
...(fields.length === 0 && parts.preamble === undefined ? [] : [serialize(head)]),
|
|
589
|
+
...sections.map(([name, part]) => serialize(written(empty(definition), [{ kind: 'section', name, value: lineEnded(part.value), prior: undefined }], definition))),
|
|
354
590
|
];
|
|
355
|
-
|
|
356
|
-
return markdown;
|
|
357
|
-
return `${lineEnded(markdown)}\n${pieces.map(lineEnded).join('')}`;
|
|
591
|
+
return followedBy(markdown, pieces.join(''));
|
|
358
592
|
}
|
|
359
|
-
export function returnedInto(existing, returned) {
|
|
593
|
+
export function returnedInto(existing, returned, definitions) {
|
|
360
594
|
if (existing === undefined)
|
|
361
595
|
return returned;
|
|
362
596
|
const next = { ...existing };
|
|
@@ -376,7 +610,9 @@ export function returnedInto(existing, returned) {
|
|
|
376
610
|
delete next.fields;
|
|
377
611
|
delete next.sections;
|
|
378
612
|
delete next.preamble;
|
|
379
|
-
const value = partsAfter(whole.value, existing.markdown === undefined ? existing : returned);
|
|
613
|
+
const value = partsAfter(whole.value, existing.markdown === undefined ? existing : returned, definitions);
|
|
614
|
+
if (value === null)
|
|
615
|
+
return null;
|
|
380
616
|
next.markdown = { value, base: whole.base };
|
|
381
617
|
}
|
|
382
618
|
const creation = existing.creation ?? returned.creation;
|
|
@@ -394,11 +630,14 @@ export function returnedInto(existing, returned) {
|
|
|
394
630
|
return next;
|
|
395
631
|
}
|
|
396
632
|
export function moveTarget(move) {
|
|
397
|
-
const to = normalize(move.to);
|
|
633
|
+
const to = normalize(move.to.normalize('NFC'));
|
|
398
634
|
return to === null || to === '' ? move.to : to;
|
|
399
635
|
}
|
|
400
636
|
export function readSavedParts(named) {
|
|
401
|
-
const read = named.map(({ path, parts }) =>
|
|
637
|
+
const read = named.map(({ path, parts }) => {
|
|
638
|
+
const written = path.normalize('NFC');
|
|
639
|
+
return { path: written, parts: readParts(parts, written) };
|
|
640
|
+
});
|
|
402
641
|
read.forEach(({ path }, at) => {
|
|
403
642
|
if (path === '' || normalize(path) !== path)
|
|
404
643
|
malformed(path, 'a path inside the Room, such as notes/a.md');
|
|
@@ -474,35 +713,6 @@ export function changesOf(path, parts) {
|
|
|
474
713
|
changes.push({ kind: 'remove', path });
|
|
475
714
|
return { changes, bases };
|
|
476
715
|
}
|
|
477
|
-
function rebased(before, after) {
|
|
478
|
-
return before === undefined ? after : { ...after, base: before.base };
|
|
479
|
-
}
|
|
480
|
-
function rebasedAll(before, after) {
|
|
481
|
-
return {
|
|
482
|
-
...before,
|
|
483
|
-
...Object.fromEntries(Object.entries(after).map(([name, part]) => [name, rebased(before?.[name], part)])),
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
export function joinedDraft(carried, saved) {
|
|
487
|
-
const draft = saved.find((item) => item.path === carried.path);
|
|
488
|
-
if (draft === undefined)
|
|
489
|
-
return carried;
|
|
490
|
-
const held = carried.parts;
|
|
491
|
-
const next = draft.parts;
|
|
492
|
-
return {
|
|
493
|
-
path: carried.path,
|
|
494
|
-
parts: {
|
|
495
|
-
...held,
|
|
496
|
-
...next,
|
|
497
|
-
...(next.fields === undefined ? {} : { fields: rebasedAll(held.fields, next.fields) }),
|
|
498
|
-
...(next.sections === undefined
|
|
499
|
-
? {}
|
|
500
|
-
: { sections: rebasedAll(held.sections, next.sections) }),
|
|
501
|
-
...(next.preamble === undefined ? {} : { preamble: rebased(held.preamble, next.preamble) }),
|
|
502
|
-
...(next.markdown === undefined ? {} : { markdown: rebased(held.markdown, next.markdown) }),
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
716
|
export function withdrawnDrafts(drafts, changes) {
|
|
507
717
|
return drafts.flatMap((draft) => {
|
|
508
718
|
const file = draft.parts.file;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-drafts.d.ts","sourceRoot":"","sources":["../src/room-drafts.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5D,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"room-drafts.d.ts","sourceRoot":"","sources":["../src/room-drafts.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5D,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EASL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,IAAI,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;I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G,OAAO,CAAC,IAAI,CAAC,CAUvF;AAsDD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAoDnE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,CA8BzE;AAED,wBAAgB,eAAe,CAC7B,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,MAAM,IAAI,CAiBZ;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAC1B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,MAAM,IAAI,CASZ"}
|
package/dist/room-drafts.js
CHANGED
|
@@ -5,7 +5,7 @@ import { runtimeError, uncaught } from './failure.js';
|
|
|
5
5
|
import { roomDraftRevision } from './identity.js';
|
|
6
6
|
import { normalize } from './paths.js';
|
|
7
7
|
import { slicing } from './replica.js';
|
|
8
|
-
import { binaryBase, gatheredParts, held, heldFile, readParts, staleWrite, underneath, } from './room-draft.js';
|
|
8
|
+
import { binaryBase, gatheredParts, held, heldFile, heldMarks, readParts, staleWrite, underneath, } from './room-draft.js';
|
|
9
9
|
import { stepped } from './turn.js';
|
|
10
10
|
const ROOM_DRAFTS = 'room-drafts';
|
|
11
11
|
const presentationTopic = (app) => `presentation\u0000${app}`;
|
|
@@ -24,6 +24,7 @@ function roomDraftOf(record, visible) {
|
|
|
24
24
|
revision: record.revision,
|
|
25
25
|
parts: record.parts,
|
|
26
26
|
changedUnderneath: underneath(record.parts, record.path, visible),
|
|
27
|
+
marks: record.marks,
|
|
27
28
|
returned: record.returned,
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -107,11 +108,13 @@ async function writtenRoomDraft({ store }, room, path, revision, input, next) {
|
|
|
107
108
|
: await heldFile(parts.file.blob, parts.file.base === undefined
|
|
108
109
|
? binaryBase(await visibleOf(store, room, [path]), path)
|
|
109
110
|
: parts.file.base);
|
|
111
|
+
const kept = held(current?.parts, parts, file);
|
|
110
112
|
const record = {
|
|
111
113
|
locator: room,
|
|
112
114
|
path,
|
|
113
115
|
revision: next,
|
|
114
|
-
parts:
|
|
116
|
+
parts: kept,
|
|
117
|
+
marks: heldMarks(current?.marks ?? {}, kept),
|
|
115
118
|
returned: current?.returned ?? null,
|
|
116
119
|
};
|
|
117
120
|
await local.keepRoomDraft(record, parts.file === undefined || file === undefined
|
|
@@ -138,11 +141,12 @@ export function roomDraftSurface(runtime) {
|
|
|
138
141
|
return listed;
|
|
139
142
|
});
|
|
140
143
|
},
|
|
141
|
-
async read(room,
|
|
142
|
-
const record = await store.draft(room,
|
|
144
|
+
async read(room, written) {
|
|
145
|
+
const record = await store.draft(room, written.normalize('NFC'));
|
|
143
146
|
return record === undefined ? null : (await roomDraftsOf(store, [record]))[0];
|
|
144
147
|
},
|
|
145
|
-
write(room,
|
|
148
|
+
write(room, written, revision, input, next = roomDraftRevision()) {
|
|
149
|
+
const path = written.normalize('NFC');
|
|
146
150
|
if (typeof next !== 'string' || next === '')
|
|
147
151
|
return Promise.reject(runtimeError('room-draft-malformed'));
|
|
148
152
|
return store.gathered(`room-draft\u0000${room}\u0000${path}`, { revision, input, next }, (earlier, later) => {
|
|
@@ -154,7 +158,8 @@ export function roomDraftSurface(runtime) {
|
|
|
154
158
|
: { revision: earlier.revision, input: parts, next: later.next };
|
|
155
159
|
}, (written) => writtenRoomDraft(runtime, room, path, written.revision, written.input, written.next));
|
|
156
160
|
},
|
|
157
|
-
discard(room,
|
|
161
|
+
discard(room, written, revision) {
|
|
162
|
+
const path = written.normalize('NFC');
|
|
158
163
|
return store.exclusive(async () => {
|
|
159
164
|
const local = await store.open();
|
|
160
165
|
const current = await store.draft(room, path);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuthorityChange, RoomList } from './adapter.js';
|
|
2
|
+
import type { Runtime } from './runtime.js';
|
|
3
|
+
import type { Deliver } from './reach.js';
|
|
4
|
+
export declare const ROOM_LIST_TOPIC = "room-list";
|
|
5
|
+
type RoomListChange = NonNullable<AuthorityChange['roomList']>;
|
|
6
|
+
export declare function roomsListed(runtime: Runtime, list: RoomList | undefined): Promise<void>;
|
|
7
|
+
export declare function roomListChanged(runtime: Runtime, change: RoomListChange | undefined): Promise<void>;
|
|
8
|
+
export declare function watchRoomList(runtime: Runtime, deliver: Deliver): () => void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=room-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-list.d.ts","sourceRoot":"","sources":["../src/room-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,KAAK,cAAc,GAAG,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;AA0B/D,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvF;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,cAAc,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,IAAI,CAU5E"}
|