@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmshd/app-runtime",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "The App Runtime",
|
|
5
5
|
"homepage": "https://enmeshed.eu",
|
|
6
6
|
"repository": "github:nmshd/cns-app-runtime",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@js-soft/docdb-access-loki": "^1.0.3",
|
|
39
39
|
"@js-soft/native-abstractions": "^1.2.1",
|
|
40
|
-
"@nmshd/runtime": "2.
|
|
40
|
+
"@nmshd/runtime": "2.4.1",
|
|
41
41
|
"lodash": "^4.17.21"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"@types/lokijs": "^1.5.7",
|
|
50
50
|
"@types/luxon": "^3.2.0",
|
|
51
51
|
"@types/mocha": "^10.0.1",
|
|
52
|
-
"@types/node": "^18.
|
|
52
|
+
"@types/node": "^18.13.0",
|
|
53
53
|
"bt-runner": "^3.1.0",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
55
|
"copy-webpack-plugin": "^11.0.0",
|
|
56
|
-
"eslint": "^8.
|
|
56
|
+
"eslint": "^8.34.0",
|
|
57
57
|
"madge": "^6.0.0",
|
|
58
58
|
"mocha": "^10.2.0",
|
|
59
|
-
"prettier": "^2.8.
|
|
59
|
+
"prettier": "^2.8.4",
|
|
60
60
|
"terser-webpack-plugin": "5.3.6",
|
|
61
61
|
"ts-node": "^10.9.1",
|
|
62
62
|
"tsconfig-paths": "^4.1.2",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { LocalAccountDTO } from "../../multiAccount/data/LocalAccountDTO";
|
|
2
|
-
import { UserfriendlyResult } from "../../UserfriendlyResult";
|
|
3
|
-
import { AppRuntimeFacade } from "./AppRuntimeFacade";
|
|
4
|
-
export declare class AppStringProcessorFacade extends AppRuntimeFacade {
|
|
5
|
-
private static readonly urlRegex;
|
|
6
|
-
processURL(url: string, account?: LocalAccountDTO): Promise<UserfriendlyResult<void>>;
|
|
7
|
-
private parseURL;
|
|
8
|
-
processCode(code: string, account?: LocalAccountDTO): Promise<UserfriendlyResult<void>>;
|
|
9
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppStringProcessorFacade = void 0;
|
|
4
|
-
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
5
|
-
const transport_1 = require("@nmshd/transport");
|
|
6
|
-
const AppRuntimeErrors_1 = require("../../AppRuntimeErrors");
|
|
7
|
-
const UserfriendlyResult_1 = require("../../UserfriendlyResult");
|
|
8
|
-
const AppRuntimeFacade_1 = require("./AppRuntimeFacade");
|
|
9
|
-
class AppStringProcessorFacade extends AppRuntimeFacade_1.AppRuntimeFacade {
|
|
10
|
-
async processURL(url, account) {
|
|
11
|
-
const urlResult = this.parseURL(url);
|
|
12
|
-
if (urlResult.isError) {
|
|
13
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(urlResult.error);
|
|
14
|
-
}
|
|
15
|
-
const parsedUrl = urlResult.value;
|
|
16
|
-
if (parsedUrl.startsWith("qr#")) {
|
|
17
|
-
return await this.processCode(parsedUrl.substring(3), account);
|
|
18
|
-
}
|
|
19
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
|
|
20
|
-
}
|
|
21
|
-
parseURL(url) {
|
|
22
|
-
const regexResult = AppStringProcessorFacade.urlRegex.exec(url);
|
|
23
|
-
if (!regexResult) {
|
|
24
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
|
|
25
|
-
}
|
|
26
|
-
return UserfriendlyResult_1.UserfriendlyResult.ok(regexResult.groups.data);
|
|
27
|
-
}
|
|
28
|
-
async processCode(code, account) {
|
|
29
|
-
const truncatedReference = code;
|
|
30
|
-
const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
|
|
31
|
-
reference: truncatedReference
|
|
32
|
-
});
|
|
33
|
-
if (tokenResult.isError) {
|
|
34
|
-
return await this.parseErrorResult(tokenResult);
|
|
35
|
-
}
|
|
36
|
-
const tokenDTO = tokenResult.value;
|
|
37
|
-
const content = tokenDTO.content;
|
|
38
|
-
const uiBridge = await this.runtime.uiBridge();
|
|
39
|
-
try {
|
|
40
|
-
const tokenContent = ts_serval_1.Serializable.fromUnknown(content);
|
|
41
|
-
if (tokenContent instanceof transport_1.TokenContentRelationshipTemplate) {
|
|
42
|
-
const templateResult = await this.transportServices.relationshipTemplates.loadPeerRelationshipTemplate({
|
|
43
|
-
id: tokenContent.templateId.toString(),
|
|
44
|
-
secretKey: tokenContent.secretKey.toBase64()
|
|
45
|
-
});
|
|
46
|
-
if (templateResult.isError) {
|
|
47
|
-
return await this.parseErrorResult(templateResult);
|
|
48
|
-
}
|
|
49
|
-
let useAccount = account;
|
|
50
|
-
if (!useAccount) {
|
|
51
|
-
const bestAccountResult = await this.runtime.queryAccount();
|
|
52
|
-
if (bestAccountResult.isError) {
|
|
53
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(bestAccountResult.error);
|
|
54
|
-
}
|
|
55
|
-
useAccount = bestAccountResult.value;
|
|
56
|
-
}
|
|
57
|
-
await uiBridge.showRelationshipTemplate(useAccount, templateResult.value);
|
|
58
|
-
}
|
|
59
|
-
else if (tokenContent instanceof transport_1.TokenContentDeviceSharedSecret) {
|
|
60
|
-
await uiBridge.showDeviceOnboarding(tokenDTO);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
|
|
65
|
-
await uiBridge.showError(error);
|
|
66
|
-
return UserfriendlyResult_1.UserfriendlyResult.fail(error);
|
|
67
|
-
}
|
|
68
|
-
return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.AppStringProcessorFacade = AppStringProcessorFacade;
|
|
72
|
-
AppStringProcessorFacade.urlRegex = /^\s*(nmshd:\/\/)(?<data>[A-Za-z0-9\-_#]{2,992})\s*$/;
|
|
73
|
-
//# sourceMappingURL=AppStringProcessorFacade.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppStringProcessorFacade.js","sourceRoot":"","sources":["../../../src/extensibility/facades/AppStringProcessorFacade.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,gDAAmG;AACnG,6DAAyD;AAEzD,iEAA6D;AAC7D,yDAAqD;AAErD,MAAa,wBAAyB,SAAQ,mCAAgB;IAGnD,KAAK,CAAC,UAAU,CAAC,GAAW,EAAE,OAAyB;QAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,SAAS,CAAC,OAAO,EAAE;YACnB,OAAO,uCAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;SAClD;QAED,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAA;QACjC,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;SACjE;QACD,OAAO,uCAAkB,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