@futdevpro/nts-dynamo 1.5.36 → 1.5.38

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 (37) hide show
  1. package/lib/_constants/dynamo-nts-global-settings.d.ts +3 -0
  2. package/lib/_constants/dynamo-nts-global-settings.d.ts.map +1 -0
  3. package/lib/_constants/dynamo-nts-global-settings.js +18 -0
  4. package/lib/_constants/dynamo-nts-global-settings.js.map +1 -0
  5. package/lib/_constants/index.d.ts +1 -1
  6. package/lib/_constants/index.js +1 -1
  7. package/lib/_models/dynamo-nts-socket-service-params.d.ts +19 -0
  8. package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -0
  9. package/lib/_models/dynamo-nts-socket-service-params.js +27 -0
  10. package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -0
  11. package/lib/_models/index.d.ts +1 -1
  12. package/lib/_models/index.d.ts.map +1 -1
  13. package/lib/_models/index.js +1 -1
  14. package/lib/_models/index.js.map +1 -1
  15. package/lib/_modules/app-extended.index.d.ts +1 -1
  16. package/lib/_modules/app-extended.index.js +1 -1
  17. package/lib/_modules/app.index.d.ts +1 -1
  18. package/lib/_modules/app.index.js +1 -1
  19. package/lib/_services/dynamo-nts-db.service.d.ts +24 -24
  20. package/lib/_services/dynamo-nts-db.service.js +24 -24
  21. package/lib/_services/dynamo-nts-routing-module.service.js +1 -1
  22. package/lib/_services/dynamo-nts-socket.service.d.ts +8 -6
  23. package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
  24. package/lib/_services/dynamo-nts-socket.service.js +56 -47
  25. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  26. package/lib/tsconfig.tsbuildinfo +35 -35
  27. package/package.json +1 -1
  28. package/src/_constants/index.ts +1 -1
  29. package/src/_models/dynamo-nts-socket-event-params.ts +1 -1
  30. package/src/_models/{dynamo-nts-socket-module-settings.ts → dynamo-nts-socket-service-params.ts} +1 -1
  31. package/src/_models/index.ts +1 -1
  32. package/src/_modules/app-extended.index.ts +1 -1
  33. package/src/_modules/app.index.ts +1 -1
  34. package/src/_services/dynamo-nts-db.service.ts +24 -24
  35. package/src/_services/dynamo-nts-routing-module.service.ts +1 -1
  36. package/src/_services/dynamo-nts-socket.service.ts +36 -28
  37. /package/src/_constants/{dynamo-nts-global.settings.ts → dynamo-nts-global-settings.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ import { DynamoNTS_GlobalSettings } from '../_models/dynamo-nts-global-settings';
2
+ export declare const dynamoNTS_GlobalSettings: DynamoNTS_GlobalSettings;
3
+ //# sourceMappingURL=dynamo-nts-global-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-nts-global-settings.d.ts","sourceRoot":"","sources":["../../src/_constants/dynamo-nts-global-settings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,eAAO,MAAM,wBAAwB,EAAE,wBActC,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dynamoNTS_GlobalSettings = void 0;
4
+ const dynamo_nts_route_security_enum_1 = require("../_enums/dynamo-nts-route-security.enum");
5
+ const dynamo_nts_socket_security_enum_1 = require("../_enums/dynamo-nts-socket-security.enum");
6
+ exports.dynamoNTS_GlobalSettings = {
7
+ baseUrl: '/api',
8
+ defaultRouteSecurity: dynamo_nts_route_security_enum_1.DynamoNTS_RouteSecurity.open,
9
+ defaultSocketSecurity: dynamo_nts_socket_security_enum_1.DynamoNTS_SocketSecurity.open,
10
+ logSetup: false,
11
+ logRequest: true,
12
+ logRequestsContent: true,
13
+ logResponseContent: false,
14
+ logMainSocketEvent: true,
15
+ logAllSocketEvent: false,
16
+ logEventContent: false,
17
+ };
18
+ //# sourceMappingURL=dynamo-nts-global-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-nts-global-settings.js","sourceRoot":"","sources":["../../src/_constants/dynamo-nts-global-settings.ts"],"names":[],"mappings":";;;AACA,6FAAmF;AACnF,+FAAqF;AAGxE,QAAA,wBAAwB,GAA6B;IAChE,OAAO,EAAE,MAAM;IACf,oBAAoB,EAAE,wDAAuB,CAAC,IAAI;IAClD,qBAAqB,EAAE,0DAAwB,CAAC,IAAI;IAEpD,QAAQ,EAAE,KAAK;IAEf,UAAU,EAAE,IAAI;IAChB,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,KAAK;IAEzB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;CACvB,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './dynamo-nts-global.settings';
1
+ export * from './dynamo-nts-global-settings';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./dynamo-nts-global.settings"), exports);
4
+ tslib_1.__exportStar(require("./dynamo-nts-global-settings"), exports);
5
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,19 @@
1
+ import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
2
+ /**
3
+ *
4
+ */
5
+ export declare class DynamoNTS_SocketServiceParams {
6
+ name: string;
7
+ port: number;
8
+ security?: DynamoNTS_SocketSecurity;
9
+ groupActiveSocketsBy?: string;
10
+ getIdFromSubscrioption?: (content: any) => string;
11
+ constructor(set: {
12
+ name: string;
13
+ port: number;
14
+ security?: DynamoNTS_SocketSecurity;
15
+ groupActiveSocketsBy?: string;
16
+ getIdFromSubscrioption?: (content: any) => string;
17
+ });
18
+ }
19
+ //# sourceMappingURL=dynamo-nts-socket-service-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-nts-socket-service-params.d.ts","sourceRoot":"","sources":["../../src/_models/dynamo-nts-socket-service-params.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAGrF;;GAEG;AACH,qBAAa,6BAA6B;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,CAAC;gBAGhD,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,wBAAwB,CAAC;QACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAE9B,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,CAAC;KACnD;CAiBJ"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoNTS_SocketServiceParams = void 0;
4
+ const _constants_1 = require("../_constants");
5
+ const _services_1 = require("../_services");
6
+ /**
7
+ *
8
+ */
9
+ class DynamoNTS_SocketServiceParams {
10
+ constructor(set) {
11
+ this.name = set.name;
12
+ this.port = set.port;
13
+ this.security = set.security ? set.security : _constants_1.dynamoNTS_GlobalSettings.defaultSocketSecurity;
14
+ if (set.getIdFromSubscrioption) {
15
+ this.getIdFromSubscrioption = set.getIdFromSubscrioption;
16
+ if (set.groupActiveSocketsBy) {
17
+ _services_1.DynamoNTS_Shared.logError(`setting groupActiveSocketsBy on DynamoNTS_SocketService (${this.name}) won't take effect, ` +
18
+ `since getIdFromSubscrioption is also setted, so it will be used instead`);
19
+ }
20
+ }
21
+ else if (set.groupActiveSocketsBy) {
22
+ this.getIdFromSubscrioption = content => content[set.groupActiveSocketsBy];
23
+ }
24
+ }
25
+ }
26
+ exports.DynamoNTS_SocketServiceParams = DynamoNTS_SocketServiceParams;
27
+ //# sourceMappingURL=dynamo-nts-socket-service-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-nts-socket-service-params.js","sourceRoot":"","sources":["../../src/_models/dynamo-nts-socket-service-params.ts"],"names":[],"mappings":";;;AACA,8CAAyD;AAEzD,4CAAgD;AAEhD;;GAEG;AACH,MAAa,6BAA6B;IAQxC,YACE,GAOC;QAED,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,qCAAwB,CAAC,qBAAqB,CAAC;QAE7F,IAAI,GAAG,CAAC,sBAAsB,EAAE;YAC9B,IAAI,CAAC,sBAAsB,GAAG,GAAG,CAAC,sBAAsB,CAAC;YACzD,IAAI,GAAG,CAAC,oBAAoB,EAAE;gBAC5B,4BAAgB,CAAC,QAAQ,CACvB,4DAA4D,IAAI,CAAC,IAAI,uBAAuB;oBAC5F,yEAAyE,CAAC,CAAA;aAC7E;SACF;aAAM,IAAI,GAAG,CAAC,oBAAoB,EAAE;YACnC,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;SAC5E;IACH,CAAC;CACF;AAjCD,sEAiCC"}
@@ -4,5 +4,5 @@ export * from './dynamo-nts-endpoint-params';
4
4
  export * from './dynamo-nts-global-settings';
5
5
  export * from './dynamo-nts-routing-module-settings';
6
6
  export * from './dynamo-nts-socket-event-params';
7
- export * from './dynamo-nts-socket-module-settings';
7
+ export * from './dynamo-nts-socket-service-params';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_models/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_models/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
@@ -8,5 +8,5 @@ tslib_1.__exportStar(require("./dynamo-nts-endpoint-params"), exports);
8
8
  tslib_1.__exportStar(require("./dynamo-nts-global-settings"), exports);
9
9
  tslib_1.__exportStar(require("./dynamo-nts-routing-module-settings"), exports);
10
10
  tslib_1.__exportStar(require("./dynamo-nts-socket-event-params"), exports);
11
- tslib_1.__exportStar(require("./dynamo-nts-socket-module-settings"), exports);
11
+ tslib_1.__exportStar(require("./dynamo-nts-socket-service-params"), exports);
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_models/index.ts"],"names":[],"mappings":";;;AAEA,SAAS;AACT,uEAA6C;AAC7C,kEAAwC;AACxC,uEAA6C;AAC7C,uEAA6C;AAC7C,+EAAqD;AACrD,2EAAiD;AACjD,8EAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_models/index.ts"],"names":[],"mappings":";;;AAEA,SAAS;AACT,uEAA6C;AAC7C,kEAAwC;AACxC,uEAA6C;AAC7C,uEAA6C;AAC7C,+EAAqD;AACrD,2EAAiD;AACjD,6EAAmD"}
@@ -8,5 +8,5 @@ export * from '../_models/dynamo-nts-endpoint-params';
8
8
  export * from '../_models/dynamo-nts-global-settings';
9
9
  export * from '../_models/dynamo-nts-routing-module-settings';
10
10
  export * from '../_enums/dynamo-nts-route-security.enum';
11
- export * from '../_constants/dynamo-nts-global.settings';
11
+ export * from '../_constants/dynamo-nts-global-settings';
12
12
  //# sourceMappingURL=app-extended.index.d.ts.map
@@ -15,5 +15,5 @@ tslib_1.__exportStar(require("../_models/dynamo-nts-routing-module-settings"), e
15
15
  // ENUMS
16
16
  tslib_1.__exportStar(require("../_enums/dynamo-nts-route-security.enum"), exports);
17
17
  // CONSTANTS
18
- tslib_1.__exportStar(require("../_constants/dynamo-nts-global.settings"), exports);
18
+ tslib_1.__exportStar(require("../_constants/dynamo-nts-global-settings"), exports);
19
19
  //# sourceMappingURL=app-extended.index.js.map
@@ -7,5 +7,5 @@ export * from '../_models/dynamo-nts-endpoint-params';
7
7
  export * from '../_models/dynamo-nts-global-settings';
8
8
  export * from '../_models/dynamo-nts-routing-module-settings';
9
9
  export * from '../_enums/dynamo-nts-route-security.enum';
10
- export * from '../_constants/dynamo-nts-global.settings';
10
+ export * from '../_constants/dynamo-nts-global-settings';
11
11
  //# sourceMappingURL=app.index.d.ts.map
@@ -14,5 +14,5 @@ tslib_1.__exportStar(require("../_models/dynamo-nts-routing-module-settings"), e
14
14
  // ENUMS
15
15
  tslib_1.__exportStar(require("../_enums/dynamo-nts-route-security.enum"), exports);
16
16
  // CONSTANTS
17
- tslib_1.__exportStar(require("../_constants/dynamo-nts-global.settings"), exports);
17
+ tslib_1.__exportStar(require("../_constants/dynamo-nts-global-settings"), exports);
18
18
  //# sourceMappingURL=app.index.js.map
@@ -63,11 +63,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
63
63
  * @param data
64
64
  * (always use unique parameters for find!)
65
65
  * etc.: by email:
66
- * { email: email }
66
+ * @example { email: email }
67
67
  * or by id that is in list:
68
- * { userIds: { $in: this.userId } }
68
+ * @example { userIds: { $in: this.userId } }
69
69
  * or by number or Date that is greater than OR less than:
70
- * { points: { $gte: 2, $lte: 14 } }
70
+ * @example { points: { $gte: 2, $lte: 14 } }
71
71
  * @returns data
72
72
  */
73
73
  /**
@@ -90,11 +90,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
90
90
  * @param filter
91
91
  * (always use unique parameters for find!)
92
92
  * etc.: by email:
93
- * { email: email }
93
+ * @example { email: email }
94
94
  * or by id that is in list:
95
- * { userIds: { $in: this.userId } }
95
+ * @example { userIds: { $in: this.userId } }
96
96
  * or by number or Date that is GREATER THAN OR LESS THAN:
97
- * { points: { $gt: 2, $lt: 14 } }
97
+ * @example { points: { $gt: 2, $lt: 14 } }
98
98
  * further tools (syntax matches with $gt):
99
99
  * $eq: Matches values that are EQUAL to a specified value.
100
100
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -109,11 +109,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
109
109
  * find all data by any of its parameters, throws error if not found
110
110
  * @param filter
111
111
  * etc.: by email:
112
- * { email: email }
112
+ * @example { email: email }
113
113
  * or by id that is in list:
114
- * { userIds: { $in: this.userId } }
114
+ * @example { userIds: { $in: this.userId } }
115
115
  * or by number or Date that is GREATER THAN OR LESS THAN:
116
- * { points: { $gt: 2, $lt: 14 } }
116
+ * @example { points: { $gt: 2, $lt: 14 } }
117
117
  * further tools (syntax matches with $gt):
118
118
  * $eq: Matches values that are EQUAL to a specified value.
119
119
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -128,11 +128,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
128
128
  * find all data by any of its parameters, throws error if not found
129
129
  * @param filter
130
130
  * etc.: by email:
131
- * { email: email }
131
+ * @example { email: email }
132
132
  * or by id that is in list:
133
- * { userIds: { $in: this.userId } }
133
+ * @example { userIds: { $in: this.userId } }
134
134
  * or by number or Date that is GREATER THAN OR LESS THAN:
135
- * { points: { $gt: 2, $lt: 14 } }
135
+ * @example { points: { $gt: 2, $lt: 14 } }
136
136
  * further tools (syntax matches with $gt):
137
137
  * $eq: Matches values that are EQUAL to a specified value.
138
138
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -158,11 +158,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
158
158
  * @param updateBy
159
159
  * (always use unique parameters for find!)
160
160
  * etc.: by email:
161
- * { email: email }
161
+ * @example { email: email }
162
162
  * or by id that is in list:
163
- * { userIds: { $in: this.userId } }
163
+ * @example { userIds: { $in: this.userId } }
164
164
  * or by number or Date that is GREATER THAN OR LESS THAN:
165
- * { points: { $gt: 2, $lt: 14 } }
165
+ * @example { points: { $gt: 2, $lt: 14 } }
166
166
  * further tools (syntax matches with $gt):
167
167
  * $eq: Matches values that are EQUAL to a specified value.
168
168
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -172,11 +172,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
172
172
  *
173
173
  * @param update
174
174
  * etc.: increase a specific value:
175
- * { $inc: { popularity: 15 } }
175
+ * @example { $inc: { popularity: 15 } }
176
176
  * or add element to a list:
177
- * { $push: { reactions: this.newReaction }
177
+ * @example { $push: { reactions: this.newReaction }
178
178
  * or all at once
179
- * { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
179
+ * @example { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
180
180
  * further tools (syntax matches with $inc):
181
181
  * $currentDate: Sets the value of a field to current date, either as a Date or a Timestamp.
182
182
  * $min: Only updates the field if the specified value is less than the existing field value.
@@ -190,11 +190,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
190
190
  * update one parameter by a specific
191
191
  * @param updateBy
192
192
  * etc.: by email:
193
- * { email: email }
193
+ * @example { email: email }
194
194
  * or by id that is in list:
195
- * { userIds: { $in: this.userId } }
195
+ * @example { userIds: { $in: this.userId } }
196
196
  * or by number or Date that is GREATER THAN OR LESS THAN:
197
- * { points: { $gt: 2, $lt: 14 } }
197
+ * @example { points: { $gt: 2, $lt: 14 } }
198
198
  * further tools (syntax matches with $gt):
199
199
  * $eq: Matches values that are EQUAL to a specified value.
200
200
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -204,11 +204,11 @@ export declare class DynamoNTS_DBService<T extends Metadata> {
204
204
  *
205
205
  * @param update
206
206
  * etc.: increase a specific value:
207
- * { $inc: { popularity: 15 } }
207
+ * @example { $inc: { popularity: 15 } }
208
208
  * or add element to a list:
209
- * { $push: { reactions: this.newReaction }
209
+ * @example { $push: { reactions: this.newReaction }
210
210
  * or all at once
211
- * { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
211
+ * @example { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
212
212
  * further tools (syntax matches with $inc):
213
213
  * $currentDate: Sets the value of a field to current date, either as a Date or a Timestamp.
214
214
  * $min: Only updates the field if the specified value is less than the existing field value.
@@ -311,11 +311,11 @@ class DynamoNTS_DBService {
311
311
  * @param data
312
312
  * (always use unique parameters for find!)
313
313
  * etc.: by email:
314
- * { email: email }
314
+ * @example { email: email }
315
315
  * or by id that is in list:
316
- * { userIds: { $in: this.userId } }
316
+ * @example { userIds: { $in: this.userId } }
317
317
  * or by number or Date that is greater than OR less than:
318
- * { points: { $gte: 2, $lte: 14 } }
318
+ * @example { points: { $gte: 2, $lte: 14 } }
319
319
  * @returns data
320
320
  */
321
321
  /* async findData(data: T): Promise<T> {
@@ -407,11 +407,11 @@ class DynamoNTS_DBService {
407
407
  * @param filter
408
408
  * (always use unique parameters for find!)
409
409
  * etc.: by email:
410
- * { email: email }
410
+ * @example { email: email }
411
411
  * or by id that is in list:
412
- * { userIds: { $in: this.userId } }
412
+ * @example { userIds: { $in: this.userId } }
413
413
  * or by number or Date that is GREATER THAN OR LESS THAN:
414
- * { points: { $gt: 2, $lt: 14 } }
414
+ * @example { points: { $gt: 2, $lt: 14 } }
415
415
  * further tools (syntax matches with $gt):
416
416
  * $eq: Matches values that are EQUAL to a specified value.
417
417
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -448,11 +448,11 @@ class DynamoNTS_DBService {
448
448
  * find all data by any of its parameters, throws error if not found
449
449
  * @param filter
450
450
  * etc.: by email:
451
- * { email: email }
451
+ * @example { email: email }
452
452
  * or by id that is in list:
453
- * { userIds: { $in: this.userId } }
453
+ * @example { userIds: { $in: this.userId } }
454
454
  * or by number or Date that is GREATER THAN OR LESS THAN:
455
- * { points: { $gt: 2, $lt: 14 } }
455
+ * @example { points: { $gt: 2, $lt: 14 } }
456
456
  * further tools (syntax matches with $gt):
457
457
  * $eq: Matches values that are EQUAL to a specified value.
458
458
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -488,11 +488,11 @@ class DynamoNTS_DBService {
488
488
  * find all data by any of its parameters, throws error if not found
489
489
  * @param filter
490
490
  * etc.: by email:
491
- * { email: email }
491
+ * @example { email: email }
492
492
  * or by id that is in list:
493
- * { userIds: { $in: this.userId } }
493
+ * @example { userIds: { $in: this.userId } }
494
494
  * or by number or Date that is GREATER THAN OR LESS THAN:
495
- * { points: { $gt: 2, $lt: 14 } }
495
+ * @example { points: { $gt: 2, $lt: 14 } }
496
496
  * further tools (syntax matches with $gt):
497
497
  * $eq: Matches values that are EQUAL to a specified value.
498
498
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -569,11 +569,11 @@ class DynamoNTS_DBService {
569
569
  * @param updateBy
570
570
  * (always use unique parameters for find!)
571
571
  * etc.: by email:
572
- * { email: email }
572
+ * @example { email: email }
573
573
  * or by id that is in list:
574
- * { userIds: { $in: this.userId } }
574
+ * @example { userIds: { $in: this.userId } }
575
575
  * or by number or Date that is GREATER THAN OR LESS THAN:
576
- * { points: { $gt: 2, $lt: 14 } }
576
+ * @example { points: { $gt: 2, $lt: 14 } }
577
577
  * further tools (syntax matches with $gt):
578
578
  * $eq: Matches values that are EQUAL to a specified value.
579
579
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -583,11 +583,11 @@ class DynamoNTS_DBService {
583
583
  *
584
584
  * @param update
585
585
  * etc.: increase a specific value:
586
- * { $inc: { popularity: 15 } }
586
+ * @example { $inc: { popularity: 15 } }
587
587
  * or add element to a list:
588
- * { $push: { reactions: this.newReaction }
588
+ * @example { $push: { reactions: this.newReaction }
589
589
  * or all at once
590
- * { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
590
+ * @example { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
591
591
  * further tools (syntax matches with $inc):
592
592
  * $currentDate: Sets the value of a field to current date, either as a Date or a Timestamp.
593
593
  * $min: Only updates the field if the specified value is less than the existing field value.
@@ -613,11 +613,11 @@ class DynamoNTS_DBService {
613
613
  * update one parameter by a specific
614
614
  * @param updateBy
615
615
  * etc.: by email:
616
- * { email: email }
616
+ * @example { email: email }
617
617
  * or by id that is in list:
618
- * { userIds: { $in: this.userId } }
618
+ * @example { userIds: { $in: this.userId } }
619
619
  * or by number or Date that is GREATER THAN OR LESS THAN:
620
- * { points: { $gt: 2, $lt: 14 } }
620
+ * @example { points: { $gt: 2, $lt: 14 } }
621
621
  * further tools (syntax matches with $gt):
622
622
  * $eq: Matches values that are EQUAL to a specified value.
623
623
  * $gte: Matches values that are GREATER THAN or EQUAL to a specified value.
@@ -627,11 +627,11 @@ class DynamoNTS_DBService {
627
627
  *
628
628
  * @param update
629
629
  * etc.: increase a specific value:
630
- * { $inc: { popularity: 15 } }
630
+ * @example { $inc: { popularity: 15 } }
631
631
  * or add element to a list:
632
- * { $push: { reactions: this.newReaction }
632
+ * @example { $push: { reactions: this.newReaction }
633
633
  * or all at once
634
- * { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
634
+ * @example { $inc: { popularity: this.newVote.amount }, emailVerified: true, $push: { reactions: this.newReaction } }
635
635
  * further tools (syntax matches with $inc):
636
636
  * $currentDate: Sets the value of a field to current date, either as a Date or a Timestamp.
637
637
  * $min: Only updates the field if the specified value is less than the existing field value.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamoNTS_RoutingModule = void 0;
4
4
  const express_1 = require("express");
5
5
  const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
6
- const dynamo_nts_global_settings_1 = require("../_constants/dynamo-nts-global.settings");
6
+ const dynamo_nts_global_settings_1 = require("../_constants/dynamo-nts-global-settings");
7
7
  const dynamo_nts_route_security_enum_1 = require("../_enums/dynamo-nts-route-security.enum");
8
8
  const http_call_type_enum_1 = require("../_enums/http/http-call-type.enum");
9
9
  const dynamo_nts_shared_service_1 = require("./dynamo-nts-shared.service");
@@ -1,5 +1,5 @@
1
1
  import * as SocketIO from 'socket.io';
2
- import { DynamoNTS_SocketServiceSettings } from '../_models';
2
+ import { DynamoNTS_SocketServiceParams } from '../_models';
3
3
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
4
4
  import { DynamoNTS_SocketEventParams } from '../_models/dynamo-nts-socket-event-params';
5
5
  import { DynamoNTS_SocketSecurity } from '../_enums';
@@ -11,13 +11,13 @@ export interface DynamoNTS_SocketDictionary {
11
11
  *
12
12
  */
13
13
  export declare abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService {
14
- protected params: DynamoNTS_SocketServiceSettings;
14
+ protected params: DynamoNTS_SocketServiceParams;
15
15
  get name(): string;
16
- get security(): DynamoNTS_SocketSecurity;
17
16
  get port(): number;
17
+ get security(): DynamoNTS_SocketSecurity;
18
18
  protected socketServer: SocketIO.Server;
19
19
  private connectEvent;
20
- protected events: DynamoNTS_SocketEventParams<any>[];
20
+ protected incomingEvents: DynamoNTS_SocketEventParams<any>[];
21
21
  private subscriptionEvent;
22
22
  private getIdFromSubscrioption?;
23
23
  private activeSockets;
@@ -28,11 +28,13 @@ export declare abstract class DynamoNTS_SocketService extends DynamoNTS_Singleto
28
28
  * You must setup events and required services for this function
29
29
  */
30
30
  private prepareEvents;
31
- setupSocketServer(newSocketServer: SocketIO.Server): void;
31
+ setupSocketServer(newSocketServer: SocketIO.Server): Promise<void>;
32
32
  private socketSubscription;
33
33
  private removeSubscriptionOnDisconnect;
34
34
  emitEvent(event: string, content: any): void;
35
- emitEventForId(id: string, event: string, content: any): void;
35
+ idIsSubscribed(id: string): boolean;
36
+ sendEventForId(id: string, event: string, content: any, error?: (err: any) => void): Promise<void>;
37
+ broadcastEvent(event: string, content: any): void;
36
38
  /**
37
39
  * You must setup params for the service in this function
38
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dynamo-nts-socket.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamo-nts-socket.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAIxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,8BAAsB,uBAAwB,SAAQ,0BAA0B;IAC9E,SAAS,CAAC,MAAM,EAAE,+BAA+B,CAAC;IAClD,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,QAAQ,IAAI,wBAAwB,CAEvC;IACD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC;IAExC,OAAO,CAAC,YAAY,CAA+C;IACnE,SAAS,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,CAAC,EAAE,CAAC;IAErD,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,sBAAsB,CAAC,CAA4B;IAC3D,OAAO,CAAC,aAAa,CAAoC;IAEzD,SAAS,CAAC,GAAG,EAAE,OAAO,CAAqC;;IAkB3D,OAAO,CAAC,wBAAwB;IAIhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAoCrB,iBAAiB,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,GAAG,IAAI;YAkC3C,kBAAkB;YASlB,8BAA8B;IAW5C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAI5C,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAW7D;;;OAGG;IACF,QAAQ,CAAC,kBAAkB,IAAI,IAAI;IAEpC;;OAEG;IACH,QAAQ,CAAC,WAAW,IAAI,IAAI;CAC7B"}
1
+ {"version":3,"file":"dynamo-nts-socket.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamo-nts-socket.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAIxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,8BAAsB,uBAAwB,SAAQ,0BAA0B;IAC9E,SAAS,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAChD,IAAI,IAAI,IAAI,MAAM,CAA6B;IAC/C,IAAI,IAAI,IAAI,MAAM,CAA6B;IAC/C,IAAI,QAAQ,IAAI,wBAAwB,CAAiC;IAEzE,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC;IAExC,OAAO,CAAC,YAAY,CAA+C;IACnE,SAAS,CAAC,cAAc,EAAE,2BAA2B,CAAC,GAAG,CAAC,EAAE,CAAC;IAE7D,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,sBAAsB,CAAC,CAAqC;IACpE,OAAO,CAAC,aAAa,CAAoC;IAEzD,SAAS,CAAC,GAAG,EAAE,OAAO,CAAqC;;IAkB3D,OAAO,CAAC,wBAAwB;IAIhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAoCf,iBAAiB,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAmC1D,kBAAkB;YASlB,8BAA8B;IAW5C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAI5C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI7B,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAYxG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAQjD;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,IAAI,IAAI;IAEnC;;OAEG;IACH,QAAQ,CAAC,WAAW,IAAI,IAAI;CAC7B"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamoNTS_SocketService = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const dynamo_nts_global_settings_1 = require("../_constants/dynamo-nts-global.settings");
5
+ const dynamo_nts_global_settings_1 = require("../_constants/dynamo-nts-global-settings");
6
6
  const dynamo_nts_shared_service_1 = require("./dynamo-nts-shared.service");
7
7
  const dynamo_nts_singleton_service_1 = require("./dynamo-nts-singleton.service");
8
8
  const dynamo_nts_socket_event_params_1 = require("../_models/dynamo-nts-socket-event-params");
@@ -29,15 +29,9 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
29
29
  dynamo_nts_shared_service_1.DynamoNTS_Shared.logError(`Socket Controller setup failed: ${this.params.name} (${this.params.port})`, error);
30
30
  }
31
31
  }
32
- get name() {
33
- return this.params.name;
34
- }
35
- get security() {
36
- return this.params.security;
37
- }
38
- get port() {
39
- return this.params.port;
40
- }
32
+ get name() { return this.params.name; }
33
+ get port() { return this.params.port; }
34
+ get security() { return this.params.security; }
41
35
  attachToGlobalCollection() {
42
36
  dynamo_nts_global_service_1.DynamoNTS_GlobalService.attachNewSocketService(this);
43
37
  }
@@ -45,9 +39,9 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
45
39
  * You must setup events and required services for this function
46
40
  */
47
41
  prepareEvents() {
48
- const connectEventIndex = this.events.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.connection);
42
+ const connectEventIndex = this.incomingEvents.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.connection);
49
43
  if (0 <= connectEventIndex) {
50
- this.connectEvent = this.events.splice(connectEventIndex)[0];
44
+ this.connectEvent = this.incomingEvents.splice(connectEventIndex)[0];
51
45
  }
52
46
  else {
53
47
  this.connectEvent = new dynamo_nts_socket_event_params_1.DynamoNTS_SocketEventParams({
@@ -56,9 +50,9 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
56
50
  });
57
51
  }
58
52
  if (this.getIdFromSubscrioption) {
59
- const subscriptionEventIndex = this.events.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.subscribe);
53
+ const subscriptionEventIndex = this.incomingEvents.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.subscribe);
60
54
  if (0 <= subscriptionEventIndex) {
61
- this.subscriptionEvent = this.events.splice(subscriptionEventIndex)[0];
55
+ this.subscriptionEvent = this.incomingEvents.splice(subscriptionEventIndex)[0];
62
56
  }
63
57
  else {
64
58
  this.subscriptionEvent = new dynamo_nts_socket_event_params_1.DynamoNTS_SocketEventParams({
@@ -66,12 +60,12 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
66
60
  tasks: []
67
61
  });
68
62
  }
69
- const disconnectEventIndex = this.events.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.disconnect);
63
+ const disconnectEventIndex = this.incomingEvents.findIndex((event) => event.event === socket_event_enum_1.DynamoNTS_SocketEvent.disconnect);
70
64
  if (0 <= disconnectEventIndex) {
71
- this.events[disconnectEventIndex].tasks.push(this.removeSubscriptionOnDisconnect);
65
+ this.incomingEvents[disconnectEventIndex].tasks.push(this.removeSubscriptionOnDisconnect);
72
66
  }
73
67
  else {
74
- this.events.push(new dynamo_nts_socket_event_params_1.DynamoNTS_SocketEventParams({
68
+ this.incomingEvents.push(new dynamo_nts_socket_event_params_1.DynamoNTS_SocketEventParams({
75
69
  event: socket_event_enum_1.DynamoNTS_SocketEvent.disconnect,
76
70
  tasks: [
77
71
  this.removeSubscriptionOnDisconnect
@@ -81,30 +75,32 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
81
75
  }
82
76
  }
83
77
  setupSocketServer(newSocketServer) {
84
- this.socketServer = newSocketServer;
85
- this.socketServer.on(socket_event_enum_1.DynamoNTS_SocketEvent.connection, (socket) => tslib_1.__awaiter(this, void 0, void 0, function* () {
86
- let issuer;
87
- for (let i = 0; i < this.connectEvent.preProcessess.length; i++) {
88
- yield this.connectEvent.preProcessess[i](socket);
89
- }
90
- for (let i = 0; i < this.connectEvent.tasks.length; i++) {
91
- yield this.connectEvent.tasks[i](socket);
92
- }
93
- if (this.getIdFromSubscrioption) {
94
- socket.on(socket_event_enum_1.DynamoNTS_SocketEvent.subscribe, (content) => {
95
- issuer = this.getIdFromSubscrioption(content);
96
- this.socketSubscription(socket, issuer);
97
- this.subscriptionEvent.getFullExecution(issuer)(content);
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ this.socketServer = newSocketServer;
80
+ this.socketServer.on(socket_event_enum_1.DynamoNTS_SocketEvent.connection, (socket) => tslib_1.__awaiter(this, void 0, void 0, function* () {
81
+ let issuer;
82
+ for (let i = 0; i < this.connectEvent.preProcessess.length; i++) {
83
+ yield this.connectEvent.preProcessess[i](socket);
84
+ }
85
+ for (let i = 0; i < this.connectEvent.tasks.length; i++) {
86
+ yield this.connectEvent.tasks[i](socket);
87
+ }
88
+ if (this.getIdFromSubscrioption) {
89
+ socket.on(socket_event_enum_1.DynamoNTS_SocketEvent.subscribe, (content) => tslib_1.__awaiter(this, void 0, void 0, function* () {
90
+ issuer = yield this.getIdFromSubscrioption(content);
91
+ this.socketSubscription(socket, issuer);
92
+ this.subscriptionEvent.getFullExecution(issuer)(content);
93
+ }));
94
+ }
95
+ this.incomingEvents.forEach((event) => {
96
+ socket.on(event.event, event.getFullExecution(issuer));
98
97
  });
99
- }
100
- this.events.forEach((event) => {
101
- socket.on(event.event, event.getFullExecution(issuer));
102
- });
103
- }));
104
- this.socketServer.listen(this.params.port);
105
- if (this.log)
106
- console.log(`\nsocket service setup finished: ${this.params.name}` +
107
- `\nsocket server listening on port: ${this.params.port}`);
98
+ }));
99
+ this.socketServer.listen(this.params.port);
100
+ if (this.log)
101
+ console.log(`\nsocket service setup finished: ${this.params.name}` +
102
+ `\nsocket server listening on port: ${this.params.port}`);
103
+ });
108
104
  }
109
105
  socketSubscription(newSocket, id) {
110
106
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -132,16 +128,29 @@ class DynamoNTS_SocketService extends dynamo_nts_singleton_service_1.DynamoNTS_S
132
128
  emitEvent(event, content) {
133
129
  this.socketServer.emit(event, content);
134
130
  }
135
- emitEventForId(id, event, content) {
136
- const dic = this.activeSockets.find((dic) => dic.id === id);
137
- if (dic) {
131
+ idIsSubscribed(id) {
132
+ return !!this.activeSockets.find((dic) => dic.id === id);
133
+ }
134
+ sendEventForId(id, event, content, error) {
135
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
136
+ const dic = this.activeSockets.find((dic) => dic.id === id);
137
+ if (dic) {
138
+ dic.sockets.forEach((socket) => {
139
+ socket.emit(event, content);
140
+ });
141
+ }
142
+ else {
143
+ if (error)
144
+ throw new fsm_dynamo_1.DynamoNTS_Error({ status: 404, message: `No active socket whit this specific ID: ${id}` });
145
+ }
146
+ });
147
+ }
148
+ broadcastEvent(event, content) {
149
+ this.activeSockets.forEach((dic) => {
138
150
  dic.sockets.forEach((socket) => {
139
151
  socket.emit(event, content);
140
152
  });
141
- }
142
- else {
143
- throw new fsm_dynamo_1.DynamoNTS_Error({ message: `No active socket whit this specific ID: ${id}` });
144
- }
153
+ });
145
154
  }
146
155
  }
147
156
  exports.DynamoNTS_SocketService = DynamoNTS_SocketService;