@nmshd/app-runtime 1.0.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/LICENSE +7 -0
- package/README.md +24 -0
- package/dist/AppConfig.d.ts +10 -0
- package/dist/AppConfig.js +55 -0
- package/dist/AppConfig.js.map +1 -0
- package/dist/AppRuntime.d.ts +61 -0
- package/dist/AppRuntime.js +306 -0
- package/dist/AppRuntime.js.map +1 -0
- package/dist/AppRuntimeError.d.ts +5 -0
- package/dist/AppRuntimeError.js +12 -0
- package/dist/AppRuntimeError.js.map +1 -0
- package/dist/AppRuntimeErrors.d.ts +33 -0
- package/dist/AppRuntimeErrors.js +67 -0
- package/dist/AppRuntimeErrors.js.map +1 -0
- package/dist/UserfriendlyApplicationError.d.ts +7 -0
- package/dist/UserfriendlyApplicationError.js +18 -0
- package/dist/UserfriendlyApplicationError.js.map +1 -0
- package/dist/UserfriendlyResult.d.ts +4 -0
- package/dist/UserfriendlyResult.js +8 -0
- package/dist/UserfriendlyResult.js.map +1 -0
- package/dist/buildInformation.d.ts +512 -0
- package/dist/buildInformation.js +25 -0
- package/dist/buildInformation.js.map +1 -0
- package/dist/events/AccountSelectedEvent.d.ts +12 -0
- package/dist/events/AccountSelectedEvent.js +16 -0
- package/dist/events/AccountSelectedEvent.js.map +1 -0
- package/dist/events/DatawalletSynchronizedEvent.d.ts +5 -0
- package/dist/events/DatawalletSynchronizedEvent.js +12 -0
- package/dist/events/DatawalletSynchronizedEvent.js.map +1 -0
- package/dist/events/ExternalEventReceivedEvent.d.ts +8 -0
- package/dist/events/ExternalEventReceivedEvent.js +15 -0
- package/dist/events/ExternalEventReceivedEvent.js.map +1 -0
- package/dist/events/MailReceivedEvent.d.ts +5 -0
- package/dist/events/MailReceivedEvent.js +12 -0
- package/dist/events/MailReceivedEvent.js.map +1 -0
- package/dist/events/OnboardingChangeReceivedEvent.d.ts +9 -0
- package/dist/events/OnboardingChangeReceivedEvent.js +16 -0
- package/dist/events/OnboardingChangeReceivedEvent.js.map +1 -0
- package/dist/events/RelationshipSelectedEvent.d.ts +5 -0
- package/dist/events/RelationshipSelectedEvent.js +12 -0
- package/dist/events/RelationshipSelectedEvent.js.map +1 -0
- package/dist/events/RequestReceivedEvent.d.ts +8 -0
- package/dist/events/RequestReceivedEvent.js +15 -0
- package/dist/events/RequestReceivedEvent.js.map +1 -0
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.js +20 -0
- package/dist/events/index.js.map +1 -0
- package/dist/extensibility/AppServices.d.ts +7 -0
- package/dist/extensibility/AppServices.js +12 -0
- package/dist/extensibility/AppServices.js.map +1 -0
- package/dist/extensibility/DVOs/RelationshipItemsDVO.d.ts +3 -0
- package/dist/extensibility/DVOs/RelationshipItemsDVO.js +3 -0
- package/dist/extensibility/DVOs/RelationshipItemsDVO.js.map +1 -0
- package/dist/extensibility/facades/AppRelationshipFacade.d.ts +21 -0
- package/dist/extensibility/facades/AppRelationshipFacade.js +88 -0
- package/dist/extensibility/facades/AppRelationshipFacade.js.map +1 -0
- package/dist/extensibility/facades/AppRuntimeFacade.d.ts +13 -0
- package/dist/extensibility/facades/AppRuntimeFacade.js +29 -0
- package/dist/extensibility/facades/AppRuntimeFacade.js.map +1 -0
- package/dist/extensibility/facades/AppStringProcessorFacade.d.ts +9 -0
- package/dist/extensibility/facades/AppStringProcessorFacade.js +73 -0
- package/dist/extensibility/facades/AppStringProcessorFacade.js.map +1 -0
- package/dist/extensibility/facades/index.d.ts +2 -0
- package/dist/extensibility/facades/index.js +15 -0
- package/dist/extensibility/facades/index.js.map +1 -0
- package/dist/extensibility/index.d.ts +2 -0
- package/dist/extensibility/index.js +15 -0
- package/dist/extensibility/index.js.map +1 -0
- package/dist/extensibility/ui/IUIBridge.d.ts +14 -0
- package/dist/extensibility/ui/IUIBridge.js +3 -0
- package/dist/extensibility/ui/IUIBridge.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/AppRuntimeModule.d.ts +9 -0
- package/dist/modules/AppRuntimeModule.js +8 -0
- package/dist/modules/AppRuntimeModule.js.map +1 -0
- package/dist/modules/appEvents/AppLaunchModule.d.ts +13 -0
- package/dist/modules/appEvents/AppLaunchModule.js +33 -0
- package/dist/modules/appEvents/AppLaunchModule.js.map +1 -0
- package/dist/modules/appEvents/MailReceivedModule.d.ts +13 -0
- package/dist/modules/appEvents/MailReceivedModule.js +41 -0
- package/dist/modules/appEvents/MailReceivedModule.js.map +1 -0
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.d.ts +13 -0
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js +62 -0
- package/dist/modules/appEvents/OnboardingChangeReceivedModule.js.map +1 -0
- package/dist/modules/appEvents/index.d.ts +3 -0
- package/dist/modules/appEvents/index.js +16 -0
- package/dist/modules/appEvents/index.js.map +1 -0
- package/dist/modules/appSync/AppSyncModule.d.ts +13 -0
- package/dist/modules/appSync/AppSyncModule.js +37 -0
- package/dist/modules/appSync/AppSyncModule.js.map +1 -0
- package/dist/modules/appSync/index.d.ts +1 -0
- package/dist/modules/appSync/index.js +14 -0
- package/dist/modules/appSync/index.js.map +1 -0
- package/dist/modules/index.d.ts +5 -0
- package/dist/modules/index.js +18 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/pushNotifications/IBackboneEventContent.d.ts +10 -0
- package/dist/modules/pushNotifications/IBackboneEventContent.js +9 -0
- package/dist/modules/pushNotifications/IBackboneEventContent.js.map +1 -0
- package/dist/modules/pushNotifications/PushNotificationModule.d.ts +17 -0
- package/dist/modules/pushNotifications/PushNotificationModule.js +168 -0
- package/dist/modules/pushNotifications/PushNotificationModule.js.map +1 -0
- package/dist/modules/pushNotifications/index.d.ts +2 -0
- package/dist/modules/pushNotifications/index.js +15 -0
- package/dist/modules/pushNotifications/index.js.map +1 -0
- package/dist/modules/runtimeEvents/MessageReceivedModule.d.ts +13 -0
- package/dist/modules/runtimeEvents/MessageReceivedModule.js +52 -0
- package/dist/modules/runtimeEvents/MessageReceivedModule.js.map +1 -0
- package/dist/modules/runtimeEvents/RelationshipChangedModule.d.ts +13 -0
- package/dist/modules/runtimeEvents/RelationshipChangedModule.js +46 -0
- package/dist/modules/runtimeEvents/RelationshipChangedModule.js.map +1 -0
- package/dist/modules/runtimeEvents/index.d.ts +2 -0
- package/dist/modules/runtimeEvents/index.js +15 -0
- package/dist/modules/runtimeEvents/index.js.map +1 -0
- package/dist/multiAccount/AccountServices.d.ts +13 -0
- package/dist/multiAccount/AccountServices.js +37 -0
- package/dist/multiAccount/AccountServices.js.map +1 -0
- package/dist/multiAccount/MultiAccountController.d.ts +28 -0
- package/dist/multiAccount/MultiAccountController.js +155 -0
- package/dist/multiAccount/MultiAccountController.js.map +1 -0
- package/dist/multiAccount/MultiAccountFacade.d.ts +15 -0
- package/dist/multiAccount/MultiAccountFacade.js +46 -0
- package/dist/multiAccount/MultiAccountFacade.js.map +1 -0
- package/dist/multiAccount/data/LocalAccount.d.ts +18 -0
- package/dist/multiAccount/data/LocalAccount.js +55 -0
- package/dist/multiAccount/data/LocalAccount.js.map +1 -0
- package/dist/multiAccount/data/LocalAccountDTO.d.ts +8 -0
- package/dist/multiAccount/data/LocalAccountDTO.js +3 -0
- package/dist/multiAccount/data/LocalAccountDTO.js.map +1 -0
- package/dist/multiAccount/data/LocalAccountMapper.d.ts +5 -0
- package/dist/multiAccount/data/LocalAccountMapper.js +18 -0
- package/dist/multiAccount/data/LocalAccountMapper.js.map +1 -0
- package/dist/multiAccount/data/LocalAccountSession.d.ts +17 -0
- package/dist/multiAccount/data/LocalAccountSession.js +3 -0
- package/dist/multiAccount/data/LocalAccountSession.js.map +1 -0
- package/dist/multiAccount/index.d.ts +6 -0
- package/dist/multiAccount/index.js +19 -0
- package/dist/multiAccount/index.js.map +1 -0
- package/lib-web/nmshd.app-runtime.js +23621 -0
- package/lib-web/nmshd.app-runtime.min.js +3 -0
- package/package.json +71 -0
- package/ui5.yaml +9 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MailReceivedEvent = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
class MailReceivedEvent extends runtime_1.DataEvent {
|
|
6
|
+
constructor(address, message) {
|
|
7
|
+
super(MailReceivedEvent.namespace, address, message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.MailReceivedEvent = MailReceivedEvent;
|
|
11
|
+
MailReceivedEvent.namespace = "app.mailReceived";
|
|
12
|
+
//# sourceMappingURL=MailReceivedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailReceivedEvent.js","sourceRoot":"","sources":["../../src/events/MailReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AAEnE,MAAa,iBAAkB,SAAQ,mBAAmC;IAGtE,YAAmB,OAAe,EAAE,OAAiC;QACjE,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;;AALL,8CAMC;AAL0B,2BAAS,GAAW,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataEvent, IdentityDVO, RelationshipChangeDTO, RelationshipDTO } from "@nmshd/runtime";
|
|
2
|
+
export declare class OnboardingChangeReceivedEvent extends DataEvent<{
|
|
3
|
+
change: RelationshipChangeDTO;
|
|
4
|
+
relationship: RelationshipDTO;
|
|
5
|
+
identity: IdentityDVO;
|
|
6
|
+
}> {
|
|
7
|
+
static readonly namespace: string;
|
|
8
|
+
constructor(address: string, change: RelationshipChangeDTO, relationship: RelationshipDTO, identity: IdentityDVO);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OnboardingChangeReceivedEvent = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
class OnboardingChangeReceivedEvent extends runtime_1.DataEvent {
|
|
6
|
+
constructor(address, change, relationship, identity) {
|
|
7
|
+
super(OnboardingChangeReceivedEvent.namespace, address, {
|
|
8
|
+
change,
|
|
9
|
+
relationship,
|
|
10
|
+
identity
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.OnboardingChangeReceivedEvent = OnboardingChangeReceivedEvent;
|
|
15
|
+
OnboardingChangeReceivedEvent.namespace = "app.onboardingChangeReceived";
|
|
16
|
+
//# sourceMappingURL=OnboardingChangeReceivedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingChangeReceivedEvent.js","sourceRoot":"","sources":["../../src/events/OnboardingChangeReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAA+F;AAE/F,MAAa,6BAA8B,SAAQ,mBAIjD;IAGE,YACI,OAAe,EACf,MAA6B,EAC7B,YAA6B,EAC7B,QAAqB;QAErB,KAAK,CAAC,6BAA6B,CAAC,SAAS,EAAE,OAAO,EAAE;YACpD,MAAM;YACN,YAAY;YACZ,QAAQ;SACX,CAAC,CAAA;IACN,CAAC;;AAlBL,sEAmBC;AAd0B,uCAAS,GAAW,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RelationshipSelectedEvent = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
class RelationshipSelectedEvent extends runtime_1.DataEvent {
|
|
6
|
+
constructor(address, data) {
|
|
7
|
+
super(RelationshipSelectedEvent.namespace, address, data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.RelationshipSelectedEvent = RelationshipSelectedEvent;
|
|
11
|
+
RelationshipSelectedEvent.namespace = "app.relationshipSelected";
|
|
12
|
+
//# sourceMappingURL=RelationshipSelectedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipSelectedEvent.js","sourceRoot":"","sources":["../../src/events/RelationshipSelectedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AAEvD,MAAa,yBAA0B,SAAQ,mBAAsB;IAGjE,YAAmB,OAAe,EAAE,IAAiB;QACjD,KAAK,CAAC,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7D,CAAC;;AALL,8DAMC;AAL0B,mCAAS,GAAW,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataEvent, MessageDVO, RequestDVO, RequestMailDVO } from "@nmshd/runtime";
|
|
2
|
+
export declare class RequestReceivedEvent extends DataEvent<{
|
|
3
|
+
request: RequestDVO;
|
|
4
|
+
message: MessageDVO | RequestMailDVO;
|
|
5
|
+
}> {
|
|
6
|
+
static readonly namespace: string;
|
|
7
|
+
constructor(address: string, request: RequestDVO, message: MessageDVO | RequestMailDVO);
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestReceivedEvent = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
class RequestReceivedEvent extends runtime_1.DataEvent {
|
|
6
|
+
constructor(address, request, message) {
|
|
7
|
+
super(RequestReceivedEvent.namespace, address, {
|
|
8
|
+
request,
|
|
9
|
+
message
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RequestReceivedEvent = RequestReceivedEvent;
|
|
14
|
+
RequestReceivedEvent.namespace = "app.requestReceived";
|
|
15
|
+
//# sourceMappingURL=RequestReceivedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestReceivedEvent.js","sourceRoot":"","sources":["../../src/events/RequestReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAkF;AAElF,MAAa,oBAAqB,SAAQ,mBAGxC;IAGE,YAAmB,OAAe,EAAE,OAAmB,EAAE,OAAoC;QACzF,KAAK,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE;YAC3C,OAAO;YACP,OAAO;SACV,CAAC,CAAA;IACN,CAAC;;AAXL,oDAYC;AAR0B,8BAAS,GAAW,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./AccountSelectedEvent";
|
|
2
|
+
export * from "./DatawalletSynchronizedEvent";
|
|
3
|
+
export * from "./ExternalEventReceivedEvent";
|
|
4
|
+
export * from "./MailReceivedEvent";
|
|
5
|
+
export * from "./OnboardingChangeReceivedEvent";
|
|
6
|
+
export * from "./RelationshipSelectedEvent";
|
|
7
|
+
export * from "./RequestReceivedEvent";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AccountSelectedEvent"), exports);
|
|
14
|
+
__exportStar(require("./DatawalletSynchronizedEvent"), exports);
|
|
15
|
+
__exportStar(require("./ExternalEventReceivedEvent"), exports);
|
|
16
|
+
__exportStar(require("./MailReceivedEvent"), exports);
|
|
17
|
+
__exportStar(require("./OnboardingChangeReceivedEvent"), exports);
|
|
18
|
+
__exportStar(require("./RelationshipSelectedEvent"), exports);
|
|
19
|
+
__exportStar(require("./RequestReceivedEvent"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAsC;AACtC,gEAA6C;AAC7C,+DAA4C;AAC5C,sDAAmC;AACnC,kEAA+C;AAC/C,8DAA2C;AAC3C,yDAAsC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppRuntime } from "../AppRuntime";
|
|
2
|
+
import { AppRelationshipFacade, AppStringProcessorFacade } from "./facades";
|
|
3
|
+
export declare class AppServices {
|
|
4
|
+
readonly relationships: AppRelationshipFacade;
|
|
5
|
+
readonly stringProcessor: AppStringProcessorFacade;
|
|
6
|
+
constructor(appRuntime: AppRuntime);
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppServices = void 0;
|
|
4
|
+
const facades_1 = require("./facades");
|
|
5
|
+
class AppServices {
|
|
6
|
+
constructor(appRuntime) {
|
|
7
|
+
this.relationships = new facades_1.AppRelationshipFacade(appRuntime);
|
|
8
|
+
this.stringProcessor = new facades_1.AppStringProcessorFacade(appRuntime);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AppServices = AppServices;
|
|
12
|
+
//# sourceMappingURL=AppServices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppServices.js","sourceRoot":"","sources":["../../src/extensibility/AppServices.ts"],"names":[],"mappings":";;;AACA,uCAA2E;AAE3E,MAAa,WAAW;IAIpB,YAAmB,UAAsB;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,+BAAqB,CAAC,UAAU,CAAC,CAAA;QAC1D,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAwB,CAAC,UAAU,CAAC,CAAA;IACnE,CAAC;CACJ;AARD,kCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipItemsDVO.js","sourceRoot":"","sources":["../../../src/extensibility/DVOs/RelationshipItemsDVO.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AcceptRelationshipChangeRequest, CreateRelationshipChangeRequest, CreateRelationshipRequest, GetRelationshipByAddressRequest, GetRelationshipRequest, GetRelationshipsRequest, IdentityDVO, RejectRelationshipChangeRequest, RevokeRelationshipChangeRequest } from "@nmshd/runtime";
|
|
2
|
+
import { UserfriendlyResult } from "../../UserfriendlyResult";
|
|
3
|
+
import { RelationshipItemsDVO } from "../DVOs/RelationshipItemsDVO";
|
|
4
|
+
import { AppRuntimeFacade } from "./AppRuntimeFacade";
|
|
5
|
+
export declare class AppRelationshipFacade extends AppRuntimeFacade {
|
|
6
|
+
renderActiveRelationships(): Promise<UserfriendlyResult<IdentityDVO[]>>;
|
|
7
|
+
renderAllRelationships(): Promise<UserfriendlyResult<IdentityDVO[]>>;
|
|
8
|
+
renderRelationship(id: string): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
9
|
+
renderRelationshipItems(id: string, limit: number): Promise<UserfriendlyResult<RelationshipItemsDVO>>;
|
|
10
|
+
acceptRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
11
|
+
rejectRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
12
|
+
revokeRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
13
|
+
getRelationships(request: GetRelationshipsRequest): Promise<UserfriendlyResult<IdentityDVO[]>>;
|
|
14
|
+
getRelationship(request: GetRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
15
|
+
getRelationshipByAddress(request: GetRelationshipByAddressRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
16
|
+
createRelationship(request: CreateRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
17
|
+
createRelationshipChange(request: CreateRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
18
|
+
acceptRelationshipChange(request: AcceptRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
19
|
+
rejectRelationshipChange(request: RejectRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
20
|
+
revokeRelationshipChange(request: RevokeRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppRelationshipFacade = void 0;
|
|
4
|
+
const UserfriendlyResult_1 = require("../../UserfriendlyResult");
|
|
5
|
+
const AppRuntimeFacade_1 = require("./AppRuntimeFacade");
|
|
6
|
+
class AppRelationshipFacade extends AppRuntimeFacade_1.AppRuntimeFacade {
|
|
7
|
+
async renderActiveRelationships() {
|
|
8
|
+
return await this.getRelationships({
|
|
9
|
+
query: { status: "Active" }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async renderAllRelationships() {
|
|
13
|
+
return await this.getRelationships({});
|
|
14
|
+
}
|
|
15
|
+
async renderRelationship(id) {
|
|
16
|
+
return await this.getRelationship({ id });
|
|
17
|
+
}
|
|
18
|
+
async renderRelationshipItems(id, limit) {
|
|
19
|
+
const messagesResult = await this.transportServices.messages.getMessages({
|
|
20
|
+
query: { relationshipIds: id }
|
|
21
|
+
});
|
|
22
|
+
if (messagesResult.isError) {
|
|
23
|
+
return await this.parseErrorResult(messagesResult);
|
|
24
|
+
}
|
|
25
|
+
const dvo = [...(await this.expander.expandMessageDTOs(messagesResult.value))]
|
|
26
|
+
.sort((m1, m2) => { var _a, _b; return new Date((_a = m2.date) !== null && _a !== void 0 ? _a : 0).valueOf() - new Date((_b = m1.date) !== null && _b !== void 0 ? _b : 0).valueOf(); })
|
|
27
|
+
.slice(0, limit);
|
|
28
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(dvo);
|
|
29
|
+
}
|
|
30
|
+
async acceptRelationshipCreationChange(relationshipId, content) {
|
|
31
|
+
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
|
|
32
|
+
if (result.isError) {
|
|
33
|
+
return await this.parseErrorResult(result);
|
|
34
|
+
}
|
|
35
|
+
const changeId = result.value.changes[0].id;
|
|
36
|
+
return await this.acceptRelationshipChange({ relationshipId, changeId, content });
|
|
37
|
+
}
|
|
38
|
+
async rejectRelationshipCreationChange(relationshipId, content) {
|
|
39
|
+
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
|
|
40
|
+
if (result.isError) {
|
|
41
|
+
return await this.parseErrorResult(result);
|
|
42
|
+
}
|
|
43
|
+
const changeId = result.value.changes[0].id;
|
|
44
|
+
return await this.rejectRelationshipChange({ relationshipId, changeId, content });
|
|
45
|
+
}
|
|
46
|
+
async revokeRelationshipCreationChange(relationshipId, content) {
|
|
47
|
+
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
|
|
48
|
+
if (result.isError) {
|
|
49
|
+
return await this.parseErrorResult(result);
|
|
50
|
+
}
|
|
51
|
+
const changeId = result.value.changes[0].id;
|
|
52
|
+
return await this.revokeRelationshipChange({ relationshipId, changeId, content });
|
|
53
|
+
}
|
|
54
|
+
async getRelationships(request) {
|
|
55
|
+
const result = await this.transportServices.relationships.getRelationships(request);
|
|
56
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTOs(v));
|
|
57
|
+
}
|
|
58
|
+
async getRelationship(request) {
|
|
59
|
+
const result = await this.transportServices.relationships.getRelationship(request);
|
|
60
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
61
|
+
}
|
|
62
|
+
async getRelationshipByAddress(request) {
|
|
63
|
+
const result = await this.transportServices.relationships.getRelationshipByAddress(request);
|
|
64
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
65
|
+
}
|
|
66
|
+
async createRelationship(request) {
|
|
67
|
+
const result = await this.transportServices.relationships.createRelationship(request);
|
|
68
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
69
|
+
}
|
|
70
|
+
async createRelationshipChange(request) {
|
|
71
|
+
const result = await this.transportServices.relationships.createRelationshipChange(request);
|
|
72
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
73
|
+
}
|
|
74
|
+
async acceptRelationshipChange(request) {
|
|
75
|
+
const result = await this.transportServices.relationships.acceptRelationshipChange(request);
|
|
76
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
77
|
+
}
|
|
78
|
+
async rejectRelationshipChange(request) {
|
|
79
|
+
const result = await this.transportServices.relationships.rejectRelationshipChange(request);
|
|
80
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
81
|
+
}
|
|
82
|
+
async revokeRelationshipChange(request) {
|
|
83
|
+
const result = await this.transportServices.relationships.revokeRelationshipChange(request);
|
|
84
|
+
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.AppRelationshipFacade = AppRelationshipFacade;
|
|
88
|
+
//# sourceMappingURL=AppRelationshipFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRelationshipFacade.js","sourceRoot":"","sources":["../../../src/extensibility/facades/AppRelationshipFacade.ts"],"names":[],"mappings":";;;AAYA,iEAA6D;AAE7D,yDAAqD;AAErD,MAAa,qBAAsB,SAAQ,mCAAgB;IAChD,KAAK,CAAC,yBAAyB;QAClC,OAAO,MAAM,IA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AAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAA;IACzF,CAAC;CACJ;AAtHD,sDAsHC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Result } from "@js-soft/ts-utils";
|
|
2
|
+
import { ConsumptionServices, DataViewExpander, TransportServices } from "@nmshd/runtime";
|
|
3
|
+
import { AppRuntime } from "../../AppRuntime";
|
|
4
|
+
import { UserfriendlyApplicationError } from "../../UserfriendlyApplicationError";
|
|
5
|
+
export declare abstract class AppRuntimeFacade {
|
|
6
|
+
protected readonly runtime: AppRuntime;
|
|
7
|
+
protected readonly transportServices: TransportServices;
|
|
8
|
+
protected readonly consumptionServices: ConsumptionServices;
|
|
9
|
+
protected readonly expander: DataViewExpander;
|
|
10
|
+
constructor(runtime: AppRuntime);
|
|
11
|
+
protected parseErrorResult<T>(result: Result<any>): Promise<Result<T, UserfriendlyApplicationError>>;
|
|
12
|
+
protected handleResult<TOriginal, TWanted>(result: Result<TOriginal>, parsingFunction: (value: TOriginal) => Promise<TWanted> | TWanted): Promise<Result<TWanted, UserfriendlyApplicationError>>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppRuntimeFacade = void 0;
|
|
4
|
+
const UserfriendlyApplicationError_1 = require("../../UserfriendlyApplicationError");
|
|
5
|
+
const UserfriendlyResult_1 = require("../../UserfriendlyResult");
|
|
6
|
+
class AppRuntimeFacade {
|
|
7
|
+
constructor(runtime) {
|
|
8
|
+
this.runtime = runtime;
|
|
9
|
+
this.transportServices = runtime.transportServices;
|
|
10
|
+
this.consumptionServices = runtime.consumptionServices;
|
|
11
|
+
this.expander = runtime.expander;
|
|
12
|
+
}
|
|
13
|
+
async parseErrorResult(result) {
|
|
14
|
+
const userfriendlyMessageResult = await this.runtime.translate(result.error.code);
|
|
15
|
+
if (userfriendlyMessageResult.isSuccess) {
|
|
16
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(result.error, userfriendlyMessageResult.value));
|
|
17
|
+
}
|
|
18
|
+
return UserfriendlyResult_1.UserfriendlyResult.fail(UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(result.error, result.error.code));
|
|
19
|
+
}
|
|
20
|
+
async handleResult(result, parsingFunction) {
|
|
21
|
+
if (result.isError) {
|
|
22
|
+
return await this.parseErrorResult(result);
|
|
23
|
+
}
|
|
24
|
+
const parsed = await parsingFunction(result.value);
|
|
25
|
+
return UserfriendlyResult_1.UserfriendlyResult.ok(parsed);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AppRuntimeFacade = AppRuntimeFacade;
|
|
29
|
+
//# sourceMappingURL=AppRuntimeFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRuntimeFacade.js","sourceRoot":"","sources":["../../../src/extensibility/facades/AppRuntimeFacade.ts"],"names":[],"mappings":";;;AAGA,qFAAiF;AACjF,iEAA6D;AAE7D,MAAsB,gBAAgB;IAKlC,YAAsC,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QACrD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;QAClD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;QACtD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACpC,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAI,MAAmB;QACnD,MAAM,yBAAyB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACjF,IAAI,yBAAyB,CAAC,SAAS,EAAE;YACrC,OAAO,uCAAkB,CAAC,IAAI,CAC1B,2DAA4B,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,CACxF,CAAA;SACJ;QACD,OAAO,uCAAkB,CAAC,IAAI,CAC1B,2DAA4B,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAC1E,CAAA;IACL,CAAC;IAES,KAAK,CAAC,YAAY,CACxB,MAAyB,EACzB,eAAiE;QAEjE,IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAU,MAAM,CAAC,CAAA;SACtD;QAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAClD,OAAO,uCAAkB,CAAC,EAAE,CAAwC,MAAM,CAAC,CAAA;IAC/E,CAAC;CACJ;AAlCD,4CAkCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 = await ts_serval_1.SerializableAsync.fromUnknown(content);
|
|
41
|
+
if (tokenContent instanceof transport_1.TokenContentRelationshipTemplate) {
|
|
42
|
+
const templateResult = await this.runtime.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppStringProcessorFacade.js","sourceRoot":"","sources":["../../../src/extensibility/facades/AppStringProcessorFacade.ts"],"names":[],"mappings":";;;AAAA,kDAAsD;AACtD,gDAAmG;AACnG,6DAAyD;AAEzD,iEAA6D;AAC7D,yDAAqD;AAErD,MAAa,wBAAyB,S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A;YAClD,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAO,uCAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACxC;QACD,OAAO,uCAAkB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;;AAtEL,4DAuEC;AAtE2B,iCAAQ,GAAG,qDAAqD,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AppRelationshipFacade"), exports);
|
|
14
|
+
__exportStar(require("./AppStringProcessorFacade"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensibility/facades/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAuC;AACvC,6DAA0C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AppServices"), exports);
|
|
14
|
+
__exportStar(require("./ui/IUIBridge"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extensibility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA6B;AAC7B,iDAA8B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Result } from "@js-soft/ts-utils";
|
|
2
|
+
import { IdentityDVO, MailDVO, MessageDVO, RelationshipChangeDTO, RelationshipTemplateDTO, RequestMailDVO, TokenDTO } from "@nmshd/runtime";
|
|
3
|
+
import { LocalAccountDTO } from "../../multiAccount";
|
|
4
|
+
import { UserfriendlyApplicationError } from "../../UserfriendlyApplicationError";
|
|
5
|
+
export interface IUIBridge {
|
|
6
|
+
showMessage(account: LocalAccountDTO, relationship: IdentityDVO, message: MessageDVO | MailDVO | RequestMailDVO): Promise<Result<void>>;
|
|
7
|
+
showRelationship(account: LocalAccountDTO, relationship: IdentityDVO): Promise<Result<void>>;
|
|
8
|
+
showRelationshipChange(account: LocalAccountDTO, relationship: IdentityDVO, change: RelationshipChangeDTO): Promise<Result<void>>;
|
|
9
|
+
showRelationshipTemplate(account: LocalAccountDTO, relationshipTemplate: RelationshipTemplateDTO): Promise<Result<void>>;
|
|
10
|
+
showDeviceOnboarding(token: TokenDTO): Promise<Result<void>>;
|
|
11
|
+
showRecovery(token: TokenDTO): Promise<Result<void>>;
|
|
12
|
+
showError(error: UserfriendlyApplicationError, account?: LocalAccountDTO): Promise<Result<void>>;
|
|
13
|
+
requestAccountSelection(possibleAccounts: LocalAccountDTO[], title?: string, description?: string): Promise<Result<LocalAccountDTO>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IUIBridge.js","sourceRoot":"","sources":["../../../src/extensibility/ui/IUIBridge.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./AppConfig";
|
|
2
|
+
export * from "./AppRuntime";
|
|
3
|
+
export * from "./AppRuntimeError";
|
|
4
|
+
export * from "./AppRuntimeErrors";
|
|
5
|
+
export * from "./buildInformation";
|
|
6
|
+
export * from "./events";
|
|
7
|
+
export * from "./extensibility";
|
|
8
|
+
export * from "./modules";
|
|
9
|
+
export * from "./multiAccount";
|
|
10
|
+
export * from "./UserfriendlyApplicationError";
|
|
11
|
+
export * from "./UserfriendlyResult";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AppConfig"), exports);
|
|
14
|
+
__exportStar(require("./AppRuntime"), exports);
|
|
15
|
+
__exportStar(require("./AppRuntimeError"), exports);
|
|
16
|
+
__exportStar(require("./AppRuntimeErrors"), exports);
|
|
17
|
+
__exportStar(require("./buildInformation"), exports);
|
|
18
|
+
__exportStar(require("./events"), exports);
|
|
19
|
+
__exportStar(require("./extensibility"), exports);
|
|
20
|
+
__exportStar(require("./modules"), exports);
|
|
21
|
+
__exportStar(require("./multiAccount"), exports);
|
|
22
|
+
__exportStar(require("./UserfriendlyApplicationError"), exports);
|
|
23
|
+
__exportStar(require("./UserfriendlyResult"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B;AAC5B,oDAAiC;AACjC,qDAAkC;AAClC,qDAAkC;AAClC,2CAAwB;AACxB,kDAA+B;AAC/B,4CAAyB;AACzB,iDAA8B;AAC9B,iEAA8C;AAC9C,uDAAoC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModuleConfiguration, RuntimeModule } from "@nmshd/runtime";
|
|
2
|
+
import { AppRuntime } from "../AppRuntime";
|
|
3
|
+
export interface IAppRuntimeModuleConstructor {
|
|
4
|
+
new (): AppRuntimeModule;
|
|
5
|
+
}
|
|
6
|
+
export interface AppRuntimeModuleConfiguration extends ModuleConfiguration {
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class AppRuntimeModule<TConfig extends AppRuntimeModuleConfiguration = AppRuntimeModuleConfiguration> extends RuntimeModule<TConfig, AppRuntime> {
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppRuntimeModule = void 0;
|
|
4
|
+
const runtime_1 = require("@nmshd/runtime");
|
|
5
|
+
class AppRuntimeModule extends runtime_1.RuntimeModule {
|
|
6
|
+
}
|
|
7
|
+
exports.AppRuntimeModule = AppRuntimeModule;
|
|
8
|
+
//# sourceMappingURL=AppRuntimeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRuntimeModule.js","sourceRoot":"","sources":["../../src/modules/AppRuntimeModule.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AASnE,MAAsB,gBAEpB,SAAQ,uBAAkC;CAAG;AAF/C,4CAE+C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppRuntimeError } from "../../AppRuntimeError";
|
|
2
|
+
import { AppRuntimeModule, AppRuntimeModuleConfiguration } from "../AppRuntimeModule";
|
|
3
|
+
export interface AppLaunchModuleConfig extends AppRuntimeModuleConfiguration {
|
|
4
|
+
}
|
|
5
|
+
export declare class AppLaunchModuleError extends AppRuntimeError {
|
|
6
|
+
}
|
|
7
|
+
export declare class AppLaunchModule extends AppRuntimeModule<AppLaunchModuleConfig> {
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
private urlOpenEventListener;
|
|
10
|
+
private urlOpenSubscriptionId;
|
|
11
|
+
start(): void;
|
|
12
|
+
stop(): void;
|
|
13
|
+
}
|