@nmshd/connector-types 7.0.0-alpha.23 → 7.0.0-alpha.24
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/infrastructure/httpServer/index.d.ts +0 -2
- package/dist/infrastructure/httpServer/index.d.ts.map +1 -1
- package/dist/infrastructure/httpServer/index.js +0 -2
- package/dist/infrastructure/httpServer/index.js.map +1 -1
- package/package.json +2 -22
- package/dist/infrastructure/httpServer/HttpServerRole.d.ts +0 -6
- package/dist/infrastructure/httpServer/HttpServerRole.d.ts.map +0 -1
- package/dist/infrastructure/httpServer/HttpServerRole.js +0 -10
- package/dist/infrastructure/httpServer/HttpServerRole.js.map +0 -1
- package/dist/infrastructure/httpServer/middlewares/index.d.ts +0 -2
- package/dist/infrastructure/httpServer/middlewares/index.d.ts.map +0 -1
- package/dist/infrastructure/httpServer/middlewares/index.js +0 -18
- package/dist/infrastructure/httpServer/middlewares/index.js.map +0 -1
- package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.d.ts +0 -3
- package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.d.ts.map +0 -1
- package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.js +0 -18
- package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -18,7 +18,5 @@ __exportStar(require("./BaseController"), exports);
|
|
|
18
18
|
__exportStar(require("./common"), exports);
|
|
19
19
|
__exportStar(require("./globals"), exports);
|
|
20
20
|
__exportStar(require("./HttpMethod"), exports);
|
|
21
|
-
__exportStar(require("./HttpServerRole"), exports);
|
|
22
21
|
__exportStar(require("./IHttpServer"), exports);
|
|
23
|
-
__exportStar(require("./middlewares"), exports);
|
|
24
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,gDAA8B"}
|
package/package.json
CHANGED
|
@@ -22,27 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"build:ci": "tsc",
|
|
25
|
-
"build:watch": "tsc --watch"
|
|
26
|
-
"test": "jest -i",
|
|
27
|
-
"test:ci": "npm run test",
|
|
28
|
-
"test:local": "npm run test"
|
|
29
|
-
},
|
|
30
|
-
"jest": {
|
|
31
|
-
"maxWorkers": 2,
|
|
32
|
-
"preset": "ts-jest",
|
|
33
|
-
"testEnvironment": "node",
|
|
34
|
-
"testPathIgnorePatterns": [
|
|
35
|
-
"/node_modules/"
|
|
36
|
-
],
|
|
37
|
-
"testTimeout": 60000,
|
|
38
|
-
"transform": {
|
|
39
|
-
"^.+\\.ts$": [
|
|
40
|
-
"ts-jest",
|
|
41
|
-
{
|
|
42
|
-
"tsconfig": "test/tsconfig.json"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
25
|
+
"build:watch": "tsc --watch"
|
|
46
26
|
},
|
|
47
27
|
"dependencies": {
|
|
48
28
|
"qrcode": "^1.5.4"
|
|
@@ -66,5 +46,5 @@
|
|
|
66
46
|
"access": "public",
|
|
67
47
|
"provenance": true
|
|
68
48
|
},
|
|
69
|
-
"version": "7.0.0-alpha.
|
|
49
|
+
"version": "7.0.0-alpha.24"
|
|
70
50
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpServerRole.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/HttpServerRole.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,UAAU,eAAe;CAC5B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpServerRole = void 0;
|
|
4
|
-
var HttpServerRole;
|
|
5
|
-
(function (HttpServerRole) {
|
|
6
|
-
HttpServerRole["ADMIN"] = "admin";
|
|
7
|
-
HttpServerRole["DEVELOPER"] = "developer";
|
|
8
|
-
HttpServerRole["MONITORING"] = "monitoring";
|
|
9
|
-
})(HttpServerRole || (exports.HttpServerRole = HttpServerRole = {}));
|
|
10
|
-
//# sourceMappingURL=HttpServerRole.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpServerRole.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/HttpServerRole.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACtB,iCAAe,CAAA;IACf,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;AAC7B,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./routeRequiresRoles"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeRequiresRoles.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/routeRequiresRoles.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,wBAAgB,kBAAkB,CAAC,GAAG,aAAa,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,IAG9D,KAAK,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,KAAG,IAAI,CAUvF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.routeRequiresRoles = routeRequiresRoles;
|
|
4
|
-
const typescript_rest_1 = require("@nmshd/typescript-rest");
|
|
5
|
-
function routeRequiresRoles(...requiredRoles) {
|
|
6
|
-
if (requiredRoles.length === 0)
|
|
7
|
-
throw new Error("At least one role must be specified.");
|
|
8
|
-
return (req, _, next) => {
|
|
9
|
-
const userRoles = req.userRoles;
|
|
10
|
-
const hasRole = userRoles && Array.isArray(userRoles) && requiredRoles.some((role) => userRoles.includes(role));
|
|
11
|
-
if (!hasRole) {
|
|
12
|
-
next(new typescript_rest_1.Errors.ForbiddenError("You are not allowed to access this endpoint."));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
next();
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=routeRequiresRoles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeRequiresRoles.js","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/routeRequiresRoles.ts"],"names":[],"mappings":";;AAGA,gDAaC;AAhBD,4DAAgD;AAGhD,SAAgB,kBAAkB,CAAC,GAAG,aAAoC;IACtE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAExF,OAAO,CAAC,GAAoB,EAAE,CAAmB,EAAE,IAA0B,EAAQ,EAAE;QACnF,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAChC,MAAM,OAAO,GAAG,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAChH,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,IAAI,CAAC,IAAI,wBAAM,CAAC,cAAc,CAAC,8CAA8C,CAAC,CAAC,CAAC;YAChF,OAAO;QACX,CAAC;QAED,IAAI,EAAE,CAAC;IACX,CAAC,CAAC;AACN,CAAC"}
|