Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/adapt runtime to new relationships api #90

Merged
merged 118 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
b801218
chore: adapt accept, reject, revoke runtime use cases
Magnus-Kuhn Apr 3, 2024
e4dd01e
chore: change relationship classes
Magnus-Kuhn Apr 4, 2024
8fd5692
chore: adapt transmission types
Magnus-Kuhn Apr 5, 2024
2be2ee7
chore: rename transmission request/response types
Magnus-Kuhn Apr 5, 2024
0e3b27f
fix: relationships backbone response type
Magnus-Kuhn Apr 5, 2024
67e7de2
chore: adapt RelationshipsController
Magnus-Kuhn Apr 5, 2024
9d0c485
chore: adapt ExternalEventsProcessor
Magnus-Kuhn Apr 5, 2024
18c00f1
chore: adapt the relationship use cases
Magnus-Kuhn Apr 5, 2024
827d224
chore: adapt request response type
Magnus-Kuhn Apr 5, 2024
ac3c486
chore: adapt completing incoming requests
Magnus-Kuhn Apr 8, 2024
9ab69ab
refactor: content type names
Magnus-Kuhn Apr 8, 2024
6404793
feat: get relationship with audit logs, fix types
Magnus-Kuhn Apr 8, 2024
b3e46f5
chore: adapt outgoing request controller and use cases
Magnus-Kuhn Apr 8, 2024
c3a5528
chore: adapt relationship (change) dtos
Magnus-Kuhn Apr 8, 2024
aa5402f
chore: adapt request module
Magnus-Kuhn Apr 8, 2024
37431bd
chore: adapt index file
Magnus-Kuhn Apr 8, 2024
68c4268
refactor: auditLog is transport relationship member
Magnus-Kuhn Apr 9, 2024
622b9c9
chore: adapt relationship getter use cases
Magnus-Kuhn Apr 9, 2024
dba02a9
chore: rename use cases
Magnus-Kuhn Apr 9, 2024
99a73fc
chore: adapt transport validation
Magnus-Kuhn Apr 9, 2024
165dc9e
chore: adapt schemas and further renaming
Magnus-Kuhn Apr 9, 2024
7232b7b
chore: rename relation creation request content file
Magnus-Kuhn Apr 9, 2024
0215ea7
refactor: renaming types
Magnus-Kuhn Apr 9, 2024
52d33a9
chore: adapt request consumption tests
Magnus-Kuhn Apr 9, 2024
cf53d3b
refactor: rename content to creation content in sendRelationship
Magnus-Kuhn Apr 9, 2024
2ae83c8
fix: relationship creation request type name
Magnus-Kuhn Apr 9, 2024
a7ec033
chore: adapt final consumption and transport tests
Magnus-Kuhn Apr 9, 2024
47331f0
chore: adapt runtime tests
Magnus-Kuhn Apr 9, 2024
19bc595
fix: adapt changes in transport tests
Magnus-Kuhn Apr 10, 2024
1624e44
Merge branch 'main' into change-accept-reject-revoke
Magnus-Kuhn Apr 11, 2024
0abbd2f
chore: adapt the new external event processor
Magnus-Kuhn Apr 11, 2024
c488b03
Merge branch 'main' into change-accept-reject-revoke
Magnus-Kuhn Apr 11, 2024
9bb5eb3
chore: use correct backbone version
Magnus-Kuhn Apr 11, 2024
9b44149
fix: adapt to backbone signature
Magnus-Kuhn Apr 11, 2024
d49e4de
fix: await promise
Magnus-Kuhn Apr 11, 2024
586b931
fix: update status with relationship
Magnus-Kuhn Apr 11, 2024
2e0a1d8
refactor: move audit log to relationship cache
Magnus-Kuhn Apr 15, 2024
15d4389
refactor: merge the relationship event handlers
Magnus-Kuhn Apr 15, 2024
bc0628d
fix: relationship controller flows
Magnus-Kuhn Apr 16, 2024
f81efbf
refactor: relationship types
Magnus-Kuhn Apr 16, 2024
bd1e630
fix: audit log deserializer
Magnus-Kuhn Apr 16, 2024
3af3a4f
fix: relationship event payload
Magnus-Kuhn Apr 16, 2024
203bd54
fix: get correct creation/acceptance content
Magnus-Kuhn Apr 16, 2024
64a9cab
fix: only decrypt relationship if secrets available
Magnus-Kuhn Apr 16, 2024
3ec796f
fix: don't use sync result in a test
Magnus-Kuhn Apr 16, 2024
05a8270
chore: remove comments / debug code
Magnus-Kuhn Apr 16, 2024
f666757
fix: transport tests, sort audit log
Magnus-Kuhn Apr 16, 2024
3779066
fix: consumption tests, request controller type
Magnus-Kuhn Apr 16, 2024
ff72803
refactor: remove auditLog flag in useCases
Magnus-Kuhn Apr 17, 2024
b1d09a5
fix: assorted fixes
Magnus-Kuhn Apr 17, 2024
42ade71
Merge branch 'main' into change-accept-reject-revoke
Magnus-Kuhn Apr 17, 2024
2484e14
chore: update app-runtime
jkoenig134 Apr 17, 2024
6902417
fix: exports
jkoenig134 Apr 17, 2024
5a605b4
refactor: massively simplify DTO creation
jkoenig134 Apr 17, 2024
b3cd375
fix: app runtime tests
jkoenig134 Apr 17, 2024
06bff09
fix: import
jkoenig134 Apr 17, 2024
24b962f
fix: mandatory audit log
Magnus-Kuhn Apr 17, 2024
b195385
fix: adapt relationship dto/dvo, remove null checks
Magnus-Kuhn Apr 17, 2024
3b4e7c7
refactor/fix: add audit log to test factory, remove redundant method
Magnus-Kuhn Apr 17, 2024
380a7ff
Merge branch 'main' into change-accept-reject-revoke
mergify[bot] Apr 17, 2024
0615722
fix: de-duplicate functions
jkoenig134 Apr 17, 2024
030e678
fix: redo old behaviour
jkoenig134 Apr 17, 2024
f575022
fix: casing
jkoenig134 Apr 17, 2024
3ee3c28
fix: update event behaviour
jkoenig134 Apr 17, 2024
3f2d662
fix: re-add some tests
jkoenig134 Apr 17, 2024
a68593f
fix: make peer an address again
jkoenig134 Apr 17, 2024
786eb9f
refactor: mandatory payload in put
Magnus-Kuhn Apr 18, 2024
d8928cd
feat: add the relationship changes to the relationship dto
Magnus-Kuhn Apr 18, 2024
cf1b2df
chore: add validation to outoing request controller
Magnus-Kuhn Apr 18, 2024
fea0896
refactor: relationshipCreationContent instead of CreationRequestContent
Magnus-Kuhn Apr 18, 2024
9ac0703
refactor/fix: auditLog to relationshipAuditLog, add createdByDevice
Magnus-Kuhn Apr 18, 2024
8435889
refactor: simplify RelationshipMapper
jkoenig134 Apr 18, 2024
6319c1e
chore: remove unused runtime error
jkoenig134 Apr 18, 2024
d363ab7
fix: re-add check, remove throw
jkoenig134 Apr 18, 2024
32afb14
fix: add createdByDevice to relationship DTO
Magnus-Kuhn Apr 18, 2024
b1f05e1
refactor: cleaner function call
Magnus-Kuhn Apr 18, 2024
908c231
test: add old relationship change tests; test for creation content
Magnus-Kuhn Apr 18, 2024
ecd1878
fix: add createdByDevice to audit log method
Magnus-Kuhn Apr 18, 2024
8a1dddb
fix: wrong type annotations
Magnus-Kuhn Apr 18, 2024
c58f1a1
fix: condition in createRequestFromTemplateResponse
Magnus-Kuhn Apr 18, 2024
e502fa5
fix: add createdBDevice to TestObjectFactory audit logs
Magnus-Kuhn Apr 19, 2024
f32da91
refactor: rename auditLog file
Magnus-Kuhn Apr 19, 2024
bec035a
refactor: cosmetic changes
Magnus-Kuhn Apr 19, 2024
83b61fe
refactor: correct audit log in test object factory
Magnus-Kuhn Apr 19, 2024
87e772e
fix: add oldStatus
Magnus-Kuhn Apr 19, 2024
b248fbb
refactor: remove empty acceptanceContents
Magnus-Kuhn Apr 19, 2024
b4baac9
refactor: request/response to creation-/acceptanceContent
Magnus-Kuhn Apr 19, 2024
5b5152f
chore: adapt backbone return types, type check
Magnus-Kuhn Apr 19, 2024
d0acebf
fix: correctly use types
jkoenig134 Apr 19, 2024
522d93b
refactor: no type extension in backboneGetRelationships
Magnus-Kuhn Apr 19, 2024
980bc64
fix: catch undefined creation content
Magnus-Kuhn Apr 19, 2024
852154e
refactor: fail fast undefined creation content
Magnus-Kuhn Apr 19, 2024
34a2335
fix: this was supposed to be the previous commit
Magnus-Kuhn Apr 19, 2024
bad41ea
refactor: add relationship prefix to audit log
Magnus-Kuhn Apr 22, 2024
7b04c2f
refactor: rename relationship event processor
Magnus-Kuhn Apr 22, 2024
91e2ee8
refactor: change checks, use JSONWrapper for creation content
Magnus-Kuhn Apr 22, 2024
a097725
refactor: split audit log class
Magnus-Kuhn Apr 22, 2024
9090801
fix: update import
Magnus-Kuhn Apr 22, 2024
4a45fb2
Merge branch 'release/v5' into change-accept-reject-revoke
jkoenig134 Apr 23, 2024
51ed29d
refactor: acceptanceContent -> creationResponseContent
jkoenig134 Apr 24, 2024
e2eed23
refactor: combine events
jkoenig134 Apr 24, 2024
119f547
fix: naming
jkoenig134 Apr 24, 2024
ea536a6
chore: bump backbone
jkoenig134 Apr 24, 2024
f0cd83e
chore: add admin ui to compose
jkoenig134 Apr 24, 2024
210cafb
fix: naming
jkoenig134 Apr 24, 2024
49ec9a4
chore: naming
jkoenig134 Apr 24, 2024
851b140
fix: Relationships
jkoenig134 Apr 24, 2024
1f3246b
fix: re-add import
jkoenig134 Apr 24, 2024
2324f48
fix: update types and errors
jkoenig134 Apr 24, 2024
ceb3f94
chore: bump backbone
jkoenig134 Apr 24, 2024
48f8935
fix: add enum validators
jkoenig134 Apr 24, 2024
4432f09
Merge branch 'release/v5' into change-accept-reject-revoke
jkoenig134 Apr 24, 2024
d086f28
chore: any is always nullable
jkoenig134 Apr 24, 2024
fefcded
fix: pass creation content
jkoenig134 Apr 24, 2024
c75cb0f
fix: throw error again
jkoenig134 Apr 24, 2024
c1a0a40
chore: remove unused content
jkoenig134 Apr 24, 2024
a7445bc
fix: make publicCreationResponseContentCrypto required
jkoenig134 Apr 24, 2024
3a1875d
chore: update validate annotation
jkoenig134 Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dev/compose.backbone.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BACKBONE_VERSION=5.0.0
BACKBONE_VERSION=6.0.0-alpha.4
18 changes: 18 additions & 0 deletions .dev/compose.backbone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ services:
- source: Config
target: app/appsettings.override.json

admin-ui:
image: ghcr.io/nmshd/backbone-admin-ui:${BACKBONE_VERSION}
container_name: admin-ui
hostname: admin-ui
ports:
- "8091:8080"
depends_on:
database:
condition: service_started
rabbitmq:
condition: service_started
consumer-api:
condition: service_healthy
configs:
- source: Config
target: app/appsettings.override.json
profiles: [debug]

### infrastructure ###

database:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { DataEvent, IdentityDVO, RelationshipChangeDTO, RelationshipDTO } from "@nmshd/runtime";
import { DataEvent, IdentityDVO, RelationshipAuditLogEntryDTO, RelationshipDTO } from "@nmshd/runtime";

export class OnboardingChangeReceivedEvent extends DataEvent<{
change: RelationshipChangeDTO;
relationship: RelationshipDTO;
auditLogEntry: RelationshipAuditLogEntryDTO;
identity: IdentityDVO;
}> {
public static readonly namespace: string = "app.onboardingChangeReceived";

public constructor(address: string, change: RelationshipChangeDTO, relationship: RelationshipDTO, identity: IdentityDVO) {
public constructor(address: string, relationship: RelationshipDTO, auditLogEntry: RelationshipAuditLogEntryDTO, identity: IdentityDVO) {
super(OnboardingChangeReceivedEvent.namespace, address, {
change,
relationship,
auditLogEntry,
identity
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
AcceptRelationshipChangeRequest,
AcceptRelationshipRequest,
CreateRelationshipRequest,
GetRelationshipByAddressRequest,
GetRelationshipRequest,
GetRelationshipsRequest,
IdentityDVO,
RejectRelationshipChangeRequest,
RevokeRelationshipChangeRequest
RejectRelationshipRequest,
RevokeRelationshipRequest
} from "@nmshd/runtime";
import { UserfriendlyApplicationError } from "../../UserfriendlyApplicationError";
import { UserfriendlyResult } from "../../UserfriendlyResult";
Expand Down Expand Up @@ -43,34 +43,24 @@ export class AppRelationshipFacade extends AppRuntimeFacade {
return UserfriendlyResult.ok<RelationshipItemsDVO, UserfriendlyApplicationError>(dvo);
}

public async acceptRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
if (result.isError) {
return await this.parseErrorResult<IdentityDVO>(result);
}

const changeId = result.value.changes[0].id;
return await this.acceptRelationshipChange({ relationshipId, changeId, content });
public async createRelationship(request: CreateRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.createRelationship(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async rejectRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
if (result.isError) {
return await this.parseErrorResult<IdentityDVO>(result);
}

const changeId = result.value.changes[0].id;
return await this.rejectRelationshipChange({ relationshipId, changeId, content });
public async acceptRelationship(request: AcceptRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.acceptRelationship(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async revokeRelationshipCreationChange(relationshipId: string, content: any): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.getRelationship({ id: relationshipId });
if (result.isError) {
return await this.parseErrorResult<IdentityDVO>(result);
}
public async rejectRelationship(request: RejectRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.rejectRelationship(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

const changeId = result.value.changes[0].id;
return await this.revokeRelationshipChange({ relationshipId, changeId, content });
public async revokeRelationship(request: RevokeRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.revokeRelationship(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async getRelationships(request: GetRelationshipsRequest): Promise<UserfriendlyResult<IdentityDVO[]>> {
Expand All @@ -87,24 +77,4 @@ export class AppRelationshipFacade extends AppRuntimeFacade {
const result = await this.transportServices.relationships.getRelationshipByAddress(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async createRelationship(request: CreateRelationshipRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.createRelationship(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async acceptRelationshipChange(request: AcceptRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.acceptRelationshipChange(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async rejectRelationshipChange(request: RejectRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.rejectRelationshipChange(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}

public async revokeRelationshipChange(request: RevokeRelationshipChangeRequest): Promise<UserfriendlyResult<IdentityDVO>> {
const result = await this.transportServices.relationships.revokeRelationshipChange(request);
return await this.handleResult(result, (v) => this.expander.expandRelationshipDTO(v));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RelationshipChangeStatus } from "@nmshd/runtime";
import { RelationshipAuditLogEntryReason } from "@nmshd/runtime";
import { AppRuntimeError } from "../../AppRuntimeError";
import { OnboardingChangeReceivedEvent } from "../../events";
import { AppRuntimeModule, AppRuntimeModuleConfiguration } from "../AppRuntimeModule";
Expand All @@ -17,32 +17,35 @@ export class OnboardingChangeReceivedModule extends AppRuntimeModule<OnboardingC
}

private async handleOnboardingChangeReceived(event: OnboardingChangeReceivedEvent) {
const change = event.data.change;
const auditLogEntry = event.data.auditLogEntry;
const identity = event.data.identity;
let title = "";
let text = "";
const session = await this.runtime.getOrCreateSession(event.eventTargetAddress);

switch (change.status) {
case RelationshipChangeStatus.Accepted:
switch (auditLogEntry.reason) {
case RelationshipAuditLogEntryReason.AcceptanceOfCreation:
title = "Kontaktanfrage genehmigt";
text = `Du kannst nun mit ${identity.name} kommunizieren`;
break;

case RelationshipChangeStatus.Pending:
case RelationshipAuditLogEntryReason.Creation:
title = "Kontaktanfrage erhalten";
text = `Du hast eine Kontaktanfrage von ${identity.name} erhalten`;
break;

case RelationshipChangeStatus.Rejected:
case RelationshipAuditLogEntryReason.RejectionOfCreation:
title = "Kontaktanfrage abgelehnt";
text = `${identity.name} hat ihre Kontaktanfrage abgelehnt`;
break;

case RelationshipChangeStatus.Revoked:
case RelationshipAuditLogEntryReason.RevocationOfCreation:
title = "Kontaktanfrage zurückgezogen";
text = `${identity.name} hat die Kontaktanfrage zurückgezogen`;
break;

default:
return;
}
await this.runtime.nativeEnvironment.notificationAccess.schedule(title, text, {
callback: async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RelationshipChangedEvent } from "@nmshd/runtime";
import { RelationshipAuditLogEntryReason, RelationshipChangedEvent } from "@nmshd/runtime";
import { AppRuntimeError } from "../../AppRuntimeError";
import { OnboardingChangeReceivedEvent } from "../../events";
import { AppRuntimeModule, AppRuntimeModuleConfiguration } from "../AppRuntimeModule";
Expand All @@ -18,20 +18,28 @@ export class RelationshipChangedModule extends AppRuntimeModule<RelationshipChan

private async handleRelationshipChanged(event: RelationshipChangedEvent) {
const relationship = event.data;
// Only listen for the creation change (the first one)
if (relationship.changes.length !== 1) return;

const change = relationship.changes[0];
const lastAuditLogEntry = relationship.auditLog[relationship.auditLog.length - 1];

// response doest not exist and request created by the current identity
if (!change.response && change.request.createdBy === event.eventTargetAddress) return;
// Do not process changes that were created by the current user
if (lastAuditLogEntry.createdBy === event.eventTargetAddress) return;

// response exists and created by the current identity
if (change.response && change.response.createdBy === event.eventTargetAddress) return;
switch (lastAuditLogEntry.reason) {
case RelationshipAuditLogEntryReason.Creation:
case RelationshipAuditLogEntryReason.AcceptanceOfCreation:
case RelationshipAuditLogEntryReason.RevocationOfCreation:
case RelationshipAuditLogEntryReason.RejectionOfCreation:
break;

default:
return;
}

const services = await this.runtime.getServices(event.eventTargetAddress);
const relationshipDVO = await services.dataViewExpander.expandRelationshipDTO(relationship);
this.runtime.eventBus.publish(new OnboardingChangeReceivedEvent(event.eventTargetAddress, change, relationship, relationshipDVO));

const eventToPublish = new OnboardingChangeReceivedEvent(event.eventTargetAddress, relationship, lastAuditLogEntry, relationshipDVO);
this.runtime.eventBus.publish(eventToPublish);
}

public stop(): void {
Expand Down
68 changes: 7 additions & 61 deletions packages/app-runtime/test/lib/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,76 +198,22 @@ export class TestUtil {
mycontent: "request"
}
): Promise<RelationshipDTO> {
const relRequest = await from.transportServices.relationships.createRelationship({ templateId, content });
const relRequest = await from.transportServices.relationships.createRelationship({ templateId, creationContent: content });
return relRequest.value;
}

public static async acceptRelationship(
session: LocalAccountSession,
relationshipId: string,
content: any = {
mycontent: "response"
}
): Promise<RelationshipDTO> {
const relationship = (
await session.transportServices.relationships.getRelationship({
id: relationshipId
})
).value;

const acceptedRelationship = (
await session.transportServices.relationships.acceptRelationshipChange({
changeId: relationship.changes[0].id,
content,
relationshipId
})
).value;
public static async acceptRelationship(session: LocalAccountSession, relationshipId: string): Promise<RelationshipDTO> {
const acceptedRelationship = (await session.transportServices.relationships.acceptRelationship({ relationshipId })).value;
return acceptedRelationship;
}

public static async rejectRelationship(
session: LocalAccountSession,
relationshipId: string,
content: any = {
mycontent: "rejection"
}
): Promise<RelationshipDTO> {
const relationship = (
await session.transportServices.relationships.getRelationship({
id: relationshipId
})
).value;

const rejectedRelationship = (
await session.transportServices.relationships.rejectRelationshipChange({
changeId: relationship.changes[0].id,
content,
relationshipId
})
).value;
public static async rejectRelationship(session: LocalAccountSession, relationshipId: string): Promise<RelationshipDTO> {
const rejectedRelationship = (await session.transportServices.relationships.rejectRelationship({ relationshipId })).value;
return rejectedRelationship;
}

public static async revokeRelationship(
session: LocalAccountSession,
relationshipId: string,
content: any = {
mycontent: "revokation"
}
): Promise<RelationshipDTO> {
const relationship = (
await session.transportServices.relationships.getRelationship({
id: relationshipId
})
).value;

const rejectedRelationship = (
await session.transportServices.relationships.revokeRelationshipChange({
changeId: relationship.changes[0].id,
content,
relationshipId
})
).value;
public static async revokeRelationship(session: LocalAccountSession, relationshipId: string): Promise<RelationshipDTO> {
const rejectedRelationship = (await session.transportServices.relationships.revokeRelationship({ relationshipId })).value;
return rejectedRelationship;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RelationshipChangedEvent, RelationshipChangeStatus, RelationshipStatus } from "@nmshd/runtime";
import { RelationshipChangedEvent, RelationshipStatus } from "@nmshd/runtime";
import { AppRuntime, LocalAccountSession, OnboardingChangeReceivedEvent } from "../../src";
import { EventListener, TestUtil } from "../lib";

Expand Down Expand Up @@ -42,8 +42,7 @@ describe("RelationshipEventingAcceptTest", function () {
const onboardingChangeReceivedEvent = events[1].instance as OnboardingChangeReceivedEvent;
expect(onboardingChangeReceivedEvent).toBeInstanceOf(OnboardingChangeReceivedEvent);
expect(onboardingChangeReceivedEvent.data).toBeDefined();
expect(onboardingChangeReceivedEvent.data.change.status).toBe(RelationshipChangeStatus.Pending);
expect(onboardingChangeReceivedEvent.data.change).toBe(relationshipChangedEvent.data.changes[0]);
expect(onboardingChangeReceivedEvent.data.auditLogEntry.newStatus).toBe(RelationshipStatus.Pending);
expect(onboardingChangeReceivedEvent.data.identity).toBeDefined();
expect(onboardingChangeReceivedEvent.data.identity.id).toBe(sessionB.address.toString());
expect(onboardingChangeReceivedEvent.data.identity.name).toBe(sessionB.address.toString().substring(3, 9));
Expand Down Expand Up @@ -85,8 +84,7 @@ describe("RelationshipEventingAcceptTest", function () {
const onboardingChangeReceivedEvent = events[1].instance as OnboardingChangeReceivedEvent;
expect(onboardingChangeReceivedEvent).toBeInstanceOf(OnboardingChangeReceivedEvent);
expect(onboardingChangeReceivedEvent.data).toBeDefined();
expect(onboardingChangeReceivedEvent.data.change.status).toBe(RelationshipChangeStatus.Accepted);
expect(onboardingChangeReceivedEvent.data.change).toBe(relationshipChangedEvent.data.changes[0]);
expect(onboardingChangeReceivedEvent.data.auditLogEntry.newStatus).toBe(RelationshipStatus.Active);
expect(onboardingChangeReceivedEvent.data.identity).toBeDefined();
expect(onboardingChangeReceivedEvent.data.identity.name).toBe(sessionA.accountController.identity.address.toString().substring(3, 9));
expect(onboardingChangeReceivedEvent.data.identity.id).toBe(sessionA.accountController.identity.address.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RelationshipChangedEvent, RelationshipChangeStatus, RelationshipStatus } from "@nmshd/runtime";
import { RelationshipChangedEvent, RelationshipStatus } from "@nmshd/runtime";
import { AppRuntime, LocalAccountSession, OnboardingChangeReceivedEvent } from "../../src";
import { EventListener, TestUtil } from "../lib";

Expand Down Expand Up @@ -42,8 +42,7 @@ describe("RelationshipEventingRejectTest", function () {
const onboardingChangeReceivedEvent = events[1].instance as OnboardingChangeReceivedEvent;
expect(onboardingChangeReceivedEvent).toBeInstanceOf(OnboardingChangeReceivedEvent);
expect(onboardingChangeReceivedEvent.data).toBeDefined();
expect(onboardingChangeReceivedEvent.data.change.status).toBe(RelationshipChangeStatus.Pending);
expect(onboardingChangeReceivedEvent.data.change).toBe(relationshipChangedEvent.data.changes[0]);
expect(onboardingChangeReceivedEvent.data.auditLogEntry.newStatus).toBe(RelationshipStatus.Pending);
expect(onboardingChangeReceivedEvent.data.identity).toBeDefined();
expect(onboardingChangeReceivedEvent.data.identity.name).toBe(sessionB.accountController.identity.address.toString().substring(3, 9));
expect(onboardingChangeReceivedEvent.data.identity.id).toBe(sessionB.accountController.identity.address.toString());
Expand Down Expand Up @@ -84,8 +83,7 @@ describe("RelationshipEventingRejectTest", function () {
const onboardingChangeReceivedEvent = events[1].instance as OnboardingChangeReceivedEvent;
expect(onboardingChangeReceivedEvent).toBeInstanceOf(OnboardingChangeReceivedEvent);
expect(onboardingChangeReceivedEvent.data).toBeDefined();
expect(onboardingChangeReceivedEvent.data.change.status).toBe(RelationshipChangeStatus.Rejected);
expect(onboardingChangeReceivedEvent.data.change).toBe(relationshipChangedEvent.data.changes[0]);
expect(onboardingChangeReceivedEvent.data.auditLogEntry.newStatus).toBe(RelationshipStatus.Rejected);
expect(onboardingChangeReceivedEvent.data.identity).toBeDefined();

expect(onboardingChangeReceivedEvent.data.identity.name).toBe(sessionA.accountController.identity.address.toString().substring(3, 9));
Expand Down
Loading