docblocks-core 0.1.2 → 0.1.3
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/CHANGELOG.md +10 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +14 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# docblocks-core
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5971d30: `PresenceState` now passes through the awareness payload's sharing
|
|
8
|
+
contract fields — the consumer user identity (`userId` / `name`), the
|
|
9
|
+
opaque ciphertext selection entries (`selections`), and the publication
|
|
10
|
+
counter (`seq`). The ws-provider mapper validates them defensively; a
|
|
11
|
+
legacy frame keeps its pre-sharing shape.
|
|
12
|
+
|
|
3
13
|
## 0.1.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1287,6 +1287,27 @@ interface PresenceState {
|
|
|
1287
1287
|
selection: PresenceSelection | null;
|
|
1288
1288
|
/** Unix milliseconds. Staleness handling (TTL) is a consumer concern. */
|
|
1289
1289
|
updatedAt: number;
|
|
1290
|
+
/**
|
|
1291
|
+
* Consumer-provided stable user identity (optional; absent on legacy
|
|
1292
|
+
* peers). `peerId` is the anonymous transport-level identifier —
|
|
1293
|
+
* `userId` is the only addressable identity.
|
|
1294
|
+
*/
|
|
1295
|
+
userId?: string;
|
|
1296
|
+
/** Consumer-provided roster display label (optional). */
|
|
1297
|
+
name?: string;
|
|
1298
|
+
/**
|
|
1299
|
+
* Opaque ciphertext selection entries (optional): one per share
|
|
1300
|
+
* target, no target id inside the entry — the recipient tries each
|
|
1301
|
+
* entry with its own decryptor. Absent when the peer shares with
|
|
1302
|
+
* everyone (plaintext `selection`) or not at all.
|
|
1303
|
+
*/
|
|
1304
|
+
selections?: string[];
|
|
1305
|
+
/**
|
|
1306
|
+
* Monotonic per-publisher selection publication counter (optional):
|
|
1307
|
+
* the recipient discards a decrypted selection whose `seq` is older
|
|
1308
|
+
* than the last accepted one for the peer (the async decrypt race).
|
|
1309
|
+
*/
|
|
1310
|
+
seq?: number;
|
|
1290
1311
|
}
|
|
1291
1312
|
/**
|
|
1292
1313
|
* Transport for syncing one document with peers.
|
package/dist/index.mjs
CHANGED
|
@@ -6255,6 +6255,18 @@ function parseSelection(value) {
|
|
|
6255
6255
|
if (isStringArray(sel.blocks)) return { blocks: [...sel.blocks] };
|
|
6256
6256
|
return null;
|
|
6257
6257
|
}
|
|
6258
|
+
/** The sharing-contract presence extras (identity, ciphertext entries, the
|
|
6259
|
+
* publication counter): defensive validation, absent for legacy peers. */
|
|
6260
|
+
function parsePresenceExtras(value) {
|
|
6261
|
+
if (typeof value !== "object" || value === null) return {};
|
|
6262
|
+
const state = value;
|
|
6263
|
+
const extras = {};
|
|
6264
|
+
if (typeof state.userId === "string") extras.userId = state.userId;
|
|
6265
|
+
if (typeof state.name === "string") extras.name = state.name;
|
|
6266
|
+
if (isStringArray(state.selections)) extras.selections = [...state.selections];
|
|
6267
|
+
if (typeof state.seq === "number") extras.seq = state.seq;
|
|
6268
|
+
return extras;
|
|
6269
|
+
}
|
|
6258
6270
|
/** The default socket factory: the global WebSocket, normalized to WsLike. */
|
|
6259
6271
|
const defaultWebSocketImpl = (url) => {
|
|
6260
6272
|
const ws = new WebSocket(url);
|
|
@@ -6591,7 +6603,8 @@ var WsSyncProvider = class {
|
|
|
6591
6603
|
peers.push({
|
|
6592
6604
|
peerId: String(clientID),
|
|
6593
6605
|
selection: parseSelection(state.selection),
|
|
6594
|
-
updatedAt: typeof state.updatedAt === "number" ? state.updatedAt : 0
|
|
6606
|
+
updatedAt: typeof state.updatedAt === "number" ? state.updatedAt : 0,
|
|
6607
|
+
...parsePresenceExtras(state)
|
|
6595
6608
|
});
|
|
6596
6609
|
});
|
|
6597
6610
|
return peers;
|
package/package.json
CHANGED