onelobby 0.3.1 → 0.5.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/README.md +2 -2
- package/blueprint.schema.json +237 -0
- package/dist/blueprint.d.ts +166 -0
- package/dist/blueprint.js +281 -0
- package/dist/blueprint.js.map +1 -0
- package/dist/chunking.d.ts +4 -0
- package/dist/chunking.js +23 -2
- package/dist/chunking.js.map +1 -1
- package/dist/deflate.d.ts +2 -1
- package/dist/deflate.js +10 -4
- package/dist/deflate.js.map +1 -1
- package/dist/direct/hub-host.d.ts +16 -0
- package/dist/direct/hub-host.js +45 -1
- package/dist/direct/hub-host.js.map +1 -1
- package/dist/direct/hub.d.ts +3 -0
- package/dist/direct/hub.js +32 -6
- package/dist/direct/hub.js.map +1 -1
- package/dist/direct/index.d.ts +8 -2
- package/dist/direct/index.js +26 -4
- package/dist/direct/index.js.map +1 -1
- package/dist/friendly.d.ts +36 -0
- package/dist/friendly.js +44 -0
- package/dist/friendly.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lockstep.d.ts +5 -0
- package/dist/lockstep.js +17 -2
- package/dist/lockstep.js.map +1 -1
- package/dist/onelobby.bundle.mjs +5 -5
- package/dist/onelobby.bundle.mjs.map +4 -4
- package/dist/onelobby.d.ts +34 -2
- package/dist/onelobby.global.js +445 -30
- package/dist/onelobby.global.js.map +3 -3
- package/dist/onelobby.global.min.js +5 -5
- package/dist/onelobby.global.min.js.map +4 -4
- package/dist/onelobby.js +136 -25
- package/dist/onelobby.js.map +1 -1
- package/package.json +4 -2
package/dist/onelobby.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { Lobby, type RateLimit } from "./lobby.js";
|
|
|
4
4
|
import { type LobbySummary } from "./signaling.js";
|
|
5
5
|
import { type LinkFactory, type SocketFactory } from "./transport.js";
|
|
6
6
|
import type { VoiceCodec, FrameSource, AudioSink } from "./voice-types.js";
|
|
7
|
+
import { type Blueprint } from "./blueprint.js";
|
|
7
8
|
export declare const LIB_NAME = "onelobby";
|
|
8
|
-
export declare const LIB_VERSION = "0.
|
|
9
|
+
export declare const LIB_VERSION = "0.5.0";
|
|
9
10
|
/** Where `rememberSeat` keeps the resume token: the subset of the Web Storage API it uses. */
|
|
10
11
|
export interface SeatStorage {
|
|
11
12
|
getItem(key: string): string | null;
|
|
@@ -73,6 +74,16 @@ export interface OneLobbyOptions {
|
|
|
73
74
|
/** @deprecated use `advanced.createSink` */
|
|
74
75
|
createSink?: (() => AudioSink) | null;
|
|
75
76
|
}
|
|
77
|
+
/** Per-launch settings for `OneLobby.fromConfig`; everything else comes from the blueprint. */
|
|
78
|
+
export interface FromConfigOverrides {
|
|
79
|
+
/** The player's name. Checked against `players.identity` and `players.maxNameLength`. */
|
|
80
|
+
displayName?: string;
|
|
81
|
+
/** Wins over `hosting.lobbyServer` (the file is the bottom layer: put `?lobby=` / storage / `<meta>` lookups here). */
|
|
82
|
+
lobbyServer?: string;
|
|
83
|
+
/** Default: `lobby.rejoin` from the file. */
|
|
84
|
+
rememberSeat?: boolean;
|
|
85
|
+
advanced?: AdvancedOptions;
|
|
86
|
+
}
|
|
76
87
|
export interface HostOptions {
|
|
77
88
|
name: string;
|
|
78
89
|
maxPlayers: number;
|
|
@@ -120,6 +131,16 @@ export declare class OneLobby extends Emitter<OneLobbyEvents> {
|
|
|
120
131
|
private createMic;
|
|
121
132
|
private createSink;
|
|
122
133
|
private storage;
|
|
134
|
+
/** The validated, frozen onelobby.json this kit was built from (`OneLobby.fromConfig`); undefined for `new OneLobby`. */
|
|
135
|
+
readonly blueprint?: Blueprint;
|
|
136
|
+
/**
|
|
137
|
+
* Build a kit from an onelobby.json (already parsed; docs/design/blueprint.md s.7). Throws `bad_config` for an
|
|
138
|
+
* invalid file or name, `identity_anonymous` for a name when `players.identity` is "anonymous". Then `host()` and
|
|
139
|
+
* `hostDirect()` default their options from the file and the file's chat/listing switches are enforced.
|
|
140
|
+
*/
|
|
141
|
+
static fromConfig(json: unknown, overrides?: FromConfigOverrides): OneLobby;
|
|
142
|
+
/** @internal Host options the blueprint implies (empty without one). */
|
|
143
|
+
blueprintHostDefaults(): Partial<HostOptions>;
|
|
123
144
|
constructor(o: OneLobbyOptions);
|
|
124
145
|
private get seatKey();
|
|
125
146
|
private loadSeat;
|
|
@@ -134,8 +155,11 @@ export declare class OneLobby extends Emitter<OneLobbyEvents> {
|
|
|
134
155
|
resume(): Promise<Lobby | null>;
|
|
135
156
|
private helloMsg;
|
|
136
157
|
private connect;
|
|
158
|
+
/** The signaling socket only (no hello yet); with a timeout (direct IP), no answer is `direct_unreachable`. */
|
|
159
|
+
private open;
|
|
137
160
|
private makeLobby;
|
|
138
|
-
|
|
161
|
+
/** With a blueprint (`fromConfig`) every option defaults from `lobby.*`; explicit options win. */
|
|
162
|
+
host(opts?: Partial<HostOptions>): Promise<Lobby>;
|
|
139
163
|
join(code: string): Promise<Lobby>;
|
|
140
164
|
/**
|
|
141
165
|
* Join a direct-IP host (docs/direct-ip.md): a join code from the host's screen (`6B01-RGFE-P2B`, any case, spaces
|
|
@@ -144,8 +168,16 @@ export declare class OneLobby extends Emitter<OneLobbyEvents> {
|
|
|
144
168
|
* The address is also given to ICE as the host's UDP candidate. When the host leaves, `sessionEnded("host_left")`.
|
|
145
169
|
*/
|
|
146
170
|
joinDirect(codeOrAddress: string, opts?: JoinDirectOptions): Promise<Lobby>;
|
|
171
|
+
/**
|
|
172
|
+
* Take a direct-IP seat back after a drop or a restart: the code (or address) joined before and that lobby's
|
|
173
|
+
* `resumeToken` (save it after every join; it changes on each resume). The host keeps a dropped seat for 60 s and the
|
|
174
|
+
* same peer id comes back. Rejects with `invalid_token` when the seat is gone: offer `joinDirect` then.
|
|
175
|
+
*/
|
|
176
|
+
rejoinDirect(codeOrAddress: string, resumeToken: string, opts?: JoinDirectOptions): Promise<Lobby>;
|
|
177
|
+
private directTarget;
|
|
147
178
|
/** @internal onelobby/direct's host: create the one lobby on the embedded hub, in direct mode. */
|
|
148
179
|
hostDirectWith(h: HostOptions, hooks: DirectLobbyHooks): Promise<Lobby>;
|
|
149
180
|
rejoin(resumeToken: string): Promise<Lobby>;
|
|
181
|
+
private resumeAt;
|
|
150
182
|
list(opts?: ListOptions): Promise<LobbySummary[]>;
|
|
151
183
|
}
|