@agentshouse/mdruntime 0.1.0-c52f87bb83a70 → 0.1.0-c55c6f69061ee
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 +11 -9
- package/dist/adapter.d.ts +94 -63
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +2 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +16 -8
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +142 -94
- package/dist/change-set.d.ts +1 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +1 -4
- package/dist/client.d.ts +10 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -8
- package/dist/collection.d.ts +5 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts +7 -2
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +125 -48
- package/dist/connection.d.ts +10 -10
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1611 -1313
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/{chat/context.js → context.js} +1 -4
- package/dist/conversation.d.ts +17 -14
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +262 -159
- package/dist/durability.d.ts +1 -5
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +1 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +2 -1
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +4 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +52 -32
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +13 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +2 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +9 -5
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +10 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +177 -100
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +6 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -10
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +13 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/phrase.d.ts +3 -0
- package/dist/phrase.d.ts.map +1 -0
- package/dist/phrase.js +8 -0
- package/dist/query.d.ts +14 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +32 -2
- package/dist/reach.d.ts +13 -7
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +80 -64
- package/dist/react.d.ts +1 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +14 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -8
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +10 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +104 -30
- package/dist/replica.d.ts +5 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +7 -7
- package/dist/room-draft.d.ts +20 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +131 -51
- package/dist/rows.d.ts +17 -7
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +120 -87
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +13 -7
- package/dist/search.d.ts +12 -95
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -349
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +34 -60
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +71 -275
- package/dist/stored.d.ts +42 -23
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +198 -210
- package/dist/tables.d.ts +79 -46
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +101 -53
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +35 -96
- package/dist/wire.d.ts +6 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +3 -3
- package/package.json +14 -18
- package/AGENTS.md +0 -310
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -237
- package/dist/chat/messages.d.ts +0 -29
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -190
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -68
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -619
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -306
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
package/dist/room-draft.js
CHANGED
|
@@ -9,52 +9,60 @@ export function returnedBy(kind) {
|
|
|
9
9
|
export function staleWrite(current) {
|
|
10
10
|
return { outcome: 'stale', code: 'stale', retryable: false, current };
|
|
11
11
|
}
|
|
12
|
-
function malformed() {
|
|
13
|
-
throw runtimeError('room-draft-malformed');
|
|
12
|
+
function malformed(at, needs) {
|
|
13
|
+
throw runtimeError('room-draft-malformed', at === undefined ? 'room-draft-malformed' : `room-draft-malformed at ${at}: ${needs}`);
|
|
14
14
|
}
|
|
15
15
|
function plain(value) {
|
|
16
16
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
17
17
|
}
|
|
18
|
-
function text(value) {
|
|
19
|
-
return typeof value === 'string' ? value : malformed();
|
|
18
|
+
function text(value, at) {
|
|
19
|
+
return typeof value === 'string' ? value : malformed(at, 'text');
|
|
20
20
|
}
|
|
21
|
-
function optionalText(value) {
|
|
22
|
-
return value === undefined ? undefined : text(value);
|
|
21
|
+
function optionalText(value, at) {
|
|
22
|
+
return value === undefined ? undefined : text(value, at);
|
|
23
23
|
}
|
|
24
|
-
function markdownBase(value) {
|
|
25
|
-
return value === null ? null : optionalText(value);
|
|
24
|
+
function markdownBase(value, at) {
|
|
25
|
+
return value === null ? null : optionalText(value, at);
|
|
26
26
|
}
|
|
27
|
-
function entries(value, each) {
|
|
27
|
+
function entries(value, at, each) {
|
|
28
28
|
if (!plain(value))
|
|
29
|
-
malformed();
|
|
29
|
+
malformed(at, 'an object of named values');
|
|
30
30
|
const read = {};
|
|
31
31
|
for (const [name, item] of Object.entries(value))
|
|
32
|
-
read[name] = each(item);
|
|
32
|
+
read[name] = each(item, `${at}.${name}`);
|
|
33
33
|
return read;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function frontmatter(item, at) {
|
|
36
|
+
return frontmatterValue(item) ? item : malformed(at, 'a frontmatter value');
|
|
37
|
+
}
|
|
38
|
+
function fieldValue(value, at) {
|
|
36
39
|
if (value === null)
|
|
37
40
|
return null;
|
|
38
41
|
if (!plain(value) || !Object.hasOwn(value, 'value') || !frontmatterValue(value.value)) {
|
|
39
|
-
malformed();
|
|
42
|
+
malformed(at, '{ value } with a frontmatter value, or null where the document lacks it');
|
|
40
43
|
}
|
|
41
44
|
return { value: value.value };
|
|
42
45
|
}
|
|
43
|
-
function textPart(value) {
|
|
46
|
+
function textPart(value, at) {
|
|
44
47
|
if (!plain(value))
|
|
45
|
-
malformed();
|
|
46
|
-
const base = optionalText(value.base);
|
|
47
|
-
return { value: text(value.value), ...(base === undefined ? {} : { base }) };
|
|
48
|
+
malformed(at, '{ value, base }');
|
|
49
|
+
const base = optionalText(value.base, `${at}.base`);
|
|
50
|
+
return { value: text(value.value, `${at}.value`), ...(base === undefined ? {} : { base }) };
|
|
48
51
|
}
|
|
49
|
-
function creationOf(value) {
|
|
52
|
+
function creationOf(value, at) {
|
|
50
53
|
if (!plain(value))
|
|
51
|
-
malformed();
|
|
54
|
+
malformed(at, '{ type, fields, sections }, or { markdown }');
|
|
52
55
|
if (Object.hasOwn(value, 'markdown'))
|
|
53
|
-
return { markdown: text(value.markdown) };
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
return { markdown: text(value.markdown, `${at}.markdown`) };
|
|
57
|
+
if (typeof value.type !== 'string')
|
|
58
|
+
malformed(`${at}.type`, 'a type name, or markdown in place of type, fields and sections');
|
|
59
|
+
return {
|
|
60
|
+
type: value.type,
|
|
61
|
+
fields: entries(value.fields, `${at}.fields`, frontmatter),
|
|
62
|
+
sections: entries(value.sections, `${at}.sections`, text),
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
|
-
const PART_NAMES =
|
|
65
|
+
const PART_NAMES = [
|
|
58
66
|
'fields',
|
|
59
67
|
'sections',
|
|
60
68
|
'preamble',
|
|
@@ -63,52 +71,57 @@ const PART_NAMES = new Set([
|
|
|
63
71
|
'move',
|
|
64
72
|
'removal',
|
|
65
73
|
'file',
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
];
|
|
75
|
+
const NAMED_PARTS = `a part named ${PART_NAMES.slice(0, -1).join(', ')} or ${PART_NAMES.at(-1)}`;
|
|
76
|
+
export function readParts(value, path) {
|
|
77
|
+
if (!plain(value))
|
|
78
|
+
malformed(path, 'an object of parts');
|
|
79
|
+
const unknown = Object.keys(value).find((name) => !PART_NAMES.includes(name));
|
|
80
|
+
if (unknown !== undefined)
|
|
81
|
+
malformed(`${path} ${unknown}`, NAMED_PARTS);
|
|
70
82
|
const parts = {};
|
|
71
83
|
if (value.fields !== undefined) {
|
|
72
|
-
parts.fields = entries(value.fields, (item) => {
|
|
84
|
+
parts.fields = entries(value.fields, `${path} fields`, (item, at) => {
|
|
73
85
|
if (!plain(item) || !Object.hasOwn(item, 'value') || !frontmatterValue(item.value)) {
|
|
74
|
-
malformed();
|
|
86
|
+
malformed(at, '{ value, base } with a frontmatter value');
|
|
75
87
|
}
|
|
76
88
|
return item.base === undefined
|
|
77
89
|
? { value: item.value }
|
|
78
|
-
: { value: item.value, base: fieldValue(item.base) };
|
|
90
|
+
: { value: item.value, base: fieldValue(item.base, `${at}.base`) };
|
|
79
91
|
});
|
|
80
92
|
}
|
|
81
93
|
if (value.sections !== undefined)
|
|
82
|
-
parts.sections = entries(value.sections, textPart);
|
|
94
|
+
parts.sections = entries(value.sections, `${path} sections`, textPart);
|
|
83
95
|
if (value.preamble !== undefined)
|
|
84
|
-
parts.preamble = textPart(value.preamble);
|
|
96
|
+
parts.preamble = textPart(value.preamble, `${path} preamble`);
|
|
85
97
|
if (value.markdown !== undefined)
|
|
86
|
-
parts.markdown = textPart(value.markdown);
|
|
98
|
+
parts.markdown = textPart(value.markdown, `${path} markdown`);
|
|
87
99
|
if (value.creation !== undefined)
|
|
88
|
-
parts.creation = creationOf(value.creation);
|
|
100
|
+
parts.creation = creationOf(value.creation, `${path} creation`);
|
|
89
101
|
if (value.move !== undefined) {
|
|
90
102
|
if (!plain(value.move))
|
|
91
|
-
malformed();
|
|
92
|
-
const base = markdownBase(value.move.base);
|
|
93
|
-
const room = optionalText(value.move.room);
|
|
103
|
+
malformed(`${path} move`, '{ to, room, base }');
|
|
104
|
+
const base = markdownBase(value.move.base, `${path} move.base`);
|
|
105
|
+
const room = optionalText(value.move.room, `${path} move.room`);
|
|
94
106
|
parts.move = {
|
|
95
|
-
to: text(value.move.to),
|
|
107
|
+
to: text(value.move.to, `${path} move.to`),
|
|
96
108
|
...(room === undefined ? {} : { room }),
|
|
97
109
|
...(base === undefined ? {} : { base }),
|
|
98
110
|
};
|
|
99
111
|
}
|
|
100
112
|
if (value.removal !== undefined) {
|
|
101
113
|
if (!plain(value.removal))
|
|
102
|
-
malformed();
|
|
103
|
-
const base = markdownBase(value.removal.base);
|
|
114
|
+
malformed(`${path} removal`, '{ base }');
|
|
115
|
+
const base = markdownBase(value.removal.base, `${path} removal.base`);
|
|
104
116
|
parts.removal = base === undefined ? {} : { base };
|
|
105
117
|
}
|
|
106
118
|
if (value.file !== undefined) {
|
|
107
119
|
if (!plain(value.file) || !(value.file.blob instanceof Blob))
|
|
108
|
-
malformed();
|
|
120
|
+
malformed(`${path} file`, '{ blob, base } with a Blob');
|
|
109
121
|
if (Object.keys(value).length > 1)
|
|
110
122
|
throw runtimeError('room-draft-file-exclusive');
|
|
111
|
-
|
|
123
|
+
const base = markdownBase(value.file.base, `${path} file.base`);
|
|
124
|
+
parts.file = base === undefined ? { blob: value.file.blob } : { blob: value.file.blob, base };
|
|
112
125
|
}
|
|
113
126
|
return parts;
|
|
114
127
|
}
|
|
@@ -137,6 +150,39 @@ function editsText(parts) {
|
|
|
137
150
|
named(parts.fields).length > 0 ||
|
|
138
151
|
named(parts.sections).length > 0);
|
|
139
152
|
}
|
|
153
|
+
function partNames(parts) {
|
|
154
|
+
const names = [];
|
|
155
|
+
for (const [name, part] of Object.entries(parts)) {
|
|
156
|
+
if (name === 'preamble' || name === 'markdown')
|
|
157
|
+
names.push(name);
|
|
158
|
+
else if ((name === 'fields' || name === 'sections') && plain(part))
|
|
159
|
+
names.push(...Object.keys(part).map((one) => `${name}/${one}`));
|
|
160
|
+
else
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return names.sort().join('\u0000');
|
|
164
|
+
}
|
|
165
|
+
function withBaseOf(prior, part) {
|
|
166
|
+
return plain(part) && plain(prior) && Object.hasOwn(prior, 'base')
|
|
167
|
+
? { ...part, base: prior.base }
|
|
168
|
+
: part;
|
|
169
|
+
}
|
|
170
|
+
export function gatheredParts(earlier, later) {
|
|
171
|
+
if (!plain(earlier) || !plain(later))
|
|
172
|
+
return null;
|
|
173
|
+
const named = partNames(earlier);
|
|
174
|
+
if (named === null || named !== partNames(later))
|
|
175
|
+
return null;
|
|
176
|
+
return Object.fromEntries(Object.entries(later).map(([name, part]) => [
|
|
177
|
+
name,
|
|
178
|
+
name === 'fields' || name === 'sections'
|
|
179
|
+
? Object.fromEntries(Object.entries(part).map(([one, value]) => [
|
|
180
|
+
one,
|
|
181
|
+
withBaseOf(earlier[name][one], value),
|
|
182
|
+
]))
|
|
183
|
+
: withBaseOf(earlier[name], part),
|
|
184
|
+
]));
|
|
185
|
+
}
|
|
140
186
|
export function held(current, parts, file) {
|
|
141
187
|
if (parts.markdown !== undefined && editsText(parts)) {
|
|
142
188
|
throw runtimeError('room-draft-markdown-exclusive');
|
|
@@ -259,18 +305,22 @@ export async function heldFile(blob, base) {
|
|
|
259
305
|
};
|
|
260
306
|
}
|
|
261
307
|
export function binaryBase(visible, path) {
|
|
262
|
-
|
|
308
|
+
const binary = visible?.binaries[path];
|
|
309
|
+
if (binary === undefined)
|
|
310
|
+
return null;
|
|
311
|
+
return visible?.revisions[path] ?? (binary.state === 'pending' ? binary.localId : null);
|
|
263
312
|
}
|
|
264
|
-
export function changedParts(path,
|
|
313
|
+
export function changedParts(path, parts, visible) {
|
|
314
|
+
const report = underneath(parts, path, visible);
|
|
315
|
+
const made = parts.file?.base === null;
|
|
265
316
|
return [
|
|
266
|
-
...(report.creation === undefined ? [] : [{ path, part: 'creation' }]),
|
|
267
317
|
...named(report.fields).map(([name]) => ({ path, part: 'field', name })),
|
|
268
318
|
...named(report.sections).map(([name]) => ({ path, part: 'section', name })),
|
|
269
319
|
...(report.preamble === undefined ? [] : [{ path, part: 'preamble' }]),
|
|
270
320
|
...(report.markdown === undefined ? [] : [{ path, part: 'markdown' }]),
|
|
271
321
|
...(report.move === undefined ? [] : [{ path, part: 'move' }]),
|
|
272
322
|
...(report.removal === undefined ? [] : [{ path, part: 'removal' }]),
|
|
273
|
-
...(report.file === undefined ? [] : [{ path, part: 'file' }]),
|
|
323
|
+
...(report.file === undefined || made ? [] : [{ path, part: 'file' }]),
|
|
274
324
|
];
|
|
275
325
|
}
|
|
276
326
|
function joined(existing, returned) {
|
|
@@ -280,7 +330,7 @@ function joined(existing, returned) {
|
|
|
280
330
|
merged[name] = part;
|
|
281
331
|
return Object.keys(merged).length === 0 ? undefined : merged;
|
|
282
332
|
}
|
|
283
|
-
function
|
|
333
|
+
export function lineEnded(text) {
|
|
284
334
|
return text === '' || text.endsWith('\n') ? text : `${text}\n`;
|
|
285
335
|
}
|
|
286
336
|
function frontmatterOf(fields) {
|
|
@@ -304,7 +354,7 @@ export function partsAfter(markdown, parts) {
|
|
|
304
354
|
];
|
|
305
355
|
if (pieces.length === 0)
|
|
306
356
|
return markdown;
|
|
307
|
-
return `${
|
|
357
|
+
return `${lineEnded(markdown)}\n${pieces.map(lineEnded).join('')}`;
|
|
308
358
|
}
|
|
309
359
|
export function returnedInto(existing, returned) {
|
|
310
360
|
if (existing === undefined)
|
|
@@ -347,6 +397,36 @@ export function moveTarget(move) {
|
|
|
347
397
|
const to = normalize(move.to);
|
|
348
398
|
return to === null || to === '' ? move.to : to;
|
|
349
399
|
}
|
|
400
|
+
export function readSavedParts(named) {
|
|
401
|
+
const read = named.map(({ path, parts }) => ({ path, parts: readParts(parts, path) }));
|
|
402
|
+
read.forEach(({ path }, at) => {
|
|
403
|
+
if (path === '' || normalize(path) !== path)
|
|
404
|
+
malformed(path, 'a path inside the Room, such as notes/a.md');
|
|
405
|
+
if (read.findIndex((one) => one.path === path) !== at)
|
|
406
|
+
malformed(path, 'each path once in one save');
|
|
407
|
+
});
|
|
408
|
+
return read;
|
|
409
|
+
}
|
|
410
|
+
export function partsChanges(named) {
|
|
411
|
+
const changes = [];
|
|
412
|
+
const preconditions = [];
|
|
413
|
+
for (const { path, parts } of readSavedParts(named)) {
|
|
414
|
+
const parted = held(undefined, parts);
|
|
415
|
+
const made = changesOf(path, parted);
|
|
416
|
+
changes.push(...made.changes);
|
|
417
|
+
preconditions.push(...made.bases);
|
|
418
|
+
for (const change of made.changes) {
|
|
419
|
+
if (change.kind === 'create')
|
|
420
|
+
preconditions.push({ kind: 'absent', path });
|
|
421
|
+
if (change.kind === 'move')
|
|
422
|
+
preconditions.push({ kind: 'absent', path: change.to });
|
|
423
|
+
}
|
|
424
|
+
const revision = parted.markdown?.base ?? parted.move?.base ?? parted.removal?.base;
|
|
425
|
+
if (typeof revision === 'string')
|
|
426
|
+
preconditions.push({ kind: 'revision', path, revision });
|
|
427
|
+
}
|
|
428
|
+
return { changes, preconditions };
|
|
429
|
+
}
|
|
350
430
|
export function changesOf(path, parts) {
|
|
351
431
|
const changes = [];
|
|
352
432
|
const bases = [];
|
|
@@ -366,11 +446,11 @@ export function changesOf(path, parts) {
|
|
|
366
446
|
bases.push({ kind: 'field', path, name, value: part.base?.value });
|
|
367
447
|
}
|
|
368
448
|
for (const [name, part] of named(parts.sections)) {
|
|
369
|
-
changes.push({ kind: 'section', path, name, value: part.value });
|
|
449
|
+
changes.push({ kind: 'section', path, name, value: lineEnded(part.value) });
|
|
370
450
|
bases.push({ kind: 'section', path, name, value: part.base });
|
|
371
451
|
}
|
|
372
452
|
if (parts.preamble !== undefined) {
|
|
373
|
-
changes.push({ kind: 'preamble', path, value: parts.preamble.value });
|
|
453
|
+
changes.push({ kind: 'preamble', path, value: lineEnded(parts.preamble.value) });
|
|
374
454
|
bases.push({ kind: 'preamble', path, value: parts.preamble.base });
|
|
375
455
|
}
|
|
376
456
|
if (parts.markdown !== undefined) {
|
|
@@ -382,7 +462,7 @@ export function changesOf(path, parts) {
|
|
|
382
462
|
if (base !== null && at !== path)
|
|
383
463
|
changes.push({ kind: 'move', path, to: at });
|
|
384
464
|
changes.push({ kind: 'binary', path: at, ...file });
|
|
385
|
-
if (base === null
|
|
465
|
+
if (base === null)
|
|
386
466
|
bases.push({ kind: 'absent', path: at });
|
|
387
467
|
return { changes, bases };
|
|
388
468
|
}
|
package/dist/rows.d.ts
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
+
import { type Outline } from '@agentshouse/mdmodel';
|
|
1
2
|
import { type Composition } from './collection.js';
|
|
2
3
|
export type ValueKind = 'string' | 'number' | 'boolean' | 'null' | 'array' | 'object' | 'undefined';
|
|
3
4
|
type HeldValue = {
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
5
|
+
readonly keys: string;
|
|
6
|
+
readonly places: string;
|
|
6
7
|
readonly item: number;
|
|
7
8
|
readonly kind: ValueKind;
|
|
8
9
|
readonly value: string | number | null;
|
|
9
10
|
readonly size: number | null;
|
|
10
|
-
readonly single: boolean;
|
|
11
11
|
};
|
|
12
12
|
type LinkKind = 'field' | 'section' | 'body';
|
|
13
13
|
type HeldLink = {
|
|
14
14
|
readonly kind: LinkKind;
|
|
15
|
-
readonly
|
|
15
|
+
readonly keys: string;
|
|
16
|
+
readonly places: string;
|
|
16
17
|
readonly target: string;
|
|
17
18
|
readonly field: string;
|
|
18
19
|
};
|
|
19
|
-
export type
|
|
20
|
+
export type Described = {
|
|
20
21
|
readonly type: string | null;
|
|
21
22
|
readonly declared: string | null;
|
|
22
23
|
readonly queried: boolean;
|
|
23
24
|
readonly folder: string;
|
|
24
25
|
readonly fields: string | null;
|
|
26
|
+
};
|
|
27
|
+
export type Derived = Described & {
|
|
25
28
|
readonly values: readonly HeldValue[];
|
|
26
29
|
readonly links: readonly HeldLink[];
|
|
27
30
|
};
|
|
@@ -29,9 +32,16 @@ export declare function documentKey(room: string, path: string): string;
|
|
|
29
32
|
export declare function roomOfKey(key: string): string;
|
|
30
33
|
export declare function pathOfKey(key: string): string;
|
|
31
34
|
export declare function markdownPath(path: string): boolean;
|
|
32
|
-
export declare function settingsTextPath(path: string): boolean;
|
|
33
35
|
export declare function folderOf(path: string): string;
|
|
36
|
+
export type Reach = 'exact' | 'value' | 'link';
|
|
37
|
+
export type Placed = {
|
|
38
|
+
readonly keys: string;
|
|
39
|
+
readonly places: string;
|
|
40
|
+
readonly glob: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare function placedOf(pointer: string, reach: Reach): Placed;
|
|
34
43
|
export declare function kindOf(value: unknown): ValueKind;
|
|
35
|
-
export declare function
|
|
44
|
+
export declare function described(path: string, content: string | null, outlined: Outline | null): Described;
|
|
45
|
+
export declare function derived(path: string, content: string | null, outlined: Outline | null, composition: Composition): Derived;
|
|
36
46
|
export {};
|
|
37
47
|
//# sourceMappingURL=rows.d.ts.map
|
package/dist/rows.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpG,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C,KAAK,QAAQ,GAAG;IACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC,CAAC;AAMF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAWD,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhG,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAuB9D;AAwBD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAMhD;AAiKD,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,QAAQ,EAAE,OAAO,GAAG,IAAI,GACvB,SAAS,CAEX;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,QAAQ,EAAE,OAAO,GAAG,IAAI,EACxB,WAAW,EAAE,WAAW,GACvB,OAAO,CAOT"}
|
package/dist/rows.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ARRAY_INDEX,
|
|
1
|
+
import { ARRAY_INDEX, escapePointer, outline, references, sectionReferences, target, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { governing } from './collection.js';
|
|
3
3
|
import { definitionOf } from './model.js';
|
|
4
4
|
function keyOf(...parts) {
|
|
@@ -16,12 +16,44 @@ export function pathOfKey(key) {
|
|
|
16
16
|
export function markdownPath(path) {
|
|
17
17
|
return path.endsWith('.md');
|
|
18
18
|
}
|
|
19
|
-
export function settingsTextPath(path) {
|
|
20
|
-
return /^settings\/.+\.ya?ml$/u.test(path);
|
|
21
|
-
}
|
|
22
19
|
export function folderOf(path) {
|
|
23
20
|
return path.slice(0, Math.max(path.lastIndexOf('/'), 0));
|
|
24
21
|
}
|
|
22
|
+
export function placedOf(pointer, reach) {
|
|
23
|
+
const [first = '', ...rest] = pointer.split('/').slice(1);
|
|
24
|
+
const keys = [first];
|
|
25
|
+
const gaps = [[]];
|
|
26
|
+
for (const segment of rest) {
|
|
27
|
+
if (ARRAY_INDEX.test(segment)) {
|
|
28
|
+
gaps.at(-1).push(segment);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
keys.push(segment);
|
|
32
|
+
gaps.push([]);
|
|
33
|
+
}
|
|
34
|
+
const places = gaps
|
|
35
|
+
.map((gap, at) => {
|
|
36
|
+
const open = at < gaps.length - 1 ? reach !== 'exact' : reach === 'link';
|
|
37
|
+
return `/${gap.map((number) => `[.:]${number}`).join('')}.${open ? '*' : ''}`;
|
|
38
|
+
})
|
|
39
|
+
.join('');
|
|
40
|
+
return {
|
|
41
|
+
keys: keys.map((key) => `/${key}`).join(''),
|
|
42
|
+
places,
|
|
43
|
+
glob: /[[*]/u.test(places),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function placesOf({ done, head, tail }) {
|
|
47
|
+
return `${done}/${head}${tail}.`;
|
|
48
|
+
}
|
|
49
|
+
function throughOf(keys, places) {
|
|
50
|
+
const gaps = places.split('/').slice(1);
|
|
51
|
+
return keys
|
|
52
|
+
.split('/')
|
|
53
|
+
.slice(1)
|
|
54
|
+
.map((key, at) => `/${key}${gaps[at].replace(/\.\d*/gu, '').replaceAll(':', '/')}`)
|
|
55
|
+
.join('');
|
|
56
|
+
}
|
|
25
57
|
function plainObject(value) {
|
|
26
58
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
27
59
|
}
|
|
@@ -50,137 +82,138 @@ function scalarOf(value) {
|
|
|
50
82
|
return JSON.stringify(value);
|
|
51
83
|
return null;
|
|
52
84
|
}
|
|
53
|
-
function held(reading,
|
|
54
|
-
const at = reading.reached.get(form) ?? 0;
|
|
55
|
-
reading.reached.set(form, at + 1);
|
|
56
|
-
const kind = kindOf(value);
|
|
85
|
+
function held(reading, keys, places, value) {
|
|
57
86
|
reading.values.push({
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
keys,
|
|
88
|
+
places,
|
|
60
89
|
item: -1,
|
|
61
|
-
kind,
|
|
90
|
+
kind: kindOf(value),
|
|
62
91
|
value: scalarOf(value),
|
|
63
92
|
size: Array.isArray(value) ? value.length : null,
|
|
64
|
-
single,
|
|
65
93
|
});
|
|
66
94
|
if (!Array.isArray(value))
|
|
67
95
|
return;
|
|
68
96
|
value.forEach((item, index) => {
|
|
69
97
|
const itemKind = kindOf(item);
|
|
70
98
|
reading.values.push({
|
|
71
|
-
|
|
72
|
-
|
|
99
|
+
keys,
|
|
100
|
+
places,
|
|
73
101
|
item: index,
|
|
74
102
|
kind: itemKind,
|
|
75
103
|
value: itemKind === 'array' ? null : scalarOf(item),
|
|
76
104
|
size: null,
|
|
77
|
-
single: false,
|
|
78
105
|
});
|
|
79
106
|
});
|
|
80
107
|
}
|
|
81
|
-
function record(reading, node,
|
|
108
|
+
function record(reading, node, at) {
|
|
82
109
|
const value = Array.isArray(node)
|
|
83
|
-
? node.map((item, index) => compared(reading, `${exact}/${index}`, item))
|
|
84
|
-
: compared(reading, exact, node);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
held(reading, form.text, value, !form.through && value !== undefined && !plainObject(value));
|
|
89
|
-
}
|
|
90
|
-
if (Array.isArray(node) || plainObject(node) || !reading.references.has(exact))
|
|
110
|
+
? node.map((item, index) => compared(reading, `${at.exact}/${index}`, item))
|
|
111
|
+
: compared(reading, at.exact, node);
|
|
112
|
+
const places = placesOf(at);
|
|
113
|
+
held(reading, at.keys, places, value);
|
|
114
|
+
if (typeof value !== 'string' || !reading.references.has(at.exact))
|
|
91
115
|
return;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
reading.targets.set(`${field}\u0000${found}`, kept);
|
|
103
|
-
}
|
|
104
|
-
function walk(reading, node, forms, exact) {
|
|
105
|
-
record(reading, node, forms, exact);
|
|
116
|
+
reading.links.push({
|
|
117
|
+
kind: 'field',
|
|
118
|
+
keys: at.keys,
|
|
119
|
+
places,
|
|
120
|
+
target: value,
|
|
121
|
+
field: throughOf(at.keys, places),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function walk(reading, node, at) {
|
|
125
|
+
record(reading, node, at);
|
|
106
126
|
if (Array.isArray(node)) {
|
|
107
|
-
node.forEach((item, index) => walk(reading, item,
|
|
108
|
-
...(form.pending
|
|
109
|
-
? []
|
|
110
|
-
: [{ text: `${form.text}/${index}`, through: form.through, pending: false }]),
|
|
111
|
-
{ text: form.text, through: true, pending: true },
|
|
112
|
-
]), `${exact}/${index}`));
|
|
127
|
+
node.forEach((item, index) => walk(reading, item, { ...at, tail: `${at.tail}.${index}`, exact: `${at.exact}/${index}` }));
|
|
113
128
|
return;
|
|
114
129
|
}
|
|
115
130
|
if (!plainObject(node))
|
|
116
131
|
return;
|
|
117
132
|
for (const [key, value] of Object.entries(node)) {
|
|
118
133
|
const segment = escapePointer(key);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
const exact = `${at.exact}/${segment}`;
|
|
135
|
+
walk(reading, value, ARRAY_INDEX.test(segment)
|
|
136
|
+
? { ...at, head: `${at.head}${at.tail.replaceAll('.', ':')}:${segment}`, tail: '', exact }
|
|
137
|
+
: { keys: `${at.keys}/${segment}`, done: placesOf(at), head: '', tail: '', exact });
|
|
122
138
|
}
|
|
123
139
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
const found = [];
|
|
127
|
-
for (const { target: reached } of bodyLinks(bodyAfterFrontmatter(content), path)) {
|
|
128
|
-
if (seen.has(reached))
|
|
129
|
-
continue;
|
|
130
|
-
seen.add(reached);
|
|
131
|
-
found.push({ kind: 'body', form: '', target: reached, field: '' });
|
|
132
|
-
}
|
|
133
|
-
return found;
|
|
140
|
+
function bodyOf(targets) {
|
|
141
|
+
return targets.map((target) => ({ kind: 'body', keys: '', places: '', target, field: '' }));
|
|
134
142
|
}
|
|
135
|
-
function typedRows(path, content, document, composition) {
|
|
143
|
+
function typedRows(path, content, document, composition, body) {
|
|
136
144
|
const definition = definitionOf(governing(composition, path), document.type);
|
|
137
145
|
const reading = {
|
|
138
146
|
path,
|
|
139
147
|
references: new Set(definition === undefined ? [] : references(document, definition).map((one) => one.pointer)),
|
|
140
148
|
values: [],
|
|
141
|
-
|
|
142
|
-
targets: new Map(),
|
|
149
|
+
links: [],
|
|
143
150
|
};
|
|
144
151
|
for (const [name, value] of Object.entries(document.fields)) {
|
|
145
152
|
const segment = escapePointer(name);
|
|
146
|
-
walk(reading, value,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
+
walk(reading, value, {
|
|
154
|
+
keys: `/${segment}`,
|
|
155
|
+
done: '',
|
|
156
|
+
head: '',
|
|
157
|
+
tail: '',
|
|
158
|
+
exact: `/${segment}`,
|
|
159
|
+
});
|
|
153
160
|
}
|
|
154
|
-
|
|
161
|
+
const links = reading.links;
|
|
162
|
+
if (definition !== undefined && content !== null) {
|
|
155
163
|
const sectioned = new Set();
|
|
156
164
|
for (const { target: reached } of sectionReferences(path, content, definition)) {
|
|
157
165
|
if (reached === null || sectioned.has(reached))
|
|
158
166
|
continue;
|
|
159
167
|
sectioned.add(reached);
|
|
160
|
-
links.push({ kind: 'section',
|
|
168
|
+
links.push({ kind: 'section', keys: '', places: '', target: reached, field: '' });
|
|
161
169
|
}
|
|
162
170
|
}
|
|
163
|
-
return { values: reading.values, links: [...links, ...
|
|
171
|
+
return { values: reading.values, links: [...links, ...body] };
|
|
164
172
|
}
|
|
165
|
-
|
|
173
|
+
function readOf(path, declared, document) {
|
|
166
174
|
const folder = folderOf(path);
|
|
167
|
-
const unread = {
|
|
168
|
-
if (
|
|
169
|
-
return { ...unread, declared:
|
|
170
|
-
const read = parseFrontmatter(content, path);
|
|
171
|
-
const declared = read.ok ? (read.frontmatter.type ?? 'any') : null;
|
|
172
|
-
if (!markdownPath(path)) {
|
|
173
|
-
return { ...unread, declared, queried: true, links: bodyTargets(path, content) };
|
|
175
|
+
const unread = { fields: null, folder, type: null };
|
|
176
|
+
if (!markdownPath(path) || document === null) {
|
|
177
|
+
return { described: { ...unread, declared, queried: !markdownPath(path) }, document: null };
|
|
174
178
|
}
|
|
175
|
-
if (!read.ok)
|
|
176
|
-
return { ...unread, declared, queried: false };
|
|
177
|
-
const document = read.frontmatter;
|
|
178
179
|
return {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
described: {
|
|
181
|
+
type: document.type ?? 'any',
|
|
182
|
+
declared,
|
|
183
|
+
queried: true,
|
|
184
|
+
folder,
|
|
185
|
+
fields: JSON.stringify(document.fields),
|
|
186
|
+
},
|
|
187
|
+
document,
|
|
185
188
|
};
|
|
186
189
|
}
|
|
190
|
+
function read(path, content, outlined) {
|
|
191
|
+
const held = content === null ? outlined : outline(content, path);
|
|
192
|
+
if (held === null) {
|
|
193
|
+
return {
|
|
194
|
+
described: {
|
|
195
|
+
fields: null,
|
|
196
|
+
folder: folderOf(path),
|
|
197
|
+
type: null,
|
|
198
|
+
declared: null,
|
|
199
|
+
queried: true,
|
|
200
|
+
},
|
|
201
|
+
document: null,
|
|
202
|
+
links: [],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const type = held.type === null || held.type === 'any' ? undefined : held.type;
|
|
206
|
+
const document = held.fields === null ? null : { type, fields: held.fields };
|
|
207
|
+
return { ...readOf(path, held.type, document), links: held.links };
|
|
208
|
+
}
|
|
209
|
+
export function described(path, content, outlined) {
|
|
210
|
+
return read(path, content, outlined).described;
|
|
211
|
+
}
|
|
212
|
+
export function derived(path, content, outlined, composition) {
|
|
213
|
+
const { described: columns, document, links } = read(path, content, outlined);
|
|
214
|
+
const body = bodyOf(links);
|
|
215
|
+
if (document !== null) {
|
|
216
|
+
return { ...columns, ...typedRows(path, content, document, composition, body) };
|
|
217
|
+
}
|
|
218
|
+
return { ...columns, values: [], links: markdownPath(path) ? [] : body };
|
|
219
|
+
}
|
package/dist/save.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type SaveInput = {
|
|
|
21
21
|
providerOwnedPaths: readonly string[];
|
|
22
22
|
providerLimits: readonly ProviderLimit[];
|
|
23
23
|
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
24
25
|
handle: string;
|
|
25
26
|
changes: readonly Change[];
|
|
26
27
|
bases: readonly Precondition[];
|
|
@@ -75,6 +76,7 @@ export type MoveSide = {
|
|
|
75
76
|
operations: OperationScopes;
|
|
76
77
|
providerOwnedPaths: readonly string[];
|
|
77
78
|
visible: VisibleLayer;
|
|
79
|
+
folders: ReadonlySet<string>;
|
|
78
80
|
queued: ReadonlySet<string>;
|
|
79
81
|
unmodeled: boolean;
|
|
80
82
|
validate: Validator;
|