@nmshd/app-runtime 2.0.0-alpha.5 → 2.0.0-beta.10
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/AppRuntime.d.ts +13 -22
- package/dist/AppRuntime.js +68 -122
- package/dist/AppRuntime.js.map +1 -1
- package/dist/AppRuntimeErrors.d.ts +0 -1
- package/dist/AppRuntimeErrors.js +0 -3
- package/dist/AppRuntimeErrors.js.map +1 -1
- package/dist/SessionStorage.d.ts +10 -0
- package/dist/SessionStorage.js +31 -0
- package/dist/SessionStorage.js.map +1 -0
- package/dist/buildInformation.js +5 -5
- package/dist/events/index.d.ts +0 -1
- package/dist/events/index.js +0 -1
- package/dist/events/index.js.map +1 -1
- package/dist/modules/AppRuntimeModule.d.ts +1 -1
- package/dist/modules/AppRuntimeModule.js +4 -6
- package/dist/modules/AppRuntimeModule.js.map +1 -1
- package/dist/modules/appEvents/MailReceivedModule.js +1 -5
- package/dist/modules/appEvents/MailReceivedModule.js.map +1 -1
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js +1 -5
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js.map +1 -1
- package/dist/modules/appSync/AppSyncModule.js +1 -2
- package/dist/modules/appSync/AppSyncModule.js.map +1 -1
- package/dist/modules/pushNotifications/PushNotificationModule.d.ts +1 -1
- package/dist/modules/pushNotifications/PushNotificationModule.js +18 -34
- package/dist/modules/pushNotifications/PushNotificationModule.js.map +1 -1
- package/dist/modules/runtimeEvents/MessageReceivedModule.js +2 -10
- package/dist/modules/runtimeEvents/MessageReceivedModule.js.map +1 -1
- package/dist/modules/runtimeEvents/RelationshipChangedModule.js +12 -14
- package/dist/modules/runtimeEvents/RelationshipChangedModule.js.map +1 -1
- package/lib-web/nmshd.app-runtime.js +228 -256
- package/lib-web/nmshd.app-runtime.min.js +1 -1
- package/package.json +15 -16
- package/dist/events/RequestReceivedEvent.d.ts +0 -8
- package/dist/events/RequestReceivedEvent.js +0 -15
- package/dist/events/RequestReceivedEvent.js.map +0 -1
|
@@ -8,7 +8,7 @@ export declare class PushNotificationModule extends AppRuntimeModule<PushNotific
|
|
|
8
8
|
private handleRemoteNotification;
|
|
9
9
|
private handleTokenRegistration;
|
|
10
10
|
private handleAccountSelected;
|
|
11
|
-
registerPushTokenForLocalAccount(
|
|
11
|
+
registerPushTokenForLocalAccount(address: string, token: string): Promise<void>;
|
|
12
12
|
getNotificationTokenFromConfig(): Result<string>;
|
|
13
13
|
stop(): void;
|
|
14
14
|
}
|
|
@@ -21,28 +21,23 @@ class PushNotificationModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
21
21
|
const notification = event.notification;
|
|
22
22
|
const content = notification.content;
|
|
23
23
|
try {
|
|
24
|
-
const
|
|
25
|
-
const session = this.runtime.findSession(account.id.toString());
|
|
26
|
-
if (!session) {
|
|
27
|
-
this.logger.error(`No session found for account ref ${content.accRef}`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
24
|
+
const services = await this.runtime.getServices(content.accRef);
|
|
30
25
|
switch (content.eventName) {
|
|
31
26
|
case IBackboneEventContent_1.BackboneEventName.DatawalletModificationsCreated:
|
|
32
|
-
const walletResult = await
|
|
27
|
+
const walletResult = await services.transportServices.account.syncDatawallet();
|
|
33
28
|
if (walletResult.isError) {
|
|
34
29
|
this.logger.error(walletResult);
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
|
-
this.runtime.eventBus.publish(new events_1.DatawalletSynchronizedEvent(
|
|
32
|
+
this.runtime.eventBus.publish(new events_1.DatawalletSynchronizedEvent(content.accRef));
|
|
38
33
|
break;
|
|
39
34
|
case IBackboneEventContent_1.BackboneEventName.ExternalEventCreated:
|
|
40
|
-
const syncResult = await
|
|
35
|
+
const syncResult = await services.transportServices.account.syncEverything();
|
|
41
36
|
if (syncResult.isError) {
|
|
42
37
|
this.logger.error(syncResult);
|
|
43
38
|
return;
|
|
44
39
|
}
|
|
45
|
-
this.runtime.eventBus.publish(new events_1.ExternalEventReceivedEvent(
|
|
40
|
+
this.runtime.eventBus.publish(new events_1.ExternalEventReceivedEvent(content.accRef, syncResult.value.messages, syncResult.value.relationships));
|
|
46
41
|
break;
|
|
47
42
|
default:
|
|
48
43
|
break;
|
|
@@ -55,8 +50,8 @@ class PushNotificationModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
55
50
|
async handleTokenRegistration(event) {
|
|
56
51
|
try {
|
|
57
52
|
this.logger.trace("PushNotificationModule.handleTokenRegistration", event);
|
|
58
|
-
for (const
|
|
59
|
-
await this.registerPushTokenForLocalAccount(account.
|
|
53
|
+
for (const session of this.runtime.getSessions()) {
|
|
54
|
+
await this.registerPushTokenForLocalAccount(session.account.address, event.token);
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
catch (e) {
|
|
@@ -64,33 +59,22 @@ class PushNotificationModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
64
59
|
}
|
|
65
60
|
}
|
|
66
61
|
async handleAccountSelected(event) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.logger.error(tokenResult.error);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
this.logger.error(e);
|
|
62
|
+
this.logger.trace("PushNotificationModule.handleAccountSelected", event);
|
|
63
|
+
const tokenResult = this.getNotificationTokenFromConfig();
|
|
64
|
+
if (tokenResult.isError) {
|
|
65
|
+
this.logger.error(tokenResult.error);
|
|
66
|
+
return;
|
|
79
67
|
}
|
|
68
|
+
await this.registerPushTokenForLocalAccount(event.data.address, tokenResult.value);
|
|
80
69
|
}
|
|
81
|
-
async registerPushTokenForLocalAccount(
|
|
70
|
+
async registerPushTokenForLocalAccount(address, token) {
|
|
82
71
|
if (!token) {
|
|
83
72
|
throw AppRuntimeErrors_1.AppRuntimeErrors.modules.pushNotificationModule
|
|
84
73
|
.tokenRegistrationNotPossible("The registered token was empty. This might be the case if you did not allow push notifications.")
|
|
85
74
|
.logWith(this.logger);
|
|
86
75
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
throw AppRuntimeErrors_1.AppRuntimeErrors.modules.pushNotificationModule
|
|
90
|
-
.tokenRegistrationNotPossible("No session for this account found")
|
|
91
|
-
.logWith(this.logger);
|
|
92
|
-
}
|
|
93
|
-
const deviceResult = await session.transportServices.account.getDeviceInfo();
|
|
76
|
+
const services = await this.runtime.getServices(address);
|
|
77
|
+
const deviceResult = await services.transportServices.account.getDeviceInfo();
|
|
94
78
|
if (deviceResult.isError) {
|
|
95
79
|
throw AppRuntimeErrors_1.AppRuntimeErrors.modules.pushNotificationModule
|
|
96
80
|
.tokenRegistrationNotPossible("No device for this account found", deviceResult.error)
|
|
@@ -100,7 +84,7 @@ class PushNotificationModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
100
84
|
const platform = this.runtime.nativeEnvironment.deviceInfoAccess.deviceInfo.pushService;
|
|
101
85
|
const handle = token;
|
|
102
86
|
const installationId = device.id;
|
|
103
|
-
const result = await
|
|
87
|
+
const result = await services.transportServices.account.registerPushNotificationToken({
|
|
104
88
|
platform,
|
|
105
89
|
handle,
|
|
106
90
|
installationId
|
|
@@ -111,7 +95,7 @@ class PushNotificationModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
111
95
|
.logWith(this.logger);
|
|
112
96
|
}
|
|
113
97
|
else {
|
|
114
|
-
this.logger.trace(`PushNotificationModule.registerPushTokenForLocalAccount: Token ${handle} registered for account ${
|
|
98
|
+
this.logger.trace(`PushNotificationModule.registerPushTokenForLocalAccount: Token ${handle} registered for account ${address} on platform ${platform} and installationId ${installationId}`);
|
|
115
99
|
}
|
|
116
100
|
}
|
|
117
101
|
getNotificationTokenFromConfig() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationModule.js","sourceRoot":"","sources":["../../../src/modules/pushNotifications/PushNotificationModule.ts"],"names":[],"mappings":";;;AAAA,sEAIqC;AACrC,gDAA0C;AAC1C,6DAAyD;AACzD,yCAA4G;AAC5G,0DAAqF;AACrF,mEAAkF;AAIlF,MAAa,sBAAuB,SAAQ,mCAA8C;IAC/E,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,sBAAsB,CAAC,6CAAuB,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9F,IAAI,CAAC,sBAAsB,CAAC,yDAAmC,EAAE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACzG,IAAI,CAAC,gBAAgB,CAAC,6BAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;IAEO,KAAK,CAAC,wBAAwB,CAAC,KAA8B;QACjE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iDAAiD,EAAE,KAAK,CAAC,CAAA;QAC3E,MAAM,YAAY,GAA4B,KAAK,CAAC,YAAY,CAAA;QAChE,MAAM,OAAO,GAA0B,YAAY,CAAC,OAAgC,CAAA;QAEpF,IAAI;YACA,MAAM,
|
|
1
|
+
{"version":3,"file":"PushNotificationModule.js","sourceRoot":"","sources":["../../../src/modules/pushNotifications/PushNotificationModule.ts"],"names":[],"mappings":";;;AAAA,sEAIqC;AACrC,gDAA0C;AAC1C,6DAAyD;AACzD,yCAA4G;AAC5G,0DAAqF;AACrF,mEAAkF;AAIlF,MAAa,sBAAuB,SAAQ,mCAA8C;IAC/E,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,sBAAsB,CAAC,6CAAuB,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9F,IAAI,CAAC,sBAAsB,CAAC,yDAAm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AI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;QACpF,IAAI,eAAe,CAAC,OAAO,EAAE;YACzB,iBAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;SACrC;QACD,OAAO,iBAAM,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;IAC3C,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACnC,CAAC;CACJ;AA5HD,wDA4HC"}
|
|
@@ -16,17 +16,9 @@ class MessageReceivedModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
16
16
|
this.subscribeToEvent(runtime_1.MessageReceivedEvent, this.handleMessageReceived.bind(this));
|
|
17
17
|
}
|
|
18
18
|
async handleMessageReceived(event) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
if (!session) {
|
|
22
|
-
this.logger.error(`No session found for address ${event.eventTargetAddress}`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const messageDVO = await session.expander.expandMessageDTO(message);
|
|
19
|
+
const services = await this.runtime.getServices(event.eventTargetAddress);
|
|
20
|
+
const messageDVO = await services.dataViewExpander.expandMessageDTO(event.data);
|
|
26
21
|
switch (messageDVO.type) {
|
|
27
|
-
case "RequestMessageDVO":
|
|
28
|
-
this.runtime.eventBus.publish(new events_1.RequestReceivedEvent(event.eventTargetAddress, messageDVO.request, messageDVO));
|
|
29
|
-
break;
|
|
30
22
|
case "MailDVO":
|
|
31
23
|
const mail = messageDVO;
|
|
32
24
|
this.runtime.eventBus.publish(new events_1.MailReceivedEvent(event.eventTargetAddress, mail));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageReceivedModule.js","sourceRoot":"","sources":["../../../src/modules/runtimeEvents/MessageReceivedModule.ts"],"names":[],"mappings":";;;AAAA,4CAA8D;AAC9D,2DAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"MessageReceivedModule.js","sourceRoot":"","sources":["../../../src/modules/runtimeEvents/MessageReceivedModule.ts"],"names":[],"mappings":";;;AAAA,4CAA8D;AAC9D,2DAAuD;AACvD,yCAAgD;AAChD,0DAAqF;AAIrF,MAAa,0BAA2B,SAAQ,iCAAe;CAAG;AAAlE,gEAAkE;AAElE,MAAa,qBAAsB,SAAQ,mCAA6C;IAC7E,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,gBAAgB,CAAC,8BAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,KAA2B;QAC3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACzE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAE/E,QAAQ,UAAU,CAAC,IAAI,EAAE;YACrB,KAAK,SAAS;gBACV,MAAM,IAAI,GAAY,UAAU,CAAA;gBAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,0BAAiB,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAA;gBACpF,MAAK;YACT;gBACI,MAAK;SACZ;IACL,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACnC,CAAC;CACJ;AA1BD,sDA0BC"}
|
|
@@ -17,21 +17,19 @@ class RelationshipChangedModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
17
17
|
}
|
|
18
18
|
async handleRelationshipChanged(event) {
|
|
19
19
|
const relationship = event.data;
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
this.logger.error(`No session found for address ${event.eventTargetAddress}`);
|
|
20
|
+
// Only listen for the creation change (the first one)
|
|
21
|
+
if (relationship.changes.length !== 1)
|
|
23
22
|
return;
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
23
|
+
const change = relationship.changes[0];
|
|
24
|
+
// response exits and created by the current identity
|
|
25
|
+
if (!change.response && change.request.createdBy === event.eventTargetAddress)
|
|
26
|
+
return;
|
|
27
|
+
// response exits and created by the current identity
|
|
28
|
+
if (change.response && change.response.createdBy === event.eventTargetAddress)
|
|
29
|
+
return;
|
|
30
|
+
const services = await this.runtime.getServices(event.eventTargetAddress);
|
|
31
|
+
const relationshipDVO = await services.dataViewExpander.expandRelationshipDTO(relationship);
|
|
32
|
+
this.runtime.eventBus.publish(new events_1.OnboardingChangeReceivedEvent(event.eventTargetAddress, change, relationship, relationshipDVO));
|
|
35
33
|
}
|
|
36
34
|
stop() {
|
|
37
35
|
this.unsubscribeFromAllEvents();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipChangedModule.js","sourceRoot":"","sources":["../../../src/modules/runtimeEvents/RelationshipChangedModule.ts"],"names":[],"mappings":";;;AAAA,4CAAyD;AACzD,2DAAuD;AACvD,yCAA4D;AAC5D,0DAAqF;AAIrF,MAAa,8BAA+B,SAAQ,iCAAe;CAAG;AAAtE,wEAAsE;AAEtE,MAAa,yBAA0B,SAAQ,mCAAiD;IACrF,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,gBAAgB,CAAC,kCAAwB,EAAE,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9F,CAAC;IAEO,KAAK,CAAC,yBAAyB,CAAC,KAA+B;QACnE,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAA;QAC/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