@futdevpro/nts-dynamo 1.5.77 → 1.5.83

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 (227) hide show
  1. package/LICENSE +2 -2
  2. package/lib/_constants/dynamo-nts-global-settings.d.ts +2 -2
  3. package/lib/_constants/dynamo-nts-global-settings.js +17 -17
  4. package/lib/_constants/index.d.ts +1 -1
  5. package/lib/_constants/index.js +4 -4
  6. package/lib/_enums/data-model-type.enum.d.ts +12 -12
  7. package/lib/_enums/data-model-type.enum.js +16 -16
  8. package/lib/_enums/data-model-type.enum.js.map +1 -1
  9. package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +12 -12
  10. package/lib/_enums/dynamo-nts-data-service-function.enum.js +18 -18
  11. package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
  12. package/lib/_enums/dynamo-nts-route-security.enum.d.ts +11 -11
  13. package/lib/_enums/dynamo-nts-route-security.enum.js +15 -15
  14. package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
  15. package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +10 -10
  16. package/lib/_enums/dynamo-nts-socket-security.enum.js +14 -14
  17. package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
  18. package/lib/_enums/http/http-call-type.enum.d.ts +11 -11
  19. package/lib/_enums/http/http-call-type.enum.js +15 -15
  20. package/lib/_enums/http/http-call-type.enum.js.map +1 -1
  21. package/lib/_enums/http/http-response-type.enum.d.ts +6 -6
  22. package/lib/_enums/http/http-response-type.enum.js +10 -10
  23. package/lib/_enums/http/http-response-type.enum.js.map +1 -1
  24. package/lib/_enums/http/socket-event.enum.d.ts +9 -8
  25. package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
  26. package/lib/_enums/http/socket-event.enum.js +13 -12
  27. package/lib/_enums/http/socket-event.enum.js.map +1 -1
  28. package/lib/_enums/index.d.ts +8 -8
  29. package/lib/_enums/index.js +13 -13
  30. package/lib/_enums/predefined-data-types.enum.d.ts +10 -10
  31. package/lib/_enums/predefined-data-types.enum.js +14 -14
  32. package/lib/_enums/predefined-data-types.enum.js.map +1 -1
  33. package/lib/_interfaces/certification-settings.interface.d.ts +7 -0
  34. package/lib/_interfaces/certification-settings.interface.d.ts.map +1 -0
  35. package/lib/_interfaces/certification-settings.interface.js +3 -0
  36. package/lib/_interfaces/certification-settings.interface.js.map +1 -0
  37. package/lib/_interfaces/global-service-settings.interface.d.ts +18 -0
  38. package/lib/_interfaces/global-service-settings.interface.d.ts.map +1 -0
  39. package/lib/_interfaces/global-service-settings.interface.js +3 -0
  40. package/lib/_interfaces/global-service-settings.interface.js.map +1 -0
  41. package/lib/_interfaces/index.d.ts +1 -0
  42. package/lib/_interfaces/index.d.ts.map +1 -0
  43. package/lib/_interfaces/index.js +4 -0
  44. package/lib/_interfaces/index.js.map +1 -0
  45. package/lib/_interfaces/port-settings.interface.d.ts +5 -0
  46. package/lib/_interfaces/port-settings.interface.d.ts.map +1 -0
  47. package/lib/_interfaces/port-settings.interface.js +3 -0
  48. package/lib/_interfaces/port-settings.interface.js.map +1 -0
  49. package/lib/_models/dynamo-nts-api-call-params.d.ts +95 -95
  50. package/lib/_models/dynamo-nts-api-call-params.js +47 -47
  51. package/lib/_models/dynamo-nts-app-params.d.ts +49 -49
  52. package/lib/_models/dynamo-nts-app-params.js +17 -17
  53. package/lib/_models/dynamo-nts-endpoint-params.d.ts +80 -80
  54. package/lib/_models/dynamo-nts-endpoint-params.js +139 -139
  55. package/lib/_models/dynamo-nts-global-settings.d.ts +53 -53
  56. package/lib/_models/dynamo-nts-global-settings.js +2 -2
  57. package/lib/_models/dynamo-nts-routing-module-settings.d.ts +19 -19
  58. package/lib/_models/dynamo-nts-routing-module-settings.js +2 -2
  59. package/lib/_models/dynamo-nts-socket-event-params.d.ts +32 -30
  60. package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
  61. package/lib/_models/dynamo-nts-socket-event-params.js +80 -79
  62. package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
  63. package/lib/_models/dynamo-nts-socket-presence.d.ts +21 -0
  64. package/lib/_models/dynamo-nts-socket-presence.d.ts.map +1 -0
  65. package/lib/_models/dynamo-nts-socket-presence.js +45 -0
  66. package/lib/_models/dynamo-nts-socket-presence.js.map +1 -0
  67. package/lib/_models/dynamo-nts-socket-service-params.d.ts +18 -18
  68. package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
  69. package/lib/_models/dynamo-nts-socket-service-params.js +26 -26
  70. package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
  71. package/lib/_models/index.d.ts +7 -8
  72. package/lib/_models/index.d.ts.map +1 -1
  73. package/lib/_models/index.js +12 -12
  74. package/lib/_models/index.js.map +1 -1
  75. package/lib/_modules/api-service.index.d.ts +5 -5
  76. package/lib/_modules/api-service.index.js +11 -11
  77. package/lib/_modules/app-extended.index.d.ts +15 -12
  78. package/lib/_modules/app-extended.index.d.ts.map +1 -1
  79. package/lib/_modules/app-extended.index.js +23 -19
  80. package/lib/_modules/app-extended.index.js.map +1 -1
  81. package/lib/_modules/app.index.d.ts +13 -10
  82. package/lib/_modules/app.index.d.ts.map +1 -1
  83. package/lib/_modules/app.index.js +21 -17
  84. package/lib/_modules/app.index.js.map +1 -1
  85. package/lib/_modules/auth.index.d.ts +3 -3
  86. package/lib/_modules/auth.index.js +8 -8
  87. package/lib/_modules/constants.index.d.ts +1 -1
  88. package/lib/_modules/constants.index.js +4 -4
  89. package/lib/_modules/controller.index.d.ts +4 -4
  90. package/lib/_modules/controller.index.js +10 -10
  91. package/lib/_modules/custom-data/custom-data.controller.d.ts +5 -5
  92. package/lib/_modules/custom-data/custom-data.controller.js +55 -55
  93. package/lib/_modules/custom-data/custom-data.service.d.ts +5 -5
  94. package/lib/_modules/custom-data/custom-data.service.js +11 -11
  95. package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +3 -3
  96. package/lib/_modules/custom-data/get-custom-data-routing-module.js +17 -17
  97. package/lib/_modules/custom-data/index.d.ts +4 -4
  98. package/lib/_modules/custom-data/index.js +8 -8
  99. package/lib/_modules/custom-data-module.index.d.ts +1 -1
  100. package/lib/_modules/custom-data-module.index.js +4 -4
  101. package/lib/_modules/data-service.index.d.ts +5 -5
  102. package/lib/_modules/data-service.index.js +10 -10
  103. package/lib/_modules/email.index.d.ts +3 -3
  104. package/lib/_modules/email.index.js +8 -8
  105. package/lib/_modules/enums.index.d.ts +1 -1
  106. package/lib/_modules/enums.index.js +4 -4
  107. package/lib/_modules/models.index.d.ts +1 -1
  108. package/lib/_modules/models.index.js +4 -4
  109. package/lib/_modules/services.index.d.ts +1 -1
  110. package/lib/_modules/services.index.js +4 -4
  111. package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
  112. package/lib/_modules/test/get-test-routing-module.js +17 -17
  113. package/lib/_modules/test/index.d.ts +3 -3
  114. package/lib/_modules/test/index.js +7 -7
  115. package/lib/_modules/test/test.controller.d.ts +5 -5
  116. package/lib/_modules/test/test.controller.js +104 -104
  117. package/lib/_modules/test-module.index.d.ts +1 -1
  118. package/lib/_modules/test-module.index.js +4 -4
  119. package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
  120. package/lib/_modules/usage/get-usage-routing-module.js +17 -17
  121. package/lib/_modules/usage/index.d.ts +4 -4
  122. package/lib/_modules/usage/index.js +8 -8
  123. package/lib/_modules/usage/usage-controller.d.ts +6 -6
  124. package/lib/_modules/usage/usage-controller.js +88 -88
  125. package/lib/_modules/usage/usage.service.d.ts +16 -16
  126. package/lib/_modules/usage/usage.service.js +132 -132
  127. package/lib/_modules/usage-module.index.d.ts +1 -1
  128. package/lib/_modules/usage-module.index.js +4 -4
  129. package/lib/_services/dynamo-nts-api.service.d.ts +34 -34
  130. package/lib/_services/dynamo-nts-api.service.js +188 -188
  131. package/lib/_services/dynamo-nts-app-extended.d.ts +128 -128
  132. package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
  133. package/lib/_services/dynamo-nts-app-extended.js +212 -212
  134. package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
  135. package/lib/_services/dynamo-nts-app.d.ts +270 -278
  136. package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
  137. package/lib/_services/dynamo-nts-app.js +371 -371
  138. package/lib/_services/dynamo-nts-app.js.map +1 -1
  139. package/lib/_services/dynamo-nts-app.spec.d.ts +1 -0
  140. package/lib/_services/dynamo-nts-app.spec.d.ts.map +1 -0
  141. package/lib/_services/dynamo-nts-app.spec.js +10 -0
  142. package/lib/_services/dynamo-nts-app.spec.js.map +1 -0
  143. package/lib/_services/dynamo-nts-auth.service.d.ts +127 -127
  144. package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
  145. package/lib/_services/dynamo-nts-auth.service.js +53 -53
  146. package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
  147. package/lib/_services/dynamo-nts-controller.service.d.ts +105 -105
  148. package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
  149. package/lib/_services/dynamo-nts-controller.service.js +57 -57
  150. package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
  151. package/lib/_services/dynamo-nts-data.service.d.ts +230 -230
  152. package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
  153. package/lib/_services/dynamo-nts-data.service.js +689 -689
  154. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  155. package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +8 -8
  156. package/lib/_services/dynamo-nts-db-service-collection.service.js +10 -10
  157. package/lib/_services/dynamo-nts-db.service.d.ts +386 -312
  158. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  159. package/lib/_services/dynamo-nts-db.service.js +856 -856
  160. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  161. package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +18 -18
  162. package/lib/_services/dynamo-nts-email-service-collection.service.js +20 -20
  163. package/lib/_services/dynamo-nts-email.service.d.ts +56 -56
  164. package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
  165. package/lib/_services/dynamo-nts-email.service.js +203 -203
  166. package/lib/_services/dynamo-nts-email.service.js.map +1 -1
  167. package/lib/_services/dynamo-nts-global.service.d.ts +71 -84
  168. package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
  169. package/lib/_services/dynamo-nts-global.service.js +156 -156
  170. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  171. package/lib/_services/dynamo-nts-routing-module.service.d.ts +76 -76
  172. package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
  173. package/lib/_services/dynamo-nts-routing-module.service.js +191 -191
  174. package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
  175. package/lib/_services/dynamo-nts-shared.service.d.ts +31 -31
  176. package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
  177. package/lib/_services/dynamo-nts-shared.service.js +70 -70
  178. package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
  179. package/lib/_services/dynamo-nts-shared.service.spec.d.ts +2 -0
  180. package/lib/_services/dynamo-nts-shared.service.spec.d.ts.map +1 -0
  181. package/lib/_services/dynamo-nts-shared.service.spec.js +12 -0
  182. package/lib/_services/dynamo-nts-shared.service.spec.js.map +1 -0
  183. package/lib/_services/dynamo-nts-singleton.service.d.ts +8 -8
  184. package/lib/_services/dynamo-nts-singleton.service.js +18 -18
  185. package/lib/_services/dynamo-nts-singleton.service.js.map +1 -1
  186. package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +9 -9
  187. package/lib/_services/dynamo-nts-socket-service-collection.service.js +13 -13
  188. package/lib/_services/dynamo-nts-socket.service.d.ts +57 -45
  189. package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
  190. package/lib/_services/dynamo-nts-socket.service.js +188 -165
  191. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  192. package/lib/_services/index.d.ts +14 -16
  193. package/lib/_services/index.d.ts.map +1 -1
  194. package/lib/_services/index.js +20 -20
  195. package/lib/_services/index.js.map +1 -1
  196. package/lib/index.d.ts +6 -6
  197. package/lib/index.js +14 -14
  198. package/lib/tsconfig.tsbuildinfo +1 -1
  199. package/package SAVE.json +216 -0
  200. package/package-NEW with test but not working.json +228 -0
  201. package/package.json +14 -8
  202. package/spec/support/jasmine.json +14 -0
  203. package/src/_enums/http/socket-event.enum.ts +2 -1
  204. package/src/_interfaces/certification-settings.interface.ts +7 -0
  205. package/src/_interfaces/global-service-settings.interface.ts +23 -0
  206. package/src/_interfaces/index.ts +5 -0
  207. package/src/_interfaces/port-settings.interface.ts +5 -0
  208. package/src/_models/dynamo-nts-socket-event-params.ts +23 -21
  209. package/src/_models/{dynamo-nts-socket-dictionary.ts → dynamo-nts-socket-presence.ts} +21 -5
  210. package/src/_models/dynamo-nts-socket-service-params.ts +1 -0
  211. package/src/_models/index.ts +2 -2
  212. package/src/_modules/app-extended.index.ts +7 -2
  213. package/src/_modules/app.index.ts +5 -0
  214. package/src/_services/dynamo-nts-app-extended.ts +6 -2
  215. package/src/_services/dynamo-nts-app.spec.ts +14 -0
  216. package/src/_services/dynamo-nts-app.ts +8 -14
  217. package/src/_services/dynamo-nts-auth.service.ts +1 -0
  218. package/src/_services/dynamo-nts-controller.service.ts +2 -1
  219. package/src/_services/dynamo-nts-data.service.ts +19 -19
  220. package/src/_services/dynamo-nts-db.service.ts +195 -115
  221. package/src/_services/dynamo-nts-email.service.ts +1 -0
  222. package/src/_services/dynamo-nts-global.service.ts +3 -18
  223. package/src/_services/dynamo-nts-routing-module.service.ts +1 -0
  224. package/src/_services/dynamo-nts-shared.service.spec.ts +10 -0
  225. package/src/_services/dynamo-nts-shared.service.ts +2 -1
  226. package/src/_services/dynamo-nts-socket.service.ts +80 -41
  227. package/src/_services/index.ts +2 -2
@@ -1,313 +1,387 @@
1
- import * as mongoose from 'mongoose';
2
- import { Dynamo_Metadata, Dynamo_DataParams } from '@futdevpro/fsm-dynamo';
3
- /**
4
- *
5
- */
6
- export declare class DynamoNTS_DBService<T extends Dynamo_Metadata, F extends T = any, U extends T = any> {
7
- dataParams: Dynamo_DataParams;
8
- dataModel: mongoose.Model<mongoose.Document<any, any, any>, any, any>;
9
- private depDataName;
10
- defaultErrorUserMsg: string;
11
- /**
12
- * @param dataName name the model
13
- * @param typeSample sample data for scheme creation (dont include Dynamo_Metadata!)
14
- * @param schemaSettings additional settings for specific parameters as unique, required, minlength or maxlength
15
- * schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
16
- */
17
- constructor(dataParams: Dynamo_DataParams);
18
- /**
19
- * save new data
20
- * @param data data
21
- * @returns data
22
- */
23
- createData(data: T, issuer: string): Promise<T>;
24
- /**
25
- * Find data by _id and update
26
- * @param data data
27
- * @returns data
28
- */
29
- modifyData(data: T, issuer: string): Promise<T>;
30
- /**
31
- * returns data by _id,
32
- * @param id id
33
- * @returns data
34
- */
35
- getDataById(id: string): Promise<T>;
36
- /**
37
- * get data by dependency data id,
38
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-GD2)
39
- *
40
- * @param dependencyId id
41
- * @returns data
42
- */
43
- getDataByDependencyId(dependencyId: string): Promise<T>;
44
- /**
45
- * get data by dependency data id,
46
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-GLD2)
47
- *
48
- * @param dependencyId id
49
- * @returns dataList
50
- */
51
- getDataListByDependencyId(dependencyId: string): Promise<T[]>;
52
- /**
53
- * get multiple data objects by a list of DependencyIDs,
54
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-GLDS2)
55
- *
56
- * @param ids ids
57
- * @returns dataList
58
- */
59
- getDataListByDependencyIds(ids: string[]): Promise<T[]>;
60
- /**
61
- * returns search result for searchBy object params
62
- * can use lists or xRange values for searchBy obj properties
63
- *
64
- * @param searchBy filter
65
- * @param narrowByDependencyIds id
66
- * @returns dataList
67
- */
68
- searchData(searchBy: F, narrowByDependencyIds?: string[]): Promise<T[]>;
69
- /**
70
- * returns all data from database,
71
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-GA1)
72
- *
73
- * @returns dataList
74
- */
75
- getAll(): Promise<T[]>;
76
- /**
77
- * deleted data by id
78
- * @param id id
79
- */
80
- deleteDataById(id: string): Promise<void>;
81
- /**
82
- * deleted data by id
83
- * @param dependencyId id
84
- */
85
- deleteDataByDependencyId(dependencyId: string): Promise<void>;
86
- /**
87
- * Find the data first by any of its parameters,
88
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-FO1)
89
- *
90
- * @param filter if you can, use unique parameters for find!
91
- *
92
- * @example
93
- * // by email:
94
- * { email: email }
95
- * //
96
- * @example
97
- * // or by id that is in list:
98
- * { userIds: { $in: this.userId } }
99
- * //
100
- * @example
101
- * // or by number or Date that is Greater Than AND Less Than:
102
- * { points: { $gt: 2, $lt: 14 } }
103
- * // further tools (syntax matches with $gt):
104
- * $eq: // Matches values that are EQual to a specified value.
105
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
106
- * $lte: // Matches values that are Less Than or Equal to a specified value.
107
- * $ne: // Matches all values that are Not Equal to a specified value.
108
- * $nin: // Matches None of the values specified IN an array.
109
- * //
110
- * @returns {T} data: T
111
- */
112
- findOne(filter: F): Promise<T>;
113
- /**
114
- * #MONGOOSE FUNCTION
115
- * Find the data first by any of its parameters,
116
- * !!!: throws error if not found (errorCode on not found: NTS-DBS-F1)
117
- *
118
- * @param filter if you can, use unique parameters for find!
119
- *
120
- * @example
121
- * // by email:
122
- * { email: email }
123
- * //
124
- * @example
125
- * // or by id that is in list:
126
- * { userIds: { $in: this.userId } }
127
- * //
128
- * @example
129
- * // or by number or Date that is Greater Than AND Less Than:
130
- * { points: { $gt: 2, $lt: 14 } }
131
- * // further tools (syntax matches with $gt):
132
- * $eq: // Matches values that are EQual to a specified value.
133
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
134
- * $lte: // Matches values that are Less Than or Equal to a specified value.
135
- * $ne: // Matches all values that are Not Equal to a specified value.
136
- * $nin: // Matches None of the values specified IN an array.
137
- * //
138
- * @returns {T[]} dataList: T[]
139
- */
140
- find(filter: F): Promise<T[]>;
141
- /**
142
- * #MONGOOSE FUNCTION
143
- * Find the data first by any of its parameters
144
- *
145
- * @param filter if you can, use unique parameters for find!
146
- *
147
- * @example
148
- * // by email:
149
- * { email: email }
150
- * //
151
- * @example
152
- * // or by id that is in list:
153
- * { userIds: { $in: this.userId } }
154
- * //
155
- * @example
156
- * // or by number or Date that is Greater Than AND Less Than:
157
- * { points: { $gt: 2, $lt: 14 } }
158
- * // further tools (syntax matches with $gt):
159
- * $eq: // Matches values that are EQual to a specified value.
160
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
161
- * $lte: // Matches values that are Less Than or Equal to a specified value.
162
- * $ne: // Matches all values that are Not Equal to a specified value.
163
- * $nin: // Matches None of the values specified IN an array.
164
- * //
165
- * @param page page
166
- * @param pageSize pageSize
167
- * @param sort
168
- * @example
169
- * // by dateTime (this uses the basic sort function):
170
- * { dateTime: -1 }
171
- * //
172
- * @returns {T[]} dataList: T[]
173
- */
174
- findWithPaging(filter: F, page: number, pageSize: number, sort?: any): Promise<T[]>;
175
- /**
176
- * #MONGOOSE FUNCTION
177
- * Find data by _id and update
178
- * !!!: throws error if not found (errorCode on not found: )
179
- *
180
- * @param id id
181
- * @param update update
182
- * @returns data
183
- */
184
- findByIdAndUpdate(id: string, update: U, modifier: string): Promise<T>;
185
- /**
186
- * #MONGOOSE FUNCTION
187
- * Find the data first by any of its parameters
188
- *
189
- * @param filter This uses the basic Mongoose updateOne.
190
- * If you can, use unique parameters for find!
191
- * @example
192
- * // by email:
193
- * { email: email }
194
- * //
195
- * @example
196
- * // or by id that is in list:
197
- * { userIds: { $in: this.userId } }
198
- * //
199
- * @example
200
- * // or by number or Date that is Greater Than AND Less Than:
201
- * { points: { $gt: 2, $lt: 14 } }
202
- * // further tools (syntax matches with $gt):
203
- * $eq: // Matches values that are EQual to a specified value.
204
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
205
- * $lte: // Matches values that are Less Than or Equal to a specified value.
206
- * $ne: // Matches all values that are Not Equal to a specified value.
207
- * $nin: // Matches None of the values specified IN an array.
208
- * //
209
- *
210
- * @param update this uses the basic Mongoose updateOne
211
- * @example
212
- * // increase a specific value (here by 15):
213
- * { $inc: { popularity: 15 } }
214
- * //
215
- * @example
216
- * // or add element to a list:
217
- * { $push: { reactions: this.newReaction }
218
- * // or add multiple elements to a list
219
- * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
220
- * //
221
- * @example
222
- * // or all at once
223
- * {
224
- * $inc: { popularity: this.newVote.amount },
225
- * emailVerified: true,
226
- * $push: { reactions: this.newReaction }
227
- * }
228
- * // further tools (syntax matches with $inc):
229
- * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
230
- * $min: // Only updates the field if the specified value is less than the existing field value.
231
- * $max: // Only updates the field if the specified value is greater than the existing field value.
232
- * $mul: // Multiplies the value of the field by the specified amount.
233
- * $rename: // Renames a field.
234
- * $unset: // Removes the specified field from a document. (set: "" to value)
235
- * //
236
- */
237
- updateOne(updateBy: F, update: U, issuer: string): Promise<void>;
238
- /**
239
- * #MONGOOSE FUNCTION
240
- * update one parameter by a specific
241
- *
242
- * @param filter This uses the basic Mongoose updateMany.
243
- * @example
244
- * // by email:
245
- * { email: email }
246
- * //
247
- * @example
248
- * // or by id that is in list:
249
- * { userIds: { $in: this.userId } }
250
- * //
251
- * @example
252
- * // or by number or Date that is Greater Than AND Less Than:
253
- * { points: { $gt: 2, $lt: 14 } }
254
- * // further tools (syntax matches with $gt):
255
- * $eq: // Matches values that are EQual to a specified value.
256
- * $gte: // Matches values that are Greater Than OR Equal to a specified value.
257
- * $lte: // Matches values that are Less Than or Equal to a specified value.
258
- * $ne: // Matches all values that are Not Equal to a specified value.
259
- * $nin: // Matches None of the values specified IN an array.
260
- * //
261
- *
262
- * @param update this uses the basic Mongoose updateOne
263
- * @example
264
- * // increase a specific value (here by 15):
265
- * { $inc: { popularity: 15 } }
266
- * //
267
- * @example
268
- * // or add element to a list:
269
- * { $push: { reactions: this.newReaction }
270
- * // or add multiple elements to a list
271
- * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
272
- * //
273
- * @example
274
- * // or all at once
275
- * {
276
- * $inc: { popularity: this.newVote.amount },
277
- * emailVerified: true,
278
- * $push: { reactions: this.newReaction }
279
- * }
280
- * // further tools (syntax matches with $inc):
281
- * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
282
- * $min: // Only updates the field if the specified value is less than the existing field value.
283
- * $max: // Only updates the field if the specified value is greater than the existing field value.
284
- * $mul: // Multiplies the value of the field by the specified amount.
285
- * $rename: // Renames a field.
286
- * $unset: // Removes the specified field from a document. (set: "" to value)
287
- * //
288
- */
289
- updateMany(updateBy: F, update: U, issuer: string): Promise<void>;
290
- /**
291
- * builds and returns mongoose schema
292
- * @returns schema
293
- */
294
- private getSchema;
295
- /**
296
- * builds mongoose schema building settings object by dynamoDataModelParamsList
297
- * @param params DynamoBEDataPropertyParams
298
- * @returns mongoose schema object
299
- */
300
- private buildMongooseSchemaByModelParams;
301
- private getBEType;
302
- /**
303
- * adds dynamo metadata settings to any mongoose schema building settings object
304
- * @param schema schema to update
305
- * @returns updated schema
306
- */
307
- private addDynamo_MetadataToSchema;
308
- /**
309
- * sets depDataKey
310
- */
311
- private lookForDependencyDataSettings;
312
- }
1
+ import * as mongoose from 'mongoose';
2
+ import { Dynamo_Metadata, Dynamo_DataParams } from '@futdevpro/fsm-dynamo';
3
+ /**
4
+ * @example
5
+ * // by email:
6
+ * { email: email }
7
+ * //
8
+ * @example
9
+ * // or by id that is in list:
10
+ * { userIds: { $in: this.userId } }
11
+ * //
12
+ * @example
13
+ * // or by number or Date that is Greater Than AND Less Than:
14
+ * { points: { $gt: 2, $lt: 14 } }
15
+ * // further tools (syntax matches with $gt):
16
+ * $eq: // Matches values that are EQual to a specified value.
17
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
18
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
19
+ * $ne: // Matches all values that are Not Equal to a specified value.
20
+ * $nin: // Matches None of the values specified IN an array.
21
+ * //
22
+ * @returns {T} data: T
23
+ */
24
+ export type DynamoNTS_DBFilter<T> = {
25
+ [K in keyof T]?: T[K] | {
26
+ $in?: any;
27
+ $eq?: T[K];
28
+ $gt?: number | Date;
29
+ $gte?: number | Date;
30
+ $lt?: number | Date;
31
+ $lte?: number | Date;
32
+ $ne?: T[K];
33
+ $nin?: T[K];
34
+ };
35
+ };
36
+ /**
37
+ * @param update this uses the basic Mongoose updateOne
38
+ * @example
39
+ * // increase a specific value (here by 15):
40
+ * { $inc: { popularity: 15 } }
41
+ * //
42
+ * @example
43
+ * // or add element to a list:
44
+ * { $push: { reactions: this.newReaction }
45
+ * // or add multiple elements to a list
46
+ * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
47
+ * //
48
+ * @example
49
+ * // or all at once
50
+ * {
51
+ * $inc: { popularity: this.newVote.amount },
52
+ * emailVerified: true,
53
+ * $push: { reactions: this.newReaction }
54
+ * }
55
+ * // further tools (syntax matches with $inc):
56
+ * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
57
+ * $min: // Only updates the field if the specified value is less than the existing field value.
58
+ * $max: // Only updates the field if the specified value is greater than the existing field value.
59
+ * $mul: // Multiplies the value of the field by the specified amount.
60
+ * $rename: // Renames a field.
61
+ * $unset: // Removes the specified field from a document. (set: "" to value)
62
+ * //
63
+ */
64
+ export type DynamoNTS_DBUpdate<T> = {
65
+ [K in keyof T]?: T[K] | {
66
+ $inc?: number;
67
+ $push?: any | {
68
+ $each?: T[K];
69
+ };
70
+ $min?: number;
71
+ $max?: number;
72
+ $mul?: number;
73
+ $rename?: string;
74
+ $unset?: string;
75
+ };
76
+ };
77
+ /**
78
+ *
79
+ */
80
+ export declare class DynamoNTS_DBService<T extends Dynamo_Metadata> {
81
+ dataParams: Dynamo_DataParams;
82
+ dataModel: mongoose.Model<mongoose.Document<any, any, any>, any, any>;
83
+ private depDataName;
84
+ defaultErrorUserMsg: string;
85
+ /**
86
+ * @param dataName name the model
87
+ * @param typeSample sample data for scheme creation (dont include Dynamo_Metadata!)
88
+ * @param schemaSettings additional settings for specific parameters as unique, required, minlength or maxlength
89
+ * schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
90
+ */
91
+ constructor(dataParams: Dynamo_DataParams);
92
+ /**
93
+ * save new data
94
+ * @param data data
95
+ * @returns data
96
+ */
97
+ createData(data: T, issuer: string): Promise<T>;
98
+ /**
99
+ * Find data by _id and update
100
+ * @param data data
101
+ * @returns data
102
+ */
103
+ modifyData(data: T, issuer: string): Promise<T>;
104
+ /**
105
+ * returns data by _id,
106
+ * @param id id
107
+ * @returns data
108
+ */
109
+ getDataById(id: string): Promise<T>;
110
+ /**
111
+ * get data by dependency data id,
112
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-GD2)
113
+ *
114
+ * @param dependencyId id
115
+ * @returns data
116
+ */
117
+ getDataByDependencyId(dependencyId: string): Promise<T>;
118
+ /**
119
+ * get data by dependency data id,
120
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-GLD2)
121
+ *
122
+ * @param dependencyId id
123
+ * @returns dataList
124
+ */
125
+ getDataListByDependencyId(dependencyId: string): Promise<T[]>;
126
+ /**
127
+ * get multiple data objects by a list of DependencyIDs,
128
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-GLDS2)
129
+ *
130
+ * @param ids ids
131
+ * @returns dataList
132
+ */
133
+ getDataListByDependencyIds(ids: string[]): Promise<T[]>;
134
+ /**
135
+ * returns all data from database,
136
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-GA1)
137
+ *
138
+ * @returns dataList
139
+ */
140
+ getAll(): Promise<T[]>;
141
+ /**
142
+ * deleted data by id
143
+ * @param id id
144
+ */
145
+ deleteDataById(id: string): Promise<void>;
146
+ /**
147
+ * deleted data by id
148
+ * @param dependencyId id
149
+ */
150
+ deleteDataByDependencyId(dependencyId: string): Promise<void>;
151
+ /**
152
+ * returns search result for searchBy object params
153
+ * can use lists or xRange values for searchBy obj properties
154
+ *
155
+ * @param filterBy filter
156
+ * @param narrowByDependencyIds id
157
+ * @returns dataList
158
+ */
159
+ searchData(filterBy: DynamoNTS_DBFilter<T>, narrowByDependencyIds?: string[]): Promise<T[]>;
160
+ /**
161
+ * Find the data first by any of its parameters,
162
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-FO1)
163
+ *
164
+ * @param filterBy if you can, use unique parameters for find!
165
+ *
166
+ * @example
167
+ * // by email:
168
+ * { email: email }
169
+ * //
170
+ * @example
171
+ * // or by id that is in list:
172
+ * { userIds: { $in: this.userId } }
173
+ * //
174
+ * @example
175
+ * // or by number or Date that is Greater Than AND Less Than:
176
+ * { points: { $gt: 2, $lt: 14 } }
177
+ * // further tools (syntax matches with $gt):
178
+ * $eq: // Matches values that are EQual to a specified value.
179
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
180
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
181
+ * $ne: // Matches all values that are Not Equal to a specified value.
182
+ * $nin: // Matches None of the values specified IN an array.
183
+ * //
184
+ * @returns {T} data: T
185
+ */
186
+ findOne(filterBy: DynamoNTS_DBFilter<T>): Promise<T>;
187
+ /**
188
+ * #MONGOOSE FUNCTION
189
+ * Find the data first by any of its parameters,
190
+ * !!!: throws error if not found (errorCode on not found: NTS-DBS-F1)
191
+ *
192
+ * @param filterBy if you can, use unique parameters for find!
193
+ *
194
+ * @example
195
+ * // by email:
196
+ * { email: email }
197
+ * //
198
+ * @example
199
+ * // or by id that is in list:
200
+ * { userIds: { $in: this.userId } }
201
+ * //
202
+ * @example
203
+ * // or by number or Date that is Greater Than AND Less Than:
204
+ * { points: { $gt: 2, $lt: 14 } }
205
+ * // further tools (syntax matches with $gt):
206
+ * $eq: // Matches values that are EQual to a specified value.
207
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
208
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
209
+ * $ne: // Matches all values that are Not Equal to a specified value.
210
+ * $nin: // Matches None of the values specified IN an array.
211
+ * //
212
+ * @returns {T[]} dataList: T[]
213
+ */
214
+ find(filterBy: DynamoNTS_DBFilter<T>): Promise<T[]>;
215
+ /**
216
+ * #MONGOOSE FUNCTION
217
+ * Find the data first by any of its parameters
218
+ *
219
+ * @param filterBy if you can, use unique parameters for find!
220
+ *
221
+ * @example
222
+ * // by email:
223
+ * { email: email }
224
+ * //
225
+ * @example
226
+ * // or by id that is in list:
227
+ * { userIds: { $in: this.userId } }
228
+ * //
229
+ * @example
230
+ * // or by number or Date that is Greater Than AND Less Than:
231
+ * { points: { $gt: 2, $lt: 14 } }
232
+ * // further tools (syntax matches with $gt):
233
+ * $eq: // Matches values that are EQual to a specified value.
234
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
235
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
236
+ * $ne: // Matches all values that are Not Equal to a specified value.
237
+ * $nin: // Matches None of the values specified IN an array.
238
+ * //
239
+ * @param page page
240
+ * @param pageSize pageSize
241
+ * @param sort
242
+ * @example
243
+ * // by dateTime (this uses the basic sort function):
244
+ * { dateTime: -1 }
245
+ * //
246
+ * @returns {T[]} dataList: T[]
247
+ */
248
+ findWithPaging(filterBy: DynamoNTS_DBFilter<T>, page: number, pageSize: number, sort?: any): Promise<T[]>;
249
+ /**
250
+ * #MONGOOSE FUNCTION
251
+ * Find data by _id and update
252
+ * !!!: throws error if not found (errorCode on not found: )
253
+ *
254
+ * @param id id
255
+ * @param update update
256
+ * @returns data
257
+ */
258
+ findByIdAndUpdate(id: string, update: DynamoNTS_DBUpdate<T>, modifier: string): Promise<T>;
259
+ /**
260
+ * #MONGOOSE FUNCTION
261
+ * Find the data first by any of its parameters
262
+ *
263
+ * @param filter This uses the basic Mongoose updateOne.
264
+ * If you can, use unique parameters for find!
265
+ * @example
266
+ * // by email:
267
+ * { email: email }
268
+ * //
269
+ * @example
270
+ * // or by id that is in list:
271
+ * { userIds: { $in: this.userId } }
272
+ * //
273
+ * @example
274
+ * // or by number or Date that is Greater Than AND Less Than:
275
+ * { points: { $gt: 2, $lt: 14 } }
276
+ * // further tools (syntax matches with $gt):
277
+ * $eq: // Matches values that are EQual to a specified value.
278
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
279
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
280
+ * $ne: // Matches all values that are Not Equal to a specified value.
281
+ * $nin: // Matches None of the values specified IN an array.
282
+ * //
283
+ *
284
+ * @param update this uses the basic Mongoose updateOne
285
+ * @example
286
+ * // increase a specific value (here by 15):
287
+ * { $inc: { popularity: 15 } }
288
+ * //
289
+ * @example
290
+ * // or add element to a list:
291
+ * { $push: { reactions: this.newReaction }
292
+ * // or add multiple elements to a list
293
+ * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
294
+ * //
295
+ * @example
296
+ * // or all at once
297
+ * {
298
+ * $inc: { popularity: this.newVote.amount },
299
+ * emailVerified: true,
300
+ * $push: { reactions: this.newReaction }
301
+ * }
302
+ * // further tools (syntax matches with $inc):
303
+ * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
304
+ * $min: // Only updates the field if the specified value is less than the existing field value.
305
+ * $max: // Only updates the field if the specified value is greater than the existing field value.
306
+ * $mul: // Multiplies the value of the field by the specified amount.
307
+ * $rename: // Renames a field.
308
+ * $unset: // Removes the specified field from a document. (set: "" to value)
309
+ * //
310
+ */
311
+ updateOne(filterBy: DynamoNTS_DBFilter<T>, update: DynamoNTS_DBUpdate<T>, issuer: string): Promise<void>;
312
+ /**
313
+ * #MONGOOSE FUNCTION
314
+ * update one parameter by a specific
315
+ *
316
+ * @param filter This uses the basic Mongoose updateMany.
317
+ * @example
318
+ * // by email:
319
+ * { email: email }
320
+ * //
321
+ * @example
322
+ * // or by id that is in list:
323
+ * { userIds: { $in: this.userId } }
324
+ * //
325
+ * @example
326
+ * // or by number or Date that is Greater Than AND Less Than:
327
+ * { points: { $gt: 2, $lt: 14 } }
328
+ * // further tools (syntax matches with $gt):
329
+ * $eq: // Matches values that are EQual to a specified value.
330
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
331
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
332
+ * $ne: // Matches all values that are Not Equal to a specified value.
333
+ * $nin: // Matches None of the values specified IN an array.
334
+ * //
335
+ *
336
+ * @param update this uses the basic Mongoose updateOne
337
+ * @example
338
+ * // increase a specific value (here by 15):
339
+ * { $inc: { popularity: 15 } }
340
+ * //
341
+ * @example
342
+ * // or add element to a list:
343
+ * { $push: { reactions: this.newReaction }
344
+ * // or add multiple elements to a list
345
+ * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
346
+ * //
347
+ * @example
348
+ * // or all at once
349
+ * {
350
+ * $inc: { popularity: this.newVote.amount },
351
+ * emailVerified: true,
352
+ * $push: { reactions: this.newReaction }
353
+ * }
354
+ * // further tools (syntax matches with $inc):
355
+ * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
356
+ * $min: // Only updates the field if the specified value is less than the existing field value.
357
+ * $max: // Only updates the field if the specified value is greater than the existing field value.
358
+ * $mul: // Multiplies the value of the field by the specified amount.
359
+ * $rename: // Renames a field.
360
+ * $unset: // Removes the specified field from a document. (set: "" to value)
361
+ * //
362
+ */
363
+ updateMany(filterBy: DynamoNTS_DBFilter<T>, update: DynamoNTS_DBUpdate<T>, issuer: string): Promise<void>;
364
+ /**
365
+ * builds and returns mongoose schema
366
+ * @returns schema
367
+ */
368
+ private getSchema;
369
+ /**
370
+ * builds mongoose schema building settings object by dynamoDataModelParamsList
371
+ * @param params DynamoBEDataPropertyParams
372
+ * @returns mongoose schema object
373
+ */
374
+ private buildMongooseSchemaByModelParams;
375
+ private getBEType;
376
+ /**
377
+ * adds dynamo metadata settings to any mongoose schema building settings object
378
+ * @param schema schema to update
379
+ * @returns updated schema
380
+ */
381
+ private addDynamo_MetadataToSchema;
382
+ /**
383
+ * sets depDataKey
384
+ */
385
+ private lookForDependencyDataSettings;
386
+ }
313
387
  //# sourceMappingURL=dynamo-nts-db.service.d.ts.map