@nmshd/connector-types 6.33.2 → 6.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/AbstractConnectorRuntime.d.ts +2 -0
  2. package/dist/AbstractConnectorRuntime.d.ts.map +1 -1
  3. package/dist/AbstractConnectorRuntime.js.map +1 -1
  4. package/dist/ConnectorRuntimeBuildInformation.d.ts +15 -0
  5. package/dist/ConnectorRuntimeBuildInformation.d.ts.map +1 -0
  6. package/dist/ConnectorRuntimeBuildInformation.js +3 -0
  7. package/dist/ConnectorRuntimeBuildInformation.js.map +1 -0
  8. package/dist/ConnectorRuntimeModule.d.ts +2 -0
  9. package/dist/ConnectorRuntimeModule.d.ts.map +1 -1
  10. package/dist/ConnectorRuntimeModule.js +4 -0
  11. package/dist/ConnectorRuntimeModule.js.map +1 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/infrastructure/httpServer/HttpServerRole.d.ts +6 -0
  17. package/dist/infrastructure/httpServer/HttpServerRole.d.ts.map +1 -0
  18. package/dist/infrastructure/httpServer/HttpServerRole.js +10 -0
  19. package/dist/infrastructure/httpServer/HttpServerRole.js.map +1 -0
  20. package/dist/infrastructure/httpServer/common/HttpErrors.d.ts +1 -0
  21. package/dist/infrastructure/httpServer/common/HttpErrors.d.ts.map +1 -1
  22. package/dist/infrastructure/httpServer/common/HttpErrors.js +3 -0
  23. package/dist/infrastructure/httpServer/common/HttpErrors.js.map +1 -1
  24. package/dist/infrastructure/httpServer/globals.d.ts +9 -0
  25. package/dist/infrastructure/httpServer/globals.d.ts.map +1 -0
  26. package/dist/infrastructure/httpServer/globals.js +3 -0
  27. package/dist/infrastructure/httpServer/globals.js.map +1 -0
  28. package/dist/infrastructure/httpServer/index.d.ts +3 -0
  29. package/dist/infrastructure/httpServer/index.d.ts.map +1 -1
  30. package/dist/infrastructure/httpServer/index.js +3 -0
  31. package/dist/infrastructure/httpServer/index.js.map +1 -1
  32. package/dist/infrastructure/httpServer/middlewares/index.d.ts +2 -0
  33. package/dist/infrastructure/httpServer/middlewares/index.d.ts.map +1 -0
  34. package/dist/infrastructure/httpServer/middlewares/index.js +18 -0
  35. package/dist/infrastructure/httpServer/middlewares/index.js.map +1 -0
  36. package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.d.ts +3 -0
  37. package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.d.ts.map +1 -0
  38. package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.js +18 -0
  39. package/dist/infrastructure/httpServer/middlewares/routeRequiresRoles.js.map +1 -0
  40. package/package.json +26 -6
@@ -1,5 +1,6 @@
1
1
  import { IDatabaseConnection } from "@js-soft/docdb-access-abstractions";
2
2
  import { Runtime, RuntimeConfig, RuntimeServices } from "@nmshd/runtime";
3
+ import { ConnectorRuntimeBuildInformation } from "./ConnectorRuntimeBuildInformation";
3
4
  import { IConnectorInfrastructureRegistry } from "./infrastructure";
4
5
  export interface ConnectorRuntimeConfig extends RuntimeConfig {
5
6
  database: {
@@ -10,6 +11,7 @@ export interface ConnectorRuntimeConfig extends RuntimeConfig {
10
11
  export declare abstract class AbstractConnectorRuntime<TConfig extends ConnectorRuntimeConfig = ConnectorRuntimeConfig> extends Runtime<TConfig> {
11
12
  abstract getServices(): RuntimeServices;
12
13
  abstract getBackboneAuthenticationToken(): Promise<string>;
14
+ abstract getBuildInformation(): ConnectorRuntimeBuildInformation;
13
15
  abstract readonly infrastructure: IConnectorInfrastructureRegistry;
14
16
  databaseConnection: IDatabaseConnection;
15
17
  readonly runtimeConfig: TConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractConnectorRuntime.d.ts","sourceRoot":"","sources":["../src/AbstractConnectorRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAEpE,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IACzD,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,8BAAsB,wBAAwB,CAAC,OAAO,SAAS,sBAAsB,GAAG,sBAAsB,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;aAC3G,WAAW,IAAI,eAAe;aACvC,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC;IACjE,kBAAyB,cAAc,EAAE,gCAAgC,CAAC;IAE1D,kBAAkB,EAAE,mBAAmB,CAAC;IACxD,SAAyB,aAAa,EAAE,OAAO,CAAC;CACnD"}
1
+ {"version":3,"file":"AbstractConnectorRuntime.d.ts","sourceRoot":"","sources":["../src/AbstractConnectorRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAEpE,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IACzD,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,8BAAsB,wBAAwB,CAAC,OAAO,SAAS,sBAAsB,GAAG,sBAAsB,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;aAC3G,WAAW,IAAI,eAAe;aACvC,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC;aACjD,mBAAmB,IAAI,gCAAgC;IACvE,kBAAyB,cAAc,EAAE,gCAAgC,CAAC;IAE1D,kBAAkB,EAAE,mBAAmB,CAAC;IACxD,SAAyB,aAAa,EAAE,OAAO,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractConnectorRuntime.js","sourceRoot":"","sources":["../src/AbstractConnectorRuntime.ts"],"names":[],"mappings":";;;AACA,4CAAyE;AAOzE,MAAsB,wBAA0F,SAAQ,iBAAgB;CAOvI;AAPD,4DAOC"}
1
+ {"version":3,"file":"AbstractConnectorRuntime.js","sourceRoot":"","sources":["../src/AbstractConnectorRuntime.ts"],"names":[],"mappings":";;;AACA,4CAAyE;AAQzE,MAAsB,wBAA0F,SAAQ,iBAAgB;CAQvI;AARD,4DAQC"}
@@ -0,0 +1,15 @@
1
+ export interface ConnectorRuntimeBuildInformation {
2
+ version: string;
3
+ build: string;
4
+ date: string;
5
+ commit: string;
6
+ runtimeVersion: string;
7
+ modules: Record<string, ConnectorRuntimeModuleBuildInformation>;
8
+ }
9
+ export interface ConnectorRuntimeModuleBuildInformation {
10
+ version: string;
11
+ build: string;
12
+ date: string;
13
+ commit: string;
14
+ }
15
+ //# sourceMappingURL=ConnectorRuntimeBuildInformation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectorRuntimeBuildInformation.d.ts","sourceRoot":"","sources":["../src/ConnectorRuntimeBuildInformation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gCAAgC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sCAAsC,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,sCAAsC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ConnectorRuntimeBuildInformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectorRuntimeBuildInformation.js","sourceRoot":"","sources":["../src/ConnectorRuntimeBuildInformation.ts"],"names":[],"mappings":""}
@@ -2,11 +2,13 @@ import { ILogger } from "@js-soft/logging-abstractions";
2
2
  import { ModuleConfiguration, RuntimeModule } from "@nmshd/runtime";
3
3
  import { AbstractConnectorRuntime } from "./AbstractConnectorRuntime";
4
4
  import { ConnectorMode } from "./ConnectorMode";
5
+ import { ConnectorRuntimeModuleBuildInformation } from "./ConnectorRuntimeBuildInformation";
5
6
  export interface ConnectorRuntimeModuleConfiguration extends ModuleConfiguration {
6
7
  requiredInfrastructure?: string[];
7
8
  }
8
9
  export declare abstract class ConnectorRuntimeModule<TConfig extends ConnectorRuntimeModuleConfiguration = ConnectorRuntimeModuleConfiguration> extends RuntimeModule<TConfig, AbstractConnectorRuntime> {
9
10
  protected readonly connectorMode: ConnectorMode;
10
11
  constructor(runtime: AbstractConnectorRuntime, configuration: TConfig, logger: ILogger, connectorMode: ConnectorMode);
12
+ getBuildInformation(): ConnectorRuntimeModuleBuildInformation | undefined;
11
13
  }
12
14
  //# sourceMappingURL=ConnectorRuntimeModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectorRuntimeModule.d.ts","sourceRoot":"","sources":["../src/ConnectorRuntimeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,mCAAoC,SAAQ,mBAAmB;IAC5E,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,8BAAsB,sBAAsB,CAAC,OAAO,SAAS,mCAAmC,GAAG,mCAAmC,CAAE,SAAQ,aAAa,CACzJ,OAAO,EACP,wBAAwB,CAC3B;IAKO,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa;gBAH/C,OAAO,EAAE,wBAAwB,EACjC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,OAAO,EACI,aAAa,EAAE,aAAa;CAItD"}
1
+ {"version":3,"file":"ConnectorRuntimeModule.d.ts","sourceRoot":"","sources":["../src/ConnectorRuntimeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sCAAsC,EAAE,MAAM,oCAAoC,CAAC;AAE5F,MAAM,WAAW,mCAAoC,SAAQ,mBAAmB;IAC5E,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,8BAAsB,sBAAsB,CAAC,OAAO,SAAS,mCAAmC,GAAG,mCAAmC,CAAE,SAAQ,aAAa,CACzJ,OAAO,EACP,wBAAwB,CAC3B;IAKO,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa;gBAH/C,OAAO,EAAE,wBAAwB,EACjC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,OAAO,EACI,aAAa,EAAE,aAAa;IAK5C,mBAAmB,IAAI,sCAAsC,GAAG,SAAS;CAInF"}
@@ -7,6 +7,10 @@ class ConnectorRuntimeModule extends runtime_1.RuntimeModule {
7
7
  super(runtime, configuration, logger);
8
8
  this.connectorMode = connectorMode;
9
9
  }
10
+ getBuildInformation() {
11
+ // This method can be overridden by subclasses to provide module-specific build information
12
+ return undefined;
13
+ }
10
14
  }
11
15
  exports.ConnectorRuntimeModule = ConnectorRuntimeModule;
12
16
  //# sourceMappingURL=ConnectorRuntimeModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectorRuntimeModule.js","sourceRoot":"","sources":["../src/ConnectorRuntimeModule.ts"],"names":[],"mappings":";;;AACA,4CAAoE;AAQpE,MAAsB,sBAAkH,SAAQ,uBAG/I;IACG,YACI,OAAiC,EACjC,aAAsB,EACtB,MAAe,EACI,aAA4B;QAE/C,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAFnB,kBAAa,GAAb,aAAa,CAAe;IAGnD,CAAC;CACJ;AAZD,wDAYC"}
1
+ {"version":3,"file":"ConnectorRuntimeModule.js","sourceRoot":"","sources":["../src/ConnectorRuntimeModule.ts"],"names":[],"mappings":";;;AACA,4CAAoE;AASpE,MAAsB,sBAAkH,SAAQ,uBAG/I;IACG,YACI,OAAiC,EACjC,aAAsB,EACtB,MAAe,EACI,aAA4B;QAE/C,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAFnB,kBAAa,GAAb,aAAa,CAAe;IAGnD,CAAC;IAEM,mBAAmB;QACtB,2FAA2F;QAC3F,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAjBD,wDAiBC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./AbstractConnectorRuntime";
2
2
  export * from "./ConnectorMode";
3
+ export * from "./ConnectorRuntimeBuildInformation";
3
4
  export * from "./ConnectorRuntimeModule";
4
5
  export * from "./DocumentationLink";
5
6
  export * from "./infrastructure";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AbstractConnectorRuntime"), exports);
18
18
  __exportStar(require("./ConnectorMode"), exports);
19
+ __exportStar(require("./ConnectorRuntimeBuildInformation"), exports);
19
20
  __exportStar(require("./ConnectorRuntimeModule"), exports);
20
21
  __exportStar(require("./DocumentationLink"), exports);
21
22
  __exportStar(require("./infrastructure"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,kDAAgC;AAChC,2DAAyC;AACzC,sDAAoC;AACpC,mDAAiC;AACjC,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,kDAAgC;AAChC,qEAAmD;AACnD,2DAAyC;AACzC,sDAAoC;AACpC,mDAAiC;AACjC,2CAAyB"}
@@ -0,0 +1,6 @@
1
+ export declare enum HttpServerRole {
2
+ ADMIN = "admin",
3
+ DEVELOPER = "developer",
4
+ MONITORING = "monitoring"
5
+ }
6
+ //# sourceMappingURL=HttpServerRole.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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,6 +1,7 @@
1
1
  import { HttpError } from "./HttpError";
2
2
  export declare class HttpErrors {
3
3
  static unauthorized(): HttpError;
4
+ static forbidden(): HttpError;
4
5
  static invalidJsonInPayload(): HttpError;
5
6
  static routeDoesNotExist(): HttpError;
6
7
  static methodNotAllowed(): HttpError;
@@ -1 +1 @@
1
- {"version":3,"file":"HttpErrors.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/common/HttpErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,UAAU;WACL,YAAY,IAAI,SAAS;WAIzB,oBAAoB,IAAI,SAAS;WAIjC,iBAAiB,IAAI,SAAS;WAI9B,gBAAgB,IAAI,SAAS;WAI7B,aAAa,IAAI,SAAS;CAM3C"}
1
+ {"version":3,"file":"HttpErrors.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/common/HttpErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,UAAU;WACL,YAAY,IAAI,SAAS;WAIzB,SAAS,IAAI,SAAS;WAItB,oBAAoB,IAAI,SAAS;WAIjC,iBAAiB,IAAI,SAAS;WAI9B,gBAAgB,IAAI,SAAS;WAI7B,aAAa,IAAI,SAAS;CAM3C"}
@@ -6,6 +6,9 @@ class HttpErrors {
6
6
  static unauthorized() {
7
7
  return new HttpError_1.HttpError("error.connector.unauthorized", "Unauthorized.");
8
8
  }
9
+ static forbidden() {
10
+ return new HttpError_1.HttpError("error.connector.forbidden", "You are not allowed to access this endpoint.");
11
+ }
9
12
  static invalidJsonInPayload() {
10
13
  return new HttpError_1.HttpError("error.connector.validation.invalidJsonInPayload", "The given payload is not a valid json object.");
11
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"HttpErrors.js","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/common/HttpErrors.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAExC,MAAa,UAAU;IACZ,MAAM,CAAC,YAAY;QACtB,OAAO,IAAI,qBAAS,CAAC,8BAA8B,EAAE,eAAe,CAAC,CAAC;IAC1E,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAC9B,OAAO,IAAI,qBAAS,CAAC,iDAAiD,EAAE,+CAA+C,CAAC,CAAC;IAC7H,CAAC;IAEM,MAAM,CAAC,iBAAiB;QAC3B,OAAO,IAAI,qBAAS,CAAC,wCAAwC,EAAE,qCAAqC,CAAC,CAAC;IAC1G,CAAC;IAEM,MAAM,CAAC,gBAAgB;QAC1B,OAAO,IAAI,qBAAS,CAAC,uCAAuC,EAAE,iEAAiE,CAAC,CAAC;IACrI,CAAC;IAEM,MAAM,CAAC,aAAa;QACvB,OAAO,IAAI,qBAAS,CAChB,oCAAoC,EACpC,kIAAkI,CACrI,CAAC;IACN,CAAC;CACJ;AAvBD,gCAuBC"}
1
+ {"version":3,"file":"HttpErrors.js","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/common/HttpErrors.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAExC,MAAa,UAAU;IACZ,MAAM,CAAC,YAAY;QACtB,OAAO,IAAI,qBAAS,CAAC,8BAA8B,EAAE,eAAe,CAAC,CAAC;IAC1E,CAAC;IAEM,MAAM,CAAC,SAAS;QACnB,OAAO,IAAI,qBAAS,CAAC,2BAA2B,EAAE,8CAA8C,CAAC,CAAC;IACtG,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAC9B,OAAO,IAAI,qBAAS,CAAC,iDAAiD,EAAE,+CAA+C,CAAC,CAAC;IAC7H,CAAC;IAEM,MAAM,CAAC,iBAAiB;QAC3B,OAAO,IAAI,qBAAS,CAAC,wCAAwC,EAAE,qCAAqC,CAAC,CAAC;IAC1G,CAAC;IAEM,MAAM,CAAC,gBAAgB;QAC1B,OAAO,IAAI,qBAAS,CAAC,uCAAuC,EAAE,iEAAiE,CAAC,CAAC;IACrI,CAAC;IAEM,MAAM,CAAC,aAAa;QACvB,OAAO,IAAI,qBAAS,CAChB,oCAAoC,EACpC,kIAAkI,CACrI,CAAC;IACN,CAAC;CACJ;AA3BD,gCA2BC"}
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ namespace Express {
3
+ interface Request {
4
+ userRoles?: string[];
5
+ }
6
+ }
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/globals.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,OAAO,CAAC;QACd,UAAU,OAAO;YACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;SACxB;KACJ;CACJ;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/globals.ts"],"names":[],"mappings":""}
@@ -1,5 +1,8 @@
1
1
  export * from "./BaseController";
2
2
  export * from "./common";
3
+ export * from "./globals";
3
4
  export * from "./HttpMethod";
5
+ export * from "./HttpServerRole";
4
6
  export * from "./IHttpServer";
7
+ export * from "./middlewares";
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -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,cAAc,CAAC;AAC7B,cAAc,eAAe,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,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -16,6 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BaseController"), exports);
18
18
  __exportStar(require("./common"), exports);
19
+ __exportStar(require("./globals"), exports);
19
20
  __exportStar(require("./HttpMethod"), exports);
21
+ __exportStar(require("./HttpServerRole"), exports);
20
22
  __exportStar(require("./IHttpServer"), exports);
23
+ __exportStar(require("./middlewares"), exports);
21
24
  //# 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,+CAA6B;AAC7B,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,mDAAiC;AACjC,gDAA8B;AAC9B,gDAA8B"}
@@ -0,0 +1,2 @@
1
+ export * from "./routeRequiresRoles";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/infrastructure/httpServer/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
@@ -0,0 +1,3 @@
1
+ import express from "express";
2
+ export declare function routeRequiresRoles(...requiredRoles: [string, ...string[]]): (req: express.Request, _: express.Response, next: express.NextFunction) => void;
3
+ //# sourceMappingURL=routeRequiresRoles.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
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"}
package/package.json CHANGED
@@ -22,7 +22,30 @@
22
22
  "scripts": {
23
23
  "build": "tsc",
24
24
  "build:ci": "tsc",
25
- "build:watch": "tsc --watch"
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
+ }
46
+ },
47
+ "dependencies": {
48
+ "qrcode": "^1.5.4"
26
49
  },
27
50
  "devDependencies": {
28
51
  "@js-soft/logging-abstractions": "^1.0.1",
@@ -35,7 +58,7 @@
35
58
  "peerDependencies": {
36
59
  "@js-soft/docdb-access-abstractions": "^1.2.0",
37
60
  "@js-soft/ts-utils": "^2.3.3",
38
- "@nmshd/runtime": "^6.60.4",
61
+ "@nmshd/runtime": "^6.60.5",
39
62
  "@nmshd/typescript-rest": "^3.1.5",
40
63
  "express": "^5.1.0"
41
64
  },
@@ -43,8 +66,5 @@
43
66
  "access": "public",
44
67
  "provenance": true
45
68
  },
46
- "dependencies": {
47
- "qrcode": "^1.5.4"
48
- },
49
- "version": "6.33.2"
69
+ "version": "6.35.0"
50
70
  }