Skip to content

Commit

Permalink
Add CanCreateRelationship API route (#292)
Browse files Browse the repository at this point in the history
* chore: bump runtime

Co-authored-by: Britta Stallknecht <[email protected]>

* refactor: adjust ThirdPartyRelationshipAttribute nomenclature

* feat: add CanCreateRelationship route

* chore: adjust ConnectorRuntimeConfig to DeciderModuleConfiguration

* feat: add canCreateRelationship to openapi.yml

* feat: add thirdPartyAddress to shareInfo

* chore: update dependencies

* feat: use put for canCreateRelationship

Co-authored-by: Britta Stallknecht <[email protected]>

* refactor: more compact imports

* feat: add Runtime call of CanCreateRelationshipUseCase

* feat: add CanCreateRelationshipResponse schema

* fix: inconsistency within openapi spec

* feat: improve description

---------

Co-authored-by: Britta Stallknecht <[email protected]>
Co-authored-by: Britta Stallknecht <[email protected]>
  • Loading branch information
3 people authored Oct 28, 2024
1 parent 50e67ad commit ecfc975
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 80 deletions.
95 changes: 40 additions & 55 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@js-soft/docdb-access-mongo": "1.1.9",
"@js-soft/node-logger": "1.2.0",
"@js-soft/ts-utils": "^2.3.3",
"@nmshd/runtime": "6.3.1",
"@nmshd/runtime": "6.5.0",
"@nmshd/typescript-ioc": "^3.2.4",
"@nmshd/typescript-rest": "^3.0.5",
"agentkeepalive": "4.5.0",
Expand Down Expand Up @@ -112,21 +112,21 @@
"@js-soft/eslint-config-ts": "1.6.13",
"@js-soft/license-check": "1.0.9",
"@nmshd/connector-sdk": "*",
"@nmshd/content": "6.3.1",
"@nmshd/core-types": "6.3.1",
"@nmshd/content": "6.5.0",
"@nmshd/core-types": "6.5.0",
"@nmshd/typescript-rest-swagger": "^1.4.1",
"@types/amqplib": "^0.10.5",
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.17",
"@types/eventsource": "^1.1.15",
"@types/express": "5.0.0",
"@types/jest": "^29.5.13",
"@types/jest": "^29.5.14",
"@types/jest-json-schema": "^6.1.4",
"@types/json-stringify-safe": "^5.0.3",
"@types/lodash": "^4.17.12",
"@types/luxon": "^3.4.2",
"@types/nconf": "^0.10.7",
"@types/node": "^22.7.7",
"@types/node": "^22.8.0",
"@types/on-headers": "^1.0.3",
"@types/swagger-ui-express": "^4.1.6",
"@types/yamljs": "^0.2.34",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build:schemas:watch": "npx nodemon -e ts -w 'src/types' --exec 'npm run build:schemas'"
},
"dependencies": {
"@nmshd/content": "6.3.1",
"@nmshd/content": "6.5.0",
"axios": "^1.7.7",
"form-data": "^4.0.1",
"qs": "^6.13.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/endpoints/AttributesEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CreateRepositoryAttributeRequest,
DeleteOwnSharedAttributeAndNotifyPeerResponse,
DeletePeerSharedAttributeAndNotifyOwnerResponse,
DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse,
DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse,
ExecuteIQLQueryRequest,
ExecuteIdentityAttributeQueryRequest,
ExecuteRelationshipAttributeQueryRequest,
Expand Down Expand Up @@ -83,9 +83,9 @@ export class AttributesEndpoint extends Endpoint {
return await this.delete(`/api/v2/Attributes/${attributeId}`, undefined, 204);
}

public async deleteThirdPartyOwnedRelationshipAttributeAndNotifyPeer(
public async deleteThirdPartyRelationshipAttributeAndNotifyPeer(
attributeId: string
): Promise<ConnectorHttpResponse<DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse>> {
): Promise<ConnectorHttpResponse<DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse>> {
return await this.delete(`/api/v2/Attributes/ThirdParty/${attributeId}`);
}

Expand Down
14 changes: 13 additions & 1 deletion packages/sdk/src/endpoints/RelationshipsEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { ConnectorAttributes, ConnectorHttpResponse, ConnectorRelationship, ConnectorRelationships, CreateRelationshipRequest, GetRelationshipsRequest } from "../types";
import {
CanCreateRelationshipResponse,
ConnectorAttributes,
ConnectorHttpResponse,
ConnectorRelationship,
ConnectorRelationships,
CreateRelationshipRequest,
GetRelationshipsRequest
} from "../types";
import { Endpoint } from "./Endpoint";

export class RelationshipsEndpoint extends Endpoint {
public async canCreateRelationship(request: CreateRelationshipRequest): Promise<ConnectorHttpResponse<CanCreateRelationshipResponse>> {
return await this.put("/api/v2/Relationships/CanCreate", request);
}

public async createRelationship(request: CreateRelationshipRequest): Promise<ConnectorHttpResponse<ConnectorRelationship>> {
return await this.post("/api/v2/Relationships", request);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/types/attributes/ConnectorAttribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ export interface ConnectorAttributeShareInfoForRequest {
requestReference: string;
peer: string;
sourceAttribute?: string;
thirdPartyAddress?: string;
}

export interface ConnectorAttributeShareInfoForNotification {
notificationReference: string;
peer: string;
sourceAttribute?: string;
thirdPartyAddress?: string;
}

export type ConnectorAttributeShareInfo = ConnectorAttributeShareInfoForNotification | ConnectorAttributeShareInfoForRequest;
2 changes: 1 addition & 1 deletion packages/sdk/src/types/attributes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export * from "./RelationshipAttributeQuery";
export * from "./requests/CreateRepositoryAttributeRequest";
export * from "./requests/DeleteOwnSharedAttributeAndNotifyPeerResponse";
export * from "./requests/DeletePeerSharedAttributeAndNotifyOwnerResponse";
export * from "./requests/DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse";
export * from "./requests/DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse";
export * from "./requests/ExecuteIdentityAttributeQueryRequest";
export * from "./requests/ExecuteIQLQueryRequest";
export * from "./requests/ExecuteRelationshipAttributeQueryRequest";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse {
notificationId: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface GetAttributesRequest {
requestReference?: string;
peer?: string;
sourceAttribute?: string;
thirdPartyAddress?: string;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface GetOwnSharedIdentityAttributesRequest {
"query.shareInfo.requestReference"?: string | string[];
"query.shareInfo.notificationReference"?: string | string[];
"query.shareInfo.sourceAttribute"?: string | string[];
"query.shareInfo.thirdPartyAddress"?: string | string[];
"query.deletionInfo"?: string | string[];
"query.deletionInfo.deletionStatus"?: string | string[];
"query.deletionInfo.deletionDate"?: string | string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface GetPeerSharedIdentityAttributesRequest {
"query.shareInfo"?: string | string[];
"query.shareInfo.requestReference"?: string | string[];
"query.shareInfo.notificationReference"?: string | string[];
"query.shareInfo.thirdPartyAddress"?: string | string[];
"query.deletionInfo"?: string | string[];
"query.deletionInfo.deletionStatus"?: string | string[];
"query.deletionInfo.deletionDate"?: string | string[];
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/types/relationships/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from "./ConnectorRelationships";
export * from "./ConnectorRelationshipStatus";
export * from "./requests/CreateRelationshipRequest";
export * from "./requests/GetRelationshipsRequest";
export * from "./responses/CanCreateRelationshipResponse";
Loading

0 comments on commit ecfc975

Please sign in to comment.