@agentshouse/mdruntime 0.1.0-c967d1ca66fee → 0.1.0-c96e80d38e5f0
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 +22 -9
- package/dist/adapter.d.ts +172 -49
- 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 +27 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +184 -84
- 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 +41 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +34 -0
- package/dist/client.d.ts +34 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +104 -8
- package/dist/collection.d.ts +10 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +38 -79
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +789 -0
- package/dist/connection.d.ts +51 -17
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3951 -907
- package/dist/conversation.d.ts +48 -19
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +726 -240
- 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 +4 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +152 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -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/host.d.ts +12 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +125 -18
- 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 +9 -0
- package/dist/live.d.ts +22 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +123 -0
- 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 +18 -7
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +231 -91
- 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 +9 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -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/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +52 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +46 -0
- package/dist/overlay.d.ts +15 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +129 -177
- 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 +72 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +67 -7
- package/dist/reach.d.ts +16 -2
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +222 -56
- package/dist/react.d.ts +11 -7
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/readiness.d.ts +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +224 -0
- package/dist/refresh.d.ts +17 -14
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -56
- package/dist/replica.d.ts +58 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +310 -159
- package/dist/room-draft.d.ts +52 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +261 -56
- package/dist/rows.d.ts +38 -35
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +178 -102
- package/dist/save.d.ts +70 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +805 -147
- package/dist/search.d.ts +15 -55
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- 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 +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -0
- package/dist/status.d.ts +5 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +116 -80
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +355 -461
- package/dist/stored.d.ts +162 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +549 -0
- package/dist/tables.d.ts +353 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +585 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- 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 +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +101 -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 +166 -30
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +57 -29
- package/package.json +26 -15
- package/AGENTS.md +0 -269
- 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, 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) {
|
|
@@ -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,158 @@ 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
|
-
|
|
69
|
-
return ['', ...parts.map((_, index) => parts.slice(0, index + 1).join('/'))];
|
|
140
|
+
function bodyOf(targets) {
|
|
141
|
+
return targets.map((target) => ({ kind: 'body', keys: '', places: '', target, field: '' }));
|
|
70
142
|
}
|
|
71
|
-
|
|
72
|
-
return path.endsWith('.md');
|
|
73
|
-
}
|
|
74
|
-
export function rowsOf(room, path, document, composition, change) {
|
|
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
|
-
];
|
|
93
|
-
}
|
|
94
|
-
const type = document.type ?? 'any';
|
|
143
|
+
function typedRows(path, content, document, composition, body) {
|
|
95
144
|
const definition = definitionOf(governing(composition, path), document.type);
|
|
96
145
|
const reading = {
|
|
97
146
|
path,
|
|
98
147
|
references: new Set(definition === undefined ? [] : references(document, definition).map((one) => one.pointer)),
|
|
99
|
-
values:
|
|
100
|
-
|
|
101
|
-
targets: new Map(),
|
|
148
|
+
values: [],
|
|
149
|
+
links: [],
|
|
102
150
|
};
|
|
103
151
|
for (const [name, value] of Object.entries(document.fields)) {
|
|
104
152
|
const segment = escapePointer(name);
|
|
105
|
-
walk(reading, value,
|
|
153
|
+
walk(reading, value, {
|
|
154
|
+
keys: `/${segment}`,
|
|
155
|
+
done: '',
|
|
156
|
+
head: '',
|
|
157
|
+
tail: '',
|
|
158
|
+
exact: `/${segment}`,
|
|
159
|
+
});
|
|
106
160
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
161
|
+
const links = reading.links;
|
|
162
|
+
if (definition !== undefined && content !== null) {
|
|
163
|
+
const sectioned = new Set();
|
|
164
|
+
for (const { target: reached } of sectionReferences(path, content, definition)) {
|
|
165
|
+
if (reached === null || sectioned.has(reached))
|
|
166
|
+
continue;
|
|
167
|
+
sectioned.add(reached);
|
|
168
|
+
links.push({ kind: 'section', keys: '', places: '', target: reached, field: '' });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return { values: reading.values, links: [...links, ...body] };
|
|
172
|
+
}
|
|
173
|
+
function readOf(path, declared, document) {
|
|
174
|
+
const folder = folderOf(path);
|
|
175
|
+
const unread = { fields: null, folder, type: null };
|
|
176
|
+
if (!markdownPath(path) || document === null) {
|
|
177
|
+
return { described: { ...unread, declared, queried: !markdownPath(path) }, document: null };
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
described: {
|
|
181
|
+
type: document.type ?? 'any',
|
|
182
|
+
declared,
|
|
183
|
+
queried: true,
|
|
184
|
+
folder,
|
|
185
|
+
fields: JSON.stringify(document.fields),
|
|
130
186
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
187
|
+
document,
|
|
188
|
+
};
|
|
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 };
|
|
143
219
|
}
|
package/dist/save.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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 = {
|
|
@@ -19,18 +21,83 @@ export type SaveInput = {
|
|
|
19
21
|
providerOwnedPaths: readonly string[];
|
|
20
22
|
providerLimits: readonly ProviderLimit[];
|
|
21
23
|
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
22
25
|
handle: string;
|
|
23
26
|
changes: readonly Change[];
|
|
24
27
|
bases: readonly Precondition[];
|
|
28
|
+
queued?: ReadonlySet<string>;
|
|
25
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;
|
|
26
37
|
};
|
|
27
38
|
export type BatchResult = {
|
|
28
39
|
kind: 'batch';
|
|
29
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[];
|
|
30
62
|
} | {
|
|
31
63
|
kind: 'refused';
|
|
32
64
|
refusal: SaveRefusal;
|
|
33
65
|
};
|
|
34
|
-
|
|
35
|
-
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 {};
|
|
36
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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