@eleven-am/pondsocket 0.1.113 → 0.1.115

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/nest.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  export {
2
+ GetChannel,
2
3
  OnJoinRequest,
3
4
  ChannelInstance,
5
+ EndpointInstance,
4
6
  DChannel as Channel,
5
7
  OnConnectionRequest,
6
8
  DEndpoint as Endpoint,
7
9
  OnEvent, PondSocketModule,
10
+ GetLeaveEvent, OnLeaveEvent,
8
11
  GetEventParams, GetEventQuery,
9
12
  GetEventRequest, GetEventResponse,
10
13
  GetJoinResponse, GetConnectionParams,
package/nest.js CHANGED
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.PondSocketModule = exports.Endpoint = exports.Channel = exports.EndpointInstance = exports.ChannelInstance = exports.OnLeaveEvent = exports.OnEvent = exports.OnJoinRequest = exports.OnConnectionRequest = exports.GetLeaveEvent = exports.GetEventRequest = exports.GetEventResponse = exports.GetEventQuery = exports.GetEventParams = exports.GetEventPayload = exports.GetJoinParams = exports.GetJoinResponse = exports.GetJoinRequest = exports.GetConnectionQuery = exports.GetConnectionHeaders = exports.GetConnectionParams = exports.GetConnectionRequestId = exports.GetConnectionResponse = exports.GetConnectionRequest = exports.GetUserPresences = exports.GetInternalChannel = exports.GetUserData = exports.createParamDecorator = exports.PondGuards = void 0;
23
+ exports.PondSocketModule = exports.Endpoint = exports.Channel = exports.EndpointInstance = exports.ChannelInstance = exports.OnLeaveEvent = exports.OnEvent = exports.OnJoinRequest = exports.OnConnectionRequest = exports.GetChannel = exports.GetLeaveEvent = exports.GetEventRequest = exports.GetEventResponse = exports.GetEventQuery = exports.GetEventParams = exports.GetEventPayload = exports.GetJoinParams = exports.GetJoinResponse = exports.GetJoinRequest = exports.GetConnectionQuery = exports.GetConnectionHeaders = exports.GetConnectionParams = exports.GetConnectionRequestId = exports.GetConnectionResponse = exports.GetConnectionRequest = exports.GetUserPresences = exports.GetInternalChannel = exports.GetUserData = exports.createParamDecorator = exports.PondGuards = void 0;
24
24
  const http_1 = require("http");
25
25
  const common_1 = require("@nestjs/common");
26
26
  // eslint-disable-next-line import/no-unresolved
@@ -239,6 +239,10 @@ class Context {
239
239
  }
240
240
  return null;
241
241
  }
242
+ get assigns() {
243
+ var _a, _b, _c, _d, _e, _f;
244
+ return (_f = (_d = (_b = (_a = this.joinRequest) === null || _a === void 0 ? void 0 : _a.user.assigns) !== null && _b !== void 0 ? _b : (_c = this.eventRequest) === null || _c === void 0 ? void 0 : _c.user.assigns) !== null && _d !== void 0 ? _d : (_e = this.leveeEvent) === null || _e === void 0 ? void 0 : _e.assigns) !== null && _f !== void 0 ? _f : null;
245
+ }
242
246
  retrieveClassData(key) {
243
247
  return manageClassData(key, this.instance.constructor).get();
244
248
  }
@@ -513,6 +517,16 @@ function GetLeaveEvent() {
513
517
  })(null);
514
518
  }
515
519
  exports.GetLeaveEvent = GetLeaveEvent;
520
+ function GetChannel() {
521
+ return createParamDecorator((_, context) => {
522
+ const channel = context.channel;
523
+ if (!channel) {
524
+ throw new Error('Invalid decorator usage: GetChannel');
525
+ }
526
+ return channel;
527
+ })(null);
528
+ }
529
+ exports.GetChannel = GetChannel;
516
530
  function manageAction(instance, moduleRef, originalMethod, propertyKey, request, response) {
517
531
  return __awaiter(this, void 0, void 0, function* () {
518
532
  const req = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
package/types.d.ts CHANGED
@@ -169,6 +169,11 @@ declare class Context<Path extends string = string> {
169
169
  */
170
170
  event: PondEvent<Path> | null;
171
171
 
172
+ /**
173
+ * @desc The assigns, available in onJoin, onEvent handlers
174
+ */
175
+ assigns: PondAssigns | null;
176
+
172
177
  /**
173
178
  * @desc Returns the *type* of the controller class which the current handler belongs to.
174
179
  */
@@ -849,6 +854,12 @@ declare function GetConnectionQuery(): ParameterDecorator;
849
854
  */
850
855
  declare function GetLeaveEvent(): ParameterDecorator;
851
856
 
857
+ /**
858
+ * @desc The Decorator for retrieving the Channel object from the request in a handler
859
+ * @returns {Channel}
860
+ */
861
+ declare function GetChannel (): ParameterDecorator;
862
+
852
863
  /**
853
864
  * @desc Function to create a param decorator
854
865
  * @param callback - The callback to call when the decorator is used