Skip to content

Commit

Permalink
Feature/Make tags optional for LocalAttributeDVOs (#139)
Browse files Browse the repository at this point in the history
* feat: make tags of LocalAttributeDVOs optional

* test: SharedToPeerAttributeDVO

* chore: version bump

* fix: adjust IQLQueryExpanded test
  • Loading branch information
Milena-Czierlinski authored May 27, 2024
1 parent 77472ce commit b808959
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 109 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/runtime",
"version": "4.9.0",
"version": "4.9.1",
"description": "The enmeshed client runtime.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime/src/dataViews/DataViewExpander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ export class DataViewExpander {
isDraft: false,
requestReference: localAttribute.shareInfo.requestReference?.toString(),
notificationReference: localAttribute.shareInfo.notificationReference?.toString(),
tags: identityAttribute.tags ? identityAttribute.tags : [],
tags: identityAttribute.tags,
valueType,
deletionStatus: localAttribute.deletionInfo?.deletionStatus,
deletionDate: localAttribute.deletionInfo?.deletionDate.toString()
Expand All @@ -1168,7 +1168,7 @@ export class DataViewExpander {
requestReference: localAttribute.shareInfo.requestReference?.toString(),
notificationReference: localAttribute.shareInfo.notificationReference?.toString(),
sourceAttribute: localAttribute.shareInfo.sourceAttribute?.toString(),
tags: identityAttribute.tags ? identityAttribute.tags : [],
tags: identityAttribute.tags,
valueType,
deletionStatus: localAttribute.deletionInfo?.deletionStatus,
deletionDate: localAttribute.deletionInfo?.deletionDate.toString()
Expand Down Expand Up @@ -1196,7 +1196,7 @@ export class DataViewExpander {
isOwn: true,
isDraft: false,
sharedWith: sharedToPeerDVOs as SharedToPeerAttributeDVO[],
tags: identityAttribute.tags ? identityAttribute.tags : [],
tags: identityAttribute.tags,
valueType
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface RepositoryAttributeDVO extends LocalAttributeDVO {
type: "RepositoryAttributeDVO";
sharedWith: SharedToPeerAttributeDVO[];
isOwn: true;
tags: string[];
tags?: string[];
}

/**
Expand All @@ -46,7 +46,7 @@ export interface SharedToPeerAttributeDVO extends LocalAttributeDVO {
notificationReference?: string;
sourceAttribute?: string;
isOwn: true;
tags: string[];
tags?: string[];
deletionDate?: string;
deletionStatus?: string;
}
Expand All @@ -60,7 +60,7 @@ export interface PeerAttributeDVO extends LocalAttributeDVO {
requestReference?: string;
notificationReference?: string;
isOwn: false;
tags: string[];
tags?: string[];
deletionDate?: string;
deletionStatus?: string;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/runtime/test/dataViews/IQLQueryExpanded.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe("IQLQueryExpanded", () => {
const givenName = dvo.value as AbstractStringJSON;
expect(givenName["@type"]).toBe("GivenName");
expect(givenName.value).toBe("Hugo");
expect(dvo.tags[0]).toBe("default");
expect(dvo.tags![0]).toBe("default");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand Down Expand Up @@ -150,7 +150,7 @@ describe("IQLQueryExpanded", () => {
const value3 = dvo.value as AbstractStringJSON;
expect(value3["@type"]).toBe("GivenName");
expect(value3.value).toBe("Tester");
expect(dvo.tags[0]).toBe("fake");
expect(dvo.tags![0]).toBe("fake");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand Down Expand Up @@ -195,7 +195,7 @@ describe("IQLQueryExpanded", () => {
const givenName = dvo.value as AbstractStringJSON;
expect(givenName["@type"]).toBe("GivenName");
expect(givenName.value).toBe("Hugo");
expect(dvo.tags[0]).toBe("default");
expect(dvo.tags![0]).toBe("default");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand Down Expand Up @@ -240,7 +240,7 @@ describe("IQLQueryExpanded", () => {
const givenName = dvo.value as AbstractStringJSON;
expect(givenName["@type"]).toBe("GivenName");
expect(givenName.value).toBe("Tester");
expect(dvo.tags[0]).toBe("fake");
expect(dvo.tags![0]).toBe("fake");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand Down Expand Up @@ -282,7 +282,7 @@ describe("IQLQueryExpanded", () => {
const givenName = dvo.value as AbstractStringJSON;
expect(givenName["@type"]).toBe("GivenName");
expect(givenName.value).toBe("Tester");
expect(dvo.tags[0]).toBe("fake");
expect(dvo.tags![0]).toBe("fake");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand All @@ -306,7 +306,7 @@ describe("IQLQueryExpanded", () => {
const value = dvo.value as AbstractStringJSON;
expect(value["@type"]).toBe("Surname");
expect(value.value).toBe("Nachname");
expect(dvo.tags[0]).toBe("fake");
expect(dvo.tags![0]).toBe("fake");
expect(dvo.createdAt).toStrictEqual(attribute.createdAt);
expect(dvo.isOwn).toBe(true);
expect(dvo.isValid).toBe(true);
Expand Down
Loading

0 comments on commit b808959

Please sign in to comment.