wire-mesh-core 1.36.0 → 1.37.0

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.
@@ -430,6 +430,15 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
430
430
  await transmit(frame, false);
431
431
  emit();
432
432
  },
433
+ async sendDataFrame(frame) {
434
+ if (connection === null || state.status !== "connected") throw new Error("not connected");
435
+ frameLog.push({
436
+ direction: "sent",
437
+ frame
438
+ });
439
+ await transmit(frame, false);
440
+ emit();
441
+ },
433
442
  async close() {
434
443
  feedCancelled = true;
435
444
  if (handshakeTimer !== null) {
@@ -1,4 +1,4 @@
1
- import { D as DeviceId, N as Frame, Q as PeerAdvert, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken } from "../protocol-gbXtNeOc.cjs";
1
+ import { D as DeviceId, E as DataRequestFrame, N as Frame, Q as PeerAdvert, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-gbXtNeOc.cjs";
2
2
  import { t as IdentityPort } from "../identity-B4XBWkqg.cjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.cjs";
4
4
  import { r as Transport, t as Connection } from "../transport-DAsFqDDS.cjs";
@@ -83,6 +83,8 @@ export interface MeshSession {
83
83
  sendRevocationAnnounce: (entries: readonly RevocationEntry[]) => Promise<void>;
84
84
  /** Re-sends this side's own self-advert with a fresh snapshot-seconds and, when given, extensions merged onto peer-advert's own open `* tstr => any` tail -- the mechanism a caller uses to keep gossiped presence status (or any other advertised fact) live over a connection's lifetime, since the initial self-advert wireUpConnection sends at connect time is otherwise never repeated. Callers own their own re-advertisement cadence (there is no timer inside MeshSession itself, matching its own DOM-free, fully unit-testable design); a caller not calling this again after connecting is exactly today's existing gossip-once-on-connect behaviour. */
85
85
  sendGossipUpdate: (extensions?: Record<string, unknown>) => Promise<void>;
86
+ /** Sends one core/data frame (data-have, data-request, or data-entries) directly over this session's own connection, never relay-wrapped -- the transport half of an application's own noticeboard replication policy (data-sync.ts owns what the frames MEAN; this owns getting one onto the wire), the same layering sendRevocationAnnounce already established for its own frame kind. Rejects when not connected, exactly like every other send method here. */
87
+ sendDataFrame: (frame: DataHaveFrame | DataRequestFrame | DataEntriesFrame) => Promise<void>;
86
88
  /** Sends a manage-request and resolves with the matching manage-response's outcome, correlated by request-id. When targetDevice is given, the request is routed to that specific peer via an established relay-connect pairing (wrapped as relay-data) rather than sent directly over this session's own Connection -- relay-hub deliberately drops manage-request/manage-response frames sent to it directly, since routing between two connected peers is not the relay role's business, so a specific peer reachable only through a relay hub can only be addressed this way. Absent, this sends directly over the Connection exactly as before. When token is given, it is attached to this one request instead of whatever setToken last set -- a single session routinely needs a different token per request when its peer shares more than one scope with this side (e.g. several core/room memberships over one connection), and a session-global token can only ever be correct for one of them. Absent, this request carries setToken's own session-global token exactly as before. When timeoutMs is given, the returned promise resolves with `{ result: "error", code: "timeout" }` rather than hanging forever if no manage-response arrives in time -- a held-open request (a human approval, a not-yet-online peer) otherwise has no way for the caller to give up on it. Absent, this request waits exactly as before, with no time limit of its own. */
87
89
  sendManageRequest: (command: ManageCommand, scope: Readonly<CapabilityScope>, targetDevice?: DeviceId, token?: CapabilityToken, timeoutMs?: number) => Promise<ManageOutcome>;
88
90
  close: () => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { D as DeviceId, N as Frame, Q as PeerAdvert, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken } from "../protocol-gbXtNeOc.mjs";
1
+ import { D as DeviceId, E as DataRequestFrame, N as Frame, Q as PeerAdvert, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-gbXtNeOc.mjs";
2
2
  import { t as IdentityPort } from "../identity-CIb9dGkJ.mjs";
3
3
  import { t as Clock } from "../clock-DiSx-WKM.mjs";
4
4
  import { r as Transport, t as Connection } from "../transport-Dy4h2eNY.mjs";
@@ -83,6 +83,8 @@ export interface MeshSession {
83
83
  sendRevocationAnnounce: (entries: readonly RevocationEntry[]) => Promise<void>;
84
84
  /** Re-sends this side's own self-advert with a fresh snapshot-seconds and, when given, extensions merged onto peer-advert's own open `* tstr => any` tail -- the mechanism a caller uses to keep gossiped presence status (or any other advertised fact) live over a connection's lifetime, since the initial self-advert wireUpConnection sends at connect time is otherwise never repeated. Callers own their own re-advertisement cadence (there is no timer inside MeshSession itself, matching its own DOM-free, fully unit-testable design); a caller not calling this again after connecting is exactly today's existing gossip-once-on-connect behaviour. */
85
85
  sendGossipUpdate: (extensions?: Record<string, unknown>) => Promise<void>;
86
+ /** Sends one core/data frame (data-have, data-request, or data-entries) directly over this session's own connection, never relay-wrapped -- the transport half of an application's own noticeboard replication policy (data-sync.ts owns what the frames MEAN; this owns getting one onto the wire), the same layering sendRevocationAnnounce already established for its own frame kind. Rejects when not connected, exactly like every other send method here. */
87
+ sendDataFrame: (frame: DataHaveFrame | DataRequestFrame | DataEntriesFrame) => Promise<void>;
86
88
  /** Sends a manage-request and resolves with the matching manage-response's outcome, correlated by request-id. When targetDevice is given, the request is routed to that specific peer via an established relay-connect pairing (wrapped as relay-data) rather than sent directly over this session's own Connection -- relay-hub deliberately drops manage-request/manage-response frames sent to it directly, since routing between two connected peers is not the relay role's business, so a specific peer reachable only through a relay hub can only be addressed this way. Absent, this sends directly over the Connection exactly as before. When token is given, it is attached to this one request instead of whatever setToken last set -- a single session routinely needs a different token per request when its peer shares more than one scope with this side (e.g. several core/room memberships over one connection), and a session-global token can only ever be correct for one of them. Absent, this request carries setToken's own session-global token exactly as before. When timeoutMs is given, the returned promise resolves with `{ result: "error", code: "timeout" }` rather than hanging forever if no manage-response arrives in time -- a held-open request (a human approval, a not-yet-online peer) otherwise has no way for the caller to give up on it. Absent, this request waits exactly as before, with no time limit of its own. */
87
89
  sendManageRequest: (command: ManageCommand, scope: Readonly<CapabilityScope>, targetDevice?: DeviceId, token?: CapabilityToken, timeoutMs?: number) => Promise<ManageOutcome>;
88
90
  close: () => Promise<void>;
@@ -429,6 +429,15 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
429
429
  await transmit(frame, false);
430
430
  emit();
431
431
  },
432
+ async sendDataFrame(frame) {
433
+ if (connection === null || state.status !== "connected") throw new Error("not connected");
434
+ frameLog.push({
435
+ direction: "sent",
436
+ frame
437
+ });
438
+ await transmit(frame, false);
439
+ emit();
440
+ },
432
441
  async close() {
433
442
  feedCancelled = true;
434
443
  if (handshakeTimer !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wire-mesh-core",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
6
6
  "repository": {