@indiegems/gem-web-sdk 5.9.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/bin/gem-sdk-stamp.mjs +95 -0
- package/dist/game.d.ts +2601 -0
- package/dist/gem-web-sdk.bridge.js +1 -0
- package/dist/gem-web-sdk.capture.js +1 -0
- package/dist/gem-web-sdk.esm.js +3 -0
- package/dist/gem-web-sdk.game.js +3 -0
- package/dist/gem-web-sdk.min.js +2 -0
- package/dist/gem-web-sdk.sdk.js +3 -0
- package/dist/gem-web-sdk.server-api.js +2 -0
- package/dist/gem-web-sdk.server.js +3 -0
- package/dist/index.d.ts +1981 -0
- package/dist/sdk.d.ts +3841 -0
- package/dist/server-api.d.ts +1078 -0
- package/dist/server.d.ts +1438 -0
- package/package.json +43 -0
- package/schema/bridge.v1.json +2624 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1981 @@
|
|
|
1
|
+
declare const PROTOCOL: "gem-web-bridge";
|
|
2
|
+
declare const SUPPORTED_VERSIONS: {
|
|
3
|
+
readonly min: 1;
|
|
4
|
+
readonly max: 1;
|
|
5
|
+
};
|
|
6
|
+
declare const MAX_MESSAGE_BYTES = 65536;
|
|
7
|
+
declare const MAX_MESSAGE_DEPTH = 8;
|
|
8
|
+
declare const MAX_MESSAGE_NODES = 5000;
|
|
9
|
+
declare const MAX_ARRAY_LENGTH = 1024;
|
|
10
|
+
declare const HANDSHAKE_TIMEOUT_MS = 10000;
|
|
11
|
+
declare const RATE_LIMITS: Readonly<Record<string, number>>;
|
|
12
|
+
declare const MALFORMED_INBOUND_KEY = "__malformed";
|
|
13
|
+
declare const PARENT_TO_FRAME: readonly [
|
|
14
|
+
"gem.handshake",
|
|
15
|
+
"gem.token",
|
|
16
|
+
"gem.token.denied",
|
|
17
|
+
"gem.player",
|
|
18
|
+
"gem.pause",
|
|
19
|
+
"gem.prefs",
|
|
20
|
+
"gem.cohorts",
|
|
21
|
+
"gem.viewport",
|
|
22
|
+
"gem.deviceSettings",
|
|
23
|
+
"gem.willTerminate",
|
|
24
|
+
"gem.roomEvent",
|
|
25
|
+
"gem.socketState",
|
|
26
|
+
"gem.seatedEvent",
|
|
27
|
+
"gem.signalEvent",
|
|
28
|
+
"gem.dedicatedEvent",
|
|
29
|
+
"gem.partyResult",
|
|
30
|
+
"gem.clusterTarget",
|
|
31
|
+
"gem.devtools",
|
|
32
|
+
"gem.screenshot",
|
|
33
|
+
"gem.requestContext",
|
|
34
|
+
"gem.localServer",
|
|
35
|
+
"gem.localServer.denied",
|
|
36
|
+
"gem.error",
|
|
37
|
+
"gem.purchaseResult",
|
|
38
|
+
"gem.deviceSettings.result",
|
|
39
|
+
"gem.adResult",
|
|
40
|
+
"gem.signInResult"
|
|
41
|
+
];
|
|
42
|
+
declare const FRAME_TO_PARENT: readonly [
|
|
43
|
+
"gem.handshake.accept",
|
|
44
|
+
"gem.screenshot.denied",
|
|
45
|
+
"gem.gameContext",
|
|
46
|
+
"gem.signal",
|
|
47
|
+
"gem.dedicatedOffer",
|
|
48
|
+
"gem.partyRequest",
|
|
49
|
+
"gem.ready",
|
|
50
|
+
"gem.progress",
|
|
51
|
+
"gem.requestToken",
|
|
52
|
+
"gem.requestLocalServer",
|
|
53
|
+
"gem.exit",
|
|
54
|
+
"gem.openExternal",
|
|
55
|
+
"gem.requestFullscreen",
|
|
56
|
+
"gem.audioState",
|
|
57
|
+
"gem.rewardCue",
|
|
58
|
+
"gem.frameStats",
|
|
59
|
+
"gem.error",
|
|
60
|
+
"gem.requestPurchase",
|
|
61
|
+
"gem.deviceSettings.put",
|
|
62
|
+
"gem.requestAd",
|
|
63
|
+
"gem.requestSignIn"
|
|
64
|
+
];
|
|
65
|
+
type GemCapability = "ads" | "signIn" | "purchases" | "devtools" | "screenshot" | "feedbackContext" | "rooms" | "p2p" | "dedicated" | "clusterTarget" | "parties" | "partySeating" | "socketState" | "audioState" | "rewardCue" | "frameStats" | "viewport" | "localHost" | "cohorts" | "deviceSettings" | "asyncOpponents";
|
|
66
|
+
declare const CAPABILITY_GATES: Readonly<Record<string, string>>;
|
|
67
|
+
declare const CAPABILITY_NAMESPACE_GATES: ReadonlyArray<readonly [
|
|
68
|
+
string,
|
|
69
|
+
string
|
|
70
|
+
]>;
|
|
71
|
+
declare function capabilityFor(type: string): string | undefined;
|
|
72
|
+
type GemErrorCode = "version_mismatch" | "handshake_timeout" | "handshake_duplicate" | "invalid_message" | "rate_limited" | "token_unavailable" | "unsupported" | "unsupported_capability" | "internal";
|
|
73
|
+
interface GemHandshake {
|
|
74
|
+
readonly gem: typeof PROTOCOL;
|
|
75
|
+
readonly type: "gem.handshake";
|
|
76
|
+
readonly versions: {
|
|
77
|
+
min: number;
|
|
78
|
+
max: number;
|
|
79
|
+
};
|
|
80
|
+
readonly capabilities?: string[];
|
|
81
|
+
readonly embedder: string;
|
|
82
|
+
}
|
|
83
|
+
interface GemHandshakeAccept {
|
|
84
|
+
readonly gem: typeof PROTOCOL;
|
|
85
|
+
readonly type: "gem.handshake.accept";
|
|
86
|
+
readonly v: number;
|
|
87
|
+
readonly capabilities?: string[];
|
|
88
|
+
}
|
|
89
|
+
interface GemToken {
|
|
90
|
+
readonly gem: typeof PROTOCOL;
|
|
91
|
+
readonly type: "gem.token";
|
|
92
|
+
readonly token: string;
|
|
93
|
+
readonly requestId?: string;
|
|
94
|
+
readonly generation: number;
|
|
95
|
+
readonly apiBaseUrl?: string;
|
|
96
|
+
readonly playerId: string;
|
|
97
|
+
readonly gameId: string;
|
|
98
|
+
readonly channel: "dev" | "test" | "release";
|
|
99
|
+
readonly gameVersion?: string;
|
|
100
|
+
readonly expiresAt: number;
|
|
101
|
+
readonly chainEndsAt: number;
|
|
102
|
+
readonly allowDevTools?: boolean;
|
|
103
|
+
}
|
|
104
|
+
interface GemTokenDenied {
|
|
105
|
+
readonly gem: typeof PROTOCOL;
|
|
106
|
+
readonly type: "gem.token.denied";
|
|
107
|
+
readonly requestId: string;
|
|
108
|
+
readonly retryable: boolean;
|
|
109
|
+
readonly retryAfterMs?: number;
|
|
110
|
+
readonly reason: "chain_exhausted" | "unavailable";
|
|
111
|
+
readonly correlationId: string;
|
|
112
|
+
}
|
|
113
|
+
interface GemPlayer {
|
|
114
|
+
readonly gem: typeof PROTOCOL;
|
|
115
|
+
readonly type: "gem.player";
|
|
116
|
+
readonly untrusted: {
|
|
117
|
+
displayName: string;
|
|
118
|
+
displayHandle: string;
|
|
119
|
+
};
|
|
120
|
+
readonly displayTag: string;
|
|
121
|
+
readonly avatarUrl?: string;
|
|
122
|
+
}
|
|
123
|
+
interface GemPause {
|
|
124
|
+
readonly gem: typeof PROTOCOL;
|
|
125
|
+
readonly type: "gem.pause";
|
|
126
|
+
readonly paused: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface GemPrefs {
|
|
129
|
+
readonly gem: typeof PROTOCOL;
|
|
130
|
+
readonly type: "gem.prefs";
|
|
131
|
+
readonly reducedMotion: boolean;
|
|
132
|
+
readonly muted: boolean;
|
|
133
|
+
readonly showFrameStats?: boolean;
|
|
134
|
+
readonly locale: string;
|
|
135
|
+
}
|
|
136
|
+
interface GemCohorts {
|
|
137
|
+
readonly gem: typeof PROTOCOL;
|
|
138
|
+
readonly type: "gem.cohorts";
|
|
139
|
+
readonly cohorts: {
|
|
140
|
+
experimentId: string;
|
|
141
|
+
variantKey: string;
|
|
142
|
+
}[];
|
|
143
|
+
}
|
|
144
|
+
interface GemViewport {
|
|
145
|
+
readonly gem: typeof PROTOCOL;
|
|
146
|
+
readonly type: "gem.viewport";
|
|
147
|
+
readonly insets: {
|
|
148
|
+
top: number;
|
|
149
|
+
right: number;
|
|
150
|
+
bottom: number;
|
|
151
|
+
left: number;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
interface GemDeviceSettings {
|
|
155
|
+
readonly gem: typeof PROTOCOL;
|
|
156
|
+
readonly type: "gem.deviceSettings";
|
|
157
|
+
readonly settings?: unknown;
|
|
158
|
+
}
|
|
159
|
+
interface GemWillTerminate {
|
|
160
|
+
readonly gem: typeof PROTOCOL;
|
|
161
|
+
readonly type: "gem.willTerminate";
|
|
162
|
+
readonly reason: "grant_expiring" | "session_ended" | "navigating" | "kill_switch";
|
|
163
|
+
readonly graceMs: number;
|
|
164
|
+
}
|
|
165
|
+
interface GemRoomEvent {
|
|
166
|
+
readonly gem: typeof PROTOCOL;
|
|
167
|
+
readonly type: "gem.roomEvent";
|
|
168
|
+
readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
|
|
169
|
+
readonly roomId: string;
|
|
170
|
+
readonly matchId?: string;
|
|
171
|
+
readonly version?: number;
|
|
172
|
+
readonly reason?: string;
|
|
173
|
+
readonly platform?: "universal" | "mobile";
|
|
174
|
+
}
|
|
175
|
+
interface GemSocketState {
|
|
176
|
+
readonly gem: typeof PROTOCOL;
|
|
177
|
+
readonly type: "gem.socketState";
|
|
178
|
+
readonly connected: boolean;
|
|
179
|
+
readonly reason?: "connecting" | "dropped" | "watchdog" | "terminal";
|
|
180
|
+
}
|
|
181
|
+
interface GemSeatedEvent {
|
|
182
|
+
readonly gem: typeof PROTOCOL;
|
|
183
|
+
readonly type: "gem.seatedEvent";
|
|
184
|
+
readonly roomId: string;
|
|
185
|
+
}
|
|
186
|
+
interface GemSignalEvent {
|
|
187
|
+
readonly gem: typeof PROTOCOL;
|
|
188
|
+
readonly type: "gem.signalEvent";
|
|
189
|
+
readonly event: "hello" | "offer" | "answer" | "ice" | "peerJoined" | "peerLeft" | "migration" | "matchEnded" | "error";
|
|
190
|
+
readonly matchId: string;
|
|
191
|
+
readonly data: unknown;
|
|
192
|
+
}
|
|
193
|
+
interface GemDedicatedEvent {
|
|
194
|
+
readonly gem: typeof PROTOCOL;
|
|
195
|
+
readonly type: "gem.dedicatedEvent";
|
|
196
|
+
readonly event: "answer" | "error" | "matchEnded";
|
|
197
|
+
readonly matchId: string;
|
|
198
|
+
readonly sdp?: string;
|
|
199
|
+
readonly sessionId?: string;
|
|
200
|
+
readonly code?: string;
|
|
201
|
+
readonly message?: string;
|
|
202
|
+
readonly reason?: string;
|
|
203
|
+
}
|
|
204
|
+
interface GemPartyResult {
|
|
205
|
+
readonly gem: typeof PROTOCOL;
|
|
206
|
+
readonly type: "gem.partyResult";
|
|
207
|
+
readonly requestId: string;
|
|
208
|
+
readonly partyId?: string;
|
|
209
|
+
}
|
|
210
|
+
interface GemClusterTarget {
|
|
211
|
+
readonly gem: typeof PROTOCOL;
|
|
212
|
+
readonly type: "gem.clusterTarget";
|
|
213
|
+
readonly clusterTargetId: string;
|
|
214
|
+
}
|
|
215
|
+
interface GemDevtools {
|
|
216
|
+
readonly gem: typeof PROTOCOL;
|
|
217
|
+
readonly type: "gem.devtools";
|
|
218
|
+
readonly action: "open" | "close" | "toggle";
|
|
219
|
+
}
|
|
220
|
+
interface GemScreenshot {
|
|
221
|
+
readonly gem: typeof PROTOCOL;
|
|
222
|
+
readonly type: "gem.screenshot";
|
|
223
|
+
readonly maxWidth: number;
|
|
224
|
+
readonly maxHeight: number;
|
|
225
|
+
}
|
|
226
|
+
interface GemScreenshotDenied {
|
|
227
|
+
readonly gem: typeof PROTOCOL;
|
|
228
|
+
readonly type: "gem.screenshot.denied";
|
|
229
|
+
readonly reason: "not_wired" | "no_source" | "unsupported" | "unreadable" | "tainted" | "too_large" | "busy" | "declined" | "failed";
|
|
230
|
+
readonly retryable: boolean;
|
|
231
|
+
}
|
|
232
|
+
interface GemRequestContext {
|
|
233
|
+
readonly gem: typeof PROTOCOL;
|
|
234
|
+
readonly type: "gem.requestContext";
|
|
235
|
+
}
|
|
236
|
+
interface GemGameContext {
|
|
237
|
+
readonly gem: typeof PROTOCOL;
|
|
238
|
+
readonly type: "gem.gameContext";
|
|
239
|
+
readonly context: unknown;
|
|
240
|
+
}
|
|
241
|
+
interface GemSignal {
|
|
242
|
+
readonly gem: typeof PROTOCOL;
|
|
243
|
+
readonly type: "gem.signal";
|
|
244
|
+
readonly signal: "join" | "offer" | "answer" | "ice" | "migrationAck" | "hostUnreachable";
|
|
245
|
+
readonly matchId: string;
|
|
246
|
+
readonly data: unknown;
|
|
247
|
+
}
|
|
248
|
+
interface GemDedicatedOffer {
|
|
249
|
+
readonly gem: typeof PROTOCOL;
|
|
250
|
+
readonly type: "gem.dedicatedOffer";
|
|
251
|
+
readonly matchId: string;
|
|
252
|
+
readonly sdp: string;
|
|
253
|
+
readonly intent: "initial" | "ice_restart" | "full_reconnect";
|
|
254
|
+
}
|
|
255
|
+
interface GemPartyRequest {
|
|
256
|
+
readonly gem: typeof PROTOCOL;
|
|
257
|
+
readonly type: "gem.partyRequest";
|
|
258
|
+
readonly requestId: string;
|
|
259
|
+
}
|
|
260
|
+
interface GemReady {
|
|
261
|
+
readonly gem: typeof PROTOCOL;
|
|
262
|
+
readonly type: "gem.ready";
|
|
263
|
+
}
|
|
264
|
+
interface GemProgress {
|
|
265
|
+
readonly gem: typeof PROTOCOL;
|
|
266
|
+
readonly type: "gem.progress";
|
|
267
|
+
readonly loaded: number;
|
|
268
|
+
readonly total: number;
|
|
269
|
+
}
|
|
270
|
+
interface GemRequestToken {
|
|
271
|
+
readonly gem: typeof PROTOCOL;
|
|
272
|
+
readonly type: "gem.requestToken";
|
|
273
|
+
readonly requestId: string;
|
|
274
|
+
readonly reason: "initial" | "expiring" | "rejected";
|
|
275
|
+
}
|
|
276
|
+
interface GemRequestLocalServer {
|
|
277
|
+
readonly gem: typeof PROTOCOL;
|
|
278
|
+
readonly type: "gem.requestLocalServer";
|
|
279
|
+
readonly requestId: string;
|
|
280
|
+
readonly gameRoomId: string;
|
|
281
|
+
}
|
|
282
|
+
interface GemLocalServer {
|
|
283
|
+
readonly gem: typeof PROTOCOL;
|
|
284
|
+
readonly type: "gem.localServer";
|
|
285
|
+
readonly requestId: string;
|
|
286
|
+
readonly serverId?: string;
|
|
287
|
+
}
|
|
288
|
+
interface GemLocalServerDenied {
|
|
289
|
+
readonly gem: typeof PROTOCOL;
|
|
290
|
+
readonly type: "gem.localServer.denied";
|
|
291
|
+
readonly requestId: string;
|
|
292
|
+
readonly retryable: boolean;
|
|
293
|
+
readonly reason: "refused" | "unavailable";
|
|
294
|
+
}
|
|
295
|
+
interface GemExit {
|
|
296
|
+
readonly gem: typeof PROTOCOL;
|
|
297
|
+
readonly type: "gem.exit";
|
|
298
|
+
readonly reason?: string;
|
|
299
|
+
}
|
|
300
|
+
interface GemOpenExternal {
|
|
301
|
+
readonly gem: typeof PROTOCOL;
|
|
302
|
+
readonly type: "gem.openExternal";
|
|
303
|
+
readonly url: string;
|
|
304
|
+
}
|
|
305
|
+
interface GemRequestFullscreen {
|
|
306
|
+
readonly gem: typeof PROTOCOL;
|
|
307
|
+
readonly type: "gem.requestFullscreen";
|
|
308
|
+
readonly enabled: boolean;
|
|
309
|
+
}
|
|
310
|
+
interface GemAudioState {
|
|
311
|
+
readonly gem: typeof PROTOCOL;
|
|
312
|
+
readonly type: "gem.audioState";
|
|
313
|
+
readonly muted: boolean;
|
|
314
|
+
}
|
|
315
|
+
interface GemRewardCue {
|
|
316
|
+
readonly gem: typeof PROTOCOL;
|
|
317
|
+
readonly type: "gem.rewardCue";
|
|
318
|
+
readonly currencySlug: string;
|
|
319
|
+
readonly expected?: number;
|
|
320
|
+
readonly origin?: {
|
|
321
|
+
x: number;
|
|
322
|
+
y: number;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
interface GemFrameStats {
|
|
326
|
+
readonly gem: typeof PROTOCOL;
|
|
327
|
+
readonly type: "gem.frameStats";
|
|
328
|
+
readonly fps: number;
|
|
329
|
+
readonly frameTimeP95Ms: number;
|
|
330
|
+
}
|
|
331
|
+
interface GemError {
|
|
332
|
+
readonly gem: typeof PROTOCOL;
|
|
333
|
+
readonly type: "gem.error";
|
|
334
|
+
readonly code: "version_mismatch" | "handshake_timeout" | "handshake_duplicate" | "invalid_message" | "rate_limited" | "token_unavailable" | "unsupported" | "unsupported_capability" | "internal";
|
|
335
|
+
readonly message?: string;
|
|
336
|
+
}
|
|
337
|
+
interface GemRequestPurchase {
|
|
338
|
+
readonly gem: typeof PROTOCOL;
|
|
339
|
+
readonly type: "gem.requestPurchase";
|
|
340
|
+
readonly requestId: string;
|
|
341
|
+
readonly purchaseKind: "item" | "recipe";
|
|
342
|
+
readonly targetId: string;
|
|
343
|
+
readonly currencySlug: string;
|
|
344
|
+
readonly quantity?: number;
|
|
345
|
+
readonly catalogId?: string;
|
|
346
|
+
}
|
|
347
|
+
interface GemPurchaseResult {
|
|
348
|
+
readonly gem: typeof PROTOCOL;
|
|
349
|
+
readonly type: "gem.purchaseResult";
|
|
350
|
+
readonly requestId: string;
|
|
351
|
+
readonly outcome: "ok" | "declined" | "unavailable";
|
|
352
|
+
readonly purchaseId?: string;
|
|
353
|
+
}
|
|
354
|
+
interface GemDeviceSettingsPut {
|
|
355
|
+
readonly gem: typeof PROTOCOL;
|
|
356
|
+
readonly type: "gem.deviceSettings.put";
|
|
357
|
+
readonly requestId: string;
|
|
358
|
+
readonly settings: unknown;
|
|
359
|
+
}
|
|
360
|
+
interface GemDeviceSettingsResult {
|
|
361
|
+
readonly gem: typeof PROTOCOL;
|
|
362
|
+
readonly type: "gem.deviceSettings.result";
|
|
363
|
+
readonly requestId: string;
|
|
364
|
+
readonly outcome: "stored" | "too_large" | "unavailable";
|
|
365
|
+
}
|
|
366
|
+
interface GemRequestAd {
|
|
367
|
+
readonly gem: typeof PROTOCOL;
|
|
368
|
+
readonly type: "gem.requestAd";
|
|
369
|
+
readonly requestId: string;
|
|
370
|
+
readonly placement: string;
|
|
371
|
+
readonly format: "interstitial" | "rewarded";
|
|
372
|
+
}
|
|
373
|
+
interface GemAdResult {
|
|
374
|
+
readonly gem: typeof PROTOCOL;
|
|
375
|
+
readonly type: "gem.adResult";
|
|
376
|
+
readonly requestId: string;
|
|
377
|
+
readonly outcome: "shown" | "no_ad" | "unavailable";
|
|
378
|
+
}
|
|
379
|
+
interface GemRequestSignIn {
|
|
380
|
+
readonly gem: typeof PROTOCOL;
|
|
381
|
+
readonly type: "gem.requestSignIn";
|
|
382
|
+
readonly requestId: string;
|
|
383
|
+
}
|
|
384
|
+
interface GemSignInResult {
|
|
385
|
+
readonly gem: typeof PROTOCOL;
|
|
386
|
+
readonly type: "gem.signInResult";
|
|
387
|
+
readonly requestId: string;
|
|
388
|
+
readonly outcome: "signed_in" | "declined" | "unavailable";
|
|
389
|
+
}
|
|
390
|
+
type ParentMessage = GemHandshake | GemToken | GemTokenDenied | GemPlayer | GemPause | GemPrefs | GemCohorts | GemViewport | GemDeviceSettings | GemWillTerminate | GemRoomEvent | GemSocketState | GemSeatedEvent | GemSignalEvent | GemDedicatedEvent | GemPartyResult | GemClusterTarget | GemDevtools | GemScreenshot | GemRequestContext | GemLocalServer | GemLocalServerDenied | GemError | GemPurchaseResult | GemDeviceSettingsResult | GemAdResult | GemSignInResult;
|
|
391
|
+
type FrameMessage = GemHandshakeAccept | GemScreenshotDenied | GemGameContext | GemSignal | GemDedicatedOffer | GemPartyRequest | GemReady | GemProgress | GemRequestToken | GemRequestLocalServer | GemExit | GemOpenExternal | GemRequestFullscreen | GemAudioState | GemRewardCue | GemFrameStats | GemError | GemRequestPurchase | GemDeviceSettingsPut | GemRequestAd | GemRequestSignIn;
|
|
392
|
+
type GemMessage = ParentMessage | FrameMessage;
|
|
393
|
+
type Rejection = string | null;
|
|
394
|
+
declare function isOrigin(s: string): boolean;
|
|
395
|
+
declare function validateSize(raw: unknown): Rejection;
|
|
396
|
+
declare const validateGemHandshake: (raw: unknown) => Rejection;
|
|
397
|
+
declare const validateGemHandshakeAccept: (raw: unknown) => Rejection;
|
|
398
|
+
declare const validateGemToken: (raw: unknown) => Rejection;
|
|
399
|
+
declare const validateGemTokenDenied: (raw: unknown) => Rejection;
|
|
400
|
+
declare const validateGemPlayer: (raw: unknown) => Rejection;
|
|
401
|
+
declare const validateGemPause: (raw: unknown) => Rejection;
|
|
402
|
+
declare const validateGemPrefs: (raw: unknown) => Rejection;
|
|
403
|
+
declare const validateGemCohorts: (raw: unknown) => Rejection;
|
|
404
|
+
declare const validateGemViewport: (raw: unknown) => Rejection;
|
|
405
|
+
declare const validateGemDeviceSettings: (raw: unknown) => Rejection;
|
|
406
|
+
declare const validateGemWillTerminate: (raw: unknown) => Rejection;
|
|
407
|
+
declare const validateGemRoomEvent: (raw: unknown) => Rejection;
|
|
408
|
+
declare const validateGemSocketState: (raw: unknown) => Rejection;
|
|
409
|
+
declare const validateGemSeatedEvent: (raw: unknown) => Rejection;
|
|
410
|
+
declare const validateGemSignalEvent: (raw: unknown) => Rejection;
|
|
411
|
+
declare const validateGemDedicatedEvent: (raw: unknown) => Rejection;
|
|
412
|
+
declare const validateGemPartyResult: (raw: unknown) => Rejection;
|
|
413
|
+
declare const validateGemClusterTarget: (raw: unknown) => Rejection;
|
|
414
|
+
declare const validateGemDevtools: (raw: unknown) => Rejection;
|
|
415
|
+
declare const validateGemScreenshot: (raw: unknown) => Rejection;
|
|
416
|
+
declare const validateGemScreenshotDenied: (raw: unknown) => Rejection;
|
|
417
|
+
declare const validateGemRequestContext: (raw: unknown) => Rejection;
|
|
418
|
+
declare const validateGemGameContext: (raw: unknown) => Rejection;
|
|
419
|
+
declare const validateGemSignal: (raw: unknown) => Rejection;
|
|
420
|
+
declare const validateGemDedicatedOffer: (raw: unknown) => Rejection;
|
|
421
|
+
declare const validateGemPartyRequest: (raw: unknown) => Rejection;
|
|
422
|
+
declare const validateGemReady: (raw: unknown) => Rejection;
|
|
423
|
+
declare const validateGemProgress: (raw: unknown) => Rejection;
|
|
424
|
+
declare const validateGemRequestToken: (raw: unknown) => Rejection;
|
|
425
|
+
declare const validateGemRequestLocalServer: (raw: unknown) => Rejection;
|
|
426
|
+
declare const validateGemLocalServer: (raw: unknown) => Rejection;
|
|
427
|
+
declare const validateGemLocalServerDenied: (raw: unknown) => Rejection;
|
|
428
|
+
declare const validateGemExit: (raw: unknown) => Rejection;
|
|
429
|
+
declare const validateGemOpenExternal: (raw: unknown) => Rejection;
|
|
430
|
+
declare const validateGemRequestFullscreen: (raw: unknown) => Rejection;
|
|
431
|
+
declare const validateGemAudioState: (raw: unknown) => Rejection;
|
|
432
|
+
declare const validateGemRewardCue: (raw: unknown) => Rejection;
|
|
433
|
+
declare const validateGemFrameStats: (raw: unknown) => Rejection;
|
|
434
|
+
declare const validateGemError: (raw: unknown) => Rejection;
|
|
435
|
+
declare const validateGemRequestPurchase: (raw: unknown) => Rejection;
|
|
436
|
+
declare const validateGemPurchaseResult: (raw: unknown) => Rejection;
|
|
437
|
+
declare const validateGemDeviceSettingsPut: (raw: unknown) => Rejection;
|
|
438
|
+
declare const validateGemDeviceSettingsResult: (raw: unknown) => Rejection;
|
|
439
|
+
declare const validateGemRequestAd: (raw: unknown) => Rejection;
|
|
440
|
+
declare const validateGemAdResult: (raw: unknown) => Rejection;
|
|
441
|
+
declare const validateGemRequestSignIn: (raw: unknown) => Rejection;
|
|
442
|
+
declare const validateGemSignInResult: (raw: unknown) => Rejection;
|
|
443
|
+
declare const VALIDATORS: Readonly<Record<string, (raw: unknown) => Rejection>>;
|
|
444
|
+
interface OfferRefusal {
|
|
445
|
+
readonly reason: string;
|
|
446
|
+
}
|
|
447
|
+
declare function buildDedicatedOfferFrame(matchId: string, gameId: string, data: unknown): {
|
|
448
|
+
frame: Record<string, unknown>;
|
|
449
|
+
} | OfferRefusal;
|
|
450
|
+
declare const INBOUND_EVENTS: Readonly<Record<string, string>>;
|
|
451
|
+
interface RelayedDedicatedEvent {
|
|
452
|
+
readonly event: string;
|
|
453
|
+
readonly matchId: string;
|
|
454
|
+
readonly sdp?: string;
|
|
455
|
+
readonly sessionId?: string;
|
|
456
|
+
readonly code?: string;
|
|
457
|
+
readonly message?: string;
|
|
458
|
+
readonly reason?: string;
|
|
459
|
+
}
|
|
460
|
+
declare function projectDedicatedEvent(raw: unknown, gameId: string, knowsMatch: (matchId: string) => boolean): RelayedDedicatedEvent | null;
|
|
461
|
+
declare const MAX_SOCKET_FRAME_BYTES = 16384;
|
|
462
|
+
declare const MAX_SIGNALS_PER_SECOND = 24;
|
|
463
|
+
interface SignalRefusal {
|
|
464
|
+
readonly reason: string;
|
|
465
|
+
}
|
|
466
|
+
declare function buildSocketFrame(signal: string, matchId: string, gameId: string, data: unknown): {
|
|
467
|
+
frame: Record<string, unknown>;
|
|
468
|
+
} | SignalRefusal;
|
|
469
|
+
interface RelayedSignal {
|
|
470
|
+
readonly event: string;
|
|
471
|
+
readonly matchId: string;
|
|
472
|
+
readonly data: Record<string, unknown>;
|
|
473
|
+
}
|
|
474
|
+
declare function projectSignal(raw: unknown, gameId: string, knowsMatch: (matchId: string) => boolean): RelayedSignal | null;
|
|
475
|
+
interface PartyEventRelay {
|
|
476
|
+
readonly event: string;
|
|
477
|
+
readonly partyId: string;
|
|
478
|
+
readonly version?: number;
|
|
479
|
+
readonly gameRoomId?: string;
|
|
480
|
+
readonly gameId?: string;
|
|
481
|
+
readonly inviterPlayerId?: string;
|
|
482
|
+
readonly inviterDisplayTag?: string;
|
|
483
|
+
readonly partyName?: string;
|
|
484
|
+
}
|
|
485
|
+
declare function projectPartyEvent(raw: unknown): PartyEventRelay | null;
|
|
486
|
+
type PortMessageHandler = {
|
|
487
|
+
handle(event: {
|
|
488
|
+
data: unknown;
|
|
489
|
+
ports?: ReadonlyArray<MessagePort>;
|
|
490
|
+
}): void;
|
|
491
|
+
}["handle"];
|
|
492
|
+
interface PortLike {
|
|
493
|
+
postMessage(data: unknown, transfer?: unknown[]): void;
|
|
494
|
+
close(): void;
|
|
495
|
+
onmessage: PortMessageHandler | null;
|
|
496
|
+
start?(): void;
|
|
497
|
+
}
|
|
498
|
+
interface WindowLike {
|
|
499
|
+
postMessage(data: unknown, targetOrigin: string, transfer?: unknown[]): void;
|
|
500
|
+
}
|
|
501
|
+
interface HandshakeEvent {
|
|
502
|
+
readonly data: unknown;
|
|
503
|
+
readonly origin: string;
|
|
504
|
+
readonly source?: unknown;
|
|
505
|
+
readonly ports?: readonly PortLike[];
|
|
506
|
+
}
|
|
507
|
+
interface Clock {
|
|
508
|
+
now(): number;
|
|
509
|
+
setTimeout(fn: () => void, ms: number): unknown;
|
|
510
|
+
clearTimeout(handle: unknown): void;
|
|
511
|
+
}
|
|
512
|
+
declare const systemClock: Clock;
|
|
513
|
+
declare class RateLimiter {
|
|
514
|
+
private readonly clock;
|
|
515
|
+
private readonly tokens;
|
|
516
|
+
private readonly lastRefill;
|
|
517
|
+
constructor(clock?: Clock);
|
|
518
|
+
allow(type: string): boolean;
|
|
519
|
+
}
|
|
520
|
+
declare function originsEqual(a: string, b: string): boolean;
|
|
521
|
+
declare function negotiateVersion(ours: {
|
|
522
|
+
min: number;
|
|
523
|
+
max: number;
|
|
524
|
+
}, theirs: {
|
|
525
|
+
min: number;
|
|
526
|
+
max: number;
|
|
527
|
+
}): number | null;
|
|
528
|
+
interface TokenGrant {
|
|
529
|
+
readonly token: string;
|
|
530
|
+
readonly expiresAt: number;
|
|
531
|
+
readonly chainEndsAt: number;
|
|
532
|
+
readonly generation: number;
|
|
533
|
+
readonly playerId: string;
|
|
534
|
+
readonly gameId: string;
|
|
535
|
+
readonly channel: "dev" | "test" | "release";
|
|
536
|
+
readonly gameVersion?: string;
|
|
537
|
+
readonly requestId?: string;
|
|
538
|
+
readonly apiBaseUrl?: string;
|
|
539
|
+
readonly allowDevTools?: boolean;
|
|
540
|
+
readonly garden?: string;
|
|
541
|
+
}
|
|
542
|
+
interface TokenDenial {
|
|
543
|
+
readonly requestId: string;
|
|
544
|
+
readonly retryable: boolean;
|
|
545
|
+
readonly reason: "chain_exhausted" | "unavailable";
|
|
546
|
+
readonly correlationId: string;
|
|
547
|
+
readonly retryAfterMs?: number;
|
|
548
|
+
}
|
|
549
|
+
interface LocalServerGrant {
|
|
550
|
+
readonly requestId: string;
|
|
551
|
+
readonly serverId?: string;
|
|
552
|
+
}
|
|
553
|
+
interface LocalServerDenial {
|
|
554
|
+
readonly requestId: string;
|
|
555
|
+
readonly retryable: boolean;
|
|
556
|
+
readonly reason: "refused" | "unavailable";
|
|
557
|
+
}
|
|
558
|
+
interface PlayerIdentity {
|
|
559
|
+
readonly untrusted: {
|
|
560
|
+
readonly displayName: string;
|
|
561
|
+
readonly displayHandle: string;
|
|
562
|
+
};
|
|
563
|
+
readonly displayTag: string;
|
|
564
|
+
readonly avatarUrl?: string;
|
|
565
|
+
}
|
|
566
|
+
interface RoomEventRelay {
|
|
567
|
+
readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
|
|
568
|
+
readonly roomId: string;
|
|
569
|
+
readonly matchId?: string;
|
|
570
|
+
readonly version?: number;
|
|
571
|
+
readonly reason?: string;
|
|
572
|
+
readonly platform?: GemRoomEvent["platform"];
|
|
573
|
+
}
|
|
574
|
+
type RelayDestination = "room" | "signal" | "dedicated" | "party";
|
|
575
|
+
type HostState = "idle" | "handshaking" | "connected" | "unsupported" | "closed";
|
|
576
|
+
interface HostCallbacks {
|
|
577
|
+
onReady?(): void;
|
|
578
|
+
onProgress?(msg: GemProgress): void;
|
|
579
|
+
onRequestToken?(msg: GemRequestToken): void;
|
|
580
|
+
onRequestLocalServer?(msg: GemRequestLocalServer): void;
|
|
581
|
+
onExit?(msg: GemExit): void;
|
|
582
|
+
onOpenExternal?(msg: GemOpenExternal): void;
|
|
583
|
+
onRequestFullscreen?(msg: GemRequestFullscreen): void;
|
|
584
|
+
onAudioState?(msg: GemAudioState): void;
|
|
585
|
+
onRewardCue?(msg: GemRewardCue): void;
|
|
586
|
+
onFrameStats?(msg: GemFrameStats): void;
|
|
587
|
+
onScreenshotDenied?(msg: GemScreenshotDenied): void;
|
|
588
|
+
onGameContext?(msg: GemGameContext): void;
|
|
589
|
+
onSendSignal?(frame: Record<string, unknown>): void;
|
|
590
|
+
onPartyRequest?(msg: GemPartyRequest): void;
|
|
591
|
+
onRequestPurchase?(msg: GemRequestPurchase): void;
|
|
592
|
+
onDeviceSettingsPut?(msg: GemDeviceSettingsPut): void;
|
|
593
|
+
onRequestAd?(msg: GemRequestAd): void;
|
|
594
|
+
onRequestSignIn?(msg: GemRequestSignIn): void;
|
|
595
|
+
onPartyEvent?(event: PartyEventRelay): void;
|
|
596
|
+
onError?(code: GemErrorCode, message?: string): void;
|
|
597
|
+
onDropped?(code: GemErrorCode, message?: string): void;
|
|
598
|
+
onStateChange?(state: HostState): void;
|
|
599
|
+
}
|
|
600
|
+
interface HostOptions extends HostCallbacks {
|
|
601
|
+
frame: WindowLike;
|
|
602
|
+
frameOrigin: string;
|
|
603
|
+
embedderOrigin: string;
|
|
604
|
+
capabilities?: readonly string[];
|
|
605
|
+
clock?: Clock;
|
|
606
|
+
}
|
|
607
|
+
declare class GemHost {
|
|
608
|
+
private readonly options;
|
|
609
|
+
private state;
|
|
610
|
+
private port;
|
|
611
|
+
private version;
|
|
612
|
+
private timeoutHandle;
|
|
613
|
+
private reofferHandle;
|
|
614
|
+
private makeChannel;
|
|
615
|
+
private readonly offered;
|
|
616
|
+
private offersMade;
|
|
617
|
+
private localDenials;
|
|
618
|
+
private chainEndsAt;
|
|
619
|
+
private gameId;
|
|
620
|
+
private peerCapabilities;
|
|
621
|
+
private readonly knownMatches;
|
|
622
|
+
private readonly askedMatches;
|
|
623
|
+
private readonly clock;
|
|
624
|
+
private readonly inbound;
|
|
625
|
+
private readonly outbound;
|
|
626
|
+
private readonly socketWindow;
|
|
627
|
+
constructor(options: HostOptions);
|
|
628
|
+
get currentState(): HostState;
|
|
629
|
+
get frameCapabilities(): readonly string[];
|
|
630
|
+
frameSupports(capability: string): boolean;
|
|
631
|
+
get protocolVersion(): number | null;
|
|
632
|
+
start(makeChannel?: (() => {
|
|
633
|
+
port1: PortLike;
|
|
634
|
+
port2: PortLike;
|
|
635
|
+
}) | {
|
|
636
|
+
port1: PortLike;
|
|
637
|
+
port2: PortLike;
|
|
638
|
+
}): void;
|
|
639
|
+
private offer;
|
|
640
|
+
private scheduleReoffer;
|
|
641
|
+
private pruneStaleOffers;
|
|
642
|
+
private adopt;
|
|
643
|
+
static checkHandshakeOrigin(event: HandshakeEvent, expectedOrigin: string, expectedSource: unknown): string | null;
|
|
644
|
+
sendToken(grant: TokenGrant): void;
|
|
645
|
+
relayRoomEvent(raw: unknown): boolean;
|
|
646
|
+
sendRoomEvent(relay: RoomEventRelay): boolean;
|
|
647
|
+
sendSocketState(state: {
|
|
648
|
+
readonly connected: true;
|
|
649
|
+
} | {
|
|
650
|
+
readonly connected: false;
|
|
651
|
+
readonly reason: GemSocketState["reason"];
|
|
652
|
+
}): boolean;
|
|
653
|
+
sendSeatedEvent(roomId: string): boolean;
|
|
654
|
+
relaySeatedEvent(raw: unknown): boolean;
|
|
655
|
+
relaySocketEvent(raw: unknown): readonly RelayDestination[];
|
|
656
|
+
relaySignalEvent(raw: unknown): boolean;
|
|
657
|
+
sendSignalEvent(relay: RelayedSignal): boolean;
|
|
658
|
+
relayDedicatedEvent(raw: unknown): boolean;
|
|
659
|
+
sendDedicatedEvent(relay: RelayedDedicatedEvent): boolean;
|
|
660
|
+
private knowsMatch;
|
|
661
|
+
private rememberMatch;
|
|
662
|
+
private rememberAsked;
|
|
663
|
+
answerPartyRequest(requestId: string, partyId?: string): boolean;
|
|
664
|
+
answerPurchase(requestId: string, outcome: "ok" | "declined" | "unavailable", purchaseId?: string): boolean;
|
|
665
|
+
answerDeviceSettingsPut(requestId: string, outcome: "stored" | "too_large" | "unavailable"): boolean;
|
|
666
|
+
sendDeviceSettings(settings?: Readonly<Record<string, unknown>>): boolean;
|
|
667
|
+
answerAd(requestId: string, outcome: "shown" | "no_ad" | "unavailable"): boolean;
|
|
668
|
+
answerSignIn(requestId: string, outcome: "signed_in" | "declined" | "unavailable"): boolean;
|
|
669
|
+
denyToken(denial: TokenDenial): void;
|
|
670
|
+
grantLocalServer(grant: LocalServerGrant): boolean;
|
|
671
|
+
denyLocalServer(denial: LocalServerDenial): boolean;
|
|
672
|
+
sendClusterTarget(clusterTargetId: string): boolean;
|
|
673
|
+
sendPlayer(player: PlayerIdentity): void;
|
|
674
|
+
private chainExpired;
|
|
675
|
+
private localCorrelationId;
|
|
676
|
+
sendPause(paused: boolean): void;
|
|
677
|
+
sendDevtools(action: "open" | "close" | "toggle"): void;
|
|
678
|
+
requestScreenshot(port: MessagePort, caps: {
|
|
679
|
+
maxWidth: number;
|
|
680
|
+
maxHeight: number;
|
|
681
|
+
}): boolean;
|
|
682
|
+
requestContext(): boolean;
|
|
683
|
+
sendPrefs(prefs: {
|
|
684
|
+
reducedMotion: boolean;
|
|
685
|
+
muted: boolean;
|
|
686
|
+
locale: string;
|
|
687
|
+
showFrameStats?: boolean;
|
|
688
|
+
}): void;
|
|
689
|
+
sendCohorts(cohorts: ReadonlyArray<{
|
|
690
|
+
experimentId: string;
|
|
691
|
+
variantKey: string;
|
|
692
|
+
}>): boolean;
|
|
693
|
+
sendViewport(viewport: {
|
|
694
|
+
insets: {
|
|
695
|
+
top: number;
|
|
696
|
+
right: number;
|
|
697
|
+
bottom: number;
|
|
698
|
+
left: number;
|
|
699
|
+
};
|
|
700
|
+
}): boolean;
|
|
701
|
+
sendWillTerminate(reason: "grant_expiring" | "session_ended" | "navigating" | "kill_switch", graceMs: number): void;
|
|
702
|
+
close(): void;
|
|
703
|
+
private transition;
|
|
704
|
+
private fail;
|
|
705
|
+
private send;
|
|
706
|
+
private receive;
|
|
707
|
+
private refuseMalformed;
|
|
708
|
+
private versionMatches;
|
|
709
|
+
private forwardSignal;
|
|
710
|
+
private forwardDedicatedOffer;
|
|
711
|
+
private withinFrameSize;
|
|
712
|
+
private dispatch;
|
|
713
|
+
}
|
|
714
|
+
declare class PlayerText {
|
|
715
|
+
#private;
|
|
716
|
+
constructor(value: string);
|
|
717
|
+
toString(): string;
|
|
718
|
+
toJSON(): string;
|
|
719
|
+
get [Symbol.toStringTag](): string;
|
|
720
|
+
static unwrap(t: PlayerText): string;
|
|
721
|
+
}
|
|
722
|
+
declare function asPlayerText(value: string): PlayerText;
|
|
723
|
+
declare const text: {
|
|
724
|
+
toPlain(t: PlayerText): string;
|
|
725
|
+
compare(a: PlayerText | string, b: PlayerText | string, locale?: string): number;
|
|
726
|
+
equals(a: PlayerText | string, b: PlayerText | string): boolean;
|
|
727
|
+
};
|
|
728
|
+
type ClusterTargetLike = string | null | undefined;
|
|
729
|
+
type ClusterTargetResolver = () => Promise<ClusterTargetLike>;
|
|
730
|
+
declare function normaliseClusterTarget(value: ClusterTargetLike): string | undefined;
|
|
731
|
+
interface ClusterTargetBridge {
|
|
732
|
+
parentSupports(capability: string): boolean;
|
|
733
|
+
}
|
|
734
|
+
interface ClusterTargetSourceOptions {
|
|
735
|
+
readonly bridge: ClusterTargetBridge;
|
|
736
|
+
readonly clock: Clock;
|
|
737
|
+
readonly timeoutMs?: number;
|
|
738
|
+
}
|
|
739
|
+
interface ClusterTargetSource {
|
|
740
|
+
resolve: ClusterTargetResolver;
|
|
741
|
+
accept(clusterTargetId: ClusterTargetLike): void;
|
|
742
|
+
}
|
|
743
|
+
declare function createClusterTargetSource(options: ClusterTargetSourceOptions): ClusterTargetSource;
|
|
744
|
+
interface RewardCue {
|
|
745
|
+
currencySlug: string;
|
|
746
|
+
expected?: number;
|
|
747
|
+
origin?: {
|
|
748
|
+
x: number;
|
|
749
|
+
y: number;
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
type FrameState = "waiting" | "connected" | "refused" | "closed";
|
|
753
|
+
interface FrameCallbacks {
|
|
754
|
+
onToken?(msg: GemToken): void;
|
|
755
|
+
onPause?(msg: GemPause): void;
|
|
756
|
+
onPrefs?(msg: GemPrefs): void;
|
|
757
|
+
onCohorts?(msg: GemCohorts): void;
|
|
758
|
+
onViewport?(msg: GemViewport): void;
|
|
759
|
+
onWillTerminate?(msg: GemWillTerminate): void;
|
|
760
|
+
onDevtools?(action: "open" | "close" | "toggle"): void;
|
|
761
|
+
onScreenshot?(request: {
|
|
762
|
+
maxWidth: number;
|
|
763
|
+
maxHeight: number;
|
|
764
|
+
}, port: MessagePort, deny: (reason: GemScreenshotDenied["reason"], retryable: boolean) => void): void;
|
|
765
|
+
onRequestContext?(): void;
|
|
766
|
+
onTokenDenied?(msg: GemTokenDenied): void;
|
|
767
|
+
onLocalServer?(msg: GemLocalServer): void;
|
|
768
|
+
onLocalServerDenied?(msg: GemLocalServerDenied): void;
|
|
769
|
+
onPlayer?(player: {
|
|
770
|
+
displayName: PlayerText;
|
|
771
|
+
displayHandle: PlayerText;
|
|
772
|
+
displayTag: string;
|
|
773
|
+
avatarUrl?: string;
|
|
774
|
+
}): void;
|
|
775
|
+
onRoomEvent?(msg: GemRoomEvent): void;
|
|
776
|
+
onSeatedEvent?(msg: GemSeatedEvent): void;
|
|
777
|
+
onSocketState?(msg: GemSocketState): void;
|
|
778
|
+
onSignalEvent?(msg: GemSignalEvent): void;
|
|
779
|
+
onDedicatedEvent?(msg: GemDedicatedEvent): void;
|
|
780
|
+
onClusterTarget?(msg: GemClusterTarget): void;
|
|
781
|
+
onPartyResult?(msg: GemPartyResult): void;
|
|
782
|
+
onPurchaseResult?(msg: GemPurchaseResult): void;
|
|
783
|
+
onDeviceSettings?(msg: GemDeviceSettings): void;
|
|
784
|
+
onDeviceSettingsResult?(msg: GemDeviceSettingsResult): void;
|
|
785
|
+
onAdResult?(msg: GemAdResult): void;
|
|
786
|
+
onSignInResult?(msg: GemSignInResult): void;
|
|
787
|
+
onError?(code: GemErrorCode, message?: string): void;
|
|
788
|
+
onDropped?(code: GemErrorCode, message?: string): void;
|
|
789
|
+
onStateChange?(state: FrameState): void;
|
|
790
|
+
onRefused?(reason: string): void;
|
|
791
|
+
}
|
|
792
|
+
interface FrameOptions extends FrameCallbacks {
|
|
793
|
+
allowedEmbedders: readonly string[];
|
|
794
|
+
selfOrigin?: string;
|
|
795
|
+
expectedSource: unknown;
|
|
796
|
+
capabilities?: readonly string[];
|
|
797
|
+
clock?: Clock;
|
|
798
|
+
}
|
|
799
|
+
declare class GemFrame {
|
|
800
|
+
private readonly options;
|
|
801
|
+
private state;
|
|
802
|
+
private port;
|
|
803
|
+
private version;
|
|
804
|
+
private peerCapabilities;
|
|
805
|
+
private readyPending;
|
|
806
|
+
private readySent;
|
|
807
|
+
private settleWaiters;
|
|
808
|
+
private readonly clock;
|
|
809
|
+
private readonly inbound;
|
|
810
|
+
private readonly outbound;
|
|
811
|
+
private readonly expectedSource;
|
|
812
|
+
constructor(options: FrameOptions);
|
|
813
|
+
get currentState(): FrameState;
|
|
814
|
+
get parentCapabilities(): readonly string[];
|
|
815
|
+
parentSupports(capability: string): boolean;
|
|
816
|
+
get protocolVersion(): number | null;
|
|
817
|
+
handleWindowMessage(event: HandshakeEvent): boolean;
|
|
818
|
+
ready(): void;
|
|
819
|
+
settled(timeoutMs?: number): Promise<FrameState>;
|
|
820
|
+
progress(loaded: number, total: number): void;
|
|
821
|
+
requestToken(requestId: string, reason: "initial" | "expiring" | "rejected"): void;
|
|
822
|
+
requestLocalServer(requestId: string, gameRoomId: string): boolean;
|
|
823
|
+
exit(reason?: string): void;
|
|
824
|
+
openExternal(url: string): void;
|
|
825
|
+
requestFullscreen(enabled: boolean): void;
|
|
826
|
+
reportMuted(muted: boolean): boolean;
|
|
827
|
+
cueReward(cue: RewardCue): boolean;
|
|
828
|
+
reportFrameStats(stats: {
|
|
829
|
+
fps: number;
|
|
830
|
+
frameTimeP95Ms: number;
|
|
831
|
+
}): boolean;
|
|
832
|
+
sendGameContext(context: Record<string, unknown>): boolean;
|
|
833
|
+
signal(signal: string, matchId: string, data: Record<string, unknown>): void;
|
|
834
|
+
dedicatedOffer(matchId: string, sdp: string, intent: GemDedicatedOffer["intent"]): void;
|
|
835
|
+
requestParty(requestId: string): boolean;
|
|
836
|
+
requestPurchase(requestId: string, purchaseKind: "item" | "recipe", targetId: string, currencySlug: string, quantity?: number, catalogId?: string): boolean;
|
|
837
|
+
putDeviceSettings(requestId: string, settings: Readonly<Record<string, unknown>>): boolean;
|
|
838
|
+
requestAd(requestId: string, placement: string, format: "interstitial" | "rewarded"): boolean;
|
|
839
|
+
requestSignIn(requestId: string): boolean;
|
|
840
|
+
close(): void;
|
|
841
|
+
private transition;
|
|
842
|
+
private refuseMalformed;
|
|
843
|
+
private dropUnknownType;
|
|
844
|
+
private refuse;
|
|
845
|
+
private fail;
|
|
846
|
+
private send;
|
|
847
|
+
private receive;
|
|
848
|
+
private dispatchInbound;
|
|
849
|
+
private screenshotDenied;
|
|
850
|
+
}
|
|
851
|
+
declare const DEVICE_SETTINGS_MAX_BYTES = 16384;
|
|
852
|
+
declare function deviceSettingsByteLength(settings: unknown): number | null;
|
|
853
|
+
declare const CONDITIONAL_HEADERS: readonly [
|
|
854
|
+
"if-match",
|
|
855
|
+
"if-none-match"
|
|
856
|
+
];
|
|
857
|
+
type ConditionalRequestHeaders = Partial<Record<(typeof CONDITIONAL_HEADERS)[number], string>>;
|
|
858
|
+
interface TransportRequest {
|
|
859
|
+
readonly method: "GET" | "PUT" | "POST" | "PATCH" | "DELETE";
|
|
860
|
+
readonly path: string;
|
|
861
|
+
readonly body?: unknown;
|
|
862
|
+
readonly headers?: ConditionalRequestHeaders;
|
|
863
|
+
readonly signal?: AbortSignal;
|
|
864
|
+
readonly keepalive?: boolean;
|
|
865
|
+
}
|
|
866
|
+
interface TransportResponse {
|
|
867
|
+
readonly status: number;
|
|
868
|
+
readonly body: unknown;
|
|
869
|
+
readonly etag?: string;
|
|
870
|
+
readonly retryAfterSeconds?: number;
|
|
871
|
+
}
|
|
872
|
+
interface Transport {
|
|
873
|
+
request(request: TransportRequest): Promise<TransportResponse>;
|
|
874
|
+
}
|
|
875
|
+
interface ClientOptions {
|
|
876
|
+
readonly transport: Transport;
|
|
877
|
+
readonly clock: Clock;
|
|
878
|
+
readonly maxRetries?: number;
|
|
879
|
+
}
|
|
880
|
+
interface RequestOptions {
|
|
881
|
+
readonly keepalive?: boolean;
|
|
882
|
+
readonly ifMatch?: string;
|
|
883
|
+
readonly replaySafe?: boolean;
|
|
884
|
+
}
|
|
885
|
+
interface VersionedGetOptions {
|
|
886
|
+
readonly signal?: AbortSignal;
|
|
887
|
+
readonly ifNoneMatch?: string;
|
|
888
|
+
}
|
|
889
|
+
type VersionedResponse<T> = {
|
|
890
|
+
readonly modified: true;
|
|
891
|
+
readonly body: T;
|
|
892
|
+
readonly etag?: string;
|
|
893
|
+
} | {
|
|
894
|
+
readonly modified: false;
|
|
895
|
+
readonly etag?: string;
|
|
896
|
+
};
|
|
897
|
+
declare class GemClient {
|
|
898
|
+
private readonly options;
|
|
899
|
+
constructor(options: ClientOptions);
|
|
900
|
+
get<T>(path: string, signal?: AbortSignal): Promise<T>;
|
|
901
|
+
getWithEtag<T>(path: string, options?: VersionedGetOptions): Promise<VersionedResponse<T>>;
|
|
902
|
+
put<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
|
|
903
|
+
post<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
|
|
904
|
+
patch<T>(path: string, body: unknown, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
|
|
905
|
+
delete<T>(path: string, signal?: AbortSignal, options?: RequestOptions): Promise<T>;
|
|
906
|
+
private send;
|
|
907
|
+
private sendRaw;
|
|
908
|
+
private backoff;
|
|
909
|
+
}
|
|
910
|
+
type TransportLabel = "p2p" | "dedicated" | "unknown";
|
|
911
|
+
declare const TRANSPORT_LABELS: readonly TransportLabel[];
|
|
912
|
+
declare const TELEMETRY_EVENTS: readonly string[];
|
|
913
|
+
interface TelemetrySample {
|
|
914
|
+
readonly type: string;
|
|
915
|
+
readonly value?: number;
|
|
916
|
+
readonly transport?: TransportLabel;
|
|
917
|
+
}
|
|
918
|
+
interface ClientTelemetryOptions {
|
|
919
|
+
readonly client: GemClient;
|
|
920
|
+
readonly gameId: () => string | null;
|
|
921
|
+
readonly transport?: TransportLabel;
|
|
922
|
+
readonly now?: () => number;
|
|
923
|
+
}
|
|
924
|
+
declare class ClientTelemetry {
|
|
925
|
+
private readonly options;
|
|
926
|
+
constructor(options: ClientTelemetryOptions);
|
|
927
|
+
post(samples: readonly TelemetrySample[], signal?: AbortSignal): Promise<void>;
|
|
928
|
+
report(samples: readonly TelemetrySample[]): void;
|
|
929
|
+
}
|
|
930
|
+
type MatchEndedReason = "explicit" | "stale_cleanup" | "game_room_closed" | "replaced" | "migration_failed" | "host_left" | "insufficient_players" | "all_left" | "expired" | "migration_rate_exceeded" | "game_room_gone" | "failed" | "idle" | "reclaimed";
|
|
931
|
+
declare const WEBRTC_DEDICATED = "webrtc_dedicated";
|
|
932
|
+
declare const CLIENT_PLATFORMS: readonly [
|
|
933
|
+
"universal",
|
|
934
|
+
"mobile",
|
|
935
|
+
"web"
|
|
936
|
+
];
|
|
937
|
+
type ClientPlatform = (typeof CLIENT_PLATFORMS)[number];
|
|
938
|
+
interface ClientVersion {
|
|
939
|
+
readonly platform?: ClientPlatform;
|
|
940
|
+
readonly gameVersion: string;
|
|
941
|
+
readonly engineVersion?: string;
|
|
942
|
+
}
|
|
943
|
+
type ResolvedClientVersion = ClientVersion & {
|
|
944
|
+
readonly platform: ClientPlatform;
|
|
945
|
+
readonly engineVersion: string;
|
|
946
|
+
};
|
|
947
|
+
interface StartedMatch$1 {
|
|
948
|
+
readonly matchId: string;
|
|
949
|
+
readonly status: string;
|
|
950
|
+
}
|
|
951
|
+
interface ReadyMatch {
|
|
952
|
+
readonly status: "ready";
|
|
953
|
+
readonly matchId: string;
|
|
954
|
+
readonly protocol: string;
|
|
955
|
+
readonly joinCredential?: string;
|
|
956
|
+
readonly credentialExpiresAt?: number;
|
|
957
|
+
readonly host?: string;
|
|
958
|
+
readonly port?: number;
|
|
959
|
+
}
|
|
960
|
+
interface FailedMatch {
|
|
961
|
+
readonly status: "failed";
|
|
962
|
+
readonly matchId: string;
|
|
963
|
+
readonly reason: string;
|
|
964
|
+
}
|
|
965
|
+
interface EndedMatch {
|
|
966
|
+
readonly status: "ended";
|
|
967
|
+
readonly matchId: string;
|
|
968
|
+
readonly reason: MatchEndedReason | "unknown";
|
|
969
|
+
}
|
|
970
|
+
type MatchOutcome = ReadyMatch | FailedMatch | EndedMatch;
|
|
971
|
+
interface AllocationTarget {
|
|
972
|
+
readonly client: GemClient;
|
|
973
|
+
readonly gameId: string;
|
|
974
|
+
readonly roomId: string;
|
|
975
|
+
}
|
|
976
|
+
interface StartMatchOptions$1 extends AllocationTarget {
|
|
977
|
+
readonly clusterTargetId?: ClusterTargetLike;
|
|
978
|
+
readonly clock?: Clock;
|
|
979
|
+
readonly retry?: StartMatchRetryOptions;
|
|
980
|
+
readonly signal?: AbortSignal;
|
|
981
|
+
}
|
|
982
|
+
interface StartMatchWaiting {
|
|
983
|
+
readonly attempt: number;
|
|
984
|
+
readonly elapsedMs: number;
|
|
985
|
+
readonly budgetMs: number;
|
|
986
|
+
readonly nextAttemptInMs: number;
|
|
987
|
+
readonly status: number;
|
|
988
|
+
readonly message: string;
|
|
989
|
+
}
|
|
990
|
+
interface StartMatchRetryOptions {
|
|
991
|
+
readonly budgetMs?: number;
|
|
992
|
+
readonly initialDelayMs?: number;
|
|
993
|
+
readonly maxDelayMs?: number;
|
|
994
|
+
readonly onWaiting?: (waiting: StartMatchWaiting) => void;
|
|
995
|
+
}
|
|
996
|
+
declare function startMatch(options: StartMatchOptions$1): Promise<StartedMatch$1>;
|
|
997
|
+
interface MatchOutcomeWaitOptions extends AllocationTarget {
|
|
998
|
+
readonly matchId: string;
|
|
999
|
+
readonly clock: Clock;
|
|
1000
|
+
readonly version: ResolvedClientVersion;
|
|
1001
|
+
readonly timeoutMs?: number;
|
|
1002
|
+
readonly pollIntervalMs?: number;
|
|
1003
|
+
readonly knownToExist?: boolean;
|
|
1004
|
+
readonly signal?: AbortSignal;
|
|
1005
|
+
}
|
|
1006
|
+
declare function awaitMatchOutcome(options: MatchOutcomeWaitOptions): Promise<MatchOutcome>;
|
|
1007
|
+
interface ClusterTargetsOptions {
|
|
1008
|
+
readonly client: GemClient;
|
|
1009
|
+
readonly signal?: AbortSignal;
|
|
1010
|
+
}
|
|
1011
|
+
interface ClusterTarget {
|
|
1012
|
+
readonly id: string;
|
|
1013
|
+
readonly pressure: string;
|
|
1014
|
+
}
|
|
1015
|
+
declare function listClusterTargets(options: ClusterTargetsOptions): Promise<readonly ClusterTarget[]>;
|
|
1016
|
+
type RoomArgScalar = string | number | boolean;
|
|
1017
|
+
type RoomArgValue = RoomArgScalar | readonly RoomArgScalar[];
|
|
1018
|
+
type RoomArgs = Readonly<Record<string, RoomArgValue>>;
|
|
1019
|
+
type RoomArgType = "string" | "int" | "float" | "bool" | (string & {});
|
|
1020
|
+
interface RoomArgEntry {
|
|
1021
|
+
readonly name: string;
|
|
1022
|
+
readonly type: RoomArgType;
|
|
1023
|
+
readonly list: boolean;
|
|
1024
|
+
readonly required: boolean;
|
|
1025
|
+
readonly mutable: boolean;
|
|
1026
|
+
readonly fixed?: RoomArgValue;
|
|
1027
|
+
readonly default?: RoomArgValue;
|
|
1028
|
+
readonly description?: string;
|
|
1029
|
+
readonly allowed?: readonly RoomArgScalar[];
|
|
1030
|
+
readonly min?: number;
|
|
1031
|
+
readonly max?: number;
|
|
1032
|
+
readonly minItems?: number;
|
|
1033
|
+
readonly maxItems?: number;
|
|
1034
|
+
readonly maxLength?: number;
|
|
1035
|
+
}
|
|
1036
|
+
declare function roomArgValuesFromWire(body: unknown): RoomArgs | undefined;
|
|
1037
|
+
declare function roomArgsTemplateFromWire(body: unknown): readonly RoomArgEntry[] | undefined;
|
|
1038
|
+
type DedicatedServerFailure = "timeout" | "aborted" | "allocation_failed" | "no_server_ready" | "start_rate_limited" | "p2p_unavailable" | "unsupported_protocol" | "credential_expired" | "credential_reused" | "join_rate_limited" | "signaling_unavailable" | "signaling_failed" | "offer_refused" | "invalid_sdp" | "media_refused" | "connection_failed" | "join_refused" | "match_ended" | "misconfigured";
|
|
1039
|
+
declare class DedicatedServerError extends Error {
|
|
1040
|
+
readonly reason: DedicatedServerFailure;
|
|
1041
|
+
readonly retryable: boolean;
|
|
1042
|
+
readonly platformCode: string | undefined;
|
|
1043
|
+
constructor(reason: DedicatedServerFailure, message: string, options?: {
|
|
1044
|
+
cause?: unknown;
|
|
1045
|
+
platformCode?: string;
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
type SignalingIntent = "initial" | "ice_restart" | "full_reconnect";
|
|
1049
|
+
interface OfferRequest {
|
|
1050
|
+
readonly matchId: string;
|
|
1051
|
+
readonly sdp: string;
|
|
1052
|
+
readonly intent: SignalingIntent;
|
|
1053
|
+
}
|
|
1054
|
+
interface SignalingAnswer {
|
|
1055
|
+
readonly sdp: string;
|
|
1056
|
+
}
|
|
1057
|
+
interface SignalingChannel {
|
|
1058
|
+
exchange(request: OfferRequest, signal?: AbortSignal): Promise<SignalingAnswer>;
|
|
1059
|
+
close(): void;
|
|
1060
|
+
}
|
|
1061
|
+
declare function unavailableSignaling(): SignalingChannel;
|
|
1062
|
+
type SdpType$1 = "offer" | "answer" | "pranswer" | "rollback";
|
|
1063
|
+
interface SessionDescriptionLike$1 {
|
|
1064
|
+
readonly type: SdpType$1;
|
|
1065
|
+
readonly sdp?: string;
|
|
1066
|
+
}
|
|
1067
|
+
interface DataChannelInitLike$1 {
|
|
1068
|
+
readonly ordered?: boolean;
|
|
1069
|
+
readonly maxRetransmits?: number;
|
|
1070
|
+
}
|
|
1071
|
+
interface EventTargetLike$1 {
|
|
1072
|
+
addEventListener(type: string, listener: (event: unknown) => void): void;
|
|
1073
|
+
removeEventListener(type: string, listener: (event: unknown) => void): void;
|
|
1074
|
+
}
|
|
1075
|
+
interface DataChannelLike$1 extends EventTargetLike$1 {
|
|
1076
|
+
readonly readyState: string;
|
|
1077
|
+
send(data: string | Uint8Array): void;
|
|
1078
|
+
close(): void;
|
|
1079
|
+
}
|
|
1080
|
+
interface PeerConnectionLike$1 extends EventTargetLike$1 {
|
|
1081
|
+
readonly localDescription: SessionDescriptionLike$1 | null;
|
|
1082
|
+
readonly iceGatheringState: string;
|
|
1083
|
+
createDataChannel(label: string, init?: DataChannelInitLike$1): DataChannelLike$1;
|
|
1084
|
+
createOffer(): Promise<SessionDescriptionLike$1>;
|
|
1085
|
+
setLocalDescription(description: SessionDescriptionLike$1): Promise<void>;
|
|
1086
|
+
setRemoteDescription(description: SessionDescriptionLike$1): Promise<void>;
|
|
1087
|
+
close(): void;
|
|
1088
|
+
}
|
|
1089
|
+
interface EstablishOptions {
|
|
1090
|
+
readonly peerConnection: PeerConnectionLike$1;
|
|
1091
|
+
readonly signaling: SignalingChannel;
|
|
1092
|
+
readonly matchId: string;
|
|
1093
|
+
readonly clock: Clock;
|
|
1094
|
+
readonly intent?: SignalingIntent;
|
|
1095
|
+
readonly channelLabel?: string;
|
|
1096
|
+
readonly gatherTimeoutMs?: number;
|
|
1097
|
+
readonly exchangeTimeoutMs?: number;
|
|
1098
|
+
readonly openTimeoutMs?: number;
|
|
1099
|
+
readonly credentialExpiresAt?: number;
|
|
1100
|
+
readonly signal?: AbortSignal;
|
|
1101
|
+
readonly extraChannels?: readonly {
|
|
1102
|
+
readonly label: string;
|
|
1103
|
+
readonly ordered?: boolean;
|
|
1104
|
+
readonly maxRetransmits?: number;
|
|
1105
|
+
}[];
|
|
1106
|
+
readonly onExtraChannel?: (label: string, channel: DataChannelLike$1) => void;
|
|
1107
|
+
}
|
|
1108
|
+
declare function establishDataChannel(options: EstablishOptions): Promise<DataChannelLike$1>;
|
|
1109
|
+
declare const DEFAULT_WELCOME_CEILING_MS = 25000;
|
|
1110
|
+
interface JoinWelcome {
|
|
1111
|
+
readonly playerId?: string;
|
|
1112
|
+
readonly matchId?: string;
|
|
1113
|
+
readonly heartbeatIntervalMs?: number;
|
|
1114
|
+
}
|
|
1115
|
+
interface JoinExchange {
|
|
1116
|
+
readonly welcome: JoinWelcome;
|
|
1117
|
+
detach(): void;
|
|
1118
|
+
}
|
|
1119
|
+
interface PresentCredentialOptions {
|
|
1120
|
+
readonly channel: DataChannelLike$1;
|
|
1121
|
+
readonly credential: string;
|
|
1122
|
+
readonly credentialExpiresAt: number;
|
|
1123
|
+
readonly clock: Clock;
|
|
1124
|
+
readonly ceilingMs?: number;
|
|
1125
|
+
readonly wire?: number;
|
|
1126
|
+
readonly heartbeat?: boolean;
|
|
1127
|
+
readonly onMessage?: (data: unknown) => void;
|
|
1128
|
+
readonly signal?: AbortSignal;
|
|
1129
|
+
}
|
|
1130
|
+
declare function presentJoinCredential(options: PresentCredentialOptions): Promise<JoinExchange>;
|
|
1131
|
+
type TransportKind = "webtransport" | "webrtc" | "websocket";
|
|
1132
|
+
interface SendOptions {
|
|
1133
|
+
readonly reliable?: boolean;
|
|
1134
|
+
readonly ordered?: boolean;
|
|
1135
|
+
}
|
|
1136
|
+
interface MessageMeta {
|
|
1137
|
+
readonly reliable: boolean;
|
|
1138
|
+
readonly ordered: boolean;
|
|
1139
|
+
}
|
|
1140
|
+
interface GameServerLink {
|
|
1141
|
+
readonly transport: TransportKind;
|
|
1142
|
+
send(data: Uint8Array | string, options?: SendOptions): void;
|
|
1143
|
+
onMessage(handler: (data: Uint8Array | string, meta: MessageMeta) => void): void;
|
|
1144
|
+
onClose(handler: (reason?: string) => void): void;
|
|
1145
|
+
close(): void;
|
|
1146
|
+
}
|
|
1147
|
+
type RoomStatus = "open" | "in_game" | "closed" | (string & {});
|
|
1148
|
+
type MatchConnectionState = "disconnected" | "connecting" | "connected" | "suspended";
|
|
1149
|
+
type MatchSessionPhase = "none" | "starting" | "ready" | "connected" | "suspended" | "ended" | (string & {});
|
|
1150
|
+
interface MatchSession {
|
|
1151
|
+
readonly phase: MatchSessionPhase;
|
|
1152
|
+
readonly matchId?: string;
|
|
1153
|
+
readonly reason?: string;
|
|
1154
|
+
readonly roomReopened?: boolean;
|
|
1155
|
+
}
|
|
1156
|
+
interface MatchEnded {
|
|
1157
|
+
readonly matchId: string;
|
|
1158
|
+
readonly reason: string;
|
|
1159
|
+
readonly roomReopened: boolean;
|
|
1160
|
+
}
|
|
1161
|
+
interface MatchSuspended {
|
|
1162
|
+
readonly matchId: string;
|
|
1163
|
+
readonly cause: string;
|
|
1164
|
+
}
|
|
1165
|
+
interface MatchReconnecting {
|
|
1166
|
+
readonly matchId: string;
|
|
1167
|
+
readonly attempt: number;
|
|
1168
|
+
readonly attempts: number;
|
|
1169
|
+
readonly remainingMs: number;
|
|
1170
|
+
}
|
|
1171
|
+
interface MatchReconnected {
|
|
1172
|
+
readonly matchId: string;
|
|
1173
|
+
readonly attempt: number;
|
|
1174
|
+
}
|
|
1175
|
+
interface AutoReconnectOptions {
|
|
1176
|
+
readonly budgetMs?: number;
|
|
1177
|
+
readonly attempts?: number;
|
|
1178
|
+
readonly maxDelayMs?: number;
|
|
1179
|
+
}
|
|
1180
|
+
interface RoomMember {
|
|
1181
|
+
readonly playerId: string;
|
|
1182
|
+
readonly isReady: boolean;
|
|
1183
|
+
readonly role: string;
|
|
1184
|
+
readonly joinedAt: number;
|
|
1185
|
+
readonly groupId?: string;
|
|
1186
|
+
readonly platform?: string;
|
|
1187
|
+
readonly displayName?: PlayerText;
|
|
1188
|
+
readonly displayTag?: PlayerText;
|
|
1189
|
+
readonly discriminator?: string;
|
|
1190
|
+
}
|
|
1191
|
+
interface Room {
|
|
1192
|
+
readonly id: string;
|
|
1193
|
+
readonly gameId: string;
|
|
1194
|
+
readonly name: string;
|
|
1195
|
+
readonly status: RoomStatus;
|
|
1196
|
+
readonly hostPlayerId: string;
|
|
1197
|
+
readonly maxPlayers: number;
|
|
1198
|
+
readonly memberCount: number;
|
|
1199
|
+
readonly members: readonly RoomMember[];
|
|
1200
|
+
readonly isPublic: boolean;
|
|
1201
|
+
readonly joinCode?: string;
|
|
1202
|
+
readonly settings?: unknown;
|
|
1203
|
+
readonly roomArgs?: RoomArgs;
|
|
1204
|
+
readonly roomArgsTemplate?: readonly RoomArgEntry[];
|
|
1205
|
+
readonly gameChannel: string;
|
|
1206
|
+
readonly region?: string;
|
|
1207
|
+
readonly matchId?: string;
|
|
1208
|
+
readonly version: number;
|
|
1209
|
+
readonly templateId?: string;
|
|
1210
|
+
readonly roomType: string;
|
|
1211
|
+
readonly transports?: readonly TransportKind[];
|
|
1212
|
+
readonly createdAt: number;
|
|
1213
|
+
readonly updatedAt: number;
|
|
1214
|
+
readonly startedAt?: number;
|
|
1215
|
+
}
|
|
1216
|
+
interface RoomSummary {
|
|
1217
|
+
readonly id: string;
|
|
1218
|
+
readonly gameId: string;
|
|
1219
|
+
readonly name: string;
|
|
1220
|
+
readonly status: RoomStatus;
|
|
1221
|
+
readonly hostPlayerId: string;
|
|
1222
|
+
readonly maxPlayers: number;
|
|
1223
|
+
readonly memberCount: number;
|
|
1224
|
+
readonly isPublic: boolean;
|
|
1225
|
+
readonly gameChannel: string;
|
|
1226
|
+
readonly roomType: string;
|
|
1227
|
+
readonly createdAt: number;
|
|
1228
|
+
}
|
|
1229
|
+
interface RoomPage {
|
|
1230
|
+
readonly rooms: readonly RoomSummary[];
|
|
1231
|
+
readonly nextCursor?: string;
|
|
1232
|
+
}
|
|
1233
|
+
interface RoomOperationError {
|
|
1234
|
+
readonly operation: string;
|
|
1235
|
+
readonly code: number;
|
|
1236
|
+
readonly reason: string;
|
|
1237
|
+
readonly message: string;
|
|
1238
|
+
readonly retryable: boolean;
|
|
1239
|
+
}
|
|
1240
|
+
declare function roomFromWire(body: unknown): Room;
|
|
1241
|
+
declare function memberFromWire(body: unknown): RoomMember;
|
|
1242
|
+
declare function summaryFromWire(body: unknown): RoomSummary;
|
|
1243
|
+
interface RoomsApiOptions {
|
|
1244
|
+
readonly client: GemClient;
|
|
1245
|
+
readonly gameId: () => string;
|
|
1246
|
+
}
|
|
1247
|
+
interface CreateRoomOptions {
|
|
1248
|
+
readonly name: string;
|
|
1249
|
+
readonly maxPlayers?: number;
|
|
1250
|
+
readonly isPublic?: boolean;
|
|
1251
|
+
readonly settings?: unknown;
|
|
1252
|
+
readonly region?: string;
|
|
1253
|
+
readonly templateId?: string;
|
|
1254
|
+
readonly templateSlug?: string;
|
|
1255
|
+
readonly partyId?: string;
|
|
1256
|
+
readonly roomArgs?: RoomArgs;
|
|
1257
|
+
readonly signal?: AbortSignal;
|
|
1258
|
+
}
|
|
1259
|
+
interface JoinRoomOptions {
|
|
1260
|
+
readonly partyId?: string;
|
|
1261
|
+
readonly signal?: AbortSignal;
|
|
1262
|
+
}
|
|
1263
|
+
interface QuickJoinOptions extends JoinRoomOptions {
|
|
1264
|
+
readonly templateSlug?: string;
|
|
1265
|
+
readonly templateId?: string;
|
|
1266
|
+
readonly region?: string;
|
|
1267
|
+
readonly name?: string;
|
|
1268
|
+
}
|
|
1269
|
+
interface ListRoomsOptions {
|
|
1270
|
+
readonly status?: "open" | "in_game";
|
|
1271
|
+
readonly templateSlug?: string;
|
|
1272
|
+
readonly limit?: number;
|
|
1273
|
+
readonly cursor?: string;
|
|
1274
|
+
readonly signal?: AbortSignal;
|
|
1275
|
+
}
|
|
1276
|
+
interface UpdateRoomOptions {
|
|
1277
|
+
readonly name?: string;
|
|
1278
|
+
readonly maxPlayers?: number;
|
|
1279
|
+
readonly isPublic?: boolean;
|
|
1280
|
+
readonly settings?: unknown;
|
|
1281
|
+
readonly roomArgs?: RoomArgs;
|
|
1282
|
+
readonly signal?: AbortSignal;
|
|
1283
|
+
}
|
|
1284
|
+
declare class RoomsApi {
|
|
1285
|
+
private readonly options;
|
|
1286
|
+
constructor(options: RoomsApiOptions);
|
|
1287
|
+
list(options: ListRoomsOptions): Promise<RoomPage>;
|
|
1288
|
+
myRooms(signal?: AbortSignal): Promise<RoomPage>;
|
|
1289
|
+
create(options: CreateRoomOptions, version: ResolvedClientVersion): Promise<Room>;
|
|
1290
|
+
get(roomId: string, signal?: AbortSignal): Promise<Room>;
|
|
1291
|
+
join(roomId: string, options: JoinRoomOptions, version: ResolvedClientVersion): Promise<Room>;
|
|
1292
|
+
joinByCode(code: string, options: JoinRoomOptions, version: ResolvedClientVersion): Promise<Room>;
|
|
1293
|
+
quickJoin(options: QuickJoinOptions, version: ResolvedClientVersion): Promise<Room>;
|
|
1294
|
+
leave(roomId: string, asGroup: boolean, signal?: AbortSignal, keepalive?: boolean): Promise<void>;
|
|
1295
|
+
close(roomId: string, signal?: AbortSignal): Promise<void>;
|
|
1296
|
+
update(roomId: string, options: UpdateRoomOptions): Promise<Room>;
|
|
1297
|
+
setReady(roomId: string, isReady: boolean, signal?: AbortSignal): Promise<Room>;
|
|
1298
|
+
kick(roomId: string, playerId: string, signal?: AbortSignal): Promise<Room>;
|
|
1299
|
+
transferHost(roomId: string, playerId: string, signal?: AbortSignal): Promise<Room>;
|
|
1300
|
+
leaveMatch(matchId: string, keepalive: boolean): Promise<void>;
|
|
1301
|
+
private baseV2;
|
|
1302
|
+
private baseV1;
|
|
1303
|
+
private roomV2;
|
|
1304
|
+
private roomV1;
|
|
1305
|
+
}
|
|
1306
|
+
interface RoomEventMap {
|
|
1307
|
+
created: [
|
|
1308
|
+
Room
|
|
1309
|
+
];
|
|
1310
|
+
joined: [
|
|
1311
|
+
Room
|
|
1312
|
+
];
|
|
1313
|
+
left: [
|
|
1314
|
+
];
|
|
1315
|
+
closed: [
|
|
1316
|
+
];
|
|
1317
|
+
updated: [
|
|
1318
|
+
Room
|
|
1319
|
+
];
|
|
1320
|
+
seated: [
|
|
1321
|
+
Room
|
|
1322
|
+
];
|
|
1323
|
+
listed: [
|
|
1324
|
+
RoomPage
|
|
1325
|
+
];
|
|
1326
|
+
mineListed: [
|
|
1327
|
+
readonly RoomSummary[]
|
|
1328
|
+
];
|
|
1329
|
+
memberJoined: [
|
|
1330
|
+
string
|
|
1331
|
+
];
|
|
1332
|
+
memberLeft: [
|
|
1333
|
+
string
|
|
1334
|
+
];
|
|
1335
|
+
kicked: [
|
|
1336
|
+
];
|
|
1337
|
+
readyChanged: [
|
|
1338
|
+
string,
|
|
1339
|
+
boolean
|
|
1340
|
+
];
|
|
1341
|
+
hostChanged: [
|
|
1342
|
+
string
|
|
1343
|
+
];
|
|
1344
|
+
matchStartWaiting: [
|
|
1345
|
+
StartMatchWaiting
|
|
1346
|
+
];
|
|
1347
|
+
matchAllocationStarted: [
|
|
1348
|
+
string
|
|
1349
|
+
];
|
|
1350
|
+
matchReady: [
|
|
1351
|
+
ReadyMatch
|
|
1352
|
+
];
|
|
1353
|
+
matchFailed: [
|
|
1354
|
+
string,
|
|
1355
|
+
string
|
|
1356
|
+
];
|
|
1357
|
+
matchEnded: [
|
|
1358
|
+
MatchEnded
|
|
1359
|
+
];
|
|
1360
|
+
matchSuspended: [
|
|
1361
|
+
MatchSuspended
|
|
1362
|
+
];
|
|
1363
|
+
matchReconnecting: [
|
|
1364
|
+
MatchReconnecting
|
|
1365
|
+
];
|
|
1366
|
+
matchReconnected: [
|
|
1367
|
+
MatchReconnected
|
|
1368
|
+
];
|
|
1369
|
+
versionUpdateAvailable: [
|
|
1370
|
+
ClientPlatform | undefined
|
|
1371
|
+
];
|
|
1372
|
+
error: [
|
|
1373
|
+
RoomOperationError
|
|
1374
|
+
];
|
|
1375
|
+
}
|
|
1376
|
+
type RoomEventName = keyof RoomEventMap;
|
|
1377
|
+
type Listener<K extends RoomEventName> = (...args: RoomEventMap[K]) => void;
|
|
1378
|
+
declare class RoomEmitter {
|
|
1379
|
+
private readonly listeners;
|
|
1380
|
+
private retainedMatch;
|
|
1381
|
+
on<K extends RoomEventName>(event: K, listener: Listener<K>): () => void;
|
|
1382
|
+
hasListeners(event: RoomEventName): boolean;
|
|
1383
|
+
off<K extends RoomEventName>(event: K, listener: Listener<K>): void;
|
|
1384
|
+
once<K extends RoomEventName>(event: K, listener: Listener<K>): () => void;
|
|
1385
|
+
emit<K extends RoomEventName>(event: K, ...args: RoomEventMap[K]): void;
|
|
1386
|
+
get retained(): ReadyMatch | null;
|
|
1387
|
+
retain(match: ReadyMatch): void;
|
|
1388
|
+
clearRetained(): void;
|
|
1389
|
+
clear(): void;
|
|
1390
|
+
}
|
|
1391
|
+
type PartyResolver = () => Promise<string | undefined>;
|
|
1392
|
+
interface PartyBridge {
|
|
1393
|
+
requestParty(requestId: string): boolean;
|
|
1394
|
+
parentSupports(capability: string): boolean;
|
|
1395
|
+
}
|
|
1396
|
+
interface PartyResolverOptions {
|
|
1397
|
+
readonly bridge: PartyBridge;
|
|
1398
|
+
readonly clock: Clock;
|
|
1399
|
+
readonly timeoutMs?: number;
|
|
1400
|
+
}
|
|
1401
|
+
declare function createPartyResolver(options: PartyResolverOptions): {
|
|
1402
|
+
resolve: PartyResolver;
|
|
1403
|
+
settle(requestId: string, partyId?: string): void;
|
|
1404
|
+
};
|
|
1405
|
+
interface MatchEndHint {
|
|
1406
|
+
readonly matchId?: string;
|
|
1407
|
+
readonly reason?: string;
|
|
1408
|
+
}
|
|
1409
|
+
interface AutoReconnectWiring {
|
|
1410
|
+
readonly attempts: number;
|
|
1411
|
+
readonly maxDelayMs: number;
|
|
1412
|
+
readonly budgetMs: number;
|
|
1413
|
+
readonly redial: (matchId: string, deadlineAt: number) => Promise<"connected" | "closed">;
|
|
1414
|
+
readonly abandon: (matchId: string, reason: string) => void;
|
|
1415
|
+
}
|
|
1416
|
+
interface RelayedRoomEvent {
|
|
1417
|
+
readonly event: "updated" | "match_started" | "match_ready" | "match_failed" | "version_stale";
|
|
1418
|
+
readonly roomId: string;
|
|
1419
|
+
readonly matchId?: string;
|
|
1420
|
+
readonly version?: number;
|
|
1421
|
+
readonly reason?: string;
|
|
1422
|
+
readonly platform?: ClientPlatform;
|
|
1423
|
+
}
|
|
1424
|
+
interface RoomManagerOptions {
|
|
1425
|
+
readonly client: GemClient;
|
|
1426
|
+
readonly clock: Clock;
|
|
1427
|
+
readonly gameId: string | (() => string | null);
|
|
1428
|
+
readonly awaitGameId?: () => Promise<string>;
|
|
1429
|
+
readonly playerId: string | (() => string | null);
|
|
1430
|
+
readonly clientVersion?: ClientVersion;
|
|
1431
|
+
readonly platformGameVersion?: () => string | null;
|
|
1432
|
+
readonly poll?: boolean;
|
|
1433
|
+
readonly pollIntervalMs?: number;
|
|
1434
|
+
readonly pushedPollIntervalMs?: number;
|
|
1435
|
+
readonly notifyOnUnload?: boolean;
|
|
1436
|
+
readonly followMatch?: boolean;
|
|
1437
|
+
readonly resolveParty?: PartyResolver;
|
|
1438
|
+
readonly resolveClusterTarget?: ClusterTargetResolver;
|
|
1439
|
+
readonly ensureLocalServer?: (gameRoomId: string) => Promise<void>;
|
|
1440
|
+
readonly autoReconnect?: AutoReconnectWiring;
|
|
1441
|
+
readonly recoverStaleMembership?: boolean;
|
|
1442
|
+
readonly watchSeats?: boolean;
|
|
1443
|
+
readonly seatPollIntervalMs?: number;
|
|
1444
|
+
}
|
|
1445
|
+
interface StartMatchOptions {
|
|
1446
|
+
readonly clusterTargetId?: ClusterTargetLike;
|
|
1447
|
+
readonly retry?: StartMatchRetryOptions;
|
|
1448
|
+
readonly signal?: AbortSignal;
|
|
1449
|
+
}
|
|
1450
|
+
interface AwaitMatchOptions {
|
|
1451
|
+
readonly timeoutMs?: number;
|
|
1452
|
+
readonly pollIntervalMs?: number;
|
|
1453
|
+
readonly signal?: AbortSignal;
|
|
1454
|
+
}
|
|
1455
|
+
interface StartedMatch {
|
|
1456
|
+
readonly matchId: string;
|
|
1457
|
+
readonly status: string;
|
|
1458
|
+
}
|
|
1459
|
+
interface RoomManager {
|
|
1460
|
+
create(options: CreateRoomOptions): Promise<Room>;
|
|
1461
|
+
join(roomId: string, options?: JoinRoomOptions): Promise<Room>;
|
|
1462
|
+
joinByCode(code: string, options?: JoinRoomOptions): Promise<Room>;
|
|
1463
|
+
quickJoin(options: QuickJoinOptions): Promise<Room>;
|
|
1464
|
+
list(options?: ListRoomsOptions): Promise<RoomPage>;
|
|
1465
|
+
myRooms(signal?: AbortSignal): Promise<readonly RoomSummary[]>;
|
|
1466
|
+
leave(options?: {
|
|
1467
|
+
asGroup?: boolean;
|
|
1468
|
+
signal?: AbortSignal;
|
|
1469
|
+
keepalive?: boolean;
|
|
1470
|
+
}): Promise<void>;
|
|
1471
|
+
leaveAll(signal?: AbortSignal): Promise<readonly string[]>;
|
|
1472
|
+
close(signal?: AbortSignal): Promise<void>;
|
|
1473
|
+
refresh(signal?: AbortSignal): Promise<Room | null>;
|
|
1474
|
+
setReady(isReady: boolean, signal?: AbortSignal): Promise<Room>;
|
|
1475
|
+
kick(playerId: string, signal?: AbortSignal): Promise<Room>;
|
|
1476
|
+
transferHost(playerId: string, signal?: AbortSignal): Promise<Room>;
|
|
1477
|
+
update(options: UpdateRoomOptions): Promise<Room>;
|
|
1478
|
+
startMatch(options?: StartMatchOptions): Promise<StartedMatch>;
|
|
1479
|
+
awaitMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
|
|
1480
|
+
pollMatchStatus(options?: AwaitMatchOptions): Promise<ReadyMatch>;
|
|
1481
|
+
notifyMatchConnected(matchId: string): void;
|
|
1482
|
+
notifyMatchDisconnected(cause?: string): Promise<void>;
|
|
1483
|
+
reconnectToMatch(options?: AwaitMatchOptions): Promise<ReadyMatch>;
|
|
1484
|
+
notifyLeavingMatch(options?: {
|
|
1485
|
+
keepalive?: boolean;
|
|
1486
|
+
}): Promise<void>;
|
|
1487
|
+
readonly gameId: string | null;
|
|
1488
|
+
readonly currentRoom: Room | null;
|
|
1489
|
+
readonly currentMatch: ReadyMatch | null;
|
|
1490
|
+
readonly matchConnectionState: MatchConnectionState;
|
|
1491
|
+
readonly matchSession: MatchSession;
|
|
1492
|
+
readonly isInRoom: boolean;
|
|
1493
|
+
readonly isHost: boolean;
|
|
1494
|
+
readonly members: readonly Room["members"][number][];
|
|
1495
|
+
on<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
|
|
1496
|
+
off<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): void;
|
|
1497
|
+
once<K extends RoomEventName>(event: K, listener: (...args: RoomEventMap[K]) => void): () => void;
|
|
1498
|
+
handleRoomEvent(event: RelayedRoomEvent): void;
|
|
1499
|
+
handleSeated(roomId: string): void;
|
|
1500
|
+
reconcileSeats(): Promise<void>;
|
|
1501
|
+
reconcile(hint?: MatchEndHint): Promise<void>;
|
|
1502
|
+
startPolling(intervalMs?: number): void;
|
|
1503
|
+
stopPolling(): void;
|
|
1504
|
+
settled(): Promise<void>;
|
|
1505
|
+
dispose(): void;
|
|
1506
|
+
}
|
|
1507
|
+
declare function createRoomManager(options: RoomManagerOptions): RoomManager;
|
|
1508
|
+
declare const WEB_ENGINE_VERSION = "0.1.0-beta";
|
|
1509
|
+
interface DedicatedSignalTransport {
|
|
1510
|
+
dedicatedOffer(matchId: string, sdp: string, intent: OfferRequest["intent"]): void;
|
|
1511
|
+
parentSupports(capability: string): boolean;
|
|
1512
|
+
}
|
|
1513
|
+
interface DedicatedSignalingOptions {
|
|
1514
|
+
readonly bridge: DedicatedSignalTransport | null;
|
|
1515
|
+
}
|
|
1516
|
+
interface Pending {
|
|
1517
|
+
readonly settle: (answer: SignalingAnswer) => void;
|
|
1518
|
+
readonly refuse: (error: DedicatedServerError) => void;
|
|
1519
|
+
}
|
|
1520
|
+
declare class DedicatedSignalingHub {
|
|
1521
|
+
private readonly options;
|
|
1522
|
+
private readonly pending;
|
|
1523
|
+
constructor(options: DedicatedSignalingOptions);
|
|
1524
|
+
channel(): SignalingChannel;
|
|
1525
|
+
handleEvent(event: GemDedicatedEvent): void;
|
|
1526
|
+
register(matchId: string, waiter: Pending): void;
|
|
1527
|
+
release(matchId: string, waiter: Pending): void;
|
|
1528
|
+
transport(): DedicatedSignalTransport;
|
|
1529
|
+
}
|
|
1530
|
+
interface DedicatedServerApiOptions {
|
|
1531
|
+
readonly client: GemClient;
|
|
1532
|
+
readonly clock: Clock;
|
|
1533
|
+
readonly rooms: RoomManager;
|
|
1534
|
+
readonly signaling?: () => SignalingChannel;
|
|
1535
|
+
readonly log?: (message: string) => void;
|
|
1536
|
+
readonly signalingReady?: (timeoutMs: number) => Promise<boolean>;
|
|
1537
|
+
}
|
|
1538
|
+
interface ConnectOptions {
|
|
1539
|
+
readonly clusterTargetId?: ClusterTargetLike;
|
|
1540
|
+
readonly retry?: StartMatchRetryOptions;
|
|
1541
|
+
readonly timeoutMs?: number;
|
|
1542
|
+
readonly pollIntervalMs?: number;
|
|
1543
|
+
readonly signal?: AbortSignal;
|
|
1544
|
+
readonly signaling?: SignalingChannel;
|
|
1545
|
+
readonly peerConnection?: PeerConnectionLike$1;
|
|
1546
|
+
readonly intent?: SignalingIntent;
|
|
1547
|
+
readonly channelLabel?: string;
|
|
1548
|
+
readonly gatherTimeoutMs?: number;
|
|
1549
|
+
readonly exchangeTimeoutMs?: number;
|
|
1550
|
+
readonly openTimeoutMs?: number;
|
|
1551
|
+
readonly reportDisconnect?: boolean;
|
|
1552
|
+
readonly reportConnected?: boolean;
|
|
1553
|
+
readonly presentCredential?: boolean;
|
|
1554
|
+
readonly onMessage?: (data: unknown) => void;
|
|
1555
|
+
readonly onMatchEnded?: (reason?: string) => void;
|
|
1556
|
+
readonly welcomeTimeoutMs?: number;
|
|
1557
|
+
readonly transports?: readonly TransportKind[];
|
|
1558
|
+
readonly transportAttemptTimeoutMs?: number;
|
|
1559
|
+
readonly redial?: boolean;
|
|
1560
|
+
readonly deadlineAt?: number;
|
|
1561
|
+
}
|
|
1562
|
+
interface DedicatedServerSession {
|
|
1563
|
+
readonly matchId: string;
|
|
1564
|
+
readonly channel: RTCDataChannel;
|
|
1565
|
+
readonly peerConnection: PeerConnectionLike$1;
|
|
1566
|
+
readonly joinCredential: string;
|
|
1567
|
+
readonly credentialExpiresAt: number;
|
|
1568
|
+
readonly welcome: JoinWelcome | null;
|
|
1569
|
+
close(): void;
|
|
1570
|
+
}
|
|
1571
|
+
interface MultiTransportSession {
|
|
1572
|
+
readonly matchId: string;
|
|
1573
|
+
readonly transport: TransportKind;
|
|
1574
|
+
readonly link: GameServerLink;
|
|
1575
|
+
readonly joinCredential: string;
|
|
1576
|
+
readonly credentialExpiresAt: number;
|
|
1577
|
+
readonly welcome: JoinWelcome | null;
|
|
1578
|
+
readonly channel?: RTCDataChannel;
|
|
1579
|
+
readonly peerConnection?: PeerConnectionLike$1;
|
|
1580
|
+
close(): void;
|
|
1581
|
+
}
|
|
1582
|
+
interface DedicatedServerConnect {
|
|
1583
|
+
(options?: ConnectOptions & {
|
|
1584
|
+
transports?: undefined;
|
|
1585
|
+
}): Promise<DedicatedServerSession>;
|
|
1586
|
+
(options: ConnectOptions & {
|
|
1587
|
+
transports: readonly TransportKind[];
|
|
1588
|
+
}): Promise<MultiTransportSession>;
|
|
1589
|
+
(options?: ConnectOptions): Promise<DedicatedServerSession | MultiTransportSession>;
|
|
1590
|
+
}
|
|
1591
|
+
interface DedicatedServerApi {
|
|
1592
|
+
readonly connect: DedicatedServerConnect;
|
|
1593
|
+
listClusterTargets(options?: {
|
|
1594
|
+
signal?: AbortSignal;
|
|
1595
|
+
}): Promise<readonly ClusterTarget[]>;
|
|
1596
|
+
handleMatchEnded(matchId: string, reason?: string): void;
|
|
1597
|
+
}
|
|
1598
|
+
declare function createDedicatedServerApi(options: DedicatedServerApiOptions): DedicatedServerApi;
|
|
1599
|
+
interface BootMark {
|
|
1600
|
+
readonly name: string;
|
|
1601
|
+
readonly at: number;
|
|
1602
|
+
}
|
|
1603
|
+
interface BootTimeline {
|
|
1604
|
+
mark(name: string, at?: number): boolean;
|
|
1605
|
+
timeline(): string;
|
|
1606
|
+
readonly marks: readonly BootMark[];
|
|
1607
|
+
}
|
|
1608
|
+
interface P2pApiOptions$1 {
|
|
1609
|
+
readonly client: GemClient;
|
|
1610
|
+
readonly gameId: () => string;
|
|
1611
|
+
}
|
|
1612
|
+
interface JoinCredential {
|
|
1613
|
+
readonly credential: string;
|
|
1614
|
+
readonly hostFingerprint: string;
|
|
1615
|
+
readonly hostEpoch: number;
|
|
1616
|
+
readonly expiresAt: number;
|
|
1617
|
+
}
|
|
1618
|
+
interface IceServer {
|
|
1619
|
+
readonly urls: readonly string[];
|
|
1620
|
+
readonly username: string;
|
|
1621
|
+
readonly credential: string;
|
|
1622
|
+
}
|
|
1623
|
+
interface TurnLease {
|
|
1624
|
+
readonly iceServers: readonly IceServer[];
|
|
1625
|
+
readonly expiresAt: number;
|
|
1626
|
+
}
|
|
1627
|
+
type P2pTelemetryEvent = TelemetrySample;
|
|
1628
|
+
declare class P2pApi {
|
|
1629
|
+
private readonly options;
|
|
1630
|
+
private readonly reporter;
|
|
1631
|
+
constructor(options: P2pApiOptions$1);
|
|
1632
|
+
joinCredential(matchId: string, fingerprint: string, signal?: AbortSignal): Promise<JoinCredential>;
|
|
1633
|
+
turnLease(matchId: string, clusterTargetId: string, signal?: AbortSignal): Promise<TurnLease>;
|
|
1634
|
+
kick(matchId: string, playerId: string, signal?: AbortSignal): Promise<void>;
|
|
1635
|
+
leave(matchId: string, keepalive?: boolean): Promise<void>;
|
|
1636
|
+
telemetry(events: readonly P2pTelemetryEvent[], signal?: AbortSignal): Promise<void>;
|
|
1637
|
+
private match;
|
|
1638
|
+
}
|
|
1639
|
+
type P2pFailure = "timeout" | "aborted" | "unsupported_protocol" | "signaling_unavailable" | "signaling_failed" | "invalid_sdp" | "media_refused" | "peer_unauthenticated" | "not_expected_player" | "keys_unavailable" | "migration_failed" | "kicked" | "match_ended" | "connection_failed" | "misconfigured";
|
|
1640
|
+
declare class P2pError extends Error {
|
|
1641
|
+
readonly reason: P2pFailure;
|
|
1642
|
+
readonly retryable: boolean;
|
|
1643
|
+
constructor(reason: P2pFailure, message: string, options?: {
|
|
1644
|
+
cause?: unknown;
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
interface P2pEventMap {
|
|
1648
|
+
peerJoined: [
|
|
1649
|
+
P2pPeer
|
|
1650
|
+
];
|
|
1651
|
+
peerLeft: [
|
|
1652
|
+
string,
|
|
1653
|
+
string
|
|
1654
|
+
];
|
|
1655
|
+
migrating: [
|
|
1656
|
+
string,
|
|
1657
|
+
number
|
|
1658
|
+
];
|
|
1659
|
+
hostChanged: [
|
|
1660
|
+
string,
|
|
1661
|
+
number
|
|
1662
|
+
];
|
|
1663
|
+
matchEnded: [
|
|
1664
|
+
string
|
|
1665
|
+
];
|
|
1666
|
+
candidatesDropped: [
|
|
1667
|
+
number
|
|
1668
|
+
];
|
|
1669
|
+
error: [
|
|
1670
|
+
P2pError
|
|
1671
|
+
];
|
|
1672
|
+
}
|
|
1673
|
+
type P2pEventName = keyof P2pEventMap;
|
|
1674
|
+
declare function fingerprintOf(sdp: string): string | null;
|
|
1675
|
+
declare function normaliseFingerprint(raw: string): string | null;
|
|
1676
|
+
declare function fingerprintsMatch(a: string, b: string): boolean;
|
|
1677
|
+
interface VerifiedCredential {
|
|
1678
|
+
readonly playerId: string;
|
|
1679
|
+
readonly matchId: string;
|
|
1680
|
+
readonly gameId: string;
|
|
1681
|
+
readonly hostEpoch: number;
|
|
1682
|
+
readonly role: "host" | "client";
|
|
1683
|
+
readonly fingerprint: string;
|
|
1684
|
+
readonly hostFingerprint: string;
|
|
1685
|
+
readonly jti: string;
|
|
1686
|
+
readonly expiresAt: number;
|
|
1687
|
+
}
|
|
1688
|
+
interface VerifyContext {
|
|
1689
|
+
readonly matchId: string;
|
|
1690
|
+
readonly gameId: string;
|
|
1691
|
+
readonly hostEpoch: number;
|
|
1692
|
+
readonly peerFingerprint: string;
|
|
1693
|
+
readonly hostFingerprint: string;
|
|
1694
|
+
readonly now: number;
|
|
1695
|
+
}
|
|
1696
|
+
interface KeySource {
|
|
1697
|
+
key(kid: string): Promise<CryptoKey | null>;
|
|
1698
|
+
}
|
|
1699
|
+
interface JwksOptions {
|
|
1700
|
+
readonly baseUrl: string;
|
|
1701
|
+
readonly now: () => number;
|
|
1702
|
+
readonly fetch?: (url: string, init?: RequestInit) => Promise<{
|
|
1703
|
+
ok: boolean;
|
|
1704
|
+
text(): Promise<string>;
|
|
1705
|
+
}>;
|
|
1706
|
+
readonly subtle?: SubtleCrypto;
|
|
1707
|
+
}
|
|
1708
|
+
declare function createKeySource(options: JwksOptions): KeySource;
|
|
1709
|
+
declare class ReplaySet {
|
|
1710
|
+
private readonly seen;
|
|
1711
|
+
admit(jti: string, now: number): boolean;
|
|
1712
|
+
}
|
|
1713
|
+
declare function verifyCredential(jwt: string, context: VerifyContext, keys: KeySource, replays: ReplaySet, options: {
|
|
1714
|
+
issuer: string;
|
|
1715
|
+
subtle?: SubtleCrypto;
|
|
1716
|
+
}): Promise<VerifiedCredential>;
|
|
1717
|
+
interface SignalTransport {
|
|
1718
|
+
signal(signal: string, matchId: string, data: Record<string, unknown>): void;
|
|
1719
|
+
parentSupports(capability: string): boolean;
|
|
1720
|
+
}
|
|
1721
|
+
interface SignalingOptions {
|
|
1722
|
+
readonly bridge: SignalTransport;
|
|
1723
|
+
readonly matchId: string;
|
|
1724
|
+
readonly clock: {
|
|
1725
|
+
now(): number;
|
|
1726
|
+
setTimeout(fn: () => void, ms: number): unknown;
|
|
1727
|
+
clearTimeout(handle: unknown): void;
|
|
1728
|
+
};
|
|
1729
|
+
readonly maxQueuedCandidates?: number;
|
|
1730
|
+
readonly candidateIntervalMs?: number;
|
|
1731
|
+
readonly onCandidatesDropped?: (dropped: number) => void;
|
|
1732
|
+
}
|
|
1733
|
+
declare class SignalingClient {
|
|
1734
|
+
private readonly options;
|
|
1735
|
+
private readonly queue;
|
|
1736
|
+
private drainHandle;
|
|
1737
|
+
private dropped;
|
|
1738
|
+
private closed;
|
|
1739
|
+
private dropListener;
|
|
1740
|
+
constructor(options: SignalingOptions);
|
|
1741
|
+
onDropped(listener: (dropped: number) => void): void;
|
|
1742
|
+
join(): void;
|
|
1743
|
+
offer(sdp: string, intent: "initial" | "ice_restart" | "full_reconnect"): void;
|
|
1744
|
+
answer(peerId: string, sdp: string, assignedPeerId: number): void;
|
|
1745
|
+
candidate(peerId: string, candidate: string, sdpMid?: string, sdpMLineIndex?: number): void;
|
|
1746
|
+
migrationAck(hostEpoch: number): void;
|
|
1747
|
+
reportHostUnreachable(hostEpoch: number, iceState: "disconnected" | "failed" | "closed"): void;
|
|
1748
|
+
discardQueued(): void;
|
|
1749
|
+
close(): void;
|
|
1750
|
+
private assertUsable;
|
|
1751
|
+
private schedule;
|
|
1752
|
+
}
|
|
1753
|
+
type SdpType = "offer" | "answer" | "pranswer" | "rollback";
|
|
1754
|
+
interface SessionDescriptionLike {
|
|
1755
|
+
readonly type: SdpType;
|
|
1756
|
+
readonly sdp?: string;
|
|
1757
|
+
}
|
|
1758
|
+
interface IceCandidateLike {
|
|
1759
|
+
readonly candidate: string;
|
|
1760
|
+
readonly sdpMid?: string | null;
|
|
1761
|
+
readonly sdpMLineIndex?: number | null;
|
|
1762
|
+
}
|
|
1763
|
+
interface EventTargetLike {
|
|
1764
|
+
addEventListener(type: string, listener: (event: never) => void): void;
|
|
1765
|
+
removeEventListener(type: string, listener: (event: never) => void): void;
|
|
1766
|
+
}
|
|
1767
|
+
interface DataChannelLike extends EventTargetLike {
|
|
1768
|
+
readonly readyState: string;
|
|
1769
|
+
readonly label: string;
|
|
1770
|
+
binaryType: string;
|
|
1771
|
+
send(data: string | ArrayBuffer): void;
|
|
1772
|
+
close(): void;
|
|
1773
|
+
}
|
|
1774
|
+
interface DataChannelInitLike {
|
|
1775
|
+
readonly ordered?: boolean;
|
|
1776
|
+
readonly maxRetransmits?: number;
|
|
1777
|
+
readonly negotiated?: boolean;
|
|
1778
|
+
readonly id?: number;
|
|
1779
|
+
}
|
|
1780
|
+
interface PeerConnectionLike extends EventTargetLike {
|
|
1781
|
+
readonly localDescription: SessionDescriptionLike | null;
|
|
1782
|
+
readonly remoteDescription: SessionDescriptionLike | null;
|
|
1783
|
+
readonly iceConnectionState: string;
|
|
1784
|
+
readonly connectionState: string;
|
|
1785
|
+
createDataChannel(label: string, init?: DataChannelInitLike): DataChannelLike;
|
|
1786
|
+
createOffer(): Promise<SessionDescriptionLike>;
|
|
1787
|
+
createAnswer(): Promise<SessionDescriptionLike>;
|
|
1788
|
+
setLocalDescription(description?: SessionDescriptionLike): Promise<void>;
|
|
1789
|
+
setRemoteDescription(description: SessionDescriptionLike): Promise<void>;
|
|
1790
|
+
addIceCandidate(candidate: IceCandidateLike): Promise<void>;
|
|
1791
|
+
close(): void;
|
|
1792
|
+
}
|
|
1793
|
+
interface PeerConnectionConfig {
|
|
1794
|
+
readonly iceServers: readonly {
|
|
1795
|
+
urls: readonly string[];
|
|
1796
|
+
username?: string;
|
|
1797
|
+
credential?: string;
|
|
1798
|
+
}[];
|
|
1799
|
+
readonly certificates?: readonly unknown[];
|
|
1800
|
+
}
|
|
1801
|
+
type PeerConnectionFactory = (config: PeerConnectionConfig) => PeerConnectionLike;
|
|
1802
|
+
type ChannelKind = "reliable" | "ordered" | "unreliable";
|
|
1803
|
+
declare const CHANNELS: Readonly<Record<ChannelKind, DataChannelInitLike & {
|
|
1804
|
+
id: number;
|
|
1805
|
+
}>>;
|
|
1806
|
+
declare const CHANNEL_KINDS: readonly ChannelKind[];
|
|
1807
|
+
declare function browserPeerConnection(config: PeerConnectionConfig): PeerConnectionLike;
|
|
1808
|
+
declare function generateCertificate(): Promise<unknown | null>;
|
|
1809
|
+
declare class CredentialPacing {
|
|
1810
|
+
private readonly perMinute;
|
|
1811
|
+
private readonly sent;
|
|
1812
|
+
constructor(perMinute?: number);
|
|
1813
|
+
delayUntilAllowed(now: number): number;
|
|
1814
|
+
record(now: number): void;
|
|
1815
|
+
private prune;
|
|
1816
|
+
}
|
|
1817
|
+
interface P2pPeer {
|
|
1818
|
+
readonly playerId: string;
|
|
1819
|
+
readonly assignedPeerId: number;
|
|
1820
|
+
readonly connection: PeerConnectionLike;
|
|
1821
|
+
readonly channels: Readonly<Record<ChannelKind, DataChannelLike>>;
|
|
1822
|
+
send(data: string | ArrayBuffer, kind?: ChannelKind): void;
|
|
1823
|
+
}
|
|
1824
|
+
interface P2pSessionOptions {
|
|
1825
|
+
readonly api: P2pApi;
|
|
1826
|
+
readonly clock: Clock;
|
|
1827
|
+
readonly matchId: string;
|
|
1828
|
+
readonly gameId: string;
|
|
1829
|
+
readonly baseUrl: string;
|
|
1830
|
+
readonly signaling: SignalingClient;
|
|
1831
|
+
readonly clusterTargetId?: ClusterTargetLike;
|
|
1832
|
+
readonly peerConnectionFactory?: PeerConnectionFactory;
|
|
1833
|
+
readonly certificate?: unknown;
|
|
1834
|
+
readonly connectTimeoutMs?: number;
|
|
1835
|
+
readonly keys?: KeySource;
|
|
1836
|
+
readonly boot?: BootTimeline;
|
|
1837
|
+
readonly log?: ((message: string) => void) | null;
|
|
1838
|
+
readonly credentialPacing?: CredentialPacing;
|
|
1839
|
+
}
|
|
1840
|
+
declare class P2pSession {
|
|
1841
|
+
private readonly options;
|
|
1842
|
+
private readonly emitter;
|
|
1843
|
+
private readonly links;
|
|
1844
|
+
private readonly replays;
|
|
1845
|
+
private readonly keys;
|
|
1846
|
+
private localPlayerId;
|
|
1847
|
+
private migration;
|
|
1848
|
+
private iceServers;
|
|
1849
|
+
private credential;
|
|
1850
|
+
private nextPeerId;
|
|
1851
|
+
private ended;
|
|
1852
|
+
private closed;
|
|
1853
|
+
private ready;
|
|
1854
|
+
private helloSeen;
|
|
1855
|
+
private reportedUnreachableEpoch;
|
|
1856
|
+
private reportedStallEpoch;
|
|
1857
|
+
private counted;
|
|
1858
|
+
private readonly pendingOffers;
|
|
1859
|
+
private readonly answeredSessions;
|
|
1860
|
+
private credentialGeneration;
|
|
1861
|
+
private credentialDeadline;
|
|
1862
|
+
constructor(options: P2pSessionOptions);
|
|
1863
|
+
get matchId(): string;
|
|
1864
|
+
get playerId(): string;
|
|
1865
|
+
get isHost(): boolean;
|
|
1866
|
+
get hostPlayerId(): string;
|
|
1867
|
+
get hostEpoch(): number;
|
|
1868
|
+
get peers(): readonly P2pPeer[];
|
|
1869
|
+
peer(playerId: string): P2pPeer | null;
|
|
1870
|
+
on<K extends P2pEventName>(event: K, listener: (...args: P2pEventMap[K]) => void): () => void;
|
|
1871
|
+
off<K extends P2pEventName>(event: K, listener: (...args: P2pEventMap[K]) => void): void;
|
|
1872
|
+
once<K extends P2pEventName>(event: K, listener: (...args: P2pEventMap[K]) => void): () => void;
|
|
1873
|
+
start(signal?: AbortSignal): Promise<void>;
|
|
1874
|
+
kick(playerId: string): Promise<void>;
|
|
1875
|
+
leave(): Promise<void>;
|
|
1876
|
+
close(): void;
|
|
1877
|
+
report(events: readonly TelemetrySample[]): void;
|
|
1878
|
+
notifyCandidatesDropped(dropped: number): void;
|
|
1879
|
+
handleSignal(event: string, data: Record<string, unknown>): void;
|
|
1880
|
+
private route;
|
|
1881
|
+
private onHello;
|
|
1882
|
+
private drainPendingOffers;
|
|
1883
|
+
private offerToHost;
|
|
1884
|
+
private fetchCredential;
|
|
1885
|
+
private waitForCredential;
|
|
1886
|
+
private onOffer;
|
|
1887
|
+
private onAnswer;
|
|
1888
|
+
private hostVerified;
|
|
1889
|
+
private maybeAuthenticate;
|
|
1890
|
+
private applyAnswer;
|
|
1891
|
+
private onIce;
|
|
1892
|
+
private onPeerLeft;
|
|
1893
|
+
private onMigration;
|
|
1894
|
+
private watchMigration;
|
|
1895
|
+
private onMatchEnded;
|
|
1896
|
+
private onSignalingError;
|
|
1897
|
+
private openLink;
|
|
1898
|
+
private flushCandidates;
|
|
1899
|
+
private onReliableOpen;
|
|
1900
|
+
private onHandshakeMessage;
|
|
1901
|
+
private admit;
|
|
1902
|
+
private refuseLink;
|
|
1903
|
+
private finishAdmission;
|
|
1904
|
+
private onIceState;
|
|
1905
|
+
private onConnectionState;
|
|
1906
|
+
private expose;
|
|
1907
|
+
private dropLink;
|
|
1908
|
+
private settle;
|
|
1909
|
+
private fail;
|
|
1910
|
+
private report_;
|
|
1911
|
+
private count;
|
|
1912
|
+
private refuseMedia;
|
|
1913
|
+
private mark;
|
|
1914
|
+
private sleep;
|
|
1915
|
+
private warn;
|
|
1916
|
+
get endedReason(): string | null;
|
|
1917
|
+
}
|
|
1918
|
+
declare const WEB_PROTOCOL_VERSION = 32769;
|
|
1919
|
+
type MigrationState = "idle" | "preparing" | "reconnecting";
|
|
1920
|
+
interface MigrationEvent {
|
|
1921
|
+
readonly hostPlayerId: string;
|
|
1922
|
+
readonly hostEpoch: number;
|
|
1923
|
+
readonly reason?: string;
|
|
1924
|
+
readonly kickedPlayerIds?: readonly string[];
|
|
1925
|
+
readonly migrationComplete?: boolean;
|
|
1926
|
+
}
|
|
1927
|
+
type MigrationOutcome = {
|
|
1928
|
+
readonly kind: "accepted";
|
|
1929
|
+
readonly state: MigrationState;
|
|
1930
|
+
} | {
|
|
1931
|
+
readonly kind: "completed";
|
|
1932
|
+
} | {
|
|
1933
|
+
readonly kind: "duplicate";
|
|
1934
|
+
} | {
|
|
1935
|
+
readonly kind: "refused";
|
|
1936
|
+
readonly why: string;
|
|
1937
|
+
};
|
|
1938
|
+
declare const MIGRATION_TIMEOUT_MS = 30000;
|
|
1939
|
+
declare class HostMigration {
|
|
1940
|
+
private readonly localPlayerId;
|
|
1941
|
+
private state;
|
|
1942
|
+
private epoch;
|
|
1943
|
+
private hostPlayerId;
|
|
1944
|
+
private kicked;
|
|
1945
|
+
private startedAt;
|
|
1946
|
+
constructor(localPlayerId: string, hostPlayerId: string, epoch: number);
|
|
1947
|
+
get currentState(): MigrationState;
|
|
1948
|
+
get currentEpoch(): number;
|
|
1949
|
+
get currentHostPlayerId(): string;
|
|
1950
|
+
get isLocalHost(): boolean;
|
|
1951
|
+
isKicked(playerId: string): boolean;
|
|
1952
|
+
stalled(now: number): boolean;
|
|
1953
|
+
apply(event: MigrationEvent, now: number): MigrationOutcome;
|
|
1954
|
+
complete(): void;
|
|
1955
|
+
}
|
|
1956
|
+
declare const WEBRTC_P2P = "webrtc_p2p";
|
|
1957
|
+
interface P2pApiOptions {
|
|
1958
|
+
readonly client: GemClient;
|
|
1959
|
+
readonly clock: Clock;
|
|
1960
|
+
readonly rooms: RoomManager;
|
|
1961
|
+
readonly bridge: SignalTransport | null;
|
|
1962
|
+
readonly gameId: () => string;
|
|
1963
|
+
readonly baseUrl: string | (() => string);
|
|
1964
|
+
readonly resolveClusterTarget?: ClusterTargetResolver;
|
|
1965
|
+
readonly boot?: BootTimeline;
|
|
1966
|
+
readonly log?: ((message: string) => void) | null;
|
|
1967
|
+
}
|
|
1968
|
+
interface P2pConnectOptions {
|
|
1969
|
+
readonly clusterTargetId?: ClusterTargetLike;
|
|
1970
|
+
readonly timeoutMs?: number;
|
|
1971
|
+
readonly signal?: AbortSignal;
|
|
1972
|
+
readonly peerConnectionFactory?: PeerConnectionFactory;
|
|
1973
|
+
readonly certificate?: unknown;
|
|
1974
|
+
}
|
|
1975
|
+
interface P2pMatchApi {
|
|
1976
|
+
connect(options?: P2pConnectOptions): Promise<P2pSession>;
|
|
1977
|
+
handleSignalEvent(matchId: string, event: string, data: Record<string, unknown>): void;
|
|
1978
|
+
session(matchId: string): P2pSession | null;
|
|
1979
|
+
}
|
|
1980
|
+
declare function createP2pApi(options: P2pApiOptions): P2pMatchApi;
|
|
1981
|
+
export { type AutoReconnectOptions, type AwaitMatchOptions, CAPABILITY_GATES, CAPABILITY_NAMESPACE_GATES, CHANNELS, CHANNEL_KINDS, type ChannelKind, type ClientPlatform, ClientTelemetry, type ClientTelemetryOptions, type ClientVersion, type Clock, type ClusterTarget, type ClusterTargetBridge, type ClusterTargetLike, type ClusterTargetResolver, type ClusterTargetSource, type ClusterTargetSourceOptions, type ConnectOptions, type CreateRoomOptions, INBOUND_EVENTS as DEDICATED_INBOUND_EVENTS, DEFAULT_WELCOME_CEILING_MS, DEVICE_SETTINGS_MAX_BYTES, type DataChannelLike$1 as DataChannelLike, type DedicatedServerApi, type DedicatedServerApiOptions, DedicatedServerError, type DedicatedServerFailure, type DedicatedServerSession, type DedicatedSignalTransport, DedicatedSignalingHub, type DedicatedSignalingOptions, type EstablishOptions, FRAME_TO_PARENT, type FailedMatch, type FrameCallbacks, type FrameMessage, type FrameOptions, type FrameState, type GemAdResult, type GemAudioState, type GemCapability, type GemClusterTarget, type GemCohorts, type GemDedicatedEvent, type GemDedicatedOffer, type GemDeviceSettings, type GemDeviceSettingsPut, type GemDeviceSettingsResult, type GemDevtools, type GemError, type GemErrorCode, type GemExit, GemFrame, type GemFrameStats, type GemGameContext, type GemHandshake, type GemHandshakeAccept, GemHost, type GemLocalServer, type GemLocalServerDenied, type GemMessage, type GemOpenExternal, type GemPartyRequest, type GemPartyResult, type GemPause, type GemPlayer, type GemPrefs, type GemProgress, type GemPurchaseResult, type GemReady, type GemRequestAd, type GemRequestContext, type GemRequestFullscreen, type GemRequestLocalServer, type GemRequestPurchase, type GemRequestSignIn, type GemRequestToken, type GemRewardCue, type GemRoomEvent, type GemScreenshot, type GemScreenshotDenied, type GemSeatedEvent, type GemSignInResult, type GemSignal, type GemSignalEvent, type GemSocketState, type GemToken, type GemTokenDenied, type GemViewport, type GemWillTerminate, HANDSHAKE_TIMEOUT_MS, type HandshakeEvent, type HostCallbacks, HostMigration, type HostOptions, type HostState, type JoinCredential, type JoinExchange, type JoinRoomOptions, type JoinWelcome, type KeySource, type ListRoomsOptions, MALFORMED_INBOUND_KEY, MAX_ARRAY_LENGTH, MAX_MESSAGE_BYTES, MAX_MESSAGE_DEPTH, MAX_MESSAGE_NODES, MAX_SIGNALS_PER_SECOND, MAX_SOCKET_FRAME_BYTES, MIGRATION_TIMEOUT_MS, type MatchConnectionState, type MatchEnded, type MatchOutcome, type MatchOutcomeWaitOptions, type MatchReconnected, type MatchReconnecting, type MatchSession, type MatchSessionPhase, type MatchSuspended, type MigrationState, type OfferRefusal, type OfferRequest, P2pApi, type P2pConnectOptions, P2pError, type P2pEventMap, type P2pEventName, type P2pFailure, type P2pMatchApi, type P2pPeer, P2pSession, PARENT_TO_FRAME, PROTOCOL, type ParentMessage, type PartyBridge, type PartyEventRelay, type PartyResolver, type PartyResolverOptions, type PeerConnectionLike$1 as PeerConnectionLike, type PlayerIdentity, PlayerText, type PortLike, type PortMessageHandler, type PresentCredentialOptions, type QuickJoinOptions, RATE_LIMITS, RateLimiter, type ReadyMatch, type Rejection, type RelayedDedicatedEvent, type RelayedRoomEvent, type RelayedSignal, type ResolvedClientVersion, type Room, type RoomArgEntry, type RoomArgScalar, type RoomArgType, type RoomArgValue, type RoomArgs, RoomEmitter, type RoomEventMap, type RoomEventName, type RoomManager, type RoomManagerOptions, type RoomMember, type RoomOperationError, type RoomPage, type RoomStatus, type RoomSummary, RoomsApi, type RoomsApiOptions, SUPPORTED_VERSIONS, type SdpType$1 as SdpType, type SessionDescriptionLike$1 as SessionDescriptionLike, type SignalTransport, type SignalingAnswer, type SignalingChannel, SignalingClient, type SignalingIntent, type StartMatchOptions, type StartedMatch$1 as StartedMatch, TELEMETRY_EVENTS, TRANSPORT_LABELS, type TelemetrySample, type TokenDenial, type TokenGrant, type TransportLabel, type TurnLease, type UpdateRoomOptions, VALIDATORS, type VerifiedCredential, WEBRTC_DEDICATED, WEBRTC_P2P, WEB_ENGINE_VERSION, WEB_PROTOCOL_VERSION, type WindowLike, asPlayerText, awaitMatchOutcome, browserPeerConnection, buildDedicatedOfferFrame, buildSocketFrame, capabilityFor, createClusterTargetSource, createDedicatedServerApi, createKeySource, createP2pApi, createPartyResolver, createRoomManager, deviceSettingsByteLength, establishDataChannel, fingerprintOf, fingerprintsMatch, generateCertificate, isOrigin, listClusterTargets, memberFromWire, negotiateVersion, normaliseClusterTarget, normaliseFingerprint, originsEqual, presentJoinCredential, projectDedicatedEvent, projectPartyEvent, projectSignal, roomArgValuesFromWire, roomArgsTemplateFromWire, roomFromWire, startMatch, summaryFromWire, systemClock, text, unavailableSignaling, validateGemAdResult, validateGemAudioState, validateGemClusterTarget, validateGemCohorts, validateGemDedicatedEvent, validateGemDedicatedOffer, validateGemDeviceSettings, validateGemDeviceSettingsPut, validateGemDeviceSettingsResult, validateGemDevtools, validateGemError, validateGemExit, validateGemFrameStats, validateGemGameContext, validateGemHandshake, validateGemHandshakeAccept, validateGemLocalServer, validateGemLocalServerDenied, validateGemOpenExternal, validateGemPartyRequest, validateGemPartyResult, validateGemPause, validateGemPlayer, validateGemPrefs, validateGemProgress, validateGemPurchaseResult, validateGemReady, validateGemRequestAd, validateGemRequestContext, validateGemRequestFullscreen, validateGemRequestLocalServer, validateGemRequestPurchase, validateGemRequestSignIn, validateGemRequestToken, validateGemRewardCue, validateGemRoomEvent, validateGemScreenshot, validateGemScreenshotDenied, validateGemSeatedEvent, validateGemSignInResult, validateGemSignal, validateGemSignalEvent, validateGemSocketState, validateGemToken, validateGemTokenDenied, validateGemViewport, validateGemWillTerminate, validateSize, verifyCredential };
|