@agentshouse/mdruntime 0.1.0-ce5c5bb29be5a → 0.1.0-ce6bc9239a3ee
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 +2 -2
- package/dist/acceptance.d.ts +26 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +384 -0
- package/dist/adapter.d.ts +81 -49
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +21 -56
- package/dist/bootstrap.d.ts +9 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +209 -75
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +2 -0
- package/dist/client.d.ts +16 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -1
- package/dist/collection.d.ts +2 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +262 -318
- package/dist/connection.d.ts +20 -44
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1438 -3393
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +47 -0
- package/dist/conversation.d.ts +26 -17
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +441 -307
- package/dist/durability.d.ts +6 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -7
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/host.d.ts +4 -6
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +22 -26
- 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 +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/install.d.ts +86 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +63 -22
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/memory.d.ts +11 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +171 -81
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +97 -19
- package/dist/model.d.ts +2 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -9
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +7 -2
- package/dist/outcome.d.ts +1 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -0
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/query.d.ts +14 -209
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +32 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +118 -0
- package/dist/reach.d.ts +12 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +182 -136
- package/dist/react.d.ts +5 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +0 -2
- package/dist/readiness.d.ts.map +1 -1
- package/dist/reads.d.ts +36 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +136 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +9 -1
- package/dist/refresh.d.ts +6 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +32 -4
- package/dist/replica.d.ts +8 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +50 -15
- package/dist/room-draft.d.ts +4 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +65 -52
- package/dist/room-drafts.d.ts +29 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -184
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +11 -8
- package/dist/saves.d.ts +96 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +999 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +16 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +66 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket.d.ts +43 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +96 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/watchers.d.ts +15 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +36 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +78 -145
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +117 -367
- package/dist/stored.d.ts +58 -32
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +264 -187
- package/dist/tables.d.ts +107 -25
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +193 -47
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +7 -4
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +15 -4
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -1
- package/package.json +2 -2
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -370
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -156
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { composedOf } from '../collection.js';
|
|
2
|
+
import { binaryLocalId } from '../identity.js';
|
|
3
|
+
const FILE = '\u0000file';
|
|
4
|
+
function batchFacts(batch) {
|
|
5
|
+
return { paths: batch.changes.map(({ path }) => path), moving: batch.between !== undefined };
|
|
6
|
+
}
|
|
7
|
+
function batchFiles(batch) {
|
|
8
|
+
return batch.changes.flatMap((change) => (change.kind === 'binary' ? [change.localId] : []));
|
|
9
|
+
}
|
|
10
|
+
function draftFiles(drafts) {
|
|
11
|
+
return drafts.flatMap(({ parts }) => (parts.file === undefined ? [] : [parts.file.localId]));
|
|
12
|
+
}
|
|
13
|
+
function roomDraftRow(record) {
|
|
14
|
+
return { path: record.path, record: JSON.stringify(record), files: draftFiles([record]) };
|
|
15
|
+
}
|
|
16
|
+
function authoredRows({ locator, queue, stored, founded, saved, roomDrafts, consumedRoomDrafts, }) {
|
|
17
|
+
const held = new Set((stored ?? []).map(({ id }) => id));
|
|
18
|
+
return {
|
|
19
|
+
locator,
|
|
20
|
+
...(queue === undefined
|
|
21
|
+
? {}
|
|
22
|
+
: {
|
|
23
|
+
order: queue.map(({ id }) => id),
|
|
24
|
+
added: queue
|
|
25
|
+
.filter(({ id }) => !held.has(id))
|
|
26
|
+
.map((batch) => {
|
|
27
|
+
const drafts = saved?.get(batch.id) ?? [];
|
|
28
|
+
return {
|
|
29
|
+
id: batch.id,
|
|
30
|
+
batch: JSON.stringify(batch),
|
|
31
|
+
state: JSON.stringify({
|
|
32
|
+
drafts,
|
|
33
|
+
submission: { state: 'waiting' },
|
|
34
|
+
lost: false,
|
|
35
|
+
}),
|
|
36
|
+
files: [...batchFiles(batch), ...draftFiles(drafts)],
|
|
37
|
+
...batchFacts(batch),
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
...(founded === undefined
|
|
42
|
+
? {}
|
|
43
|
+
: {
|
|
44
|
+
founded: founded.map((batch) => ({
|
|
45
|
+
id: batch.id,
|
|
46
|
+
batch: JSON.stringify(batch),
|
|
47
|
+
files: batchFiles(batch),
|
|
48
|
+
...batchFacts(batch),
|
|
49
|
+
})),
|
|
50
|
+
}),
|
|
51
|
+
...(roomDrafts === undefined ? {} : { roomDrafts: roomDrafts.map(roomDraftRow) }),
|
|
52
|
+
...(consumedRoomDrafts === undefined ? {} : { consumedRoomDrafts }),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function marked(value) {
|
|
56
|
+
return typeof value === 'object' && value !== null && FILE in value;
|
|
57
|
+
}
|
|
58
|
+
function keyed(keys, value) {
|
|
59
|
+
const stored = [];
|
|
60
|
+
const files = [];
|
|
61
|
+
const record = JSON.stringify(value, (_name, held) => {
|
|
62
|
+
if (!(held instanceof Blob))
|
|
63
|
+
return held;
|
|
64
|
+
let key = keys.get(held);
|
|
65
|
+
if (key === undefined) {
|
|
66
|
+
key = binaryLocalId();
|
|
67
|
+
keys.set(held, key);
|
|
68
|
+
}
|
|
69
|
+
stored.push({ key, blob: held });
|
|
70
|
+
files.push(key);
|
|
71
|
+
return { [FILE]: key, type: held.type };
|
|
72
|
+
});
|
|
73
|
+
return { record, files, stored };
|
|
74
|
+
}
|
|
75
|
+
async function filed(value, read) {
|
|
76
|
+
if (Array.isArray(value))
|
|
77
|
+
return Promise.all(value.map((item) => filed(item, read)));
|
|
78
|
+
if (marked(value))
|
|
79
|
+
return read(value[FILE], value.type);
|
|
80
|
+
if (typeof value !== 'object' || value === null)
|
|
81
|
+
return value;
|
|
82
|
+
const restored = {};
|
|
83
|
+
for (const [name, item] of Object.entries(value))
|
|
84
|
+
restored[name] = await filed(item, read);
|
|
85
|
+
return restored;
|
|
86
|
+
}
|
|
87
|
+
function roomOf(row) {
|
|
88
|
+
return {
|
|
89
|
+
record: { ...JSON.parse(row.record), key: row.key },
|
|
90
|
+
indexed: row.indexed,
|
|
91
|
+
documents: row.documents,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function json(value, fallback) {
|
|
95
|
+
return value === undefined ? fallback : JSON.parse(value);
|
|
96
|
+
}
|
|
97
|
+
export function openRuntimeStore(authored) {
|
|
98
|
+
const keys = new WeakMap();
|
|
99
|
+
const read = async (key, type) => {
|
|
100
|
+
const blob = await authored.ask({ kind: 'authored.file', key, type });
|
|
101
|
+
keys.set(blob, key);
|
|
102
|
+
return blob;
|
|
103
|
+
};
|
|
104
|
+
const restored = async (records) => Promise.all(records.map(async (record) => (await filed(JSON.parse(record), read))));
|
|
105
|
+
const amend = async (locator, id, amendment) => {
|
|
106
|
+
await authored.ask({
|
|
107
|
+
kind: 'authored.amend',
|
|
108
|
+
locator,
|
|
109
|
+
id,
|
|
110
|
+
amendment: JSON.stringify(amendment),
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const fact = (name) => authored.ask({ kind: 'authored.fact', name });
|
|
114
|
+
const changed = new Map();
|
|
115
|
+
const change = (key) => changed.set(key, (changed.get(key) ?? 0) + 1);
|
|
116
|
+
return {
|
|
117
|
+
opened() {
|
|
118
|
+
return authored.ask({ kind: 'replica.open' });
|
|
119
|
+
},
|
|
120
|
+
async rooms(locators) {
|
|
121
|
+
const held = await authored.ask({ kind: 'replica.rooms', locators: locators ?? null });
|
|
122
|
+
return held.map(roomOf);
|
|
123
|
+
},
|
|
124
|
+
async room(locator) {
|
|
125
|
+
const { room, queue } = await authored.ask({ kind: 'replica.room', locator });
|
|
126
|
+
return {
|
|
127
|
+
room: room === null ? null : { ...roomOf(room), overlaid: new Set(room.overlaid) },
|
|
128
|
+
queue: queue.map(({ batch, state }) => ({
|
|
129
|
+
batch: JSON.parse(batch),
|
|
130
|
+
state: JSON.parse(state),
|
|
131
|
+
})),
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
async covering() {
|
|
135
|
+
const { rooms, queues } = await authored.ask({ kind: 'replica.covering' });
|
|
136
|
+
return {
|
|
137
|
+
rooms: new Map(rooms.map(({ locator, ...room }) => [locator, room])),
|
|
138
|
+
queues: new Map(queues.map(({ locator, ids }) => [locator, ids])),
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
offline(locator) {
|
|
142
|
+
return authored.ask({ kind: 'replica.offline', locator });
|
|
143
|
+
},
|
|
144
|
+
async held() {
|
|
145
|
+
const { held, staged } = await authored.ask({ kind: 'replica.held' });
|
|
146
|
+
return { held: new Set(held), staged: new Set(staged) };
|
|
147
|
+
},
|
|
148
|
+
async status() {
|
|
149
|
+
const { queued, lastCompleted, changes, resets, returned } = await authored.ask({
|
|
150
|
+
kind: 'authored.status',
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
queued,
|
|
154
|
+
lastCompleted: json(lastCompleted ?? undefined, null),
|
|
155
|
+
unsent: changes.map(({ locator, path }) => ({ room: locator, path })),
|
|
156
|
+
resets,
|
|
157
|
+
returned: returned.map((record) => JSON.parse(record)),
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
async batch(locator, id) {
|
|
161
|
+
const held = await authored.ask({ kind: 'authored.batch', locator, id });
|
|
162
|
+
return held === null ? null : JSON.parse(held);
|
|
163
|
+
},
|
|
164
|
+
order(locator) {
|
|
165
|
+
return authored.ask({ kind: 'authored.order', locator });
|
|
166
|
+
},
|
|
167
|
+
queued() {
|
|
168
|
+
return authored.ask({ kind: 'authored.queued' });
|
|
169
|
+
},
|
|
170
|
+
async moving() {
|
|
171
|
+
const { queues, pending } = await authored.ask({ kind: 'authored.moving' });
|
|
172
|
+
return {
|
|
173
|
+
queued: new Map(queues.map(({ locator, ids }) => [locator, ids])),
|
|
174
|
+
moving: pending.map(({ locator, batch, state }) => ({
|
|
175
|
+
locator,
|
|
176
|
+
batch: JSON.parse(batch),
|
|
177
|
+
state: JSON.parse(state),
|
|
178
|
+
})),
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
async pending(locator, id) {
|
|
182
|
+
const { state, room } = await authored.ask({ kind: 'authored.pending', locator, id });
|
|
183
|
+
return { state: state === null ? undefined : JSON.parse(state), room };
|
|
184
|
+
},
|
|
185
|
+
async facts() {
|
|
186
|
+
const held = await authored.ask({ kind: 'replica.facts' });
|
|
187
|
+
return {
|
|
188
|
+
lastCompleted: json(held.lastCompleted, null),
|
|
189
|
+
providerLimits: json(held.providerLimits, []),
|
|
190
|
+
capabilities: json(held.capabilities, []),
|
|
191
|
+
member: json(held.member, null),
|
|
192
|
+
targets: json(held.targets, {}),
|
|
193
|
+
conversationList: json(held.conversationList, null),
|
|
194
|
+
conversationCursor: json(held.conversationCursor, null),
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
async presentation(app) {
|
|
198
|
+
const held = await authored.ask({ kind: 'replica.presentation', app });
|
|
199
|
+
return held === null ? undefined : JSON.parse(held);
|
|
200
|
+
},
|
|
201
|
+
async demote() {
|
|
202
|
+
await authored.ask({ kind: 'replica.demote' });
|
|
203
|
+
},
|
|
204
|
+
query(plan, rooms, budget) {
|
|
205
|
+
return authored.ask({ kind: 'replica.query', plan, rooms, budget });
|
|
206
|
+
},
|
|
207
|
+
changes(keys) {
|
|
208
|
+
return keys.reduce((total, key) => total + (changed.get(key) ?? 0), 0);
|
|
209
|
+
},
|
|
210
|
+
entries(key, view, paths) {
|
|
211
|
+
return authored.ask({ kind: 'replica.entries', key, view, paths });
|
|
212
|
+
},
|
|
213
|
+
typed(key, view, paths) {
|
|
214
|
+
return authored.ask({ kind: 'replica.typed', key, view, paths });
|
|
215
|
+
},
|
|
216
|
+
referrers(key, view, targets) {
|
|
217
|
+
return authored.ask({ kind: 'replica.referrers', key, view, targets });
|
|
218
|
+
},
|
|
219
|
+
folders(key, view, paths) {
|
|
220
|
+
return authored.ask({ kind: 'replica.folders', key, view, paths });
|
|
221
|
+
},
|
|
222
|
+
typedWithin(key, view, roots, within) {
|
|
223
|
+
return authored.ask({ kind: 'replica.typedWithin', key, view, roots, within });
|
|
224
|
+
},
|
|
225
|
+
stage(record, composition, page) {
|
|
226
|
+
return authored.ask({
|
|
227
|
+
kind: 'replica.stage',
|
|
228
|
+
locator: record.locator,
|
|
229
|
+
transfer: record.transfer,
|
|
230
|
+
key: record.key,
|
|
231
|
+
fingerprint: composedOf(composition).fingerprint,
|
|
232
|
+
entries: page.entries,
|
|
233
|
+
folders: page.folders,
|
|
234
|
+
part: page.part ?? null,
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
resume(record, composition, parts, published) {
|
|
238
|
+
return authored.ask({
|
|
239
|
+
kind: 'replica.resume',
|
|
240
|
+
locator: record.locator,
|
|
241
|
+
transfer: record.transfer,
|
|
242
|
+
fingerprint: composedOf(composition).fingerprint,
|
|
243
|
+
parts,
|
|
244
|
+
published,
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
async refresh(key, composition, page) {
|
|
248
|
+
await authored.ask({
|
|
249
|
+
kind: 'replica.refresh',
|
|
250
|
+
key,
|
|
251
|
+
composed: composedOf(composition),
|
|
252
|
+
entries: page.entries,
|
|
253
|
+
removals: page.removals,
|
|
254
|
+
folders: page.folders,
|
|
255
|
+
folderRemovals: page.folderRemovals,
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
async unrefresh(key) {
|
|
259
|
+
await authored.ask({ kind: 'replica.unrefresh', key });
|
|
260
|
+
},
|
|
261
|
+
commit({ rooms, writes = [], files = [], whole = false }) {
|
|
262
|
+
for (const room of rooms)
|
|
263
|
+
change(room.key);
|
|
264
|
+
return authored.ask({
|
|
265
|
+
kind: 'replica.commit',
|
|
266
|
+
...(writes.length === 0 && files.length === 0
|
|
267
|
+
? {}
|
|
268
|
+
: { authored: { writes: writes.map(authoredRows), files, whole } }),
|
|
269
|
+
rooms,
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
async fence(locators) {
|
|
273
|
+
await authored.ask({ kind: 'replica.fence', locators });
|
|
274
|
+
},
|
|
275
|
+
async erase(locator, limit) {
|
|
276
|
+
return (await authored.ask({ kind: 'replica.erase', locator, limit })).remaining;
|
|
277
|
+
},
|
|
278
|
+
async abandon(locator) {
|
|
279
|
+
await authored.ask({ kind: 'replica.abandon', locator });
|
|
280
|
+
},
|
|
281
|
+
async unfence(locators) {
|
|
282
|
+
return new Set(await authored.ask({ kind: 'replica.unfence', locators }));
|
|
283
|
+
},
|
|
284
|
+
async release(key) {
|
|
285
|
+
await authored.ask({ kind: 'replica.release', key });
|
|
286
|
+
},
|
|
287
|
+
async rederive(key, composition, bytes, ms, floor) {
|
|
288
|
+
change(key);
|
|
289
|
+
return authored.ask({
|
|
290
|
+
kind: 'replica.rederive',
|
|
291
|
+
key,
|
|
292
|
+
composed: composedOf(composition),
|
|
293
|
+
bytes,
|
|
294
|
+
ms,
|
|
295
|
+
floor,
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
async fact(name, value) {
|
|
299
|
+
await authored.ask({ kind: 'replica.fact', name, value: JSON.stringify(value) });
|
|
300
|
+
},
|
|
301
|
+
submit(locator, id, submission, lost) {
|
|
302
|
+
return amend(locator, id, { submission, lost });
|
|
303
|
+
},
|
|
304
|
+
keepUpload(locator, id, upload) {
|
|
305
|
+
return amend(locator, id, { upload });
|
|
306
|
+
},
|
|
307
|
+
async roomDrafts(locator, paths) {
|
|
308
|
+
const held = await authored.ask({
|
|
309
|
+
kind: 'authored.roomDrafts',
|
|
310
|
+
locator: locator ?? null,
|
|
311
|
+
paths: paths ?? null,
|
|
312
|
+
});
|
|
313
|
+
return held.map((record) => JSON.parse(record));
|
|
314
|
+
},
|
|
315
|
+
async present(record) {
|
|
316
|
+
await authored.ask({
|
|
317
|
+
kind: 'replica.present',
|
|
318
|
+
app: record.app,
|
|
319
|
+
value: JSON.stringify(record.value ?? null),
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
conversations(conversations) {
|
|
323
|
+
return authored.ask({ kind: 'conversation.held', conversations: conversations ?? null });
|
|
324
|
+
},
|
|
325
|
+
async keepMessages(write) {
|
|
326
|
+
await authored.ask({ kind: 'conversation.keep', ...write });
|
|
327
|
+
},
|
|
328
|
+
messageWindow(conversation, limit, before, phrase = null) {
|
|
329
|
+
return authored.ask({ kind: 'conversation.window', conversation, limit, before, phrase });
|
|
330
|
+
},
|
|
331
|
+
messageCount(conversation, phrase = null) {
|
|
332
|
+
return authored.ask({ kind: 'conversation.count', conversation, phrase });
|
|
333
|
+
},
|
|
334
|
+
turnArrived(conversation, turn) {
|
|
335
|
+
return authored.ask({ kind: 'conversation.turn', conversation, turn });
|
|
336
|
+
},
|
|
337
|
+
conversationRows(conversations) {
|
|
338
|
+
return authored.ask({ kind: 'conversation.rows', conversations });
|
|
339
|
+
},
|
|
340
|
+
jobMarkers(conversation) {
|
|
341
|
+
return authored.ask({ kind: 'conversation.jobs', conversation });
|
|
342
|
+
},
|
|
343
|
+
async dropConversations(conversations) {
|
|
344
|
+
await authored.ask({ kind: 'conversation.drop', conversations });
|
|
345
|
+
},
|
|
346
|
+
async chatDrafts() {
|
|
347
|
+
const records = await authored.ask({ kind: 'authored.chatDrafts' });
|
|
348
|
+
return records.map((record) => JSON.parse(record));
|
|
349
|
+
},
|
|
350
|
+
async chatDraft(conversation) {
|
|
351
|
+
const record = await authored.ask({ kind: 'authored.chatDraft.read', conversation });
|
|
352
|
+
return record === null ? null : JSON.parse(record);
|
|
353
|
+
},
|
|
354
|
+
async keepChatDrafts(records) {
|
|
355
|
+
await authored.ask({
|
|
356
|
+
kind: 'authored.chatDraft',
|
|
357
|
+
kept: records.map((record) => ({
|
|
358
|
+
conversation: record.conversation,
|
|
359
|
+
record: JSON.stringify(record),
|
|
360
|
+
})),
|
|
361
|
+
dropped: [],
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
async dropChatDraft(conversation) {
|
|
365
|
+
await authored.ask({ kind: 'authored.chatDraft', kept: [], dropped: [conversation] });
|
|
366
|
+
},
|
|
367
|
+
async calls() {
|
|
368
|
+
return restored(await authored.ask({ kind: 'authored.calls' }));
|
|
369
|
+
},
|
|
370
|
+
async keepCall(record) {
|
|
371
|
+
const { stored, ...kept } = keyed(keys, record);
|
|
372
|
+
await authored.ask({
|
|
373
|
+
kind: 'authored.call',
|
|
374
|
+
operation: record.operation,
|
|
375
|
+
kept,
|
|
376
|
+
files: stored,
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
async dropCall(operation) {
|
|
380
|
+
await authored.ask({ kind: 'authored.call', operation, kept: null, files: [] });
|
|
381
|
+
},
|
|
382
|
+
async keepRoomDraft(record, files) {
|
|
383
|
+
const { path, ...kept } = roomDraftRow(record);
|
|
384
|
+
await authored.ask({
|
|
385
|
+
kind: 'authored.roomDraft',
|
|
386
|
+
locator: record.locator,
|
|
387
|
+
path,
|
|
388
|
+
kept,
|
|
389
|
+
files,
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
async discardRoomDraft(locator, path) {
|
|
393
|
+
await authored.ask({ kind: 'authored.roomDraft', locator, path, kept: null, files: [] });
|
|
394
|
+
},
|
|
395
|
+
fences() {
|
|
396
|
+
return authored.ask({ kind: 'authored.fences' });
|
|
397
|
+
},
|
|
398
|
+
generation() {
|
|
399
|
+
return fact('generation');
|
|
400
|
+
},
|
|
401
|
+
async rememberGeneration(value) {
|
|
402
|
+
await authored.ask({ kind: 'authored.remember', name: 'generation', value });
|
|
403
|
+
},
|
|
404
|
+
file(key, type) {
|
|
405
|
+
return authored.ask({ kind: 'authored.file', key, type });
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type RoomHeld<T> = {
|
|
2
|
+
of(locator: string, key: string): T | undefined;
|
|
3
|
+
hold(locator: string, key: string, value: T): void;
|
|
4
|
+
drop(locator: string, key: string): void;
|
|
5
|
+
forget(locator: string): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createRoomHeld<T>(): RoomHeld<T>;
|
|
8
|
+
//# sourceMappingURL=room-held.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-held.d.ts","sourceRoot":"","sources":["../../src/store/room-held.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,wBAAgB,cAAc,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAgB/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function createRoomHeld() {
|
|
2
|
+
const rooms = new Map();
|
|
3
|
+
return {
|
|
4
|
+
of: (locator, key) => rooms.get(locator)?.get(key),
|
|
5
|
+
hold(locator, key, value) {
|
|
6
|
+
const room = rooms.get(locator) ?? new Map();
|
|
7
|
+
room.set(key, value);
|
|
8
|
+
rooms.set(locator, room);
|
|
9
|
+
},
|
|
10
|
+
drop(locator, key) {
|
|
11
|
+
rooms.get(locator)?.delete(key);
|
|
12
|
+
},
|
|
13
|
+
forget(locator) {
|
|
14
|
+
rooms.delete(locator);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Watcher = {
|
|
2
|
+
held(): boolean;
|
|
3
|
+
stop(): void;
|
|
4
|
+
answer(value: unknown): void;
|
|
5
|
+
};
|
|
6
|
+
export type Watching = 'all' | 'waiting' | 'ready';
|
|
7
|
+
type Watchers = {
|
|
8
|
+
publication(work: () => Promise<void>): Promise<void>;
|
|
9
|
+
watch(topic: string, notify: (value: unknown) => void): Watcher;
|
|
10
|
+
watching(topic: string, which?: Watching): readonly Watcher[];
|
|
11
|
+
close(): void;
|
|
12
|
+
};
|
|
13
|
+
export declare function createWatchers(unpublished: (error: unknown) => void): Watchers;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=watchers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchers.d.ts","sourceRoot":"","sources":["../../src/store/watchers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,IAAI,OAAO,CAAC;IAChB,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;AAInD,KAAK,QAAQ,GAAG;IACd,WAAW,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,OAAO,EAAE,CAAC;IAC9D,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,wBAAgB,cAAc,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,QAAQ,CAqC9E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function createWatchers(unpublished) {
|
|
2
|
+
let published = Promise.resolve();
|
|
3
|
+
const topics = new Map();
|
|
4
|
+
return {
|
|
5
|
+
publication(work) {
|
|
6
|
+
published = published.then(work).catch(unpublished);
|
|
7
|
+
return published;
|
|
8
|
+
},
|
|
9
|
+
watch(topic, notify) {
|
|
10
|
+
const held = topics.get(topic) ?? new Set();
|
|
11
|
+
topics.set(topic, held);
|
|
12
|
+
const watcher = {
|
|
13
|
+
ready: false,
|
|
14
|
+
held: () => topics.get(topic)?.has(watcher) === true,
|
|
15
|
+
stop() {
|
|
16
|
+
const on = topics.get(topic);
|
|
17
|
+
on?.delete(watcher);
|
|
18
|
+
if (on?.size === 0)
|
|
19
|
+
topics.delete(topic);
|
|
20
|
+
},
|
|
21
|
+
answer(value) {
|
|
22
|
+
watcher.ready = true;
|
|
23
|
+
notify(value);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
held.add(watcher);
|
|
27
|
+
return watcher;
|
|
28
|
+
},
|
|
29
|
+
watching(topic, which = 'all') {
|
|
30
|
+
return [...(topics.get(topic) ?? [])].filter(({ ready }) => which === 'all' || ready === (which === 'ready'));
|
|
31
|
+
},
|
|
32
|
+
close() {
|
|
33
|
+
topics.clear();
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Composition } from '../collection.js';
|
|
2
|
+
import type { RefreshedPage, RuntimeStore } from './records.js';
|
|
3
|
+
export type InstallHold = {
|
|
4
|
+
take(): void;
|
|
5
|
+
release(): void;
|
|
6
|
+
};
|
|
7
|
+
type Writes = {
|
|
8
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
9
|
+
gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
|
|
10
|
+
written(): Promise<unknown>;
|
|
11
|
+
startingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
12
|
+
finishingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
13
|
+
ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
|
|
14
|
+
rederive(local: RuntimeStore, key: number, composition: Composition): Promise<{
|
|
15
|
+
readonly done: boolean;
|
|
16
|
+
readonly text: number;
|
|
17
|
+
}>;
|
|
18
|
+
refreshPage(local: RuntimeStore, key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
19
|
+
stageBytes(): number;
|
|
20
|
+
deriveBytes(): number;
|
|
21
|
+
};
|
|
22
|
+
export declare function createWrites(): Writes;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=writes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writes.d.ts","sourceRoot":"","sources":["../../src/store/writes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA8BhE,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,IAAI,IAAI,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAAC;AAE5D,KAAK,MAAM,GAAG;IACZ,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,CAAC,EAAE,CAAC,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,EACzC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CAAC;IACd,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrD,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,QAAQ,CACN,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,WAAW,CACT,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,UAAU,IAAI,MAAM,CAAC;IACrB,WAAW,IAAI,MAAM,CAAC;CACvB,CAAC;AAcF,wBAAgB,YAAY,IAAI,MAAM,CAqHrC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { yielded } from '../turn.js';
|
|
2
|
+
const DERIVE_BYTES = 1 << 23;
|
|
3
|
+
const DERIVE_FLOOR = 1 << 18;
|
|
4
|
+
// An index build aims at this much database work, so a Save, a query or the next part's progress waits behind at most one short build.
|
|
5
|
+
const DERIVE_AIM_MS = 250;
|
|
6
|
+
// A build past its floor of text stops after a second and a half of work, its full-text writes included, so a Room whose text costs ten times the usual holds a Save, a query or the next part's progress behind no longer build.
|
|
7
|
+
const DERIVE_LONGEST_MS = 1_500;
|
|
8
|
+
const STAGE_BYTES = 1 << 20;
|
|
9
|
+
const STAGE_FLOOR = 1 << 16;
|
|
10
|
+
// A batch aims at this much database work, so a Save or a query waits behind at most one short write.
|
|
11
|
+
const STAGE_AIM_MS = 50;
|
|
12
|
+
async function timed(budget, work) {
|
|
13
|
+
const started = performance.now();
|
|
14
|
+
const done = await work();
|
|
15
|
+
const spent = performance.now() - started;
|
|
16
|
+
if (spent < budget.aim / 2)
|
|
17
|
+
budget.bytes = Math.min(budget.ceiling, Math.round(budget.bytes * 1.5));
|
|
18
|
+
else if (spent > budget.aim * 2) {
|
|
19
|
+
budget.bytes = Math.max(budget.floor, Math.round(budget.bytes / 1.5));
|
|
20
|
+
}
|
|
21
|
+
return done;
|
|
22
|
+
}
|
|
23
|
+
export function createWrites() {
|
|
24
|
+
let mutations = Promise.resolve();
|
|
25
|
+
let gathering = null;
|
|
26
|
+
const stageBudget = {
|
|
27
|
+
bytes: STAGE_FLOOR * 4,
|
|
28
|
+
floor: STAGE_FLOOR,
|
|
29
|
+
ceiling: STAGE_BYTES,
|
|
30
|
+
aim: STAGE_AIM_MS,
|
|
31
|
+
};
|
|
32
|
+
const deriveBudget = {
|
|
33
|
+
bytes: DERIVE_FLOOR * 4,
|
|
34
|
+
floor: DERIVE_FLOOR,
|
|
35
|
+
ceiling: DERIVE_BYTES,
|
|
36
|
+
aim: DERIVE_AIM_MS,
|
|
37
|
+
};
|
|
38
|
+
const installTurns = { busy: false, ahead: 0, finishing: [], starting: [] };
|
|
39
|
+
function exclusive(work) {
|
|
40
|
+
gathering = null;
|
|
41
|
+
const next = mutations.then(work, work);
|
|
42
|
+
mutations = next.then(() => undefined, () => undefined);
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
45
|
+
function gathered(key, input, merge, work) {
|
|
46
|
+
const tail = gathering;
|
|
47
|
+
if (tail !== null && tail.key === key) {
|
|
48
|
+
const merged = merge(tail.input, input);
|
|
49
|
+
if (merged !== null) {
|
|
50
|
+
tail.input = merged;
|
|
51
|
+
return tail.done;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const entry = { key, input, done: Promise.resolve() };
|
|
55
|
+
entry.done = exclusive(() => {
|
|
56
|
+
if (gathering === entry)
|
|
57
|
+
gathering = null;
|
|
58
|
+
return work(entry.input);
|
|
59
|
+
});
|
|
60
|
+
gathering = entry;
|
|
61
|
+
return entry.done;
|
|
62
|
+
}
|
|
63
|
+
function nextInstallTurn() {
|
|
64
|
+
if (installTurns.busy || installTurns.ahead > 0)
|
|
65
|
+
return;
|
|
66
|
+
const turn = installTurns.finishing.shift() ?? installTurns.starting.shift();
|
|
67
|
+
if (turn === undefined)
|
|
68
|
+
return;
|
|
69
|
+
installTurns.busy = true;
|
|
70
|
+
turn();
|
|
71
|
+
}
|
|
72
|
+
function installTurn(queue, work) {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
queue.push(() => void exclusive(work)
|
|
75
|
+
.then(resolve, reject)
|
|
76
|
+
.finally(() => {
|
|
77
|
+
installTurns.busy = false;
|
|
78
|
+
nextInstallTurn();
|
|
79
|
+
}));
|
|
80
|
+
nextInstallTurn();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function resumeInstall() {
|
|
84
|
+
if (installTurns.ahead > 0)
|
|
85
|
+
return;
|
|
86
|
+
void yielded().then(nextInstallTurn);
|
|
87
|
+
}
|
|
88
|
+
async function ahead(work) {
|
|
89
|
+
let taken = false;
|
|
90
|
+
const hold = {
|
|
91
|
+
take() {
|
|
92
|
+
if (taken)
|
|
93
|
+
return;
|
|
94
|
+
taken = true;
|
|
95
|
+
installTurns.ahead += 1;
|
|
96
|
+
},
|
|
97
|
+
release() {
|
|
98
|
+
if (!taken)
|
|
99
|
+
return;
|
|
100
|
+
taken = false;
|
|
101
|
+
installTurns.ahead -= 1;
|
|
102
|
+
resumeInstall();
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
hold.take();
|
|
106
|
+
try {
|
|
107
|
+
return await work(hold);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
hold.release();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
exclusive,
|
|
115
|
+
gathered,
|
|
116
|
+
written: () => mutations,
|
|
117
|
+
startingWrite: (work) => installTurn(installTurns.starting, work),
|
|
118
|
+
finishingWrite: (work) => installTurn(installTurns.finishing, work),
|
|
119
|
+
ahead,
|
|
120
|
+
rederive: (local, key, composition) => timed(deriveBudget, () => local.rederive(key, composition, deriveBudget.bytes, DERIVE_LONGEST_MS, DERIVE_FLOOR)),
|
|
121
|
+
refreshPage: (local, key, composition, page) => timed(stageBudget, () => local.refresh(key, composition, page)),
|
|
122
|
+
stageBytes: () => stageBudget.bytes,
|
|
123
|
+
deriveBytes: () => deriveBudget.bytes,
|
|
124
|
+
};
|
|
125
|
+
}
|