@agentshouse/mdruntime 0.1.0-cf6d5f0a5c9c8 → 0.1.0-cf6e25bcd52f6
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 -8
- package/dist/adapter.d.ts +139 -32
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +38 -4
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +70 -0
- package/dist/binary.d.ts +18 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +32 -9
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +192 -67
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -62
- package/dist/change.d.ts +45 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +34 -0
- package/dist/client.d.ts +33 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +123 -21
- package/dist/collection.d.ts +12 -6
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +51 -76
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +765 -0
- package/dist/connection.d.ts +60 -20
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3825 -793
- package/dist/conversation.d.ts +42 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +642 -188
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +5 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +19 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +151 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/fulltext.d.ts +27 -0
- package/dist/fulltext.d.ts.map +1 -0
- package/dist/fulltext.js +368 -0
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +134 -22
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +9 -0
- package/dist/index.d.ts +19 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/live.d.ts +22 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +124 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +208 -0
- package/dist/memory.d.ts +12 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +128 -29
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +90 -0
- package/dist/model.d.ts +13 -4
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +17 -2
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +20 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +113 -12
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +73 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +81 -1
- package/dist/overlay.d.ts +15 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +136 -180
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +70 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +51 -7
- package/dist/reach.d.ts +18 -4
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +246 -68
- package/dist/react.d.ts +12 -8
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +8 -17
- package/dist/readiness.d.ts +64 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +100 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +198 -0
- package/dist/refresh.d.ts +16 -15
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +113 -54
- package/dist/replica.d.ts +59 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +320 -159
- package/dist/room-draft.d.ts +41 -9
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +185 -36
- package/dist/rows.d.ts +37 -35
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +173 -102
- package/dist/save.d.ts +73 -4
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +820 -151
- package/dist/search.d.ts +41 -29
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +37 -105
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +16 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +431 -0
- package/dist/status.d.ts +11 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -9
- package/dist/store.d.ts +130 -80
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +376 -457
- package/dist/stored.d.ts +154 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +578 -0
- package/dist/tables.d.ts +362 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +627 -0
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +162 -0
- package/dist/windows.d.ts +22 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +89 -0
- package/dist/wire.d.ts +172 -33
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +68 -31
- package/dist/words.d.ts +19 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +156 -0
- package/package.json +26 -15
- package/AGENTS.md +0 -253
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -433
package/dist/rows.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ARRAY_INDEX, escapePointer, references, target, } from '@agentshouse/mdmodel';
|
|
1
|
+
import { ARRAY_INDEX, bodyAfterFrontmatter, bodyLinks, escapePointer, parseFrontmatter, 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) {
|
|
@@ -10,6 +10,50 @@ export function documentKey(room, path) {
|
|
|
10
10
|
export function roomOfKey(key) {
|
|
11
11
|
return key.split('\u0000')[1];
|
|
12
12
|
}
|
|
13
|
+
export function pathOfKey(key) {
|
|
14
|
+
return key.split('\u0000')[2];
|
|
15
|
+
}
|
|
16
|
+
export function markdownPath(path) {
|
|
17
|
+
return path.endsWith('.md');
|
|
18
|
+
}
|
|
19
|
+
export function folderOf(path) {
|
|
20
|
+
return path.slice(0, Math.max(path.lastIndexOf('/'), 0));
|
|
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
|
+
}
|
|
13
57
|
function plainObject(value) {
|
|
14
58
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
15
59
|
}
|
|
@@ -18,126 +62,153 @@ function compared(reading, exact, value) {
|
|
|
18
62
|
return value;
|
|
19
63
|
return (typeof value === 'string' ? target(reading.path, value) : null) ?? undefined;
|
|
20
64
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (
|
|
65
|
+
export function kindOf(value) {
|
|
66
|
+
if (value === undefined)
|
|
67
|
+
return 'undefined';
|
|
68
|
+
if (value === null)
|
|
69
|
+
return 'null';
|
|
70
|
+
if (Array.isArray(value))
|
|
71
|
+
return 'array';
|
|
72
|
+
if (typeof value === 'object')
|
|
73
|
+
return 'object';
|
|
74
|
+
return typeof value;
|
|
75
|
+
}
|
|
76
|
+
function scalarOf(value) {
|
|
77
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
78
|
+
return value;
|
|
79
|
+
if (typeof value === 'boolean')
|
|
80
|
+
return value ? 1 : 0;
|
|
81
|
+
if (Array.isArray(value))
|
|
82
|
+
return JSON.stringify(value);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function held(reading, keys, places, value) {
|
|
86
|
+
reading.values.push({
|
|
87
|
+
keys,
|
|
88
|
+
places,
|
|
89
|
+
item: -1,
|
|
90
|
+
kind: kindOf(value),
|
|
91
|
+
value: scalarOf(value),
|
|
92
|
+
size: Array.isArray(value) ? value.length : null,
|
|
93
|
+
});
|
|
94
|
+
if (!Array.isArray(value))
|
|
34
95
|
return;
|
|
35
|
-
|
|
36
|
-
|
|
96
|
+
value.forEach((item, index) => {
|
|
97
|
+
const itemKind = kindOf(item);
|
|
98
|
+
reading.values.push({
|
|
99
|
+
keys,
|
|
100
|
+
places,
|
|
101
|
+
item: index,
|
|
102
|
+
kind: itemKind,
|
|
103
|
+
value: itemKind === 'array' ? null : scalarOf(item),
|
|
104
|
+
size: null,
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function record(reading, node, at) {
|
|
109
|
+
const value = Array.isArray(node)
|
|
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))
|
|
37
115
|
return;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
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);
|
|
49
126
|
if (Array.isArray(node)) {
|
|
50
|
-
node.forEach((item, index) => walk(reading, item,
|
|
51
|
-
...(form.pending
|
|
52
|
-
? []
|
|
53
|
-
: [{ text: `${form.text}/${index}`, through: form.through, pending: false }]),
|
|
54
|
-
{ text: form.text, through: true, pending: true },
|
|
55
|
-
]), `${exact}/${index}`));
|
|
127
|
+
node.forEach((item, index) => walk(reading, item, { ...at, tail: `${at.tail}.${index}`, exact: `${at.exact}/${index}` }));
|
|
56
128
|
return;
|
|
57
129
|
}
|
|
58
130
|
if (!plainObject(node))
|
|
59
131
|
return;
|
|
60
132
|
for (const [key, value] of Object.entries(node)) {
|
|
61
133
|
const segment = escapePointer(key);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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 });
|
|
65
138
|
}
|
|
66
139
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const key = documentKey(room, path);
|
|
76
|
-
const body = keyOf('b', room, path);
|
|
77
|
-
if (document === null || !markdownPath(path)) {
|
|
78
|
-
return [
|
|
79
|
-
{
|
|
80
|
-
key,
|
|
81
|
-
kind: 'document',
|
|
82
|
-
room,
|
|
83
|
-
path,
|
|
84
|
-
type: null,
|
|
85
|
-
fields: {},
|
|
86
|
-
values: {},
|
|
87
|
-
reached: {},
|
|
88
|
-
directories: directoriesOf(path),
|
|
89
|
-
body,
|
|
90
|
-
change,
|
|
91
|
-
},
|
|
92
|
-
];
|
|
140
|
+
function bodyTargets(path, content) {
|
|
141
|
+
const seen = new Set();
|
|
142
|
+
const found = [];
|
|
143
|
+
for (const { target: reached } of bodyLinks(bodyAfterFrontmatter(content), path)) {
|
|
144
|
+
if (seen.has(reached))
|
|
145
|
+
continue;
|
|
146
|
+
seen.add(reached);
|
|
147
|
+
found.push({ kind: 'body', keys: '', places: '', target: reached, field: '' });
|
|
93
148
|
}
|
|
94
|
-
|
|
149
|
+
return found;
|
|
150
|
+
}
|
|
151
|
+
function typedRows(path, content, document, composition) {
|
|
95
152
|
const definition = definitionOf(governing(composition, path), document.type);
|
|
96
153
|
const reading = {
|
|
97
154
|
path,
|
|
98
155
|
references: new Set(definition === undefined ? [] : references(document, definition).map((one) => one.pointer)),
|
|
99
|
-
values:
|
|
100
|
-
|
|
101
|
-
targets: new Map(),
|
|
156
|
+
values: [],
|
|
157
|
+
links: [],
|
|
102
158
|
};
|
|
103
159
|
for (const [name, value] of Object.entries(document.fields)) {
|
|
104
160
|
const segment = escapePointer(name);
|
|
105
|
-
walk(reading, value,
|
|
161
|
+
walk(reading, value, {
|
|
162
|
+
keys: `/${segment}`,
|
|
163
|
+
done: '',
|
|
164
|
+
head: '',
|
|
165
|
+
tail: '',
|
|
166
|
+
exact: `/${segment}`,
|
|
167
|
+
});
|
|
106
168
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
169
|
+
const links = reading.links;
|
|
170
|
+
if (definition !== undefined) {
|
|
171
|
+
const sectioned = new Set();
|
|
172
|
+
for (const { target: reached } of sectionReferences(path, content, definition)) {
|
|
173
|
+
if (reached === null || sectioned.has(reached))
|
|
174
|
+
continue;
|
|
175
|
+
sectioned.add(reached);
|
|
176
|
+
links.push({ kind: 'section', keys: '', places: '', target: reached, field: '' });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { values: reading.values, links: [...links, ...bodyTargets(path, content)] };
|
|
180
|
+
}
|
|
181
|
+
function read(path, content) {
|
|
182
|
+
const folder = folderOf(path);
|
|
183
|
+
const unread = { fields: null, folder, type: null };
|
|
184
|
+
if (content === null) {
|
|
185
|
+
return { described: { ...unread, declared: null, queried: true }, document: null };
|
|
186
|
+
}
|
|
187
|
+
const parsed = parseFrontmatter(content, path);
|
|
188
|
+
const declared = parsed.ok ? (parsed.frontmatter.type ?? 'any') : null;
|
|
189
|
+
if (!markdownPath(path) || !parsed.ok) {
|
|
190
|
+
return { described: { ...unread, declared, queried: !markdownPath(path) }, document: null };
|
|
191
|
+
}
|
|
192
|
+
const document = parsed.frontmatter;
|
|
193
|
+
return {
|
|
194
|
+
described: {
|
|
195
|
+
type: document.type ?? 'any',
|
|
196
|
+
declared,
|
|
197
|
+
queried: true,
|
|
198
|
+
folder,
|
|
199
|
+
fields: JSON.stringify(document.fields),
|
|
130
200
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
];
|
|
201
|
+
document,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export function described(path, content) {
|
|
205
|
+
return read(path, content).described;
|
|
206
|
+
}
|
|
207
|
+
export function derived(path, content, composition) {
|
|
208
|
+
const { described: columns, document } = read(path, content);
|
|
209
|
+
if (document !== null) {
|
|
210
|
+
return { ...columns, ...typedRows(path, content, document, composition) };
|
|
211
|
+
}
|
|
212
|
+
const links = content === null || markdownPath(path) ? [] : bodyTargets(path, content);
|
|
213
|
+
return { ...columns, values: [], links };
|
|
143
214
|
}
|
package/dist/save.d.ts
CHANGED
|
@@ -1,34 +1,103 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Validation } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
2
3
|
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
3
4
|
import { type Composition } from './collection.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
4
6
|
import type { VisibleLayer } from './replica.js';
|
|
5
7
|
import type { ChangedPart } from './room-draft.js';
|
|
6
8
|
export type SaveRefusal = {
|
|
7
|
-
|
|
9
|
+
code: string;
|
|
10
|
+
retryable: boolean;
|
|
8
11
|
file?: string;
|
|
9
12
|
location?: string;
|
|
10
13
|
referrers?: readonly string[];
|
|
11
14
|
parts?: readonly ChangedPart[];
|
|
12
15
|
};
|
|
13
16
|
export type SaveInput = {
|
|
17
|
+
local: boolean;
|
|
14
18
|
composition: Composition;
|
|
15
19
|
baseRoomVersion: string;
|
|
16
20
|
operations: import('./adapter.js').OperationScopes;
|
|
17
21
|
providerOwnedPaths: readonly string[];
|
|
18
22
|
providerLimits: readonly ProviderLimit[];
|
|
19
23
|
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
20
25
|
handle: string;
|
|
21
26
|
changes: readonly Change[];
|
|
22
27
|
bases: readonly Precondition[];
|
|
28
|
+
queued?: ReadonlySet<string>;
|
|
23
29
|
writtenBy?: WrittenBy;
|
|
30
|
+
unmodeled: boolean;
|
|
31
|
+
validate: Validator;
|
|
32
|
+
};
|
|
33
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
34
|
+
type Refusing = {
|
|
35
|
+
kind: 'refused';
|
|
36
|
+
refusal: SaveRefusal;
|
|
24
37
|
};
|
|
25
38
|
export type BatchResult = {
|
|
26
39
|
kind: 'batch';
|
|
27
40
|
batch: ChangeBatch;
|
|
41
|
+
} | Refusing;
|
|
42
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
43
|
+
export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
44
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
45
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
46
|
+
export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
|
|
47
|
+
export type Requeued = {
|
|
48
|
+
kind: 'requeued';
|
|
49
|
+
queue: readonly ChangeBatch[];
|
|
50
|
+
changes: readonly Change[];
|
|
51
|
+
queued: ReadonlySet<string>;
|
|
52
|
+
withdrawn: ReadonlyMap<string, ChangeBatch | null>;
|
|
53
|
+
owners: ReadonlySet<string>;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'refused';
|
|
56
|
+
refusal: SaveRefusal;
|
|
57
|
+
};
|
|
58
|
+
export type Joining = {
|
|
59
|
+
kind: 'joined';
|
|
60
|
+
batch: ChangeBatch;
|
|
61
|
+
queue: readonly ChangeBatch[];
|
|
28
62
|
} | {
|
|
29
63
|
kind: 'refused';
|
|
30
64
|
refusal: SaveRefusal;
|
|
31
65
|
};
|
|
32
|
-
|
|
33
|
-
export declare function
|
|
66
|
+
type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
67
|
+
export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
|
|
68
|
+
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
69
|
+
export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
|
|
70
|
+
export declare const MOVE_DOCUMENTS = "move-documents";
|
|
71
|
+
export type MoveSide = {
|
|
72
|
+
room: string;
|
|
73
|
+
handle: string;
|
|
74
|
+
baseRoomVersion: string;
|
|
75
|
+
composition: Composition;
|
|
76
|
+
operations: OperationScopes;
|
|
77
|
+
providerOwnedPaths: readonly string[];
|
|
78
|
+
visible: VisibleLayer;
|
|
79
|
+
folders: ReadonlySet<string>;
|
|
80
|
+
queued: ReadonlySet<string>;
|
|
81
|
+
unmodeled: boolean;
|
|
82
|
+
validate: Validator;
|
|
83
|
+
};
|
|
84
|
+
export type MoveInput = {
|
|
85
|
+
source: MoveSide;
|
|
86
|
+
destination: MoveSide;
|
|
87
|
+
moves: readonly {
|
|
88
|
+
readonly path: string;
|
|
89
|
+
readonly to: string;
|
|
90
|
+
}[];
|
|
91
|
+
providerLimits: readonly ProviderLimit[];
|
|
92
|
+
local: boolean;
|
|
93
|
+
writtenBy?: WrittenBy;
|
|
94
|
+
};
|
|
95
|
+
export type MoveResult = {
|
|
96
|
+
kind: 'moved';
|
|
97
|
+
leaving: ChangeBatch;
|
|
98
|
+
arriving: ChangeBatch;
|
|
99
|
+
} | Refusing;
|
|
100
|
+
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
101
|
+
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
102
|
+
export {};
|
|
34
103
|
//# sourceMappingURL=save.d.ts.map
|
package/dist/save.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AACA,OAAO,EAkBL,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,cAAc,EAAE,eAAe,CAAC;IACnD,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE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