@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.
- package/dist/lib/BackgroundService.js +0 -4
- package/dist/lib/BackgroundService.js.map +1 -1
- package/dist/lib/BackgroundServiceManager.js +21 -4
- package/dist/lib/BackgroundServiceManager.js.map +1 -1
- package/dist/lib/EventListenerManager.js.map +1 -1
- package/dist/lib/OpenApiSpec.js +3 -2
- package/dist/lib/OpenApiSpec.js.map +1 -1
- package/dist/lib/Server.js +18 -79
- package/dist/lib/Server.js.map +1 -1
- package/dist/lib/database/TypeOrmSupport.js +18 -2
- package/dist/lib/database/TypeOrmSupport.js.map +1 -1
- package/dist/lib/decorators/DocDecorators.js +19 -1
- package/dist/lib/decorators/DocDecorators.js.map +1 -1
- package/dist/lib/decorators/PersistenceDecorators.js.map +1 -1
- package/dist/lib/decorators/RouteDecorators.js +71 -20
- package/dist/lib/decorators/RouteDecorators.js.map +1 -1
- package/dist/lib/http/Adapters.js +45 -2
- package/dist/lib/http/Adapters.js.map +1 -1
- package/dist/lib/http/Router.js +53 -56
- package/dist/lib/http/Router.js.map +1 -1
- package/dist/lib/models/ModelUtils.js +18 -8
- package/dist/lib/models/ModelUtils.js.map +1 -1
- package/dist/lib/models/RepoUtils.js +96 -31
- package/dist/lib/models/RepoUtils.js.map +1 -1
- package/dist/lib/routes/{AdminRoute.js → BaseAdminRoute.js} +51 -36
- package/dist/lib/routes/BaseAdminRoute.js.map +1 -0
- package/dist/lib/routes/{MetricsRoute.js → BaseMetricsRoute.js} +28 -15
- package/dist/lib/routes/BaseMetricsRoute.js.map +1 -0
- package/dist/lib/routes/{OpenAPIRoute.js → BaseOpenAPIRoute.js} +31 -32
- package/dist/lib/routes/BaseOpenAPIRoute.js.map +1 -0
- package/dist/lib/routes/BasePushRoute.js +193 -0
- package/dist/lib/routes/BasePushRoute.js.map +1 -0
- package/dist/lib/routes/BaseStaticRoute.js +152 -0
- package/dist/lib/routes/BaseStaticRoute.js.map +1 -0
- package/dist/lib/routes/BaseStatusRoute.js +79 -0
- package/dist/lib/routes/BaseStatusRoute.js.map +1 -0
- package/dist/lib/routes/CRUDRoute.js +238 -0
- package/dist/lib/routes/CRUDRoute.js.map +1 -0
- package/dist/lib/routes/ModelRoute.js +20 -28
- package/dist/lib/routes/ModelRoute.js.map +1 -1
- package/dist/lib/routes/index.js +7 -4
- package/dist/lib/routes/index.js.map +1 -1
- package/dist/lib/security/ACLUtils.js +10 -13
- package/dist/lib/security/ACLUtils.js.map +1 -1
- package/dist/lib/security/AccessControlListMongo.js +5 -1
- package/dist/lib/security/AccessControlListMongo.js.map +1 -1
- package/dist/lib/security/AccessControlListSQL.js +7 -3
- package/dist/lib/security/AccessControlListSQL.js.map +1 -1
- package/dist/lib/security/BaseACLRoute.js +239 -0
- package/dist/lib/security/BaseACLRoute.js.map +1 -0
- package/dist/lib/security/index.js +3 -0
- package/dist/lib/security/index.js.map +1 -1
- package/dist/lib/test/request.js +6 -2
- package/dist/lib/test/request.js.map +1 -1
- package/dist/types/BackgroundService.d.ts +0 -5
- package/dist/types/BackgroundServiceManager.d.ts +1 -1
- package/dist/types/EventListenerManager.d.ts +4 -4
- package/dist/types/Server.d.ts +21 -6
- package/dist/types/decorators/DocDecorators.d.ts +9 -0
- package/dist/types/decorators/PersistenceDecorators.d.ts +7 -0
- package/dist/types/decorators/RouteDecorators.d.ts +14 -5
- package/dist/types/http/Adapters.d.ts +19 -0
- package/dist/types/http/Router.d.ts +6 -6
- package/dist/types/models/ModelUtils.d.ts +2 -1
- package/dist/types/routes/BaseAdminRoute.d.ts +59 -0
- package/dist/types/routes/BaseMetricsRoute.d.ts +37 -0
- package/dist/types/routes/BaseOpenAPIRoute.d.ts +33 -0
- package/dist/types/routes/BasePushRoute.d.ts +39 -0
- package/dist/types/routes/BaseStaticRoute.d.ts +44 -0
- package/dist/types/routes/BaseStatusRoute.d.ts +37 -0
- package/dist/types/routes/CRUDRoute.d.ts +47 -0
- package/dist/types/routes/ModelRoute.d.ts +23 -16
- package/dist/types/routes/index.d.ts +7 -4
- package/dist/types/security/ACLUtils.d.ts +1 -1
- package/dist/types/security/AccessControlList.d.ts +1 -1
- package/dist/types/security/AccessControlListMongo.d.ts +1 -1
- package/dist/types/security/AccessControlListSQL.d.ts +1 -1
- package/dist/types/security/BaseACLRoute.d.ts +73 -0
- package/dist/types/security/index.d.ts +3 -0
- package/package.json +132 -129
- package/tsconfig.export.json +17 -0
- package/dist/lib/routes/AdminRoute.js.map +0 -1
- package/dist/lib/routes/MetricsRoute.js.map +0 -1
- package/dist/lib/routes/OpenAPIRoute.js.map +0 -1
- package/dist/lib/routes/StatusRoute.js +0 -55
- package/dist/lib/routes/StatusRoute.js.map +0 -1
- package/dist/lib/security/ACLRouteMongo.js +0 -194
- package/dist/lib/security/ACLRouteMongo.js.map +0 -1
- package/dist/lib/security/ACLRouteSQL.js +0 -193
- package/dist/lib/security/ACLRouteSQL.js.map +0 -1
- package/dist/types/routes/AdminRoute.d.ts +0 -47
- package/dist/types/routes/MetricsRoute.d.ts +0 -15
- package/dist/types/routes/OpenAPIRoute.d.ts +0 -17
- package/dist/types/routes/StatusRoute.d.ts +0 -11
- package/dist/types/security/ACLRouteMongo.d.ts +0 -19
- package/dist/types/security/ACLRouteSQL.d.ts +0 -19
- package/docs/Makefile +0 -20
- package/docs/conf.py +0 -58
- package/docs/index.rst +0 -17
- package/docs/make.bat +0 -35
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/README.md +0 -13
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/MongoRepository.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/RedisConnection.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DatabaseDecorators/functions/Repository.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/README.md +0 -23
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Default.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Description.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Document.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Example.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Format.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Returns.md +0 -28
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Summary.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/Tags.md +0 -25
- package/docs/reference/@rapidrest/namespaces/DocDecorators/functions/TypeInfo.md +0 -28
- package/docs/reference/@rapidrest/namespaces/DocDecorators/interfaces/DocumentsData.md +0 -57
- package/docs/reference/@rapidrest/namespaces/EventDecorators/README.md +0 -12
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/EventListener.md +0 -17
- package/docs/reference/@rapidrest/namespaces/EventDecorators/functions/OnEvent.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/README.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Cache.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/ChildEntity.md +0 -18
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/DataStore.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Identifier.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Protect.md +0 -35
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Reference.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/Shard.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/functions/TrackChanges.md +0 -26
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/interfaces/PendingTypeOrmColumn.md +0 -45
- package/docs/reference/@rapidrest/namespaces/ModelDecorators/variables/pendingTypeOrmColumns.md +0 -14
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/README.md +0 -27
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Column.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Entity.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Index.md +0 -119
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/PrimaryColumn.md +0 -25
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/Unique.md +0 -68
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getColumnMetadata.md +0 -26
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getEntityName.md +0 -26
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/functions/getIndexMetadata.md +0 -27
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/CollationOptions.md +0 -79
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnInfo.md +0 -41
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/ColumnOptions.md +0 -51
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/EntityOptions.md +0 -32
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexInfo.md +0 -41
- package/docs/reference/@rapidrest/namespaces/PersistenceDecorators/interfaces/IndexOptions.md +0 -61
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/README.md +0 -36
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/After.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Auth.md +0 -33
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/AuthResult.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Before.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/ContentType.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Delete.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Get.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Head.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Header.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Method.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Model.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Options.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Param.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Patch.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Post.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Protect.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Put.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Query.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Request.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/RequiresRole.md +0 -26
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Response.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Route.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Socket.md +0 -33
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/User.md +0 -31
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/Validate.md +0 -25
- package/docs/reference/@rapidrest/namespaces/RouteDecorators/functions/WebSocket.md +0 -25
- package/docs/reference/README.md +0 -20
- package/docs/reference/classes/ACLUtils.md +0 -263
- package/docs/reference/classes/AdminRoute.md +0 -51
- package/docs/reference/classes/AuthMiddleware.md +0 -173
- package/docs/reference/classes/BackgroundService.md +0 -117
- package/docs/reference/classes/BackgroundServiceManager.md +0 -172
- package/docs/reference/classes/BaseEntity.md +0 -82
- package/docs/reference/classes/BaseMongoEntity.md +0 -107
- package/docs/reference/classes/BasicStrategy.md +0 -131
- package/docs/reference/classes/BasicStrategyOptions.md +0 -115
- package/docs/reference/classes/BulkError.md +0 -271
- package/docs/reference/classes/ConnectionManager.md +0 -75
- package/docs/reference/classes/EventListenerManager.md +0 -88
- package/docs/reference/classes/HttpRouter.md +0 -343
- package/docs/reference/classes/JWTStrategy.md +0 -100
- package/docs/reference/classes/JWTStrategyOptions.md +0 -97
- package/docs/reference/classes/MetricsRoute.md +0 -27
- package/docs/reference/classes/ModelRoute.md +0 -527
- package/docs/reference/classes/ModelUtils.md +0 -430
- package/docs/reference/classes/MongoConnection.md +0 -218
- package/docs/reference/classes/MongoRepository.md +0 -390
- package/docs/reference/classes/MongoSchemaSync.md +0 -97
- package/docs/reference/classes/NetUtils.md +0 -90
- package/docs/reference/classes/NotificationUtils.md +0 -77
- package/docs/reference/classes/ObjectFactory.md +0 -336
- package/docs/reference/classes/OpenAPIRoute.md +0 -77
- package/docs/reference/classes/OpenApiSpec.md +0 -892
- package/docs/reference/classes/RecoverableBaseEntity.md +0 -114
- package/docs/reference/classes/RecoverableBaseMongoEntity.md +0 -124
- package/docs/reference/classes/RedisTransport.md +0 -2202
- package/docs/reference/classes/RepoUtils.md +0 -482
- package/docs/reference/classes/RouteUtils.md +0 -191
- package/docs/reference/classes/Server.md +0 -408
- package/docs/reference/classes/SimpleEntity.md +0 -48
- package/docs/reference/classes/SimpleMongoEntity.md +0 -66
- package/docs/reference/classes/StatusExtraData.md +0 -57
- package/docs/reference/classes/StatusRoute.md +0 -26
- package/docs/reference/classes/UWSRequest.md +0 -226
- package/docs/reference/classes/UWSResponse.md +0 -257
- package/docs/reference/classes/UWSWebSocketShim.md +0 -958
- package/docs/reference/enumerations/ACLAction.md +0 -63
- package/docs/reference/enumerations/ApiErrorMessages.md +0 -123
- package/docs/reference/enumerations/ApiErrors.md +0 -123
- package/docs/reference/functions/createWebSocketStream.md +0 -27
- package/docs/reference/functions/isSqlDataSource.md +0 -26
- package/docs/reference/functions/readBody.md +0 -29
- package/docs/reference/functions/resolveCollectionName.md +0 -33
- package/docs/reference/functions/runChain.md +0 -40
- package/docs/reference/functions/snakeCase.md +0 -28
- package/docs/reference/globals.md +0 -106
- package/docs/reference/interfaces/ACLRecord.md +0 -96
- package/docs/reference/interfaces/AccessControlList.md +0 -76
- package/docs/reference/interfaces/AuthResult.md +0 -55
- package/docs/reference/interfaces/AuthStrategy.md +0 -95
- package/docs/reference/interfaces/CreateRequestOptions.md +0 -121
- package/docs/reference/interfaces/DeleteRequestOptions.md +0 -137
- package/docs/reference/interfaces/FindRequestOptions.md +0 -133
- package/docs/reference/interfaces/HttpRequest.md +0 -147
- package/docs/reference/interfaces/HttpResponse.md +0 -164
- package/docs/reference/interfaces/JWTAuthResult.md +0 -84
- package/docs/reference/interfaces/RepoCreateOptions.md +0 -95
- package/docs/reference/interfaces/RepoDeleteOptions.md +0 -105
- package/docs/reference/interfaces/RepoFindOptions.md +0 -125
- package/docs/reference/interfaces/RepoOperationOptions.md +0 -69
- package/docs/reference/interfaces/RepoUpdateOptions.md +0 -101
- package/docs/reference/interfaces/RequestOptions.md +0 -112
- package/docs/reference/interfaces/RequestWS.md +0 -225
- package/docs/reference/interfaces/TruncateRequestOptions.md +0 -161
- package/docs/reference/interfaces/UpdateRequestOptions.md +0 -139
- package/docs/reference/type-aliases/ErrorHandler.md +0 -35
- package/docs/reference/type-aliases/NextFunction.md +0 -23
- package/docs/reference/type-aliases/OneOrMany.md +0 -19
- package/docs/reference/type-aliases/OneOrNull.md +0 -19
- package/docs/reference/type-aliases/PartialBaseEntity.md +0 -17
- package/docs/reference/type-aliases/PartialSimpleEntity.md +0 -17
- package/docs/reference/type-aliases/RequestHandler.md +0 -31
- package/docs/reference/type-aliases/UpdateObject.md +0 -19
- package/docs/reference/type-aliases/WsUpgradeAuth.md +0 -27
- package/docs/reference/type-aliases/WsUpgradeAuthResult.md +0 -47
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { AccessControlListMongo } from "./AccessControlListMongo.js";
|
|
14
|
-
import { MongoRepository as Repo } from "../database/MongoRepository.js";
|
|
15
|
-
import { ACLAction } from "./AccessControlList.js";
|
|
16
|
-
import { ApiError, UserUtils } from "@rapidrest/core";
|
|
17
|
-
import { DatabaseDecorators, DocDecorators, RouteDecorators } from "../decorators/index.js";
|
|
18
|
-
import { ModelRoute } from "../routes/ModelRoute.js";
|
|
19
|
-
import { RepoUtils } from "../models/index.js";
|
|
20
|
-
import { ApiErrorMessages } from "../ApiErrors.js";
|
|
21
|
-
const { MongoRepository } = DatabaseDecorators;
|
|
22
|
-
const { Description, Returns, Summary, TypeInfo } = DocDecorators;
|
|
23
|
-
const { Auth, Delete, Get, Head, Model, Param, Post, Put, Query, Request, Response, Route, User } = RouteDecorators;
|
|
24
|
-
let ACLRouteMongo = class ACLRouteMongo extends ModelRoute {
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
this.repoUtilsClass = RepoUtils;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The base key used to get or set data in the cache.
|
|
31
|
-
*/
|
|
32
|
-
get baseCacheKey() {
|
|
33
|
-
return "db.cache.AccessControlList";
|
|
34
|
-
}
|
|
35
|
-
create(objs, req, user) {
|
|
36
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
37
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
38
|
-
}
|
|
39
|
-
return super.doCreate(objs, { user, recordEvent: true, req });
|
|
40
|
-
}
|
|
41
|
-
updateBulk(objs, req, user) {
|
|
42
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
43
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
44
|
-
}
|
|
45
|
-
return super.doBulkUpdate(objs, { user, recordEvent: true, req });
|
|
46
|
-
}
|
|
47
|
-
count(params, query, res, user) {
|
|
48
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
49
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
50
|
-
}
|
|
51
|
-
return super.doCount({ params, query, res, user });
|
|
52
|
-
}
|
|
53
|
-
findAll(params, query, user) {
|
|
54
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
55
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
56
|
-
}
|
|
57
|
-
return super.doFindAll({ params, query, user });
|
|
58
|
-
}
|
|
59
|
-
async delete(id, req, version, user) {
|
|
60
|
-
if (!user ||
|
|
61
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
62
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
63
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
64
|
-
}
|
|
65
|
-
if (id.startsWith("default_")) {
|
|
66
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
67
|
-
}
|
|
68
|
-
return super.doDelete(id, { version, user, recordEvent: true, req });
|
|
69
|
-
}
|
|
70
|
-
async findById(id, query, user) {
|
|
71
|
-
if (!user ||
|
|
72
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
73
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
74
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
75
|
-
}
|
|
76
|
-
return super.doFindById(id, { query, user });
|
|
77
|
-
}
|
|
78
|
-
async update(id, obj, req, user) {
|
|
79
|
-
if (!user ||
|
|
80
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
81
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
82
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
83
|
-
}
|
|
84
|
-
if (id.startsWith("default_")) {
|
|
85
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
86
|
-
}
|
|
87
|
-
const acl = new AccessControlListMongo(obj);
|
|
88
|
-
return super.doUpdate(id, acl, { user, recordEvent: true, req });
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
__decorate([
|
|
92
|
-
MongoRepository(AccessControlListMongo),
|
|
93
|
-
__metadata("design:type", Repo)
|
|
94
|
-
], ACLRouteMongo.prototype, "repo", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
Summary("Creates Access Control Lists."),
|
|
97
|
-
Description("Creates one or more access control lists."),
|
|
98
|
-
Auth(["jwt"]),
|
|
99
|
-
Post(),
|
|
100
|
-
TypeInfo([AccessControlListMongo, [Array, AccessControlListMongo]]),
|
|
101
|
-
Returns([AccessControlListMongo, [Array, AccessControlListMongo]]),
|
|
102
|
-
__param(1, Request),
|
|
103
|
-
__param(2, User),
|
|
104
|
-
__metadata("design:type", Function),
|
|
105
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
106
|
-
__metadata("design:returntype", Promise)
|
|
107
|
-
], ACLRouteMongo.prototype, "create", null);
|
|
108
|
-
__decorate([
|
|
109
|
-
Summary("Bulk Update Access Control Lists."),
|
|
110
|
-
Description("Saves modifications for the given collection of access control lists."),
|
|
111
|
-
Auth(["jwt"]),
|
|
112
|
-
Put(),
|
|
113
|
-
TypeInfo([[Array, AccessControlListMongo]]),
|
|
114
|
-
Returns([[Array, AccessControlListMongo]]),
|
|
115
|
-
__param(1, Request),
|
|
116
|
-
__param(2, User),
|
|
117
|
-
__metadata("design:type", Function),
|
|
118
|
-
__metadata("design:paramtypes", [Array, Object, Object]),
|
|
119
|
-
__metadata("design:returntype", Promise)
|
|
120
|
-
], ACLRouteMongo.prototype, "updateBulk", null);
|
|
121
|
-
__decorate([
|
|
122
|
-
Summary("Count Access Control Lists."),
|
|
123
|
-
Description("Returns the total number of access control lists matching the given search criteria."),
|
|
124
|
-
Auth(["jwt"]),
|
|
125
|
-
Head(),
|
|
126
|
-
Returns([null]),
|
|
127
|
-
__param(0, Param()),
|
|
128
|
-
__param(1, Query()),
|
|
129
|
-
__param(2, Response),
|
|
130
|
-
__param(3, User),
|
|
131
|
-
__metadata("design:type", Function),
|
|
132
|
-
__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
133
|
-
__metadata("design:returntype", Promise)
|
|
134
|
-
], ACLRouteMongo.prototype, "count", null);
|
|
135
|
-
__decorate([
|
|
136
|
-
Summary("Find All Access Control Lists."),
|
|
137
|
-
Description("Returns a collection of access control lists matching the given search criteria."),
|
|
138
|
-
Auth(["jwt"]),
|
|
139
|
-
Get(),
|
|
140
|
-
Returns([[Array, AccessControlListMongo]]),
|
|
141
|
-
__param(0, Param()),
|
|
142
|
-
__param(1, Query()),
|
|
143
|
-
__param(2, User),
|
|
144
|
-
__metadata("design:type", Function),
|
|
145
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
146
|
-
__metadata("design:returntype", Promise)
|
|
147
|
-
], ACLRouteMongo.prototype, "findAll", null);
|
|
148
|
-
__decorate([
|
|
149
|
-
Summary("Delete Access Control Lists by Id."),
|
|
150
|
-
Description("Deletes the access control list with the given unique identifier and optional version."),
|
|
151
|
-
Auth(["jwt"]),
|
|
152
|
-
Delete("/:id"),
|
|
153
|
-
Returns([null]),
|
|
154
|
-
__param(0, Param("id")),
|
|
155
|
-
__param(1, Request),
|
|
156
|
-
__param(2, Query("version")),
|
|
157
|
-
__param(3, User),
|
|
158
|
-
__metadata("design:type", Function),
|
|
159
|
-
__metadata("design:paramtypes", [String, Object, String, Object]),
|
|
160
|
-
__metadata("design:returntype", Promise)
|
|
161
|
-
], ACLRouteMongo.prototype, "delete", null);
|
|
162
|
-
__decorate([
|
|
163
|
-
Summary("Find Access Control Lists by Id."),
|
|
164
|
-
Description("Returns the access control list with the given unique identifier."),
|
|
165
|
-
Auth(["jwt"]),
|
|
166
|
-
Get("/:id"),
|
|
167
|
-
Returns([AccessControlListMongo]),
|
|
168
|
-
__param(0, Param("id")),
|
|
169
|
-
__param(1, Query()),
|
|
170
|
-
__param(2, User),
|
|
171
|
-
__metadata("design:type", Function),
|
|
172
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
|
173
|
-
__metadata("design:returntype", Promise)
|
|
174
|
-
], ACLRouteMongo.prototype, "findById", null);
|
|
175
|
-
__decorate([
|
|
176
|
-
Summary("Update Access Control Lists by Id."),
|
|
177
|
-
Description("Saves modifications to existing access control list with the given unique identifier."),
|
|
178
|
-
Auth(["jwt"]),
|
|
179
|
-
Put("/:id"),
|
|
180
|
-
Returns([AccessControlListMongo]),
|
|
181
|
-
__param(0, Param("id")),
|
|
182
|
-
__param(2, Request),
|
|
183
|
-
__param(3, User),
|
|
184
|
-
__metadata("design:type", Function),
|
|
185
|
-
__metadata("design:paramtypes", [String, AccessControlListMongo, Object, Object]),
|
|
186
|
-
__metadata("design:returntype", Promise)
|
|
187
|
-
], ACLRouteMongo.prototype, "update", null);
|
|
188
|
-
ACLRouteMongo = __decorate([
|
|
189
|
-
Model(AccessControlListMongo),
|
|
190
|
-
Route("/acls"),
|
|
191
|
-
__metadata("design:paramtypes", [])
|
|
192
|
-
], ACLRouteMongo);
|
|
193
|
-
export { ACLRouteMongo };
|
|
194
|
-
//# sourceMappingURL=ACLRouteMongo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ACLRouteMongo.js","sourceRoot":"","sources":["../../../src/security/ACLRouteMongo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;AAC/C,MAAM,EAAE,WAA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,CAAC,CAAC;IAE7B,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IACX,WAAA,KAAK,EAAE,CAAA;IACP,WAAA,IAAI,CAAA;;;;6CAWR;AAOa;IALb,OAAO,CAAC,oCAAoC,CAAC;IAC7C,WAAW,CAAC,uFAAuF,CAAC;IACpG,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACb,GAAG,CAAC,MAAM,CAAC;IACX,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAAC;IAE7B,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IAEX,WAAA,OAAO,CAAA;IACP,WAAA,IAAI,CAAA;;6CAFA,sBAAsB;;2CAkB9B;AA9JQ,aAAa;IAFzB,KAAK,CAAC,sBAAsB,CAAC;IAC7B,KAAK,CAAC,OAAO,CAAC;;GACF,aAAa,CA+JzB"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { AccessControlListSQL } from "./AccessControlListSQL.js";
|
|
14
|
-
import { ACLAction } from "./AccessControlList.js";
|
|
15
|
-
import { ApiError, UserUtils } from "@rapidrest/core";
|
|
16
|
-
import { DatabaseDecorators, DocDecorators, RouteDecorators } from "../decorators/index.js";
|
|
17
|
-
import { ModelRoute } from "../routes/ModelRoute.js";
|
|
18
|
-
import { RepoUtils } from "../models/index.js";
|
|
19
|
-
import { ApiErrorMessages } from "../ApiErrors.js";
|
|
20
|
-
const { Repository } = DatabaseDecorators;
|
|
21
|
-
const { Description, Returns, TypeInfo, Summary } = DocDecorators;
|
|
22
|
-
const { Auth, Delete, Get, Head, Model, Param, Post, Put, Query, Request, Response, Route, User } = RouteDecorators;
|
|
23
|
-
let ACLRouteSQL = class ACLRouteSQL extends ModelRoute {
|
|
24
|
-
constructor() {
|
|
25
|
-
super();
|
|
26
|
-
this.repoUtilsClass = RepoUtils;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The base key used to get or set data in the cache.
|
|
30
|
-
*/
|
|
31
|
-
get baseCacheKey() {
|
|
32
|
-
return "db.cache.AccessControlList";
|
|
33
|
-
}
|
|
34
|
-
create(objs, req, user) {
|
|
35
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
36
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
37
|
-
}
|
|
38
|
-
return super.doCreate(objs, { user, recordEvent: true, req });
|
|
39
|
-
}
|
|
40
|
-
updateBulk(objs, req, user) {
|
|
41
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
42
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
43
|
-
}
|
|
44
|
-
return super.doBulkUpdate(objs, { user, recordEvent: true, req });
|
|
45
|
-
}
|
|
46
|
-
count(params, query, res, user) {
|
|
47
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
48
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
49
|
-
}
|
|
50
|
-
return super.doCount({ params, query, res, user });
|
|
51
|
-
}
|
|
52
|
-
findAll(params, query, user) {
|
|
53
|
-
if (!user || !UserUtils.hasRoles(user, this.config.get("trusted_roles"))) {
|
|
54
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
55
|
-
}
|
|
56
|
-
return super.doFindAll({ params, query, user });
|
|
57
|
-
}
|
|
58
|
-
async delete(id, req, version, user) {
|
|
59
|
-
if (!user ||
|
|
60
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
61
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
62
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
63
|
-
}
|
|
64
|
-
if (id.startsWith("default_")) {
|
|
65
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
66
|
-
}
|
|
67
|
-
return super.doDelete(id, { version, user, recordEvent: true, req });
|
|
68
|
-
}
|
|
69
|
-
async findById(id, query, user) {
|
|
70
|
-
if (!user ||
|
|
71
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
72
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
73
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
74
|
-
}
|
|
75
|
-
return super.doFindById(id, { query, user });
|
|
76
|
-
}
|
|
77
|
-
async update(id, obj, req, user) {
|
|
78
|
-
if (!user ||
|
|
79
|
-
(!UserUtils.hasRoles(user, this.config.get("trusted_roles")) &&
|
|
80
|
-
!(await this.aclUtils?.hasPermission(user, id, ACLAction.FULL)))) {
|
|
81
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
82
|
-
}
|
|
83
|
-
if (id.startsWith("default_")) {
|
|
84
|
-
throw new ApiError(ApiErrorMessages.AUTH_PERMISSION_FAILURE, 403, ApiErrorMessages.AUTH_PERMISSION_FAILURE);
|
|
85
|
-
}
|
|
86
|
-
const acl = new AccessControlListSQL(obj);
|
|
87
|
-
return super.doUpdate(id, acl, { user, recordEvent: true, req });
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
__decorate([
|
|
91
|
-
Repository(AccessControlListSQL),
|
|
92
|
-
__metadata("design:type", Function)
|
|
93
|
-
], ACLRouteSQL.prototype, "repo", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
Summary("Creates Access Control Lists."),
|
|
96
|
-
Description("Creates one or more access control lists."),
|
|
97
|
-
Auth(["jwt"]),
|
|
98
|
-
Post(),
|
|
99
|
-
TypeInfo([AccessControlListSQL, [Array, AccessControlListSQL]]),
|
|
100
|
-
Returns([AccessControlListSQL, [Array, AccessControlListSQL]]),
|
|
101
|
-
__param(1, Request),
|
|
102
|
-
__param(2, User),
|
|
103
|
-
__metadata("design:type", Function),
|
|
104
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
105
|
-
__metadata("design:returntype", Promise)
|
|
106
|
-
], ACLRouteSQL.prototype, "create", null);
|
|
107
|
-
__decorate([
|
|
108
|
-
Summary("Bulk Update Access Control Lists."),
|
|
109
|
-
Description("Saves modifications for the given collection of access control lists."),
|
|
110
|
-
Auth(["jwt"]),
|
|
111
|
-
Put(),
|
|
112
|
-
TypeInfo([[Array, AccessControlListSQL]]),
|
|
113
|
-
Returns([[Array, AccessControlListSQL]]),
|
|
114
|
-
__param(1, Request),
|
|
115
|
-
__param(2, User),
|
|
116
|
-
__metadata("design:type", Function),
|
|
117
|
-
__metadata("design:paramtypes", [Array, Object, Object]),
|
|
118
|
-
__metadata("design:returntype", Promise)
|
|
119
|
-
], ACLRouteSQL.prototype, "updateBulk", null);
|
|
120
|
-
__decorate([
|
|
121
|
-
Summary("Count Access Control Lists."),
|
|
122
|
-
Description("Returns the total number of access control lists matching the given search criteria."),
|
|
123
|
-
Auth(["jwt"]),
|
|
124
|
-
Head(),
|
|
125
|
-
Returns([null]),
|
|
126
|
-
__param(0, Param()),
|
|
127
|
-
__param(1, Query()),
|
|
128
|
-
__param(2, Response),
|
|
129
|
-
__param(3, User),
|
|
130
|
-
__metadata("design:type", Function),
|
|
131
|
-
__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
132
|
-
__metadata("design:returntype", Promise)
|
|
133
|
-
], ACLRouteSQL.prototype, "count", null);
|
|
134
|
-
__decorate([
|
|
135
|
-
Summary("Find All Access Control Lists."),
|
|
136
|
-
Description("Returns a collection of access control lists matching the given search criteria."),
|
|
137
|
-
Auth(["jwt"]),
|
|
138
|
-
Get(),
|
|
139
|
-
Returns([Array, AccessControlListSQL]),
|
|
140
|
-
__param(0, Param()),
|
|
141
|
-
__param(1, Query()),
|
|
142
|
-
__param(2, User),
|
|
143
|
-
__metadata("design:type", Function),
|
|
144
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
145
|
-
__metadata("design:returntype", Promise)
|
|
146
|
-
], ACLRouteSQL.prototype, "findAll", null);
|
|
147
|
-
__decorate([
|
|
148
|
-
Summary("Delete Access Control Lists by Id."),
|
|
149
|
-
Description("Deletes the access control list with the given unique identifier and optional version."),
|
|
150
|
-
Auth(["jwt"]),
|
|
151
|
-
Delete("/:id"),
|
|
152
|
-
Returns([null]),
|
|
153
|
-
__param(0, Param("id")),
|
|
154
|
-
__param(1, Request),
|
|
155
|
-
__param(2, Query("version")),
|
|
156
|
-
__param(3, User),
|
|
157
|
-
__metadata("design:type", Function),
|
|
158
|
-
__metadata("design:paramtypes", [String, Object, String, Object]),
|
|
159
|
-
__metadata("design:returntype", Promise)
|
|
160
|
-
], ACLRouteSQL.prototype, "delete", null);
|
|
161
|
-
__decorate([
|
|
162
|
-
Summary("Find Access Control Lists by Id."),
|
|
163
|
-
Description("Returns the access control list with the given unique identifier."),
|
|
164
|
-
Auth(["jwt"]),
|
|
165
|
-
Get("/:id"),
|
|
166
|
-
Returns([AccessControlListSQL]),
|
|
167
|
-
__param(0, Param("id")),
|
|
168
|
-
__param(1, Query()),
|
|
169
|
-
__param(2, User),
|
|
170
|
-
__metadata("design:type", Function),
|
|
171
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
|
172
|
-
__metadata("design:returntype", Promise)
|
|
173
|
-
], ACLRouteSQL.prototype, "findById", null);
|
|
174
|
-
__decorate([
|
|
175
|
-
Summary("Update Access Control Lists by Id."),
|
|
176
|
-
Description("Saves modifications to existing access control list with the given unique identifier."),
|
|
177
|
-
Auth(["jwt"]),
|
|
178
|
-
Put("/:id"),
|
|
179
|
-
Returns([AccessControlListSQL]),
|
|
180
|
-
__param(0, Param("id")),
|
|
181
|
-
__param(2, Request),
|
|
182
|
-
__param(3, User),
|
|
183
|
-
__metadata("design:type", Function),
|
|
184
|
-
__metadata("design:paramtypes", [String, AccessControlListSQL, Object, Object]),
|
|
185
|
-
__metadata("design:returntype", Promise)
|
|
186
|
-
], ACLRouteSQL.prototype, "update", null);
|
|
187
|
-
ACLRouteSQL = __decorate([
|
|
188
|
-
Model(AccessControlListSQL),
|
|
189
|
-
Route("/acls"),
|
|
190
|
-
__metadata("design:paramtypes", [])
|
|
191
|
-
], ACLRouteSQL);
|
|
192
|
-
export { ACLRouteSQL };
|
|
193
|
-
//# sourceMappingURL=ACLRouteSQL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ACLRouteSQL.js","sourceRoot":"","sources":["../../../src/security/ACLRouteSQL.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,OAAO,EAAE,oBAA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F,CAAC;IACrG,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACb,MAAM,CAAC,MAAM,CAAC;IACd,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IAEX,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IACX,WAAA,OAAO,CAAA;IACP,WAAA,KAAK,CAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAI,CAAA;;;;yCAeR;AAOa;IALb,OAAO,CAAC,kCAAkC,CAAC;IAC3C,WAAW,CAAC,mEAAmE,CAAC;IAChF,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACb,GAAG,CAAC,MAAM,CAAC;IACX,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAE3B,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IACX,WAAA,KAAK,EAAE,CAAA;IACP,WAAA,IAAI,CAAA;;;;2CAWR;AAOa;IALb,OAAO,CAAC,oCAAoC,CAAC;IAC7C,WAAW,CAAC,uFAAuF,CAAC;IACpG,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACb,GAAG,CAAC,MAAM,CAAC;IACX,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAE3B,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;IAEX,WAAA,OAAO,CAAA;IACP,WAAA,IAAI,CAAA;;6CAFA,oBAAoB;;yCAkB5B;AA1JQ,WAAW;IAFvB,KAAK,CAAC,oBAAoB,CAAC;IAC3B,KAAK,CAAC,OAAO,CAAC;;GACF,WAAW,CA2JvB"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Redis } from "ioredis";
|
|
2
|
-
import Transport from "winston-transport";
|
|
3
|
-
/**
|
|
4
|
-
* Implements a Winston transport that pipes incoming log messages to a configured redis pubsub channel.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RedisTransport extends Transport {
|
|
7
|
-
private channel;
|
|
8
|
-
private redis;
|
|
9
|
-
constructor(opts: any);
|
|
10
|
-
close(): void;
|
|
11
|
-
log(info: any, next: Function): any;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The `AdminRoute` provides a default `/admin` endpoint that gives trusted users the following abilities:
|
|
15
|
-
*
|
|
16
|
-
* * Clear cache via `GET /admin/clear-cache`
|
|
17
|
-
* * Live tail the service logs via `GET /admin/logs`
|
|
18
|
-
* * Retrieve service dependencies via `GET /admin/dependencies`
|
|
19
|
-
* * Retrieve service release notes via `GET /admin/release-notes`
|
|
20
|
-
* * Restart the service via `GET /admin/restart`
|
|
21
|
-
*
|
|
22
|
-
* @author Jean-Philippe Steinmetz
|
|
23
|
-
*/
|
|
24
|
-
export declare class AdminRoute {
|
|
25
|
-
/** A map of user uid's to active sockets. */
|
|
26
|
-
private activeSockets;
|
|
27
|
-
protected cacheClient?: Redis;
|
|
28
|
-
private cacheConnConfig;
|
|
29
|
-
private logger;
|
|
30
|
-
private logsConnConfig;
|
|
31
|
-
private redisClient?;
|
|
32
|
-
/** The underlying ReleaseNotes specification. */
|
|
33
|
-
private releaseNotes;
|
|
34
|
-
private serviceName?;
|
|
35
|
-
private trustedRoles;
|
|
36
|
-
/**
|
|
37
|
-
* Constructs a new `ReleaseNotesRoute` object with the specified defaults.
|
|
38
|
-
*
|
|
39
|
-
* @param releaseNotes The ReleaseNotes specification object to serve.
|
|
40
|
-
*/
|
|
41
|
-
constructor(releaseNotes: string);
|
|
42
|
-
private init;
|
|
43
|
-
private clearCache;
|
|
44
|
-
private logs;
|
|
45
|
-
private get;
|
|
46
|
-
private restart;
|
|
47
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handles all REST API requests for the endpoint `/metrics'. This route handler produces Prometheus compatible metrics
|
|
3
|
-
* for use with a Prometheus based server.
|
|
4
|
-
*
|
|
5
|
-
* Services that wish to provide metrics to be exposed via this route can register them using the global registry
|
|
6
|
-
* from the provided `prom-client` dependency. See the `prom-client` documentation for more details.
|
|
7
|
-
*/
|
|
8
|
-
export declare class MetricsRoute {
|
|
9
|
-
private metricsConfig;
|
|
10
|
-
private registry;
|
|
11
|
-
private trustedRoles;
|
|
12
|
-
constructor();
|
|
13
|
-
private getMetrics;
|
|
14
|
-
private getSingleMetric;
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `OpenAPIRoute` provides default routes to expose the service's OpenAPI specification.
|
|
3
|
-
*
|
|
4
|
-
* - `GET /` — Swagger UI HTML (loads swagger-ui-dist from CDN)
|
|
5
|
-
* - `GET /openapi.json` — raw OpenAPI specification as JSON
|
|
6
|
-
* - `GET /openapi.yaml` — raw OpenAPI specification as YAML
|
|
7
|
-
*
|
|
8
|
-
* @author Jean-Philippe Steinmetz
|
|
9
|
-
*/
|
|
10
|
-
export declare class OpenAPIRoute {
|
|
11
|
-
/** The underlying OpenAPI specification. */
|
|
12
|
-
private apiSpec;
|
|
13
|
-
getHTML(): string;
|
|
14
|
-
getAPIDocs(): string;
|
|
15
|
-
getJSON(): any;
|
|
16
|
-
getYAML(): string;
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `StatusRoute` provides a default `/status` endpoint the returns metadata information about the service such as
|
|
3
|
-
* name, version.
|
|
4
|
-
*
|
|
5
|
-
* @author Jean-Philippe Steinmetz
|
|
6
|
-
*/
|
|
7
|
-
export declare class StatusRoute {
|
|
8
|
-
private config;
|
|
9
|
-
private statusExtraData;
|
|
10
|
-
private get;
|
|
11
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AccessControlListMongo } from "./AccessControlListMongo.js";
|
|
2
|
-
import { MongoRepository as Repo } from "../database/MongoRepository.js";
|
|
3
|
-
import { ModelRoute } from "../routes/ModelRoute.js";
|
|
4
|
-
export declare class ACLRouteMongo extends ModelRoute<AccessControlListMongo> {
|
|
5
|
-
protected repo?: Repo<AccessControlListMongo>;
|
|
6
|
-
protected readonly repoUtilsClass: any;
|
|
7
|
-
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* The base key used to get or set data in the cache.
|
|
10
|
-
*/
|
|
11
|
-
protected get baseCacheKey(): string;
|
|
12
|
-
private create;
|
|
13
|
-
private updateBulk;
|
|
14
|
-
private count;
|
|
15
|
-
private findAll;
|
|
16
|
-
private delete;
|
|
17
|
-
private findById;
|
|
18
|
-
private update;
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AccessControlListSQL } from "./AccessControlListSQL.js";
|
|
2
|
-
import type { Repository as Repo } from "typeorm";
|
|
3
|
-
import { ModelRoute } from "../routes/ModelRoute.js";
|
|
4
|
-
export declare class ACLRouteSQL extends ModelRoute<AccessControlListSQL> {
|
|
5
|
-
protected repo?: Repo<AccessControlListSQL>;
|
|
6
|
-
protected readonly repoUtilsClass: any;
|
|
7
|
-
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* The base key used to get or set data in the cache.
|
|
10
|
-
*/
|
|
11
|
-
protected get baseCacheKey(): string;
|
|
12
|
-
private create;
|
|
13
|
-
private updateBulk;
|
|
14
|
-
private count;
|
|
15
|
-
private findAll;
|
|
16
|
-
private delete;
|
|
17
|
-
private findById;
|
|
18
|
-
private update;
|
|
19
|
-
}
|
package/docs/Makefile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Minimal makefile for Sphinx documentation
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
# You can set these variables from the command line, and also
|
|
5
|
-
# from the environment for the first two.
|
|
6
|
-
SPHINXOPTS ?=
|
|
7
|
-
SPHINXBUILD ?= sphinx-build
|
|
8
|
-
SOURCEDIR = .
|
|
9
|
-
BUILDDIR = _build
|
|
10
|
-
|
|
11
|
-
# Put it first so that "make" without argument is like "make help".
|
|
12
|
-
help:
|
|
13
|
-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
-
|
|
15
|
-
.PHONY: help Makefile
|
|
16
|
-
|
|
17
|
-
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
-
%: Makefile
|
|
20
|
-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
package/docs/conf.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Configuration file for the Sphinx documentation builder.
|
|
2
|
-
#
|
|
3
|
-
# This file only contains a selection of the most common options. For a full
|
|
4
|
-
# list see the documentation:
|
|
5
|
-
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
6
|
-
|
|
7
|
-
# -- Path setup --------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
# If extensions (or modules to document with autodoc) are in another directory,
|
|
10
|
-
# add these directories to sys.path here. If the directory is relative to the
|
|
11
|
-
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
12
|
-
#
|
|
13
|
-
# import os
|
|
14
|
-
# import sys
|
|
15
|
-
# sys.path.insert(0, os.path.abspath('.'))
|
|
16
|
-
import recommonmark
|
|
17
|
-
from recommonmark.transform import AutoStructify
|
|
18
|
-
|
|
19
|
-
source_suffix = ['.rst', '.md']
|
|
20
|
-
|
|
21
|
-
# -- Project information -----------------------------------------------------
|
|
22
|
-
|
|
23
|
-
project = 'Core Library'
|
|
24
|
-
copyright = 'RapidREST All rights reserved.'
|
|
25
|
-
author = 'RapidREST'
|
|
26
|
-
|
|
27
|
-
# -- General configuration ---------------------------------------------------
|
|
28
|
-
|
|
29
|
-
# Add any Sphinx extension module names here, as strings. They can be
|
|
30
|
-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
31
|
-
# ones.
|
|
32
|
-
extensions = [
|
|
33
|
-
'recommonmark',
|
|
34
|
-
'sphinx.ext.autodoc',
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
# List of patterns, relative to source directory, that match files and
|
|
38
|
-
# directories to ignore when looking for source files.
|
|
39
|
-
# This pattern also affects html_static_path and html_extra_path.
|
|
40
|
-
exclude_patterns = []
|
|
41
|
-
|
|
42
|
-
master_doc = 'index'
|
|
43
|
-
|
|
44
|
-
# Add any paths that contain custom static files (such as style sheets) here,
|
|
45
|
-
# relative to this directory. They are copied after the builtin static files,
|
|
46
|
-
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
47
|
-
html_static_path = ['_static']
|
|
48
|
-
|
|
49
|
-
# app setup hook
|
|
50
|
-
def setup(app):
|
|
51
|
-
app.add_config_value('recommonmark_config', {
|
|
52
|
-
'auto_toc_tree_section': 'Contents',
|
|
53
|
-
'enable_math': False,
|
|
54
|
-
'enable_inline_math': False,
|
|
55
|
-
'enable_eval_rst': True,
|
|
56
|
-
'enable_auto_doc_ref': True,
|
|
57
|
-
}, True)
|
|
58
|
-
app.add_transform(AutoStructify)
|
package/docs/index.rst
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
===============================================================================
|
|
2
|
-
Services Core Library
|
|
3
|
-
===============================================================================
|
|
4
|
-
|
|
5
|
-
Repository: ``git clone https://github.com/rapidrest/service-core.git``
|
|
6
|
-
|
|
7
|
-
Provides all core functionality for RapidREST based backend services.
|
|
8
|
-
|
|
9
|
-
.. toctree::
|
|
10
|
-
:caption: Project Info
|
|
11
|
-
|
|
12
|
-
reference/README
|
|
13
|
-
|
|
14
|
-
.. toctree::
|
|
15
|
-
:caption: API Reference
|
|
16
|
-
|
|
17
|
-
reference/globals
|