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/apply consistent attribute nomenclature #134

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 4.0.0

- upgrade the runtime version to 4.0.0
- use the names 'repository attribute' and 'own shared identity attribute'
jkoenig134 marked this conversation as resolved.
Show resolved Hide resolved

## 3.7.1

- upgrade the runtime version to 3.7.0
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/connector",
"version": "3.7.1",
"version": "4.0.0",
jkoenig134 marked this conversation as resolved.
Show resolved Hide resolved
"private": true,
"description": "The Enmeshed Connector",
"homepage": "https://enmeshed.eu/integrate",
Expand Down Expand Up @@ -65,7 +65,7 @@
"@js-soft/node-logger": "1.1.1",
"@js-soft/ts-utils": "^2.3.3",
"@nmshd/iql": "^1.0.1",
"@nmshd/runtime": "3.7.0",
"@nmshd/runtime": "4.0.0",
"agentkeepalive": "4.5.0",
"amqplib": "^0.10.3",
"axios": "^1.6.7",
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/src/endpoints/AttributesEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
ExecuteThirdPartyRelationshipAttributeQueryRequest,
GetAttributesRequest,
GetValidAttributesRequest,
NotifyPeerAboutIdentityAttributeSuccessionRequest,
NotifyPeerAboutIdentityAttributeSuccessionResponse,
NotifyPeerAboutRepositoryAttributeSuccessionRequest,
NotifyPeerAboutRepositoryAttributeSuccessionResponse,
SucceedAttributeRequest,
SucceedAttributeResponse
} from "../types";
Expand All @@ -25,10 +25,10 @@ export class AttributesEndpoint extends Endpoint {
return await this.post(`/api/v2/Attributes/${predecessorId}/Succeed`, request);
}

public async notifyPeerAboutIdentityAttributeSuccession(
public async notifyPeerAboutRepositoryAttributeSuccession(
attributeId: string,
request: NotifyPeerAboutIdentityAttributeSuccessionRequest
): Promise<ConnectorResponse<NotifyPeerAboutIdentityAttributeSuccessionResponse>> {
request: NotifyPeerAboutRepositoryAttributeSuccessionRequest
): Promise<ConnectorResponse<NotifyPeerAboutRepositoryAttributeSuccessionResponse>> {
return await this.post(`/api/v2/Attributes/${attributeId}/NotifyPeer`, request);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/types/attributes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export * from "./requests/ExecuteRelationshipAttributeQueryRequest";
export * from "./requests/ExecuteThirdPartyRelationshipAttributeQueryRequest";
export * from "./requests/GetAttributesRequest";
export * from "./requests/GetValidAttributesRequest";
export * from "./requests/NotifyPeerAboutIdentityAttributeSuccessionRequest";
export * from "./requests/NotifyPeerAboutIdentityAttributeSuccessionResponse";
export * from "./requests/NotifyPeerAboutRepositoryAttributeSuccessionRequest";
export * from "./requests/NotifyPeerAboutRepositoryAttributeSuccessionResponse";
export * from "./requests/SucceedAttributeRequest";
export * from "./requests/SucceedAttributeResponse";

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface NotifyPeerAboutRepositoryAttributeSuccessionRequest {
peer: string;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConnectorAttribute } from "../ConnectorAttribute";

export interface NotifyPeerAboutIdentityAttributeSuccessionResponse {
export interface NotifyPeerAboutRepositoryAttributeSuccessionResponse {
predecessor: ConnectorAttribute;
successor: ConnectorAttribute;
notificationId: string;
Expand Down
8 changes: 4 additions & 4 deletions src/modules/coreHttpApi/controllers/AttributesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AttributesController extends BaseController {
if (typeof request?.content?.owner !== "undefined") delete request.content.owner;
if (request?.content?.["@type"] === "IdentityAttribute") delete request.content["@type"];

const result = await this.consumptionServices.attributes.createIdentityAttribute(request);
const result = await this.consumptionServices.attributes.createRepositoryAttribute(request);
return this.created(result);
}

Expand All @@ -45,7 +45,7 @@ export class AttributesController extends BaseController {
const predecessor = result.value;

if (predecessor.content["@type"] === "IdentityAttribute") {
const result = await this.consumptionServices.attributes.succeedIdentityAttribute({
const result = await this.consumptionServices.attributes.succeedRepositoryAttribute({
predecessorId: predecessorId,
...request
});
Expand All @@ -62,8 +62,8 @@ export class AttributesController extends BaseController {
@POST
@Path("/:attributeId/NotifyPeer")
@Accept("application/json")
public async notifyPeerAboutIdentityAttributeSuccession(@PathParam("attributeId") attributeId: string, request: any): Promise<Return.NewResource<Envelope>> {
const result = await this.consumptionServices.attributes.notifyPeerAboutIdentityAttributeSuccession({ attributeId: attributeId, peer: request.peer });
public async notifyPeerAboutRepositoryAttributeSuccession(@PathParam("attributeId") attributeId: string, request: any): Promise<Return.NewResource<Envelope>> {
const result = await this.consumptionServices.attributes.notifyPeerAboutRepositoryAttributeSuccession({ attributeId: attributeId, peer: request.peer });
return this.created(result);
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/coreHttpApi/openapi.yml
jkoenig134 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ paths:
responses:
201:
description: |
"Success. Returns the successor and predecessor own shared repository
"Success. Returns the successor and predecessor own shared identity
attributes as well as the ID of the notification sent to the peer."
content:
application/json:
Expand Down
10 changes: 5 additions & 5 deletions test/attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { QueryParamConditions } from "./lib/QueryParamConditions";
import {
createRepositoryAttribute,
establishRelationship,
executeFullCreateAndShareIdentityAttributeFlow,
executeFullCreateAndShareRelationshipAttributeFlow,
executeFullCreateAndShareRepositoryAttributeFlow,
syncUntilHasMessageWithNotification,
syncUntilHasMessages
} from "./lib/testUtils";
Expand Down Expand Up @@ -98,7 +98,7 @@ describe("Attributes", () => {
});

test("Should notify peer about Repository Attribute Succession", async () => {
const ownSharedRepositoryAttribute = await executeFullCreateAndShareIdentityAttributeFlow(client1, client2, {
const ownSharedIdentityAttribute = await executeFullCreateAndShareRepositoryAttributeFlow(client1, client2, {
"@type": "IdentityAttribute",
owner: client1Address,
value: {
Expand All @@ -107,9 +107,9 @@ describe("Attributes", () => {
}
});

expect(ownSharedRepositoryAttribute.shareInfo?.sourceAttribute).toBeDefined();
expect(ownSharedIdentityAttribute.shareInfo?.sourceAttribute).toBeDefined();

const ownUnsharedRepositoryAttribute = await client1.attributes.getAttribute(ownSharedRepositoryAttribute.shareInfo!.sourceAttribute!);
const ownUnsharedRepositoryAttribute = await client1.attributes.getAttribute(ownSharedIdentityAttribute.shareInfo!.sourceAttribute!);

const successionResponse = await client1.attributes.succeedAttribute(ownUnsharedRepositoryAttribute.result.id, {
successorContent: {
Expand All @@ -120,7 +120,7 @@ describe("Attributes", () => {
}
});
expect(successionResponse.isSuccess).toBe(true);
const notificationResponse = await client1.attributes.notifyPeerAboutIdentityAttributeSuccession(successionResponse.result.successor.id, {
const notificationResponse = await client1.attributes.notifyPeerAboutRepositoryAttributeSuccession(successionResponse.result.successor.id, {
slavistan marked this conversation as resolved.
Show resolved Hide resolved
peer: client2Address
});
expect(notificationResponse.isSuccess).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion test/lib/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export async function executeFullCreateAndShareRelationshipAttributeFlow(
*
* Returns the sender's own shared identity attribute.
*/
export async function executeFullCreateAndShareIdentityAttributeFlow(
export async function executeFullCreateAndShareRepositoryAttributeFlow(
sender: ConnectorClient,
recipient: ConnectorClient,
attributeContent: ConnectorIdentityAttribute
Expand Down
Loading