@net-mesh/browser 0.39.0 → 0.41.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.
package/dist/index.d.ts CHANGED
@@ -36,3 +36,12 @@ export { rememberedIdentity, DEFAULT_IDENTITY_KEY } from './identity.js';
36
36
  export type { IdentitySecrets } from './identity.js';
37
37
  export { requestCredential, CredentialRequestError } from './credential.js';
38
38
  export type { AnchorCredential, CredentialRequestErrorKind, RequestCredentialOptions, } from './credential.js';
39
+ export { ORG_SINK_BUDGET_REFUSAL, ORG_UPLOAD_SINK_BUDGET_REFUSAL, ORG_UPLOAD_SINK_CLOSED_REFUSAL, } from './errors.js';
40
+ export { clientStreamOrgTrampoline, duplexOrgTrampoline, streamingOrgTrampoline, unaryOrgTrampoline, } from './org.js';
41
+ export { acceptPeer, connectPeer, driveAttempt, handshakePeer, NO_ANNOUNCEMENT_PREFIX, NO_LIVE_ATTEMPT_PREFIX, NO_OFFER_PREFIX, PEER_OFFER_WAIT_MS, PEER_TICK_MS, PeerAttempts, REPLACED_ATTEMPT_MARKER, } from './peer-driver.js';
42
+ export type { HealthyDialog, PeerPrimitives, } from './peer-driver.js';
43
+ export { StreamIdentityError, } from './stream.js';
44
+ export type { StreamIdentity, } from './stream.js';
45
+ export { STUN_NO_RESPONSE_CODE, } from './udp-probe.js';
46
+ export { idArg, } from './wasm.js';
47
+ export type { LeafWasmOrgAccess, LeafWasmOrgByteItem, LeafWasmOrgByteStreamHandle, LeafWasmOrgCaller, LeafWasmOrgCallOptions, LeafWasmOrgClientStreamHandler, LeafWasmOrgCredentials, LeafWasmOrgDuplexCallHandle, LeafWasmOrgDuplexHandler, LeafWasmOrgRequestItem, LeafWasmOrgRequestStreamHandle, LeafWasmOrgResponseSinkHandle, LeafWasmOrgServeHandle, LeafWasmOrgServeOptions, LeafWasmOrgStreamingHandler, LeafWasmOrgTerminalError, LeafWasmOrgUnaryHandler, LeafWasmOrgUploadCallHandle, } from './wasm.js';
package/dist/index.js CHANGED
@@ -44,3 +44,12 @@ export * from './lobby.js';
44
44
  export { rememberedIdentity, DEFAULT_IDENTITY_KEY } from './identity.js';
45
45
  // Anonymous visitor credentials from a game anchor.
46
46
  export { requestCredential, CredentialRequestError } from './credential.js';
47
+ // The rest of the public module surface: lower-level building blocks
48
+ // the high-level verbs above are made of, exported so callers can
49
+ // compose their own.
50
+ export { ORG_SINK_BUDGET_REFUSAL, ORG_UPLOAD_SINK_BUDGET_REFUSAL, ORG_UPLOAD_SINK_CLOSED_REFUSAL, } from './errors.js';
51
+ export { clientStreamOrgTrampoline, duplexOrgTrampoline, streamingOrgTrampoline, unaryOrgTrampoline, } from './org.js';
52
+ export { acceptPeer, connectPeer, driveAttempt, handshakePeer, NO_ANNOUNCEMENT_PREFIX, NO_LIVE_ATTEMPT_PREFIX, NO_OFFER_PREFIX, PEER_OFFER_WAIT_MS, PEER_TICK_MS, PeerAttempts, REPLACED_ATTEMPT_MARKER, } from './peer-driver.js';
53
+ export { StreamIdentityError, } from './stream.js';
54
+ export { STUN_NO_RESPONSE_CODE, } from './udp-probe.js';
55
+ export { idArg, } from './wasm.js';
@@ -9,6 +9,6 @@
9
9
  export { MeshSession, openSession } from './session.js';
10
10
  export type { SessionOptions, SessionRole } from './session.js';
11
11
  export { isLifecycleEvent, parseSessionEvent } from './events.js';
12
- export type { GenerationFencedEvent, LeaderChangedEvent, LeaderLostEvent, NotLeaderEvent, SessionEvent, SessionEventOf, SessionLifecycleEvent, SubscriptionRestoredEvent, } from './events.js';
12
+ export type { GenerationFencedEvent, LeaderChangedEvent, LeaderLostEvent, NotLeaderEvent, PromotionFailedEvent, SessionEvent, SessionEventOf, SessionLifecycleEvent, SubscriptionRestoredEvent, } from './events.js';
13
13
  export { asSessionModule } from './wasm.js';
14
14
  export type { LeafWasmSession, LeafWasmSessionModule, LeafWasmSessionOptions, } from './wasm.js';
@@ -72,13 +72,6 @@ export class LeafNode {
72
72
  * a silent retry.
73
73
  */
74
74
  call(service: string, payload: Uint8Array, timeout_ms?: number | null): Promise<Uint8Array>;
75
- /**
76
- * One org-scoped client-streaming call. `send` pushes items,
77
- * `finish` half-closes and resolves the response body. See
78
- * [`Self::call_org`] for the deadline, suspension and closure
79
- * contract.
80
- */
81
- call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
82
75
  /**
83
76
  * One org-scoped unary call.
84
77
  *
@@ -97,6 +90,13 @@ export class LeafNode {
97
90
  * fail typed.
98
91
  */
99
92
  call_org(service: string, payload: Uint8Array, opts: any): Promise<Uint8Array>;
93
+ /**
94
+ * One org-scoped client-streaming call. `send` pushes items,
95
+ * `finish` half-closes and resolves the response body. See
96
+ * [`Self::call_org`] for the deadline, suspension and closure
97
+ * contract.
98
+ */
99
+ call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
100
100
  /**
101
101
  * One org-scoped duplex call. See [`Self::call_org`] for the
102
102
  * deadline, suspension and closure contract.
@@ -521,13 +521,6 @@ export class LeafNode {
521
521
  * zeros.
522
522
  */
523
523
  rtc_stats_json(): string;
524
- /**
525
- * Serve one org-scoped client-streaming service:
526
- * `handler(caller, requests)` resolves the response body. See
527
- * [`Self::serve_org`] for the handler-drop contract and the
528
- * close semantics.
529
- */
530
- serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
531
524
  /**
532
525
  * Serve one org-scoped unary service: `handler(caller, request)`
533
526
  * resolves the response body.
@@ -548,6 +541,13 @@ export class LeafNode {
548
541
  * openings (C9's protected split).
549
542
  */
550
543
  serve_org(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
544
+ /**
545
+ * Serve one org-scoped client-streaming service:
546
+ * `handler(caller, requests)` resolves the response body. See
547
+ * [`Self::serve_org`] for the handler-drop contract and the
548
+ * close semantics.
549
+ */
550
+ serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
551
551
  /**
552
552
  * Serve one org-scoped duplex service:
553
553
  * `handler(caller, requests, sink)` pulls requests and pushes
@@ -786,11 +786,6 @@ export class MeshSession {
786
786
  * Call an nRPC service.
787
787
  */
788
788
  call(service: string, payload: Uint8Array, timeout_ms?: number | null): Promise<Uint8Array>;
789
- /**
790
- * One org-scoped client-streaming call through the shared
791
- * session. See [`Self::call_org`] for the contract.
792
- */
793
- call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
794
789
  /**
795
790
  * One org-scoped unary call through the shared session.
796
791
  *
@@ -805,6 +800,11 @@ export class MeshSession {
805
800
  * refuses rather than addressing a successor's call.
806
801
  */
807
802
  call_org(service: string, payload: Uint8Array, opts: any): Promise<Uint8Array>;
803
+ /**
804
+ * One org-scoped client-streaming call through the shared
805
+ * session. See [`Self::call_org`] for the contract.
806
+ */
807
+ call_org_client_stream(service: string, opts: any): Promise<OrgUploadCallHandle>;
808
808
  /**
809
809
  * One org-scoped duplex call through the shared session. See
810
810
  * [`Self::call_org`] for the contract.
@@ -942,12 +942,6 @@ export class MeshSession {
942
942
  * The lock and channel name.
943
943
  */
944
944
  scope(): string;
945
- /**
946
- * Serve one org-scoped client-streaming service through the
947
- * shared session. See [`Self::serve_org`] for the handler-drop
948
- * contract and the close semantics.
949
- */
950
- serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
951
945
  /**
952
946
  * Serve one org-scoped unary service through the shared
953
947
  * session: `handler(caller, request)` resolves the response
@@ -968,6 +962,12 @@ export class MeshSession {
968
962
  * new openings (C9's protected split).
969
963
  */
970
964
  serve_org(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
965
+ /**
966
+ * Serve one org-scoped client-streaming service through the
967
+ * shared session. See [`Self::serve_org`] for the handler-drop
968
+ * contract and the close semantics.
969
+ */
970
+ serve_org_client_stream(service: string, access: string, handler: Function, opts: any): OrgServeHandle;
971
971
  /**
972
972
  * Serve one org-scoped duplex service through the shared
973
973
  * session. See [`Self::serve_org`] for the handler-drop
@@ -1453,8 +1453,8 @@ export interface InitOutput {
1453
1453
  readonly proxystream_send: (a: number, b: number) => number;
1454
1454
  readonly proxystream_stream_id_hex: (a: number, b: number) => void;
1455
1455
  readonly start: () => void;
1456
- readonly __wasm_bindgen_func_elem_6509: (a: number, b: number, c: number, d: number) => void;
1457
- readonly __wasm_bindgen_func_elem_6511: (a: number, b: number, c: number, d: number) => void;
1456
+ readonly __wasm_bindgen_func_elem_6504: (a: number, b: number, c: number, d: number) => void;
1457
+ readonly __wasm_bindgen_func_elem_6506: (a: number, b: number, c: number, d: number) => void;
1458
1458
  readonly __wasm_bindgen_func_elem_2365: (a: number, b: number, c: number) => number;
1459
1459
  readonly __wasm_bindgen_func_elem_2366: (a: number, b: number, c: number) => void;
1460
1460
  readonly __wasm_bindgen_func_elem_2366_112: (a: number, b: number, c: number) => void;
package/dist/net_leaf.js CHANGED
@@ -146,21 +146,6 @@ export class LeafNode {
146
146
  const ret = wasm.leafnode_call(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
147
147
  return takeObject(ret);
148
148
  }
149
- /**
150
- * One org-scoped client-streaming call. `send` pushes items,
151
- * `finish` half-closes and resolves the response body. See
152
- * [`Self::call_org`] for the deadline, suspension and closure
153
- * contract.
154
- * @param {string} service
155
- * @param {any} opts
156
- * @returns {Promise<OrgUploadCallHandle>}
157
- */
158
- call_org_client_stream(service, opts) {
159
- const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
- const len0 = WASM_VECTOR_LEN;
161
- const ret = wasm.leafnode_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
162
- return takeObject(ret);
163
- }
164
149
  /**
165
150
  * One org-scoped unary call.
166
151
  *
@@ -188,6 +173,21 @@ export class LeafNode {
188
173
  const ret = wasm.leafnode_call_org(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), addHeapObject(opts));
189
174
  return takeObject(ret);
190
175
  }
176
+ /**
177
+ * One org-scoped client-streaming call. `send` pushes items,
178
+ * `finish` half-closes and resolves the response body. See
179
+ * [`Self::call_org`] for the deadline, suspension and closure
180
+ * contract.
181
+ * @param {string} service
182
+ * @param {any} opts
183
+ * @returns {Promise<OrgUploadCallHandle>}
184
+ */
185
+ call_org_client_stream(service, opts) {
186
+ const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
187
+ const len0 = WASM_VECTOR_LEN;
188
+ const ret = wasm.leafnode_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
189
+ return takeObject(ret);
190
+ }
191
191
  /**
192
192
  * One org-scoped duplex call. See [`Self::call_org`] for the
193
193
  * deadline, suspension and closure contract.
@@ -915,24 +915,37 @@ export class LeafNode {
915
915
  }
916
916
  }
917
917
  /**
918
- * Serve one org-scoped client-streaming service:
919
- * `handler(caller, requests)` resolves the response body. See
920
- * [`Self::serve_org`] for the handler-drop contract and the
921
- * close semantics.
918
+ * Serve one org-scoped unary service: `handler(caller, request)`
919
+ * resolves the response body.
920
+ *
921
+ * # The handler-drop contract (F-S3.1-2)
922
+ *
923
+ * The retire supervisor may drop the handler future without a
924
+ * final poll — cancellation is observed through the retirement
925
+ * observables (the terminal item, the sink's typed closed
926
+ * refusal, and `retired`), never assumed as a handler-side
927
+ * event; a detached observer holding `retired` observes the
928
+ * signal. After retirement the handler sees typed refusals and
929
+ * its return value is discarded — the terminal was already
930
+ * sent.
931
+ *
932
+ * Closing the returned handle retires this registration's live
933
+ * protected calls with their exact terminals and refuses new
934
+ * openings (C9's protected split).
922
935
  * @param {string} service
923
936
  * @param {string} access
924
937
  * @param {Function} handler
925
938
  * @param {any} opts
926
939
  * @returns {OrgServeHandle}
927
940
  */
928
- serve_org_client_stream(service, access, handler, opts) {
941
+ serve_org(service, access, handler, opts) {
929
942
  try {
930
943
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
931
944
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
932
945
  const len0 = WASM_VECTOR_LEN;
933
946
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
934
947
  const len1 = WASM_VECTOR_LEN;
935
- wasm.leafnode_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
948
+ wasm.leafnode_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
936
949
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
937
950
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
938
951
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -945,37 +958,24 @@ export class LeafNode {
945
958
  }
946
959
  }
947
960
  /**
948
- * Serve one org-scoped unary service: `handler(caller, request)`
949
- * resolves the response body.
950
- *
951
- * # The handler-drop contract (F-S3.1-2)
952
- *
953
- * The retire supervisor may drop the handler future without a
954
- * final poll — cancellation is observed through the retirement
955
- * observables (the terminal item, the sink's typed closed
956
- * refusal, and `retired`), never assumed as a handler-side
957
- * event; a detached observer holding `retired` observes the
958
- * signal. After retirement the handler sees typed refusals and
959
- * its return value is discarded — the terminal was already
960
- * sent.
961
- *
962
- * Closing the returned handle retires this registration's live
963
- * protected calls with their exact terminals and refuses new
964
- * openings (C9's protected split).
961
+ * Serve one org-scoped client-streaming service:
962
+ * `handler(caller, requests)` resolves the response body. See
963
+ * [`Self::serve_org`] for the handler-drop contract and the
964
+ * close semantics.
965
965
  * @param {string} service
966
966
  * @param {string} access
967
967
  * @param {Function} handler
968
968
  * @param {any} opts
969
969
  * @returns {OrgServeHandle}
970
970
  */
971
- serve_org(service, access, handler, opts) {
971
+ serve_org_client_stream(service, access, handler, opts) {
972
972
  try {
973
973
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
974
974
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
975
975
  const len0 = WASM_VECTOR_LEN;
976
976
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
977
977
  const len1 = WASM_VECTOR_LEN;
978
- wasm.leafnode_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
978
+ wasm.leafnode_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
979
979
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
980
980
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
981
981
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1434,19 +1434,6 @@ export class MeshSession {
1434
1434
  const ret = wasm.meshsession_call(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
1435
1435
  return takeObject(ret);
1436
1436
  }
1437
- /**
1438
- * One org-scoped client-streaming call through the shared
1439
- * session. See [`Self::call_org`] for the contract.
1440
- * @param {string} service
1441
- * @param {any} opts
1442
- * @returns {Promise<OrgUploadCallHandle>}
1443
- */
1444
- call_org_client_stream(service, opts) {
1445
- const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1446
- const len0 = WASM_VECTOR_LEN;
1447
- const ret = wasm.meshsession_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
1448
- return takeObject(ret);
1449
- }
1450
1437
  /**
1451
1438
  * One org-scoped unary call through the shared session.
1452
1439
  *
@@ -1470,6 +1457,19 @@ export class MeshSession {
1470
1457
  const ret = wasm.meshsession_call_org(this.__wbg_ptr, ptr0, len0, addHeapObject(payload), addHeapObject(opts));
1471
1458
  return takeObject(ret);
1472
1459
  }
1460
+ /**
1461
+ * One org-scoped client-streaming call through the shared
1462
+ * session. See [`Self::call_org`] for the contract.
1463
+ * @param {string} service
1464
+ * @param {any} opts
1465
+ * @returns {Promise<OrgUploadCallHandle>}
1466
+ */
1467
+ call_org_client_stream(service, opts) {
1468
+ const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1469
+ const len0 = WASM_VECTOR_LEN;
1470
+ const ret = wasm.meshsession_call_org_client_stream(this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
1471
+ return takeObject(ret);
1472
+ }
1473
1473
  /**
1474
1474
  * One org-scoped duplex call through the shared session. See
1475
1475
  * [`Self::call_org`] for the contract.
@@ -1799,23 +1799,37 @@ export class MeshSession {
1799
1799
  }
1800
1800
  }
1801
1801
  /**
1802
- * Serve one org-scoped client-streaming service through the
1803
- * shared session. See [`Self::serve_org`] for the handler-drop
1804
- * contract and the close semantics.
1802
+ * Serve one org-scoped unary service through the shared
1803
+ * session: `handler(caller, request)` resolves the response
1804
+ * body. The registration rides the proxy registry and its
1805
+ * inbound calls dispatch to THIS follower's handle and no other.
1806
+ *
1807
+ * # The handler-drop contract (F-S3.1-2)
1808
+ *
1809
+ * The retire supervisor may drop the handler future without a
1810
+ * final poll — cancellation is observed through the retirement
1811
+ * observables (the terminal item, the sink's typed closed
1812
+ * refusal, and `retired`), never assumed as a handler-side
1813
+ * event; a detached observer holding `retired` observes the
1814
+ * signal. After retirement the handler sees typed refusals and
1815
+ * its return value is discarded — the terminal was already
1816
+ * sent. Closing the returned handle retires this registration's
1817
+ * live protected calls with their exact terminals and refuses
1818
+ * new openings (C9's protected split).
1805
1819
  * @param {string} service
1806
1820
  * @param {string} access
1807
1821
  * @param {Function} handler
1808
1822
  * @param {any} opts
1809
1823
  * @returns {OrgServeHandle}
1810
1824
  */
1811
- serve_org_client_stream(service, access, handler, opts) {
1825
+ serve_org(service, access, handler, opts) {
1812
1826
  try {
1813
1827
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1814
1828
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1815
1829
  const len0 = WASM_VECTOR_LEN;
1816
1830
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1817
1831
  const len1 = WASM_VECTOR_LEN;
1818
- wasm.meshsession_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1832
+ wasm.meshsession_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1819
1833
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1820
1834
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1821
1835
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1828,37 +1842,23 @@ export class MeshSession {
1828
1842
  }
1829
1843
  }
1830
1844
  /**
1831
- * Serve one org-scoped unary service through the shared
1832
- * session: `handler(caller, request)` resolves the response
1833
- * body. The registration rides the proxy registry and its
1834
- * inbound calls dispatch to THIS follower's handle and no other.
1835
- *
1836
- * # The handler-drop contract (F-S3.1-2)
1837
- *
1838
- * The retire supervisor may drop the handler future without a
1839
- * final poll — cancellation is observed through the retirement
1840
- * observables (the terminal item, the sink's typed closed
1841
- * refusal, and `retired`), never assumed as a handler-side
1842
- * event; a detached observer holding `retired` observes the
1843
- * signal. After retirement the handler sees typed refusals and
1844
- * its return value is discarded — the terminal was already
1845
- * sent. Closing the returned handle retires this registration's
1846
- * live protected calls with their exact terminals and refuses
1847
- * new openings (C9's protected split).
1845
+ * Serve one org-scoped client-streaming service through the
1846
+ * shared session. See [`Self::serve_org`] for the handler-drop
1847
+ * contract and the close semantics.
1848
1848
  * @param {string} service
1849
1849
  * @param {string} access
1850
1850
  * @param {Function} handler
1851
1851
  * @param {any} opts
1852
1852
  * @returns {OrgServeHandle}
1853
1853
  */
1854
- serve_org(service, access, handler, opts) {
1854
+ serve_org_client_stream(service, access, handler, opts) {
1855
1855
  try {
1856
1856
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1857
1857
  const ptr0 = passStringToWasm0(service, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1858
1858
  const len0 = WASM_VECTOR_LEN;
1859
1859
  const ptr1 = passStringToWasm0(access, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1860
1860
  const len1 = WASM_VECTOR_LEN;
1861
- wasm.meshsession_serve_org(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1861
+ wasm.meshsession_serve_org_client_stream(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(handler), addHeapObject(opts));
1862
1862
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1863
1863
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1864
1864
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2714,13 +2714,13 @@ function __wbg_get_imports() {
2714
2714
  const ret = getObject(arg0).errorCode;
2715
2715
  return ret;
2716
2716
  },
2717
+ __wbg_error_25ec685a8c675bef: function(arg0, arg1) {
2718
+ console.error(getStringFromWasm0(arg0, arg1));
2719
+ },
2717
2720
  __wbg_error_3da0c81bd4184d52: function(arg0) {
2718
2721
  const ret = getObject(arg0).error;
2719
2722
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
2720
2723
  },
2721
- __wbg_error_68609ef5ca157ced: function(arg0, arg1) {
2722
- console.error(getStringFromWasm0(arg0, arg1));
2723
- },
2724
2724
  __wbg_error_6a23b57453026a47: function() { return handleError(function (arg0) {
2725
2725
  const ret = getObject(arg0).error;
2726
2726
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -2914,7 +2914,7 @@ function __wbg_get_imports() {
2914
2914
  const a = state0.a;
2915
2915
  state0.a = 0;
2916
2916
  try {
2917
- return __wasm_bindgen_func_elem_6511(a, state0.b, arg0, arg1);
2917
+ return __wasm_bindgen_func_elem_6506(a, state0.b, arg0, arg1);
2918
2918
  } finally {
2919
2919
  state0.a = a;
2920
2920
  }
@@ -2956,7 +2956,7 @@ function __wbg_get_imports() {
2956
2956
  const a = state0.a;
2957
2957
  state0.a = 0;
2958
2958
  try {
2959
- return __wasm_bindgen_func_elem_6511(a, state0.b, arg0, arg1);
2959
+ return __wasm_bindgen_func_elem_6506(a, state0.b, arg0, arg1);
2960
2960
  } finally {
2961
2961
  state0.a = a;
2962
2962
  }
@@ -3275,8 +3275,8 @@ function __wbg_get_imports() {
3275
3275
  return addHeapObject(ret);
3276
3276
  },
3277
3277
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
3278
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 867, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3279
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6509);
3278
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 868, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3279
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6504);
3280
3280
  return addHeapObject(ret);
3281
3281
  },
3282
3282
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
@@ -3366,14 +3366,14 @@ function __wasm_bindgen_func_elem_2365(arg0, arg1, arg2) {
3366
3366
  return takeObject(ret);
3367
3367
  }
3368
3368
 
3369
- function __wasm_bindgen_func_elem_6511(arg0, arg1, arg2, arg3) {
3370
- wasm.__wasm_bindgen_func_elem_6511(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3369
+ function __wasm_bindgen_func_elem_6506(arg0, arg1, arg2, arg3) {
3370
+ wasm.__wasm_bindgen_func_elem_6506(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3371
3371
  }
3372
3372
 
3373
- function __wasm_bindgen_func_elem_6509(arg0, arg1, arg2) {
3373
+ function __wasm_bindgen_func_elem_6504(arg0, arg1, arg2) {
3374
3374
  try {
3375
3375
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3376
- wasm.__wasm_bindgen_func_elem_6509(retptr, arg0, arg1, addHeapObject(arg2));
3376
+ wasm.__wasm_bindgen_func_elem_6504(retptr, arg0, arg1, addHeapObject(arg2));
3377
3377
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3378
3378
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3379
3379
  if (r1) {
Binary file
@@ -119,8 +119,8 @@ export const proxystream_peer_node_hex: (a: number, b: number) => void;
119
119
  export const proxystream_send: (a: number, b: number) => number;
120
120
  export const proxystream_stream_id_hex: (a: number, b: number) => void;
121
121
  export const start: () => void;
122
- export const __wasm_bindgen_func_elem_6509: (a: number, b: number, c: number, d: number) => void;
123
- export const __wasm_bindgen_func_elem_6511: (a: number, b: number, c: number, d: number) => void;
122
+ export const __wasm_bindgen_func_elem_6504: (a: number, b: number, c: number, d: number) => void;
123
+ export const __wasm_bindgen_func_elem_6506: (a: number, b: number, c: number, d: number) => void;
124
124
  export const __wasm_bindgen_func_elem_2365: (a: number, b: number, c: number) => number;
125
125
  export const __wasm_bindgen_func_elem_2366: (a: number, b: number, c: number) => void;
126
126
  export const __wasm_bindgen_func_elem_2366_112: (a: number, b: number, c: number) => void;
@@ -17,3 +17,6 @@ export type { ClockEstimate, Millis } from './clock.js';
17
17
  export { SnapshotBuffer, lerpNumbers, SNAPSHOT_BUFFER } from './interpolate.js';
18
18
  export type { Interpolator, TimedSnapshot } from './interpolate.js';
19
19
  export type { NetcodeStream, NetcodeTransport } from './wire.js';
20
+ export { snapshotFrames, } from './host.js';
21
+ export { chunkOf, decodeFrame, defaultNow, encodeFrame, eventPeer, MAX_NETCODE_INTEREST_KEY_LENGTH, MAX_NETCODE_INTEREST_KEYS, MAX_SNAPSHOT_CHUNKS, peerHex, } from './wire.js';
22
+ export type { Frame, Now, WireInput, } from './wire.js';
@@ -12,3 +12,7 @@ export { hostNetcode } from './host.js';
12
12
  export { joinNetcode } from './client.js';
13
13
  export { ClockEstimator, CLOCK_WINDOW } from './clock.js';
14
14
  export { SnapshotBuffer, lerpNumbers, SNAPSHOT_BUFFER } from './interpolate.js';
15
+ // The netcode wire format and its helpers, exported so callers can
16
+ // build their own transports and tooling on the same frames.
17
+ export { snapshotFrames, } from './host.js';
18
+ export { chunkOf, decodeFrame, defaultNow, encodeFrame, eventPeer, MAX_NETCODE_INTEREST_KEY_LENGTH, MAX_NETCODE_INTEREST_KEYS, MAX_SNAPSHOT_CHUNKS, peerHex, } from './wire.js';
@@ -115,7 +115,8 @@ export interface StoreTransport {
115
115
  connectPeer?(peerHex: string): Promise<unknown>;
116
116
  }
117
117
  /**
118
- * A peer id in the spelling `openStream` takes: 16 lowercase hex.
118
+ * The peer ON AN EVENT, in the spelling `openStream` takes: 16
119
+ * lowercase hex. For an id the caller holds, see {@link nodeHexOf}.
119
120
  *
120
121
  * Events carry the authenticated peer as an EXACT DECIMAL string, and
121
122
  * `openStream({ peer })` requires 16 hex digits. Handing the decimal
@@ -126,8 +127,23 @@ export interface StoreTransport {
126
127
  * reconciliation for the store's own seam.
127
128
  */
128
129
  export declare function peerHexOf(peer: string): string | null;
129
- /** Whether two peer spellings name the same node. */
130
- export declare function samePeer(left: string, right: string): boolean;
130
+ /**
131
+ * A node id the CALLER holds, in the same spelling: 16 lowercase hex.
132
+ *
133
+ * Not {@link peerHexOf}, which reads an event's peer and takes digits
134
+ * to mean decimal. An id a caller holds is nearly always one this
135
+ * package printed — `nodeIdHex()`, a descriptor's `peerIdHex`, a
136
+ * lobby's `host` — and one such id in ~1,800 has no letter in it. Read
137
+ * as decimal it names a DIFFERENT node: a joiner addressed its host
138
+ * 4798628394172323 as 00110c53bcd7ffa3, and nothing was there. So
139
+ * sixteen hex digits are hex, whatever they are made of.
140
+ *
141
+ * Any other length is read as {@link peerHexOf} reads it, so an app
142
+ * may still hand back the decimal `peerNode` an event gave it. A
143
+ * decimal exactly sixteen digits long is the one spelling that cannot
144
+ * be told from the canonical hex, and it is read as hex.
145
+ */
146
+ export declare function nodeHexOf(id: string): string | null;
131
147
  /**
132
148
  * How a host decides what each replica sees: exactly one of these.
133
149
  *
@@ -50,7 +50,8 @@ export const HOST_SWEEP_MS = 5_000;
50
50
  */
51
51
  export const FAREWELL_DEADLINE_MS = 500;
52
52
  /**
53
- * A peer id in the spelling `openStream` takes: 16 lowercase hex.
53
+ * The peer ON AN EVENT, in the spelling `openStream` takes: 16
54
+ * lowercase hex. For an id the caller holds, see {@link nodeHexOf}.
54
55
  *
55
56
  * Events carry the authenticated peer as an EXACT DECIMAL string, and
56
57
  * `openStream({ peer })` requires 16 hex digits. Handing the decimal
@@ -74,11 +75,24 @@ export function peerHexOf(peer) {
74
75
  }
75
76
  return null;
76
77
  }
77
- /** Whether two peer spellings name the same node. */
78
- export function samePeer(left, right) {
79
- const a = peerHexOf(left);
80
- const b = peerHexOf(right);
81
- return a !== null && a === b;
78
+ /**
79
+ * A node id the CALLER holds, in the same spelling: 16 lowercase hex.
80
+ *
81
+ * Not {@link peerHexOf}, which reads an event's peer and takes digits
82
+ * to mean decimal. An id a caller holds is nearly always one this
83
+ * package printed — `nodeIdHex()`, a descriptor's `peerIdHex`, a
84
+ * lobby's `host` — and one such id in ~1,800 has no letter in it. Read
85
+ * as decimal it names a DIFFERENT node: a joiner addressed its host
86
+ * 4798628394172323 as 00110c53bcd7ffa3, and nothing was there. So
87
+ * sixteen hex digits are hex, whatever they are made of.
88
+ *
89
+ * Any other length is read as {@link peerHexOf} reads it, so an app
90
+ * may still hand back the decimal `peerNode` an event gave it. A
91
+ * decimal exactly sixteen digits long is the one spelling that cannot
92
+ * be told from the canonical hex, and it is read as hex.
93
+ */
94
+ export function nodeHexOf(id) {
95
+ return /^[0-9a-f]{16}$/i.test(id) ? id.toLowerCase() : peerHexOf(id);
82
96
  }
83
97
  /**
84
98
  * The store addresses live on each transport.
@@ -663,7 +677,7 @@ export function hostStore(options) {
663
677
  owner: owner,
664
678
  // The spelling `AccessRequest.peer` and `ActionContext.peer`
665
679
  // promise: 16 lowercase hex, as a replica's frames are handed.
666
- peer: peerHexOf(authority) ?? authority,
680
+ peer: nodeHexOf(authority) ?? authority,
667
681
  maxEventBytes: options.maxEventBytes,
668
682
  dispatched,
669
683
  isClosed: () => closed,
@@ -48,3 +48,26 @@ export type { Hidden, Visibility, VisibilityPreset, VisibilityRule, VisibilityRu
48
48
  export { cellKey, cellsAround, sameCells, stickyCells } from './interest.js';
49
49
  export type { CellOptions } from './interest.js';
50
50
  export { MAX_INTEREST_KEYS, MAX_INTEREST_KEY_BYTES } from './wire.js';
51
+ export { Assembly, ASSEMBLY_DEADLINE_MS, AssemblyTable, MAX_ASSEMBLY_BYTES_TOTAL, } from './assembly.js';
52
+ export type { AssemblyChunk, AssemblyManifest, AssemblyRefusal, AssemblyRejected, ChunkOutcome, } from './assembly.js';
53
+ export { assertChunkingFits, base64, chunkBytesFor, chunkSnapshot, fromBase64, jsonByteLength, LARGEST_FROZEN_ENVELOPE, MIN_CHUNK_BYTES, SNAP_ENVELOPE_RESERVE, } from './chunker.js';
54
+ export type { Chunked, } from './chunker.js';
55
+ export { isEntityMap, } from './definition.js';
56
+ export { isStaleStream, STORE_ERROR_CODES, } from './errors.js';
57
+ export { FAREWELL_DEADLINE_MS, hostInternals, nodeHexOf, peerHexOf, } from './host.js';
58
+ export type { HostInternals, } from './host.js';
59
+ export { TICK_INTERVAL_MS, TRANSITION_DEADLINE_MS, } from './join.js';
60
+ export { MAX_JSON_DEPTH, parseStoreJson, } from './json.js';
61
+ export type { JsonFailure, JsonObject, JsonRefusal, JsonResult, JsonValue, } from './json.js';
62
+ export { BINDING_INLINE_MAX_BYTES, canonicalBytes, canonicalRequest, digestBinding, HandleLedger, inlineBinding, InputSequences, LEDGER_MAX_AGE_MS, LEDGER_MAX_BYTES, LEDGER_MAX_ENTRIES, LedgerTable, MAX_SEQUENCE, needsDigest, } from './ledger.js';
63
+ export type { Disposition, Outcome, RequestBinding, } from './ledger.js';
64
+ export { HANDLE_LEASE_MS, MAX_HANDLES, MAX_PENDING_ACTIONS, StoreOwner, } from './owner.js';
65
+ export type { ActionHandlers, Dispatched, InputHandlers, Outbound, OwnerDeps, OwnerHandle, } from './owner.js';
66
+ export { applyPatch, FORBIDDEN_SEGMENTS, } from './patch.js';
67
+ export type { PatchApplied, PatchOutcome, PatchRefusal, PatchRejected, } from './patch.js';
68
+ export { MAX_JOIN_REASKS, StoreReplica, } from './replica.js';
69
+ export type { Received, ReplicaDeps, ReplicaState, Request, } from './replica.js';
70
+ export { applyVisibility, compileVisibility, } from './visibility.js';
71
+ export type { CompiledVisibility, } from './visibility.js';
72
+ export { CALLER_KINDS, decimalValue, decodeMessage, encodeMessage, HANDLE_HEX_LENGTH, inadmissibleValue, INCARNATION_HEX_LENGTH, isCanonicalBase64, isCanonicalDecimal, isCanonicalHex, MAX_AUDIENCE_LABEL_BYTES, MAX_AUDIENCE_LABELS, MAX_DECIMAL, MAX_DETAIL_BYTES, MAX_PATCH_OPS, MAX_PATH_SEGMENT_BYTES, MAX_PATH_SEGMENTS, MAX_SNAPSHOT_BYTES, MAX_SNAPSHOT_CHUNKS, OWNER_KINDS, REQUEST_HEX_LENGTH, utf8Length, WIRE_VERSION, } from './wire.js';
73
+ export type { ActMessage, AliveMessage, AudienceMessage, CallerKind, CallerMessage, Decimal, DecodeOptions, DecodeRefusal, DecodeResult, DecodeStage, DeltaMessage, Hex, InputMessage, InterestMessage, JoinMessage, LeaveMessage, ManifestMessage, MessageFor, MessageKind, NoMessage, OkMessage, OwnerKind, OwnerMessage, ResultMessage, ResumeMessage, ResyncMessage, Side, SnapMessage, StoreMessage, WireOp, } from './wire.js';
@@ -38,3 +38,19 @@ export { addItems, countItems, emptyInventory, hasItems, InventoryError, invento
38
38
  export { assertHidden, HIDDEN, hiddenOr, isHidden, projectVisible, } from './visibility.js';
39
39
  export { cellKey, cellsAround, sameCells, stickyCells } from './interest.js';
40
40
  export { MAX_INTEREST_KEYS, MAX_INTEREST_KEY_BYTES } from './wire.js';
41
+ // The store's lower-level building blocks — wire codec, ledgers,
42
+ // chunking, owner/replica cores — exported so callers can compose
43
+ // their own transports and tooling.
44
+ export { Assembly, ASSEMBLY_DEADLINE_MS, AssemblyTable, MAX_ASSEMBLY_BYTES_TOTAL, } from './assembly.js';
45
+ export { assertChunkingFits, base64, chunkBytesFor, chunkSnapshot, fromBase64, jsonByteLength, LARGEST_FROZEN_ENVELOPE, MIN_CHUNK_BYTES, SNAP_ENVELOPE_RESERVE, } from './chunker.js';
46
+ export { isEntityMap, } from './definition.js';
47
+ export { isStaleStream, STORE_ERROR_CODES, } from './errors.js';
48
+ export { FAREWELL_DEADLINE_MS, hostInternals, nodeHexOf, peerHexOf, } from './host.js';
49
+ export { TICK_INTERVAL_MS, TRANSITION_DEADLINE_MS, } from './join.js';
50
+ export { MAX_JSON_DEPTH, parseStoreJson, } from './json.js';
51
+ export { BINDING_INLINE_MAX_BYTES, canonicalBytes, canonicalRequest, digestBinding, HandleLedger, inlineBinding, InputSequences, LEDGER_MAX_AGE_MS, LEDGER_MAX_BYTES, LEDGER_MAX_ENTRIES, LedgerTable, MAX_SEQUENCE, needsDigest, } from './ledger.js';
52
+ export { HANDLE_LEASE_MS, MAX_HANDLES, MAX_PENDING_ACTIONS, StoreOwner, } from './owner.js';
53
+ export { applyPatch, FORBIDDEN_SEGMENTS, } from './patch.js';
54
+ export { MAX_JOIN_REASKS, StoreReplica, } from './replica.js';
55
+ export { applyVisibility, compileVisibility, } from './visibility.js';
56
+ export { CALLER_KINDS, decimalValue, decodeMessage, encodeMessage, HANDLE_HEX_LENGTH, inadmissibleValue, INCARNATION_HEX_LENGTH, isCanonicalBase64, isCanonicalDecimal, isCanonicalHex, MAX_AUDIENCE_LABEL_BYTES, MAX_AUDIENCE_LABELS, MAX_DECIMAL, MAX_DETAIL_BYTES, MAX_PATCH_OPS, MAX_PATH_SEGMENT_BYTES, MAX_PATH_SEGMENTS, MAX_SNAPSHOT_BYTES, MAX_SNAPSHOT_CHUNKS, OWNER_KINDS, REQUEST_HEX_LENGTH, utf8Length, WIRE_VERSION, } from './wire.js';