@nmshd/app-runtime 2.2.3 → 2.3.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.
- package/dist/AppConfig.js +6 -0
- package/dist/AppConfig.js.map +1 -1
- package/dist/AppRuntime.d.ts +9 -8
- package/dist/AppRuntime.js +20 -24
- package/dist/AppRuntime.js.map +1 -1
- package/dist/AppRuntimeServices.d.ts +5 -0
- package/dist/AppRuntimeServices.js +3 -0
- package/dist/AppRuntimeServices.js.map +1 -0
- package/dist/AppStringProcessor.d.ts +32 -0
- package/dist/AppStringProcessor.js +121 -0
- package/dist/AppStringProcessor.js.map +1 -0
- package/dist/UserfriendlyApplicationError.d.ts +1 -1
- package/dist/UserfriendlyApplicationError.js.map +1 -1
- package/dist/buildInformation.js +5 -5
- package/dist/extensibility/AppServices.d.ts +1 -2
- package/dist/extensibility/AppServices.js +0 -1
- package/dist/extensibility/AppServices.js.map +1 -1
- package/dist/extensibility/facades/index.d.ts +0 -1
- package/dist/extensibility/facades/index.js +0 -1
- package/dist/extensibility/facades/index.js.map +1 -1
- package/dist/extensibility/ui/IUIBridge.d.ts +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/appEvents/AppLaunchModule.js +1 -1
- package/dist/modules/appEvents/AppLaunchModule.js.map +1 -1
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js +2 -1
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js.map +1 -1
- package/dist/modules/appEvents/RelationshipTemplateProcessedModule.d.ts +9 -0
- package/dist/modules/appEvents/RelationshipTemplateProcessedModule.js +58 -0
- package/dist/modules/appEvents/RelationshipTemplateProcessedModule.js.map +1 -0
- package/dist/modules/appEvents/index.d.ts +1 -0
- package/dist/modules/appEvents/index.js +1 -0
- package/dist/modules/appEvents/index.js.map +1 -1
- package/dist/multiAccount/AccountServices.d.ts +2 -0
- package/dist/multiAccount/AccountServices.js +8 -0
- package/dist/multiAccount/AccountServices.js.map +1 -1
- package/lib-web/nmshd.app-runtime.js +256 -116
- package/lib-web/nmshd.app-runtime.min.js +1 -1
- package/package.json +5 -5
- package/dist/extensibility/facades/AppStringProcessorFacade.d.ts +0 -9
- package/dist/extensibility/facades/AppStringProcessorFacade.js +0 -73
- package/dist/extensibility/facades/AppStringProcessorFacade.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RelationshipTemplateProcessedModule = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
const UserfriendlyApplicationError_1 = require("../../UserfriendlyApplicationError");
|
|
6
|
+
const AppRuntimeModule_1 = require("../AppRuntimeModule");
|
|
7
|
+
class RelationshipTemplateProcessedModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
8
|
+
async init() {
|
|
9
|
+
// Nothing to do here
|
|
10
|
+
}
|
|
11
|
+
start() {
|
|
12
|
+
this.subscribeToEvent(runtime_1.RelationshipTemplateProcessedEvent, this.handleUrlOpen.bind(this));
|
|
13
|
+
}
|
|
14
|
+
async handleUrlOpen(event) {
|
|
15
|
+
const services = await this.runtime.getServices(event.eventTargetAddress);
|
|
16
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
17
|
+
const account = await this.runtime.accountServices.getAccountByAddress(event.eventTargetAddress);
|
|
18
|
+
const data = event.data;
|
|
19
|
+
switch (data.result) {
|
|
20
|
+
case runtime_1.RelationshipTemplateProcessedResult.ManualRequestDecisionRequired:
|
|
21
|
+
case runtime_1.RelationshipTemplateProcessedResult.NonCompletedRequestExists: {
|
|
22
|
+
const result = await services.consumptionServices.incomingRequests.getRequest({ id: data.requestId });
|
|
23
|
+
if (result.isError) {
|
|
24
|
+
this.logger.error(result.error);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const request = await services.dataViewExpander.expandLocalRequestDTO(result.value);
|
|
28
|
+
await uiBridge.showRequest(account, request);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case runtime_1.RelationshipTemplateProcessedResult.RelationshipExists: {
|
|
32
|
+
const result = await services.transportServices.relationships.getRelationship({
|
|
33
|
+
id: data.relationshipId
|
|
34
|
+
});
|
|
35
|
+
if (result.isError) {
|
|
36
|
+
this.logger.error(result.error);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const identityDVO = await services.dataViewExpander.expandRelationshipDTO(result.value);
|
|
40
|
+
await uiBridge.showRelationship(account, identityDVO);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case runtime_1.RelationshipTemplateProcessedResult.NoRequest: {
|
|
44
|
+
await uiBridge.showError(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.relationshipTemplateProcessedModule.relationshipTemplateNotSupported", "The relationship template content is not supported."));
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case runtime_1.RelationshipTemplateProcessedResult.Error: {
|
|
48
|
+
await uiBridge.showError(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.relationshipTemplateProcessedModule.relationshipTemplateProcessingError", "An error occurred while processing the relationship template."));
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
stop() {
|
|
54
|
+
this.unsubscribeFromAllEvents();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.RelationshipTemplateProcessedModule = RelationshipTemplateProcessedModule;
|
|
58
|
+
//# sourceMappingURL=RelationshipTemplateProcessedModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipTemplateProcessedModule.js","sourceRoot":"","sources":["../../../src/modules/appEvents/RelationshipTemplateProcessedModule.ts"],"names":[],"mappings":";;;AAAA,4CAAwG;AACxG,qFAAiF;AACjF,0DAAqF;AAIrF,MAAa,mCAAoC,SAAQ,mCAA2D;IACzG,KAAK,CAAC,I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a,CAAC,eAAe,CAAC;oBAC1E,EAAE,EAAE,IAAI,CAAC,cAAc;iBAC1B,CAAC,CAAA;gBAEF,IAAI,MAAM,CAAC,OAAO,EAAE;oBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;oBAC/B,OAAM;iBACT;gBAED,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;gBACvF,MAAM,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;gBACrD,MAAK;aACR;YAED,KAAK,6CAAmC,CAAC,SAAS,CAAC,CAAC;gBAChD,MAAM,QAAQ,CAAC,SAAS,CACpB,IAAI,2DAA4B,CAC5B,4EAA4E,EAC5E,qDAAqD,CACxD,CACJ,CAAA;gBACD,MAAK;aACR;YAED,KAAK,6CAAmC,CAAC,KAAK,CAAC,CAAC;gBAC5C,MAAM,QAAQ,CAAC,SAAS,CACpB,IAAI,2DAA4B,CAC5B,+EAA+E,EAC/E,+DAA+D,CAClE,CACJ,CAAA;gBACD,MAAK;aACR;SACJ;IACL,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACnC,CAAC;CACJ;AAvED,kFAuEC"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./AppLaunchModule"), exports);
|
|
18
18
|
__exportStar(require("./MailReceivedModule"), exports);
|
|
19
19
|
__exportStar(require("./OnboardingChangeReceivedModule"), exports);
|
|
20
|
+
__exportStar(require("./RelationshipTemplateProcessedModule"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/appEvents/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,uDAAoC;AACpC,mEAAgD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/appEvents/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,uDAAoC;AACpC,mEAAgD;AAChD,wEAAqD"}
|
|
@@ -8,6 +8,8 @@ export declare class AccountServices {
|
|
|
8
8
|
createAccount(realm: Realm, name: string): Promise<LocalAccountDTO>;
|
|
9
9
|
onboardAccount(onboardingInfo: DeviceOnboardingInfoDTO): Promise<LocalAccountDTO>;
|
|
10
10
|
getAccounts(): Promise<LocalAccountDTO[]>;
|
|
11
|
+
getAccount(id: string): Promise<LocalAccountDTO>;
|
|
12
|
+
getAccountByAddress(address: string): Promise<LocalAccountDTO>;
|
|
11
13
|
clearAccounts(): Promise<void>;
|
|
12
14
|
renameAccount(localAccountId: string, newAccountName: string): Promise<void>;
|
|
13
15
|
}
|
|
@@ -26,6 +26,14 @@ class AccountServices {
|
|
|
26
26
|
const localAccounts = await this.multiAccountController.getAccounts();
|
|
27
27
|
return localAccounts.map((account) => LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(account));
|
|
28
28
|
}
|
|
29
|
+
async getAccount(id) {
|
|
30
|
+
const localAccount = await this.multiAccountController.getAccount(transport_1.CoreId.from(id));
|
|
31
|
+
return LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(localAccount);
|
|
32
|
+
}
|
|
33
|
+
async getAccountByAddress(address) {
|
|
34
|
+
const localAccount = await this.multiAccountController.getAccountByAddress(address);
|
|
35
|
+
return LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(localAccount);
|
|
36
|
+
}
|
|
29
37
|
async clearAccounts() {
|
|
30
38
|
await this.multiAccountController.clearAccounts();
|
|
31
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountServices.js","sourceRoot":"","sources":["../../src/multiAccount/AccountServices.ts"],"names":[],"mappings":";;;AAAA,4CAAsE;AAC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C,uCAAkB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;IACxF,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,EAAU;QAC9B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,kBAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QAClF,OAAO,uCAAkB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC7D,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,OAAe;QAC5C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACnF,OAAO,uCAAkB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC7D,CAAC;IAEM,KAAK,CAAC,aAAa;QACtB,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa,EAAE,CAAA;IACrD,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,cAAsB,EAAE,cAAsB;QACrE,MAAM,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,kBAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,CAAA;IACrG,CAAC;CACJ;AAzCD,0CAyCC"}
|
|
@@ -58,6 +58,12 @@ function createAppConfig(...configs) {
|
|
|
58
58
|
location: "relationshipChanged",
|
|
59
59
|
enabled: true
|
|
60
60
|
},
|
|
61
|
+
relationshipTemplateProcessed: {
|
|
62
|
+
name: "relationshipTemplateProcessed",
|
|
63
|
+
displayName: "Relationship Template Processed",
|
|
64
|
+
location: "relationshipTemplateProcessed",
|
|
65
|
+
enabled: true
|
|
66
|
+
},
|
|
61
67
|
decider: {
|
|
62
68
|
displayName: "Decider Module",
|
|
63
69
|
name: "DeciderModule",
|
|
@@ -103,6 +109,7 @@ const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
|
|
|
103
109
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
104
110
|
const AppConfig_1 = __webpack_require__(/*! ./AppConfig */ "./dist/AppConfig.js");
|
|
105
111
|
const AppRuntimeErrors_1 = __webpack_require__(/*! ./AppRuntimeErrors */ "./dist/AppRuntimeErrors.js");
|
|
112
|
+
const AppStringProcessor_1 = __webpack_require__(/*! ./AppStringProcessor */ "./dist/AppStringProcessor.js");
|
|
106
113
|
const events_1 = __webpack_require__(/*! ./events */ "./dist/events/index.js");
|
|
107
114
|
const extensibility_1 = __webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js");
|
|
108
115
|
const modules_1 = __webpack_require__(/*! ./modules */ "./dist/modules/index.js");
|
|
@@ -117,6 +124,7 @@ class AppRuntime extends runtime_1.Runtime {
|
|
|
117
124
|
this.translationProvider = {
|
|
118
125
|
translate: (key) => Promise.resolve(ts_utils_1.Result.ok(key))
|
|
119
126
|
};
|
|
127
|
+
this._stringProcessor = new AppStringProcessor_1.AppStringProcessor(this, this.loggerFactory);
|
|
120
128
|
}
|
|
121
129
|
async uiBridge() {
|
|
122
130
|
if (this._uiBridge)
|
|
@@ -159,14 +167,16 @@ class AppRuntime extends runtime_1.Runtime {
|
|
|
159
167
|
getSessions() {
|
|
160
168
|
return this.sessionStorage.getSessions();
|
|
161
169
|
}
|
|
170
|
+
get stringProcessor() {
|
|
171
|
+
return this._stringProcessor;
|
|
172
|
+
}
|
|
162
173
|
async login(accountController, consumptionController) {
|
|
163
174
|
const services = await super.login(accountController, consumptionController);
|
|
164
175
|
const appServices = new extensibility_1.AppServices(this, services.transportServices, services.consumptionServices, services.dataViewExpander);
|
|
165
176
|
return { ...services, appServices };
|
|
166
177
|
}
|
|
167
|
-
async getServices(
|
|
168
|
-
const
|
|
169
|
-
const session = await this.getOrCreateSession(addressString);
|
|
178
|
+
async getServices(accountReference) {
|
|
179
|
+
const session = await this.getOrCreateSession(accountReference.toString());
|
|
170
180
|
return {
|
|
171
181
|
transportServices: session.transportServices,
|
|
172
182
|
consumptionServices: session.consumptionServices,
|
|
@@ -174,8 +184,8 @@ class AppRuntime extends runtime_1.Runtime {
|
|
|
174
184
|
dataViewExpander: session.expander
|
|
175
185
|
};
|
|
176
186
|
}
|
|
177
|
-
async selectAccount(
|
|
178
|
-
const session = await this.getOrCreateSession(
|
|
187
|
+
async selectAccount(accountReference, _password) {
|
|
188
|
+
const session = await this.getOrCreateSession(accountReference);
|
|
179
189
|
this.sessionStorage.currentSession = session;
|
|
180
190
|
this.eventBus.publish(new events_1.AccountSelectedEvent(session.address, session.account.id));
|
|
181
191
|
return session;
|
|
@@ -230,24 +240,16 @@ class AppRuntime extends runtime_1.Runtime {
|
|
|
230
240
|
this.sessionStorage.addSession(session);
|
|
231
241
|
return session;
|
|
232
242
|
}
|
|
233
|
-
async
|
|
234
|
-
let selectedAccount;
|
|
243
|
+
async requestAccountSelection(title = "i18n://uibridge.accountSelection.title", description = "i18n://uibridge.accountSelection.description") {
|
|
235
244
|
const accounts = await this.accountServices.getAccounts();
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.general.noAccountAvailable(accountSelectionResult.error));
|
|
241
|
-
}
|
|
242
|
-
selectedAccount = accountSelectionResult.value;
|
|
243
|
-
}
|
|
244
|
-
else if (accounts.length === 1) {
|
|
245
|
-
selectedAccount = accounts[0];
|
|
245
|
+
const bridge = await this.uiBridge();
|
|
246
|
+
const accountSelectionResult = await bridge.requestAccountSelection(accounts, title, description);
|
|
247
|
+
if (accountSelectionResult.isError) {
|
|
248
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.general.noAccountAvailable(accountSelectionResult.error));
|
|
246
249
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return UserfriendlyResult_1.UserfriendlyResult.ok(selectedAccount);
|
|
250
|
+
if (accountSelectionResult.value)
|
|
251
|
+
await this.selectAccount(accountSelectionResult.value.id, "");
|
|
252
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(accountSelectionResult.value);
|
|
251
253
|
}
|
|
252
254
|
async selectRelationship(id) {
|
|
253
255
|
if (!id) {
|
|
@@ -310,8 +312,7 @@ class AppRuntime extends runtime_1.Runtime {
|
|
|
310
312
|
this.moduleRegistry[moduleName] = ctor;
|
|
311
313
|
}
|
|
312
314
|
loadModule(moduleConfiguration) {
|
|
313
|
-
const moduleConstructor = AppRuntime.moduleRegistry[moduleConfiguration.
|
|
314
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
315
|
+
const moduleConstructor = AppRuntime.moduleRegistry[moduleConfiguration.location];
|
|
315
316
|
if (!moduleConstructor) {
|
|
316
317
|
const error = new Error(`Module '${this.getModuleName(moduleConfiguration)}' could not be loaded, because it was not registered. Please register all modules before running init.`);
|
|
317
318
|
this.logger.error(error);
|
|
@@ -343,7 +344,8 @@ AppRuntime.moduleRegistry = {
|
|
|
343
344
|
mailReceived: modules_1.MailReceivedModule,
|
|
344
345
|
onboardingChangeReceived: modules_1.OnboardingChangeReceivedModule,
|
|
345
346
|
messageReceived: modules_1.MessageReceivedModule,
|
|
346
|
-
relationshipChanged: modules_1.RelationshipChangedModule
|
|
347
|
+
relationshipChanged: modules_1.RelationshipChangedModule,
|
|
348
|
+
relationshipTemplateProcessed: modules_1.RelationshipTemplateProcessedModule
|
|
347
349
|
};
|
|
348
350
|
//# sourceMappingURL=AppRuntime.js.map
|
|
349
351
|
|
|
@@ -445,6 +447,150 @@ AppRuntimeErrors.multiAccount = new MultiAccount();
|
|
|
445
447
|
|
|
446
448
|
/***/ }),
|
|
447
449
|
|
|
450
|
+
/***/ "./dist/AppRuntimeServices.js":
|
|
451
|
+
/*!************************************!*\
|
|
452
|
+
!*** ./dist/AppRuntimeServices.js ***!
|
|
453
|
+
\************************************/
|
|
454
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
455
|
+
|
|
456
|
+
"use strict";
|
|
457
|
+
|
|
458
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
459
|
+
//# sourceMappingURL=AppRuntimeServices.js.map
|
|
460
|
+
|
|
461
|
+
/***/ }),
|
|
462
|
+
|
|
463
|
+
/***/ "./dist/AppStringProcessor.js":
|
|
464
|
+
/*!************************************!*\
|
|
465
|
+
!*** ./dist/AppStringProcessor.js ***!
|
|
466
|
+
\************************************/
|
|
467
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
468
|
+
|
|
469
|
+
"use strict";
|
|
470
|
+
|
|
471
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
472
|
+
exports.AppStringProcessor = void 0;
|
|
473
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
474
|
+
const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
|
|
475
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
476
|
+
const AppRuntimeErrors_1 = __webpack_require__(/*! ./AppRuntimeErrors */ "./dist/AppRuntimeErrors.js");
|
|
477
|
+
const UserfriendlyApplicationError_1 = __webpack_require__(/*! ./UserfriendlyApplicationError */ "./dist/UserfriendlyApplicationError.js");
|
|
478
|
+
const UserfriendlyResult_1 = __webpack_require__(/*! ./UserfriendlyResult */ "./dist/UserfriendlyResult.js");
|
|
479
|
+
class AppStringProcessor {
|
|
480
|
+
constructor(runtime, loggerFactory) {
|
|
481
|
+
this.runtime = runtime;
|
|
482
|
+
this.logger = loggerFactory.getLogger(this.constructor);
|
|
483
|
+
}
|
|
484
|
+
async processURL(url, account) {
|
|
485
|
+
url = url.trim();
|
|
486
|
+
const prefix = url.substring(0, 11);
|
|
487
|
+
if (prefix.startsWith("nmshd://qr#") || prefix === "nmshd://tr#") {
|
|
488
|
+
return await this.processTruncatedReference(url.substring(11), account);
|
|
489
|
+
}
|
|
490
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
|
|
491
|
+
}
|
|
492
|
+
async processTruncatedReference(truncatedReference, account) {
|
|
493
|
+
if (account) {
|
|
494
|
+
await this._handleTruncatedReference(truncatedReference, account);
|
|
495
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
496
|
+
}
|
|
497
|
+
// process Files and RelationshipTemplates and ask for an account
|
|
498
|
+
if (truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.File) ||
|
|
499
|
+
truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.RelationshipTemplate)) {
|
|
500
|
+
const result = await this.runtime.requestAccountSelection();
|
|
501
|
+
if (result.isError) {
|
|
502
|
+
this.logger.error("Could not query account", result.error);
|
|
503
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(result.error);
|
|
504
|
+
}
|
|
505
|
+
if (!result.value) {
|
|
506
|
+
this.logger.info("User cancelled account selection");
|
|
507
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
508
|
+
}
|
|
509
|
+
await this._handleTruncatedReference(truncatedReference, result.value);
|
|
510
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
511
|
+
}
|
|
512
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
513
|
+
if (!truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.Token)) {
|
|
514
|
+
const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
|
|
515
|
+
await this.error(error);
|
|
516
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(error);
|
|
517
|
+
}
|
|
518
|
+
const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
|
|
519
|
+
reference: truncatedReference
|
|
520
|
+
});
|
|
521
|
+
if (tokenResult.isError) {
|
|
522
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(tokenResult.error));
|
|
523
|
+
}
|
|
524
|
+
const tokenDTO = tokenResult.value;
|
|
525
|
+
const tokenContent = this.parseTokenContent(tokenDTO.content);
|
|
526
|
+
if (!tokenContent) {
|
|
527
|
+
const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
|
|
528
|
+
await this.error(error);
|
|
529
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(error);
|
|
530
|
+
}
|
|
531
|
+
if (tokenContent instanceof transport_1.TokenContentDeviceSharedSecret) {
|
|
532
|
+
await uiBridge.showDeviceOnboarding(tokenContent.sharedSecret);
|
|
533
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
534
|
+
}
|
|
535
|
+
const accountSelectionResult = await this.runtime.requestAccountSelection();
|
|
536
|
+
if (accountSelectionResult.isError) {
|
|
537
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(accountSelectionResult.error);
|
|
538
|
+
}
|
|
539
|
+
const selectedAccount = accountSelectionResult.value;
|
|
540
|
+
if (!selectedAccount) {
|
|
541
|
+
this.logger.info("User cancelled account selection");
|
|
542
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
543
|
+
}
|
|
544
|
+
await this._handleTruncatedReference(truncatedReference, selectedAccount);
|
|
545
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
546
|
+
}
|
|
547
|
+
async _handleTruncatedReference(truncatedReference, account) {
|
|
548
|
+
const services = await this.runtime.getServices(account.id);
|
|
549
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
550
|
+
const result = await services.transportServices.account.loadItemFromTruncatedReference({
|
|
551
|
+
reference: truncatedReference
|
|
552
|
+
});
|
|
553
|
+
if (result.isError)
|
|
554
|
+
return await this.error(result.error);
|
|
555
|
+
switch (result.value.type) {
|
|
556
|
+
case "File":
|
|
557
|
+
const file = await services.dataViewExpander.expandFileDTO(result.value.value);
|
|
558
|
+
await uiBridge.showFile(account, file);
|
|
559
|
+
break;
|
|
560
|
+
case "RelationshipTemplate":
|
|
561
|
+
// RelationshipTemplates are processed by the RequestModule
|
|
562
|
+
break;
|
|
563
|
+
case "Token":
|
|
564
|
+
await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.notSupportedTokenContent", "The scanned code is not supported in this context"));
|
|
565
|
+
break;
|
|
566
|
+
case "DeviceOnboardingInfo":
|
|
567
|
+
await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.deviceOnboardingNotAllowed", "The token contained a device onboarding info, but this is not allowed in this context."));
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
parseTokenContent(content) {
|
|
572
|
+
try {
|
|
573
|
+
return ts_serval_1.Serializable.fromUnknown(content);
|
|
574
|
+
}
|
|
575
|
+
catch (e) {
|
|
576
|
+
this.logger.info("Could not parse token content", e);
|
|
577
|
+
return undefined;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
async error(error) {
|
|
581
|
+
const parsedError = error instanceof UserfriendlyApplicationError_1.UserfriendlyApplicationError //
|
|
582
|
+
? error
|
|
583
|
+
: UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(error);
|
|
584
|
+
this.logger.error(parsedError);
|
|
585
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
586
|
+
await uiBridge.showError(parsedError);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
exports.AppStringProcessor = AppStringProcessor;
|
|
590
|
+
//# sourceMappingURL=AppStringProcessor.js.map
|
|
591
|
+
|
|
592
|
+
/***/ }),
|
|
593
|
+
|
|
448
594
|
/***/ "./dist/SessionStorage.js":
|
|
449
595
|
/*!********************************!*\
|
|
450
596
|
!*** ./dist/SessionStorage.js ***!
|
|
@@ -549,11 +695,11 @@ const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
|
549
695
|
const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
|
|
550
696
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
551
697
|
exports.buildInformation = {
|
|
552
|
-
version: "2.
|
|
553
|
-
build: "
|
|
554
|
-
date: "2023-02-
|
|
555
|
-
commit: "
|
|
556
|
-
dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","@nmshd/runtime":"2.
|
|
698
|
+
version: "2.3.0",
|
|
699
|
+
build: "43",
|
|
700
|
+
date: "2023-02-17T19:06:23+00:00",
|
|
701
|
+
commit: "5bb90a2e7a4d68c976eee7e6b039e453c1043d7c",
|
|
702
|
+
dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","@nmshd/runtime":"2.4.1","lodash":"^4.17.21"},
|
|
557
703
|
libraries: {
|
|
558
704
|
serval: ts_serval_1.buildInformation,
|
|
559
705
|
crypto: crypto_1.buildInformation,
|
|
@@ -757,7 +903,6 @@ const facades_1 = __webpack_require__(/*! ./facades */ "./dist/extensibility/fac
|
|
|
757
903
|
class AppServices {
|
|
758
904
|
constructor(appRuntime, transportServices, consumptionServices, expander) {
|
|
759
905
|
this.relationships = new facades_1.AppRelationshipFacade(appRuntime, transportServices, consumptionServices, expander);
|
|
760
|
-
this.stringProcessor = new facades_1.AppStringProcessorFacade(appRuntime, transportServices, consumptionServices, expander);
|
|
761
906
|
}
|
|
762
907
|
}
|
|
763
908
|
exports.AppServices = AppServices;
|
|
@@ -898,89 +1043,6 @@ exports.AppRuntimeFacade = AppRuntimeFacade;
|
|
|
898
1043
|
|
|
899
1044
|
/***/ }),
|
|
900
1045
|
|
|
901
|
-
/***/ "./dist/extensibility/facades/AppStringProcessorFacade.js":
|
|
902
|
-
/*!****************************************************************!*\
|
|
903
|
-
!*** ./dist/extensibility/facades/AppStringProcessorFacade.js ***!
|
|
904
|
-
\****************************************************************/
|
|
905
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
906
|
-
|
|
907
|
-
"use strict";
|
|
908
|
-
|
|
909
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
910
|
-
exports.AppStringProcessorFacade = void 0;
|
|
911
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
912
|
-
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
913
|
-
const AppRuntimeErrors_1 = __webpack_require__(/*! ../../AppRuntimeErrors */ "./dist/AppRuntimeErrors.js");
|
|
914
|
-
const UserfriendlyResult_1 = __webpack_require__(/*! ../../UserfriendlyResult */ "./dist/UserfriendlyResult.js");
|
|
915
|
-
const AppRuntimeFacade_1 = __webpack_require__(/*! ./AppRuntimeFacade */ "./dist/extensibility/facades/AppRuntimeFacade.js");
|
|
916
|
-
class AppStringProcessorFacade extends AppRuntimeFacade_1.AppRuntimeFacade {
|
|
917
|
-
async processURL(url, account) {
|
|
918
|
-
const urlResult = this.parseURL(url);
|
|
919
|
-
if (urlResult.isError) {
|
|
920
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(urlResult.error);
|
|
921
|
-
}
|
|
922
|
-
const parsedUrl = urlResult.value;
|
|
923
|
-
if (parsedUrl.startsWith("qr#")) {
|
|
924
|
-
return await this.processCode(parsedUrl.substring(3), account);
|
|
925
|
-
}
|
|
926
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
|
|
927
|
-
}
|
|
928
|
-
parseURL(url) {
|
|
929
|
-
const regexResult = AppStringProcessorFacade.urlRegex.exec(url);
|
|
930
|
-
if (!regexResult) {
|
|
931
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
|
|
932
|
-
}
|
|
933
|
-
return UserfriendlyResult_1.UserfriendlyResult.ok(regexResult.groups.data);
|
|
934
|
-
}
|
|
935
|
-
async processCode(code, account) {
|
|
936
|
-
const truncatedReference = code;
|
|
937
|
-
const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
|
|
938
|
-
reference: truncatedReference
|
|
939
|
-
});
|
|
940
|
-
if (tokenResult.isError) {
|
|
941
|
-
return await this.parseErrorResult(tokenResult);
|
|
942
|
-
}
|
|
943
|
-
const tokenDTO = tokenResult.value;
|
|
944
|
-
const content = tokenDTO.content;
|
|
945
|
-
const uiBridge = await this.runtime.uiBridge();
|
|
946
|
-
try {
|
|
947
|
-
const tokenContent = ts_serval_1.Serializable.fromUnknown(content);
|
|
948
|
-
if (tokenContent instanceof transport_1.TokenContentRelationshipTemplate) {
|
|
949
|
-
const templateResult = await this.transportServices.relationshipTemplates.loadPeerRelationshipTemplate({
|
|
950
|
-
id: tokenContent.templateId.toString(),
|
|
951
|
-
secretKey: tokenContent.secretKey.toBase64()
|
|
952
|
-
});
|
|
953
|
-
if (templateResult.isError) {
|
|
954
|
-
return await this.parseErrorResult(templateResult);
|
|
955
|
-
}
|
|
956
|
-
let useAccount = account;
|
|
957
|
-
if (!useAccount) {
|
|
958
|
-
const bestAccountResult = await this.runtime.queryAccount();
|
|
959
|
-
if (bestAccountResult.isError) {
|
|
960
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(bestAccountResult.error);
|
|
961
|
-
}
|
|
962
|
-
useAccount = bestAccountResult.value;
|
|
963
|
-
}
|
|
964
|
-
await uiBridge.showRelationshipTemplate(useAccount, templateResult.value);
|
|
965
|
-
}
|
|
966
|
-
else if (tokenContent instanceof transport_1.TokenContentDeviceSharedSecret) {
|
|
967
|
-
await uiBridge.showDeviceOnboarding(tokenDTO);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
catch (e) {
|
|
971
|
-
const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
|
|
972
|
-
await uiBridge.showError(error);
|
|
973
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(error);
|
|
974
|
-
}
|
|
975
|
-
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
exports.AppStringProcessorFacade = AppStringProcessorFacade;
|
|
979
|
-
AppStringProcessorFacade.urlRegex = /^\s*(nmshd:\/\/)(?<data>[A-Za-z0-9\-_#]{2,992})\s*$/;
|
|
980
|
-
//# sourceMappingURL=AppStringProcessorFacade.js.map
|
|
981
|
-
|
|
982
|
-
/***/ }),
|
|
983
|
-
|
|
984
1046
|
/***/ "./dist/extensibility/facades/index.js":
|
|
985
1047
|
/*!*********************************************!*\
|
|
986
1048
|
!*** ./dist/extensibility/facades/index.js ***!
|
|
@@ -1005,7 +1067,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1005
1067
|
};
|
|
1006
1068
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1007
1069
|
__exportStar(__webpack_require__(/*! ./AppRelationshipFacade */ "./dist/extensibility/facades/AppRelationshipFacade.js"), exports);
|
|
1008
|
-
__exportStar(__webpack_require__(/*! ./AppStringProcessorFacade */ "./dist/extensibility/facades/AppStringProcessorFacade.js"), exports);
|
|
1009
1070
|
//# sourceMappingURL=index.js.map
|
|
1010
1071
|
|
|
1011
1072
|
/***/ }),
|
|
@@ -1079,6 +1140,7 @@ __exportStar(__webpack_require__(/*! ./AppConfig */ "./dist/AppConfig.js"), expo
|
|
|
1079
1140
|
__exportStar(__webpack_require__(/*! ./AppRuntime */ "./dist/AppRuntime.js"), exports);
|
|
1080
1141
|
__exportStar(__webpack_require__(/*! ./AppRuntimeError */ "./dist/AppRuntimeError.js"), exports);
|
|
1081
1142
|
__exportStar(__webpack_require__(/*! ./AppRuntimeErrors */ "./dist/AppRuntimeErrors.js"), exports);
|
|
1143
|
+
__exportStar(__webpack_require__(/*! ./AppRuntimeServices */ "./dist/AppRuntimeServices.js"), exports);
|
|
1082
1144
|
__exportStar(__webpack_require__(/*! ./buildInformation */ "./dist/buildInformation.js"), exports);
|
|
1083
1145
|
__exportStar(__webpack_require__(/*! ./events */ "./dist/events/index.js"), exports);
|
|
1084
1146
|
__exportStar(__webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js"), exports);
|
|
@@ -1149,7 +1211,7 @@ class AppLaunchModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
|
1149
1211
|
this.subscribeToNativeEvent(native_abstractions_1.UrlOpenEvent, this.handleUrlOpen.bind(this));
|
|
1150
1212
|
}
|
|
1151
1213
|
async handleUrlOpen(event) {
|
|
1152
|
-
await this.runtime.
|
|
1214
|
+
await this.runtime.stringProcessor.processURL(event.url);
|
|
1153
1215
|
}
|
|
1154
1216
|
stop() {
|
|
1155
1217
|
this.unsubscribeFromAllEvents();
|
|
@@ -1252,7 +1314,8 @@ class OnboardingChangeReceivedModule extends AppRuntimeModule_1.AppRuntimeModule
|
|
|
1252
1314
|
}
|
|
1253
1315
|
await this.runtime.nativeEnvironment.notificationAccess.schedule(title, text, {
|
|
1254
1316
|
callback: async () => {
|
|
1255
|
-
|
|
1317
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
1318
|
+
await uiBridge.showRelationship(session.account, identity);
|
|
1256
1319
|
}
|
|
1257
1320
|
});
|
|
1258
1321
|
}
|
|
@@ -1265,6 +1328,74 @@ exports.OnboardingChangeReceivedModule = OnboardingChangeReceivedModule;
|
|
|
1265
1328
|
|
|
1266
1329
|
/***/ }),
|
|
1267
1330
|
|
|
1331
|
+
/***/ "./dist/modules/appEvents/RelationshipTemplateProcessedModule.js":
|
|
1332
|
+
/*!***********************************************************************!*\
|
|
1333
|
+
!*** ./dist/modules/appEvents/RelationshipTemplateProcessedModule.js ***!
|
|
1334
|
+
\***********************************************************************/
|
|
1335
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1336
|
+
|
|
1337
|
+
"use strict";
|
|
1338
|
+
|
|
1339
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1340
|
+
exports.RelationshipTemplateProcessedModule = void 0;
|
|
1341
|
+
const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
|
|
1342
|
+
const UserfriendlyApplicationError_1 = __webpack_require__(/*! ../../UserfriendlyApplicationError */ "./dist/UserfriendlyApplicationError.js");
|
|
1343
|
+
const AppRuntimeModule_1 = __webpack_require__(/*! ../AppRuntimeModule */ "./dist/modules/AppRuntimeModule.js");
|
|
1344
|
+
class RelationshipTemplateProcessedModule extends AppRuntimeModule_1.AppRuntimeModule {
|
|
1345
|
+
async init() {
|
|
1346
|
+
// Nothing to do here
|
|
1347
|
+
}
|
|
1348
|
+
start() {
|
|
1349
|
+
this.subscribeToEvent(runtime_1.RelationshipTemplateProcessedEvent, this.handleUrlOpen.bind(this));
|
|
1350
|
+
}
|
|
1351
|
+
async handleUrlOpen(event) {
|
|
1352
|
+
const services = await this.runtime.getServices(event.eventTargetAddress);
|
|
1353
|
+
const uiBridge = await this.runtime.uiBridge();
|
|
1354
|
+
const account = await this.runtime.accountServices.getAccountByAddress(event.eventTargetAddress);
|
|
1355
|
+
const data = event.data;
|
|
1356
|
+
switch (data.result) {
|
|
1357
|
+
case runtime_1.RelationshipTemplateProcessedResult.ManualRequestDecisionRequired:
|
|
1358
|
+
case runtime_1.RelationshipTemplateProcessedResult.NonCompletedRequestExists: {
|
|
1359
|
+
const result = await services.consumptionServices.incomingRequests.getRequest({ id: data.requestId });
|
|
1360
|
+
if (result.isError) {
|
|
1361
|
+
this.logger.error(result.error);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
const request = await services.dataViewExpander.expandLocalRequestDTO(result.value);
|
|
1365
|
+
await uiBridge.showRequest(account, request);
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
case runtime_1.RelationshipTemplateProcessedResult.RelationshipExists: {
|
|
1369
|
+
const result = await services.transportServices.relationships.getRelationship({
|
|
1370
|
+
id: data.relationshipId
|
|
1371
|
+
});
|
|
1372
|
+
if (result.isError) {
|
|
1373
|
+
this.logger.error(result.error);
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
const identityDVO = await services.dataViewExpander.expandRelationshipDTO(result.value);
|
|
1377
|
+
await uiBridge.showRelationship(account, identityDVO);
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
case runtime_1.RelationshipTemplateProcessedResult.NoRequest: {
|
|
1381
|
+
await uiBridge.showError(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.relationshipTemplateProcessedModule.relationshipTemplateNotSupported", "The relationship template content is not supported."));
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
case runtime_1.RelationshipTemplateProcessedResult.Error: {
|
|
1385
|
+
await uiBridge.showError(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.relationshipTemplateProcessedModule.relationshipTemplateProcessingError", "An error occurred while processing the relationship template."));
|
|
1386
|
+
break;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
stop() {
|
|
1391
|
+
this.unsubscribeFromAllEvents();
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
exports.RelationshipTemplateProcessedModule = RelationshipTemplateProcessedModule;
|
|
1395
|
+
//# sourceMappingURL=RelationshipTemplateProcessedModule.js.map
|
|
1396
|
+
|
|
1397
|
+
/***/ }),
|
|
1398
|
+
|
|
1268
1399
|
/***/ "./dist/modules/appEvents/index.js":
|
|
1269
1400
|
/*!*****************************************!*\
|
|
1270
1401
|
!*** ./dist/modules/appEvents/index.js ***!
|
|
@@ -1291,6 +1422,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1291
1422
|
__exportStar(__webpack_require__(/*! ./AppLaunchModule */ "./dist/modules/appEvents/AppLaunchModule.js"), exports);
|
|
1292
1423
|
__exportStar(__webpack_require__(/*! ./MailReceivedModule */ "./dist/modules/appEvents/MailReceivedModule.js"), exports);
|
|
1293
1424
|
__exportStar(__webpack_require__(/*! ./OnboardingChangeReceivedModule */ "./dist/modules/appEvents/OnboardingChangeReceivedModule.js"), exports);
|
|
1425
|
+
__exportStar(__webpack_require__(/*! ./RelationshipTemplateProcessedModule */ "./dist/modules/appEvents/RelationshipTemplateProcessedModule.js"), exports);
|
|
1294
1426
|
//# sourceMappingURL=index.js.map
|
|
1295
1427
|
|
|
1296
1428
|
/***/ }),
|
|
@@ -1733,6 +1865,14 @@ class AccountServices {
|
|
|
1733
1865
|
const localAccounts = await this.multiAccountController.getAccounts();
|
|
1734
1866
|
return localAccounts.map((account) => LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(account));
|
|
1735
1867
|
}
|
|
1868
|
+
async getAccount(id) {
|
|
1869
|
+
const localAccount = await this.multiAccountController.getAccount(transport_1.CoreId.from(id));
|
|
1870
|
+
return LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(localAccount);
|
|
1871
|
+
}
|
|
1872
|
+
async getAccountByAddress(address) {
|
|
1873
|
+
const localAccount = await this.multiAccountController.getAccountByAddress(address);
|
|
1874
|
+
return LocalAccountMapper_1.LocalAccountMapper.toLocalAccountDTO(localAccount);
|
|
1875
|
+
}
|
|
1736
1876
|
async clearAccounts() {
|
|
1737
1877
|
await this.multiAccountController.clearAccounts();
|
|
1738
1878
|
}
|