@eleven-am/pondsocket-nest 0.0.51 → 0.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket-nest",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
@@ -16,16 +16,21 @@ const response_1 = require("./response");
16
16
  const context_1 = require("../context/context");
17
17
  const parametres_1 = require("../managers/parametres");
18
18
  function retrieveParameters(context) {
19
- var _a;
20
- const gottenValues = (_a = (0, parametres_1.manageParameters)(context.getInstance(), context.getMethod()).get()) !== null && _a !== void 0 ? _a : [];
21
- const values = gottenValues
22
- .map(({ callback, index }) => ({
23
- value: callback(context),
24
- index,
25
- }));
26
- return values
27
- .sort((a, b) => a.index - b.index)
28
- .map(({ value }) => value);
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ var _a;
21
+ const gottenValues = (_a = (0, parametres_1.manageParameters)(context.getInstance(), context.getMethod()).get()) !== null && _a !== void 0 ? _a : [];
22
+ const promises = gottenValues
23
+ .map((_b) => __awaiter(this, [_b], void 0, function* ({ callback, index }) {
24
+ return ({
25
+ value: yield callback(context),
26
+ index,
27
+ });
28
+ }));
29
+ const values = yield Promise.all(promises);
30
+ return values
31
+ .sort((a, b) => a.index - b.index)
32
+ .map(({ value }) => value);
33
+ });
29
34
  }
30
35
  function performAction(instance, moduleRef, originalMethod, propertyKey, leaveEvent, request, response) {
31
36
  return __awaiter(this, void 0, void 0, function* () {
@@ -53,7 +58,7 @@ function performAction(instance, moduleRef, originalMethod, propertyKey, leaveEv
53
58
  const socketId = context.user.id;
54
59
  const canProceed = yield (0, guards_1.performGuards)(moduleRef, context);
55
60
  if (canProceed) {
56
- const data = yield originalMethod.apply(instance, retrieveParameters(context));
61
+ const data = yield originalMethod.apply(instance, yield retrieveParameters(context));
57
62
  (0, response_1.performResponse)(socketId, channel, data, response);
58
63
  }
59
64
  else if (response && ((0, narrow_1.isJoinResponse)(response) || (0, narrow_1.isConnectionResponse)(response))) {