@rapidrest/service-core 1.0.0-rc.2 → 1.0.0-rc.21

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 (250) hide show
  1. package/dist/lib/BackgroundService.js +0 -4
  2. package/dist/lib/BackgroundService.js.map +1 -1
  3. package/dist/lib/BackgroundServiceManager.js +21 -4
  4. package/dist/lib/BackgroundServiceManager.js.map +1 -1
  5. package/dist/lib/EventListenerManager.js.map +1 -1
  6. package/dist/lib/OpenApiSpec.js +3 -2
  7. package/dist/lib/OpenApiSpec.js.map +1 -1
  8. package/dist/lib/Server.js +18 -79
  9. package/dist/lib/Server.js.map +1 -1
  10. package/dist/lib/database/TypeOrmSupport.js +18 -2
  11. package/dist/lib/database/TypeOrmSupport.js.map +1 -1
  12. package/dist/lib/decorators/DocDecorators.js +19 -1
  13. package/dist/lib/decorators/DocDecorators.js.map +1 -1
  14. package/dist/lib/decorators/PersistenceDecorators.js.map +1 -1
  15. package/dist/lib/decorators/RouteDecorators.js +71 -20
  16. package/dist/lib/decorators/RouteDecorators.js.map +1 -1
  17. package/dist/lib/http/Adapters.js +45 -2
  18. package/dist/lib/http/Adapters.js.map +1 -1
  19. package/dist/lib/http/Router.js +53 -56
  20. package/dist/lib/http/Router.js.map +1 -1
  21. package/dist/lib/models/ModelUtils.js +18 -8
  22. package/dist/lib/models/ModelUtils.js.map +1 -1
  23. package/dist/lib/models/RepoUtils.js +96 -31
  24. package/dist/lib/models/RepoUtils.js.map +1 -1
  25. package/dist/lib/routes/{AdminRoute.js → BaseAdminRoute.js} +51 -36
  26. package/dist/lib/routes/BaseAdminRoute.js.map +1 -0
  27. package/dist/lib/routes/{MetricsRoute.js → BaseMetricsRoute.js} +28 -15
  28. package/dist/lib/routes/BaseMetricsRoute.js.map +1 -0
  29. package/dist/lib/routes/{OpenAPIRoute.js → BaseOpenAPIRoute.js} +31 -32
  30. package/dist/lib/routes/BaseOpenAPIRoute.js.map +1 -0
  31. package/dist/lib/routes/BasePushRoute.js +193 -0
  32. package/dist/lib/routes/BasePushRoute.js.map +1 -0
  33. package/dist/lib/routes/BaseStaticRoute.js +152 -0
  34. package/dist/lib/routes/BaseStaticRoute.js.map +1 -0
  35. package/dist/lib/routes/BaseStatusRoute.js +79 -0
  36. package/dist/lib/routes/BaseStatusRoute.js.map +1 -0
  37. package/dist/lib/routes/CRUDRoute.js +238 -0
  38. package/dist/lib/routes/CRUDRoute.js.map +1 -0
  39. package/dist/lib/routes/ModelRoute.js +20 -28
  40. package/dist/lib/routes/ModelRoute.js.map +1 -1
  41. package/dist/lib/routes/index.js +7 -4
  42. package/dist/lib/routes/index.js.map +1 -1
  43. package/dist/lib/security/ACLUtils.js +10 -13
  44. package/dist/lib/security/ACLUtils.js.map +1 -1
  45. package/dist/lib/security/AccessControlListMongo.js +5 -1
  46. package/dist/lib/security/AccessControlListMongo.js.map +1 -1
  47. package/dist/lib/security/AccessControlListSQL.js +7 -3
  48. package/dist/lib/security/AccessControlListSQL.js.map +1 -1
  49. package/dist/lib/security/BaseACLRoute.js +239 -0
  50. package/dist/lib/security/BaseACLRoute.js.map +1 -0
  51. package/dist/lib/security/index.js +3 -0
  52. package/dist/lib/security/index.js.map +1 -1
  53. package/dist/lib/test/request.js +6 -2
  54. package/dist/lib/test/request.js.map +1 -1
  55. package/dist/types/BackgroundService.d.ts +0 -5
  56. package/dist/types/BackgroundServiceManager.d.ts +1 -1
  57. package/dist/types/EventListenerManager.d.ts +4 -4
  58. package/dist/types/Server.d.ts +21 -6
  59. package/dist/types/decorators/DocDecorators.d.ts +9 -0
  60. package/dist/types/decorators/PersistenceDecorators.d.ts +7 -0
  61. package/dist/types/decorators/RouteDecorators.d.ts +14 -5
  62. package/dist/types/http/Adapters.d.ts +19 -0
  63. package/dist/types/http/Router.d.ts +6 -6
  64. package/dist/types/models/ModelUtils.d.ts +2 -1
  65. package/dist/types/routes/BaseAdminRoute.d.ts +59 -0
  66. package/dist/types/routes/BaseMetricsRoute.d.ts +37 -0
  67. package/dist/types/routes/BaseOpenAPIRoute.d.ts +33 -0
  68. package/dist/types/routes/BasePushRoute.d.ts +39 -0
  69. package/dist/types/routes/BaseStaticRoute.d.ts +44 -0
  70. package/dist/types/routes/BaseStatusRoute.d.ts +37 -0
  71. package/dist/types/routes/CRUDRoute.d.ts +47 -0
  72. package/dist/types/routes/ModelRoute.d.ts +23 -16
  73. package/dist/types/routes/index.d.ts +7 -4
  74. package/dist/types/security/ACLUtils.d.ts +1 -1
  75. package/dist/types/security/AccessControlList.d.ts +1 -1
  76. package/dist/types/security/AccessControlListMongo.d.ts +1 -1
  77. package/dist/types/security/AccessControlListSQL.d.ts +1 -1
  78. package/dist/types/security/BaseACLRoute.d.ts +73 -0
  79. package/dist/types/security/index.d.ts +3 -0
  80. package/package.json +132 -129
  81. package/tsconfig.export.json +17 -0
  82. package/dist/lib/routes/AdminRoute.js.map +0 -1
  83. package/dist/lib/routes/MetricsRoute.js.map +0 -1
  84. package/dist/lib/routes/OpenAPIRoute.js.map +0 -1
  85. package/dist/lib/routes/StatusRoute.js +0 -55
  86. package/dist/lib/routes/StatusRoute.js.map +0 -1
  87. package/dist/lib/security/ACLRouteMongo.js +0 -194
  88. package/dist/lib/security/ACLRouteMongo.js.map +0 -1
  89. package/dist/lib/security/ACLRouteSQL.js +0 -193
  90. package/dist/lib/security/ACLRouteSQL.js.map +0 -1
  91. package/dist/types/routes/AdminRoute.d.ts +0 -47
  92. package/dist/types/routes/MetricsRoute.d.ts +0 -15
  93. package/dist/types/routes/OpenAPIRoute.d.ts +0 -17
  94. package/dist/types/routes/StatusRoute.d.ts +0 -11
  95. package/dist/types/security/ACLRouteMongo.d.ts +0 -19
  96. package/dist/types/security/ACLRouteSQL.d.ts +0 -19
  97. package/docs/Makefile +0 -20
  98. package/docs/conf.py +0 -58
  99. package/docs/index.rst +0 -17
  100. package/docs/make.bat +0 -35
  101. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +0 -13
  102. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +0 -25
  103. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +0 -25
  104. package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +0 -25
  105. package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +0 -23
  106. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +0 -25
  107. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +0 -25
  108. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +0 -25
  109. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +0 -25
  110. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +0 -25
  111. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +0 -28
  112. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +0 -25
  113. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +0 -25
  114. package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +0 -28
  115. package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +0 -57
  116. package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +0 -12
  117. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +0 -17
  118. package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +0 -26
  119. package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +0 -26
  120. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +0 -25
  121. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +0 -18
  122. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +0 -25
  123. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +0 -27
  124. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +0 -35
  125. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +0 -25
  126. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +0 -27
  127. package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +0 -26
  128. package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +0 -45
  129. package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +0 -14
  130. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +0 -27
  131. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +0 -25
  132. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +0 -25
  133. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +0 -119
  134. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +0 -25
  135. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +0 -68
  136. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +0 -26
  137. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +0 -26
  138. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +0 -27
  139. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/CollationOptions.md +0 -79
  140. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +0 -41
  141. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +0 -51
  142. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/EntityOptions.md +0 -32
  143. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +0 -41
  144. package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +0 -61
  145. package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +0 -36
  146. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +0 -26
  147. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +0 -33
  148. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +0 -31
  149. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +0 -25
  150. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +0 -25
  151. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +0 -25
  152. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +0 -25
  153. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +0 -25
  154. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +0 -25
  155. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +0 -31
  156. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +0 -25
  157. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +0 -25
  158. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +0 -26
  159. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +0 -25
  160. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +0 -25
  161. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +0 -31
  162. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +0 -25
  163. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +0 -26
  164. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +0 -31
  165. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +0 -26
  166. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +0 -31
  167. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +0 -25
  168. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +0 -33
  169. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +0 -31
  170. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +0 -25
  171. package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +0 -25
  172. package/docs/reference/README.md +0 -20
  173. package/docs/reference/classes/ACLUtils.md +0 -263
  174. package/docs/reference/classes/AdminRoute.md +0 -51
  175. package/docs/reference/classes/AuthMiddleware.md +0 -173
  176. package/docs/reference/classes/BackgroundService.md +0 -117
  177. package/docs/reference/classes/BackgroundServiceManager.md +0 -172
  178. package/docs/reference/classes/BaseEntity.md +0 -82
  179. package/docs/reference/classes/BaseMongoEntity.md +0 -107
  180. package/docs/reference/classes/BasicStrategy.md +0 -131
  181. package/docs/reference/classes/BasicStrategyOptions.md +0 -115
  182. package/docs/reference/classes/BulkError.md +0 -271
  183. package/docs/reference/classes/ConnectionManager.md +0 -75
  184. package/docs/reference/classes/EventListenerManager.md +0 -88
  185. package/docs/reference/classes/HttpRouter.md +0 -343
  186. package/docs/reference/classes/JWTStrategy.md +0 -100
  187. package/docs/reference/classes/JWTStrategyOptions.md +0 -97
  188. package/docs/reference/classes/MetricsRoute.md +0 -27
  189. package/docs/reference/classes/ModelRoute.md +0 -527
  190. package/docs/reference/classes/ModelUtils.md +0 -430
  191. package/docs/reference/classes/MongoConnection.md +0 -218
  192. package/docs/reference/classes/MongoRepository.md +0 -390
  193. package/docs/reference/classes/MongoSchemaSync.md +0 -97
  194. package/docs/reference/classes/NetUtils.md +0 -90
  195. package/docs/reference/classes/NotificationUtils.md +0 -77
  196. package/docs/reference/classes/ObjectFactory.md +0 -336
  197. package/docs/reference/classes/OpenAPIRoute.md +0 -77
  198. package/docs/reference/classes/OpenApiSpec.md +0 -892
  199. package/docs/reference/classes/RecoverableBaseEntity.md +0 -114
  200. package/docs/reference/classes/RecoverableBaseMongoEntity.md +0 -124
  201. package/docs/reference/classes/RedisTransport.md +0 -2202
  202. package/docs/reference/classes/RepoUtils.md +0 -482
  203. package/docs/reference/classes/RouteUtils.md +0 -191
  204. package/docs/reference/classes/Server.md +0 -408
  205. package/docs/reference/classes/SimpleEntity.md +0 -48
  206. package/docs/reference/classes/SimpleMongoEntity.md +0 -66
  207. package/docs/reference/classes/StatusExtraData.md +0 -57
  208. package/docs/reference/classes/StatusRoute.md +0 -26
  209. package/docs/reference/classes/UWSRequest.md +0 -226
  210. package/docs/reference/classes/UWSResponse.md +0 -257
  211. package/docs/reference/classes/UWSWebSocketShim.md +0 -958
  212. package/docs/reference/enumerations/ACLAction.md +0 -63
  213. package/docs/reference/enumerations/ApiErrorMessages.md +0 -123
  214. package/docs/reference/enumerations/ApiErrors.md +0 -123
  215. package/docs/reference/functions/createWebSocketStream.md +0 -27
  216. package/docs/reference/functions/isSqlDataSource.md +0 -26
  217. package/docs/reference/functions/readBody.md +0 -29
  218. package/docs/reference/functions/resolveCollectionName.md +0 -33
  219. package/docs/reference/functions/runChain.md +0 -40
  220. package/docs/reference/functions/snakeCase.md +0 -28
  221. package/docs/reference/globals.md +0 -106
  222. package/docs/reference/interfaces/ACLRecord.md +0 -96
  223. package/docs/reference/interfaces/AccessControlList.md +0 -76
  224. package/docs/reference/interfaces/AuthResult.md +0 -55
  225. package/docs/reference/interfaces/AuthStrategy.md +0 -95
  226. package/docs/reference/interfaces/CreateRequestOptions.md +0 -121
  227. package/docs/reference/interfaces/DeleteRequestOptions.md +0 -137
  228. package/docs/reference/interfaces/FindRequestOptions.md +0 -133
  229. package/docs/reference/interfaces/HttpRequest.md +0 -147
  230. package/docs/reference/interfaces/HttpResponse.md +0 -164
  231. package/docs/reference/interfaces/JWTAuthResult.md +0 -84
  232. package/docs/reference/interfaces/RepoCreateOptions.md +0 -95
  233. package/docs/reference/interfaces/RepoDeleteOptions.md +0 -105
  234. package/docs/reference/interfaces/RepoFindOptions.md +0 -125
  235. package/docs/reference/interfaces/RepoOperationOptions.md +0 -69
  236. package/docs/reference/interfaces/RepoUpdateOptions.md +0 -101
  237. package/docs/reference/interfaces/RequestOptions.md +0 -112
  238. package/docs/reference/interfaces/RequestWS.md +0 -225
  239. package/docs/reference/interfaces/TruncateRequestOptions.md +0 -161
  240. package/docs/reference/interfaces/UpdateRequestOptions.md +0 -139
  241. package/docs/reference/type-aliases/ErrorHandler.md +0 -35
  242. package/docs/reference/type-aliases/NextFunction.md +0 -23
  243. package/docs/reference/type-aliases/OneOrMany.md +0 -19
  244. package/docs/reference/type-aliases/OneOrNull.md +0 -19
  245. package/docs/reference/type-aliases/PartialBaseEntity.md +0 -17
  246. package/docs/reference/type-aliases/PartialSimpleEntity.md +0 -17
  247. package/docs/reference/type-aliases/RequestHandler.md +0 -31
  248. package/docs/reference/type-aliases/UpdateObject.md +0 -19
  249. package/docs/reference/type-aliases/WsUpgradeAuth.md +0 -27
  250. package/docs/reference/type-aliases/WsUpgradeAuthResult.md +0 -47
@@ -1,430 +0,0 @@
1
- [**@rapidrest/service-core**](../README.md)
2
-
3
- ***
4
-
5
- [@rapidrest/service-core](../globals.md) / ModelUtils
6
-
7
- # Class: ModelUtils
8
-
9
- Defined in: [src/models/ModelUtils.ts:24](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L24)
10
-
11
- Utility class for working with data model classes.
12
-
13
- ## Author
14
-
15
- Jean-Philippe Steinmetz
16
-
17
- ## Constructors
18
-
19
- ### Constructor
20
-
21
- > **new ModelUtils**(): `ModelUtils`
22
-
23
- #### Returns
24
-
25
- `ModelUtils`
26
-
27
- ## Methods
28
-
29
- ### buildIdSearchQuery()
30
-
31
- > `static` **buildIdSearchQuery**\<`T`\>(`repo`, `modelClass`, `id`, `version?`): `any`
32
-
33
- Defined in: [src/models/ModelUtils.ts:87](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L87)
34
-
35
- Builds a query object for use with `find` functions of the given repository for retrieving objects matching the
36
- specified unique identifier.
37
-
38
- #### Type Parameters
39
-
40
- ##### T
41
-
42
- `T` *extends* `object`
43
-
44
- #### Parameters
45
-
46
- ##### repo
47
-
48
- `Repository`\<`T`\> \| [`MongoRepository`](MongoRepository.md)\<`T`\> \| `undefined`
49
-
50
- The repository to build the query for.
51
-
52
- ##### modelClass
53
-
54
- `any`
55
-
56
- The class definition of the data model to build a search query for.
57
-
58
- ##### id
59
-
60
- `any`
61
-
62
- The unique identifier to search for.
63
-
64
- ##### version?
65
-
66
- `number`
67
-
68
- The version number of the document to search for.
69
-
70
- #### Returns
71
-
72
- `any`
73
-
74
- An object that can be passed to a TypeORM `find` function.
75
-
76
- ***
77
-
78
- ### buildIdSearchQueryMongo()
79
-
80
- > `static` **buildIdSearchQueryMongo**(`modelClass`, `id`, `version?`): `any`
81
-
82
- Defined in: [src/models/ModelUtils.ts:135](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L135)
83
-
84
- Builds a MongoDB compatible query object for use in `find` functions for retrieving objects matching the
85
- specified unique identifier.
86
-
87
- #### Parameters
88
-
89
- ##### modelClass
90
-
91
- `any`
92
-
93
- The class definition of the data model to build a search query for.
94
-
95
- ##### id
96
-
97
- `any`
98
-
99
- The unique identifier to search for.
100
-
101
- ##### version?
102
-
103
- `number`
104
-
105
- The version number of the document to search for.
106
-
107
- #### Returns
108
-
109
- `any`
110
-
111
- An object that can be passed to a MongoDB `find` function.
112
-
113
- ***
114
-
115
- ### buildIdSearchQuerySQL()
116
-
117
- > `static` **buildIdSearchQuerySQL**(`modelClass`, `id`, `version?`): `any`
118
-
119
- Defined in: [src/models/ModelUtils.ts:109](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L109)
120
-
121
- Builds a TypeORM compatible query object for use in `find` functions for retrieving objects matching the
122
- specified unique identifier.
123
-
124
- #### Parameters
125
-
126
- ##### modelClass
127
-
128
- `any`
129
-
130
- The class definition of the data model to build a search query for.
131
-
132
- ##### id
133
-
134
- `any`
135
-
136
- The unique identifier to search for.
137
-
138
- ##### version?
139
-
140
- `number`
141
-
142
- The version number of the document to search for.
143
-
144
- #### Returns
145
-
146
- `any`
147
-
148
- An object that can be passed to a TypeORM `find` function.
149
-
150
- ***
151
-
152
- ### buildSearchQuery()
153
-
154
- > `static` **buildSearchQuery**\<`T`\>(`modelClass`, `repo`, `params?`, `queryParams?`, `exactMatch?`, `user?`): `any`
155
-
156
- Defined in: [src/models/ModelUtils.ts:362](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L362)
157
-
158
- Builds a query object for the given criteria and repository. Query params can have a value containing a
159
- conditional operator to apply for the search. The operator is encoded with the format `op(value)`. The following
160
- operators are supported:
161
- * `eq` - Returns matches whose parameter exactly matches of the given value. e.g. `param = value`
162
- * `gt` - Returns matches whose parameter is greater than the given value. e.g. `param > value`
163
- * `gte` - Returns matches whose parameter is greater than or equal to the given value. e.g. `param >= value`
164
- * `in` - Returns matches whose parameter includes one of the given values. e.g. `param in ('value1', 'value2', 'value3', ...)`
165
- * `like` - Returns matches whose parameter is lexographically similar to the given value. `param like value`
166
- * `lt` - Returns matches whose parameter is less than the given value. e.g. `param < value`
167
- * `lte` - Returns matches whose parameter is less than or equal to than the given value. e.g. `param < value`
168
- * `not` - Returns matches whose parameter is not equal to the given value. e.g. `param not value`
169
- * `range` - Returns matches whose parameter is greater than or equal to first given value and less than or equal to the second. e.g. `param between(1,100)`
170
-
171
- When no operator is provided the comparison will always be evaluated as `eq`.
172
-
173
- NOTE: The result of this function is only compatible with the `aggregate()` function when MongoDB is used.
174
-
175
- #### Type Parameters
176
-
177
- ##### T
178
-
179
- `T` *extends* `object`
180
-
181
- #### Parameters
182
-
183
- ##### modelClass
184
-
185
- `any`
186
-
187
- The class definition of the data model to build a search query for.
188
-
189
- ##### repo
190
-
191
- `Repository`\<`T`\> \| [`MongoRepository`](MongoRepository.md)\<`T`\> \| `undefined`
192
-
193
- The repository to build a search query for.
194
-
195
- ##### params?
196
-
197
- `any`
198
-
199
- The URI parameters for the endpoint that was requested.
200
-
201
- ##### queryParams?
202
-
203
- `any`
204
-
205
- The URI query parameters that were included in the request.
206
-
207
- ##### exactMatch?
208
-
209
- `boolean` = `false`
210
-
211
- Set to true to create a query where parameters are to be matched exactly, otherwise set to false to use a 'contains' search.
212
-
213
- ##### user?
214
-
215
- `any`
216
-
217
- The user that is performing the request.
218
-
219
- #### Returns
220
-
221
- `any`
222
-
223
- The TypeORM compatible query object.
224
-
225
- ***
226
-
227
- ### buildSearchQueryMongo()
228
-
229
- > `static` **buildSearchQueryMongo**(`modelClass`, `params?`, `queryParams?`, `exactMatch?`, `user?`): `any`
230
-
231
- Defined in: [src/models/ModelUtils.ts:552](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L552)
232
-
233
- Builds a MongoDB compatible query object for the given criteria. Query params can have a value containing a
234
- conditional operator to apply for the search. The operator is encoded with the format `op(value)`. The following
235
- operators are supported:
236
- * `eq` - Returns matches whose parameter exactly matches of the given value. e.g. `param = value`
237
- * `gt` - Returns matches whose parameter is greater than the given value. e.g. `param > value`
238
- * `gte` - Returns matches whose parameter is greater than or equal to the given value. e.g. `param >= value`
239
- * `in` - Returns matches whose parameter includes one of the given values. e.g. `param in ('value1', 'value2', 'value3', ...)`
240
- * `like` - Returns matches whose parameter is lexographically similar to the given value. `param like value`
241
- * `lt` - Returns matches whose parameter is less than the given value. e.g. `param < value`
242
- * `lte` - Returns matches whose parameter is less than or equal to than the given value. e.g. `param < value`
243
- * `not` - Returns matches whose parameter is not equal to the given value. e.g. `param not value`
244
- * `range` - Returns matches whose parameter is greater than or equal to first given value and less than or equal to the second. e.g. `param between(1,100)`
245
-
246
- When no operator is provided the comparison will always be evaluated as `eq`.
247
-
248
- NOTE: The result of this function is only compatible with the `aggregate()` function.
249
-
250
- #### Parameters
251
-
252
- ##### modelClass
253
-
254
- `any`
255
-
256
- The class definition of the data model to build a search query for.
257
-
258
- ##### params?
259
-
260
- `any`
261
-
262
- The URI parameters for the endpoint that was requested.
263
-
264
- ##### queryParams?
265
-
266
- `any`
267
-
268
- The URI query parameters that were included in the request.
269
-
270
- ##### exactMatch?
271
-
272
- `boolean` = `false`
273
-
274
- Set to true to create a query where parameters are to be matched exactly, otherwise set to false to use a 'contains' search.
275
-
276
- ##### user?
277
-
278
- `any`
279
-
280
- The user that is performing the request.
281
-
282
- #### Returns
283
-
284
- `any`
285
-
286
- The TypeORM compatible query object.
287
-
288
- ***
289
-
290
- ### buildSearchQuerySQL()
291
-
292
- > `static` **buildSearchQuerySQL**(`modelClass`, `params?`, `queryParams?`, `exactMatch?`, `user?`): `any`
293
-
294
- Defined in: [src/models/ModelUtils.ts:408](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L408)
295
-
296
- Builds a TypeORM compatible query object for the given criteria. Query params can have a value containing a
297
- conditional operator to apply for the search. The operator is encoded with the format `op(value)`. The following
298
- operators are supported:
299
- * `eq` - Returns matches whose parameter exactly matches of the given value. e.g. `param = value`
300
- * `gt` - Returns matches whose parameter is greater than the given value. e.g. `param > value`
301
- * `gte` - Returns matches whose parameter is greater than or equal to the given value. e.g. `param >= value`
302
- * `in` - Returns matches whose parameter includes one of the given values. e.g. `param in ('value1', 'value2', 'value3', ...)`
303
- * `like` - Returns matches whose parameter is lexographically similar to the given value. `param like value`
304
- * `lt` - Returns matches whose parameter is less than the given value. e.g. `param < value`
305
- * `lte` - Returns matches whose parameter is less than or equal to than the given value. e.g. `param < value`
306
- * `not` - Returns matches whose parameter is not equal to the given value. e.g. `param not value`
307
- * `range` - Returns matches whose parameter is greater than or equal to first given value and less than or equal to the second. e.g. `param between(1,100)`
308
-
309
- When no operator is provided the comparison will always be evaluated as `eq`.
310
-
311
- #### Parameters
312
-
313
- ##### modelClass
314
-
315
- `any`
316
-
317
- The class definition of the data model to build a search query for.
318
-
319
- ##### params?
320
-
321
- `any`
322
-
323
- The URI parameters for the endpoint that was requested.
324
-
325
- ##### queryParams?
326
-
327
- `any`
328
-
329
- The URI query parameters that were included in the request.
330
-
331
- ##### exactMatch?
332
-
333
- `boolean` = `false`
334
-
335
- Set to true to create a query where parameters are to be matched exactly, otherwise set to false to use a 'contains' search.
336
-
337
- ##### user?
338
-
339
- `any`
340
-
341
- The user that is performing the request.
342
-
343
- #### Returns
344
-
345
- `any`
346
-
347
- The TypeORM compatible query object.
348
-
349
- ***
350
-
351
- ### getIdPropertyNames()
352
-
353
- > `static` **getIdPropertyNames**(`modelClass`): `string`[]
354
-
355
- Defined in: [src/models/ModelUtils.ts:56](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L56)
356
-
357
- Retrieves a list of all of the specified class's properties that have the
358
-
359
- #### Parameters
360
-
361
- ##### modelClass
362
-
363
- `any`
364
-
365
- The class definition to search for identifiers from.
366
-
367
- #### Returns
368
-
369
- `string`[]
370
-
371
- The list of all property names that have the
372
-
373
- #### Identifier
374
-
375
- decorator applied.
376
-
377
- #### Identifier
378
-
379
- decorator applied.
380
-
381
- ***
382
-
383
- ### loadModels()
384
-
385
- > `static` **loadModels**(`src`, `result?`): `Promise`\<`Map`\<`string`, `any`\>\>
386
-
387
- Defined in: [src/models/ModelUtils.ts:704](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L704)
388
-
389
- Loads all model schema files from the specified path and returns a map containing all the definitions.
390
-
391
- #### Parameters
392
-
393
- ##### src
394
-
395
- `string`
396
-
397
- The path to the model files to load.
398
-
399
- ##### result?
400
-
401
- `Map`\<`string`, `any`\> = `...`
402
-
403
- #### Returns
404
-
405
- `Promise`\<`Map`\<`string`, `any`\>\>
406
-
407
- A map containing of all loaded model names to their class definitions.
408
-
409
- ***
410
-
411
- ### setTypeOrm()
412
-
413
- > `static` **setTypeOrm**(`module`): `void`
414
-
415
- Defined in: [src/models/ModelUtils.ts:34](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/models/ModelUtils.ts#L34)
416
-
417
- Provides the `typeorm` module to use when building SQL queries. This is called automatically when a SQL
418
- datastore connection is established.
419
-
420
- #### Parameters
421
-
422
- ##### module
423
-
424
- `any`
425
-
426
- The `typeorm` module.
427
-
428
- #### Returns
429
-
430
- `void`
@@ -1,218 +0,0 @@
1
- [**@rapidrest/service-core**](../README.md)
2
-
3
- ***
4
-
5
- [@rapidrest/service-core](../globals.md) / MongoConnection
6
-
7
- # Class: MongoConnection
8
-
9
- Defined in: [src/database/MongoConnection.ts:17](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L17)
10
-
11
- Represents a single named connection to a MongoDB database using the native `mongodb` driver, including the
12
- registry of all model classes assigned to the connection's datastore.
13
-
14
- Note that this class only references the `mongodb` package via type-only imports and is therefore safe to load
15
- when the optional `mongodb` peer dependency is not installed.
16
-
17
- ## Author
18
-
19
- Jean-Philippe Steinmetz <rapidrests@gmail.com>
20
-
21
- ## Constructors
22
-
23
- ### Constructor
24
-
25
- > **new MongoConnection**(`name`, `client`, `db`, `entities?`): `MongoConnection`
26
-
27
- Defined in: [src/database/MongoConnection.ts:29](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L29)
28
-
29
- #### Parameters
30
-
31
- ##### name
32
-
33
- `string`
34
-
35
- ##### client
36
-
37
- `MongoClient`
38
-
39
- ##### db
40
-
41
- `Db`
42
-
43
- ##### entities?
44
-
45
- `Iterable`\<`any`, `any`, `any`\>
46
-
47
- #### Returns
48
-
49
- `MongoConnection`
50
-
51
- ## Properties
52
-
53
- ### client
54
-
55
- > `readonly` **client**: `MongoClient`
56
-
57
- Defined in: [src/database/MongoConnection.ts:19](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L19)
58
-
59
- The underlying MongoDB client.
60
-
61
- ***
62
-
63
- ### db
64
-
65
- > `readonly` **db**: `Db`
66
-
67
- Defined in: [src/database/MongoConnection.ts:21](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L21)
68
-
69
- The database that this connection is bound to.
70
-
71
- ***
72
-
73
- ### name
74
-
75
- > `readonly` **name**: `string`
76
-
77
- Defined in: [src/database/MongoConnection.ts:23](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L23)
78
-
79
- The name of the datastore that this connection was created for.
80
-
81
- ## Accessors
82
-
83
- ### entityClasses
84
-
85
- #### Get Signature
86
-
87
- > **get** **entityClasses**(): `any`[]
88
-
89
- Defined in: [src/database/MongoConnection.ts:71](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L71)
90
-
91
- Returns the list of all model classes registered with this connection.
92
-
93
- ##### Returns
94
-
95
- `any`[]
96
-
97
- ***
98
-
99
- ### isConnected
100
-
101
- #### Get Signature
102
-
103
- > **get** **isConnected**(): `boolean`
104
-
105
- Defined in: [src/database/MongoConnection.ts:42](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L42)
106
-
107
- Indicates whether or not the connection is currently active.
108
-
109
- ##### Returns
110
-
111
- `boolean`
112
-
113
- ## Methods
114
-
115
- ### admin()
116
-
117
- > **admin**(): `Admin`
118
-
119
- Defined in: [src/database/MongoConnection.ts:47](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L47)
120
-
121
- Returns the admin interface of the underlying database.
122
-
123
- #### Returns
124
-
125
- `Admin`
126
-
127
- ***
128
-
129
- ### close()
130
-
131
- > **close**(): `Promise`\<`void`\>
132
-
133
- Defined in: [src/database/MongoConnection.ts:54](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L54)
134
-
135
- Closes the connection to the database server.
136
-
137
- #### Returns
138
-
139
- `Promise`\<`void`\>
140
-
141
- ***
142
-
143
- ### collectionNameFor()
144
-
145
- > **collectionNameFor**(`clazz`): `string`
146
-
147
- Defined in: [src/database/MongoConnection.ts:64](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L64)
148
-
149
- Returns the name of the collection that records of the given model class are stored in.
150
-
151
- #### Parameters
152
-
153
- ##### clazz
154
-
155
- `any`
156
-
157
- The model class to resolve the collection name for.
158
-
159
- #### Returns
160
-
161
- `string`
162
-
163
- ***
164
-
165
- ### getMongoRepository()
166
-
167
- > **getMongoRepository**\<`T`\>(`classOrName`): [`MongoRepository`](MongoRepository.md)\<`T`\>
168
-
169
- Defined in: [src/database/MongoConnection.ts:105](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L105)
170
-
171
- Returns a repository for performing operations against the collection associated with the given model class.
172
- This is an alias of `getRepository` provided for compatibility with TypeORM's `DataSource` interface.
173
-
174
- #### Type Parameters
175
-
176
- ##### T
177
-
178
- `T` *extends* `object` = `any`
179
-
180
- #### Parameters
181
-
182
- ##### classOrName
183
-
184
- `any`
185
-
186
- The model class, or the name of a registered model class, to retrieve a repository for.
187
-
188
- #### Returns
189
-
190
- [`MongoRepository`](MongoRepository.md)\<`T`\>
191
-
192
- ***
193
-
194
- ### getRepository()
195
-
196
- > **getRepository**\<`T`\>(`classOrName`): [`MongoRepository`](MongoRepository.md)\<`T`\>
197
-
198
- Defined in: [src/database/MongoConnection.ts:80](https://github.com/rapidrest/service-core/blob/33d3655fa6883713f33f0fe6f330eb205671fea1/src/database/MongoConnection.ts#L80)
199
-
200
- Returns a repository for performing operations against the collection associated with the given model class.
201
-
202
- #### Type Parameters
203
-
204
- ##### T
205
-
206
- `T` *extends* `object` = `any`
207
-
208
- #### Parameters
209
-
210
- ##### classOrName
211
-
212
- `any`
213
-
214
- The model class, or the name of a registered model class, to retrieve a repository for.
215
-
216
- #### Returns
217
-
218
- [`MongoRepository`](MongoRepository.md)\<`T`\>