transport-io 0.0.1

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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/adapter.d.ts +69 -0
  4. package/dist/adapter.d.ts.map +1 -0
  5. package/dist/adapter.js +51 -0
  6. package/dist/adapter.js.map +1 -0
  7. package/dist/client.d.ts +60 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +162 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/codec.d.ts +5 -0
  12. package/dist/codec.d.ts.map +1 -0
  13. package/dist/codec.js +47 -0
  14. package/dist/codec.js.map +1 -0
  15. package/dist/contract.d.ts +79 -0
  16. package/dist/contract.d.ts.map +1 -0
  17. package/dist/contract.js +54 -0
  18. package/dist/contract.js.map +1 -0
  19. package/dist/datagram.d.ts +29 -0
  20. package/dist/datagram.d.ts.map +1 -0
  21. package/dist/datagram.js +92 -0
  22. package/dist/datagram.js.map +1 -0
  23. package/dist/errors.d.ts +8 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +11 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/framer.d.ts +21 -0
  28. package/dist/framer.d.ts.map +1 -0
  29. package/dist/framer.js +110 -0
  30. package/dist/framer.js.map +1 -0
  31. package/dist/handshake.d.ts +34 -0
  32. package/dist/handshake.d.ts.map +1 -0
  33. package/dist/handshake.js +79 -0
  34. package/dist/handshake.js.map +1 -0
  35. package/dist/hub.d.ts +43 -0
  36. package/dist/hub.d.ts.map +1 -0
  37. package/dist/hub.js +149 -0
  38. package/dist/hub.js.map +1 -0
  39. package/dist/index.d.ts +19 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +18 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/origin.d.ts +18 -0
  44. package/dist/origin.d.ts.map +1 -0
  45. package/dist/origin.js +72 -0
  46. package/dist/origin.js.map +1 -0
  47. package/dist/protocol.d.ts +79 -0
  48. package/dist/protocol.d.ts.map +1 -0
  49. package/dist/protocol.js +76 -0
  50. package/dist/protocol.js.map +1 -0
  51. package/dist/queue.d.ts +45 -0
  52. package/dist/queue.d.ts.map +1 -0
  53. package/dist/queue.js +94 -0
  54. package/dist/queue.js.map +1 -0
  55. package/dist/server.d.ts +45 -0
  56. package/dist/server.d.ts.map +1 -0
  57. package/dist/server.js +127 -0
  58. package/dist/server.js.map +1 -0
  59. package/dist/session.d.ts +94 -0
  60. package/dist/session.d.ts.map +1 -0
  61. package/dist/session.js +645 -0
  62. package/dist/session.js.map +1 -0
  63. package/dist/testing/hostile-adapter.d.ts +44 -0
  64. package/dist/testing/hostile-adapter.d.ts.map +1 -0
  65. package/dist/testing/hostile-adapter.js +116 -0
  66. package/dist/testing/hostile-adapter.js.map +1 -0
  67. package/dist/testing/index.d.ts +8 -0
  68. package/dist/testing/index.d.ts.map +1 -0
  69. package/dist/testing/index.js +8 -0
  70. package/dist/testing/index.js.map +1 -0
  71. package/dist/transport/browser.d.ts +8 -0
  72. package/dist/transport/browser.d.ts.map +1 -0
  73. package/dist/transport/browser.js +89 -0
  74. package/dist/transport/browser.js.map +1 -0
  75. package/dist/transport/fails.node.d.ts +33 -0
  76. package/dist/transport/fails.node.d.ts.map +1 -0
  77. package/dist/transport/fails.node.js +184 -0
  78. package/dist/transport/fails.node.js.map +1 -0
  79. package/dist/transport/loopback.d.ts +11 -0
  80. package/dist/transport/loopback.d.ts.map +1 -0
  81. package/dist/transport/loopback.js +98 -0
  82. package/dist/transport/loopback.js.map +1 -0
  83. package/dist/transport/moq.node.d.ts +19 -0
  84. package/dist/transport/moq.node.d.ts.map +1 -0
  85. package/dist/transport/moq.node.js +211 -0
  86. package/dist/transport/moq.node.js.map +1 -0
  87. package/dist/transport/parity-suite.d.ts +40 -0
  88. package/dist/transport/parity-suite.d.ts.map +1 -0
  89. package/dist/transport/parity-suite.js +133 -0
  90. package/dist/transport/parity-suite.js.map +1 -0
  91. package/dist/transport/types.d.ts +36 -0
  92. package/dist/transport/types.d.ts.map +1 -0
  93. package/dist/transport/types.js +2 -0
  94. package/dist/transport/types.js.map +1 -0
  95. package/dist/transport/unreliable.d.ts +37 -0
  96. package/dist/transport/unreliable.d.ts.map +1 -0
  97. package/dist/transport/unreliable.js +59 -0
  98. package/dist/transport/unreliable.js.map +1 -0
  99. package/package.json +55 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.js","sourceRoot":"","sources":["../src/hub.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAa7E,MAAM,OAAO,GAAG;IACL,QAAQ,CAAS;IACjB,MAAM,CAAY;IAClB,MAAM,GAAG,IAAI,GAAG,EAA+B,CAAA;IAC/C,UAAU,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC3C,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE1C,YAAY,OAAgB,EAAE,KAAiB;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,kFAAkF;QAClF,8EAA8E;QAC9E,iFAAiF;QACjF,iFAAiF;QACjF,qDAAqD;QACrD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM;gBAAE,OAAM;YAC7C,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC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AC,MAAM,EAAE,EAAE,CAAC;YACjC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;gBAAE,SAAQ;YACnC,IAAI,IAAI,KAAK,UAAU;gBAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;;gBACtD,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ export { type Adapter, type BroadcastOptions, type Frame as AdapterFrame, MemoryAdapter, type MemoryBus, memoryBus, type PeerId, type RemoteEnvelope, } from './adapter.ts';
2
+ export { Client, type ClientOptions, type ClientState, type Status } from './client.ts';
3
+ export { type AnyMap, type CallableOf, type Contract, defineContract, type EventDef, type EventShape, type Infer, type Lane, type MapOf, type Schema, type$, } from './contract.ts';
4
+ export { maxDatagramPayload } from './datagram.ts';
5
+ export { TransportError, type TransportErrorCode } from './errors.ts';
6
+ export { encodeFrame, type Frame, FrameDecoder, maxPayloadFor } from './framer.ts';
7
+ export { CloseCode, Codec, DATAGRAM_CONSERVATIVE_PAYLOAD_MAX, DATAGRAM_HEADER_BYTES, EVENT_ID_NOT_APPLICABLE, FrameType, MAX_CALL_PAYLOAD_BYTES, MAX_EMIT_PAYLOAD_BYTES, PROTOCOL_VERSION, ResetCode, STREAM_FRAME_OVERHEAD_BYTES, } from './protocol.ts';
8
+ export { createServer, type RoomTarget, Server, type ServerOptions, type ServerPeer, } from './server.ts';
9
+ export type { SessionStats } from './session.ts';
10
+ /**
11
+ * Hand-maintained and asserted against `package.json` by `index.test.ts`, because
12
+ * `isolatedDeclarations` forbids inferring it from an import and a version that drifts from
13
+ * its manifest is a lie in the one place a user checks first.
14
+ *
15
+ * `changeset version` moves the manifest, so this moves in the same commit — which the test
16
+ * enforces rather than trusting anyone to remember.
17
+ */
18
+ export declare const VERSION: string;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,KAAK,IAAI,YAAY,EAC1B,aAAa,EACb,KAAK,SAAS,EACd,SAAS,EACT,KAAK,MAAM,EAKX,KAAK,cAAc,GACpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,EACL,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GACN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EACL,SAAS,EACT,KAAK,EACL,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,2BAA2B,GAC5B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,MAAM,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ export { MemoryAdapter, memoryBus, } from './adapter.js';
2
+ export { Client } from './client.js';
3
+ export { defineContract, type$, } from './contract.js';
4
+ export { maxDatagramPayload } from './datagram.js';
5
+ export { TransportError } from './errors.js';
6
+ export { encodeFrame, FrameDecoder, maxPayloadFor } from './framer.js';
7
+ export { CloseCode, Codec, DATAGRAM_CONSERVATIVE_PAYLOAD_MAX, DATAGRAM_HEADER_BYTES, EVENT_ID_NOT_APPLICABLE, FrameType, MAX_CALL_PAYLOAD_BYTES, MAX_EMIT_PAYLOAD_BYTES, PROTOCOL_VERSION, ResetCode, STREAM_FRAME_OVERHEAD_BYTES, } from './protocol.js';
8
+ export { createServer, Server, } from './server.js';
9
+ /**
10
+ * Hand-maintained and asserted against `package.json` by `index.test.ts`, because
11
+ * `isolatedDeclarations` forbids inferring it from an import and a version that drifts from
12
+ * its manifest is a lie in the one place a user checks first.
13
+ *
14
+ * `changeset version` moves the manifest, so this moves in the same commit — which the test
15
+ * enforces rather than trusting anyone to remember.
16
+ */
17
+ export const VERSION = '0.0.1';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAEb,SAAS,GAOV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAqD,MAAM,aAAa,CAAA;AACvF,OAAO,EAIL,cAAc,EAOd,KAAK,GACN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,cAAc,EAA2B,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,WAAW,EAAc,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EACL,SAAS,EACT,KAAK,EACL,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,2BAA2B,GAC5B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EAEZ,MAAM,GAGP,MAAM,aAAa,CAAA;AAGpB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW,OAAO,CAAA"}
@@ -0,0 +1,18 @@
1
+ export declare class OriginAllocator {
2
+ #private;
3
+ /**
4
+ * `counterSpace` exists so the exhaustion branch can be reached in a test. Exhausting the
5
+ * real space means 4,194,304 allocations, which is why §7.3's "MUST refuse new sessions"
6
+ * went unproven — and an unreachable branch in an allocator is exactly the kind of code
7
+ * that is wrong the first time it runs. Production never passes it.
8
+ */
9
+ constructor(hostOrdinal?: number, quarantineMs?: number, counterSpace?: number);
10
+ allocate(now: number): number;
11
+ /** Held well beyond any window in which a stale datagram or sequence entry can survive. */
12
+ free(value: number, now: number): void;
13
+ stats(now: number): {
14
+ live: number;
15
+ quarantined: number;
16
+ };
17
+ }
18
+ //# sourceMappingURL=origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAiBA,qBAAa,eAAe;;IAS1B;;;;;OAKG;IACH,YACE,WAAW,SAAI,EACf,YAAY,GAAE,MAA6B,EAC3C,YAAY,GAAE,MAAsB,EAYrC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkB5B;IAED,2FAA2F;IAC3F,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAGrC;IAWD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAGxD;CACF"}
package/dist/origin.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Origin allocation. PROTOCOL.md §7.3.
3
+ *
4
+ * Allocated, not derived: hashing a PeerId would carry a birthday problem into a place
5
+ * where a collision is close to undebuggable, since two peers would share a sequence space
6
+ * and each would silently discard the other's datagrams as stale.
7
+ *
8
+ * Quarantined, not retired: never reusing turns the counter into a clock — 2^22 values at
9
+ * 100 sessions per second exhausts in under twelve hours — so a busy host would stop
10
+ * accepting sessions and need a restart.
11
+ */
12
+ import { TransportError } from './errors.js';
13
+ import { MAX_SESSION_HOSTS, ORIGIN_QUARANTINE_MS } from './protocol.js';
14
+ const COUNTER_BITS = 22;
15
+ const COUNTER_SPACE = 1 << COUNTER_BITS;
16
+ export class OriginAllocator {
17
+ #ordinal;
18
+ #quarantineMs;
19
+ #live = new Set();
20
+ #quarantined = [];
21
+ #next = 0;
22
+ #space;
23
+ /**
24
+ * `counterSpace` exists so the exhaustion branch can be reached in a test. Exhausting the
25
+ * real space means 4,194,304 allocations, which is why §7.3's "MUST refuse new sessions"
26
+ * went unproven — and an unreachable branch in an allocator is exactly the kind of code
27
+ * that is wrong the first time it runs. Production never passes it.
28
+ */
29
+ constructor(hostOrdinal = 0, quarantineMs = ORIGIN_QUARANTINE_MS, counterSpace = COUNTER_SPACE) {
30
+ if (!Number.isInteger(hostOrdinal) || hostOrdinal < 0 || hostOrdinal >= MAX_SESSION_HOSTS) {
31
+ throw new TransportError('WT_PROTOCOL_ERROR', `host ordinal ${hostOrdinal} is outside 0..${MAX_SESSION_HOSTS - 1}`, `This deployment supports at most ${MAX_SESSION_HOSTS} concurrent session hosts.`);
32
+ }
33
+ this.#ordinal = hostOrdinal;
34
+ this.#quarantineMs = quarantineMs;
35
+ this.#space = counterSpace;
36
+ }
37
+ allocate(now) {
38
+ this.#release(now);
39
+ for (let i = 0; i < this.#space; i++) {
40
+ const counter = (this.#next + i) % this.#space;
41
+ // 0 is reserved so a zero-filled buffer cannot parse as a real peer.
42
+ if (this.#ordinal === 0 && counter === 0)
43
+ continue;
44
+ const value = (this.#ordinal << COUNTER_BITS) | counter;
45
+ if (this.#live.has(value))
46
+ continue;
47
+ if (this.#quarantined.some((q) => q.value === value))
48
+ continue;
49
+ this.#next = (counter + 1) % this.#space;
50
+ this.#live.add(value);
51
+ return value;
52
+ }
53
+ throw new TransportError('WT_TOO_MANY_STREAMS', `this host has no free origin identifiers (${this.#space} live plus quarantined)`, 'This is a concurrency limit, not a clock. Add another session host, or reduce concurrent sessions.');
54
+ }
55
+ /** Held well beyond any window in which a stale datagram or sequence entry can survive. */
56
+ free(value, now) {
57
+ if (!this.#live.delete(value))
58
+ return;
59
+ this.#quarantined.push({ value, until: now + this.#quarantineMs });
60
+ }
61
+ #release(now) {
62
+ while (this.#quarantined.length > 0 &&
63
+ this.#quarantined[0].until <= now) {
64
+ this.#quarantined.shift();
65
+ }
66
+ }
67
+ stats(now) {
68
+ this.#release(now);
69
+ return { live: this.#live.size, quarantined: this.#quarantined.length };
70
+ }
71
+ }
72
+ //# sourceMappingURL=origin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEvE,MAAM,YAAY,GAAG,EAAE,CAAA;AACvB,MAAM,aAAa,GAAG,CAAC,IAAI,YAAY,CAAA;AAEvC,MAAM,OAAO,eAAe;IACjB,QAAQ,CAAQ;IAChB,aAAa,CAAQ;IACrB,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IACzB,YAAY,GAAuC,EAAE,CAAA;IAC9D,KAAK,GAAG,CAAC,CAAA;IAEA,MAAM,CAAQ;IAEvB;;;;;OAKG;IACH,YACE,WAAW,GAAG,CAAC,EACf,YAAY,GAAW,oBAAoB,EAC3C,YAAY,GAAW,aAAa;QAEpC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,IAAI,WAAW,IAAI,iBAAiB,EAAE,CAAC;YAC1F,MAAM,IAAI,cAAc,CACtB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;IAC3F,IAAI,CAAC,KAAa,EAAE,GAAW;QAC7B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,OAAM;QACrC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,OACE,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAC3B,IAAI,CAAC,YAAY,CAAC,CAAC,CAAuB,CAAC,KAAK,IAAI,GAAG,EACxD,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAW;QACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;IACzE,CAAC;CACF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The single source of truth for every normative constant in PROTOCOL.md.
3
+ *
4
+ * `scripts/check-docs.ts` parses the tables out of PROTOCOL.md and asserts they match
5
+ * these values, so a document and an implementation cannot drift. Change one and the
6
+ * build fails until you change the other.
7
+ */
8
+ /** PROTOCOL.md §4.2 — Stage 0 requires exact equality and refuses otherwise. */
9
+ export declare const PROTOCOL_VERSION = 0;
10
+ /** PROTOCOL.md §5.2 */
11
+ export declare const FrameType: {
12
+ readonly HANDSHAKE: 1;
13
+ readonly EMIT: 2;
14
+ readonly CALL_REQUEST: 3;
15
+ readonly CALL_RESPONSE: 4;
16
+ readonly CALL_ERROR: 5;
17
+ readonly JOIN: 6;
18
+ readonly LEAVE: 7;
19
+ };
20
+ export type FrameType = (typeof FrameType)[keyof typeof FrameType];
21
+ export declare function isFrameType(v: number): v is FrameType;
22
+ /** PROTOCOL.md §5.3. `0x00` is permanently reserved so a zero-filled buffer cannot parse. */
23
+ export declare const Codec: {
24
+ readonly JSON: 1;
25
+ };
26
+ export type Codec = (typeof Codec)[keyof typeof Codec];
27
+ /** PROTOCOL.md §5.4 — used by frames whose meaning comes from the stream, not the table. */
28
+ export declare const EVENT_ID_NOT_APPLICABLE = 0;
29
+ /** PROTOCOL.md §5.1 — stream frame field budget. */
30
+ export declare const LENGTH_PREFIX_BYTES = 4;
31
+ export declare const STREAM_HEADER_BYTES = 8;
32
+ export declare const STREAM_FRAME_OVERHEAD_BYTES: number;
33
+ /** `Length` counts every byte AFTER itself: header plus payload. Never itself. */
34
+ export declare const MIN_LENGTH: number;
35
+ export declare const MAX_EMIT_PAYLOAD_BYTES = 1048576;
36
+ export declare const MAX_CALL_PAYLOAD_BYTES = 16777216;
37
+ /** PROTOCOL.md §7.2 — datagram field budget. */
38
+ export declare const DATAGRAM_HEADER_BYTES = 13;
39
+ /** PROTOCOL.md §7.4 — used only when the transport reports nothing usable. */
40
+ export declare const DATAGRAM_CONSERVATIVE_FLOOR = 1024;
41
+ export declare const DATAGRAM_CONSERVATIVE_PAYLOAD_MAX: number;
42
+ /** PROTOCOL.md §9 — per-peer bounds. Numbers, not adjectives. */
43
+ export declare const DATAGRAM_QUEUE_MAX = 64;
44
+ export declare const EMIT_QUEUE_MAX = 256;
45
+ /** PROTOCOL.md §10.1 code 9 — a rejected open resets that stream, never the session. */
46
+ export declare const MAX_CONCURRENT_CALL_STREAMS = 256;
47
+ /** Checked at dequeue, not enqueue: overflow handles a burst, TTL handles a stall. */
48
+ export declare const DATAGRAM_TTL_MS = 150;
49
+ /** PROTOCOL.md §7.3 — a receiver discards (origin, event) sequence state after this idle. */
50
+ export declare const SEQUENCE_STATE_RETENTION_MS = 60000;
51
+ /** PROTOCOL.md §7.3 — a released Origin waits this long before returning to the pool. */
52
+ export declare const ORIGIN_QUARANTINE_MS = 120000;
53
+ /** PROTOCOL.md §7.3 — a departed host's ordinal waits this long before reallocation. */
54
+ export declare const HOST_ORDINAL_QUARANTINE_MS = 300000;
55
+ /** PROTOCOL.md §7.3 — stated ceiling on concurrent session hosts. */
56
+ export declare const MAX_SESSION_HOSTS = 1024;
57
+ /** PROTOCOL.md §4.1 */
58
+ export declare const HANDSHAKE_DEADLINE_MS = 5000;
59
+ /** PROTOCOL.md §10.2 */
60
+ export declare const CLOSE_REASON_MAX_BYTES = 1024;
61
+ /** PROTOCOL.md §10.1 — one byte, because the browser API clamps stream codes to an octet. */
62
+ export declare const ResetCode: {
63
+ readonly WT_NO_ERROR: 0;
64
+ readonly WT_ABORTED: 1;
65
+ readonly WT_TOO_MANY_STREAMS: 9;
66
+ };
67
+ export type ResetCode = (typeof ResetCode)[keyof typeof ResetCode];
68
+ /** PROTOCOL.md §10.2 */
69
+ export declare const CloseCode: {
70
+ readonly WT_NO_ERROR: 0;
71
+ readonly WT_PROTOCOL_VERSION_MISMATCH: 1000;
72
+ readonly WT_CONTRACT_MISMATCH: 1001;
73
+ readonly WT_HANDSHAKE_TIMEOUT: 1002;
74
+ readonly WT_PEER_TOO_SLOW: 1003;
75
+ readonly WT_PROTOCOL_ERROR: 1004;
76
+ readonly WT_RELIABILITY_REFUSED: 1006;
77
+ };
78
+ export type CloseCode = (typeof CloseCode)[keyof typeof CloseCode];
79
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,uBAAuB;AACvB,eAAO,MAAM,SAAS;aACpB,SAAS,EAAE,CAAI;aACf,IAAI,EAAE,CAAI;aACV,YAAY,EAAE,CAAI;aAClB,aAAa,EAAE,CAAI;aACnB,UAAU,EAAE,CAAI;aAChB,IAAI,EAAE,CAAI;aACV,KAAK,EAAE,CAAI;CACH,CAAA;AAC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B;AACvB,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,wBAAwB;AACxB,eAAO,MAAM,sBAAsB,OAAO,CAAA;AAE1C,6FAA6F;AAC7F,eAAO,MAAM,SAAS;aACpB,WAAW,EAAE,CAAC;aACd,UAAU,EAAE,CAAC;aACb,mBAAmB,EAAE,CAAC;CACd,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE,wBAAwB;AACxB,eAAO,MAAM,SAAS;aACpB,WAAW,EAAE,CAAC;aACd,4BAA4B,EAAE,IAAI;aAClC,oBAAoB,EAAE,IAAI;aAC1B,oBAAoB,EAAE,IAAI;aAC1B,gBAAgB,EAAE,IAAI;aACtB,iBAAiB,EAAE,IAAI;aACvB,sBAAsB,EAAE,IAAI;CACpB,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The single source of truth for every normative constant in PROTOCOL.md.
3
+ *
4
+ * `scripts/check-docs.ts` parses the tables out of PROTOCOL.md and asserts they match
5
+ * these values, so a document and an implementation cannot drift. Change one and the
6
+ * build fails until you change the other.
7
+ */
8
+ /** PROTOCOL.md §4.2 — Stage 0 requires exact equality and refuses otherwise. */
9
+ export const PROTOCOL_VERSION = 0;
10
+ /** PROTOCOL.md §5.2 */
11
+ export const FrameType = {
12
+ HANDSHAKE: 0x01,
13
+ EMIT: 0x02,
14
+ CALL_REQUEST: 0x03,
15
+ CALL_RESPONSE: 0x04,
16
+ CALL_ERROR: 0x05,
17
+ JOIN: 0x06,
18
+ LEAVE: 0x07,
19
+ };
20
+ const FRAME_TYPES = new Set(Object.values(FrameType));
21
+ export function isFrameType(v) {
22
+ return FRAME_TYPES.has(v);
23
+ }
24
+ /** PROTOCOL.md §5.3. `0x00` is permanently reserved so a zero-filled buffer cannot parse. */
25
+ export const Codec = { JSON: 0x01 };
26
+ /** PROTOCOL.md §5.4 — used by frames whose meaning comes from the stream, not the table. */
27
+ export const EVENT_ID_NOT_APPLICABLE = 0x00000000;
28
+ /** PROTOCOL.md §5.1 — stream frame field budget. */
29
+ export const LENGTH_PREFIX_BYTES = 4;
30
+ export const STREAM_HEADER_BYTES = 8;
31
+ export const STREAM_FRAME_OVERHEAD_BYTES = LENGTH_PREFIX_BYTES + STREAM_HEADER_BYTES;
32
+ /** `Length` counts every byte AFTER itself: header plus payload. Never itself. */
33
+ export const MIN_LENGTH = STREAM_HEADER_BYTES + 1;
34
+ export const MAX_EMIT_PAYLOAD_BYTES = 1_048_576;
35
+ export const MAX_CALL_PAYLOAD_BYTES = 16_777_216;
36
+ /** PROTOCOL.md §7.2 — datagram field budget. */
37
+ export const DATAGRAM_HEADER_BYTES = 13;
38
+ /** PROTOCOL.md §7.4 — used only when the transport reports nothing usable. */
39
+ export const DATAGRAM_CONSERVATIVE_FLOOR = 1024;
40
+ export const DATAGRAM_CONSERVATIVE_PAYLOAD_MAX = DATAGRAM_CONSERVATIVE_FLOOR - DATAGRAM_HEADER_BYTES;
41
+ /** PROTOCOL.md §9 — per-peer bounds. Numbers, not adjectives. */
42
+ export const DATAGRAM_QUEUE_MAX = 64;
43
+ export const EMIT_QUEUE_MAX = 256;
44
+ /** PROTOCOL.md §10.1 code 9 — a rejected open resets that stream, never the session. */
45
+ export const MAX_CONCURRENT_CALL_STREAMS = 256;
46
+ /** Checked at dequeue, not enqueue: overflow handles a burst, TTL handles a stall. */
47
+ export const DATAGRAM_TTL_MS = 150;
48
+ /** PROTOCOL.md §7.3 — a receiver discards (origin, event) sequence state after this idle. */
49
+ export const SEQUENCE_STATE_RETENTION_MS = 60_000;
50
+ /** PROTOCOL.md §7.3 — a released Origin waits this long before returning to the pool. */
51
+ export const ORIGIN_QUARANTINE_MS = 120_000;
52
+ /** PROTOCOL.md §7.3 — a departed host's ordinal waits this long before reallocation. */
53
+ export const HOST_ORDINAL_QUARANTINE_MS = 300_000;
54
+ /** PROTOCOL.md §7.3 — stated ceiling on concurrent session hosts. */
55
+ export const MAX_SESSION_HOSTS = 1024;
56
+ /** PROTOCOL.md §4.1 */
57
+ export const HANDSHAKE_DEADLINE_MS = 5000;
58
+ /** PROTOCOL.md §10.2 */
59
+ export const CLOSE_REASON_MAX_BYTES = 1024;
60
+ /** PROTOCOL.md §10.1 — one byte, because the browser API clamps stream codes to an octet. */
61
+ export const ResetCode = {
62
+ WT_NO_ERROR: 0,
63
+ WT_ABORTED: 1,
64
+ WT_TOO_MANY_STREAMS: 9,
65
+ };
66
+ /** PROTOCOL.md §10.2 */
67
+ export const CloseCode = {
68
+ WT_NO_ERROR: 0,
69
+ WT_PROTOCOL_VERSION_MISMATCH: 1000,
70
+ WT_CONTRACT_MISMATCH: 1001,
71
+ WT_HANDSHAKE_TIMEOUT: 1002,
72
+ WT_PEER_TOO_SLOW: 1003,
73
+ WT_PROTOCOL_ERROR: 1004,
74
+ WT_RELIABILITY_REFUSED: 1006,
75
+ };
76
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAEjC,uBAAuB;AACvB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;CACH,CAAA;AAGV,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1E,MAAM,UAAU,WAAW,CAAC,CAAS;IACnC,OAAO,WAAW,CAA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CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC,uBAAuB;AACvB,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AACzC,wBAAwB;AACxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAE1C,6FAA6F;AAC7F,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,mBAAmB,EAAE,CAAC;CACd,CAAA;AAGV,wBAAwB;AACxB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE,CAAC;IACd,4BAA4B,EAAE,IAAI;IAClC,oBAAoB,EAAE,IAAI;IAC1B,oBAAoB,EAAE,IAAI;IAC1B,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,IAAI;CACpB,CAAA"}
@@ -0,0 +1,45 @@
1
+ export interface QueueStats {
2
+ readonly queueDepth: number;
3
+ readonly overflowDropped: number;
4
+ readonly staleDropped: number;
5
+ }
6
+ /**
7
+ * Datagram lane: bounded ring, drop OLDEST on overflow, TTL checked at DEQUEUE.
8
+ *
9
+ * The two axes are different problems. Drop-oldest handles a burst. It does nothing for a
10
+ * peer that stalls two seconds and resumes — the ring never overflows, so a backlog of
11
+ * stale positions is delivered and the application renders history, which is worse than
12
+ * delivering nothing. TTL at dequeue is what fixes that, and the two causes are counted
13
+ * separately so an operator can tell a slow consumer from a slow network.
14
+ */
15
+ export declare class DatagramQueue<T> {
16
+ #private;
17
+ constructor(max?: number, ttlMs?: number);
18
+ /** Never throws and never blocks: dropping is this lane's advertised contract. */
19
+ push(item: T, now: number): void;
20
+ /** Drains what is still fresh. Anything past its TTL is discarded here, not on entry. */
21
+ drain(now: number): T[];
22
+ stats(): QueueStats;
23
+ }
24
+ export declare class PeerTooSlowError extends Error {
25
+ constructor(depth: number);
26
+ }
27
+ /**
28
+ * Emit lane: bounded, and NEVER drops. A lane that advertises reliable ordered delivery
29
+ * and then discards silently is the lie this project exists to avoid, so a peer that falls
30
+ * this far behind is disconnected instead.
31
+ */
32
+ export declare class EmitQueue<T> {
33
+ #private;
34
+ constructor(max?: number);
35
+ push(item: T): void;
36
+ /**
37
+ * The head, left in place. An item leaves this queue only when its write has actually
38
+ * completed — `shift()` on hand-off would make depth a measure of nothing, which is
39
+ * precisely how the bound came to be unreachable.
40
+ */
41
+ peek(): T | undefined;
42
+ shift(): T | undefined;
43
+ get depth(): number;
44
+ }
45
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAC9B;AAOD;;;;;;;;GAQG;AACH,qBAAa,aAAa,CAAC,CAAC;;IAO1B,YAAY,GAAG,GAAE,MAA2B,EAAE,KAAK,GAAE,MAAwB,EAG5E;IAED,kFAAkF;IAClF,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAM/B;IAED,yFAAyF;IACzF,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,CAQtB;IAED,KAAK,IAAI,UAAU,CAMlB;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,KAAK,EAAE,MAAM,EAGxB;CACF;AAED;;;;GAIG;AACH,qBAAa,SAAS,CAAC,CAAC;;IAItB,YAAY,GAAG,GAAE,MAAuB,EAEvC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAGlB;IAED;;;;OAIG;IACH,IAAI,IAAI,CAAC,GAAG,SAAS,CAEpB;IAED,KAAK,IAAI,CAAC,GAAG,SAAS,CAErB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;CACF"}
package/dist/queue.js ADDED
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Backpressure. PROTOCOL.md §9 — three lanes, three answers, because they make different
3
+ * promises.
4
+ *
5
+ * The transport swallows its own "blocked" indication along with "too big", so a refused
6
+ * write reports success. We therefore do not attempt to infer network congestion: we bound
7
+ * our own queue and report our own drops, labelled as ours.
8
+ */
9
+ import { DATAGRAM_QUEUE_MAX, DATAGRAM_TTL_MS, EMIT_QUEUE_MAX } from './protocol.js';
10
+ /**
11
+ * Datagram lane: bounded ring, drop OLDEST on overflow, TTL checked at DEQUEUE.
12
+ *
13
+ * The two axes are different problems. Drop-oldest handles a burst. It does nothing for a
14
+ * peer that stalls two seconds and resumes — the ring never overflows, so a backlog of
15
+ * stale positions is delivered and the application renders history, which is worse than
16
+ * delivering nothing. TTL at dequeue is what fixes that, and the two causes are counted
17
+ * separately so an operator can tell a slow consumer from a slow network.
18
+ */
19
+ export class DatagramQueue {
20
+ #items = [];
21
+ #max;
22
+ #ttlMs;
23
+ #overflowDropped = 0;
24
+ #staleDropped = 0;
25
+ constructor(max = DATAGRAM_QUEUE_MAX, ttlMs = DATAGRAM_TTL_MS) {
26
+ this.#max = max;
27
+ this.#ttlMs = ttlMs;
28
+ }
29
+ /** Never throws and never blocks: dropping is this lane's advertised contract. */
30
+ push(item, now) {
31
+ if (this.#items.length >= this.#max) {
32
+ this.#items.shift();
33
+ this.#overflowDropped++;
34
+ }
35
+ this.#items.push({ item, at: now });
36
+ }
37
+ /** Drains what is still fresh. Anything past its TTL is discarded here, not on entry. */
38
+ drain(now) {
39
+ const out = [];
40
+ for (const q of this.#items) {
41
+ if (now - q.at >= this.#ttlMs)
42
+ this.#staleDropped++;
43
+ else
44
+ out.push(q.item);
45
+ }
46
+ this.#items.length = 0;
47
+ return out;
48
+ }
49
+ stats() {
50
+ return {
51
+ queueDepth: this.#items.length,
52
+ overflowDropped: this.#overflowDropped,
53
+ staleDropped: this.#staleDropped,
54
+ };
55
+ }
56
+ }
57
+ export class PeerTooSlowError extends Error {
58
+ constructor(depth) {
59
+ super(`emit queue reached ${depth} frames`);
60
+ this.name = 'PeerTooSlowError';
61
+ }
62
+ }
63
+ /**
64
+ * Emit lane: bounded, and NEVER drops. A lane that advertises reliable ordered delivery
65
+ * and then discards silently is the lie this project exists to avoid, so a peer that falls
66
+ * this far behind is disconnected instead.
67
+ */
68
+ export class EmitQueue {
69
+ #items = [];
70
+ #max;
71
+ constructor(max = EMIT_QUEUE_MAX) {
72
+ this.#max = max;
73
+ }
74
+ push(item) {
75
+ if (this.#items.length >= this.#max)
76
+ throw new PeerTooSlowError(this.#items.length);
77
+ this.#items.push(item);
78
+ }
79
+ /**
80
+ * The head, left in place. An item leaves this queue only when its write has actually
81
+ * completed — `shift()` on hand-off would make depth a measure of nothing, which is
82
+ * precisely how the bound came to be unreachable.
83
+ */
84
+ peek() {
85
+ return this.#items[0];
86
+ }
87
+ shift() {
88
+ return this.#items.shift();
89
+ }
90
+ get depth() {
91
+ return this.#items.length;
92
+ }
93
+ }
94
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAanF;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACf,MAAM,GAAgB,EAAE,CAAA;IACxB,IAAI,CAAQ;IACZ,MAAM,CAAQ;IACvB,gBAAgB,GAAG,CAAC,CAAA;IACpB,aAAa,GAAG,CAAC,CAAA;IAEjB,YAAY,GAAG,GAAW,kBAAkB,EAAE,KAAK,GAAW,eAAe;QAC3E,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;QACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAED,kFAAkF;IAClF,IAAI,CAAC,IAAO,EAA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ACV,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACnF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;CACF"}
@@ -0,0 +1,45 @@
1
+ /** Server surface. Transport-agnostic: it accepts a Connection from the seam. */
2
+ import { type Adapter, type PeerId } from './adapter.ts';
3
+ import { type AnyMap, type CallableOf, type Contract } from './contract.ts';
4
+ import { type SessionStats } from './session.ts';
5
+ import type { Connection } from './transport/types.ts';
6
+ export interface ServerPeer<M extends AnyMap = AnyMap> {
7
+ readonly id: PeerId;
8
+ readonly origin: number;
9
+ readonly rooms: readonly string[];
10
+ join(room: string): Promise<void>;
11
+ leave(room: string): Promise<void>;
12
+ on<K extends keyof M & string>(event: K, handler: (payload: M[K]['payload']) => void): () => void;
13
+ emit<K extends keyof M & string>(event: K, payload: M[K]['payload']): void;
14
+ stats(): SessionStats;
15
+ close(code?: number, reason?: string): void;
16
+ }
17
+ export interface CallContext {
18
+ /** Fires when the initiator resets the stream. Immediate, and free on this transport. */
19
+ readonly signal: AbortSignal;
20
+ }
21
+ export interface ServerOptions {
22
+ readonly contract: Contract;
23
+ readonly adapter?: Adapter;
24
+ readonly nodeId?: string;
25
+ readonly hostOrdinal?: number;
26
+ readonly validateInbound?: boolean;
27
+ }
28
+ export interface RoomTarget<M extends AnyMap = AnyMap> {
29
+ emit<K extends keyof M & string>(event: K, payload: M[K]['payload']): Promise<void>;
30
+ except(...peers: PeerId[]): RoomTarget<M>;
31
+ }
32
+ export declare class Server<M extends AnyMap = AnyMap> {
33
+ #private;
34
+ constructor(opts: ServerOptions);
35
+ /** Builds the event table once. Async because event ids are a SHA-256 of the name. */
36
+ listen(): Promise<void>;
37
+ /** Register a responder for a callable event. */
38
+ handle<K extends CallableOf<M> & string>(event: K, handler: (payload: M[K]['payload'], ctx: CallContext) => Promise<M[K]['returns']>): () => void;
39
+ onSession(cb: (peer: ServerPeer<M>) => void): () => void;
40
+ memberCount(room: string): number;
41
+ accept(conn: Connection): Promise<ServerPeer<M>>;
42
+ to(room: string): RoomTarget<M>;
43
+ }
44
+ export declare function createServer<M extends AnyMap = AnyMap>(opts: ServerOptions): Server<M>;
45
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,KAAK,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EACL,KAAK,MAAM,EAEX,KAAK,UAAU,EACf,KAAK,QAAQ,EAEd,MAAM,eAAe,CAAA;AAItB,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,EAAE,CAAC,CAAC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