@eleven-am/pondsocket 0.1.73 → 0.1.74

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +26 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
package/types.d.ts CHANGED
@@ -7,7 +7,10 @@ import { WebSocketServer } from 'ws';
7
7
  type Unsubscribe = () => void;
8
8
 
9
9
  type Constructor<T> = new (...args: any[]) => T;
10
- type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<unknown>) => TypedPropertyDescriptor<unknown> | void;
10
+ declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
11
+ declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
12
+ declare type ParameterDecorator = (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
13
+
11
14
  export type default_t<T = any> = Record<string, T>;
12
15
  type IsParam<Path> = Path extends `:${infer Param}` ? Param : never;
13
16
 
@@ -622,106 +625,107 @@ declare const pondSocket: (app: Express) => PondSocketExpressApp;
622
625
  * @desc The Decorator for retrieving the JoinRequest object from the request in a handler
623
626
  * @returns {JoinRequest}
624
627
  */
625
- declare function GetJoinRequest(): MethodDecorator;
628
+ declare function GetJoinRequest(): ParameterDecorator;
626
629
 
627
630
  /**
628
631
  * @desc The Decorator for retrieving the JoinResponse object from the response in a handler
629
632
  * @returns {JoinResponse}
630
633
  */
631
- declare function GetJoinResponse(): MethodDecorator;
634
+ declare function GetJoinResponse(): ParameterDecorator;
632
635
 
633
636
  /**
634
637
  * @desc The Decorator for retrieving the JoinParams object from the request in a handler
635
638
  * @returns {JoinParams}
636
639
  */
637
- declare function GetJoinParams(): MethodDecorator;
640
+ declare function GetJoinParams(): ParameterDecorator;
638
641
 
639
642
  /**
640
643
  * @desc The Decorator for retrieving the UserData object from the request in a handler
641
644
  * @returns {UserData}
642
645
  */
643
- declare function GetUserData(): MethodDecorator;
646
+ declare function GetUserData(): ParameterDecorator;
644
647
 
645
648
  /**
646
649
  * @desc The Decorator for retrieving the Channel object from the request in a handler
647
650
  * @returns {Channel}
648
651
  */
649
- declare function GetInternalChannel(): MethodDecorator;
652
+ declare function GetInternalChannel(): ParameterDecorator;
650
653
 
651
654
  /**
652
655
  * @desc The Decorator for retrieving the UserPresence object from the request in a handler
653
656
  * @returns {PondPresence}
654
657
  */
655
- declare function GetUserPresence(): MethodDecorator;
658
+ declare function GetUserPresence(): ParameterDecorator;
656
659
 
657
660
  /**
658
661
  * @desc The Decorator for retrieving the event payload from the request in a handler
659
662
  * @returns {PondMessage}
660
663
  */
661
- declare function GetEventPayload(): MethodDecorator;
664
+ declare function GetEventPayload(): ParameterDecorator;
662
665
 
663
666
  /**
664
667
  * @desc The Decorator for retrieving the EventRequest Params object from the request in a handler
665
668
  * @returns {EventParams}
666
669
  */
667
- declare function GetEventParams(): MethodDecorator;
670
+ declare function GetEventParams(): ParameterDecorator;
668
671
 
669
672
  /**
670
673
  * @desc The Decorator for retrieving the EventRequest Query object from the request in a handler
671
674
  * @returns {EventParams}
672
675
  */
673
- declare function GetEventQuery(): MethodDecorator;
676
+ declare function GetEventQuery(): ParameterDecorator;
674
677
 
675
678
  /**
676
679
  * @desc The Decorator for retrieving the EventResponse in a handler
677
680
  * @returns {EventResponse}
678
681
  */
679
- declare function GetEventResponse(): MethodDecorator;
682
+ declare function GetEventResponse(): ParameterDecorator;
680
683
 
681
684
  /**
682
685
  * @desc The Decorator for retrieving the EventRequest in a handler
683
686
  * @returns {EventRequest}
684
687
  */
685
- declare function GetEventRequest(): MethodDecorator;
688
+ declare function GetEventRequest(): ParameterDecorator;
686
689
 
687
690
  /**
688
691
  * @desc The Decorator for retrieving the ConnectionReQuest in a handler
689
692
  * @returns {IncomingConnection}
690
693
  */
691
- declare function GetConnectionRequest(): MethodDecorator;
694
+ declare function GetConnectionRequest(): ParameterDecorator;
692
695
 
693
696
  /**
694
697
  * @desc The Decorator for retrieving the ConnectionResponse in a handler
695
698
  * @returns {ConnectionResponse}
696
699
  */
697
- declare function GetConnectionResponse(): MethodDecorator;
700
+ declare function GetConnectionResponse(): ParameterDecorator;
698
701
 
699
702
  /**
700
703
  * @desc The Decorator for retrieving the ConnectionRequestId in a handler
701
704
  * @returns {string}
702
705
  */
703
- declare function GetConnectionRequestId(): MethodDecorator;
706
+ declare function GetConnectionRequestId(): ParameterDecorator;
704
707
 
705
708
  /**
706
709
  * @desc The Decorator for retrieving the ConnectionParams in a handler
707
710
  * @returns {EventParams}
708
711
  */
709
- declare function GetConnectionParams(): MethodDecorator;
712
+ declare function GetConnectionParams(): ParameterDecorator;
710
713
 
711
714
  /**
712
715
  * @desc The Decorator for retrieving the ConnectionHeaders from the request in a handler
713
716
  * @returns {EventParams}
714
717
  */
715
- declare function GetConnectionHeaders(): MethodDecorator;
718
+ declare function GetConnectionHeaders(): ParameterDecorator;
716
719
 
717
720
  /**
718
721
  * @desc The Decorator for retrieving the ConnectionQuery in a handler
719
722
  * @returns {EventParams}
720
723
  */
721
- declare function GetConnectionQuery(): MethodDecorator;
724
+ declare function GetConnectionQuery(): ParameterDecorator;
722
725
 
723
726
  /**
724
727
  * @desc Marks a method as a handler for JoinRequest events.
728
+ * @param - The path for the JoinRequest event.
725
729
  */
726
730
  declare function OnJoinRequest(): MethodDecorator;
727
731
 
@@ -740,33 +744,25 @@ declare function OnConnectionRequest(): MethodDecorator;
740
744
  * Decorator to mark a class as a channel.
741
745
  * @param path - The path for the channel (default is '*').
742
746
  */
743
- declare function DChannel<T extends Constructor<NonNullable<unknown>>>(
744
- path?: string
745
- ): (constructor: T) => void;
747
+ declare function DChannel(path?: string): ClassDecorator;
746
748
 
747
749
  /**
748
750
  * Decorator to mark a class as having multiple channels.
749
751
  * @param channels - The array of channels.
750
752
  */
751
- declare function Channels<T extends Constructor<NonNullable<unknown>>>(
752
- channels: Constructor<NonNullable<unknown>>[]
753
- ): (constructor: T) => void;
753
+ declare function Channels(channels: Constructor<NonNullable<unknown>>[]): ClassDecorator;
754
754
 
755
755
  /**
756
756
  * Decorator to mark a class as an endpoint.
757
757
  * @param path - The path for the endpoint (default is '*').
758
758
  */
759
- declare function DEndpoint<T extends Constructor<NonNullable<unknown>>>(
760
- path?: string
761
- ): (constructor: T) => void;
759
+ declare function DEndpoint(path?: string): ClassDecorator;
762
760
 
763
761
  /**
764
762
  * Decorator to mark a class as having multiple endpoints.
765
763
  * @param endpoints - The array of endpoints.
766
764
  */
767
- declare function Endpoints<T extends Constructor<NonNullable<unknown>>>(
768
- endpoints: Constructor<NonNullable<unknown>>[]
769
- ): (constructor: T) => void;
765
+ declare function Endpoints(endpoints: Constructor<NonNullable<unknown>>[]): ClassDecorator;
770
766
 
771
767
  declare class PondSocketModule {
772
768
  /**