@nmshd/runtime 2.0.0-alpha.5 → 2.0.0-alpha.6
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/Runtime.d.ts +10 -10
- package/dist/Runtime.js +21 -19
- package/dist/Runtime.js.map +1 -1
- package/dist/buildInformation.js +4 -4
- package/dist/extensibility/modules/RuntimeModule.d.ts +8 -3
- package/dist/extensibility/modules/RuntimeModule.js +16 -0
- package/dist/extensibility/modules/RuntimeModule.js.map +1 -1
- package/dist/modules/DeciderModule.d.ts +7 -0
- package/dist/modules/DeciderModule.js +29 -0
- package/dist/modules/DeciderModule.js.map +1 -0
- package/dist/modules/MessageModule.d.ts +1 -2
- package/dist/modules/MessageModule.js +6 -4
- package/dist/modules/MessageModule.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/lib-web/nmshd.runtime.js +87 -27
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +1 -1
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +2 -1
package/dist/Runtime.d.ts
CHANGED
|
@@ -2,32 +2,32 @@ import { IDatabaseConnection } from "@js-soft/docdb-access-abstractions";
|
|
|
2
2
|
import { ILogger, ILoggerFactory } from "@js-soft/logging-abstractions";
|
|
3
3
|
import { EventBus } from "@js-soft/ts-utils";
|
|
4
4
|
import { ConsumptionController } from "@nmshd/consumption";
|
|
5
|
-
import { AccountController, Transport } from "@nmshd/transport";
|
|
5
|
+
import { AccountController, ICoreAddress, Transport } from "@nmshd/transport";
|
|
6
6
|
import { DataViewExpander } from "./dataViews";
|
|
7
7
|
import { AnonymousServices, ConsumptionServices, ModuleConfiguration, RuntimeModule, RuntimeModuleRegistry, TransportServices } from "./extensibility";
|
|
8
8
|
import { RuntimeConfig } from "./RuntimeConfig";
|
|
9
9
|
import { RuntimeHealth } from "./types";
|
|
10
|
+
export interface RuntimeServices {
|
|
11
|
+
transportServices: TransportServices;
|
|
12
|
+
consumptionServices: ConsumptionServices;
|
|
13
|
+
dataViewExpander: DataViewExpander;
|
|
14
|
+
}
|
|
10
15
|
export declare abstract class Runtime<TConfig extends RuntimeConfig = RuntimeConfig> {
|
|
11
16
|
protected logger: ILogger;
|
|
12
17
|
protected loggerFactory: ILoggerFactory;
|
|
13
18
|
protected runtimeConfig: TConfig;
|
|
14
19
|
protected transport: Transport;
|
|
20
|
+
private _anonymousServices;
|
|
21
|
+
get anonymousServices(): AnonymousServices;
|
|
15
22
|
private _accountController?;
|
|
16
23
|
private _consumptionController?;
|
|
17
|
-
private _expander?;
|
|
18
24
|
protected isLoggedIn(): boolean;
|
|
19
25
|
protected getAccountController(): AccountController;
|
|
20
26
|
protected getConsumptionController(): ConsumptionController;
|
|
21
|
-
protected
|
|
22
|
-
protected login(accountController: AccountController, consumptionController: ConsumptionController): Promise<this>;
|
|
27
|
+
protected login(accountController: AccountController, consumptionController: ConsumptionController): Promise<RuntimeServices>;
|
|
23
28
|
private _modules;
|
|
24
29
|
get modules(): RuntimeModuleRegistry;
|
|
25
|
-
|
|
26
|
-
get transportServices(): TransportServices;
|
|
27
|
-
private _consumptionServices;
|
|
28
|
-
get consumptionServices(): ConsumptionServices;
|
|
29
|
-
private _anonymousServices;
|
|
30
|
-
get anonymousServices(): AnonymousServices;
|
|
30
|
+
abstract getServices(address: string | ICoreAddress): RuntimeServices;
|
|
31
31
|
private readonly _eventBus;
|
|
32
32
|
get eventBus(): EventBus;
|
|
33
33
|
constructor(config: TConfig);
|
package/dist/Runtime.js
CHANGED
|
@@ -9,6 +9,7 @@ const DatabaseSchemaUpgrader_1 = require("./DatabaseSchemaUpgrader");
|
|
|
9
9
|
const dataViews_1 = require("./dataViews");
|
|
10
10
|
const events_1 = require("./events");
|
|
11
11
|
const extensibility_1 = require("./extensibility");
|
|
12
|
+
const modules_1 = require("./modules");
|
|
12
13
|
const RuntimeLoggerFactory_1 = require("./RuntimeLoggerFactory");
|
|
13
14
|
const useCases_1 = require("./useCases");
|
|
14
15
|
const SchemaRepository_1 = require("./useCases/common/SchemaRepository");
|
|
@@ -19,6 +20,9 @@ class Runtime {
|
|
|
19
20
|
this.runtimeConfig = config;
|
|
20
21
|
this._eventBus = new ts_utils_1.EventEmitter2EventBus();
|
|
21
22
|
}
|
|
23
|
+
get anonymousServices() {
|
|
24
|
+
return this._anonymousServices;
|
|
25
|
+
}
|
|
22
26
|
isLoggedIn() {
|
|
23
27
|
return !!this._accountController;
|
|
24
28
|
}
|
|
@@ -32,32 +36,18 @@ class Runtime {
|
|
|
32
36
|
throw useCases_1.RuntimeErrors.startup.noActiveConsumptionController();
|
|
33
37
|
return this._consumptionController;
|
|
34
38
|
}
|
|
35
|
-
getDataViewExpander() {
|
|
36
|
-
if (!this._expander)
|
|
37
|
-
throw useCases_1.RuntimeErrors.startup.noActiveExpander();
|
|
38
|
-
return this._expander;
|
|
39
|
-
}
|
|
40
39
|
async login(accountController, consumptionController) {
|
|
41
40
|
this._accountController = accountController;
|
|
42
|
-
|
|
41
|
+
const transportServices = typescript_ioc_1.Container.get(extensibility_1.TransportServices);
|
|
43
42
|
this._consumptionController = consumptionController;
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const consumptionServices = typescript_ioc_1.Container.get(extensibility_1.ConsumptionServices);
|
|
44
|
+
const dataViewExpander = typescript_ioc_1.Container.get(dataViews_1.DataViewExpander);
|
|
46
45
|
await new DatabaseSchemaUpgrader_1.DatabaseSchemaUpgrader(accountController, consumptionController).upgradeSchemaVersion();
|
|
47
|
-
return
|
|
46
|
+
return { transportServices, consumptionServices, dataViewExpander };
|
|
48
47
|
}
|
|
49
48
|
get modules() {
|
|
50
49
|
return this._modules;
|
|
51
50
|
}
|
|
52
|
-
get transportServices() {
|
|
53
|
-
return this._transportServices;
|
|
54
|
-
}
|
|
55
|
-
get consumptionServices() {
|
|
56
|
-
return this._consumptionServices;
|
|
57
|
-
}
|
|
58
|
-
get anonymousServices() {
|
|
59
|
-
return this._anonymousServices;
|
|
60
|
-
}
|
|
61
51
|
get eventBus() {
|
|
62
52
|
return this._eventBus;
|
|
63
53
|
}
|
|
@@ -179,7 +169,19 @@ class Runtime {
|
|
|
179
169
|
this.logger.error(`Skip loading module '${this.getModuleName(moduleConfiguration)}' because has no location.`);
|
|
180
170
|
continue;
|
|
181
171
|
}
|
|
182
|
-
|
|
172
|
+
switch (moduleConfiguration.name.toLocaleLowerCase()) {
|
|
173
|
+
case "decidermodule":
|
|
174
|
+
const deciderModule = new modules_1.DeciderModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.DeciderModule));
|
|
175
|
+
this.modules.add(deciderModule);
|
|
176
|
+
break;
|
|
177
|
+
case "messagemodule":
|
|
178
|
+
const messageModule = new modules_1.MessageModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.MessageModule));
|
|
179
|
+
this.modules.add(messageModule);
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
await this.loadModule(moduleConfiguration);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
183
185
|
}
|
|
184
186
|
this.eventBus.publish(new events_1.ModulesLoadedEvent());
|
|
185
187
|
}
|
package/dist/Runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","sourceRoot":"","sources":["../src/Runtime.ts"],"names":[],"mappings":";;;AAEA,gDAAoE;AACpE,oDAO4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"Runtime.js","sourceRoot":"","sources":["../src/Runtime.ts"],"names":[],"mappings":";;;AAEA,gDAAoE;AACpE,oDAO4B;AAC5B,gDAc0B;AAC1B,mDAAkD;AAClD,qEAAkE;AAClE,2CAA+C;AAC/C,qCAQkB;AAClB,mDAAuJ;AACvJ,uCAAyD;AAEzD,iEAA8D;AAE9D,yCAA2C;AAC3C,yEAAsE;AAQtE,MAAsB,OAAO;IAsDzB,YAAmB,MAAe;QAK1B,mBAAc,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AAI,IAAI,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC9G,CAAC;CACJ;AA3VD,0BA2VC"}
|
package/dist/buildInformation.js
CHANGED
|
@@ -7,10 +7,10 @@ const content_1 = require("@nmshd/content");
|
|
|
7
7
|
const crypto_1 = require("@nmshd/crypto");
|
|
8
8
|
const transport_1 = require("@nmshd/transport");
|
|
9
9
|
exports.buildInformation = {
|
|
10
|
-
version: "2.0.0-alpha.
|
|
11
|
-
build: "
|
|
12
|
-
date: "2022-05-
|
|
13
|
-
commit: "
|
|
10
|
+
version: "2.0.0-alpha.6",
|
|
11
|
+
build: "53",
|
|
12
|
+
date: "2022-05-16T14:21:07+00:00",
|
|
13
|
+
commit: "297aab73aeadb8a1aa4693fcc3c4681410f42f84",
|
|
14
14
|
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.3","@js-soft/ts-utils":"^1.1.2","@nmshd/consumption":"2.0.0-alpha.9","@nmshd/content":"2.0.0-alpha.13","@nmshd/crypto":"2.0.1","@nmshd/transport":"2.0.0-alpha.1","ajv":"^8.11.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.3","json-stringify-safe":"^5.0.1","luxon":"^2.4.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
15
15
|
libraries: {
|
|
16
16
|
serval: ts_serval_1.buildInformation,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ILogger } from "@js-soft/logging-abstractions";
|
|
2
|
+
import { EventConstructor, EventHandler } from "@js-soft/ts-utils";
|
|
2
3
|
import { Runtime } from "../../Runtime";
|
|
3
4
|
export interface ModuleConfiguration {
|
|
4
5
|
enabled: boolean;
|
|
@@ -7,12 +8,16 @@ export interface ModuleConfiguration {
|
|
|
7
8
|
location: string;
|
|
8
9
|
}
|
|
9
10
|
export declare abstract class RuntimeModule<TConfig extends ModuleConfiguration = ModuleConfiguration, TRuntime extends Runtime = Runtime> {
|
|
10
|
-
runtime: TRuntime;
|
|
11
|
-
configuration: TConfig;
|
|
12
|
-
logger: ILogger;
|
|
11
|
+
readonly runtime: TRuntime;
|
|
12
|
+
readonly configuration: TConfig;
|
|
13
|
+
readonly logger: ILogger;
|
|
14
|
+
constructor(runtime: TRuntime, configuration: TConfig, logger: ILogger);
|
|
13
15
|
get name(): string;
|
|
14
16
|
get displayName(): string;
|
|
15
17
|
abstract init(): Promise<void> | void;
|
|
16
18
|
abstract start(): Promise<void> | void;
|
|
17
19
|
abstract stop(): Promise<void> | void;
|
|
20
|
+
private readonly registeredSubscriptions;
|
|
21
|
+
protected subscribeToEvent<TEvent>(event: EventConstructor<TEvent>, handler: EventHandler<TEvent>): void;
|
|
22
|
+
protected unsubscribeFromAllEvents(): void;
|
|
18
23
|
}
|
|
@@ -2,12 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RuntimeModule = void 0;
|
|
4
4
|
class RuntimeModule {
|
|
5
|
+
constructor(runtime, configuration, logger) {
|
|
6
|
+
this.runtime = runtime;
|
|
7
|
+
this.configuration = configuration;
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
this.registeredSubscriptions = [];
|
|
10
|
+
}
|
|
5
11
|
get name() {
|
|
6
12
|
return this.configuration.name;
|
|
7
13
|
}
|
|
8
14
|
get displayName() {
|
|
9
15
|
return this.configuration.displayName;
|
|
10
16
|
}
|
|
17
|
+
subscribeToEvent(event, handler) {
|
|
18
|
+
const subscriptionId = this.runtime.eventBus.subscribe(event, handler);
|
|
19
|
+
this.registeredSubscriptions.push({ id: subscriptionId, target: event });
|
|
20
|
+
}
|
|
21
|
+
unsubscribeFromAllEvents() {
|
|
22
|
+
for (const subscription of this.registeredSubscriptions) {
|
|
23
|
+
this.runtime.eventBus.unsubscribe(subscription.target, subscription.id);
|
|
24
|
+
}
|
|
25
|
+
this.registeredSubscriptions.splice(0);
|
|
26
|
+
}
|
|
11
27
|
}
|
|
12
28
|
exports.RuntimeModule = RuntimeModule;
|
|
13
29
|
//# sourceMappingURL=RuntimeModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeModule.js","sourceRoot":"","sources":["../../../src/extensibility/modules/RuntimeModule.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RuntimeModule.js","sourceRoot":"","sources":["../../../src/extensibility/modules/RuntimeModule.ts"],"names":[],"mappings":";;;AAgBA,MAAsB,aAAa;IAC/B,YAAmC,OAAiB,EAAkB,aAAsB,EAAkB,MAAe;QAA1F,YAAO,GAAP,OAAO,CAAU;QAAkB,kBAAa,GAAb,aAAa,CAAS;QAAkB,WAAM,GAAN,MAAM,CAAS;QAc5G,4BAAuB,GAAqC,EAAE,CAAC;IAdgD,CAAC;IAEjI,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;IAC1C,CAAC;IAQS,gBAAgB,CAAS,KAA+B,EAAE,OAA6B;QAC7F,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAES,wBAAwB;QAC9B,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,uBAAuB,EAAE;YACrD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;SAC3E;QAED,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACJ;AA7BD,sCA6BC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeciderModule = void 0;
|
|
4
|
+
const consumption_1 = require("@nmshd/consumption");
|
|
5
|
+
const events_1 = require("../events");
|
|
6
|
+
const extensibility_1 = require("../extensibility");
|
|
7
|
+
class DeciderModule extends extensibility_1.RuntimeModule {
|
|
8
|
+
init() {
|
|
9
|
+
// Nothing to do here
|
|
10
|
+
}
|
|
11
|
+
start() {
|
|
12
|
+
this.subscribeToEvent(events_1.IncomingRequestStatusChangedEvent, this.handleIncomingRequestStatusChanged.bind(this));
|
|
13
|
+
}
|
|
14
|
+
async handleIncomingRequestStatusChanged(event) {
|
|
15
|
+
if (event.data.newStatus !== consumption_1.ConsumptionRequestStatus.DecisionRequired)
|
|
16
|
+
return;
|
|
17
|
+
const services = this.runtime.getServices(event.eventTargetAddress);
|
|
18
|
+
const requireManualDecisionResult = await services.consumptionServices.incomingRequests.requireManualDecision({ requestId: event.data.request.id });
|
|
19
|
+
if (requireManualDecisionResult.isError) {
|
|
20
|
+
this.logger.error(`Could not require manual decision for request ${event.data.request.id}`, requireManualDecisionResult.error);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
stop() {
|
|
25
|
+
this.unsubscribeFromAllEvents();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.DeciderModule = DeciderModule;
|
|
29
|
+
//# sourceMappingURL=DeciderModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeciderModule.js","sourceRoot":"","sources":["../../src/modules/DeciderModule.ts"],"names":[],"mappings":";;;AAAA,oDAA8D;AAC9D,sCAA8D;AAC9D,oDAAiD;AAEjD,MAAa,aAAc,SAAQ,6BAAa;IACrC,IAAI;QACP,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,gBAAgB,CAAC,0CAAiC,EAAE,IAAI,CAAC,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjH,CAAC;IAEO,KAAK,CAAC,kCAAkC,CAAC,KAAwC;QACrF,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,sCAAwB,CAAC,gBAAgB;YAAE,OAAO;QAE/E,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACpE,MAAM,2BAA2B,GAAG,MAAM,QAAQ,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACpJ,IAAI,2BAA2B,CAAC,OAAO,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iDAAiD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAC/H,OAAO;SACV;IACL,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACpC,CAAC;CACJ;AAvBD,sCAuBC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ModuleConfiguration, RuntimeModule } from "../extensibility/modules/RuntimeModule";
|
|
2
2
|
export interface MessageModuleConfiguration extends ModuleConfiguration {
|
|
3
3
|
}
|
|
4
|
-
export
|
|
5
|
-
private messageReceivedSubscription;
|
|
4
|
+
export declare class MessageModule extends RuntimeModule<MessageModuleConfiguration> {
|
|
6
5
|
init(): void;
|
|
7
6
|
start(): void;
|
|
8
7
|
private handleMessageReceived;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageModule = void 0;
|
|
3
4
|
const content_1 = require("@nmshd/content");
|
|
4
5
|
const events_1 = require("../events");
|
|
5
6
|
const MailReceivedEvent_1 = require("../events/consumption/MailReceivedEvent");
|
|
@@ -11,7 +12,7 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
11
12
|
// Nothing to do here
|
|
12
13
|
}
|
|
13
14
|
start() {
|
|
14
|
-
this.
|
|
15
|
+
this.subscribeToEvent(events_1.MessageReceivedEvent, this.handleMessageReceived.bind(this));
|
|
15
16
|
}
|
|
16
17
|
async handleMessageReceived(messageReceivedEvent) {
|
|
17
18
|
const message = messageReceivedEvent.data;
|
|
@@ -36,7 +37,8 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
36
37
|
// Unknown type
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
const
|
|
40
|
+
const services = this.runtime.getServices(messageReceivedEvent.eventTargetAddress);
|
|
41
|
+
const result = await services.transportServices.relationships.getRelationshipByAddress({ address: message.createdBy });
|
|
40
42
|
if (!result.isSuccess) {
|
|
41
43
|
this.logger.error(`Could not find relationship for address '${message.createdBy}'.`, result.error);
|
|
42
44
|
return;
|
|
@@ -46,8 +48,8 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
46
48
|
this.logger.trace(`Published RelationshipEvent for ${message.id} to ${relationship.id}`);
|
|
47
49
|
}
|
|
48
50
|
stop() {
|
|
49
|
-
this.
|
|
51
|
+
this.unsubscribeFromAllEvents();
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
exports.
|
|
54
|
+
exports.MessageModule = MessageModule;
|
|
53
55
|
//# sourceMappingURL=MessageModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageModule.js","sourceRoot":"","sources":["../../src/modules/MessageModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageModule.js","sourceRoot":"","sources":["../../src/modules/MessageModule.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AACnD,sCAAiD;A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C,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;gBAE1E,MAAM;YAEV;gBACI,eAAe;gBACf,OAAO;SACd;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;QACnF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,wBAAwB,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACvH,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,OAAO,CAAC,SAAS,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YACnG,OAAO;SACV;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC;QAElC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,qCAAiB,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;QACnH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,OAAO,CAAC,EAAE,OAAO,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACpC,CAAC;CACJ;AApDD,sCAoDC"}
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DeciderModule"), exports);
|
|
17
18
|
__exportStar(require("./MessageModule"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC"}
|
package/lib-web/nmshd.runtime.js
CHANGED
|
@@ -115,6 +115,7 @@ const DatabaseSchemaUpgrader_1 = __webpack_require__(/*! ./DatabaseSchemaUpgrade
|
|
|
115
115
|
const dataViews_1 = __webpack_require__(/*! ./dataViews */ "./dist/dataViews/index.js");
|
|
116
116
|
const events_1 = __webpack_require__(/*! ./events */ "./dist/events/index.js");
|
|
117
117
|
const extensibility_1 = __webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js");
|
|
118
|
+
const modules_1 = __webpack_require__(/*! ./modules */ "./dist/modules/index.js");
|
|
118
119
|
const RuntimeLoggerFactory_1 = __webpack_require__(/*! ./RuntimeLoggerFactory */ "./dist/RuntimeLoggerFactory.js");
|
|
119
120
|
const useCases_1 = __webpack_require__(/*! ./useCases */ "./dist/useCases/index.js");
|
|
120
121
|
const SchemaRepository_1 = __webpack_require__(/*! ./useCases/common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
@@ -125,6 +126,9 @@ class Runtime {
|
|
|
125
126
|
this.runtimeConfig = config;
|
|
126
127
|
this._eventBus = new ts_utils_1.EventEmitter2EventBus();
|
|
127
128
|
}
|
|
129
|
+
get anonymousServices() {
|
|
130
|
+
return this._anonymousServices;
|
|
131
|
+
}
|
|
128
132
|
isLoggedIn() {
|
|
129
133
|
return !!this._accountController;
|
|
130
134
|
}
|
|
@@ -138,32 +142,18 @@ class Runtime {
|
|
|
138
142
|
throw useCases_1.RuntimeErrors.startup.noActiveConsumptionController();
|
|
139
143
|
return this._consumptionController;
|
|
140
144
|
}
|
|
141
|
-
getDataViewExpander() {
|
|
142
|
-
if (!this._expander)
|
|
143
|
-
throw useCases_1.RuntimeErrors.startup.noActiveExpander();
|
|
144
|
-
return this._expander;
|
|
145
|
-
}
|
|
146
145
|
async login(accountController, consumptionController) {
|
|
147
146
|
this._accountController = accountController;
|
|
148
|
-
|
|
147
|
+
const transportServices = typescript_ioc_1.Container.get(extensibility_1.TransportServices);
|
|
149
148
|
this._consumptionController = consumptionController;
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
const consumptionServices = typescript_ioc_1.Container.get(extensibility_1.ConsumptionServices);
|
|
150
|
+
const dataViewExpander = typescript_ioc_1.Container.get(dataViews_1.DataViewExpander);
|
|
152
151
|
await new DatabaseSchemaUpgrader_1.DatabaseSchemaUpgrader(accountController, consumptionController).upgradeSchemaVersion();
|
|
153
|
-
return
|
|
152
|
+
return { transportServices, consumptionServices, dataViewExpander };
|
|
154
153
|
}
|
|
155
154
|
get modules() {
|
|
156
155
|
return this._modules;
|
|
157
156
|
}
|
|
158
|
-
get transportServices() {
|
|
159
|
-
return this._transportServices;
|
|
160
|
-
}
|
|
161
|
-
get consumptionServices() {
|
|
162
|
-
return this._consumptionServices;
|
|
163
|
-
}
|
|
164
|
-
get anonymousServices() {
|
|
165
|
-
return this._anonymousServices;
|
|
166
|
-
}
|
|
167
157
|
get eventBus() {
|
|
168
158
|
return this._eventBus;
|
|
169
159
|
}
|
|
@@ -285,7 +275,19 @@ class Runtime {
|
|
|
285
275
|
this.logger.error(`Skip loading module '${this.getModuleName(moduleConfiguration)}' because has no location.`);
|
|
286
276
|
continue;
|
|
287
277
|
}
|
|
288
|
-
|
|
278
|
+
switch (moduleConfiguration.name.toLocaleLowerCase()) {
|
|
279
|
+
case "decidermodule":
|
|
280
|
+
const deciderModule = new modules_1.DeciderModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.DeciderModule));
|
|
281
|
+
this.modules.add(deciderModule);
|
|
282
|
+
break;
|
|
283
|
+
case "messagemodule":
|
|
284
|
+
const messageModule = new modules_1.MessageModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.MessageModule));
|
|
285
|
+
this.modules.add(messageModule);
|
|
286
|
+
break;
|
|
287
|
+
default:
|
|
288
|
+
await this.loadModule(moduleConfiguration);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
289
291
|
}
|
|
290
292
|
this.eventBus.publish(new events_1.ModulesLoadedEvent());
|
|
291
293
|
}
|
|
@@ -422,10 +424,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
422
424
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
423
425
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
424
426
|
exports.buildInformation = {
|
|
425
|
-
version: "2.0.0-alpha.
|
|
426
|
-
build: "
|
|
427
|
-
date: "2022-05-
|
|
428
|
-
commit: "
|
|
427
|
+
version: "2.0.0-alpha.6",
|
|
428
|
+
build: "53",
|
|
429
|
+
date: "2022-05-16T14:21:07+00:00",
|
|
430
|
+
commit: "297aab73aeadb8a1aa4693fcc3c4681410f42f84",
|
|
429
431
|
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.3","@js-soft/ts-utils":"^1.1.2","@nmshd/consumption":"2.0.0-alpha.9","@nmshd/content":"2.0.0-alpha.13","@nmshd/crypto":"2.0.1","@nmshd/transport":"2.0.0-alpha.1","ajv":"^8.11.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.3","json-stringify-safe":"^5.0.1","luxon":"^2.4.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
430
432
|
libraries: {
|
|
431
433
|
serval: ts_serval_1.buildInformation,
|
|
@@ -3353,12 +3355,28 @@ __exportStar(__webpack_require__(/*! ./TransportServices */ "./dist/extensibilit
|
|
|
3353
3355
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3354
3356
|
exports.RuntimeModule = void 0;
|
|
3355
3357
|
class RuntimeModule {
|
|
3358
|
+
constructor(runtime, configuration, logger) {
|
|
3359
|
+
this.runtime = runtime;
|
|
3360
|
+
this.configuration = configuration;
|
|
3361
|
+
this.logger = logger;
|
|
3362
|
+
this.registeredSubscriptions = [];
|
|
3363
|
+
}
|
|
3356
3364
|
get name() {
|
|
3357
3365
|
return this.configuration.name;
|
|
3358
3366
|
}
|
|
3359
3367
|
get displayName() {
|
|
3360
3368
|
return this.configuration.displayName;
|
|
3361
3369
|
}
|
|
3370
|
+
subscribeToEvent(event, handler) {
|
|
3371
|
+
const subscriptionId = this.runtime.eventBus.subscribe(event, handler);
|
|
3372
|
+
this.registeredSubscriptions.push({ id: subscriptionId, target: event });
|
|
3373
|
+
}
|
|
3374
|
+
unsubscribeFromAllEvents() {
|
|
3375
|
+
for (const subscription of this.registeredSubscriptions) {
|
|
3376
|
+
this.runtime.eventBus.unsubscribe(subscription.target, subscription.id);
|
|
3377
|
+
}
|
|
3378
|
+
this.registeredSubscriptions.splice(0);
|
|
3379
|
+
}
|
|
3362
3380
|
}
|
|
3363
3381
|
exports.RuntimeModule = RuntimeModule;
|
|
3364
3382
|
//# sourceMappingURL=RuntimeModule.js.map
|
|
@@ -3447,6 +3465,45 @@ __exportStar(__webpack_require__(/*! ./useCases */ "./dist/useCases/index.js"),
|
|
|
3447
3465
|
|
|
3448
3466
|
/***/ }),
|
|
3449
3467
|
|
|
3468
|
+
/***/ "./dist/modules/DeciderModule.js":
|
|
3469
|
+
/*!***************************************!*\
|
|
3470
|
+
!*** ./dist/modules/DeciderModule.js ***!
|
|
3471
|
+
\***************************************/
|
|
3472
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3473
|
+
|
|
3474
|
+
"use strict";
|
|
3475
|
+
|
|
3476
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3477
|
+
exports.DeciderModule = void 0;
|
|
3478
|
+
const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
|
|
3479
|
+
const events_1 = __webpack_require__(/*! ../events */ "./dist/events/index.js");
|
|
3480
|
+
const extensibility_1 = __webpack_require__(/*! ../extensibility */ "./dist/extensibility/index.js");
|
|
3481
|
+
class DeciderModule extends extensibility_1.RuntimeModule {
|
|
3482
|
+
init() {
|
|
3483
|
+
// Nothing to do here
|
|
3484
|
+
}
|
|
3485
|
+
start() {
|
|
3486
|
+
this.subscribeToEvent(events_1.IncomingRequestStatusChangedEvent, this.handleIncomingRequestStatusChanged.bind(this));
|
|
3487
|
+
}
|
|
3488
|
+
async handleIncomingRequestStatusChanged(event) {
|
|
3489
|
+
if (event.data.newStatus !== consumption_1.ConsumptionRequestStatus.DecisionRequired)
|
|
3490
|
+
return;
|
|
3491
|
+
const services = this.runtime.getServices(event.eventTargetAddress);
|
|
3492
|
+
const requireManualDecisionResult = await services.consumptionServices.incomingRequests.requireManualDecision({ requestId: event.data.request.id });
|
|
3493
|
+
if (requireManualDecisionResult.isError) {
|
|
3494
|
+
this.logger.error(`Could not require manual decision for request ${event.data.request.id}`, requireManualDecisionResult.error);
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
stop() {
|
|
3499
|
+
this.unsubscribeFromAllEvents();
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
exports.DeciderModule = DeciderModule;
|
|
3503
|
+
//# sourceMappingURL=DeciderModule.js.map
|
|
3504
|
+
|
|
3505
|
+
/***/ }),
|
|
3506
|
+
|
|
3450
3507
|
/***/ "./dist/modules/MessageModule.js":
|
|
3451
3508
|
/*!***************************************!*\
|
|
3452
3509
|
!*** ./dist/modules/MessageModule.js ***!
|
|
@@ -3456,6 +3513,7 @@ __exportStar(__webpack_require__(/*! ./useCases */ "./dist/useCases/index.js"),
|
|
|
3456
3513
|
"use strict";
|
|
3457
3514
|
|
|
3458
3515
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3516
|
+
exports.MessageModule = void 0;
|
|
3459
3517
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
3460
3518
|
const events_1 = __webpack_require__(/*! ../events */ "./dist/events/index.js");
|
|
3461
3519
|
const MailReceivedEvent_1 = __webpack_require__(/*! ../events/consumption/MailReceivedEvent */ "./dist/events/consumption/MailReceivedEvent.js");
|
|
@@ -3467,7 +3525,7 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
3467
3525
|
// Nothing to do here
|
|
3468
3526
|
}
|
|
3469
3527
|
start() {
|
|
3470
|
-
this.
|
|
3528
|
+
this.subscribeToEvent(events_1.MessageReceivedEvent, this.handleMessageReceived.bind(this));
|
|
3471
3529
|
}
|
|
3472
3530
|
async handleMessageReceived(messageReceivedEvent) {
|
|
3473
3531
|
const message = messageReceivedEvent.data;
|
|
@@ -3492,7 +3550,8 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
3492
3550
|
// Unknown type
|
|
3493
3551
|
return;
|
|
3494
3552
|
}
|
|
3495
|
-
const
|
|
3553
|
+
const services = this.runtime.getServices(messageReceivedEvent.eventTargetAddress);
|
|
3554
|
+
const result = await services.transportServices.relationships.getRelationshipByAddress({ address: message.createdBy });
|
|
3496
3555
|
if (!result.isSuccess) {
|
|
3497
3556
|
this.logger.error(`Could not find relationship for address '${message.createdBy}'.`, result.error);
|
|
3498
3557
|
return;
|
|
@@ -3502,10 +3561,10 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
3502
3561
|
this.logger.trace(`Published RelationshipEvent for ${message.id} to ${relationship.id}`);
|
|
3503
3562
|
}
|
|
3504
3563
|
stop() {
|
|
3505
|
-
this.
|
|
3564
|
+
this.unsubscribeFromAllEvents();
|
|
3506
3565
|
}
|
|
3507
3566
|
}
|
|
3508
|
-
exports
|
|
3567
|
+
exports.MessageModule = MessageModule;
|
|
3509
3568
|
//# sourceMappingURL=MessageModule.js.map
|
|
3510
3569
|
|
|
3511
3570
|
/***/ }),
|
|
@@ -3533,6 +3592,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
3533
3592
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3534
3593
|
};
|
|
3535
3594
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3595
|
+
__exportStar(__webpack_require__(/*! ./DeciderModule */ "./dist/modules/DeciderModule.js"), exports);
|
|
3536
3596
|
__exportStar(__webpack_require__(/*! ./MessageModule */ "./dist/modules/MessageModule.js"), exports);
|
|
3537
3597
|
//# sourceMappingURL=index.js.map
|
|
3538
3598
|
|