@agentshouse/mdruntime 0.1.0-cf04ede9fb796 → 0.1.0-cf0c43fc48aad
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 +12 -12
- package/dist/acceptance.d.ts +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +74 -164
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +118 -67
- package/dist/adapter.d.ts +27 -48
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +4 -2
- package/dist/client.d.ts +9 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +32 -15
- package/dist/collection.d.ts +22 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +12 -2
- package/dist/compile.d.ts +2 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +31 -24
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +26 -21
- package/dist/conversation-live.d.ts +10 -6
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +8 -6
- package/dist/conversation.d.ts +28 -10
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +194 -141
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +19 -44
- package/dist/durability.d.ts +3 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.js +1 -1
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/host.d.ts +17 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +45 -11
- package/dist/index.d.ts +12 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/install.d.ts +2 -4
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +52 -78
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +40 -31
- package/dist/listing.d.ts +6 -11
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +25 -62
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +3 -3
- package/dist/locks.d.ts +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +10 -39
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +10 -22
- package/dist/media.d.ts +1 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +4 -4
- package/dist/memory.d.ts +4 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +44 -23
- package/dist/messages.d.ts +9 -5
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +25 -35
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +95 -137
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +12 -17
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +5 -9
- package/dist/outcome.d.ts +3 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +15 -0
- package/dist/overlay.d.ts +5 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +36 -21
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +3 -59
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +10 -123
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +25 -24
- package/dist/presence.d.ts +52 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +220 -0
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +24 -14
- package/dist/query.d.ts +0 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +0 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +0 -7
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +450 -0
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +67 -22
- package/dist/react.d.ts +5 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/reads.d.ts +3 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +9 -2
- package/dist/recovery.d.ts +3 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +29 -7
- package/dist/refresh.js +2 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +5 -6
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +13 -15
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +4 -6
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +46 -57
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +17 -16
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +3 -4
- package/dist/runtime.d.ts +9 -18
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +42 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +334 -167
- package/dist/saves.d.ts +2 -40
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +107 -705
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -3
- package/dist/shared.d.ts +0 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +4 -90
- package/dist/shown.d.ts +4 -3
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +26 -31
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- package/dist/socket/session.d.ts +0 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket.d.ts +3 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +5 -16
- package/dist/source.d.ts +0 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +5 -4
- package/dist/store/records.d.ts +8 -6
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +13 -6
- package/dist/store/space.d.ts +1 -1
- package/dist/store/space.d.ts.map +1 -1
- package/dist/store/space.js +0 -2
- package/dist/store/watchers.js +1 -2
- package/dist/store.d.ts +11 -6
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +38 -13
- package/dist/stored.d.ts +2 -1
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +11 -11
- package/dist/surface.d.ts +1 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +13 -16
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +88 -85
- package/dist/tables.d.ts +6 -8
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +41 -20
- package/dist/tallies.js +5 -5
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +2 -2
- package/dist/wire.d.ts +51 -7
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -4
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -33
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -54
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -44
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
package/dist/seed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAS,KAAK,WAAW,EAAqB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,IAAI,EAA4C,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;CACpF,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAEjG,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,CAA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IAAI,EAAE,SAAS,KAAK,KAAK,EACjD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAChC,MAAM,IAAI,CAAC;AA0ChB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAe5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAmBtD;AA+BD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAOxF;AAYD,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAMlE;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,GACjB,MAAM,IAAI,CA4BZ"}
|
package/dist/seed.js
CHANGED
|
@@ -62,7 +62,6 @@ export function seededResult(seed) {
|
|
|
62
62
|
generation,
|
|
63
63
|
current: false,
|
|
64
64
|
})),
|
|
65
|
-
indexes: [],
|
|
66
65
|
overlay: [],
|
|
67
66
|
};
|
|
68
67
|
if ('groups' in seed.rows) {
|
|
@@ -83,9 +82,9 @@ function seedRoomHeld({ socket }, room, version, held) {
|
|
|
83
82
|
socket.reads.reached(room, stored.roomVersion, version));
|
|
84
83
|
}
|
|
85
84
|
function seedHeld(runtime, at, held) {
|
|
86
|
-
const { socket } = runtime;
|
|
85
|
+
const { socket, presence } = runtime;
|
|
87
86
|
return Object.entries(at).every(([room, version]) => (socket.session.now().roomsListed &&
|
|
88
|
-
|
|
87
|
+
presence.room(room) === undefined &&
|
|
89
88
|
!held.rooms.has(room)) ||
|
|
90
89
|
seedRoomHeld(runtime, room, version, held));
|
|
91
90
|
}
|
package/dist/shared.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ export declare function guarding<V>(values: Paths<V>, handler: ProxyHandler<Path
|
|
|
3
3
|
export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
|
|
4
4
|
export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
|
|
5
5
|
export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
|
|
6
|
-
export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
|
|
7
|
-
export declare function shared<V>(map: Paths<V>): Paths<V>;
|
|
8
|
-
export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
|
|
9
6
|
export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
|
|
10
|
-
export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
|
|
11
|
-
export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
|
|
12
7
|
export declare function drafted<V>(base: Paths<V>): Record<string, V>;
|
|
13
8
|
export declare function settled<V>(draft: Record<string, V>): Paths<V>;
|
|
14
9
|
export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AA8LnD,wBAAgB,QAAQ,CAAC,CAAC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AC,CAUxF"}
|
package/dist/shared.js
CHANGED
|
@@ -100,21 +100,15 @@ function lone(node) {
|
|
|
100
100
|
}
|
|
101
101
|
function taken(node, hash, key, shift) {
|
|
102
102
|
if (isLeaf(node))
|
|
103
|
-
return
|
|
103
|
+
return undefined;
|
|
104
104
|
if (isCollision(node)) {
|
|
105
105
|
const leaves = node.leaves.filter((leaf) => leaf.key !== key);
|
|
106
|
-
if (leaves.length === node.leaves.length)
|
|
107
|
-
return node;
|
|
108
106
|
return leaves.length === 1 ? leaves[0] : { hash: node.hash, leaves };
|
|
109
107
|
}
|
|
110
108
|
const bit = 1 << fragment(hash, shift);
|
|
111
|
-
if ((node.bitmap & bit) === 0)
|
|
112
|
-
return node;
|
|
113
109
|
const at = slot(node.bitmap, bit);
|
|
114
110
|
const child = node.children[at];
|
|
115
111
|
const next = taken(child, hash, key, shift + BITS);
|
|
116
|
-
if (next === child)
|
|
117
|
-
return node;
|
|
118
112
|
if (next === undefined) {
|
|
119
113
|
if (node.children.length === 1)
|
|
120
114
|
return undefined;
|
|
@@ -201,13 +195,11 @@ function* rooted(map) {
|
|
|
201
195
|
if (held !== undefined)
|
|
202
196
|
return held;
|
|
203
197
|
let node;
|
|
204
|
-
let size = 0;
|
|
205
198
|
for (const [key, value] of entriesIn(map)) {
|
|
206
199
|
node = put(node, { key, hash: hashOf(key), value }, 0);
|
|
207
|
-
size += 1;
|
|
208
200
|
yield ROW_WEIGHT;
|
|
209
201
|
}
|
|
210
|
-
return { node
|
|
202
|
+
return { node };
|
|
211
203
|
}
|
|
212
204
|
const RUN = 1 << 10;
|
|
213
205
|
function* merged(left, right) {
|
|
@@ -251,103 +243,25 @@ export function* sorting(keys) {
|
|
|
251
243
|
}
|
|
252
244
|
return runs[0] ?? [];
|
|
253
245
|
}
|
|
254
|
-
export function* sharing(map) {
|
|
255
|
-
return roots.has(map) ? map : facade(yield* rooted(map));
|
|
256
|
-
}
|
|
257
|
-
export function shared(map) {
|
|
258
|
-
return finished(sharing(map));
|
|
259
|
-
}
|
|
260
|
-
export function patched(base, set, removed = []) {
|
|
261
|
-
return finished(patching(base, set, removed));
|
|
262
|
-
}
|
|
263
246
|
export function* patching(base, set, removed = []) {
|
|
264
247
|
const root = yield* rooted(base);
|
|
265
248
|
let node = root.node;
|
|
266
|
-
let size = root.size;
|
|
267
249
|
for (const key of removed) {
|
|
268
250
|
if (node === undefined)
|
|
269
251
|
break;
|
|
270
|
-
const before = lookup({ node
|
|
252
|
+
const before = lookup({ node }, key);
|
|
271
253
|
if (before === undefined)
|
|
272
254
|
continue;
|
|
273
255
|
node = taken(node, before.hash, key, 0);
|
|
274
|
-
size -= 1;
|
|
275
256
|
yield ROW_WEIGHT;
|
|
276
257
|
}
|
|
277
258
|
for (const [key, value] of set) {
|
|
278
|
-
const before = lookup({ node, size }, key);
|
|
279
259
|
node = put(node, { key, hash: hashOf(key), value }, 0);
|
|
280
|
-
if (before === undefined)
|
|
281
|
-
size += 1;
|
|
282
260
|
yield ROW_WEIGHT;
|
|
283
261
|
}
|
|
284
262
|
if (node === root.node && roots.has(base))
|
|
285
263
|
return base;
|
|
286
|
-
return facade({ node
|
|
287
|
-
}
|
|
288
|
-
function* compared(left, right, same, into) {
|
|
289
|
-
const pending = [[left, right]];
|
|
290
|
-
for (let pair = pending.pop(); pair !== undefined; pair = pending.pop()) {
|
|
291
|
-
const [one, other] = pair;
|
|
292
|
-
if (one === other)
|
|
293
|
-
continue;
|
|
294
|
-
if (one !== undefined &&
|
|
295
|
-
other !== undefined &&
|
|
296
|
-
!isLeaf(one) &&
|
|
297
|
-
!isCollision(one) &&
|
|
298
|
-
!isLeaf(other) &&
|
|
299
|
-
!isCollision(other)) {
|
|
300
|
-
const children = [];
|
|
301
|
-
for (let remaining = one.bitmap | other.bitmap; remaining !== 0; remaining &= remaining - 1) {
|
|
302
|
-
const bit = remaining & -remaining;
|
|
303
|
-
children.push([
|
|
304
|
-
(one.bitmap & bit) === 0 ? undefined : one.children[slot(one.bitmap, bit)],
|
|
305
|
-
(other.bitmap & bit) === 0 ? undefined : other.children[slot(other.bitmap, bit)],
|
|
306
|
-
]);
|
|
307
|
-
}
|
|
308
|
-
pending.push(...children.reverse());
|
|
309
|
-
continue;
|
|
310
|
-
}
|
|
311
|
-
const before = new Map();
|
|
312
|
-
for (const leaf of leavesOf(one)) {
|
|
313
|
-
before.set(leaf.key, leaf.value);
|
|
314
|
-
yield ROW_WEIGHT;
|
|
315
|
-
}
|
|
316
|
-
for (const leaf of leavesOf(other)) {
|
|
317
|
-
const held = before.get(leaf.key);
|
|
318
|
-
before.delete(leaf.key);
|
|
319
|
-
if (held === undefined || !same(held, leaf.value))
|
|
320
|
-
into.add(leaf.key);
|
|
321
|
-
yield ROW_WEIGHT;
|
|
322
|
-
}
|
|
323
|
-
for (const key of before.keys())
|
|
324
|
-
into.add(key);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
export function* differences(left, right, same = Object.is) {
|
|
328
|
-
const into = new Set();
|
|
329
|
-
if (left === right)
|
|
330
|
-
return into;
|
|
331
|
-
const leftRoot = roots.get(left);
|
|
332
|
-
const rightRoot = roots.get(right);
|
|
333
|
-
if (leftRoot !== undefined && rightRoot !== undefined) {
|
|
334
|
-
yield* compared(leftRoot.node, rightRoot.node, same, into);
|
|
335
|
-
return into;
|
|
336
|
-
}
|
|
337
|
-
for (const [key, value] of entriesIn(left)) {
|
|
338
|
-
if (!Object.hasOwn(right, key) || !same(value, right[key]))
|
|
339
|
-
into.add(key);
|
|
340
|
-
yield ROW_WEIGHT;
|
|
341
|
-
}
|
|
342
|
-
for (const [key] of entriesIn(right)) {
|
|
343
|
-
if (!Object.hasOwn(left, key))
|
|
344
|
-
into.add(key);
|
|
345
|
-
yield ROW_WEIGHT;
|
|
346
|
-
}
|
|
347
|
-
return into;
|
|
348
|
-
}
|
|
349
|
-
export function differing(left, right, same = Object.is) {
|
|
350
|
-
return finished(differences(left, right, same));
|
|
264
|
+
return facade({ node });
|
|
351
265
|
}
|
|
352
266
|
const drafts = new WeakMap();
|
|
353
267
|
const GONE = Symbol('gone');
|
package/dist/shown.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
1
|
+
import type { Member } from './adapter.js';
|
|
2
|
+
import { type ChangeSet } from './change-set.js';
|
|
3
3
|
import type { QueueEntry } from './outcome.js';
|
|
4
4
|
import type { Runtime } from './runtime.js';
|
|
5
5
|
import type { Live, Moving } from './socket.js';
|
|
@@ -26,6 +26,7 @@ export declare function transferring({ socket }: Runtime): Moving;
|
|
|
26
26
|
export declare function pendingShown(runtime: Runtime): Promise<void>;
|
|
27
27
|
export declare function entriesOf(runtime: Runtime, locator: string): Promise<readonly QueueEntry[]>;
|
|
28
28
|
export declare function publishChangeSet(runtime: Runtime, set: ChangeSet): Promise<void>;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function submissionDue(runtime: Runtime, locators?: readonly string[]): Promise<void>;
|
|
30
|
+
export declare function roomUnreadable(runtime: Runtime, locator: string): void;
|
|
30
31
|
export declare function rest(runtime: Runtime, progress: CycleProgress | null, live?: Live): Promise<void>;
|
|
31
32
|
//# sourceMappingURL=shown.d.ts.map
|
package/dist/shown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shown.d.ts","sourceRoot":"","sources":["../src/shown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"shown.d.ts","sourceRoot":"","sources":["../src/shown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,E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GAAG,MAAM,CAExD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5D;AAYD,wBAAsB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAGjG;AAcD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBhF;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjG;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAG/D;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,GAAG,IAAI,EAC9B,IAAI,GAAE,IAAqC,iBA6B5C"}
|
package/dist/shown.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { changeSet, mergeChangeSets } from './change-set.js';
|
|
1
2
|
import { conversationsChanged, conversationsLearned } from './conversation.js';
|
|
2
|
-
import { listingNow,
|
|
3
|
+
import { listingNow, patchedListing, shownRooms } from './listing.js';
|
|
3
4
|
import { emitPresentation, publishRoomDrafts } from './room-drafts.js';
|
|
4
5
|
import { same } from './status.js';
|
|
5
6
|
export const ROOMS_TOPIC = 'rooms';
|
|
@@ -12,9 +13,8 @@ export const AUTHORITY_TOPIC = 'authority-changes';
|
|
|
12
13
|
export const LOCKS_TOPIC = 'locks';
|
|
13
14
|
export const queueTopic = (locator) => `queue\u0000${locator}`;
|
|
14
15
|
async function attended({ store, localSaves }) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const attentionRequired = held.returned.flatMap((record) => record.returned === null || isFenced(record.locator)
|
|
16
|
+
const held = await store.status();
|
|
17
|
+
const attentionRequired = held.returned.flatMap((record) => record.returned === null
|
|
18
18
|
? []
|
|
19
19
|
: [{ room: record.locator, path: record.path, returned: structuredClone(record.returned) }]);
|
|
20
20
|
attentionRequired.sort((left, right) => {
|
|
@@ -26,25 +26,22 @@ async function attended({ store, localSaves }) {
|
|
|
26
26
|
});
|
|
27
27
|
const changed = new Map();
|
|
28
28
|
if (!localSaves) {
|
|
29
|
-
for (const change of held.unsent)
|
|
30
|
-
|
|
31
|
-
changed.set(`${change.room}\u0000${change.path}`, change);
|
|
32
|
-
}
|
|
29
|
+
for (const change of held.unsent)
|
|
30
|
+
changed.set(`${change.room}\u0000${change.path}`, change);
|
|
33
31
|
}
|
|
34
32
|
const unsent = [...changed]
|
|
35
33
|
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
36
34
|
.map(([, change]) => change);
|
|
37
35
|
return {
|
|
38
|
-
queued: !localSaves && held.queued.
|
|
36
|
+
queued: !localSaves && held.queued.length > 0,
|
|
39
37
|
lastCompleted: held.lastCompleted,
|
|
40
38
|
attentionRequired,
|
|
41
39
|
unsent,
|
|
42
|
-
reset: held.resets.reduce((earliest, {
|
|
40
|
+
reset: held.resets.reduce((earliest, { reset }) => (earliest !== null && earliest <= reset ? earliest : reset), null),
|
|
43
41
|
};
|
|
44
42
|
}
|
|
45
43
|
async function queuedWork({ store, localSaves }) {
|
|
46
|
-
|
|
47
|
-
return !localSaves && held.some((locator) => !store.fences.has(locator));
|
|
44
|
+
return !localSaves && (await store.queued()).length > 0;
|
|
48
45
|
}
|
|
49
46
|
export function recoverReads({ liveQueries, figures }) {
|
|
50
47
|
liveQueries.recover();
|
|
@@ -88,9 +85,7 @@ async function deliverRooms(runtime, owed) {
|
|
|
88
85
|
if (patched === null && owed.changed.size > 0)
|
|
89
86
|
owed.all = true;
|
|
90
87
|
if (patched === null && !owed.all && owed.counted.size > 0) {
|
|
91
|
-
const held = await store.covering()
|
|
92
|
-
if (held === null)
|
|
93
|
-
return;
|
|
88
|
+
const held = await store.covering();
|
|
94
89
|
const { roomsShown } = store.device.now();
|
|
95
90
|
owed.all = [...owed.counted].some((locator) => held.rooms.has(locator) &&
|
|
96
91
|
roomsShown?.get(locator)?.documents !== held.rooms.get(locator).documents);
|
|
@@ -101,15 +96,15 @@ async function deliverRooms(runtime, owed) {
|
|
|
101
96
|
else if (waiting().length === 0)
|
|
102
97
|
return;
|
|
103
98
|
}
|
|
104
|
-
const listing = patched ?? (await listingNow(runtime)
|
|
105
|
-
if (
|
|
99
|
+
const listing = patched ?? (await listingNow(runtime));
|
|
100
|
+
if (socket.closed())
|
|
106
101
|
return;
|
|
107
|
-
const value = shownRooms(runtime, listing);
|
|
108
102
|
const { roomsListed, refusal, moving } = socket.session.now();
|
|
109
103
|
const joining = waiting().length > 0 &&
|
|
110
104
|
(roomsListed || listing.size > 0 || refusal !== null || moving.providerUnreachable);
|
|
111
105
|
if (!owed.all && patched === null && !joining)
|
|
112
106
|
return;
|
|
107
|
+
const value = shownRooms(runtime, listing);
|
|
113
108
|
const { roomsShown } = store.device.now();
|
|
114
109
|
const moved = owed.all ||
|
|
115
110
|
patched !== null ||
|
|
@@ -204,10 +199,7 @@ function entryOf({ localSaves }, states, batch) {
|
|
|
204
199
|
return Object.freeze({ batch, ...(state?.submission ?? { state: 'waiting' }) });
|
|
205
200
|
}
|
|
206
201
|
export async function entriesOf(runtime, locator) {
|
|
207
|
-
const {
|
|
208
|
-
if (store.fences.has(locator))
|
|
209
|
-
return [];
|
|
210
|
-
const { queue, states } = await store.work(locator);
|
|
202
|
+
const { queue, states } = await runtime.store.work(locator);
|
|
211
203
|
return queue.map((batch) => entryOf(runtime, states, batch));
|
|
212
204
|
}
|
|
213
205
|
function emitQueue(runtime, locator) {
|
|
@@ -253,20 +245,23 @@ export function publishChangeSet(runtime, set) {
|
|
|
253
245
|
conversationsChanged(conversations, set);
|
|
254
246
|
return Promise.all(shownNow).then(() => undefined);
|
|
255
247
|
}
|
|
256
|
-
export function
|
|
257
|
-
|
|
258
|
-
|
|
248
|
+
export async function submissionDue(runtime, locators) {
|
|
249
|
+
const { store } = runtime;
|
|
250
|
+
const due = (await store.queued()).filter((locator) => locators === undefined || locators.includes(locator));
|
|
251
|
+
if (due.length === 0)
|
|
252
|
+
return;
|
|
253
|
+
await store.changed(mergeChangeSets(due.map((locator) => changeSet(locator, { due: true }))));
|
|
254
|
+
}
|
|
255
|
+
export function roomUnreadable(runtime, locator) {
|
|
256
|
+
runtime.presence.refused(locator, null);
|
|
259
257
|
emitRooms(runtime);
|
|
260
258
|
}
|
|
261
259
|
export async function rest(runtime, progress, live = () => !runtime.socket.closed()) {
|
|
262
|
-
const { store, socket } = runtime;
|
|
263
|
-
const { session, lanes
|
|
260
|
+
const { store, socket, presence } = runtime;
|
|
261
|
+
const { session, lanes } = socket;
|
|
264
262
|
if (!live())
|
|
265
263
|
return;
|
|
266
|
-
const settled = () => session.now().complete &&
|
|
267
|
-
lanes.roomWork() === 0 &&
|
|
268
|
-
!socket.naming() &&
|
|
269
|
-
rooms.standingWhere(({ stale }) => stale).length === 0;
|
|
264
|
+
const settled = () => session.now().complete && lanes.roomWork() === 0 && !socket.naming() && presence.settled();
|
|
270
265
|
let synced = settled();
|
|
271
266
|
if (synced && !session.now().recorded) {
|
|
272
267
|
const queued = await queuedWork(runtime).catch(() => true);
|
package/dist/socket/lanes.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { CallResult } from '../outcome.js';
|
|
1
2
|
export type Live = () => boolean;
|
|
3
|
+
export type KeptSender = {
|
|
4
|
+
next(): Promise<CallResult>;
|
|
5
|
+
};
|
|
2
6
|
type LaneRules = {
|
|
3
7
|
generation(): number;
|
|
4
8
|
continuing(): boolean;
|
|
5
9
|
stopping(): boolean;
|
|
10
|
+
failed(locator: string, error: unknown): void;
|
|
6
11
|
};
|
|
7
12
|
export type Lanes = {
|
|
8
13
|
task(lane: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
@@ -11,10 +16,13 @@ export type Lanes = {
|
|
|
11
16
|
roomWork(): number;
|
|
12
17
|
current(): Promise<unknown>;
|
|
13
18
|
finished(): Promise<unknown>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
sender(operation: string): KeptSender | undefined;
|
|
20
|
+
sending(operation: string, sender: KeptSender): void;
|
|
21
|
+
sent(operation: string, sender: KeptSender): void;
|
|
22
|
+
settled(operation: string): Promise<void>;
|
|
23
|
+
settle(operation: string, lost: boolean): void;
|
|
24
|
+
unclaimed(operation: string): boolean;
|
|
17
25
|
};
|
|
18
|
-
export declare function createLanes({ generation, continuing, stopping }: LaneRules): Lanes;
|
|
26
|
+
export declare function createLanes({ generation, continuing, stopping, failed }: LaneRules): Lanes;
|
|
19
27
|
export {};
|
|
20
28
|
//# sourceMappingURL=lanes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanes.d.ts","sourceRoot":"","sources":["../../src/socket/lanes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"lanes.d.ts","sourceRoot":"","sources":["../../src/socket/lanes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;AAEjC,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAIzD,KAAK,SAAS,GAAG;IACf,UAAU,IAAI,MAAM,CAAC;IACrB,UAAU,IAAI,OAAO,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC;IACpB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,CAAC,IAAI,EAAE,MAA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export function createLanes({ generation, continuing, stopping, failed }) {
|
|
3
3
|
const lanes = new Map();
|
|
4
4
|
const roomLanes = new Map();
|
|
5
5
|
const roomReads = { free: ROOM_READS, waiting: [] };
|
|
6
6
|
const working = new Set();
|
|
7
|
-
const
|
|
7
|
+
const senders = new Map();
|
|
8
|
+
const settlements = new Map();
|
|
9
|
+
const unclaimed = new Set();
|
|
8
10
|
let roomWork = 0;
|
|
9
11
|
async function admittedRead(work) {
|
|
10
12
|
while (roomReads.free === 0) {
|
|
@@ -59,19 +61,43 @@ export function createLanes({ generation, continuing, stopping }) {
|
|
|
59
61
|
roomTask(locator, work) {
|
|
60
62
|
if (stopping())
|
|
61
63
|
return Promise.resolve();
|
|
62
|
-
return inRoom(locator, (live) => admittedRead(() => work(live))).catch(() =>
|
|
64
|
+
return inRoom(locator, (live) => admittedRead(() => work(live))).catch((error) => {
|
|
65
|
+
if (!stopping())
|
|
66
|
+
failed(locator, error);
|
|
67
|
+
});
|
|
63
68
|
},
|
|
64
69
|
roomWork: () => roomWork,
|
|
65
70
|
current: () => Promise.all([...lanes.values()]
|
|
66
71
|
.filter((held) => held.generation === generation())
|
|
67
72
|
.map((held) => held.chain)),
|
|
68
73
|
finished: () => Promise.all(working),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
sender: (operation) => senders.get(operation),
|
|
75
|
+
sending(operation, sender) {
|
|
76
|
+
senders.set(operation, sender);
|
|
72
77
|
},
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
sent(operation, sender) {
|
|
79
|
+
if (senders.get(operation) === sender)
|
|
80
|
+
senders.delete(operation);
|
|
75
81
|
},
|
|
82
|
+
settled(operation) {
|
|
83
|
+
if (unclaimed.delete(operation))
|
|
84
|
+
return Promise.resolve();
|
|
85
|
+
return new Promise((settle) => {
|
|
86
|
+
const earlier = settlements.get(operation);
|
|
87
|
+
settlements.set(operation, () => {
|
|
88
|
+
earlier?.();
|
|
89
|
+
settle();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
settle(operation, lost) {
|
|
94
|
+
const settle = settlements.get(operation);
|
|
95
|
+
settlements.delete(operation);
|
|
96
|
+
if (settle !== undefined)
|
|
97
|
+
settle();
|
|
98
|
+
else if (lost)
|
|
99
|
+
unclaimed.add(operation);
|
|
100
|
+
},
|
|
101
|
+
unclaimed: (operation) => unclaimed.has(operation),
|
|
76
102
|
};
|
|
77
103
|
}
|
package/dist/socket/session.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export type RefusalReason = 'missing-required-guarantee' | 'revoked-authorizatio
|
|
|
6
6
|
export type ConnectionRefusalCode = Open<RefusalReason>;
|
|
7
7
|
export type ConnectionRefusal = {
|
|
8
8
|
code: ConnectionRefusalCode;
|
|
9
|
-
retryable: boolean;
|
|
10
9
|
reauthorizationOffered: boolean;
|
|
11
10
|
refusal: ProviderRefusal | null;
|
|
12
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/socket/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,4BAA4B,GAAG,uBAAuB,CAAC;AAEnF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/socket/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE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C7B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,wBAAgB,aAAa,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,CAqBrF"}
|
package/dist/socket.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Adapter, Authorization, ConversationEvent, Discovery, HeldRoom, RoomStreamEvent, ServiceMode } from './adapter.js';
|
|
2
2
|
import type { Reads } from './bootstrap.js';
|
|
3
3
|
import type { Cell } from './cell.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Retries } from './retried.js';
|
|
5
5
|
import { type Admission } from './socket/admission.js';
|
|
6
6
|
import { type Answers } from './socket/answers.js';
|
|
7
7
|
import { type Lanes } from './socket/lanes.js';
|
|
8
|
-
import { type Rooms } from './socket/rooms.js';
|
|
9
8
|
import { type Session } from './socket/session.js';
|
|
10
|
-
export type { Live } from './socket/lanes.js';
|
|
11
|
-
export type { RoomDeclaration } from './socket/rooms.js';
|
|
9
|
+
export type { KeptSender, Live } from './socket/lanes.js';
|
|
12
10
|
export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
|
|
13
11
|
type SocketEvent = {
|
|
14
12
|
readonly kind: 'opened';
|
|
@@ -28,7 +26,6 @@ export type RuntimeSocket = Admission & Answers & {
|
|
|
28
26
|
readonly reads: Reads;
|
|
29
27
|
readonly streamed: boolean;
|
|
30
28
|
readonly session: Cell<Session>;
|
|
31
|
-
readonly rooms: Rooms;
|
|
32
29
|
readonly lanes: Lanes;
|
|
33
30
|
readonly ready: Promise<void>;
|
|
34
31
|
readonly firstDiscovery: Promise<void>;
|
|
@@ -66,5 +63,5 @@ export type RuntimeSocket = Admission & Answers & {
|
|
|
66
63
|
abortReads(): void;
|
|
67
64
|
stopReads(): void;
|
|
68
65
|
};
|
|
69
|
-
export declare function createSocket(adapter: Adapter,
|
|
66
|
+
export declare function createSocket(adapter: Adapter, retries: Retries, authorization: Authorization | undefined): RuntimeSocket;
|
|
70
67
|
//# sourceMappingURL=socket.d.ts.map
|
package/dist/socket.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../src/socket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../src/socket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,qBAAq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AM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,IAAI,CAAC;IACnB,SAAS,IAAI,IAAI,CAAC;CACnB,CAAC;AAEJ,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,GAAG,SAAS,GACvC,aAAa,CAwJf"}
|
package/dist/socket.js
CHANGED
|
@@ -2,14 +2,12 @@ import { createAdmission } from './socket/admission.js';
|
|
|
2
2
|
import { createAnswers } from './socket/answers.js';
|
|
3
3
|
import { createLanes } from './socket/lanes.js';
|
|
4
4
|
import { createReads } from './socket/reads.js';
|
|
5
|
-
import { createRooms } from './socket/rooms.js';
|
|
6
5
|
import { createSession } from './socket/session.js';
|
|
7
|
-
export function createSocket(adapter,
|
|
6
|
+
export function createSocket(adapter, retries, authorization) {
|
|
8
7
|
const held = createReads(adapter);
|
|
9
8
|
const admission = createAdmission();
|
|
10
9
|
const answers = createAnswers();
|
|
11
10
|
const session = createSession(authorization);
|
|
12
|
-
const rooms = createRooms();
|
|
13
11
|
let readyFromStore = () => { };
|
|
14
12
|
const ready = new Promise((resolve) => {
|
|
15
13
|
readyFromStore = resolve;
|
|
@@ -69,11 +67,11 @@ export function createSocket(adapter, journal, authorization) {
|
|
|
69
67
|
reads: held.reads,
|
|
70
68
|
streamed: adapter.roomStream !== undefined,
|
|
71
69
|
session,
|
|
72
|
-
rooms,
|
|
73
70
|
lanes: createLanes({
|
|
74
71
|
generation: () => generation,
|
|
75
72
|
continuing,
|
|
76
73
|
stopping: () => session.now().stopping,
|
|
74
|
+
failed: (locator, error) => retries.failed('download', locator, error),
|
|
77
75
|
}),
|
|
78
76
|
ready,
|
|
79
77
|
firstDiscovery,
|
|
@@ -90,18 +88,11 @@ export function createSocket(adapter, journal, authorization) {
|
|
|
90
88
|
async authorize() {
|
|
91
89
|
if (session.now().authorization !== undefined)
|
|
92
90
|
return;
|
|
93
|
-
|
|
94
|
-
session.set({ authorization: await adapter.authorize() });
|
|
95
|
-
journal.record('connection authorize');
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
journal.record('connection authorize transport-uncertainty');
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
91
|
+
session.set({ authorization: await adapter.authorize() });
|
|
101
92
|
},
|
|
102
93
|
observe(listen) {
|
|
103
94
|
const stream = adapter.roomStream;
|
|
104
|
-
if (stream === undefined
|
|
95
|
+
if (stream === undefined)
|
|
105
96
|
return;
|
|
106
97
|
withdrawStream = stream.observe((event) => {
|
|
107
98
|
const { closed, stopping } = session.now();
|
|
@@ -111,7 +102,7 @@ export function createSocket(adapter, journal, authorization) {
|
|
|
111
102
|
},
|
|
112
103
|
observeConversations(listen) {
|
|
113
104
|
const stream = adapter.conversations;
|
|
114
|
-
if (stream === undefined
|
|
105
|
+
if (stream === undefined)
|
|
115
106
|
return;
|
|
116
107
|
withdrawConversations = stream.observe(listen);
|
|
117
108
|
},
|
|
@@ -121,8 +112,6 @@ export function createSocket(adapter, journal, authorization) {
|
|
|
121
112
|
close() {
|
|
122
113
|
session.set({ closed: true });
|
|
123
114
|
notifyDiscovered();
|
|
124
|
-
rooms.unreadied();
|
|
125
|
-
rooms.connectionLive();
|
|
126
115
|
withdrawStream?.();
|
|
127
116
|
withdrawStream = undefined;
|
|
128
117
|
withdrawConversations?.();
|
package/dist/source.d.ts
CHANGED
|
@@ -45,13 +45,6 @@ export type ChatRequest = {
|
|
|
45
45
|
readonly room: string;
|
|
46
46
|
readonly message?: string;
|
|
47
47
|
};
|
|
48
|
-
export type ChatRoomRequest = {
|
|
49
|
-
readonly request: string;
|
|
50
|
-
readonly room: {
|
|
51
|
-
readonly ref: string;
|
|
52
|
-
readonly name: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
48
|
type RequestAgentFunction = {
|
|
56
49
|
readonly name: string;
|
|
57
50
|
readonly version: number;
|
package/dist/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACtE,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ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AEF,KAAK,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoChF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CA6ClF"}
|
package/dist/source.js
CHANGED
|
@@ -36,15 +36,16 @@ export function sourceOf(value, sender) {
|
|
|
36
36
|
return requestOf(source);
|
|
37
37
|
if (source.kind === 'trigger') {
|
|
38
38
|
const trigger = text(record(source.trigger), 'description');
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
39
|
+
const room = record(source.room);
|
|
40
|
+
const ref = text(room, 'ref');
|
|
41
|
+
const called = text(room, 'name');
|
|
42
|
+
return trigger === null || ref === null || called === null
|
|
42
43
|
? null
|
|
43
44
|
: {
|
|
44
45
|
kind: 'trigger',
|
|
45
46
|
customer: sender === 'customer',
|
|
46
47
|
trigger,
|
|
47
|
-
room: { ref, name:
|
|
48
|
+
room: { ref, name: called },
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
if (source.kind === 'conversation') {
|