@agentshouse/mdruntime 0.1.0-cf6041a06849c → 0.1.0-cf6d5f0a5c9c8
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/AGENTS.md +45 -23
- package/README.md +9 -9
- package/dist/adapter.d.ts +8 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +15 -2
- package/dist/bootstrap.d.ts +17 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +89 -35
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +13 -7
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +35 -0
- package/dist/collection.d.ts +6 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +56 -19
- package/dist/connection.d.ts +5 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +165 -51
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -0
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/memory.d.ts +2 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +16 -6
- package/dist/model.d.ts +7 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -16
- package/dist/query.d.ts +1 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +49 -19
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +1 -16
- package/dist/react.d.ts +22 -14
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -6
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +102 -46
- package/dist/refresh.d.ts +10 -0
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +33 -24
- package/dist/replica.d.ts +4 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +31 -25
- package/dist/room-draft.js +1 -1
- package/dist/rows.d.ts +4 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +84 -38
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +106 -53
- package/dist/store.d.ts +25 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +206 -90
- package/dist/wire.d.ts +1 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +1 -0
- package/package.json +2 -2
package/dist/store.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { transferIdentity } from './identity.js';
|
|
1
2
|
import { sameChange } from './overlay.js';
|
|
2
3
|
const DATABASE = 'mdruntime';
|
|
3
4
|
const ROOMS = 'rooms';
|
|
4
5
|
const DOCUMENTS = 'documents';
|
|
5
6
|
const BINARY_TARGETS = 'binaryTargets';
|
|
6
7
|
const ATTACHMENTS = 'attachments';
|
|
8
|
+
const TRANSFERS = 'transfers';
|
|
7
9
|
const PENDING_CHANGES = 'pendingChanges';
|
|
8
10
|
const DECLARATIONS = 'declarations';
|
|
9
11
|
const ROOM_DRAFTS = 'roomDrafts';
|
|
@@ -12,7 +14,10 @@ const CONVERSATIONS = 'conversations';
|
|
|
12
14
|
const MESSAGES = 'messages';
|
|
13
15
|
const CHAT_DRAFTS = 'chatDrafts';
|
|
14
16
|
const CURRENT = 'current';
|
|
15
|
-
const
|
|
17
|
+
const MEMBER = 'member';
|
|
18
|
+
export const STORE_SCHEMA = 21;
|
|
19
|
+
const PATH_KEYED_SCHEMA = 20;
|
|
20
|
+
const READ_BATCH = 256;
|
|
16
21
|
function settled(request) {
|
|
17
22
|
return new Promise((resolve, reject) => {
|
|
18
23
|
request.onsuccess = () => resolve(request.result);
|
|
@@ -60,6 +65,97 @@ function roomRecord(record, queue) {
|
|
|
60
65
|
const { documents, binaryTargets, revisions, changes, written, attachments, ...room } = record;
|
|
61
66
|
return { ...room, order: queue.map((batch) => batch.id) };
|
|
62
67
|
}
|
|
68
|
+
function underTransfer(locator, transfer, after) {
|
|
69
|
+
return after === undefined
|
|
70
|
+
? IDBKeyRange.bound([locator, transfer], [locator, transfer, []])
|
|
71
|
+
: IDBKeyRange.bound([locator, transfer, after], [locator, transfer, []], true);
|
|
72
|
+
}
|
|
73
|
+
function underRoom(locator) {
|
|
74
|
+
return IDBKeyRange.bound([locator], [locator, []]);
|
|
75
|
+
}
|
|
76
|
+
async function readTransfer(store, locator, transfer, receive) {
|
|
77
|
+
let range = underTransfer(locator, transfer);
|
|
78
|
+
for (;;) {
|
|
79
|
+
const batch = await settled(store.getAll(range, READ_BATCH));
|
|
80
|
+
for (const record of batch)
|
|
81
|
+
receive(record);
|
|
82
|
+
if (batch.length < READ_BATCH)
|
|
83
|
+
return;
|
|
84
|
+
range = underTransfer(locator, transfer, batch[batch.length - 1].path);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function emptyLayer() {
|
|
88
|
+
return { documents: {}, binaryTargets: [], revisions: {}, changes: {}, written: {} };
|
|
89
|
+
}
|
|
90
|
+
async function readLayer(transaction, locator, transfer) {
|
|
91
|
+
const layer = emptyLayer();
|
|
92
|
+
const head = (held) => {
|
|
93
|
+
if (held.revision !== null)
|
|
94
|
+
layer.revisions[held.path] = held.revision;
|
|
95
|
+
if (held.change !== null)
|
|
96
|
+
layer.changes[held.path] = held.change;
|
|
97
|
+
};
|
|
98
|
+
await readTransfer(transaction.objectStore(DOCUMENTS), locator, transfer, (document) => {
|
|
99
|
+
layer.documents[document.path] = document.content;
|
|
100
|
+
if (document.written !== null)
|
|
101
|
+
layer.written[document.path] = document.written;
|
|
102
|
+
head(document);
|
|
103
|
+
});
|
|
104
|
+
await readTransfer(transaction.objectStore(BINARY_TARGETS), locator, transfer, (target) => {
|
|
105
|
+
layer.binaryTargets.push(target.path);
|
|
106
|
+
head(target);
|
|
107
|
+
});
|
|
108
|
+
return layer;
|
|
109
|
+
}
|
|
110
|
+
function documentRecord(locator, transfer, layer, path) {
|
|
111
|
+
return {
|
|
112
|
+
locator,
|
|
113
|
+
transfer,
|
|
114
|
+
path,
|
|
115
|
+
content: layer.documents[path],
|
|
116
|
+
revision: layer.revisions[path] ?? null,
|
|
117
|
+
change: layer.changes[path] ?? null,
|
|
118
|
+
written: layer.written[path] ?? null,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function targetRecord(locator, transfer, layer, path) {
|
|
122
|
+
return {
|
|
123
|
+
locator,
|
|
124
|
+
transfer,
|
|
125
|
+
path,
|
|
126
|
+
revision: layer.revisions[path] ?? null,
|
|
127
|
+
change: layer.changes[path] ?? null,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function writeLayer(transaction, locator, transfer, next, base) {
|
|
131
|
+
const documents = transaction.objectStore(DOCUMENTS);
|
|
132
|
+
for (const path of Object.keys(base?.documents ?? {})) {
|
|
133
|
+
if (next.documents[path] === undefined)
|
|
134
|
+
documents.delete([locator, transfer, path]);
|
|
135
|
+
}
|
|
136
|
+
for (const [path, content] of Object.entries(next.documents)) {
|
|
137
|
+
if (base?.documents[path] === content &&
|
|
138
|
+
base.revisions[path] === next.revisions[path] &&
|
|
139
|
+
base.written[path] === next.written[path] &&
|
|
140
|
+
sameChange(base.changes[path], next.changes[path]))
|
|
141
|
+
continue;
|
|
142
|
+
documents.put(documentRecord(locator, transfer, next, path));
|
|
143
|
+
}
|
|
144
|
+
const targets = transaction.objectStore(BINARY_TARGETS);
|
|
145
|
+
const beforeTargets = new Set(base?.binaryTargets ?? []);
|
|
146
|
+
const afterTargets = new Set(next.binaryTargets);
|
|
147
|
+
for (const path of beforeTargets) {
|
|
148
|
+
if (!afterTargets.has(path))
|
|
149
|
+
targets.delete([locator, transfer, path]);
|
|
150
|
+
}
|
|
151
|
+
for (const path of afterTargets) {
|
|
152
|
+
if (!beforeTargets.has(path) ||
|
|
153
|
+
base?.revisions[path] !== next.revisions[path] ||
|
|
154
|
+
!sameChange(base?.changes[path], next.changes[path])) {
|
|
155
|
+
targets.put(targetRecord(locator, transfer, next, path));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
63
159
|
function removeRoomEntries(store, locator) {
|
|
64
160
|
const keys = store.getAllKeys();
|
|
65
161
|
keys.onsuccess = () => {
|
|
@@ -76,15 +172,59 @@ export function removeRuntimeStore() {
|
|
|
76
172
|
removal.onerror = () => reject(removal.error);
|
|
77
173
|
});
|
|
78
174
|
}
|
|
175
|
+
function keyByTransfer(database, upgrade) {
|
|
176
|
+
database.createObjectStore(TRANSFERS, { keyPath: 'locator' });
|
|
177
|
+
const moves = [DOCUMENTS, BINARY_TARGETS].map((name) => {
|
|
178
|
+
const from = upgrade.objectStore(name);
|
|
179
|
+
from.name = `${name}-${PATH_KEYED_SCHEMA}`;
|
|
180
|
+
return {
|
|
181
|
+
from,
|
|
182
|
+
to: database.createObjectStore(name, { keyPath: ['locator', 'transfer', 'path'] }),
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
const transfers = new Map();
|
|
186
|
+
const rooms = upgrade.objectStore(ROOMS).openCursor();
|
|
187
|
+
rooms.onsuccess = () => {
|
|
188
|
+
const room = rooms.result;
|
|
189
|
+
if (room !== null) {
|
|
190
|
+
const record = room.value;
|
|
191
|
+
const transfer = transferIdentity();
|
|
192
|
+
transfers.set(record.locator, transfer);
|
|
193
|
+
room.update({ ...record, transfer });
|
|
194
|
+
room.continue();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
for (const { from, to } of moves) {
|
|
198
|
+
const held = from.openCursor();
|
|
199
|
+
held.onsuccess = () => {
|
|
200
|
+
const entry = held.result;
|
|
201
|
+
if (entry === null) {
|
|
202
|
+
database.deleteObjectStore(from.name);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const record = entry.value;
|
|
206
|
+
const transfer = transfers.get(record.locator);
|
|
207
|
+
if (transfer !== undefined)
|
|
208
|
+
to.put({ ...record, transfer });
|
|
209
|
+
entry.continue();
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
79
214
|
export async function openRuntimeStore() {
|
|
80
|
-
const opening = indexedDB.open(DATABASE,
|
|
81
|
-
opening.onupgradeneeded = () => {
|
|
215
|
+
const opening = indexedDB.open(DATABASE, STORE_SCHEMA);
|
|
216
|
+
opening.onupgradeneeded = (event) => {
|
|
82
217
|
const database = opening.result;
|
|
218
|
+
if (event.oldVersion === PATH_KEYED_SCHEMA && opening.transaction !== null) {
|
|
219
|
+
keyByTransfer(database, opening.transaction);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
83
222
|
for (const name of [...database.objectStoreNames])
|
|
84
223
|
database.deleteObjectStore(name);
|
|
85
224
|
database.createObjectStore(ROOMS, { keyPath: 'locator' });
|
|
86
|
-
database.createObjectStore(DOCUMENTS, { keyPath: ['locator', 'path'] });
|
|
87
|
-
database.createObjectStore(BINARY_TARGETS, { keyPath: ['locator', 'path'] });
|
|
225
|
+
database.createObjectStore(DOCUMENTS, { keyPath: ['locator', 'transfer', 'path'] });
|
|
226
|
+
database.createObjectStore(BINARY_TARGETS, { keyPath: ['locator', 'transfer', 'path'] });
|
|
227
|
+
database.createObjectStore(TRANSFERS, { keyPath: 'locator' });
|
|
88
228
|
database.createObjectStore(ATTACHMENTS, { keyPath: ['locator', 'reference'] });
|
|
89
229
|
database.createObjectStore(PENDING_CHANGES, { keyPath: ['locator', 'id'] });
|
|
90
230
|
database.createObjectStore(DECLARATIONS);
|
|
@@ -101,99 +241,33 @@ export async function openRuntimeStore() {
|
|
|
101
241
|
return {
|
|
102
242
|
async all() {
|
|
103
243
|
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS], 'readonly');
|
|
104
|
-
const [rooms,
|
|
244
|
+
const [rooms, attachments] = await Promise.all([
|
|
105
245
|
settled(transaction.objectStore(ROOMS).getAll()),
|
|
106
|
-
settled(transaction.objectStore(DOCUMENTS).getAll()),
|
|
107
|
-
settled(transaction.objectStore(BINARY_TARGETS).getAll()),
|
|
108
246
|
settled(transaction.objectStore(ATTACHMENTS).getAll()),
|
|
109
247
|
]);
|
|
110
|
-
const
|
|
248
|
+
const records = [];
|
|
111
249
|
for (const { order, ...room } of rooms) {
|
|
112
|
-
|
|
250
|
+
const layer = await readLayer(transaction, room.locator, room.transfer);
|
|
251
|
+
records.push({
|
|
113
252
|
...room,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
changes: {},
|
|
117
|
-
written: {},
|
|
118
|
-
binaryTargets: [],
|
|
119
|
-
attachments: [],
|
|
253
|
+
...layer,
|
|
254
|
+
attachments: attachments.flatMap(({ locator, ...attachment }) => locator === room.locator ? [attachment] : []),
|
|
120
255
|
});
|
|
121
256
|
}
|
|
122
|
-
|
|
123
|
-
if (held.revision !== null) {
|
|
124
|
-
room.revisions[held.path] = held.revision;
|
|
125
|
-
}
|
|
126
|
-
if (held.change !== null) {
|
|
127
|
-
room.changes[held.path] = held.change;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
for (const document of documents) {
|
|
131
|
-
const room = byRoom.get(document.locator);
|
|
132
|
-
if (room === undefined)
|
|
133
|
-
continue;
|
|
134
|
-
room.documents[document.path] = document.content;
|
|
135
|
-
if (document.written !== null) {
|
|
136
|
-
room.written[document.path] = document.written;
|
|
137
|
-
}
|
|
138
|
-
head(room, document);
|
|
139
|
-
}
|
|
140
|
-
for (const target of targets) {
|
|
141
|
-
const room = byRoom.get(target.locator);
|
|
142
|
-
if (room === undefined)
|
|
143
|
-
continue;
|
|
144
|
-
room.binaryTargets.push(target.path);
|
|
145
|
-
head(room, target);
|
|
146
|
-
}
|
|
147
|
-
for (const { locator, ...attachment } of attachments) {
|
|
148
|
-
const room = byRoom.get(locator);
|
|
149
|
-
if (room === undefined)
|
|
150
|
-
continue;
|
|
151
|
-
room.attachments.push(attachment);
|
|
152
|
-
}
|
|
153
|
-
return [...byRoom.values()];
|
|
257
|
+
return records;
|
|
154
258
|
},
|
|
155
|
-
async write({ next, previous, queue, previousQueue, saved, roomDrafts, consumedRoomDrafts }) {
|
|
156
|
-
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
259
|
+
async write({ next, previous, stored, queue, previousQueue, saved, roomDrafts, consumedRoomDrafts, }) {
|
|
260
|
+
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, TRANSFERS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
157
261
|
transaction.objectStore(ROOMS).put(roomRecord(next, queue));
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
for (const [path, content] of Object.entries(next.documents)) {
|
|
164
|
-
if (previous?.documents[path] === content &&
|
|
165
|
-
previous.revisions[path] === next.revisions[path] &&
|
|
166
|
-
previous.written[path] === next.written[path] &&
|
|
167
|
-
sameChange(previous.changes[path], next.changes[path]))
|
|
168
|
-
continue;
|
|
169
|
-
documents.put({
|
|
170
|
-
locator: next.locator,
|
|
171
|
-
path,
|
|
172
|
-
content,
|
|
173
|
-
revision: next.revisions[path] ?? null,
|
|
174
|
-
change: next.changes[path] ?? null,
|
|
175
|
-
written: next.written[path] ?? null,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
const targets = transaction.objectStore(BINARY_TARGETS);
|
|
179
|
-
const beforeTargets = new Set(previous?.binaryTargets ?? []);
|
|
180
|
-
const afterTargets = new Set(next.binaryTargets);
|
|
181
|
-
for (const path of beforeTargets) {
|
|
182
|
-
if (!afterTargets.has(path))
|
|
183
|
-
targets.delete([next.locator, path]);
|
|
184
|
-
}
|
|
185
|
-
for (const path of afterTargets) {
|
|
186
|
-
if (!beforeTargets.has(path) ||
|
|
187
|
-
previous?.revisions[path] !== next.revisions[path] ||
|
|
188
|
-
!sameChange(previous?.changes[path], next.changes[path])) {
|
|
189
|
-
targets.put({
|
|
190
|
-
locator: next.locator,
|
|
191
|
-
path,
|
|
192
|
-
revision: next.revisions[path] ?? null,
|
|
193
|
-
change: next.changes[path] ?? null,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
262
|
+
const moved = previous?.transfer !== next.transfer;
|
|
263
|
+
if (moved && previous !== null) {
|
|
264
|
+
const range = underTransfer(previous.locator, previous.transfer);
|
|
265
|
+
transaction.objectStore(DOCUMENTS).delete(range);
|
|
266
|
+
transaction.objectStore(BINARY_TARGETS).delete(range);
|
|
196
267
|
}
|
|
268
|
+
if (moved)
|
|
269
|
+
transaction.objectStore(TRANSFERS).delete(next.locator);
|
|
270
|
+
writeLayer(transaction, next.locator, next.transfer, next, moved ? (stored ?? null) : previous);
|
|
197
271
|
const attachments = transaction.objectStore(ATTACHMENTS);
|
|
198
272
|
const held = new Map((previous?.attachments ?? []).map((attachment) => [attachment.reference, attachment]));
|
|
199
273
|
const declared = new Set(next.attachments.map((attachment) => attachment.reference));
|
|
@@ -262,6 +336,16 @@ export async function openRuntimeStore() {
|
|
|
262
336
|
capabilities,
|
|
263
337
|
}));
|
|
264
338
|
},
|
|
339
|
+
async member() {
|
|
340
|
+
const transaction = database.transaction(DECLARATIONS, 'readonly');
|
|
341
|
+
const held = await settled(transaction.objectStore(DECLARATIONS).get(MEMBER));
|
|
342
|
+
return held ?? null;
|
|
343
|
+
},
|
|
344
|
+
async keepMember(member) {
|
|
345
|
+
const transaction = database.transaction(DECLARATIONS, 'readwrite');
|
|
346
|
+
transaction.objectStore(DECLARATIONS).put(member, MEMBER);
|
|
347
|
+
await completed(transaction);
|
|
348
|
+
},
|
|
265
349
|
async queues() {
|
|
266
350
|
const transaction = database.transaction([ROOMS, PENDING_CHANGES], 'readonly');
|
|
267
351
|
const [rooms, pending] = await Promise.all([
|
|
@@ -373,15 +457,47 @@ export async function openRuntimeStore() {
|
|
|
373
457
|
await completed(transaction);
|
|
374
458
|
},
|
|
375
459
|
async dropRooms(locators) {
|
|
376
|
-
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
460
|
+
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, TRANSFERS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
377
461
|
for (const locator of locators) {
|
|
378
462
|
transaction.objectStore(ROOMS).delete(locator);
|
|
379
|
-
|
|
463
|
+
transaction.objectStore(TRANSFERS).delete(locator);
|
|
464
|
+
transaction.objectStore(DOCUMENTS).delete(underRoom(locator));
|
|
465
|
+
transaction.objectStore(BINARY_TARGETS).delete(underRoom(locator));
|
|
466
|
+
for (const name of [ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS]) {
|
|
380
467
|
removeRoomEntries(transaction.objectStore(name), locator);
|
|
381
468
|
}
|
|
382
469
|
}
|
|
383
470
|
await completed(transaction);
|
|
384
471
|
},
|
|
472
|
+
async transfers() {
|
|
473
|
+
const transaction = database.transaction(TRANSFERS, 'readonly');
|
|
474
|
+
return settled(transaction.objectStore(TRANSFERS).getAll());
|
|
475
|
+
},
|
|
476
|
+
staged(record) {
|
|
477
|
+
const transaction = database.transaction([DOCUMENTS, BINARY_TARGETS], 'readonly');
|
|
478
|
+
return readLayer(transaction, record.locator, record.transfer);
|
|
479
|
+
},
|
|
480
|
+
async stage(record, page) {
|
|
481
|
+
const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_TARGETS], 'readwrite');
|
|
482
|
+
writeLayer(transaction, record.locator, record.transfer, page, null);
|
|
483
|
+
transaction.objectStore(TRANSFERS).put(record);
|
|
484
|
+
await completed(transaction);
|
|
485
|
+
},
|
|
486
|
+
async abandon(locator) {
|
|
487
|
+
const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_TARGETS], 'readwrite');
|
|
488
|
+
const transfers = transaction.objectStore(TRANSFERS);
|
|
489
|
+
const held = transfers.get(locator);
|
|
490
|
+
held.onsuccess = () => {
|
|
491
|
+
const record = held.result;
|
|
492
|
+
if (record === undefined)
|
|
493
|
+
return;
|
|
494
|
+
transfers.delete(locator);
|
|
495
|
+
const range = underTransfer(locator, record.transfer);
|
|
496
|
+
transaction.objectStore(DOCUMENTS).delete(range);
|
|
497
|
+
transaction.objectStore(BINARY_TARGETS).delete(range);
|
|
498
|
+
};
|
|
499
|
+
await completed(transaction);
|
|
500
|
+
},
|
|
385
501
|
async generation() {
|
|
386
502
|
return (await declaration(database)).generation;
|
|
387
503
|
},
|
package/dist/wire.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ declare const TOPICS: {
|
|
|
44
44
|
readonly 'deployment-facts': 'runtime';
|
|
45
45
|
readonly 'sync-status': 'within';
|
|
46
46
|
readonly 'service-mode': 'runtime';
|
|
47
|
+
readonly member: 'runtime';
|
|
47
48
|
readonly query: 'within';
|
|
48
49
|
readonly queue: 'within';
|
|
49
50
|
readonly 'room-drafts': 'within';
|
package/dist/wire.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IACjG,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,G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,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAQ7C,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAiC5D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAe1D"}
|
package/dist/wire.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-cf6d5f0a5c9c8",
|
|
4
4
|
"description": "The headless core of MD App",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"LICENSE"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
44
|
+
"@agentshouse/mdmodel": "0.1.0-c64dbada0730d",
|
|
45
45
|
"@tanstack/db": "0.9.2",
|
|
46
46
|
"minisearch": "7.2.0"
|
|
47
47
|
},
|