@pluv/io 2.1.0 → 2.2.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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @pluv/io@2.1.0 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@2.2.0 build /home/runner/work/pluv/pluv/packages/io
3
3
  > pnpm run version && tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
 
6
- > @pluv/io@2.1.0 version /home/runner/work/pluv/pluv/packages/io
6
+ > @pluv/io@2.2.0 version /home/runner/work/pluv/pluv/packages/io
7
7
  > genversion ./src/version.generated.ts --esm
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -12,11 +12,11 @@
12
12
  CLI Target: es6
13
13
  ESM Build start
14
14
  CJS Build start
15
- CJS dist/index.js 53.49 KB
16
- CJS ⚡️ Build success in 175ms
17
- ESM dist/index.mjs 51.32 KB
18
- ESM ⚡️ Build success in 176ms
15
+ CJS dist/index.js 54.10 KB
16
+ CJS ⚡️ Build success in 130ms
17
+ ESM dist/index.mjs 51.92 KB
18
+ ESM ⚡️ Build success in 130ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 4133ms
21
- DTS dist/index.d.mts 32.19 KB
22
- DTS dist/index.d.ts 32.19 KB
20
+ DTS ⚡️ Build success in 4044ms
21
+ DTS dist/index.d.mts 32.42 KB
22
+ DTS dist/index.d.ts 32.42 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - cb660cd: Fixed multiple Cloudflare Worker Durable Objects sharing references to the same I/O methods.
8
+ - @pluv/crdt@2.2.0
9
+ - @pluv/types@2.2.0
10
+
3
11
  ## 2.1.0
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -122,15 +122,16 @@ declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatf
122
122
 
123
123
  type PluvContext<TPlatform extends AbstractPlatform, TContext extends Record<string, any>> = TContext | ((params: InferRoomContextType<TPlatform>) => TContext);
124
124
  interface CrdtLibraryType {
125
- doc: (value: any) => AbstractCrdtDocFactory<any>;
125
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
126
126
  kind: "loro" | "yjs";
127
127
  }
128
128
  type EventResolverKind = "broadcast" | "self" | "sync";
129
129
  type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
130
130
  interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
131
131
  context: TContext;
132
- doc: CrdtDocLike<any>;
132
+ doc: CrdtDocLike<any, any>;
133
133
  garbageCollect: () => Promise<void>;
134
+ platform: TPlatform;
134
135
  presence: JsonObject | null;
135
136
  room: string;
136
137
  session: TKind extends "sync" ? WebSocketSession<TAuthorize> | null : WebSocketSession<TAuthorize>;
@@ -214,7 +215,7 @@ interface PluvIOLimits {
214
215
  userMaxSize?: number | null;
215
216
  }
216
217
  type BasePluvIOListeners<TPlatform extends AbstractPlatform<any, any, any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = {
217
- onRoomDeleted: (event: IORoomListenerEvent<TContext>) => void;
218
+ onRoomDeleted: (event: IORoomListenerEvent<TPlatform, TContext>) => void;
218
219
  onRoomMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
219
220
  onStorageUpdated: (event: IOStorageUpdatedEvent<TPlatform, TAuthorize, TContext>) => void;
220
221
  onUserConnected: (event: IOUserConnectedEvent<TPlatform, TAuthorize, TContext>) => void;
@@ -234,25 +235,26 @@ type InferPlatformListeners<TPlatform extends AbstractPlatform<any, any, any, an
234
235
  [P in keyof PlatformConfig["listeners"] as InferPlatformConfig<TPlatform>["listeners"][P] extends true | undefined ? P : never]: true;
235
236
  };
236
237
  type InferPlatformRouter<TPlatform extends AbstractPlatform<any, any, any, any>> = InferPlatformConfig<TPlatform>["router"];
237
- type IORoomListenerEvent<TContext extends Record<string, any>> = {
238
+ type IORoomListenerEvent<TPlatform extends AbstractPlatform<any, any, any, any>, TContext extends Record<string, any>> = {
238
239
  context: TContext;
239
240
  encodedState: string | null;
241
+ platform: TPlatform;
240
242
  room: string;
241
243
  };
242
- type IORoomMessageEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = IORoomListenerEvent<TContext> & {
244
+ type IORoomMessageEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = IORoomListenerEvent<TPlatform, TContext> & {
243
245
  message: InferEventMessage<InferEventsOutput<TEvents>, keyof InferEventsOutput<TEvents>>;
244
246
  user?: InferIOAuthorizeUser<TAuthorize>;
245
247
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
246
248
  };
247
- type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
249
+ type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
248
250
  user?: InferIOAuthorizeUser<TAuthorize>;
249
251
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
250
252
  };
251
- type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
253
+ type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
252
254
  user?: InferIOAuthorizeUser<TAuthorize>;
253
255
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
254
256
  };
255
- type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
257
+ type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
256
258
  user?: InferIOAuthorizeUser<TAuthorize>;
257
259
  };
258
260
  type WebSocketType<TPlatform extends AbstractPlatform> = InferPlatformWebSocketType<TPlatform> | InferPlatformWebSocketSource<TPlatform>;
@@ -327,7 +329,7 @@ declare abstract class AbstractPlatform<TWebSocket extends AbstractWebSocket<any
327
329
  }
328
330
 
329
331
  interface IORoomListeners<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> {
330
- onDestroy: (event: IORoomListenerEvent<TContext>) => void;
332
+ onDestroy: (event: IORoomListenerEvent<TPlatform, TContext>) => void;
331
333
  onMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
332
334
  onUserConnected: (event: IOUserConnectedEvent<TPlatform, TAuthorize, TContext>) => void;
333
335
  onUserDisconnected: (event: IOUserDisconnectedEvent<TPlatform, TAuthorize, TContext>) => void;
@@ -339,7 +341,7 @@ type IORoomConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any
339
341
  authorize?: TAuthorize;
340
342
  context: TContext;
341
343
  crdt?: {
342
- doc: (value: any) => AbstractCrdtDocFactory<any>;
344
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
343
345
  };
344
346
  debug: boolean;
345
347
  platform: TPlatform;
@@ -433,13 +435,13 @@ type PluvServerConfig<TPlatform extends AbstractPlatform<any, any> = AbstractPla
433
435
  authorize?: TAuthorize;
434
436
  context?: PluvContext<TPlatform, TContext>;
435
437
  crdt?: {
436
- doc: (value: any) => AbstractCrdtDocFactory<any>;
438
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
437
439
  };
438
440
  debug?: boolean;
439
441
  getInitialStorage?: GetInitialStorageFn<TContext>;
440
442
  limits: PluvIOLimits;
441
443
  io: PluvIO<TPlatform, TAuthorize, TContext>;
442
- platform: TPlatform;
444
+ platform: () => TPlatform;
443
445
  router?: PluvRouter<TPlatform, TAuthorize, TContext, TEvents>;
444
446
  };
445
447
  type BaseCreateRoomOptions<TPlatform extends AbstractPlatform<any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = Partial<IORoomListeners<TPlatform, TAuthorize, TContext, TEvents>> & {
@@ -451,7 +453,6 @@ type CreateRoomOptions<TPlatform extends AbstractPlatform<any, any>, TAuthorize
451
453
  declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = AbstractPlatform<any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IOLike<TAuthorize, TEvents> {
452
454
  readonly version: string;
453
455
  private readonly _authorize;
454
- private readonly _baseRouter;
455
456
  private readonly _context;
456
457
  private readonly _crdt;
457
458
  private readonly _debug;
@@ -459,7 +460,7 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = Abstract
459
460
  private readonly _io;
460
461
  private readonly _limits;
461
462
  private readonly _platform;
462
- private readonly _router;
463
+ private readonly _inputRouter;
463
464
  get fetch(): (...args: any[]) => Promise<any>;
464
465
  /**
465
466
  * @ignore
@@ -472,7 +473,9 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = Abstract
472
473
  events: TEvents;
473
474
  platform: TPlatform;
474
475
  };
476
+ private get _baseRouter();
475
477
  private get _procedure();
478
+ private get _router();
476
479
  constructor(options: PluvServerConfig<TPlatform, TAuthorize, TContext, TEvents>);
477
480
  createRoom(room: string, ...options: CreateRoomOptions<TPlatform, TAuthorize, TContext, TEvents>): IORoom<TPlatform, TAuthorize, TContext, TEvents>;
478
481
  createToken(params: JWTEncodeParams<InferIOAuthorizeUser<InferIOAuthorize<this>>, TPlatform>): Promise<string>;
@@ -486,7 +489,7 @@ type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IO
486
489
  crdt?: CrdtLibraryType;
487
490
  debug?: boolean;
488
491
  limits?: PluvIOLimits;
489
- platform: TPlatform;
492
+ platform: () => TPlatform;
490
493
  };
491
494
  type ResolvedServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = Partial<PluvIOListeners<TPlatform, TAuthorize, TContext, TEvents>> & PluvIORouter<TPlatform, TAuthorize, TContext, TEvents> & {
492
495
  getInitialStorage?: GetInitialStorageFn<TContext>;
@@ -517,7 +520,7 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
517
520
  crdt?: CrdtLibraryType;
518
521
  debug?: boolean;
519
522
  limits?: PluvIOLimits;
520
- platform: TPlatform;
523
+ platform: () => TPlatform;
521
524
  };
522
525
  declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(params: CreateIOParams<TPlatform, TContext, TUser>) => PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext>;
523
526
 
package/dist/index.d.ts CHANGED
@@ -122,15 +122,16 @@ declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatf
122
122
 
123
123
  type PluvContext<TPlatform extends AbstractPlatform, TContext extends Record<string, any>> = TContext | ((params: InferRoomContextType<TPlatform>) => TContext);
124
124
  interface CrdtLibraryType {
125
- doc: (value: any) => AbstractCrdtDocFactory<any>;
125
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
126
126
  kind: "loro" | "yjs";
127
127
  }
128
128
  type EventResolverKind = "broadcast" | "self" | "sync";
129
129
  type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
130
130
  interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
131
131
  context: TContext;
132
- doc: CrdtDocLike<any>;
132
+ doc: CrdtDocLike<any, any>;
133
133
  garbageCollect: () => Promise<void>;
134
+ platform: TPlatform;
134
135
  presence: JsonObject | null;
135
136
  room: string;
136
137
  session: TKind extends "sync" ? WebSocketSession<TAuthorize> | null : WebSocketSession<TAuthorize>;
@@ -214,7 +215,7 @@ interface PluvIOLimits {
214
215
  userMaxSize?: number | null;
215
216
  }
216
217
  type BasePluvIOListeners<TPlatform extends AbstractPlatform<any, any, any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = {
217
- onRoomDeleted: (event: IORoomListenerEvent<TContext>) => void;
218
+ onRoomDeleted: (event: IORoomListenerEvent<TPlatform, TContext>) => void;
218
219
  onRoomMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
219
220
  onStorageUpdated: (event: IOStorageUpdatedEvent<TPlatform, TAuthorize, TContext>) => void;
220
221
  onUserConnected: (event: IOUserConnectedEvent<TPlatform, TAuthorize, TContext>) => void;
@@ -234,25 +235,26 @@ type InferPlatformListeners<TPlatform extends AbstractPlatform<any, any, any, an
234
235
  [P in keyof PlatformConfig["listeners"] as InferPlatformConfig<TPlatform>["listeners"][P] extends true | undefined ? P : never]: true;
235
236
  };
236
237
  type InferPlatformRouter<TPlatform extends AbstractPlatform<any, any, any, any>> = InferPlatformConfig<TPlatform>["router"];
237
- type IORoomListenerEvent<TContext extends Record<string, any>> = {
238
+ type IORoomListenerEvent<TPlatform extends AbstractPlatform<any, any, any, any>, TContext extends Record<string, any>> = {
238
239
  context: TContext;
239
240
  encodedState: string | null;
241
+ platform: TPlatform;
240
242
  room: string;
241
243
  };
242
- type IORoomMessageEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = IORoomListenerEvent<TContext> & {
244
+ type IORoomMessageEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = IORoomListenerEvent<TPlatform, TContext> & {
243
245
  message: InferEventMessage<InferEventsOutput<TEvents>, keyof InferEventsOutput<TEvents>>;
244
246
  user?: InferIOAuthorizeUser<TAuthorize>;
245
247
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
246
248
  };
247
- type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
249
+ type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
248
250
  user?: InferIOAuthorizeUser<TAuthorize>;
249
251
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
250
252
  };
251
- type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
253
+ type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
252
254
  user?: InferIOAuthorizeUser<TAuthorize>;
253
255
  webSocket?: InferPlatformWebSocketSource<TPlatform>;
254
256
  };
255
- type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TContext> & {
257
+ type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
256
258
  user?: InferIOAuthorizeUser<TAuthorize>;
257
259
  };
258
260
  type WebSocketType<TPlatform extends AbstractPlatform> = InferPlatformWebSocketType<TPlatform> | InferPlatformWebSocketSource<TPlatform>;
@@ -327,7 +329,7 @@ declare abstract class AbstractPlatform<TWebSocket extends AbstractWebSocket<any
327
329
  }
328
330
 
329
331
  interface IORoomListeners<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> {
330
- onDestroy: (event: IORoomListenerEvent<TContext>) => void;
332
+ onDestroy: (event: IORoomListenerEvent<TPlatform, TContext>) => void;
331
333
  onMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
332
334
  onUserConnected: (event: IOUserConnectedEvent<TPlatform, TAuthorize, TContext>) => void;
333
335
  onUserDisconnected: (event: IOUserDisconnectedEvent<TPlatform, TAuthorize, TContext>) => void;
@@ -339,7 +341,7 @@ type IORoomConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any
339
341
  authorize?: TAuthorize;
340
342
  context: TContext;
341
343
  crdt?: {
342
- doc: (value: any) => AbstractCrdtDocFactory<any>;
344
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
343
345
  };
344
346
  debug: boolean;
345
347
  platform: TPlatform;
@@ -433,13 +435,13 @@ type PluvServerConfig<TPlatform extends AbstractPlatform<any, any> = AbstractPla
433
435
  authorize?: TAuthorize;
434
436
  context?: PluvContext<TPlatform, TContext>;
435
437
  crdt?: {
436
- doc: (value: any) => AbstractCrdtDocFactory<any>;
438
+ doc: (value: any) => AbstractCrdtDocFactory<any, any>;
437
439
  };
438
440
  debug?: boolean;
439
441
  getInitialStorage?: GetInitialStorageFn<TContext>;
440
442
  limits: PluvIOLimits;
441
443
  io: PluvIO<TPlatform, TAuthorize, TContext>;
442
- platform: TPlatform;
444
+ platform: () => TPlatform;
443
445
  router?: PluvRouter<TPlatform, TAuthorize, TContext, TEvents>;
444
446
  };
445
447
  type BaseCreateRoomOptions<TPlatform extends AbstractPlatform<any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = Partial<IORoomListeners<TPlatform, TAuthorize, TContext, TEvents>> & {
@@ -451,7 +453,6 @@ type CreateRoomOptions<TPlatform extends AbstractPlatform<any, any>, TAuthorize
451
453
  declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = AbstractPlatform<any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IOLike<TAuthorize, TEvents> {
452
454
  readonly version: string;
453
455
  private readonly _authorize;
454
- private readonly _baseRouter;
455
456
  private readonly _context;
456
457
  private readonly _crdt;
457
458
  private readonly _debug;
@@ -459,7 +460,7 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = Abstract
459
460
  private readonly _io;
460
461
  private readonly _limits;
461
462
  private readonly _platform;
462
- private readonly _router;
463
+ private readonly _inputRouter;
463
464
  get fetch(): (...args: any[]) => Promise<any>;
464
465
  /**
465
466
  * @ignore
@@ -472,7 +473,9 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = Abstract
472
473
  events: TEvents;
473
474
  platform: TPlatform;
474
475
  };
476
+ private get _baseRouter();
475
477
  private get _procedure();
478
+ private get _router();
476
479
  constructor(options: PluvServerConfig<TPlatform, TAuthorize, TContext, TEvents>);
477
480
  createRoom(room: string, ...options: CreateRoomOptions<TPlatform, TAuthorize, TContext, TEvents>): IORoom<TPlatform, TAuthorize, TContext, TEvents>;
478
481
  createToken(params: JWTEncodeParams<InferIOAuthorizeUser<InferIOAuthorize<this>>, TPlatform>): Promise<string>;
@@ -486,7 +489,7 @@ type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IO
486
489
  crdt?: CrdtLibraryType;
487
490
  debug?: boolean;
488
491
  limits?: PluvIOLimits;
489
- platform: TPlatform;
492
+ platform: () => TPlatform;
490
493
  };
491
494
  type ResolvedServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = Partial<PluvIOListeners<TPlatform, TAuthorize, TContext, TEvents>> & PluvIORouter<TPlatform, TAuthorize, TContext, TEvents> & {
492
495
  getInitialStorage?: GetInitialStorageFn<TContext>;
@@ -517,7 +520,7 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
517
520
  crdt?: CrdtLibraryType;
518
521
  debug?: boolean;
519
522
  limits?: PluvIOLimits;
520
- platform: TPlatform;
523
+ platform: () => TPlatform;
521
524
  };
522
525
  declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(params: CreateIOParams<TPlatform, TContext, TUser>) => PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext>;
523
526