@air-jam/server 0.9.3 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-PSWSCMDN.js → chunk-2BHF5ZCS.js} +2 -12
- package/dist/{chunk-PSWSCMDN.js.map → chunk-2BHF5ZCS.js.map} +1 -1
- package/dist/{chunk-LWVOQ5PH.js → chunk-5YSBR6YK.js} +3 -54
- package/dist/chunk-5YSBR6YK.js.map +1 -0
- package/dist/chunk-64G5AWIQ.js +1271 -0
- package/dist/chunk-64G5AWIQ.js.map +1 -0
- package/dist/chunk-GMZVQDC6.js +54 -0
- package/dist/chunk-GMZVQDC6.js.map +1 -0
- package/dist/chunk-ILYZVHYT.js +39 -0
- package/dist/chunk-ILYZVHYT.js.map +1 -0
- package/dist/chunk-INZKL5US.js +484 -0
- package/dist/chunk-INZKL5US.js.map +1 -0
- package/dist/chunk-JYI2GKLJ.js +334 -0
- package/dist/chunk-JYI2GKLJ.js.map +1 -0
- package/dist/cli.js +9 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +15 -449
- package/dist/index.js +11 -5175
- package/dist/index.js.map +1 -1
- package/dist/process-lifecycle-A55YCNJN.js +8 -0
- package/dist/room-server-4U4TBSS5.js +13 -0
- package/dist/room-server-4U4TBSS5.js.map +1 -0
- package/dist/room-server-BO0iOvhH.d.ts +144 -0
- package/dist/room-server.d.ts +7 -0
- package/dist/room-server.js +13 -0
- package/dist/room-server.js.map +1 -0
- package/dist/room.d.ts +360 -0
- package/dist/room.js +17 -0
- package/dist/room.js.map +1 -0
- package/package.json +13 -15
- package/dist/chunk-AYTGY3H3.js +0 -67
- package/dist/chunk-AYTGY3H3.js.map +0 -1
- package/dist/chunk-LWVOQ5PH.js.map +0 -1
- package/dist/process-lifecycle-M4XOAN4Q.js +0 -8
- /package/dist/{process-lifecycle-M4XOAN4Q.js.map → process-lifecycle-A55YCNJN.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,414 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ok: false;
|
|
10
|
-
reason: RealtimeAdmissionDenialReason;
|
|
11
|
-
message: string;
|
|
12
|
-
retryAfterSeconds: number | null;
|
|
13
|
-
};
|
|
14
|
-
type RealtimeRoomLease = {
|
|
15
|
-
roomId: string;
|
|
16
|
-
leaseToken: string;
|
|
17
|
-
};
|
|
18
|
-
type RealtimeControllerLease = {
|
|
19
|
-
roomId: string;
|
|
20
|
-
controllerId: string;
|
|
21
|
-
leaseToken: string;
|
|
22
|
-
};
|
|
23
|
-
type RealtimeAdmissionDecision<TLease> = {
|
|
24
|
-
ok: true;
|
|
25
|
-
lease: TLease;
|
|
26
|
-
} | RealtimeAdmissionDenial;
|
|
27
|
-
type RealtimeAdmissionStatus = {
|
|
28
|
-
contractVersion: 1;
|
|
29
|
-
authority: "database" | "local" | "unavailable";
|
|
30
|
-
budgetRequirement: "required" | "not_applicable";
|
|
31
|
-
instanceId: string;
|
|
32
|
-
acceptingNewWork: boolean;
|
|
33
|
-
draining: boolean;
|
|
34
|
-
terminalAuthorityLost: boolean;
|
|
35
|
-
pendingReconciliations: number;
|
|
36
|
-
lastHeartbeatAt: string | null;
|
|
37
|
-
lastError: string | null;
|
|
38
|
-
};
|
|
39
|
-
interface RealtimeAdmissionService {
|
|
40
|
-
start: () => Promise<void>;
|
|
41
|
-
beginDrain: () => Promise<void>;
|
|
42
|
-
stop: () => Promise<void>;
|
|
43
|
-
admitRoom: (input: {
|
|
44
|
-
roomId: string;
|
|
45
|
-
appId?: string;
|
|
46
|
-
gameId?: string;
|
|
47
|
-
creatorId?: string;
|
|
48
|
-
maxControllers: number;
|
|
49
|
-
replacingLease?: RealtimeRoomLease;
|
|
50
|
-
}) => Promise<RealtimeAdmissionDecision<RealtimeRoomLease>>;
|
|
51
|
-
releaseRoom: (lease: RealtimeRoomLease) => Promise<void>;
|
|
52
|
-
admitController: (input: {
|
|
53
|
-
roomLease: RealtimeRoomLease;
|
|
54
|
-
controllerId: string;
|
|
55
|
-
existingLease?: RealtimeControllerLease;
|
|
56
|
-
replacingLease?: RealtimeControllerLease;
|
|
57
|
-
}) => Promise<RealtimeAdmissionDecision<RealtimeControllerLease>>;
|
|
58
|
-
markControllerDisconnected: (lease: RealtimeControllerLease, resumeLeaseMs: number | null) => Promise<void>;
|
|
59
|
-
releaseController: (lease: RealtimeControllerLease) => Promise<void>;
|
|
60
|
-
getStatus: () => RealtimeAdmissionStatus;
|
|
61
|
-
onTerminalAuthorityLoss: (listener: (failure: RealtimeAdmissionTerminalFailure) => void) => () => void;
|
|
62
|
-
}
|
|
63
|
-
type RealtimeAdmissionTerminalFailure = {
|
|
64
|
-
code: "instance_lease_lost";
|
|
65
|
-
message: string;
|
|
66
|
-
};
|
|
67
|
-
declare const createLocalRealtimeAdmissionService: ({ instanceId, }?: {
|
|
68
|
-
instanceId?: string;
|
|
69
|
-
}) => RealtimeAdmissionService;
|
|
70
|
-
|
|
71
|
-
type ControllerOrientation = NonNullable<ControllerStateMessage["state"]["orientation"]>;
|
|
72
|
-
/**
|
|
73
|
-
* Controller session information
|
|
74
|
-
*/
|
|
75
|
-
interface ControllerSession {
|
|
76
|
-
controllerId: string;
|
|
77
|
-
/** Private proof, valid only for this controller entry's lifetime. */
|
|
78
|
-
resumeCapabilityToken: string;
|
|
79
|
-
deviceId: string;
|
|
80
|
-
nickname?: string;
|
|
81
|
-
socketId?: string;
|
|
82
|
-
connected: boolean;
|
|
83
|
-
resumeLeaseExpiresAt: number | null;
|
|
84
|
-
pendingDisconnectTimer?: ReturnType<typeof setTimeout>;
|
|
85
|
-
retiredAt?: number;
|
|
86
|
-
playerProfile: PlayerProfile;
|
|
87
|
-
privilegedGrants: ControllerPrivilegedGrant[];
|
|
88
|
-
source: ControllerSource;
|
|
89
|
-
admissionLease: RealtimeControllerLease;
|
|
90
|
-
}
|
|
91
|
-
interface RoomAnalyticsState {
|
|
92
|
-
runtimeSessionId: string;
|
|
93
|
-
startedAt: number;
|
|
94
|
-
appId?: string;
|
|
95
|
-
gameId?: string;
|
|
96
|
-
hostVerifiedVia?: "appId" | "hostGrant";
|
|
97
|
-
hostVerifiedOrigin?: string;
|
|
98
|
-
hostSessionKind: HostSessionKind;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Room focus state - determines which host receives inputs
|
|
102
|
-
*/
|
|
103
|
-
type RoomFocus = "SYSTEM" | "GAME";
|
|
104
|
-
/**
|
|
105
|
-
* Explicit room lifecycle state
|
|
106
|
-
*/
|
|
107
|
-
type RoomLifecycleState = "SYSTEM_IDLE" | "GAME_LAUNCH_PENDING" | "GAME_ACTIVE" | "CLOSING" | "TEARDOWN";
|
|
108
|
-
/**
|
|
109
|
-
* Room session state
|
|
110
|
-
*/
|
|
111
|
-
interface RoomSession {
|
|
112
|
-
roomId: RoomCode;
|
|
113
|
-
masterHostSocketId: string;
|
|
114
|
-
hostResumeCapability: HostResumeCapability;
|
|
115
|
-
childHostSocketId?: string;
|
|
116
|
-
analytics: RoomAnalyticsState;
|
|
117
|
-
focus: RoomFocus;
|
|
118
|
-
launchCapability?: ChildHostCapability;
|
|
119
|
-
controllerCapability?: ControllerPrivilegedCapability;
|
|
120
|
-
/** Set when a game is launched from the system host (`system:launchGame`). */
|
|
121
|
-
activeGameId?: string;
|
|
122
|
-
controllers: Map<string, ControllerSession>;
|
|
123
|
-
replicatedStoreSnapshots: Map<string, AirJamStateSyncPayload>;
|
|
124
|
-
maxPlayers: number;
|
|
125
|
-
runtimeState: RuntimeState;
|
|
126
|
-
stateVersion: number;
|
|
127
|
-
controllerOrientation: ControllerOrientation;
|
|
128
|
-
roomSettings: ControllerRoomSettingsState;
|
|
129
|
-
lifecycleState: RoomLifecycleState;
|
|
130
|
-
admissionLease: RealtimeRoomLease;
|
|
131
|
-
/** Deferred teardown when child host socket drops (Socket.IO reconnect grace). */
|
|
132
|
-
pendingChildTeardownTimer?: ReturnType<typeof setTimeout>;
|
|
133
|
-
/** Deferred teardown when the master host socket drops. */
|
|
134
|
-
pendingRoomCloseTimer?: ReturnType<typeof setTimeout>;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Index entry for controller tracking
|
|
138
|
-
*/
|
|
139
|
-
interface ControllerIndexEntry {
|
|
140
|
-
roomId: RoomCode;
|
|
141
|
-
controllerId: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
type HostVerificationMode = NonNullable<HostSocketAuthority["verifiedVia"]>;
|
|
145
|
-
type RuntimeUsageEventKind = "host_bootstrap_verified" | "room_created" | "room_registered" | "game_launch_started" | "game_became_active" | "game_returned_to_system" | "controller_joined" | "controller_disconnected" | "controller_left" | "room_closed";
|
|
146
|
-
interface RuntimeUsageEvent {
|
|
147
|
-
id: string;
|
|
148
|
-
kind: RuntimeUsageEventKind;
|
|
149
|
-
occurredAt: number;
|
|
150
|
-
runtimeSessionId?: string;
|
|
151
|
-
runtimeSessionStartedAt?: number;
|
|
152
|
-
roomId?: RoomCode;
|
|
153
|
-
appId?: string;
|
|
154
|
-
gameId?: string;
|
|
155
|
-
hostVerifiedVia?: HostVerificationMode;
|
|
156
|
-
hostVerifiedOrigin?: string;
|
|
157
|
-
payload?: Record<string, unknown>;
|
|
158
|
-
}
|
|
159
|
-
interface RuntimeUsagePublisher {
|
|
160
|
-
publish: (event: RuntimeUsageEvent) => void;
|
|
161
|
-
}
|
|
162
|
-
declare const createRuntimeUsageEvent: (event: Omit<RuntimeUsageEvent, "id" | "occurredAt"> & {
|
|
163
|
-
occurredAt?: number;
|
|
164
|
-
}) => RuntimeUsageEvent;
|
|
165
|
-
|
|
166
|
-
type AuthMode = "disabled" | "required";
|
|
167
|
-
type ProxyHeaderTrustMode = "auto" | "enabled" | "disabled";
|
|
168
|
-
declare const loadServerEnv: (env?: Record<string, string | undefined>) => {
|
|
169
|
-
nodeEnv: string;
|
|
170
|
-
port: number;
|
|
171
|
-
rateLimitWindowMs: number;
|
|
172
|
-
hostRegistrationRateLimitMax: number;
|
|
173
|
-
controllerJoinRateLimitMax: number;
|
|
174
|
-
staticAppRateLimitMax: number;
|
|
175
|
-
runtimeErrorReportRateLimitMax: number;
|
|
176
|
-
allowedOrigins: string[] | "*";
|
|
177
|
-
devLogCollectorEnabled: boolean;
|
|
178
|
-
devLogDir: string | undefined;
|
|
179
|
-
authMode: AuthMode;
|
|
180
|
-
proxyHeaderTrustMode: ProxyHeaderTrustMode;
|
|
181
|
-
masterKey: string | undefined;
|
|
182
|
-
logLevel: string | undefined;
|
|
183
|
-
maintenanceMode: boolean;
|
|
184
|
-
};
|
|
185
|
-
type ServerEnvConfig = ReturnType<typeof loadServerEnv>;
|
|
186
|
-
|
|
187
|
-
interface BrowserLogEntry {
|
|
188
|
-
time?: string;
|
|
189
|
-
occurredAt?: string;
|
|
190
|
-
level: "debug" | "info" | "warn" | "error";
|
|
191
|
-
source: AirJamDevBrowserLogSource;
|
|
192
|
-
message: string;
|
|
193
|
-
sourceSeq?: number;
|
|
194
|
-
repeatCount?: number;
|
|
195
|
-
event?: AirJamDevLogEventName;
|
|
196
|
-
data?: unknown[];
|
|
197
|
-
stack?: string;
|
|
198
|
-
code?: string;
|
|
199
|
-
consoleCategory?: AirJamDevBrowserConsoleCategory;
|
|
200
|
-
role?: "host" | "controller";
|
|
201
|
-
traceId?: string;
|
|
202
|
-
roomId?: string;
|
|
203
|
-
controllerId?: string;
|
|
204
|
-
runtimeEpoch?: number;
|
|
205
|
-
runtimeKind?: string;
|
|
206
|
-
}
|
|
207
|
-
interface BrowserLogSessionMetadata {
|
|
208
|
-
appId?: string;
|
|
209
|
-
traceId?: string;
|
|
210
|
-
roomId?: string;
|
|
211
|
-
controllerId?: string;
|
|
212
|
-
role?: "host" | "controller";
|
|
213
|
-
origin?: string;
|
|
214
|
-
pathname?: string;
|
|
215
|
-
href?: string;
|
|
216
|
-
title?: string;
|
|
217
|
-
userAgent?: string;
|
|
218
|
-
}
|
|
219
|
-
interface BrowserLogBatchPayload {
|
|
220
|
-
mode: "reset" | "append";
|
|
221
|
-
sessionId: string;
|
|
222
|
-
metadata: BrowserLogSessionMetadata;
|
|
223
|
-
entries: BrowserLogEntry[];
|
|
224
|
-
}
|
|
225
|
-
interface BrowserLogUnloadPayload {
|
|
226
|
-
sessionId: string;
|
|
227
|
-
metadata: BrowserLogSessionMetadata;
|
|
228
|
-
entry: BrowserLogEntry;
|
|
229
|
-
}
|
|
230
|
-
declare class DevLogCollector {
|
|
231
|
-
readonly enabled: boolean;
|
|
232
|
-
readonly logDir: string;
|
|
233
|
-
readonly latestFilePath: string;
|
|
234
|
-
private writeQueue;
|
|
235
|
-
private nextCollectorSeq;
|
|
236
|
-
constructor(options: {
|
|
237
|
-
enabled: boolean;
|
|
238
|
-
logDir: string;
|
|
239
|
-
});
|
|
240
|
-
enqueueServerLogLine(line: string): void;
|
|
241
|
-
enqueueBrowserBatch(payload: BrowserLogBatchPayload): void;
|
|
242
|
-
enqueueBrowserUnload(payload: BrowserLogUnloadPayload): void;
|
|
243
|
-
flush(): Promise<void>;
|
|
244
|
-
private appendEvent;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
type ServerLogger = Logger;
|
|
248
|
-
interface CreateServerLoggerOptions {
|
|
249
|
-
level?: string;
|
|
250
|
-
}
|
|
251
|
-
declare const createServerLogger: (bindings?: Bindings, parent?: ServerLogger, devLogCollector?: DevLogCollector | null, options?: CreateServerLoggerOptions) => ServerLogger;
|
|
252
|
-
|
|
253
|
-
interface ServerLoggingOptions {
|
|
254
|
-
logger?: ServerLogger;
|
|
255
|
-
devLogCollector?: DevLogCollector | false;
|
|
256
|
-
devLogDir?: string;
|
|
257
|
-
}
|
|
258
|
-
declare const createServerLogging: (options: ServerLoggingOptions, envConfig: ServerEnvConfig) => {
|
|
259
|
-
logger: ServerLogger;
|
|
260
|
-
devLogCollector: false | DevLogCollector;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
type ServerOperationalFailureInput = {
|
|
264
|
-
code: string;
|
|
265
|
-
failureClass: "invalid_input" | "authorization" | "conflict" | "dependency" | "timeout" | "capacity" | "unavailable" | "internal";
|
|
266
|
-
summary: string;
|
|
267
|
-
retryable: boolean;
|
|
268
|
-
component: string;
|
|
269
|
-
subject: {
|
|
270
|
-
type: "service" | "runtime_session";
|
|
271
|
-
id: string;
|
|
272
|
-
};
|
|
273
|
-
correlation: {
|
|
274
|
-
contractVersion: 1;
|
|
275
|
-
correlationId: string;
|
|
276
|
-
roomId?: string;
|
|
277
|
-
runtimeSessionId?: string;
|
|
278
|
-
controllerId?: string;
|
|
279
|
-
gameId?: string;
|
|
280
|
-
};
|
|
281
|
-
occurredAt?: Date;
|
|
282
|
-
details?: Record<string, unknown>;
|
|
283
|
-
};
|
|
284
|
-
type ServerRuntimeErrorReportInput = {
|
|
285
|
-
reportId: string;
|
|
286
|
-
roomId: string;
|
|
287
|
-
runtimeSessionId: string;
|
|
288
|
-
controllerId?: string;
|
|
289
|
-
gameId?: string;
|
|
290
|
-
role: "host" | "controller";
|
|
291
|
-
code: "AJ_RUNTIME_RENDER_CRASH";
|
|
292
|
-
errorName: string;
|
|
293
|
-
digest: string;
|
|
294
|
-
clientOccurredAt: string;
|
|
295
|
-
};
|
|
296
|
-
interface ServerOperationalEventPublisher {
|
|
297
|
-
publishFailure(input: ServerOperationalFailureInput): Promise<void>;
|
|
298
|
-
publishRuntimeErrorReport(input: ServerRuntimeErrorReportInput): Promise<void>;
|
|
299
|
-
}
|
|
300
|
-
declare const publishServerOperationalFailureSafely: ({ publisher, logger, input, }: {
|
|
301
|
-
publisher: ServerOperationalEventPublisher;
|
|
302
|
-
logger: ServerLogger;
|
|
303
|
-
input: ServerOperationalFailureInput;
|
|
304
|
-
}) => void;
|
|
305
|
-
|
|
306
|
-
type AllowedOrigins = string[] | "*";
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* App identity verification result
|
|
310
|
-
*/
|
|
311
|
-
interface VerificationResult {
|
|
312
|
-
isVerified: boolean;
|
|
313
|
-
error?: string;
|
|
314
|
-
gameId?: string;
|
|
315
|
-
creatorId?: string;
|
|
316
|
-
}
|
|
317
|
-
interface VerifyAppIdContext {
|
|
318
|
-
origin?: string;
|
|
319
|
-
}
|
|
320
|
-
interface VerifyHostBootstrapInput {
|
|
321
|
-
appId?: string;
|
|
322
|
-
hostGrant?: string;
|
|
323
|
-
origin?: string;
|
|
324
|
-
hostSessionKind?: HostSessionKind;
|
|
325
|
-
}
|
|
326
|
-
interface HostBootstrapVerificationResult extends VerificationResult {
|
|
327
|
-
appId?: string;
|
|
328
|
-
verifiedVia?: "appId" | "hostGrant";
|
|
329
|
-
verifiedOrigin?: string;
|
|
330
|
-
grantClaims?: HostGrantClaims;
|
|
331
|
-
hostSessionKind?: HostSessionKind;
|
|
332
|
-
}
|
|
333
|
-
interface HostBootstrapAuthService {
|
|
334
|
-
verifyHostBootstrap: (input: VerifyHostBootstrapInput) => Promise<HostBootstrapVerificationResult>;
|
|
335
|
-
getStartupConfigurationError?: () => string | null;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
interface RateLimitResult {
|
|
339
|
-
allowed: boolean;
|
|
340
|
-
retryAfterMs: number;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Minimal in-memory fixed-window limiter.
|
|
344
|
-
* Good enough for single-instance deployments and lightweight abuse protection.
|
|
345
|
-
*/
|
|
346
|
-
declare class RateLimitService {
|
|
347
|
-
private entries;
|
|
348
|
-
private checks;
|
|
349
|
-
check(key: string, limit: number, windowMs: number): RateLimitResult;
|
|
350
|
-
private maybeCleanup;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Room manager service
|
|
355
|
-
* Handles all room state management and lookup operations
|
|
356
|
-
*/
|
|
357
|
-
declare class RoomManager {
|
|
358
|
-
private rooms;
|
|
359
|
-
private hostIndex;
|
|
360
|
-
private controllerIndex;
|
|
361
|
-
private clearRoomTimers;
|
|
362
|
-
/**
|
|
363
|
-
* Get a room by ID
|
|
364
|
-
*/
|
|
365
|
-
getRoom(roomId: RoomCode): RoomSession | undefined;
|
|
366
|
-
/**
|
|
367
|
-
* Create or update a room
|
|
368
|
-
*/
|
|
369
|
-
setRoom(roomId: RoomCode, session: RoomSession): void;
|
|
370
|
-
/**
|
|
371
|
-
* Delete a room
|
|
372
|
-
*/
|
|
373
|
-
deleteRoom(roomId: RoomCode): void;
|
|
374
|
-
/**
|
|
375
|
-
* Get room ID by host socket ID
|
|
376
|
-
*/
|
|
377
|
-
getRoomByHostId(socketId: string): RoomCode | undefined;
|
|
378
|
-
/**
|
|
379
|
-
* Associate a host socket with a room
|
|
380
|
-
*/
|
|
381
|
-
setHostRoom(socketId: string, roomId: RoomCode): void;
|
|
382
|
-
/**
|
|
383
|
-
* Remove host association
|
|
384
|
-
*/
|
|
385
|
-
deleteHost(socketId: string): void;
|
|
386
|
-
/**
|
|
387
|
-
* Get controller info by socket ID
|
|
388
|
-
*/
|
|
389
|
-
getControllerInfo(socketId: string): ControllerIndexEntry | undefined;
|
|
390
|
-
/**
|
|
391
|
-
* Associate a controller socket with room and controller ID
|
|
392
|
-
*/
|
|
393
|
-
setController(socketId: string, entry: ControllerIndexEntry): void;
|
|
394
|
-
/**
|
|
395
|
-
* Remove controller association
|
|
396
|
-
*/
|
|
397
|
-
deleteController(socketId: string): void;
|
|
398
|
-
/**
|
|
399
|
-
* Get the active host socket ID based on focus
|
|
400
|
-
*/
|
|
401
|
-
getActiveHostId(session: RoomSession): string;
|
|
402
|
-
/**
|
|
403
|
-
* Remove a room and clean up all associations
|
|
404
|
-
*/
|
|
405
|
-
removeRoom(roomId: RoomCode, io: Server, reason: string): void;
|
|
406
|
-
clearAllRooms(io: Server, reason: string): void;
|
|
407
|
-
/**
|
|
408
|
-
* Get all rooms (for debugging/monitoring)
|
|
409
|
-
*/
|
|
410
|
-
getAllRooms(): Map<RoomCode, RoomSession>;
|
|
411
|
-
}
|
|
1
|
+
import { R as RoomServerRuntime, S as ServerLogger } from './room-server-BO0iOvhH.js';
|
|
2
|
+
export { a as ServerEnvConfig, c as createServerLogger, b as createServerLogging, l as loadServerEnv } from './room-server-BO0iOvhH.js';
|
|
3
|
+
import '@air-jam/sdk/room-protocol';
|
|
4
|
+
import 'node:http';
|
|
5
|
+
import '@air-jam/sdk/protocol';
|
|
6
|
+
import 'pino';
|
|
7
|
+
import './room.js';
|
|
8
|
+
import '@air-jam/sdk/room-session';
|
|
412
9
|
|
|
413
10
|
interface WorkspaceEnvCandidates {
|
|
414
11
|
rootEnvLocal: string;
|
|
@@ -421,45 +18,14 @@ interface LoadWorkspaceEnvOptions {
|
|
|
421
18
|
}
|
|
422
19
|
declare const loadWorkspaceEnv: ({ processEnv, candidates, cwd, }?: LoadWorkspaceEnvOptions) => void;
|
|
423
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Stops the room server once on SIGINT or SIGTERM: every room closes its
|
|
23
|
+
* devices as "restarting", so they come back to the next server. Returns
|
|
24
|
+
* the call that removes the handlers.
|
|
25
|
+
*/
|
|
424
26
|
declare const installServerProcessSignalHandlers: ({ runtime, logger, }: {
|
|
425
|
-
runtime:
|
|
27
|
+
runtime: Pick<RoomServerRuntime, "stop">;
|
|
426
28
|
logger?: ServerLogger;
|
|
427
29
|
}) => (() => void);
|
|
428
30
|
|
|
429
|
-
|
|
430
|
-
interface CreateAirJamServerOptions extends ServerLoggingOptions {
|
|
431
|
-
port?: number;
|
|
432
|
-
rateLimitWindowMs?: number;
|
|
433
|
-
hostRegistrationRateLimitMax?: number;
|
|
434
|
-
controllerJoinRateLimitMax?: number;
|
|
435
|
-
staticAppRateLimitMax?: number;
|
|
436
|
-
runtimeErrorReportRateLimitMax?: number;
|
|
437
|
-
drainTimeoutMs?: number;
|
|
438
|
-
allowedOrigins?: AllowedOrigins;
|
|
439
|
-
authService?: HostBootstrapAuthService;
|
|
440
|
-
runtimeUsagePublisher?: RuntimeUsagePublisher;
|
|
441
|
-
operationalEventPublisher?: ServerOperationalEventPublisher;
|
|
442
|
-
rateLimitService?: RateLimitService;
|
|
443
|
-
roomManager?: RoomManager;
|
|
444
|
-
realtimeAdmissionService?: RealtimeAdmissionService;
|
|
445
|
-
proxyHeaderTrustMode?: ServerEnvConfig["proxyHeaderTrustMode"];
|
|
446
|
-
envConfig?: ServerEnvConfig;
|
|
447
|
-
}
|
|
448
|
-
interface AirJamServerRuntime {
|
|
449
|
-
app: express.Express;
|
|
450
|
-
httpServer: ReturnType<typeof createServer>;
|
|
451
|
-
io: AirJamIoServer;
|
|
452
|
-
start: (portOverride?: number) => Promise<number>;
|
|
453
|
-
drain: (timeoutMs?: number) => Promise<{
|
|
454
|
-
completed: boolean;
|
|
455
|
-
remainingRooms: number;
|
|
456
|
-
waitedMs: number;
|
|
457
|
-
}>;
|
|
458
|
-
stop: () => Promise<void>;
|
|
459
|
-
flushDevLogs: () => Promise<void>;
|
|
460
|
-
getPort: () => number | null;
|
|
461
|
-
onTerminalFailure: (listener: (failure: RealtimeAdmissionTerminalFailure) => void) => () => void;
|
|
462
|
-
}
|
|
463
|
-
declare const createAirJamServer: (options?: CreateAirJamServerOptions) => AirJamServerRuntime;
|
|
464
|
-
|
|
465
|
-
export { type AirJamIoServer, type AirJamServerRuntime, type CreateAirJamServerOptions, type HostBootstrapAuthService, type HostBootstrapVerificationResult, RateLimitService, type RealtimeAdmissionDecision, type RealtimeAdmissionDenial, type RealtimeAdmissionDenialReason, type RealtimeAdmissionService, type RealtimeAdmissionStatus, type RealtimeAdmissionTerminalFailure, type RealtimeControllerLease, type RealtimeRoomLease, RoomManager, type RuntimeUsageEvent, type RuntimeUsagePublisher, type ServerEnvConfig, type ServerLogger, type ServerOperationalEventPublisher, type ServerOperationalFailureInput, type VerificationResult, type VerifyAppIdContext, type VerifyHostBootstrapInput, createAirJamServer, createLocalRealtimeAdmissionService, createRuntimeUsageEvent, createServerLogger, createServerLogging, installServerProcessSignalHandlers, loadServerEnv, loadWorkspaceEnv, publishServerOperationalFailureSafely };
|
|
31
|
+
export { ServerLogger, installServerProcessSignalHandlers, loadWorkspaceEnv };
|