@eleven-am/pondsocket 0.1.90 → 0.1.91
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.js +59 -28
- package/package.json +1 -1
package/nest.js
CHANGED
|
@@ -220,6 +220,57 @@ function GetConnectionQuery() {
|
|
|
220
220
|
return createParamDecorator(connectionQueryKey, 'ConnectionQuery decorator already applied');
|
|
221
221
|
}
|
|
222
222
|
exports.GetConnectionQuery = GetConnectionQuery;
|
|
223
|
+
function manageRejectedKeys(rejectedKeys, target, propertyKey) {
|
|
224
|
+
function symbolToString(symbol) {
|
|
225
|
+
switch (symbol) {
|
|
226
|
+
case joinRequestKey:
|
|
227
|
+
return 'GetJoinRequest';
|
|
228
|
+
case joinResponseKey:
|
|
229
|
+
return 'GetJoinResponse';
|
|
230
|
+
case joinParamsKey:
|
|
231
|
+
return 'GetJoinParams';
|
|
232
|
+
case userDataKey:
|
|
233
|
+
return 'GetUserData';
|
|
234
|
+
case internalChannelKey:
|
|
235
|
+
return 'GetInternalChannel';
|
|
236
|
+
case userPresenceKey:
|
|
237
|
+
return 'GetUserPresences';
|
|
238
|
+
case eventPayloadKey:
|
|
239
|
+
return 'GetEventPayload';
|
|
240
|
+
case eventParamsKey:
|
|
241
|
+
return 'GetEventParams';
|
|
242
|
+
case eventQueryKey:
|
|
243
|
+
return 'GetEventQuery';
|
|
244
|
+
case eventResponseKey:
|
|
245
|
+
return 'GetEventResponse';
|
|
246
|
+
case eventRequestKey:
|
|
247
|
+
return 'GetEventRequest';
|
|
248
|
+
case connectionRequestKey:
|
|
249
|
+
return 'GetConnectionRequest';
|
|
250
|
+
case connectionResponseKey:
|
|
251
|
+
return 'GetConnectionResponse';
|
|
252
|
+
case connectionRequestIdKey:
|
|
253
|
+
return 'GetConnectionRequestId';
|
|
254
|
+
case connectionParamsKey:
|
|
255
|
+
return 'GetConnectionParams';
|
|
256
|
+
case connectionQueryKey:
|
|
257
|
+
return 'GetConnectionQuery';
|
|
258
|
+
case connectionHeadersKey:
|
|
259
|
+
return 'GetConnectionHeaders';
|
|
260
|
+
default:
|
|
261
|
+
throw new Error('Invalid parameter decorator');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const rejected = rejectedKeys
|
|
265
|
+
.map((key) => ({
|
|
266
|
+
key,
|
|
267
|
+
name: symbolToString(key),
|
|
268
|
+
}))
|
|
269
|
+
.filter(({ key }) => resolveParamDecorator(key, target, propertyKey) !== null);
|
|
270
|
+
if (rejected.length) {
|
|
271
|
+
throw new Error(`Invalid parameter decorators: ${rejected.map(({ name }) => name).join(', ')}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
223
274
|
function resolveJoinParameters(request, response, target, propertyKey) {
|
|
224
275
|
const joinRequestIndex = resolveParamDecorator(joinRequestKey, target, propertyKey);
|
|
225
276
|
const joinParamsIndex = resolveParamDecorator(joinParamsKey, target, propertyKey);
|
|
@@ -237,7 +288,7 @@ function resolveJoinParameters(request, response, target, propertyKey) {
|
|
|
237
288
|
eventQueryIndex,
|
|
238
289
|
JoinResponseIndex,
|
|
239
290
|
].filter((index) => typeof index === 'number');
|
|
240
|
-
|
|
291
|
+
manageRejectedKeys([
|
|
241
292
|
eventPayloadKey,
|
|
242
293
|
eventRequestKey,
|
|
243
294
|
eventResponseKey,
|
|
@@ -247,12 +298,7 @@ function resolveJoinParameters(request, response, target, propertyKey) {
|
|
|
247
298
|
connectionRequestIdKey,
|
|
248
299
|
connectionParamsKey,
|
|
249
300
|
connectionQueryKey,
|
|
250
|
-
]
|
|
251
|
-
.map((key) => resolveParamDecorator(key, target, propertyKey))
|
|
252
|
-
.filter((index) => typeof index === 'number');
|
|
253
|
-
if (rejectedKeys.length) {
|
|
254
|
-
throw new Error(`Invalid parameter decorators: ${rejectedKeys.join(', ')}`);
|
|
255
|
-
}
|
|
301
|
+
], target, propertyKey);
|
|
256
302
|
return array
|
|
257
303
|
.sort((a, b) => a - b)
|
|
258
304
|
.map((index) => {
|
|
@@ -295,7 +341,7 @@ function resolveEventParameters(request, response, target, propertyKey) {
|
|
|
295
341
|
eventRequestIndex,
|
|
296
342
|
userPresenceIndex,
|
|
297
343
|
].filter((index) => typeof index === 'number');
|
|
298
|
-
|
|
344
|
+
manageRejectedKeys([
|
|
299
345
|
joinRequestKey,
|
|
300
346
|
joinResponseKey,
|
|
301
347
|
joinParamsKey,
|
|
@@ -304,12 +350,7 @@ function resolveEventParameters(request, response, target, propertyKey) {
|
|
|
304
350
|
connectionRequestIdKey,
|
|
305
351
|
connectionParamsKey,
|
|
306
352
|
connectionQueryKey,
|
|
307
|
-
]
|
|
308
|
-
.map((key) => resolveParamDecorator(key, target, propertyKey))
|
|
309
|
-
.filter((index) => typeof index === 'number');
|
|
310
|
-
if (rejectedKeys.length) {
|
|
311
|
-
throw new Error(`Invalid parameter decorators: ${rejectedKeys.join(', ')}`);
|
|
312
|
-
}
|
|
353
|
+
], target, propertyKey);
|
|
313
354
|
return array
|
|
314
355
|
.sort((a, b) => a - b)
|
|
315
356
|
.map((index) => {
|
|
@@ -337,7 +378,7 @@ function resolveEventParameters(request, response, target, propertyKey) {
|
|
|
337
378
|
}
|
|
338
379
|
function resolveLeaveParameters(event, target, propertyKey) {
|
|
339
380
|
const userDataIndex = resolveParamDecorator(userDataKey, target, propertyKey);
|
|
340
|
-
|
|
381
|
+
manageRejectedKeys([
|
|
341
382
|
joinRequestKey,
|
|
342
383
|
joinResponseKey,
|
|
343
384
|
joinParamsKey,
|
|
@@ -353,12 +394,7 @@ function resolveLeaveParameters(event, target, propertyKey) {
|
|
|
353
394
|
eventRequestKey,
|
|
354
395
|
userPresenceKey,
|
|
355
396
|
internalChannelKey,
|
|
356
|
-
]
|
|
357
|
-
.map((key) => resolveParamDecorator(key, target, propertyKey))
|
|
358
|
-
.filter((index) => typeof index === 'number');
|
|
359
|
-
if (rejectedKeys.length) {
|
|
360
|
-
throw new Error(`Invalid parameter decorators: ${rejectedKeys.join(', ')}`);
|
|
361
|
-
}
|
|
397
|
+
], target, propertyKey);
|
|
362
398
|
if (userDataIndex === null) {
|
|
363
399
|
return [];
|
|
364
400
|
}
|
|
@@ -379,7 +415,7 @@ function resolveConnectionParameters(request, response, target, propertyKey) {
|
|
|
379
415
|
connectionQueryIndex,
|
|
380
416
|
connectionHeadersIndex,
|
|
381
417
|
].filter((index) => typeof index === 'number');
|
|
382
|
-
|
|
418
|
+
manageRejectedKeys([
|
|
383
419
|
joinRequestKey,
|
|
384
420
|
joinResponseKey,
|
|
385
421
|
joinParamsKey,
|
|
@@ -391,12 +427,7 @@ function resolveConnectionParameters(request, response, target, propertyKey) {
|
|
|
391
427
|
eventResponseKey,
|
|
392
428
|
userPresenceKey,
|
|
393
429
|
eventRequestKey,
|
|
394
|
-
]
|
|
395
|
-
.map((key) => resolveParamDecorator(key, target, propertyKey))
|
|
396
|
-
.filter((index) => typeof index === 'number');
|
|
397
|
-
if (rejectedKeys.length) {
|
|
398
|
-
throw new Error(`Invalid parameter decorators: ${rejectedKeys.join(', ')}`);
|
|
399
|
-
}
|
|
430
|
+
], target, propertyKey);
|
|
400
431
|
return array
|
|
401
432
|
.sort((a, b) => a - b)
|
|
402
433
|
.map((index) => {
|