@eleven-am/pondsocket-nest 0.0.18 → 0.0.20

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.
@@ -39,8 +39,10 @@ class Context {
39
39
  return (_a = this.response.connection) !== null && _a !== void 0 ? _a : null;
40
40
  }
41
41
  get presence() {
42
- var _a, _b, _c, _d;
43
- return (_d = (_b = (_a = this.joinRequest) === null || _a === void 0 ? void 0 : _a.presence) !== null && _b !== void 0 ? _b : (_c = this.eventRequest) === null || _c === void 0 ? void 0 : _c.presence) !== null && _d !== void 0 ? _d : null;
42
+ return this.user.presence;
43
+ }
44
+ get assigns() {
45
+ return this.user.assigns;
44
46
  }
45
47
  get user() {
46
48
  var _a, _b;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetUserAssigns = void 0;
4
+ const createParamDecorator_1 = require("../helpers/createParamDecorator");
5
+ exports.GetUserAssigns = (0, createParamDecorator_1.createParamDecorator)((data, context) => {
6
+ const userAssigns = context.assigns;
7
+ if (!userAssigns) {
8
+ throw new Error('Invalid decorator usage: GetUserPresences');
9
+ }
10
+ return userAssigns;
11
+ });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetUserPresences = void 0;
3
+ exports.GetUserPresence = void 0;
4
4
  const createParamDecorator_1 = require("../helpers/createParamDecorator");
5
- exports.GetUserPresences = (0, createParamDecorator_1.createParamDecorator)((data, context) => {
5
+ exports.GetUserPresence = (0, createParamDecorator_1.createParamDecorator)((data, context) => {
6
6
  const userPresences = context.presence;
7
7
  if (!userPresences) {
8
8
  throw new Error('Invalid decorator usage: GetUserPresences');
@@ -32,8 +32,9 @@ __exportStar(require("./getJoinParams"), exports);
32
32
  __exportStar(require("./getJoinRequest"), exports);
33
33
  __exportStar(require("./getJoinResponse"), exports);
34
34
  __exportStar(require("./getLeaveEvent"), exports);
35
+ __exportStar(require("./getUserAssigns"), exports);
35
36
  __exportStar(require("./getUserData"), exports);
36
- __exportStar(require("./getUserPresences"), exports);
37
+ __exportStar(require("./getUserPresence"), exports);
37
38
  __exportStar(require("./onConnectionRequest"), exports);
38
39
  __exportStar(require("./onJoinRequest"), exports);
39
40
  __exportStar(require("./onLeave"), exports);
package/index.d.ts CHANGED
@@ -83,7 +83,12 @@ declare class Context<Path extends string = string, Event extends PondEvenType =
83
83
  /**
84
84
  * @desc The presence object, available on the channel
85
85
  */
86
- get presence (): Record<string, Presence> | null;
86
+ get presence (): Presence;
87
+
88
+ /**
89
+ * @desc The assigns object, available on the channel
90
+ */
91
+ get assigns (): Assigns;
87
92
 
88
93
  /**
89
94
  * @desc The user object, assigned to the current user
@@ -163,91 +168,97 @@ declare const GetChannel: () => ParameterDecorator;
163
168
  * @desc Parameter decorator that retrieves the current connection headers
164
169
  * @returns {IncomingHttpHeaders}
165
170
  */
166
- declare const GetConnectionHeaders: (data: void) => ParameterDecorator;
171
+ declare const GetConnectionHeaders: () => ParameterDecorator;
167
172
 
168
173
  /**
169
174
  * @desc Parameter decorator that retrieves the current connection request
170
175
  * @returns {IncomingConnection}
171
176
  */
172
- declare const GetConnectionRequest: (data: void) => ParameterDecorator;
177
+ declare const GetConnectionRequest: () => ParameterDecorator;
173
178
 
174
179
  /**
175
180
  * @desc Parameter decorator that retrieves the current connection response
176
181
  * @returns {ConnectionResponse}
177
182
  */
178
- declare const GetConnectionResponse: (data: void) => ParameterDecorator;
183
+ declare const GetConnectionResponse: () => ParameterDecorator;
179
184
 
180
185
  /**
181
186
  * @desc Parameter decorator that retrieves the current context
182
187
  * @returns {Context}
183
188
  */
184
- declare const GetContext: (data: void) => ParameterDecorator;
189
+ declare const GetContext: () => ParameterDecorator;
185
190
 
186
191
  /**
187
192
  * @desc Parameter decorator that retrieves the current event params
188
193
  * @returns {Params}
189
194
  */
190
- declare const GetEventParams: (data: void) => ParameterDecorator;
195
+ declare const GetEventParams: () => ParameterDecorator;
191
196
 
192
197
  /**
193
198
  * @desc Parameter decorator that retrieves the current event payload
194
199
  * @returns {PondMessage}
195
200
  */
196
- declare const GetEventPayload: (data: void) => ParameterDecorator;
201
+ declare const GetEventPayload: () => ParameterDecorator;
197
202
 
198
203
  /**
199
204
  * @desc Parameter decorator that retrieves the current event query
200
205
  * @returns {Record<string, string>}
201
206
  */
202
- declare const GetEventQuery: (data: void) => ParameterDecorator;
207
+ declare const GetEventQuery: () => ParameterDecorator;
203
208
 
204
209
  /**
205
210
  * @desc Parameter decorator that retrieves the current event request
206
211
  * @returns {EventRequest}
207
212
  */
208
- declare const GetEventRequest: (data: void) => ParameterDecorator;
213
+ declare const GetEventRequest: () => ParameterDecorator;
209
214
 
210
215
  /**
211
216
  * @desc Parameter decorator that retrieves the current event response
212
217
  * @returns {EventResponse}
213
218
  */
214
- declare const GetEventResponse: (data: void) => ParameterDecorator;
219
+ declare const GetEventResponse: () => ParameterDecorator;
215
220
 
216
221
  /**
217
222
  * @desc Parameter decorator that retrieves the current join params
218
223
  * @returns {JoinParams}
219
224
  */
220
- declare const GetJoinParams: (data: void) => ParameterDecorator;
225
+ declare const GetJoinParams: () => ParameterDecorator;
221
226
 
222
227
  /**
223
228
  * @desc Parameter decorator that retrieves the current join request
224
229
  * @returns {JoinRequest}
225
230
  */
226
- declare const GetJoinRequest: (data: void) => ParameterDecorator;
231
+ declare const GetJoinRequest: () => ParameterDecorator;
227
232
 
228
233
  /**
229
234
  * @desc Parameter decorator that retrieves the current join response
230
235
  * @returns {JoinResponse}
231
236
  */
232
- declare const GetJoinResponse: (data: void) => ParameterDecorator;
237
+ declare const GetJoinResponse: () => ParameterDecorator;
233
238
 
234
239
  /**
235
240
  * @desc Parameter decorator that retrieves the current leave event
236
241
  * @returns {LeaveEvent}
237
242
  */
238
- declare const GetLeaveEvent: (data: void) => ParameterDecorator;
243
+ declare const GetLeaveEvent: () => ParameterDecorator;
239
244
 
240
245
  /**
241
246
  * @desc Parameter decorator that retrieves the current user
242
247
  * @returns {UserData}
243
248
  */
244
- declare const GetUserData: (data: void) => ParameterDecorator;
249
+ declare const GetUserData: () => ParameterDecorator;
250
+
251
+ /**
252
+ * @desc Parameter decorator that retrieves the current user presences
253
+ * @returns {PondAssigns}
254
+ */
255
+ declare const GetUserAssigns: () => ParameterDecorator;
245
256
 
246
257
  /**
247
258
  * @desc Parameter decorator that retrieves the current user presences
248
- * @returns {UserPresences}
259
+ * @returns {PondPresence}
249
260
  */
250
- declare const GetUserPresences: (data: void) => ParameterDecorator;
261
+ declare const GetUserPresence: () => ParameterDecorator;
251
262
 
252
263
  /**
253
264
  * @desc Method decorator that marks a method as an onConnection handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket-nest",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",