@futdevpro/nts-dynamo 1.9.15 → 1.9.16

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 (117) hide show
  1. package/.copilot/patterns.json +7 -7
  2. package/.github/workflows/main.yml +206 -0
  3. package/HOWTO.md +15 -15
  4. package/README.md +140 -140
  5. package/build/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
  6. package/build/_models/control-models/endpoint-params.control-model.js +2 -0
  7. package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
  8. package/build/_models/control-models/socket-event.control-model.js +1 -1
  9. package/build/_services/core/global.service.d.ts.map +1 -1
  10. package/build/_services/core/global.service.js +1 -0
  11. package/build/_services/core/global.service.js.map +1 -1
  12. package/build/_services/route/routing-module.service.d.ts +1 -0
  13. package/build/_services/route/routing-module.service.d.ts.map +1 -1
  14. package/build/_services/route/routing-module.service.js +17 -23
  15. package/build/_services/route/routing-module.service.js.map +1 -1
  16. package/build/_services/server/app.server.d.ts.map +1 -1
  17. package/build/_services/server/app.server.js +4 -1
  18. package/build/_services/server/app.server.js.map +1 -1
  19. package/build/_services/socket/socket-client.service.d.ts.map +1 -1
  20. package/build/_services/socket/socket-client.service.js +1 -0
  21. package/build/_services/socket/socket-client.service.js.map +1 -1
  22. package/nodemon.json +17 -15
  23. package/package.json +5 -5
  24. package/src/_constants/global-settings.const.ts +27 -27
  25. package/src/_constants/index.ts +2 -2
  26. package/src/_constants/mocks/app-extended-server.mock.ts +198 -198
  27. package/src/_constants/mocks/app-params.mock.ts +9 -9
  28. package/src/_constants/mocks/app-server.mock.ts +185 -185
  29. package/src/_constants/mocks/auth-service.mock.ts +28 -28
  30. package/src/_constants/mocks/controller.mock.ts +16 -16
  31. package/src/_constants/mocks/data-model.mock.ts +83 -83
  32. package/src/_constants/mocks/email-service-collection.mock.ts +13 -13
  33. package/src/_constants/mocks/email-service.mock.ts +19 -19
  34. package/src/_constants/mocks/email-template.mock.html +14 -14
  35. package/src/_constants/mocks/endpoint.mock.ts +90 -90
  36. package/src/_constants/mocks/socket-client.mock.ts +43 -43
  37. package/src/_constants/mocks/socket-server.mock.ts +43 -43
  38. package/src/_enums/data-model-type.enum.ts +14 -14
  39. package/src/_enums/data-service-function.enum.ts +15 -15
  40. package/src/_enums/http/http-call-type.enum.ts +12 -12
  41. package/src/_enums/http/http-response-type.enum.ts +7 -7
  42. package/src/_enums/http/socket-event-type.enum.ts +18 -18
  43. package/src/_enums/index.ts +13 -13
  44. package/src/_enums/predefined-data-types.enum.ts +27 -27
  45. package/src/_enums/route-security.enum.ts +12 -12
  46. package/src/_enums/socket-security.enum.ts +11 -11
  47. package/src/_models/control-models/api-call-params.control-model.ts +126 -126
  48. package/src/_models/control-models/app-ext-system-controls.control-model.ts +9 -9
  49. package/src/_models/control-models/app-params.control-model.ts +45 -45
  50. package/src/_models/control-models/app-system-controls.control-model.ts +9 -9
  51. package/src/_models/control-models/endpoint-params.control-model.ts +309 -307
  52. package/src/_models/control-models/http-settings.control-model.ts +29 -29
  53. package/src/_models/control-models/index.ts +13 -13
  54. package/src/_models/control-models/socket-client-service-params.control-model.ts +28 -28
  55. package/src/_models/control-models/socket-event.control-model.ts +150 -150
  56. package/src/_models/control-models/socket-presence.control-model.ts +207 -207
  57. package/src/_models/control-models/socket-server-service-params.control-model.ts +20 -20
  58. package/src/_models/control-models/system-control.control-model.ts +12 -12
  59. package/src/_models/index.ts +9 -9
  60. package/src/_models/interfaces/certification-settings.interface.ts +7 -7
  61. package/src/_models/interfaces/global-service-settings.interface.ts +45 -45
  62. package/src/_models/interfaces/global-settings.interface.ts +83 -83
  63. package/src/_models/interfaces/index.ts +7 -7
  64. package/src/_models/interfaces/routing-module-settings.interface.ts +20 -20
  65. package/src/_models/types/db-filter.type.ts +108 -108
  66. package/src/_models/types/db-update.type.ts +100 -100
  67. package/src/_models/types/index.ts +5 -5
  68. package/src/_modules/api-service.index.ts +12 -12
  69. package/src/_modules/app-extended.index.ts +28 -28
  70. package/src/_modules/app.index.ts +24 -24
  71. package/src/_modules/auth.index.ts +7 -7
  72. package/src/_modules/constants.index.ts +2 -2
  73. package/src/_modules/controller.index.ts +10 -10
  74. package/src/_modules/custom-data/custom-data.controller.ts +69 -69
  75. package/src/_modules/custom-data/custom-data.data-service.ts +20 -20
  76. package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +23 -23
  77. package/src/_modules/custom-data/index.ts +6 -6
  78. package/src/_modules/custom-data-module.index.ts +2 -2
  79. package/src/_modules/data-service.index.ts +9 -9
  80. package/src/_modules/email.index.ts +8 -8
  81. package/src/_modules/enums.index.ts +2 -2
  82. package/src/_modules/extended.index.ts +8 -8
  83. package/src/_modules/models.index.ts +2 -2
  84. package/src/_modules/services.index.ts +2 -2
  85. package/src/_modules/test/get-test-routing-module.util.ts +23 -23
  86. package/src/_modules/test/index.ts +5 -5
  87. package/src/_modules/test/test.controller.ts +115 -115
  88. package/src/_modules/test-module.index.ts +2 -2
  89. package/src/_modules/usage/get-usage-routing-module.util.ts +22 -22
  90. package/src/_modules/usage/index.ts +7 -7
  91. package/src/_modules/usage/usage.controller.ts +120 -120
  92. package/src/_modules/usage/usage.data-service.ts +172 -172
  93. package/src/_modules/usage-module.index.ts +2 -2
  94. package/src/_services/base/data.service.ts +921 -921
  95. package/src/_services/base/db.service.spec.ts +32 -32
  96. package/src/_services/base/db.service.ts +1063 -1063
  97. package/src/_services/base/singleton.service.ts +21 -21
  98. package/src/_services/core/api.service.ts +453 -453
  99. package/src/_services/core/auth.service.ts +172 -172
  100. package/src/_services/core/email.service.ts +678 -678
  101. package/src/_services/core/global.service.ts +270 -269
  102. package/src/_services/core/service-collection.service.ts +5 -5
  103. package/src/_services/index.ts +23 -23
  104. package/src/_services/route/controller.service.ts +129 -129
  105. package/src/_services/route/routing-module.service.ts +293 -273
  106. package/src/_services/server/app-extended.server.spec.ts +76 -76
  107. package/src/_services/server/app-extended.server.ts +520 -520
  108. package/src/_services/server/app.server.spec.ts +67 -67
  109. package/src/_services/server/app.server.ts +1181 -1179
  110. package/src/_services/shared.service.spec.ts +19 -19
  111. package/src/_services/shared.static-service.ts +73 -73
  112. package/src/_services/socket/socket-client.service.ts +236 -235
  113. package/src/_services/socket/socket-server.service.spec.ts +11 -11
  114. package/src/_services/socket/socket-server.service.ts +761 -761
  115. package/src/index.ts +18 -18
  116. package/tsconfig.json +41 -41
  117. package/build/tsconfig.tsbuildinfo +0 -1
@@ -1,83 +1,83 @@
1
- import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
2
- import { DynamoNTS_SocketSecurity } from '../../_enums/socket-security.enum';
3
-
4
- /**
5
- *
6
- *
7
- * @param logRequestsContent only will log if the specific logRequest is also true
8
- *
9
- * @param logEventContent only will log if the specific socket event is also set to log
10
- *
11
- */
12
- export interface DynamoNTS_Global_Settings {
13
- /**
14
- * this will be used as the main baseUrl for the application,
15
- * this is not required, but we suggest to use at least a '/api' as base route
16
- */
17
- baseUrl: string;
18
- /**
19
- * this sets the default security for routes
20
- */
21
- defaultRouteSecurity: DynamoNTS_RouteSecurity;
22
- /**
23
- * this sets the default security for sockets
24
- */
25
- defaultSocketSecurity: DynamoNTS_SocketSecurity;
26
-
27
- /**
28
- * this setting will enable debug logs for setting up the application
29
- */
30
- logSetup?: boolean;
31
-
32
- /**
33
- * this is an application wide default setting for route debug logs
34
- */
35
- logRequest?: boolean;
36
- /**
37
- * this is an application wide default setting for route debug logs
38
- */
39
- logRequestsParams?: boolean;
40
- /**
41
- * this is an application wide default setting for route debug logs
42
- */
43
- logRequestsContent?: boolean;
44
- /**
45
- * this is an application wide default setting for route debug logs
46
- */
47
- logResponseContent?: boolean;
48
-
49
- /**
50
- * this is an application wide default setting for socket debug logs
51
- */
52
- logAllSocketEvent?: boolean;
53
- /**
54
- * this is an application wide default setting for socket debug logs
55
- */
56
- logMainSocketEvents?: boolean;
57
- /**
58
- * this is an application wide default setting for socket debug logs
59
- */
60
- logSocketEventContent?: boolean;
61
-
62
- /**
63
- * this is an application wide default setting for api debug logs
64
- */
65
- logApiEvents?: boolean;
66
- /**
67
- * this is an application wide default setting for api debug logs
68
- */
69
- logApiRequestContents?: boolean;
70
- /**
71
- * this is an application wide default setting for api debug logs
72
- */
73
- logApiRequestSettings?: boolean;
74
- /**
75
- * this is an application wide default setting for api debug logs
76
- */
77
- logApiResponseContents?: boolean;
78
-
79
- /**
80
- * this is an application wide default setting for detailed error logs
81
- */
82
- logDetailedErrors?: boolean;
83
- }
1
+ import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
2
+ import { DynamoNTS_SocketSecurity } from '../../_enums/socket-security.enum';
3
+
4
+ /**
5
+ *
6
+ *
7
+ * @param logRequestsContent only will log if the specific logRequest is also true
8
+ *
9
+ * @param logEventContent only will log if the specific socket event is also set to log
10
+ *
11
+ */
12
+ export interface DynamoNTS_Global_Settings {
13
+ /**
14
+ * this will be used as the main baseUrl for the application,
15
+ * this is not required, but we suggest to use at least a '/api' as base route
16
+ */
17
+ baseUrl: string;
18
+ /**
19
+ * this sets the default security for routes
20
+ */
21
+ defaultRouteSecurity: DynamoNTS_RouteSecurity;
22
+ /**
23
+ * this sets the default security for sockets
24
+ */
25
+ defaultSocketSecurity: DynamoNTS_SocketSecurity;
26
+
27
+ /**
28
+ * this setting will enable debug logs for setting up the application
29
+ */
30
+ logSetup?: boolean;
31
+
32
+ /**
33
+ * this is an application wide default setting for route debug logs
34
+ */
35
+ logRequest?: boolean;
36
+ /**
37
+ * this is an application wide default setting for route debug logs
38
+ */
39
+ logRequestsParams?: boolean;
40
+ /**
41
+ * this is an application wide default setting for route debug logs
42
+ */
43
+ logRequestsContent?: boolean;
44
+ /**
45
+ * this is an application wide default setting for route debug logs
46
+ */
47
+ logResponseContent?: boolean;
48
+
49
+ /**
50
+ * this is an application wide default setting for socket debug logs
51
+ */
52
+ logAllSocketEvent?: boolean;
53
+ /**
54
+ * this is an application wide default setting for socket debug logs
55
+ */
56
+ logMainSocketEvents?: boolean;
57
+ /**
58
+ * this is an application wide default setting for socket debug logs
59
+ */
60
+ logSocketEventContent?: boolean;
61
+
62
+ /**
63
+ * this is an application wide default setting for api debug logs
64
+ */
65
+ logApiEvents?: boolean;
66
+ /**
67
+ * this is an application wide default setting for api debug logs
68
+ */
69
+ logApiRequestContents?: boolean;
70
+ /**
71
+ * this is an application wide default setting for api debug logs
72
+ */
73
+ logApiRequestSettings?: boolean;
74
+ /**
75
+ * this is an application wide default setting for api debug logs
76
+ */
77
+ logApiResponseContents?: boolean;
78
+
79
+ /**
80
+ * this is an application wide default setting for detailed error logs
81
+ */
82
+ logDetailedErrors?: boolean;
83
+ }
@@ -1,7 +1,7 @@
1
-
2
- // INTERFACES
3
- export * from './global-service-settings.interface';
4
- export * from '../control-models/http-settings.control-model';
5
- export * from './certification-settings.interface';
6
- export * from './global-settings.interface';
7
- export * from './routing-module-settings.interface';
1
+
2
+ // INTERFACES
3
+ export * from './global-service-settings.interface';
4
+ export * from '../control-models/http-settings.control-model';
5
+ export * from './certification-settings.interface';
6
+ export * from './global-settings.interface';
7
+ export * from './routing-module-settings.interface';
@@ -1,20 +1,20 @@
1
- import { DynamoNTS_RouteSecurity } from '../../_enums';
2
- import { DynamoNTS_Controller } from '../../_services';
3
-
4
- /**
5
- * This is a main route point handler, which collects a list of controllers for the API
6
- */
7
- export interface DynamoNTS_RoutingModule_Settings {
8
- /**
9
- * main route of the module
10
- */
11
- route: string;
12
- /**
13
- * the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
14
- */
15
- controllers: DynamoNTS_Controller[];
16
- /**
17
- * securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
18
- */
19
- securityOverride?: DynamoNTS_RouteSecurity;
20
- }
1
+ import { DynamoNTS_RouteSecurity } from '../../_enums';
2
+ import { DynamoNTS_Controller } from '../../_services';
3
+
4
+ /**
5
+ * This is a main route point handler, which collects a list of controllers for the API
6
+ */
7
+ export interface DynamoNTS_RoutingModule_Settings {
8
+ /**
9
+ * main route of the module
10
+ */
11
+ route: string;
12
+ /**
13
+ * the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
14
+ */
15
+ controllers: DynamoNTS_Controller[];
16
+ /**
17
+ * securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
18
+ */
19
+ securityOverride?: DynamoNTS_RouteSecurity;
20
+ }
@@ -1,108 +1,108 @@
1
-
2
- /**
3
- * @example
4
- * // by email:
5
- * { email: email }
6
- * //
7
- * @example
8
- * // or by id that is in list:
9
- * { userIds: { $in: this.userId } }
10
- * //
11
- * @example
12
- * // or by number or Date that is Greater Than AND Less Than:
13
- * { points: { $gt: 2, $lt: 14 } }
14
- * // further tools (syntax matches with $gt):
15
- * $eq: // Matches values that are EQual to a specified value.
16
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
17
- * $lte: // Matches values that are Less Than or Equal to a specified value.
18
- * $ne: // Matches all values that are Not Equal to a specified value.
19
- * $nin: // Matches None of the values specified IN an array.
20
- * //
21
- * @returns {T} data: T
22
- */
23
- export type DynamoNTS_DBFilter<T> =
24
- DynamoNTS_DBFilterSimple<T> |
25
- DynamoNTS_DBFilterOR<T> |
26
- DynamoNTS_DBFilterNOR<T>;
27
-
28
- /**
29
- * A simple filter for a DynamoDB query.
30
- */
31
- export type DynamoNTS_DBFilterSimple<T> = {
32
- [K in keyof T]?: T[K] | DynamoNTS_DBFilterExpressions<T[K]>;
33
- } & {
34
- [path: string]: any;
35
- };
36
-
37
- export type DynamoNTS_DBFilterExpressions<T> = {
38
- /**
39
- * Matches values that are includes the value; This works only when T[K] is an array!
40
- */
41
- $in?: any,
42
- /**
43
- * Matches values that are EQual to a specified value.
44
- */
45
- $eq?: T,
46
- /**
47
- * Matches values that are Greater Than a specified value.
48
- */
49
- $gt?: number | Date,
50
- /**
51
- * Matches values that are Greater Than OR Equal to a specified value.
52
- */
53
- $gte?: number | Date,
54
- /**
55
- * Matches values that are Less Than a specified value.
56
- */
57
- $lt?: number | Date,
58
- /**
59
- * Matches values that are Less Than or Equal to a specified value.
60
- */
61
- $lte?: number | Date,
62
- /**
63
- * Matches all values that are Not Equal to a specified value.
64
- */
65
- $ne?: T,
66
- /**
67
- * Matches None of the values specified IN an array.
68
- */
69
- $nin?: T,
70
- /**
71
- * Inverts the effect of a query expression and returns documents that do not match the query expression.
72
- */
73
- $not?: T | {
74
- $regex?: RegExp | string,
75
- },
76
- /**
77
- * Performs a regular expression on the field's value, and selects documents that match the regular expression.
78
- */
79
- $exists?: boolean,
80
- /**
81
- * Selects documents if a field is of the specified type.
82
- */
83
- $type?: string,
84
- };
85
-
86
-
87
- /**
88
- * Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
89
- */
90
- export type DynamoNTS_DBFilterNOR<T> = {
91
- /**
92
- * Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
93
- */
94
- $nor: DynamoNTS_DBFilterSimple<T>[];
95
- }
96
-
97
-
98
- /**
99
- * Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
100
- */
101
- export type DynamoNTS_DBFilterOR<T> = {
102
- /**
103
- * Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
104
- */
105
- $or: DynamoNTS_DBFilterSimple<T>[];
106
- }
107
-
108
-
1
+
2
+ /**
3
+ * @example
4
+ * // by email:
5
+ * { email: email }
6
+ * //
7
+ * @example
8
+ * // or by id that is in list:
9
+ * { userIds: { $in: this.userId } }
10
+ * //
11
+ * @example
12
+ * // or by number or Date that is Greater Than AND Less Than:
13
+ * { points: { $gt: 2, $lt: 14 } }
14
+ * // further tools (syntax matches with $gt):
15
+ * $eq: // Matches values that are EQual to a specified value.
16
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
17
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
18
+ * $ne: // Matches all values that are Not Equal to a specified value.
19
+ * $nin: // Matches None of the values specified IN an array.
20
+ * //
21
+ * @returns {T} data: T
22
+ */
23
+ export type DynamoNTS_DBFilter<T> =
24
+ DynamoNTS_DBFilterSimple<T> |
25
+ DynamoNTS_DBFilterOR<T> |
26
+ DynamoNTS_DBFilterNOR<T>;
27
+
28
+ /**
29
+ * A simple filter for a DynamoDB query.
30
+ */
31
+ export type DynamoNTS_DBFilterSimple<T> = {
32
+ [K in keyof T]?: T[K] | DynamoNTS_DBFilterExpressions<T[K]>;
33
+ } & {
34
+ [path: string]: any;
35
+ };
36
+
37
+ export type DynamoNTS_DBFilterExpressions<T> = {
38
+ /**
39
+ * Matches values that are includes the value; This works only when T[K] is an array!
40
+ */
41
+ $in?: any,
42
+ /**
43
+ * Matches values that are EQual to a specified value.
44
+ */
45
+ $eq?: T,
46
+ /**
47
+ * Matches values that are Greater Than a specified value.
48
+ */
49
+ $gt?: number | Date,
50
+ /**
51
+ * Matches values that are Greater Than OR Equal to a specified value.
52
+ */
53
+ $gte?: number | Date,
54
+ /**
55
+ * Matches values that are Less Than a specified value.
56
+ */
57
+ $lt?: number | Date,
58
+ /**
59
+ * Matches values that are Less Than or Equal to a specified value.
60
+ */
61
+ $lte?: number | Date,
62
+ /**
63
+ * Matches all values that are Not Equal to a specified value.
64
+ */
65
+ $ne?: T,
66
+ /**
67
+ * Matches None of the values specified IN an array.
68
+ */
69
+ $nin?: T,
70
+ /**
71
+ * Inverts the effect of a query expression and returns documents that do not match the query expression.
72
+ */
73
+ $not?: T | {
74
+ $regex?: RegExp | string,
75
+ },
76
+ /**
77
+ * Performs a regular expression on the field's value, and selects documents that match the regular expression.
78
+ */
79
+ $exists?: boolean,
80
+ /**
81
+ * Selects documents if a field is of the specified type.
82
+ */
83
+ $type?: string,
84
+ };
85
+
86
+
87
+ /**
88
+ * Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
89
+ */
90
+ export type DynamoNTS_DBFilterNOR<T> = {
91
+ /**
92
+ * Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
93
+ */
94
+ $nor: DynamoNTS_DBFilterSimple<T>[];
95
+ }
96
+
97
+
98
+ /**
99
+ * Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
100
+ */
101
+ export type DynamoNTS_DBFilterOR<T> = {
102
+ /**
103
+ * Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
104
+ */
105
+ $or: DynamoNTS_DBFilterSimple<T>[];
106
+ }
107
+
108
+
@@ -1,100 +1,100 @@
1
-
2
- /**
3
- * @param update this uses the basic Mongoose updateOne
4
- * @example
5
- * // increase a specific value (here by 15):
6
- * { $inc: { popularity: 15 } }
7
- * //
8
- * @example
9
- * // or add element to a list:
10
- * { $push: { reactions: this.newReaction }
11
- * // or add multiple elements to a list
12
- * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
13
- * //
14
- * @example
15
- * // or all at once
16
- * {
17
- * $inc: { popularity: this.newVote.amount },
18
- * emailVerified: true,
19
- * $push: { reactions: this.newReaction }
20
- * }
21
- * // further tools (syntax matches with $inc):
22
- * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
23
- * $min: // Only updates the field if the specified value is less than the existing field value.
24
- * $max: // Only updates the field if the specified value is greater than the existing field value.
25
- * $mul: // Multiplies the value of the field by the specified amount.
26
- * $rename: // Renames a field.
27
- * $unset: // Removes the specified field from a document. (set: "" to value)
28
- * //
29
- */
30
- export type DynamoNTS_DBUpdate<T> = {
31
- /**
32
- * Sets the value of a field to current date, either as a Date or a Timestamp.
33
- */
34
- /* $currentDate?: { [K in keyof T]?: boolean }; */
35
- /**
36
- * Increments the value of the field by the specified amount.
37
- */
38
- $inc?: { [K in keyof T]?: number };
39
- /**
40
- * Only updates the field if the specified value is less than the existing field value.
41
- */
42
- $min?: { [K in keyof T]?: number };
43
- /**
44
- * Only updates the field if the specified value is greater than the existing field value.
45
- */
46
- $max?: { [K in keyof T]?: number };
47
- /**
48
- * Multiplies the value of the field by the specified amount.
49
- */
50
- $mul?: { [K in keyof T]?: number };
51
- /**
52
- * Renames a field.
53
- */
54
- $rename?: { [K in keyof T]?: string };
55
- /**
56
- * Removes the specified field from a document. (set: "" to value)
57
- */
58
- $unset?: { [K in keyof T]?: string };
59
- /**
60
- * Sets the value of a field in a document.
61
- */
62
- $set?: { [K in keyof T]?: string } | any;
63
- /**
64
- * Sets the value of a field if an update results in an insert of a document.
65
- * Has no effect on update operations that modify existing documents.
66
- */
67
- $setOnInsert?: { [K in keyof T]?: T[K] };
68
- /**
69
- * Removes the first or last item of an array.
70
- */
71
-
72
- // array only operations
73
- /**
74
- * Removes the first or last item of an array.
75
- */
76
- $push?: { [K in keyof T]?: any | { $each?: T[K] } };
77
- /**
78
- * Removes the first or last item of an array.
79
- */
80
- $addToSet?: { [K in keyof T]?: any | { $each?: T[K] } };
81
- /**
82
- * Removes the first or last item of an array.
83
- */
84
- $pop?: { [K in keyof T]?: 1 | -1 };
85
- /**
86
- * Removes all array elements that match a specified query.
87
- */
88
- $pull?: { [K in keyof T]?: any | { $each?: T[K] } };
89
- /**
90
- * Removes all array elements that match a specified query.
91
- */
92
- $pullAll?: { [K in keyof T]?: any | { $each?: T[K] } };
93
- } & DynamoNTS_DBSimpleUpdate<T>;
94
-
95
- /**
96
- *
97
- */
98
- export type DynamoNTS_DBSimpleUpdate<T> = {
99
- [K in keyof T]?: T[K];
100
- };
1
+
2
+ /**
3
+ * @param update this uses the basic Mongoose updateOne
4
+ * @example
5
+ * // increase a specific value (here by 15):
6
+ * { $inc: { popularity: 15 } }
7
+ * //
8
+ * @example
9
+ * // or add element to a list:
10
+ * { $push: { reactions: this.newReaction }
11
+ * // or add multiple elements to a list
12
+ * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
13
+ * //
14
+ * @example
15
+ * // or all at once
16
+ * {
17
+ * $inc: { popularity: this.newVote.amount },
18
+ * emailVerified: true,
19
+ * $push: { reactions: this.newReaction }
20
+ * }
21
+ * // further tools (syntax matches with $inc):
22
+ * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
23
+ * $min: // Only updates the field if the specified value is less than the existing field value.
24
+ * $max: // Only updates the field if the specified value is greater than the existing field value.
25
+ * $mul: // Multiplies the value of the field by the specified amount.
26
+ * $rename: // Renames a field.
27
+ * $unset: // Removes the specified field from a document. (set: "" to value)
28
+ * //
29
+ */
30
+ export type DynamoNTS_DBUpdate<T> = {
31
+ /**
32
+ * Sets the value of a field to current date, either as a Date or a Timestamp.
33
+ */
34
+ /* $currentDate?: { [K in keyof T]?: boolean }; */
35
+ /**
36
+ * Increments the value of the field by the specified amount.
37
+ */
38
+ $inc?: { [K in keyof T]?: number };
39
+ /**
40
+ * Only updates the field if the specified value is less than the existing field value.
41
+ */
42
+ $min?: { [K in keyof T]?: number };
43
+ /**
44
+ * Only updates the field if the specified value is greater than the existing field value.
45
+ */
46
+ $max?: { [K in keyof T]?: number };
47
+ /**
48
+ * Multiplies the value of the field by the specified amount.
49
+ */
50
+ $mul?: { [K in keyof T]?: number };
51
+ /**
52
+ * Renames a field.
53
+ */
54
+ $rename?: { [K in keyof T]?: string };
55
+ /**
56
+ * Removes the specified field from a document. (set: "" to value)
57
+ */
58
+ $unset?: { [K in keyof T]?: string };
59
+ /**
60
+ * Sets the value of a field in a document.
61
+ */
62
+ $set?: { [K in keyof T]?: string } | any;
63
+ /**
64
+ * Sets the value of a field if an update results in an insert of a document.
65
+ * Has no effect on update operations that modify existing documents.
66
+ */
67
+ $setOnInsert?: { [K in keyof T]?: T[K] };
68
+ /**
69
+ * Removes the first or last item of an array.
70
+ */
71
+
72
+ // array only operations
73
+ /**
74
+ * Removes the first or last item of an array.
75
+ */
76
+ $push?: { [K in keyof T]?: any | { $each?: T[K] } };
77
+ /**
78
+ * Removes the first or last item of an array.
79
+ */
80
+ $addToSet?: { [K in keyof T]?: any | { $each?: T[K] } };
81
+ /**
82
+ * Removes the first or last item of an array.
83
+ */
84
+ $pop?: { [K in keyof T]?: 1 | -1 };
85
+ /**
86
+ * Removes all array elements that match a specified query.
87
+ */
88
+ $pull?: { [K in keyof T]?: any | { $each?: T[K] } };
89
+ /**
90
+ * Removes all array elements that match a specified query.
91
+ */
92
+ $pullAll?: { [K in keyof T]?: any | { $each?: T[K] } };
93
+ } & DynamoNTS_DBSimpleUpdate<T>;
94
+
95
+ /**
96
+ *
97
+ */
98
+ export type DynamoNTS_DBSimpleUpdate<T> = {
99
+ [K in keyof T]?: T[K];
100
+ };
@@ -1,5 +1,5 @@
1
-
2
-
3
- // TYPES
4
- export * from './db-filter.type';
5
- export * from './db-update.type';
1
+
2
+
3
+ // TYPES
4
+ export * from './db-filter.type';
5
+ export * from './db-update.type';