Skip to content

Commit 04cc4a0

Browse files
authored
Support Relationship Decomposition Based Identity Deletion (#330)
* chore: update transport types * chore: update runtime types
1 parent 0465930 commit 04cc4a0

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

packages/runtime/src/types/transport/RelationshipDTO.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ export enum RelationshipAuditLogEntryReason {
2121
AcceptanceOfReactivation = "AcceptanceOfReactivation",
2222
RejectionOfReactivation = "RejectionOfReactivation",
2323
RevocationOfReactivation = "RevocationOfReactivation",
24-
Decomposition = "Decomposition"
24+
Decomposition = "Decomposition",
25+
DecompositionDueToIdentityDeletion = "DecompositionDueToIdentityDeletion"
2526
}
2627

2728
export interface RelationshipAuditLogEntryDTO {
2829
createdAt: string;
2930
createdBy: string;
30-
createdByDevice: string;
31+
createdByDevice?: string;
3132
reason: RelationshipAuditLogEntryReason;
3233
oldStatus?: RelationshipStatus;
3334
newStatus: RelationshipStatus;

packages/runtime/src/useCases/transport/relationships/RelationshipMapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class RelationshipMapper {
3030
return {
3131
createdAt: entry.createdAt.toString(),
3232
createdBy: entry.createdBy.toString(),
33-
createdByDevice: entry.createdByDevice.toString(),
33+
createdByDevice: entry.createdByDevice?.toString(),
3434
reason: entry.reason,
3535
oldStatus: entry.oldStatus,
3636
newStatus: entry.newStatus

packages/transport/src/modules/relationships/local/RelationshipAuditLog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class RelationshipAuditLog {
99
return RelationshipAuditLogEntry.from({
1010
createdAt: CoreDate.from(entry.createdAt),
1111
createdBy: CoreAddress.from(entry.createdBy),
12-
createdByDevice: CoreId.from(entry.createdByDevice),
12+
createdByDevice: entry.createdByDevice ? CoreId.from(entry.createdByDevice) : undefined,
1313
reason: entry.reason,
1414
oldStatus: entry.oldStatus,
1515
newStatus: entry.newStatus

packages/transport/src/modules/relationships/local/RelationshipAuditLogEntry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { RelationshipStatus } from "../transmission/RelationshipStatus";
66
export interface IRelationshipAuditLogEntry extends ISerializable {
77
createdAt: ICoreDate;
88
createdBy: ICoreAddress;
9-
createdByDevice: ICoreId;
9+
createdByDevice?: ICoreId;
1010
reason: RelationshipAuditLogEntryReason;
1111
oldStatus?: RelationshipStatus;
1212
newStatus: RelationshipStatus;
@@ -22,9 +22,9 @@ export class RelationshipAuditLogEntry extends Serializable implements IRelation
2222
@serialize()
2323
public createdBy: CoreAddress;
2424

25-
@validate()
25+
@validate({ nullable: true })
2626
@serialize()
27-
public createdByDevice: CoreId;
27+
public createdByDevice?: CoreId;
2828

2929
@validate({
3030
customValidator: (v) => (!Object.values(RelationshipAuditLogEntryReason).includes(v) ? `must be one of: ${Object.values(RelationshipAuditLogEntryReason)}` : undefined)

packages/transport/src/modules/relationships/transmission/RelationshipAuditLog.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface BackboneRelationshipAuditLog extends Array<BackboneRelationship
55
export interface BackboneRelationshipAuditLogEntry {
66
createdAt: string;
77
createdBy: string;
8-
createdByDevice: string;
8+
createdByDevice?: string;
99
reason: RelationshipAuditLogEntryReason;
1010
oldStatus?: RelationshipStatus;
1111
newStatus: RelationshipStatus;
@@ -21,5 +21,6 @@ export enum RelationshipAuditLogEntryReason {
2121
AcceptanceOfReactivation = "AcceptanceOfReactivation",
2222
RejectionOfReactivation = "RejectionOfReactivation",
2323
RevocationOfReactivation = "RevocationOfReactivation",
24-
Decomposition = "Decomposition"
24+
Decomposition = "Decomposition",
25+
DecompositionDueToIdentityDeletion = "DecompositionDueToIdentityDeletion"
2526
}

0 commit comments

Comments
 (0)