diff --git a/package-lock.json b/package-lock.json index 4c060b3c..eff2dffb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,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", @@ -44,21 +44,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", @@ -1690,8 +1690,7 @@ "node_modules/@js-soft/docdb-querytranslator": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/@js-soft/docdb-querytranslator/-/docdb-querytranslator-1.1.5.tgz", - "integrity": "sha512-VfuAWmGF3fJ/hrbvk+2CYh3p6kdqlcdUtHrOM6LK9q7lnZrVHmlnaE242fhGoUiAiKF0w5PWhUtd5/lggEb0EA==", - "license": "MIT" + "integrity": "sha512-VfuAWmGF3fJ/hrbvk+2CYh3p6kdqlcdUtHrOM6LK9q7lnZrVHmlnaE242fhGoUiAiKF0w5PWhUtd5/lggEb0EA==" }, "node_modules/@js-soft/eslint-config-ts": { "version": "1.6.13", @@ -1928,7 +1927,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/@js-soft/simple-logger/-/simple-logger-1.0.5.tgz", "integrity": "sha512-ISrOACkOKJrlxsRazXHzXC1NeVxJEqUnorwPbb74wLPUkS09IY+8QE17QUkoLhv3R7eMJrhlaUMW/ZLyCn+kWQ==", - "license": "MIT", "dependencies": { "@js-soft/logging-abstractions": "1.0.1", "json-stringify-safe": "^5.0.1", @@ -2003,40 +2001,37 @@ "link": true }, "node_modules/@nmshd/consumption": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-6.3.1.tgz", - "integrity": "sha512-5WoMLYK22OymCOHT4BvRjhTHu6PluSSkFaAp81ZsKSCjmFv9zArTyja5AX8YQQ3FWDql78Ecgv7dnFV/18cupQ==", - "license": "MIT", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-6.5.0.tgz", + "integrity": "sha512-18v6x9NTcYTT1mRArmSNvDx+lqrkgAANJh5Cy0ZYwg1qReMjGy+rlseXViq7RvxX1MFSZH2ppbKbY5waHxcqbw==", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.5", "@js-soft/ts-serval": "2.0.11", "@js-soft/ts-utils": "2.3.3", - "@nmshd/content": "6.3.1", - "@nmshd/core-types": "6.3.1", + "@nmshd/content": "6.5.0", + "@nmshd/core-types": "6.5.0", "@nmshd/iql": "^1.0.2", - "@nmshd/transport": "6.3.1", + "@nmshd/transport": "6.5.0", "lodash": "^4.17.21", "ts-simple-nameof": "^1.3.1" } }, "node_modules/@nmshd/content": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-6.3.1.tgz", - "integrity": "sha512-p7xxu8QWCn68XYDhjyLCb9J8HK72xDwLKKdutG9JbSfWUenK2MhaZeiBkVqNJmo5rPuNz3ir6kcpfSQvZbqq2A==", - "license": "MIT", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-6.5.0.tgz", + "integrity": "sha512-iw7inP0/NC/yqnX39KekS2BflXdYlh+vvyHqxdlrMm1yP8r4YvWboGcT5CBY18vcLORPy+EjYShOzmVnX+WlTQ==", "dependencies": { "@js-soft/ts-serval": "2.0.11", - "@nmshd/core-types": "6.3.1", + "@nmshd/core-types": "6.5.0", "@nmshd/iql": "^1.0.2", "luxon": "^3.5.0", "ts-simple-nameof": "^1.3.1" } }, "node_modules/@nmshd/core-types": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@nmshd/core-types/-/core-types-6.3.1.tgz", - "integrity": "sha512-+io2ReRZZ9GAp1AhjyFPo0KM9Cuthm9aOgXlBt5IEspFUevXtjmkaJBvCFv/HM8zo5eQnKVZ8i8JJLgHU/uhiw==", - "license": "MIT", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@nmshd/core-types/-/core-types-6.5.0.tgz", + "integrity": "sha512-CCrRKjv8Tl6FWCTfoB4Uj1SqKW37XVSWEXWocRNAzXtaHyvifH3fHRbmjJExS7LIM4zRDiSH3G3lKYQYj0aJ/A==", "dependencies": { "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/ts-serval": "2.0.11", @@ -2048,7 +2043,6 @@ "version": "2.0.7", "resolved": "https://registry.npmjs.org/@nmshd/crypto/-/crypto-2.0.7.tgz", "integrity": "sha512-yL/Hq5AgNFr94B5gCeBtDMX8naZy/RV/Mlo5yNfj46xW6yDrANa3r2f3mnaQpO2SA3unkDLkqQwO0TxLttmkvQ==", - "license": "MIT", "dependencies": { "libsodium-wrappers-sumo": "0.7.15", "uuid": "10.0.0" @@ -2062,7 +2056,6 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], - "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -2074,21 +2067,20 @@ "license": "MIT" }, "node_modules/@nmshd/runtime": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-6.3.1.tgz", - "integrity": "sha512-PLT7OjZJmnr8xrMz+k7sgOhbQRtxxcL7sPNDzvRXLGGZEZxjkWnDoIu5mWoOTYaxuA1e6PjY5nhnju0TKZGvsw==", - "license": "MIT", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-6.5.0.tgz", + "integrity": "sha512-7ehB7+qJkSQECiTepqALqEDCQX/WhqibTgYEung5Y12zlUo2lcJzJ87sPfOwX4tZ39plCa6YJ8qDT2hHLNd1Rw==", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.5", "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/ts-serval": "2.0.11", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/consumption": "6.3.1", - "@nmshd/content": "6.3.1", - "@nmshd/core-types": "6.3.1", + "@nmshd/consumption": "6.5.0", + "@nmshd/content": "6.5.0", + "@nmshd/core-types": "6.5.0", "@nmshd/crypto": "2.0.7", "@nmshd/iql": "^1.0.2", - "@nmshd/transport": "6.3.1", + "@nmshd/transport": "6.5.0", "@nmshd/typescript-ioc": "3.2.4", "ajv": "^8.17.1", "ajv-errors": "^3.0.0", @@ -2102,16 +2094,15 @@ } }, "node_modules/@nmshd/transport": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-6.3.1.tgz", - "integrity": "sha512-kw793HfS489rMdLgUTAcH6/lOKrjQ+M5MiRNsBNp+1CQlkByk+XOdRUOZKJ1dLQ8OGehT7BKZHt4YWb1Lm5/aQ==", - "license": "MIT", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-6.5.0.tgz", + "integrity": "sha512-hQhPEVyp8U+b3cjurLyPolgG/1Yw9u95x9soJmCA6vqZyyOZZH2GMNi8Lg8PlRYlLHFIU/wW+L4MdWWlbHkvgg==", "dependencies": { "@js-soft/docdb-access-abstractions": "1.0.4", "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/simple-logger": "1.0.5", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/core-types": "6.3.1", + "@nmshd/core-types": "6.5.0", "@nmshd/crypto": "2.0.7", "axios": "^1.7.7", "fast-json-patch": "^3.1.1", @@ -2134,7 +2125,6 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], - "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -3143,11 +3133,10 @@ } }, "node_modules/@types/jest": { - "version": "29.5.13", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.13.tgz", - "integrity": "sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==", + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", "dev": true, - "license": "MIT", "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" @@ -3241,11 +3230,11 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.7.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.7.tgz", - "integrity": "sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q==", + "version": "22.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.0.tgz", + "integrity": "sha512-84rafSBHC/z1i1E3p0cJwKA+CfYDNSXX9WSZBRopjIzLET8oNt6ht2tei4C7izwDeEiLLfdeSVBv1egOH916hg==", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.19.8" } }, "node_modules/@types/on-headers": { @@ -8970,14 +8959,12 @@ "node_modules/libsodium-sumo": { "version": "0.7.15", "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.15.tgz", - "integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==", - "license": "ISC" + "integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==" }, "node_modules/libsodium-wrappers-sumo": { "version": "0.7.15", "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.15.tgz", "integrity": "sha512-aSWY8wKDZh5TC7rMvEdTHoyppVq/1dTSAeAR7H6pzd6QRT3vQWcT5pGwCotLcpPEOLXX6VvqihSPkpEhYAjANA==", - "license": "ISC", "dependencies": { "libsodium-sumo": "^0.7.15" } @@ -13348,14 +13335,12 @@ "node_modules/typescript-logging": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typescript-logging/-/typescript-logging-2.2.0.tgz", - "integrity": "sha512-mPKFGAgGJmeCqrzA6B64Lqoz6vLPtxa8yCd7sWAnfrz9opuNlxqW57VxjtEOL0OOoQeTdc/kBjGUh8sieBXa8A==", - "license": "Apache-2.0" + "integrity": "sha512-mPKFGAgGJmeCqrzA6B64Lqoz6vLPtxa8yCd7sWAnfrz9opuNlxqW57VxjtEOL0OOoQeTdc/kBjGUh8sieBXa8A==" }, "node_modules/typescript-logging-log4ts-style": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typescript-logging-log4ts-style/-/typescript-logging-log4ts-style-2.2.0.tgz", "integrity": "sha512-NP8uoFVoNJkhH6iOM1Y8+/RVFoSPCxLe/kgdxQ0uJNhUJh4CLp7CuMIh/njC9mzK0wdq2DgSJcmlzkqnRXx1Eg==", - "license": "Apache-2.0", "peerDependencies": { "typescript-logging": "~2.2.0" } @@ -14003,7 +13988,7 @@ "name": "@nmshd/connector-sdk", "license": "MIT", "dependencies": { - "@nmshd/content": "6.3.1", + "@nmshd/content": "6.5.0", "axios": "^1.7.7", "form-data": "^4.0.1", "qs": "^6.13.0" diff --git a/package.json b/package.json index 34400274..d2de7ec7 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 40bf3114..c71136af 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -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" diff --git a/packages/sdk/src/endpoints/AttributesEndpoint.ts b/packages/sdk/src/endpoints/AttributesEndpoint.ts index 8a5b03a4..6afd098c 100644 --- a/packages/sdk/src/endpoints/AttributesEndpoint.ts +++ b/packages/sdk/src/endpoints/AttributesEndpoint.ts @@ -5,7 +5,7 @@ import { CreateRepositoryAttributeRequest, DeleteOwnSharedAttributeAndNotifyPeerResponse, DeletePeerSharedAttributeAndNotifyOwnerResponse, - DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse, + DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse, ExecuteIQLQueryRequest, ExecuteIdentityAttributeQueryRequest, ExecuteRelationshipAttributeQueryRequest, @@ -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> { + ): Promise> { return await this.delete(`/api/v2/Attributes/ThirdParty/${attributeId}`); } diff --git a/packages/sdk/src/endpoints/RelationshipsEndpoint.ts b/packages/sdk/src/endpoints/RelationshipsEndpoint.ts index 02616e6b..232abdf1 100644 --- a/packages/sdk/src/endpoints/RelationshipsEndpoint.ts +++ b/packages/sdk/src/endpoints/RelationshipsEndpoint.ts @@ -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> { + return await this.put("/api/v2/Relationships/CanCreate", request); + } + public async createRelationship(request: CreateRelationshipRequest): Promise> { return await this.post("/api/v2/Relationships", request); } diff --git a/packages/sdk/src/types/attributes/ConnectorAttribute.ts b/packages/sdk/src/types/attributes/ConnectorAttribute.ts index ecd478ac..3344236d 100644 --- a/packages/sdk/src/types/attributes/ConnectorAttribute.ts +++ b/packages/sdk/src/types/attributes/ConnectorAttribute.ts @@ -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; diff --git a/packages/sdk/src/types/attributes/index.ts b/packages/sdk/src/types/attributes/index.ts index 8f6cc802..dcbd5767 100644 --- a/packages/sdk/src/types/attributes/index.ts +++ b/packages/sdk/src/types/attributes/index.ts @@ -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"; diff --git a/packages/sdk/src/types/attributes/requests/DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse.ts b/packages/sdk/src/types/attributes/requests/DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse.ts deleted file mode 100644 index 2a769e85..00000000 --- a/packages/sdk/src/types/attributes/requests/DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface DeleteThirdPartyOwnedRelationshipAttributeAndNotifyPeerResponse { - notificationId: string; -} diff --git a/packages/sdk/src/types/attributes/requests/DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse.ts b/packages/sdk/src/types/attributes/requests/DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse.ts new file mode 100644 index 00000000..c714fcbb --- /dev/null +++ b/packages/sdk/src/types/attributes/requests/DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse.ts @@ -0,0 +1,3 @@ +export interface DeleteThirdPartyRelationshipAttributeAndNotifyPeerResponse { + notificationId: string; +} diff --git a/packages/sdk/src/types/attributes/requests/GetAttributesRequest.ts b/packages/sdk/src/types/attributes/requests/GetAttributesRequest.ts index ade36b30..a5a1a7d8 100644 --- a/packages/sdk/src/types/attributes/requests/GetAttributesRequest.ts +++ b/packages/sdk/src/types/attributes/requests/GetAttributesRequest.ts @@ -19,5 +19,6 @@ export interface GetAttributesRequest { requestReference?: string; peer?: string; sourceAttribute?: string; + thirdPartyAddress?: string; }; } diff --git a/packages/sdk/src/types/attributes/requests/GetOwnSharedIdentityAttributesRequest.ts b/packages/sdk/src/types/attributes/requests/GetOwnSharedIdentityAttributesRequest.ts index 2a64b092..d993e83c 100644 --- a/packages/sdk/src/types/attributes/requests/GetOwnSharedIdentityAttributesRequest.ts +++ b/packages/sdk/src/types/attributes/requests/GetOwnSharedIdentityAttributesRequest.ts @@ -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[]; diff --git a/packages/sdk/src/types/attributes/requests/GetPeerSharedIdentityAttributesRequest.ts b/packages/sdk/src/types/attributes/requests/GetPeerSharedIdentityAttributesRequest.ts index 6102e553..2153a7ff 100644 --- a/packages/sdk/src/types/attributes/requests/GetPeerSharedIdentityAttributesRequest.ts +++ b/packages/sdk/src/types/attributes/requests/GetPeerSharedIdentityAttributesRequest.ts @@ -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[]; diff --git a/packages/sdk/src/types/relationships/index.ts b/packages/sdk/src/types/relationships/index.ts index 5913a55f..8d3cb928 100644 --- a/packages/sdk/src/types/relationships/index.ts +++ b/packages/sdk/src/types/relationships/index.ts @@ -6,3 +6,4 @@ export * from "./ConnectorRelationships"; export * from "./ConnectorRelationshipStatus"; export * from "./requests/CreateRelationshipRequest"; export * from "./requests/GetRelationshipsRequest"; +export * from "./responses/CanCreateRelationshipResponse"; diff --git a/packages/sdk/src/types/relationships/responses/CanCreateRelationshipResponse.ts b/packages/sdk/src/types/relationships/responses/CanCreateRelationshipResponse.ts new file mode 100644 index 00000000..0fd9e179 --- /dev/null +++ b/packages/sdk/src/types/relationships/responses/CanCreateRelationshipResponse.ts @@ -0,0 +1,7 @@ +export type CanCreateRelationshipResponse = + | { isSuccess: true } + | { + isSuccess: false; + code: string; + message: string; + }; diff --git a/src/ConnectorRuntimeConfig.ts b/src/ConnectorRuntimeConfig.ts index 9e66afdc..9e447e15 100644 --- a/src/ConnectorRuntimeConfig.ts +++ b/src/ConnectorRuntimeConfig.ts @@ -1,4 +1,4 @@ -import { RuntimeConfig } from "@nmshd/runtime"; +import { DeciderModuleConfiguration, RuntimeConfig } from "@nmshd/runtime"; import * as log4js from "log4js"; import { ConnectorRuntimeModuleConfiguration } from "./ConnectorRuntimeModule"; import { HttpServerConfiguration } from "./infrastructure"; @@ -20,7 +20,9 @@ export interface ConnectorRuntimeConfig extends RuntimeConfig { logging: log4js.Configuration; - modules: Record; + modules: Record & { + decider: DeciderModuleConfiguration; + }; infrastructure: { httpServer: HttpServerConfiguration; diff --git a/src/modules/coreHttpApi/controllers/AttributesController.ts b/src/modules/coreHttpApi/controllers/AttributesController.ts index 9d8f44f0..922b53e4 100644 --- a/src/modules/coreHttpApi/controllers/AttributesController.ts +++ b/src/modules/coreHttpApi/controllers/AttributesController.ts @@ -219,8 +219,8 @@ export class AttributesController extends BaseController { @DELETE @Path("/ThirdParty/:id") - public async deleteThirdPartyOwnedRelationshipAttributeAndNotifyPeer(@PathParam("id") attributeId: string): Promise { - const result = await this.consumptionServices.attributes.deleteThirdPartyOwnedRelationshipAttributeAndNotifyPeer({ attributeId }); + public async deleteThirdPartyRelationshipAttributeAndNotifyPeer(@PathParam("id") attributeId: string): Promise { + const result = await this.consumptionServices.attributes.deleteThirdPartyRelationshipAttributeAndNotifyPeer({ attributeId }); return this.ok(result); } diff --git a/src/modules/coreHttpApi/controllers/RelationshipsController.ts b/src/modules/coreHttpApi/controllers/RelationshipsController.ts index abb1e40f..579fec22 100644 --- a/src/modules/coreHttpApi/controllers/RelationshipsController.ts +++ b/src/modules/coreHttpApi/controllers/RelationshipsController.ts @@ -10,6 +10,14 @@ export class RelationshipsController extends BaseController { super(); } + @PUT + @Path("CanCreate") + @Accept("application/json") + public async canCreateRelationship(request: any): Promise { + const result = await this.transportServices.relationships.canCreateRelationship(request); + return this.ok(result); + } + @POST @Accept("application/json") public async createRelationship(request: any): Promise> { diff --git a/src/modules/coreHttpApi/openapi.yml b/src/modules/coreHttpApi/openapi.yml index ee575245..2c8adb59 100644 --- a/src/modules/coreHttpApi/openapi.yml +++ b/src/modules/coreHttpApi/openapi.yml @@ -1128,21 +1128,21 @@ paths: /api/v2/Attributes/ThirdParty/{id}: delete: - operationId: deleteThirdPartyOwnedRelationshipAttributeAndNotifyPeer - description: Delete a third party relationship attribute and notify the owner. + operationId: deleteThirdPartyRelationshipAttributeAndNotifyPeer + description: Delete a ThirdPartyRelationshipAttribute and notify the peer. tags: - Attributes parameters: - in: path name: id - description: The ID of the third party relationship attribute to delete. + description: The ID of the ThirdPartyRelationshipAttribute to delete. required: true schema: $ref: "#/components/schemas/AttributeID" responses: 200: description: | - Success. Deleting a third party relationship attribute and notifying the owner returns the notificationId of the send notification. + Success. Deleting a ThirdPartyRelationshipAttribute and notifying the peer returns the NotificationId of the sent Notification. content: application/json: schema: @@ -2435,6 +2435,65 @@ paths: # ------------------- Relationships ------------------- + /api/v2/Relationships/CanCreate: + put: + operationId: canCreateRelationship + description: Checks if a Relationship with a given RelationshipTemplate and creationContent can be created. + tags: + - Relationships + requestBody: + content: + application/json: + schema: + type: object + properties: + templateId: + allOf: + - $ref: "#/components/schemas/RelationshipTemplateID" + nullable: false + creationContent: + oneOf: + - $ref: "#/components/schemas/RelationshipCreationContent" + - $ref: "#/components/schemas/ArbitraryRelationshipCreationContent" + nullable: false + example: + "@type": "ArbitraryRelationshipCreationContent" + value: + prop1: value + prop2: 1 + description: Either a RelationshipCreationContent or an ArbitraryRelationshipCreationContent must be provided as the 'creationContent' of the Relationship. + required: + - templateId + - creationContent + responses: + 200: + description: Success + content: + application/json: + schema: + type: object + properties: + result: + nullable: false + $ref: "#/components/schemas/CanCreateRelationshipResponse" + required: + - result + headers: + X-Response-Duration-ms: + schema: + $ref: "#/components/schemas/HeaderContent_X-Response-Duration-ms" + X-Response-Time: + schema: + $ref: "#/components/schemas/HeaderContent_X-Response-Time" + 400: + $ref: "#/components/responses/BadRequest" + 401: + $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/Forbidden" + 404: + $ref: "#/components/responses/NotFound" + /api/v2/Relationships: post: operationId: createRelationship @@ -5388,6 +5447,32 @@ components: items: type: object + CanCreateRelationshipResponse: + type: object + properties: + isSuccess: + type: boolean + oneOf: + - properties: + isSuccess: + const: true + required: + - isSuccess + additionalProperties: false + + - properties: + isSuccess: + const: false + code: + type: string + message: + type: string + required: + - isSuccess + - code + - message + additionalProperties: false + Relationship: type: object properties: diff --git a/test/attributes.test.ts b/test/attributes.test.ts index 451dcbc9..fec223c0 100644 --- a/test/attributes.test.ts +++ b/test/attributes.test.ts @@ -550,7 +550,7 @@ describe("Delete attributes", () => { expect(getAttributeResponse.isSuccess).toBe(false); }); - test("should delete a third party attribute and notify owner", async () => { + test("should delete a ThirdPartyRelationshipAttribute and notify the peer", async () => { const [client3] = await launcher.launch(1); await establishRelationship(client3, client2); @@ -611,10 +611,10 @@ describe("Delete attributes", () => { const thirdPartyRelationshipAttribute = (await client3.attributes.getAttribute((message.content as any).response.items[0].attributeId)).result; - const deleteResponse = await client3.attributes.deleteThirdPartyOwnedRelationshipAttributeAndNotifyPeer(thirdPartyRelationshipAttribute.id); + const deleteResponse = await client3.attributes.deleteThirdPartyRelationshipAttributeAndNotifyPeer(thirdPartyRelationshipAttribute.id); await syncUntilHasMessageWithNotification(client2, deleteResponse.result.notificationId); - await client2._eventBus?.waitForEvent>("consumption.thirdPartyOwnedRelationshipAttributeDeletedByPeer", (event) => { + await client2._eventBus?.waitForEvent>("consumption.thirdPartyRelationshipAttributeDeletedByPeer", (event) => { return event.data.id.toString() === thirdPartyRelationshipAttribute.id; }); diff --git a/test/relationships.test.ts b/test/relationships.test.ts index fd2c0909..5172de77 100644 --- a/test/relationships.test.ts +++ b/test/relationships.test.ts @@ -28,6 +28,12 @@ describe("Relationships", () => { expect(loadRelationshipResponse).toBeSuccessful(ValidationSchema.RelationshipTemplate); const templateId = loadRelationshipResponse.result.id; + const canCreateRelationshipResponse = await client2.relationships.canCreateRelationship({ + templateId, + creationContent: { "@type": "ArbitraryRelationshipCreationContent", value: {} } + }); + expect(canCreateRelationshipResponse.isSuccess).toBe(true); + const createRelationshipResponse = await client2.relationships.createRelationship({ templateId, creationContent: { "@type": "ArbitraryRelationshipCreationContent", value: {} }