@@ -83,7 +83,7 @@ export interface PostgresEmitterOptions {
8383
8484export class Emitter <
8585 EmitEvents extends EventsMap = DefaultEventsMap ,
86- ServerSideEvents extends EventsMap = DefaultEventsMap
86+ ServerSideEvents extends EventsMap = DefaultEventsMap ,
8787> {
8888 public readonly channel : string ;
8989 public readonly tableName : string ;
@@ -92,7 +92,7 @@ export class Emitter<
9292 constructor (
9393 readonly pool : any ,
9494 readonly nsp : string = "/" ,
95- opts : Partial < PostgresEmitterOptions > = { }
95+ opts : Partial < PostgresEmitterOptions > = { } ,
9696 ) {
9797 const channelPrefix = opts . channelPrefix || "socket.io" ;
9898 this . channel = `${ channelPrefix } #${ nsp } ` ;
@@ -122,7 +122,7 @@ export class Emitter<
122122 ) : true {
123123 return new BroadcastOperator < EmitEvents , ServerSideEvents > ( this ) . emit (
124124 ev ,
125- ...args
125+ ...args ,
126126 ) ;
127127 }
128128
@@ -134,7 +134,7 @@ export class Emitter<
134134 * @public
135135 */
136136 public to (
137- room : string | string [ ]
137+ room : string | string [ ] ,
138138 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
139139 return new BroadcastOperator ( this ) . to ( room ) ;
140140 }
@@ -147,7 +147,7 @@ export class Emitter<
147147 * @public
148148 */
149149 public in (
150- room : string | string [ ]
150+ room : string | string [ ] ,
151151 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
152152 return new BroadcastOperator ( this ) . in ( room ) ;
153153 }
@@ -160,7 +160,7 @@ export class Emitter<
160160 * @public
161161 */
162162 public except (
163- room : string | string [ ]
163+ room : string | string [ ] ,
164164 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
165165 return new BroadcastOperator ( this ) . except ( room ) ;
166166 }
@@ -185,7 +185,7 @@ export class Emitter<
185185 * @public
186186 */
187187 public compress (
188- compress : boolean
188+ compress : boolean ,
189189 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
190190 return new BroadcastOperator ( this ) . compress ( compress ) ;
191191 }
@@ -231,7 +231,7 @@ export class Emitter<
231231 ...args : EventParams < ServerSideEvents , Ev >
232232 ) : void {
233233 return new BroadcastOperator < EmitEvents , ServerSideEvents > (
234- this
234+ this ,
235235 ) . serverSideEmit ( ev , ...args ) ;
236236 }
237237}
@@ -247,13 +247,14 @@ export const RESERVED_EVENTS: ReadonlySet<string | Symbol> = new Set(<const>[
247247
248248export class BroadcastOperator <
249249 EmitEvents extends EventsMap ,
250- ServerSideEvents extends EventsMap
251- > implements TypedEventBroadcaster < EmitEvents > {
250+ ServerSideEvents extends EventsMap ,
251+ > implements TypedEventBroadcaster < EmitEvents >
252+ {
252253 constructor (
253254 private readonly emitter : Emitter ,
254255 private readonly rooms : Set < string > = new Set < string > ( ) ,
255256 private readonly exceptRooms : Set < string > = new Set < string > ( ) ,
256- private readonly flags : BroadcastFlags = { }
257+ private readonly flags : BroadcastFlags = { } ,
257258 ) { }
258259
259260 /**
@@ -264,7 +265,7 @@ export class BroadcastOperator<
264265 * @public
265266 */
266267 public to (
267- room : string | string [ ]
268+ room : string | string [ ] ,
268269 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
269270 const rooms = new Set ( this . rooms ) ;
270271 if ( Array . isArray ( room ) ) {
@@ -276,7 +277,7 @@ export class BroadcastOperator<
276277 this . emitter ,
277278 rooms ,
278279 this . exceptRooms ,
279- this . flags
280+ this . flags ,
280281 ) ;
281282 }
282283
@@ -288,7 +289,7 @@ export class BroadcastOperator<
288289 * @public
289290 */
290291 public in (
291- room : string | string [ ]
292+ room : string | string [ ] ,
292293 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
293294 return this . to ( room ) ;
294295 }
@@ -301,7 +302,7 @@ export class BroadcastOperator<
301302 * @public
302303 */
303304 public except (
304- room : string | string [ ]
305+ room : string | string [ ] ,
305306 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
306307 const exceptRooms = new Set ( this . exceptRooms ) ;
307308 if ( Array . isArray ( room ) ) {
@@ -313,7 +314,7 @@ export class BroadcastOperator<
313314 this . emitter ,
314315 this . rooms ,
315316 exceptRooms ,
316- this . flags
317+ this . flags ,
317318 ) ;
318319 }
319320
@@ -325,14 +326,14 @@ export class BroadcastOperator<
325326 * @public
326327 */
327328 public compress (
328- compress : boolean
329+ compress : boolean ,
329330 ) : BroadcastOperator < EmitEvents , ServerSideEvents > {
330331 const flags = Object . assign ( { } , this . flags , { compress } ) ;
331332 return new BroadcastOperator (
332333 this . emitter ,
333334 this . rooms ,
334335 this . exceptRooms ,
335- flags
336+ flags ,
336337 ) ;
337338 }
338339
@@ -350,7 +351,7 @@ export class BroadcastOperator<
350351 this . emitter ,
351352 this . rooms ,
352353 this . exceptRooms ,
353- flags
354+ flags ,
354355 ) ;
355356 }
356357
@@ -377,10 +378,10 @@ export class BroadcastOperator<
377378 debug (
378379 "sending event of type %s to channel %s" ,
379380 document . type ,
380- this . emitter . channel
381+ this . emitter . channel ,
381382 ) ;
382383 await this . emitter . pool . query (
383- `NOTIFY "${ this . emitter . channel } ", '${ payload } '`
384+ `NOTIFY "${ this . emitter . channel } ", '${ payload } '` ,
384385 ) ;
385386 } catch ( err ) {
386387 // @ts -ignore
@@ -394,11 +395,11 @@ export class BroadcastOperator<
394395 debug (
395396 "sending event of type %s with attachment to channel %s" ,
396397 document . type ,
397- this . emitter . channel
398+ this . emitter . channel ,
398399 ) ;
399400 const result = await this . emitter . pool . query (
400401 `INSERT INTO ${ this . emitter . tableName } (payload) VALUES ($1) RETURNING id;` ,
401- [ payload ]
402+ [ payload ] ,
402403 ) ;
403404 const attachmentId = result . rows [ 0 ] . id ;
404405 const headerPayload = JSON . stringify ( {
@@ -407,7 +408,7 @@ export class BroadcastOperator<
407408 attachmentId,
408409 } ) ;
409410 this . emitter . pool . query (
410- `NOTIFY "${ this . emitter . channel } ", '${ headerPayload } '`
411+ `NOTIFY "${ this . emitter . channel } ", '${ headerPayload } '` ,
411412 ) ;
412413 }
413414
@@ -422,7 +423,7 @@ export class BroadcastOperator<
422423 ...args : EventParams < EmitEvents , Ev >
423424 ) : true {
424425 if ( RESERVED_EVENTS . has ( ev ) ) {
425- throw new Error ( `"${ ev } " is a reserved event name` ) ;
426+ throw new Error ( `"${ String ( ev ) } " is a reserved event name` ) ;
426427 }
427428
428429 // set up packet object
0 commit comments