@rapidrest/service-core 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +16 -0
- package/dist/lib/ApiErrors.js +41 -0
- package/dist/lib/ApiErrors.js.map +1 -0
- package/dist/lib/BackgroundService.js +16 -0
- package/dist/lib/BackgroundService.js.map +1 -0
- package/dist/lib/BackgroundServiceManager.js +135 -0
- package/dist/lib/BackgroundServiceManager.js.map +1 -0
- package/dist/lib/BulkError.js +24 -0
- package/dist/lib/BulkError.js.map +1 -0
- package/dist/lib/EventListenerManager.js +161 -0
- package/dist/lib/EventListenerManager.js.map +1 -0
- package/dist/lib/NetUtils.js +103 -0
- package/dist/lib/NetUtils.js.map +1 -0
- package/dist/lib/NotificationUtils.js +34 -0
- package/dist/lib/NotificationUtils.js.map +1 -0
- package/dist/lib/ObjectFactory.js +90 -0
- package/dist/lib/ObjectFactory.js.map +1 -0
- package/dist/lib/OpenApiSpec.js +748 -0
- package/dist/lib/OpenApiSpec.js.map +1 -0
- package/dist/lib/Server.js +549 -0
- package/dist/lib/Server.js.map +1 -0
- package/dist/lib/Types.js +2 -0
- package/dist/lib/Types.js.map +1 -0
- package/dist/lib/auth/AuthMiddleware.js +229 -0
- package/dist/lib/auth/AuthMiddleware.js.map +1 -0
- package/dist/lib/auth/AuthStrategy.js +2 -0
- package/dist/lib/auth/AuthStrategy.js.map +1 -0
- package/dist/lib/auth/BasicStrategy.js +106 -0
- package/dist/lib/auth/BasicStrategy.js.map +1 -0
- package/dist/lib/auth/JWTStrategy.js +161 -0
- package/dist/lib/auth/JWTStrategy.js.map +1 -0
- package/dist/lib/auth/index.js +5 -0
- package/dist/lib/auth/index.js.map +1 -0
- package/dist/lib/database/ConnectionKinds.js +14 -0
- package/dist/lib/database/ConnectionKinds.js.map +1 -0
- package/dist/lib/database/ConnectionManager.js +161 -0
- package/dist/lib/database/ConnectionManager.js.map +1 -0
- package/dist/lib/database/MongoConnection.js +86 -0
- package/dist/lib/database/MongoConnection.js.map +1 -0
- package/dist/lib/database/MongoRepository.js +136 -0
- package/dist/lib/database/MongoRepository.js.map +1 -0
- package/dist/lib/database/MongoSchemaSync.js +136 -0
- package/dist/lib/database/MongoSchemaSync.js.map +1 -0
- package/dist/lib/database/NamingUtils.js +52 -0
- package/dist/lib/database/NamingUtils.js.map +1 -0
- package/dist/lib/database/TypeOrmSupport.js +146 -0
- package/dist/lib/database/TypeOrmSupport.js.map +1 -0
- package/dist/lib/database/index.js +7 -0
- package/dist/lib/database/index.js.map +1 -0
- package/dist/lib/decorators/DatabaseDecorators.js +52 -0
- package/dist/lib/decorators/DatabaseDecorators.js.map +1 -0
- package/dist/lib/decorators/DocDecorators.js +120 -0
- package/dist/lib/decorators/DocDecorators.js.map +1 -0
- package/dist/lib/decorators/EventDecorators.js +24 -0
- package/dist/lib/decorators/EventDecorators.js.map +1 -0
- package/dist/lib/decorators/ModelDecorators.js +173 -0
- package/dist/lib/decorators/ModelDecorators.js.map +1 -0
- package/dist/lib/decorators/PersistenceDecorators.js +177 -0
- package/dist/lib/decorators/PersistenceDecorators.js.map +1 -0
- package/dist/lib/decorators/RouteDecorators.js +324 -0
- package/dist/lib/decorators/RouteDecorators.js.map +1 -0
- package/dist/lib/decorators/index.js +7 -0
- package/dist/lib/decorators/index.js.map +1 -0
- package/dist/lib/http/Adapters.js +230 -0
- package/dist/lib/http/Adapters.js.map +1 -0
- package/dist/lib/http/Router.js +403 -0
- package/dist/lib/http/Router.js.map +1 -0
- package/dist/lib/http/WebSocket.js +82 -0
- package/dist/lib/http/WebSocket.js.map +1 -0
- package/dist/lib/http/index.js +4 -0
- package/dist/lib/http/index.js.map +1 -0
- package/dist/lib/http/types.js +5 -0
- package/dist/lib/http/types.js.map +1 -0
- package/dist/lib/index.js +18 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/models/BaseEntity.js +83 -0
- package/dist/lib/models/BaseEntity.js.map +1 -0
- package/dist/lib/models/BaseMongoEntity.js +40 -0
- package/dist/lib/models/BaseMongoEntity.js.map +1 -0
- package/dist/lib/models/ModelUtils.js +645 -0
- package/dist/lib/models/ModelUtils.js.map +1 -0
- package/dist/lib/models/RecoverableBaseEntity.js +39 -0
- package/dist/lib/models/RecoverableBaseEntity.js.map +1 -0
- package/dist/lib/models/RecoverableBaseMongoEntity.js +40 -0
- package/dist/lib/models/RecoverableBaseMongoEntity.js.map +1 -0
- package/dist/lib/models/RepoUtils.js +717 -0
- package/dist/lib/models/RepoUtils.js.map +1 -0
- package/dist/lib/models/SimpleEntity.js +42 -0
- package/dist/lib/models/SimpleEntity.js.map +1 -0
- package/dist/lib/models/SimpleMongoEntity.js +38 -0
- package/dist/lib/models/SimpleMongoEntity.js.map +1 -0
- package/dist/lib/models/StatusExtraData.js +15 -0
- package/dist/lib/models/StatusExtraData.js.map +1 -0
- package/dist/lib/models/index.js +10 -0
- package/dist/lib/models/index.js.map +1 -0
- package/dist/lib/routes/AdminRoute.js +268 -0
- package/dist/lib/routes/AdminRoute.js.map +1 -0
- package/dist/lib/routes/MetricsRoute.js +86 -0
- package/dist/lib/routes/MetricsRoute.js.map +1 -0
- package/dist/lib/routes/ModelRoute.js +481 -0
- package/dist/lib/routes/ModelRoute.js.map +1 -0
- package/dist/lib/routes/OpenAPIRoute.js +115 -0
- package/dist/lib/routes/OpenAPIRoute.js.map +1 -0
- package/dist/lib/routes/RouteUtils.js +445 -0
- package/dist/lib/routes/RouteUtils.js.map +1 -0
- package/dist/lib/routes/StatusRoute.js +55 -0
- package/dist/lib/routes/StatusRoute.js.map +1 -0
- package/dist/lib/routes/index.js +7 -0
- package/dist/lib/routes/index.js.map +1 -0
- package/dist/lib/security/ACLRouteMongo.js +194 -0
- package/dist/lib/security/ACLRouteMongo.js.map +1 -0
- package/dist/lib/security/ACLRouteSQL.js +193 -0
- package/dist/lib/security/ACLRouteSQL.js.map +1 -0
- package/dist/lib/security/ACLUtils.js +457 -0
- package/dist/lib/security/ACLUtils.js.map +1 -0
- package/dist/lib/security/AccessControlList.js +18 -0
- package/dist/lib/security/AccessControlList.js.map +1 -0
- package/dist/lib/security/AccessControlListMongo.js +155 -0
- package/dist/lib/security/AccessControlListMongo.js.map +1 -0
- package/dist/lib/security/AccessControlListSQL.js +149 -0
- package/dist/lib/security/AccessControlListSQL.js.map +1 -0
- package/dist/lib/security/index.js +3 -0
- package/dist/lib/security/index.js.map +1 -0
- package/dist/lib/test/index.js +3 -0
- package/dist/lib/test/index.js.map +1 -0
- package/dist/lib/test/request.js +99 -0
- package/dist/lib/test/request.js.map +1 -0
- package/dist/lib/test/requestws.js +173 -0
- package/dist/lib/test/requestws.js.map +1 -0
- package/dist/types/ApiErrors.d.ts +38 -0
- package/dist/types/BackgroundService.d.ts +30 -0
- package/dist/types/BackgroundServiceManager.d.ts +66 -0
- package/dist/types/BulkError.d.ts +11 -0
- package/dist/types/EventListenerManager.d.ts +36 -0
- package/dist/types/NetUtils.d.ts +29 -0
- package/dist/types/NotificationUtils.d.ts +25 -0
- package/dist/types/ObjectFactory.d.ts +17 -0
- package/dist/types/OpenApiSpec.d.ts +114 -0
- package/dist/types/Server.d.ts +180 -0
- package/dist/types/Types.d.ts +8 -0
- package/dist/types/auth/AuthMiddleware.d.ts +42 -0
- package/dist/types/auth/AuthStrategy.d.ts +32 -0
- package/dist/types/auth/BasicStrategy.d.ts +33 -0
- package/dist/types/auth/JWTStrategy.d.ts +61 -0
- package/dist/types/auth/index.d.ts +4 -0
- package/dist/types/database/ConnectionKinds.d.ts +7 -0
- package/dist/types/database/ConnectionManager.d.ts +35 -0
- package/dist/types/database/MongoConnection.d.ts +54 -0
- package/dist/types/database/MongoRepository.d.ts +92 -0
- package/dist/types/database/MongoSchemaSync.d.ts +41 -0
- package/dist/types/database/NamingUtils.d.ts +24 -0
- package/dist/types/database/TypeOrmSupport.d.ts +20 -0
- package/dist/types/database/index.d.ts +6 -0
- package/dist/types/decorators/DatabaseDecorators.d.ts +18 -0
- package/dist/types/decorators/DocDecorators.d.ts +69 -0
- package/dist/types/decorators/EventDecorators.d.ts +12 -0
- package/dist/types/decorators/ModelDecorators.d.ts +80 -0
- package/dist/types/decorators/PersistenceDecorators.d.ts +117 -0
- package/dist/types/decorators/RouteDecorators.d.ts +172 -0
- package/dist/types/decorators/index.d.ts +6 -0
- package/dist/types/http/Adapters.d.ts +68 -0
- package/dist/types/http/Router.d.ts +99 -0
- package/dist/types/http/WebSocket.d.ts +56 -0
- package/dist/types/http/index.d.ts +6 -0
- package/dist/types/http/types.d.ts +54 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/models/BaseEntity.d.ts +29 -0
- package/dist/types/models/BaseMongoEntity.d.ts +13 -0
- package/dist/types/models/ModelUtils.d.ts +166 -0
- package/dist/types/models/RecoverableBaseEntity.d.ts +16 -0
- package/dist/types/models/RecoverableBaseMongoEntity.d.ts +16 -0
- package/dist/types/models/RepoUtils.d.ts +154 -0
- package/dist/types/models/SimpleEntity.d.ts +14 -0
- package/dist/types/models/SimpleMongoEntity.d.ts +15 -0
- package/dist/types/models/StatusExtraData.d.ts +6 -0
- package/dist/types/models/index.d.ts +9 -0
- package/dist/types/routes/AdminRoute.d.ts +47 -0
- package/dist/types/routes/MetricsRoute.d.ts +15 -0
- package/dist/types/routes/ModelRoute.d.ts +226 -0
- package/dist/types/routes/OpenAPIRoute.d.ts +17 -0
- package/dist/types/routes/RouteUtils.d.ts +55 -0
- package/dist/types/routes/StatusRoute.d.ts +11 -0
- package/dist/types/routes/index.d.ts +6 -0
- package/dist/types/security/ACLRouteMongo.d.ts +19 -0
- package/dist/types/security/ACLRouteSQL.d.ts +19 -0
- package/dist/types/security/ACLUtils.d.ts +94 -0
- package/dist/types/security/AccessControlList.d.ts +103 -0
- package/dist/types/security/AccessControlListMongo.d.ts +24 -0
- package/dist/types/security/AccessControlListSQL.d.ts +24 -0
- package/dist/types/security/index.d.ts +2 -0
- package/dist/types/test/index.d.ts +2 -0
- package/dist/types/test/request.d.ts +24 -0
- package/dist/types/test/requestws.d.ts +21 -0
- package/docs/Makefile +20 -0
- package/docs/conf.py +58 -0
- package/docs/index.rst +17 -0
- package/docs/make.bat +35 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +13 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +23 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +28 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +25 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +28 -0
- package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +57 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +12 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +17 -0
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +18 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +27 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +35 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +25 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +27 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +26 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +45 -0
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +14 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +119 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +25 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +68 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +26 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +27 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +41 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +51 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +41 -0
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +51 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +36 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +33 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +26 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +33 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +31 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +25 -0
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +25 -0
- package/docs/reference/README.md +20 -0
- package/docs/reference/classes/ACLUtils.md +251 -0
- package/docs/reference/classes/AdminRoute.md +51 -0
- package/docs/reference/classes/AuthMiddleware.md +131 -0
- package/docs/reference/classes/BackgroundService.md +117 -0
- package/docs/reference/classes/BackgroundServiceManager.md +172 -0
- package/docs/reference/classes/BaseEntity.md +82 -0
- package/docs/reference/classes/BaseMongoEntity.md +107 -0
- package/docs/reference/classes/BasicStrategy.md +89 -0
- package/docs/reference/classes/BasicStrategyOptions.md +91 -0
- package/docs/reference/classes/BulkError.md +271 -0
- package/docs/reference/classes/ConnectionManager.md +75 -0
- package/docs/reference/classes/EventListenerManager.md +88 -0
- package/docs/reference/classes/JWTStrategy.md +77 -0
- package/docs/reference/classes/JWTStrategyOptions.md +97 -0
- package/docs/reference/classes/MetricsRoute.md +27 -0
- package/docs/reference/classes/ModelRoute.md +527 -0
- package/docs/reference/classes/ModelUtils.md +448 -0
- package/docs/reference/classes/MongoConnection.md +218 -0
- package/docs/reference/classes/MongoRepository.md +354 -0
- package/docs/reference/classes/MongoSchemaSync.md +67 -0
- package/docs/reference/classes/NetUtils.md +90 -0
- package/docs/reference/classes/NotificationUtils.md +77 -0
- package/docs/reference/classes/ObjectFactory.md +336 -0
- package/docs/reference/classes/OpenAPIRoute.md +77 -0
- package/docs/reference/classes/OpenApiSpec.md +892 -0
- package/docs/reference/classes/RecoverableBaseEntity.md +114 -0
- package/docs/reference/classes/RecoverableBaseMongoEntity.md +124 -0
- package/docs/reference/classes/RedisTransport.md +2202 -0
- package/docs/reference/classes/RepoUtils.md +486 -0
- package/docs/reference/classes/RouteUtils.md +191 -0
- package/docs/reference/classes/Server.md +408 -0
- package/docs/reference/classes/SimpleEntity.md +48 -0
- package/docs/reference/classes/SimpleMongoEntity.md +66 -0
- package/docs/reference/classes/StatusExtraData.md +57 -0
- package/docs/reference/classes/StatusRoute.md +26 -0
- package/docs/reference/enumerations/ACLAction.md +63 -0
- package/docs/reference/enumerations/ApiErrorMessages.md +123 -0
- package/docs/reference/enumerations/ApiErrors.md +123 -0
- package/docs/reference/functions/isSqlDataSource.md +26 -0
- package/docs/reference/functions/resolveCollectionName.md +33 -0
- package/docs/reference/functions/snakeCase.md +28 -0
- package/docs/reference/globals.md +91 -0
- package/docs/reference/interfaces/ACLRecord.md +96 -0
- package/docs/reference/interfaces/AccessControlList.md +76 -0
- package/docs/reference/interfaces/AuthResult.md +55 -0
- package/docs/reference/interfaces/AuthStrategy.md +57 -0
- package/docs/reference/interfaces/CreateRequestOptions.md +121 -0
- package/docs/reference/interfaces/DeleteRequestOptions.md +147 -0
- package/docs/reference/interfaces/FindRequestOptions.md +133 -0
- package/docs/reference/interfaces/JWTAuthResult.md +84 -0
- package/docs/reference/interfaces/RepoCreateOptions.md +95 -0
- package/docs/reference/interfaces/RepoDeleteOptions.md +115 -0
- package/docs/reference/interfaces/RepoFindOptions.md +135 -0
- package/docs/reference/interfaces/RepoOperationOptions.md +69 -0
- package/docs/reference/interfaces/RepoUpdateOptions.md +111 -0
- package/docs/reference/interfaces/RequestOptions.md +112 -0
- package/docs/reference/interfaces/TruncateRequestOptions.md +175 -0
- package/docs/reference/interfaces/UpdateRequestOptions.md +149 -0
- package/docs/reference/type-aliases/OneOrMany.md +19 -0
- package/docs/reference/type-aliases/OneOrNull.md +19 -0
- package/docs/reference/type-aliases/PartialBaseEntity.md +17 -0
- package/docs/reference/type-aliases/PartialSimpleEntity.md +17 -0
- package/docs/reference/type-aliases/UpdateObject.md +19 -0
- package/package.json +125 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / MongoRepository
|
|
6
|
+
|
|
7
|
+
# Class: MongoRepository\<T\>
|
|
8
|
+
|
|
9
|
+
Defined in: [src/database/MongoRepository.ts:22](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L22)
|
|
10
|
+
|
|
11
|
+
Provides a lightweight repository for performing common operations against a single MongoDB collection using the
|
|
12
|
+
native `mongodb` driver. Instances of this class are obtained via `MongoConnection.getRepository`.
|
|
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
|
+
## Type Parameters
|
|
22
|
+
|
|
23
|
+
### T
|
|
24
|
+
|
|
25
|
+
`T` *extends* `Document` = `any`
|
|
26
|
+
|
|
27
|
+
## Constructors
|
|
28
|
+
|
|
29
|
+
### Constructor
|
|
30
|
+
|
|
31
|
+
> **new MongoRepository**\<`T`\>(`db`, `collection`, `modelClass?`): `MongoRepository`\<`T`\>
|
|
32
|
+
|
|
33
|
+
Defined in: [src/database/MongoRepository.ts:30](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L30)
|
|
34
|
+
|
|
35
|
+
#### Parameters
|
|
36
|
+
|
|
37
|
+
##### db
|
|
38
|
+
|
|
39
|
+
`Db`
|
|
40
|
+
|
|
41
|
+
##### collection
|
|
42
|
+
|
|
43
|
+
`Collection`\<`T`\>
|
|
44
|
+
|
|
45
|
+
##### modelClass?
|
|
46
|
+
|
|
47
|
+
`any`
|
|
48
|
+
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
`MongoRepository`\<`T`\>
|
|
52
|
+
|
|
53
|
+
## Properties
|
|
54
|
+
|
|
55
|
+
### collection
|
|
56
|
+
|
|
57
|
+
> `readonly` **collection**: `Collection`\<`T`\>
|
|
58
|
+
|
|
59
|
+
Defined in: [src/database/MongoRepository.ts:26](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L26)
|
|
60
|
+
|
|
61
|
+
The underlying MongoDB collection that operations are performed against.
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### db
|
|
66
|
+
|
|
67
|
+
> `readonly` **db**: `Db`
|
|
68
|
+
|
|
69
|
+
Defined in: [src/database/MongoRepository.ts:24](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L24)
|
|
70
|
+
|
|
71
|
+
The database that the underlying collection belongs to.
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### modelClass
|
|
76
|
+
|
|
77
|
+
> `readonly` **modelClass**: `any`
|
|
78
|
+
|
|
79
|
+
Defined in: [src/database/MongoRepository.ts:28](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L28)
|
|
80
|
+
|
|
81
|
+
The model class associated with this repository.
|
|
82
|
+
|
|
83
|
+
## Accessors
|
|
84
|
+
|
|
85
|
+
### collectionName
|
|
86
|
+
|
|
87
|
+
#### Get Signature
|
|
88
|
+
|
|
89
|
+
> **get** **collectionName**(): `string`
|
|
90
|
+
|
|
91
|
+
Defined in: [src/database/MongoRepository.ts:37](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L37)
|
|
92
|
+
|
|
93
|
+
The name of the underlying MongoDB collection.
|
|
94
|
+
|
|
95
|
+
##### Returns
|
|
96
|
+
|
|
97
|
+
`string`
|
|
98
|
+
|
|
99
|
+
## Methods
|
|
100
|
+
|
|
101
|
+
### aggregate()
|
|
102
|
+
|
|
103
|
+
> **aggregate**(`pipeline`): `AggregationCursor`\<`any`\>
|
|
104
|
+
|
|
105
|
+
Defined in: [src/database/MongoRepository.ts:46](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L46)
|
|
106
|
+
|
|
107
|
+
Executes the given aggregation pipeline against the collection and returns the resulting cursor.
|
|
108
|
+
|
|
109
|
+
#### Parameters
|
|
110
|
+
|
|
111
|
+
##### pipeline
|
|
112
|
+
|
|
113
|
+
`Document`[]
|
|
114
|
+
|
|
115
|
+
The aggregation pipeline stages to execute.
|
|
116
|
+
|
|
117
|
+
#### Returns
|
|
118
|
+
|
|
119
|
+
`AggregationCursor`\<`any`\>
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### clear()
|
|
124
|
+
|
|
125
|
+
> **clear**(): `Promise`\<`void`\>
|
|
126
|
+
|
|
127
|
+
Defined in: [src/database/MongoRepository.ts:54](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L54)
|
|
128
|
+
|
|
129
|
+
Drops the entire collection from the database, removing all documents and indexes. Does nothing if the
|
|
130
|
+
collection does not exist.
|
|
131
|
+
|
|
132
|
+
#### Returns
|
|
133
|
+
|
|
134
|
+
`Promise`\<`void`\>
|
|
135
|
+
|
|
136
|
+
***
|
|
137
|
+
|
|
138
|
+
### count()
|
|
139
|
+
|
|
140
|
+
> **count**(`filter?`): `Promise`\<`number`\>
|
|
141
|
+
|
|
142
|
+
Defined in: [src/database/MongoRepository.ts:70](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L70)
|
|
143
|
+
|
|
144
|
+
Returns the number of documents matching the given filter.
|
|
145
|
+
|
|
146
|
+
#### Parameters
|
|
147
|
+
|
|
148
|
+
##### filter?
|
|
149
|
+
|
|
150
|
+
`any`
|
|
151
|
+
|
|
152
|
+
The query filter to match documents against.
|
|
153
|
+
|
|
154
|
+
#### Returns
|
|
155
|
+
|
|
156
|
+
`Promise`\<`number`\>
|
|
157
|
+
|
|
158
|
+
***
|
|
159
|
+
|
|
160
|
+
### deleteMany()
|
|
161
|
+
|
|
162
|
+
> **deleteMany**(`filter`): `Promise`\<`DeleteResult`\>
|
|
163
|
+
|
|
164
|
+
Defined in: [src/database/MongoRepository.ts:79](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L79)
|
|
165
|
+
|
|
166
|
+
Deletes all documents matching the given filter.
|
|
167
|
+
|
|
168
|
+
#### Parameters
|
|
169
|
+
|
|
170
|
+
##### filter
|
|
171
|
+
|
|
172
|
+
`any`
|
|
173
|
+
|
|
174
|
+
The query filter to match documents against.
|
|
175
|
+
|
|
176
|
+
#### Returns
|
|
177
|
+
|
|
178
|
+
`Promise`\<`DeleteResult`\>
|
|
179
|
+
|
|
180
|
+
***
|
|
181
|
+
|
|
182
|
+
### deleteOne()
|
|
183
|
+
|
|
184
|
+
> **deleteOne**(`filter`): `Promise`\<`DeleteResult`\>
|
|
185
|
+
|
|
186
|
+
Defined in: [src/database/MongoRepository.ts:88](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L88)
|
|
187
|
+
|
|
188
|
+
Deletes the first document matching the given filter.
|
|
189
|
+
|
|
190
|
+
#### Parameters
|
|
191
|
+
|
|
192
|
+
##### filter
|
|
193
|
+
|
|
194
|
+
`any`
|
|
195
|
+
|
|
196
|
+
The query filter to match documents against.
|
|
197
|
+
|
|
198
|
+
#### Returns
|
|
199
|
+
|
|
200
|
+
`Promise`\<`DeleteResult`\>
|
|
201
|
+
|
|
202
|
+
***
|
|
203
|
+
|
|
204
|
+
### distinct()
|
|
205
|
+
|
|
206
|
+
> **distinct**(`field`, `filter?`): `Promise`\<`any`[]\>
|
|
207
|
+
|
|
208
|
+
Defined in: [src/database/MongoRepository.ts:98](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L98)
|
|
209
|
+
|
|
210
|
+
Returns the list of distinct values of the given field for all documents matching the given filter.
|
|
211
|
+
|
|
212
|
+
#### Parameters
|
|
213
|
+
|
|
214
|
+
##### field
|
|
215
|
+
|
|
216
|
+
`string`
|
|
217
|
+
|
|
218
|
+
The name of the document field to return distinct values of.
|
|
219
|
+
|
|
220
|
+
##### filter?
|
|
221
|
+
|
|
222
|
+
`any`
|
|
223
|
+
|
|
224
|
+
The query filter to match documents against.
|
|
225
|
+
|
|
226
|
+
#### Returns
|
|
227
|
+
|
|
228
|
+
`Promise`\<`any`[]\>
|
|
229
|
+
|
|
230
|
+
***
|
|
231
|
+
|
|
232
|
+
### find()
|
|
233
|
+
|
|
234
|
+
> **find**(`filter?`): `Promise`\<`any`[]\>
|
|
235
|
+
|
|
236
|
+
Defined in: [src/database/MongoRepository.ts:107](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L107)
|
|
237
|
+
|
|
238
|
+
Returns all documents matching the given filter.
|
|
239
|
+
|
|
240
|
+
#### Parameters
|
|
241
|
+
|
|
242
|
+
##### filter?
|
|
243
|
+
|
|
244
|
+
`any`
|
|
245
|
+
|
|
246
|
+
The query filter to match documents against.
|
|
247
|
+
|
|
248
|
+
#### Returns
|
|
249
|
+
|
|
250
|
+
`Promise`\<`any`[]\>
|
|
251
|
+
|
|
252
|
+
***
|
|
253
|
+
|
|
254
|
+
### findOne()
|
|
255
|
+
|
|
256
|
+
> **findOne**(`filter`): `Promise`\<`any`\>
|
|
257
|
+
|
|
258
|
+
Defined in: [src/database/MongoRepository.ts:116](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L116)
|
|
259
|
+
|
|
260
|
+
Returns the first document matching the given filter.
|
|
261
|
+
|
|
262
|
+
#### Parameters
|
|
263
|
+
|
|
264
|
+
##### filter
|
|
265
|
+
|
|
266
|
+
`any`
|
|
267
|
+
|
|
268
|
+
The query filter to match documents against.
|
|
269
|
+
|
|
270
|
+
#### Returns
|
|
271
|
+
|
|
272
|
+
`Promise`\<`any`\>
|
|
273
|
+
|
|
274
|
+
***
|
|
275
|
+
|
|
276
|
+
### save()
|
|
277
|
+
|
|
278
|
+
> **save**(`doc`): `Promise`\<`any`\>
|
|
279
|
+
|
|
280
|
+
Defined in: [src/database/MongoRepository.ts:128](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L128)
|
|
281
|
+
|
|
282
|
+
Saves the given document to the collection. If the document has an existing `_id` the stored document is
|
|
283
|
+
replaced (inserting if missing), otherwise the document is inserted and its newly assigned `_id` is set on
|
|
284
|
+
the returned object.
|
|
285
|
+
|
|
286
|
+
#### Parameters
|
|
287
|
+
|
|
288
|
+
##### doc
|
|
289
|
+
|
|
290
|
+
`any`
|
|
291
|
+
|
|
292
|
+
The document to save.
|
|
293
|
+
|
|
294
|
+
#### Returns
|
|
295
|
+
|
|
296
|
+
`Promise`\<`any`\>
|
|
297
|
+
|
|
298
|
+
The saved document.
|
|
299
|
+
|
|
300
|
+
***
|
|
301
|
+
|
|
302
|
+
### updateMany()
|
|
303
|
+
|
|
304
|
+
> **updateMany**(`filter`, `update`): `Promise`\<`UpdateResult`\<`Document`\>\>
|
|
305
|
+
|
|
306
|
+
Defined in: [src/database/MongoRepository.ts:153](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L153)
|
|
307
|
+
|
|
308
|
+
Updates all documents matching the given filter with the provided update operations.
|
|
309
|
+
|
|
310
|
+
#### Parameters
|
|
311
|
+
|
|
312
|
+
##### filter
|
|
313
|
+
|
|
314
|
+
`any`
|
|
315
|
+
|
|
316
|
+
The query filter to match documents against.
|
|
317
|
+
|
|
318
|
+
##### update
|
|
319
|
+
|
|
320
|
+
`any`
|
|
321
|
+
|
|
322
|
+
The update operations (e.g. `$set`) to apply.
|
|
323
|
+
|
|
324
|
+
#### Returns
|
|
325
|
+
|
|
326
|
+
`Promise`\<`UpdateResult`\<`Document`\>\>
|
|
327
|
+
|
|
328
|
+
***
|
|
329
|
+
|
|
330
|
+
### updateOne()
|
|
331
|
+
|
|
332
|
+
> **updateOne**(`filter`, `update`): `Promise`\<`UpdateResult`\<`Document`\>\>
|
|
333
|
+
|
|
334
|
+
Defined in: [src/database/MongoRepository.ts:163](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoRepository.ts#L163)
|
|
335
|
+
|
|
336
|
+
Updates the first document matching the given filter with the provided update operations.
|
|
337
|
+
|
|
338
|
+
#### Parameters
|
|
339
|
+
|
|
340
|
+
##### filter
|
|
341
|
+
|
|
342
|
+
`any`
|
|
343
|
+
|
|
344
|
+
The query filter to match documents against.
|
|
345
|
+
|
|
346
|
+
##### update
|
|
347
|
+
|
|
348
|
+
`any`
|
|
349
|
+
|
|
350
|
+
The update operations (e.g. `$set`) to apply.
|
|
351
|
+
|
|
352
|
+
#### Returns
|
|
353
|
+
|
|
354
|
+
`Promise`\<`UpdateResult`\<`Document`\>\>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / MongoSchemaSync
|
|
6
|
+
|
|
7
|
+
# Class: MongoSchemaSync
|
|
8
|
+
|
|
9
|
+
Defined in: [src/database/MongoSchemaSync.ts:33](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoSchemaSync.ts#L33)
|
|
10
|
+
|
|
11
|
+
Performs structure synchronization of MongoDB collections based on the persistence metadata of model classes.
|
|
12
|
+
|
|
13
|
+
For each collection associated with a model class the following operations are performed:
|
|
14
|
+
- The collection is created if it does not already exist.
|
|
15
|
+
- Indexes declared via the `@Index` and `@Unique` decorators are created if missing.
|
|
16
|
+
- Existing declared indexes whose definition has changed are dropped and re-created.
|
|
17
|
+
|
|
18
|
+
The synchronization process never drops collections or data, never modifies the built-in `_id_` index, and never
|
|
19
|
+
drops indexes that are not declared by the model class (e.g. shard keys or manually created indexes).
|
|
20
|
+
|
|
21
|
+
## Author
|
|
22
|
+
|
|
23
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
24
|
+
|
|
25
|
+
## Constructors
|
|
26
|
+
|
|
27
|
+
### Constructor
|
|
28
|
+
|
|
29
|
+
> **new MongoSchemaSync**(`db`, `logger?`): `MongoSchemaSync`
|
|
30
|
+
|
|
31
|
+
Defined in: [src/database/MongoSchemaSync.ts:37](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoSchemaSync.ts#L37)
|
|
32
|
+
|
|
33
|
+
#### Parameters
|
|
34
|
+
|
|
35
|
+
##### db
|
|
36
|
+
|
|
37
|
+
`Db`
|
|
38
|
+
|
|
39
|
+
##### logger?
|
|
40
|
+
|
|
41
|
+
`any`
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`MongoSchemaSync`
|
|
46
|
+
|
|
47
|
+
## Methods
|
|
48
|
+
|
|
49
|
+
### synchronize()
|
|
50
|
+
|
|
51
|
+
> **synchronize**(`entities`): `Promise`\<`void`\>
|
|
52
|
+
|
|
53
|
+
Defined in: [src/database/MongoSchemaSync.ts:47](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/database/MongoSchemaSync.ts#L47)
|
|
54
|
+
|
|
55
|
+
Synchronizes the structure of all collections associated with the given model classes.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
##### entities
|
|
60
|
+
|
|
61
|
+
`Iterable`\<`any`\>
|
|
62
|
+
|
|
63
|
+
The list of model classes to synchronize collections for.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / NetUtils
|
|
6
|
+
|
|
7
|
+
# Class: NetUtils
|
|
8
|
+
|
|
9
|
+
Defined in: [src/NetUtils.ts:12](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NetUtils.ts#L12)
|
|
10
|
+
|
|
11
|
+
Provides common utilities and functions for working with networking related problems.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new NetUtils**(): `NetUtils`
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`NetUtils`
|
|
26
|
+
|
|
27
|
+
## Methods
|
|
28
|
+
|
|
29
|
+
### getIPAddress()
|
|
30
|
+
|
|
31
|
+
> `static` **getIPAddress**(`urlOrRequest`, `trustedProxies?`): `string` \| `undefined`
|
|
32
|
+
|
|
33
|
+
Defined in: [src/NetUtils.ts:57](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NetUtils.ts#L57)
|
|
34
|
+
|
|
35
|
+
Extracts the IP address from a given url or HTTP request.
|
|
36
|
+
|
|
37
|
+
When `trustedProxies` is provided, forwarding headers (`X-Forwarded-For`, etc.) are
|
|
38
|
+
only trusted when the direct connection's `remoteAddress` is in that list. Without a
|
|
39
|
+
trusted-proxy list the headers are ignored and the socket address is returned directly,
|
|
40
|
+
preventing clients from spoofing their IP in audit logs.
|
|
41
|
+
|
|
42
|
+
#### Parameters
|
|
43
|
+
|
|
44
|
+
##### urlOrRequest
|
|
45
|
+
|
|
46
|
+
`string` \| `HttpRequest`
|
|
47
|
+
|
|
48
|
+
The url or HTTP request to extract the IP from.
|
|
49
|
+
|
|
50
|
+
##### trustedProxies?
|
|
51
|
+
|
|
52
|
+
`string`[]
|
|
53
|
+
|
|
54
|
+
Optional list of proxy IP addresses whose forwarding headers should be trusted.
|
|
55
|
+
|
|
56
|
+
#### Returns
|
|
57
|
+
|
|
58
|
+
`string` \| `undefined`
|
|
59
|
+
|
|
60
|
+
A `string` containing the IP address if found, otherwise `undefined`.
|
|
61
|
+
|
|
62
|
+
***
|
|
63
|
+
|
|
64
|
+
### lookupIPAddress()
|
|
65
|
+
|
|
66
|
+
> `static` **lookupIPAddress**(`url`, `family?`): `Promise`\<`string` \| `undefined`\>
|
|
67
|
+
|
|
68
|
+
Defined in: [src/NetUtils.ts:20](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NetUtils.ts#L20)
|
|
69
|
+
|
|
70
|
+
Performs DNS lookup of the IP address from a given url.
|
|
71
|
+
|
|
72
|
+
#### Parameters
|
|
73
|
+
|
|
74
|
+
##### url
|
|
75
|
+
|
|
76
|
+
`string`
|
|
77
|
+
|
|
78
|
+
The url to lookup the IP from.
|
|
79
|
+
|
|
80
|
+
##### family?
|
|
81
|
+
|
|
82
|
+
`number` = `4`
|
|
83
|
+
|
|
84
|
+
ip family used for dns lookup
|
|
85
|
+
|
|
86
|
+
#### Returns
|
|
87
|
+
|
|
88
|
+
`Promise`\<`string` \| `undefined`\>
|
|
89
|
+
|
|
90
|
+
A `string` containing the IP address if found, otherwise `undefined`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[**@rapidrest/service-core**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@rapidrest/service-core](../globals.md) / NotificationUtils
|
|
6
|
+
|
|
7
|
+
# Class: NotificationUtils
|
|
8
|
+
|
|
9
|
+
Defined in: [src/NotificationUtils.ts:11](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NotificationUtils.ts#L11)
|
|
10
|
+
|
|
11
|
+
Utility functions for sending push notifications to registered clients.
|
|
12
|
+
|
|
13
|
+
## Author
|
|
14
|
+
|
|
15
|
+
Jean-Philippe Steinmetz
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new NotificationUtils**(`redis`): `NotificationUtils`
|
|
22
|
+
|
|
23
|
+
Defined in: [src/NotificationUtils.ts:20](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NotificationUtils.ts#L20)
|
|
24
|
+
|
|
25
|
+
Initializes the utility using the given redis connection.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
##### redis
|
|
30
|
+
|
|
31
|
+
`Redis`
|
|
32
|
+
|
|
33
|
+
The redis connection to publish to.
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`NotificationUtils`
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
### sendMessage()
|
|
42
|
+
|
|
43
|
+
> **sendMessage**(`uids`, `type`, `action`, `data`): `void`
|
|
44
|
+
|
|
45
|
+
Defined in: [src/NotificationUtils.ts:32](https://github.com/rapidrest/service-core/blob/c8974caa9b5d3eb225bcbcd93945f2e588fe2f0a/src/NotificationUtils.ts#L32)
|
|
46
|
+
|
|
47
|
+
Sends a given message to the room or user with the specified uid(s).
|
|
48
|
+
|
|
49
|
+
#### Parameters
|
|
50
|
+
|
|
51
|
+
##### uids
|
|
52
|
+
|
|
53
|
+
`string` \| `string`[]
|
|
54
|
+
|
|
55
|
+
The universally unique identifier of the room or user to send the message to.
|
|
56
|
+
|
|
57
|
+
##### type
|
|
58
|
+
|
|
59
|
+
`string`
|
|
60
|
+
|
|
61
|
+
The type of message being sent.
|
|
62
|
+
|
|
63
|
+
##### action
|
|
64
|
+
|
|
65
|
+
`string`
|
|
66
|
+
|
|
67
|
+
The action performed on the data (if applicable).
|
|
68
|
+
|
|
69
|
+
##### data
|
|
70
|
+
|
|
71
|
+
`any`
|
|
72
|
+
|
|
73
|
+
The contents of the message to send to the room or user.
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`void`
|