diff --git a/.ci/runChecks.sh b/.ci/runChecks.sh index f955b9ae..438eb28a 100755 --- a/.ci/runChecks.sh +++ b/.ci/runChecks.sh @@ -11,4 +11,4 @@ npm run lint:prettier # auditing npx license-check --ignoreRegex @nmshd/connector -npx better-npm-audit audit --exclude 1096302,1098618,1093639 +npx better-npm-audit audit --exclude 1096302,1098681,1093639 diff --git a/package-lock.json b/package-lock.json index 86a882e3..1f519e91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,7 @@ "@js-soft/docdb-access-mongo": "1.1.8", "@js-soft/node-logger": "1.2.0", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/iql": "^1.0.2", - "@nmshd/runtime": "5.1.0", + "@nmshd/runtime": "5.3.0", "agentkeepalive": "4.5.0", "amqplib": "^0.10.4", "axios": "^1.7.5", @@ -28,7 +27,7 @@ "helmet": "7.1.0", "json-stringify-safe": "5.0.1", "jsonschema": "1.4.1", - "mqtt": "^5.10.0", + "mqtt": "^5.10.1", "multer": "^1.4.5-lts.1", "nconf": "0.12.1", "on-headers": "1.0.2", @@ -46,6 +45,8 @@ "@js-soft/eslint-config-ts": "1.6.9", "@js-soft/license-check": "1.0.9", "@nmshd/connector-sdk": "*", + "@nmshd/content": "^5.3.0", + "@nmshd/core-types": "^5.3.0", "@types/amqplib": "^0.10.5", "@types/compression": "^1.7.5", "@types/cors": "^2.8.17", @@ -57,7 +58,7 @@ "@types/lodash": "^4.17.7", "@types/luxon": "^3.4.2", "@types/nconf": "^0.10.7", - "@types/node": "^22.5.0", + "@types/node": "^22.5.1", "@types/on-headers": "^1.0.3", "@types/swagger-ui-express": "^4.1.6", "@types/yamljs": "^0.2.34", @@ -1473,7 +1474,8 @@ "node_modules/@js-soft/docdb-querytranslator": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@js-soft/docdb-querytranslator/-/docdb-querytranslator-1.1.4.tgz", - "integrity": "sha512-Wn/saaEN42T3tNIcnJd6Tp/htD8dtRImqPNu4aGQLbCPHLT8sT1VyyKwmRnZjK1z0u9pOo2svKaJmeE83rZhCg==" + "integrity": "sha512-Wn/saaEN42T3tNIcnJd6Tp/htD8dtRImqPNu4aGQLbCPHLT8sT1VyyKwmRnZjK1z0u9pOo2svKaJmeE83rZhCg==", + "license": "MIT" }, "node_modules/@js-soft/eslint-config-ts": { "version": "1.6.9", @@ -1521,6 +1523,7 @@ "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", @@ -1585,25 +1588,47 @@ "link": true }, "node_modules/@nmshd/consumption": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-5.1.0.tgz", - "integrity": "sha512-9erkPQZNxhrOcE/6cNoTrfEyF7iIMJC849Cyk4ASVye2n6Q04onFGQ3V+200Xk1I22hukuM3xzLXkZ1JX0IQtQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-5.3.0.tgz", + "integrity": "sha512-W8rxbWfCheeWw3zEPb00D7MEh8KPtHbada7JvbLT4V9ci6HZ/mKFDATtVqsi8VW/SlU0E8+z/imAhBc3iiRm5A==", + "license": "MIT", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.4", + "@js-soft/ts-serval": "2.0.10", + "@js-soft/ts-utils": "2.3.3", + "@nmshd/content": "5.3.0", + "@nmshd/core-types": "5.3.0", "@nmshd/iql": "^1.0.2", + "@nmshd/transport": "5.3.0", + "lodash": "^4.17.21", "ts-simple-nameof": "^1.3.1" } }, "node_modules/@nmshd/content": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-5.1.0.tgz", - "integrity": "sha512-Nbzq9KnsZHOFUb33WIL1/3JRyv0As5q313JjdJp3Q9QcnlAADvRcCXBQp+mSXRVfVOm+ugB/St5N0OGNdeQEgQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-5.3.0.tgz", + "integrity": "sha512-xro6gYQ9nswtWaGRv2ttjjooomSiiB3f41gGfPUguSB2fcUTwaLYpNrWgWh01ihr/7WpbJyO3DII76qRATIOLg==", + "license": "MIT", "dependencies": { - "@js-soft/logging-abstractions": "^1.0.1", + "@js-soft/ts-serval": "2.0.10", + "@nmshd/core-types": "5.3.0", "@nmshd/iql": "^1.0.2", + "luxon": "^3.5.0", "ts-simple-nameof": "^1.3.1" } }, + "node_modules/@nmshd/core-types": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@nmshd/core-types/-/core-types-5.3.0.tgz", + "integrity": "sha512-2rshqFIPVS+/Fss8PaKQEZ5KSfBG3nppz0YeAY7RnGoAhjWo/Ng4UHijwnkAFTFLP9JWOnOJf0htYsYRFlUm+Q==", + "license": "MIT", + "dependencies": { + "@js-soft/logging-abstractions": "^1.0.1", + "@js-soft/ts-serval": "2.0.10", + "json-stringify-safe": "^5.0.1", + "luxon": "^3.5.0" + } + }, "node_modules/@nmshd/crypto": { "version": "2.0.6", "license": "MIT", @@ -1617,18 +1642,21 @@ "license": "MIT" }, "node_modules/@nmshd/runtime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-5.1.0.tgz", - "integrity": "sha512-OZ8oNybmr9XWHQ0EK/KNcuPoRvNHNFDrp28UcNc3wFvlyk9Fd4M/ziB7IJPTI811YDxD9dRtwraWnxUKWeOuMg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-5.3.0.tgz", + "integrity": "sha512-Mb/hsuDyrZbgKR7Dx6Is1D78HdT9UFrhDh9T3R1eaPVxd+yIsPYeYfYhBCWZ4oEPoQ9Ngwei+cQBwAg/Psav4Q==", + "license": "MIT", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.4", "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/ts-serval": "2.0.10", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/consumption": "5.1.0", - "@nmshd/content": "5.1.0", + "@nmshd/consumption": "5.3.0", + "@nmshd/content": "5.3.0", + "@nmshd/core-types": "5.3.0", "@nmshd/crypto": "2.0.6", - "@nmshd/transport": "5.1.0", + "@nmshd/iql": "^1.0.2", + "@nmshd/transport": "5.3.0", "ajv": "^8.17.1", "ajv-errors": "^3.0.0", "ajv-formats": "^3.0.1", @@ -1642,15 +1670,18 @@ } }, "node_modules/@nmshd/transport": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-5.1.0.tgz", - "integrity": "sha512-mDRt0tV7RhG5emB0t8ticrL2qPBEvFzhEninA+rOZEmQUDRBJsjTk0l/6LhqRh/kE+URzIvX7imnJNDKX0pyZQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-5.3.0.tgz", + "integrity": "sha512-pzLFqWeCvH6SrfKaal1wLJWaHrjEKZPe1x2NYO6cru2OuhgNUA+O4F0WTlH4ruyG6XUREQSLv0o20Pk/nQOiqQ==", + "license": "MIT", "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", - "axios": "^1.7.4", + "@nmshd/core-types": "5.3.0", + "@nmshd/crypto": "2.0.6", + "axios": "^1.7.5", "fast-json-patch": "^3.1.1", "form-data": "^4.0.0", "https-proxy-agent": "^7.0.5", @@ -1671,6 +1702,7 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -2563,9 +2595,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.0.tgz", - "integrity": "sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==", + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.1.tgz", + "integrity": "sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -7631,6 +7663,7 @@ "version": "3.5.0", "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.5.0.tgz", "integrity": "sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==", + "license": "MIT", "engines": { "node": ">=12" } @@ -7884,9 +7917,9 @@ } }, "node_modules/mqtt": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.10.0.tgz", - "integrity": "sha512-2qpkUi5Ftp8cBX4sPCh/yr4ULBfLFQkjlhTGVpilHznOlsmDWIligmT1anSaJ1FqiH29RONNZJXhcJQaFwddgQ==", + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.10.1.tgz", + "integrity": "sha512-hXCOki8sANoQ7w+2OzJzg6qMBxTtrH9RlnVNV8panLZgnl+Gh0J/t4k6r8Az8+C7y3KAcyXtn0mmLixyUom8Sw==", "license": "MIT", "dependencies": { "@types/readable-stream": "^4.0.5", @@ -11142,7 +11175,8 @@ "node_modules/ts-simple-nameof": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/ts-simple-nameof/-/ts-simple-nameof-1.3.1.tgz", - "integrity": "sha512-E0xwaLwDmKmSmo4DE4i+Rp0CuixeZ6wJcn4+2OugzSoPxWW27aNRHhfhcfAELavHHS077dt998oXIMFq+MqeBw==" + "integrity": "sha512-E0xwaLwDmKmSmo4DE4i+Rp0CuixeZ6wJcn4+2OugzSoPxWW27aNRHhfhcfAELavHHS077dt998oXIMFq+MqeBw==", + "license": "MIT" }, "node_modules/ts-toolbelt": { "version": "9.6.0", @@ -11312,12 +11346,14 @@ "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==" + "integrity": "sha512-mPKFGAgGJmeCqrzA6B64Lqoz6vLPtxa8yCd7sWAnfrz9opuNlxqW57VxjtEOL0OOoQeTdc/kBjGUh8sieBXa8A==", + "license": "Apache-2.0" }, "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" } @@ -12005,6 +12041,7 @@ "name": "@nmshd/connector-sdk", "license": "MIT", "dependencies": { + "@nmshd/content": "^5.3.0", "axios": "^1.7.5", "form-data": "^4.0.0", "qs": "^6.13.0" diff --git a/package.json b/package.json index 43b3c872..6c79740c 100644 --- a/package.json +++ b/package.json @@ -84,8 +84,7 @@ "@js-soft/docdb-access-mongo": "1.1.8", "@js-soft/node-logger": "1.2.0", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/iql": "^1.0.2", - "@nmshd/runtime": "5.1.0", + "@nmshd/runtime": "5.3.0", "agentkeepalive": "4.5.0", "amqplib": "^0.10.4", "axios": "^1.7.5", @@ -96,7 +95,7 @@ "helmet": "7.1.0", "json-stringify-safe": "5.0.1", "jsonschema": "1.4.1", - "mqtt": "^5.10.0", + "mqtt": "^5.10.1", "multer": "^1.4.5-lts.1", "nconf": "0.12.1", "on-headers": "1.0.2", @@ -114,6 +113,8 @@ "@js-soft/eslint-config-ts": "1.6.9", "@js-soft/license-check": "1.0.9", "@nmshd/connector-sdk": "*", + "@nmshd/content": "^5.3.0", + "@nmshd/core-types": "^5.3.0", "@types/amqplib": "^0.10.5", "@types/compression": "^1.7.5", "@types/cors": "^2.8.17", @@ -125,7 +126,7 @@ "@types/lodash": "^4.17.7", "@types/luxon": "^3.4.2", "@types/nconf": "^0.10.7", - "@types/node": "^22.5.0", + "@types/node": "^22.5.1", "@types/on-headers": "^1.0.3", "@types/swagger-ui-express": "^4.1.6", "@types/yamljs": "^0.2.34", diff --git a/packages/sdk/_examples/messages.ts b/packages/sdk/_examples/messages.ts index d39674f9..f1f3fab9 100644 --- a/packages/sdk/_examples/messages.ts +++ b/packages/sdk/_examples/messages.ts @@ -8,7 +8,7 @@ async function run() { const sentMessage = await client.messages.sendMessage({ recipients: ["id1343523509859032455"], - content: { A: "B" } + content: { "@type": "Mail", to: [""], subject: "Hello", body: "Hello World!" } }); } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 6a47d573..e53d7503 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -30,6 +30,7 @@ "build:schemas:watch": "npx nodemon -e ts -w 'src/types' --exec 'npm run build:schemas'" }, "dependencies": { + "@nmshd/content": "^5.3.0", "axios": "^1.7.5", "form-data": "^4.0.0", "qs": "^6.13.0" diff --git a/packages/sdk/src/types/attributes/ConnectorAttribute.ts b/packages/sdk/src/types/attributes/ConnectorAttribute.ts index 833be471..ecd478ac 100644 --- a/packages/sdk/src/types/attributes/ConnectorAttribute.ts +++ b/packages/sdk/src/types/attributes/ConnectorAttribute.ts @@ -1,8 +1,10 @@ +import { IdentityAttributeJSON, RelationshipAttributeJSON } from "@nmshd/content"; + export interface ConnectorAttribute { id: string; parentId?: string; createdAt: string; - content: ConnectorIdentityAttribute | ConnectorRelationshipAttribute; + content: IdentityAttributeJSON | RelationshipAttributeJSON; succeeds?: string; succeededBy?: string; deletionInfo?: ConnectorAttributeDeletionInfo; @@ -37,29 +39,3 @@ export interface ConnectorAttributeShareInfoForNotification { } export type ConnectorAttributeShareInfo = ConnectorAttributeShareInfoForNotification | ConnectorAttributeShareInfoForRequest; - -export interface ConnectorBaseAttribute { - "@type": string; - owner: string; - validFrom?: string; - validTo?: string; -} - -export interface ConnectorIdentityAttribute extends ConnectorBaseAttribute { - "@type": "IdentityAttribute"; - value: ConnectorAttributeValue; - tags?: string[]; -} - -export interface ConnectorRelationshipAttribute extends ConnectorBaseAttribute { - "@type": "RelationshipAttribute"; - value: ConnectorAttributeValue; - key: string; - isTechnical?: boolean; - confidentiality: "public" | "private" | "protected"; -} - -export interface ConnectorAttributeValue { - "@type": string; - [key: string]: unknown; -} diff --git a/packages/sdk/src/types/attributes/requests/CreateRepositoryAttributeRequest.ts b/packages/sdk/src/types/attributes/requests/CreateRepositoryAttributeRequest.ts index 75a53a35..e910a214 100644 --- a/packages/sdk/src/types/attributes/requests/CreateRepositoryAttributeRequest.ts +++ b/packages/sdk/src/types/attributes/requests/CreateRepositoryAttributeRequest.ts @@ -1,8 +1,8 @@ -import { ConnectorAttributeValue } from "../ConnectorAttribute"; +import { AttributeValues } from "@nmshd/content"; export interface CreateRepositoryAttributeRequest { content: { - value: ConnectorAttributeValue; + value: AttributeValues.Identity.Json; tags?: string[]; validFrom?: string; validTo?: string; diff --git a/packages/sdk/src/types/attributes/requests/SucceedAttributeRequest.ts b/packages/sdk/src/types/attributes/requests/SucceedAttributeRequest.ts index eab394c7..6c0f8cff 100644 --- a/packages/sdk/src/types/attributes/requests/SucceedAttributeRequest.ts +++ b/packages/sdk/src/types/attributes/requests/SucceedAttributeRequest.ts @@ -1,8 +1,8 @@ -import { ConnectorAttributeValue } from "../ConnectorAttribute"; +import { AttributeValues } from "@nmshd/content"; export interface SucceedAttributeRequest { successorContent: { - value: ConnectorAttributeValue; + value: AttributeValues.Identity.Json | AttributeValues.Relationship.Json; tags?: string[]; validFrom?: string; validTo?: string; diff --git a/packages/sdk/src/types/messages/ConnectorMessage.ts b/packages/sdk/src/types/messages/ConnectorMessage.ts index 79bcd34f..05c82983 100644 --- a/packages/sdk/src/types/messages/ConnectorMessage.ts +++ b/packages/sdk/src/types/messages/ConnectorMessage.ts @@ -1,9 +1,9 @@ -import { ConnectorMessageContentDerivation } from "./ConnectorMessageContentDerivation"; +import { ArbitraryMessageContentJSON, MailJSON, NotificationJSON, RequestJSON, ResponseWrapperJSON } from "@nmshd/content"; import { ConnectorMessageRecipient } from "./ConnectorMessageRecipient"; export interface ConnectorMessage { id: string; - content: ConnectorMessageContentDerivation; + content: MailJSON | ResponseWrapperJSON | RequestJSON | NotificationJSON | ArbitraryMessageContentJSON; createdBy: string; createdByDevice: string; recipients: ConnectorMessageRecipient[]; diff --git a/packages/sdk/src/types/messages/ConnectorMessageContentDerivation.ts b/packages/sdk/src/types/messages/ConnectorMessageContentDerivation.ts deleted file mode 100644 index b7bf3924..00000000 --- a/packages/sdk/src/types/messages/ConnectorMessageContentDerivation.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ConnectorNotification } from "../notifications"; -import { ConnectorRequestContent, ConnectorResponse } from "../requests"; - -export type ConnectorMessageContentDerivation = ConnectorMail | ConnectorResponseWrapper | ConnectorRequestContent | ConnectorNotification | ConnectorArbitraryMessageContent; - -export interface ConnectorMail { - "@type": "Mail"; - to: string[]; - cc?: string[]; - subject: string; - body: string; -} - -export interface ConnectorResponseWrapper { - "@type": "ResponseWrapper"; - requestId: string; - requestSourceReference: string; - requestSourceType: "RelationshipTemplate" | "Message"; - response: ConnectorResponse; -} - -export interface ConnectorArbitraryMessageContent { - "@type": "ArbitraryMessageContent"; - value: any; -} diff --git a/packages/sdk/src/types/messages/ConnectorMessageWithAttachments.ts b/packages/sdk/src/types/messages/ConnectorMessageWithAttachments.ts index c77415a3..80130287 100644 --- a/packages/sdk/src/types/messages/ConnectorMessageWithAttachments.ts +++ b/packages/sdk/src/types/messages/ConnectorMessageWithAttachments.ts @@ -1,10 +1,10 @@ +import { ArbitraryMessageContentJSON, MailJSON, NotificationJSON, RequestJSON, ResponseWrapperJSON } from "@nmshd/content"; import { ConnectorFile } from "../files/ConnectorFile"; -import { ConnectorMessageContentDerivation } from "./ConnectorMessageContentDerivation"; import { ConnectorMessageRecipient } from "./ConnectorMessageRecipient"; export interface ConnectorMessageWithAttachments { id: string; - content: ConnectorMessageContentDerivation; + content: MailJSON | ResponseWrapperJSON | RequestJSON | NotificationJSON | ArbitraryMessageContentJSON; createdBy: string; createdByDevice: string; recipients: ConnectorMessageRecipient[]; diff --git a/packages/sdk/src/types/messages/requests/SendMessageRequest.ts b/packages/sdk/src/types/messages/requests/SendMessageRequest.ts index bb9c8bea..bfded2e9 100644 --- a/packages/sdk/src/types/messages/requests/SendMessageRequest.ts +++ b/packages/sdk/src/types/messages/requests/SendMessageRequest.ts @@ -1,7 +1,7 @@ -import { ConnectorMessageContentDerivation } from "../ConnectorMessageContentDerivation"; +import { ArbitraryMessageContentJSON, MailJSON, NotificationJSON, RequestJSON, ResponseWrapperJSON } from "@nmshd/content"; export interface SendMessageRequest { recipients: string[]; - content: ConnectorMessageContentDerivation; + content: MailJSON | ResponseWrapperJSON | RequestJSON | NotificationJSON | ArbitraryMessageContentJSON; attachments?: string[]; } diff --git a/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplate.ts b/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplate.ts index 169ace2a..fb96523f 100644 --- a/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplate.ts +++ b/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplate.ts @@ -1,4 +1,4 @@ -import { ConnectorRelationshipTemplateContentDerivation } from "./ConnectorRelationshipTemplateContentDerivation"; +import { ArbitraryRelationshipTemplateContentJSON, RelationshipTemplateContentJSON } from "@nmshd/content"; export interface ConnectorRelationshipTemplate { id: string; @@ -7,7 +7,7 @@ export interface ConnectorRelationshipTemplate { createdBy: string; createdByDevice: string; createdAt: string; - content: ConnectorRelationshipTemplateContentDerivation; + content: RelationshipTemplateContentJSON | ArbitraryRelationshipTemplateContentJSON; expiresAt?: string; secretKey: string; truncatedReference: string; diff --git a/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplateContentDerivation.ts b/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplateContentDerivation.ts deleted file mode 100644 index ccd2a978..00000000 --- a/packages/sdk/src/types/relationshipTemplates/ConnectorRelationshipTemplateContentDerivation.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ConnectorRequestContent } from "../requests/ConnectorRequestContent"; - -export type ConnectorRelationshipTemplateContentDerivation = ConnectorRelationshipTemplateContent | ArbitraryRelationshipTemplateContent; - -export interface ConnectorRelationshipTemplateContent { - "@type": "RelationshipTemplateContent"; - title?: string; - metadata?: object; - onNewRelationship: Omit & { "@type"?: "Request" }; - onExistingRelationship?: Omit & { "@type"?: "Request" }; -} - -export interface ArbitraryRelationshipTemplateContent { - "@type": "ArbitraryRelationshipTemplateContent"; - value: any; -} diff --git a/packages/sdk/src/types/relationshipTemplates/index.ts b/packages/sdk/src/types/relationshipTemplates/index.ts index f453214d..18347fa6 100644 --- a/packages/sdk/src/types/relationshipTemplates/index.ts +++ b/packages/sdk/src/types/relationshipTemplates/index.ts @@ -1,5 +1,4 @@ export * from "./ConnectorRelationshipTemplate"; -export * from "./ConnectorRelationshipTemplateContentDerivation"; export * from "./ConnectorRelationshipTemplates"; export * from "./RelationshipTemplateReference"; export * from "./requests/CreateOwnRelationshipTemplateRequest"; diff --git a/packages/sdk/src/types/relationshipTemplates/requests/CreateOwnRelationshipTemplateRequest.ts b/packages/sdk/src/types/relationshipTemplates/requests/CreateOwnRelationshipTemplateRequest.ts index 9af4e3d9..3b3738d2 100644 --- a/packages/sdk/src/types/relationshipTemplates/requests/CreateOwnRelationshipTemplateRequest.ts +++ b/packages/sdk/src/types/relationshipTemplates/requests/CreateOwnRelationshipTemplateRequest.ts @@ -1,7 +1,7 @@ -import { ConnectorRelationshipTemplateContentDerivation } from "../ConnectorRelationshipTemplateContentDerivation"; +import { ArbitraryRelationshipTemplateContentJSON, RelationshipTemplateContentJSON } from "@nmshd/content"; export interface CreateOwnRelationshipTemplateRequest { maxNumberOfAllocations?: number; expiresAt: string; - content: ConnectorRelationshipTemplateContentDerivation; + content: RelationshipTemplateContentJSON | ArbitraryRelationshipTemplateContentJSON; } diff --git a/packages/sdk/src/types/relationships/ConnectorPeerDeletionInfo.ts b/packages/sdk/src/types/relationships/ConnectorPeerDeletionInfo.ts new file mode 100644 index 00000000..1a7ea4e1 --- /dev/null +++ b/packages/sdk/src/types/relationships/ConnectorPeerDeletionInfo.ts @@ -0,0 +1,8 @@ +export enum ConnectorPeerDeletionStatus { + ToBeDeleted = "ToBeDeleted", + Deleted = "Deleted" +} + +export interface ConnectorPeerDeletionInfo { + deletionStatus: ConnectorPeerDeletionStatus; +} diff --git a/packages/sdk/src/types/relationships/ConnectorRelationship.ts b/packages/sdk/src/types/relationships/ConnectorRelationship.ts index 36ab058a..ce6bed9c 100644 --- a/packages/sdk/src/types/relationships/ConnectorRelationship.ts +++ b/packages/sdk/src/types/relationships/ConnectorRelationship.ts @@ -1,7 +1,8 @@ +import { ArbitraryRelationshipCreationContentJSON, RelationshipCreationContentJSON } from "@nmshd/content"; import { ConnectorRelationshipTemplate } from "../relationshipTemplates/ConnectorRelationshipTemplate"; import { ConnectorIdentity } from "./ConnectorIdentity"; +import { ConnectorPeerDeletionInfo } from "./ConnectorPeerDeletionInfo"; import { ConnectorRelationshipAuditLogEntry } from "./ConnectorRelationshipAuditLogEntry"; -import { ConnectorRelationshipCreationContentDerivation } from "./ConnectorRelationshipCreationContentDerivation"; import { ConnectorRelationshipStatus } from "./ConnectorRelationshipStatus"; export interface ConnectorRelationshipAuditLog extends Array {} @@ -11,7 +12,8 @@ export interface ConnectorRelationship { template: ConnectorRelationshipTemplate; status: ConnectorRelationshipStatus; peer: string; + peerDeletionInfo?: ConnectorPeerDeletionInfo; peerIdentity: ConnectorIdentity; - creationContent: ConnectorRelationshipCreationContentDerivation; + creationContent: RelationshipCreationContentJSON | ArbitraryRelationshipCreationContentJSON; auditLog: ConnectorRelationshipAuditLog; } diff --git a/packages/sdk/src/types/relationships/ConnectorRelationshipCreationContentDerivation.ts b/packages/sdk/src/types/relationships/ConnectorRelationshipCreationContentDerivation.ts deleted file mode 100644 index 2d09c798..00000000 --- a/packages/sdk/src/types/relationships/ConnectorRelationshipCreationContentDerivation.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ConnectorResponse } from "../requests"; - -export type ConnectorRelationshipCreationContentDerivation = ConnectorRelationshipCreationContent | ConnectorArbitraryRelationshipCreationContent; - -export interface ConnectorRelationshipCreationContent { - "@type": "RelationshipCreationContent"; - response: ConnectorResponse; -} - -export interface ConnectorArbitraryRelationshipCreationContent { - "@type": "ArbitraryRelationshipCreationContent"; - value: any; -} diff --git a/packages/sdk/src/types/relationships/index.ts b/packages/sdk/src/types/relationships/index.ts index 0a45de6b..5913a55f 100644 --- a/packages/sdk/src/types/relationships/index.ts +++ b/packages/sdk/src/types/relationships/index.ts @@ -1,3 +1,4 @@ +export * from "./ConnectorPeerDeletionInfo"; export * from "./ConnectorRelationship"; export * from "./ConnectorRelationshipAuditLogEntry"; export * from "./ConnectorRelationshipAuditLogEntryReason"; diff --git a/packages/sdk/src/types/relationships/requests/CreateRelationshipRequest.ts b/packages/sdk/src/types/relationships/requests/CreateRelationshipRequest.ts index 66dd5005..b0130778 100644 --- a/packages/sdk/src/types/relationships/requests/CreateRelationshipRequest.ts +++ b/packages/sdk/src/types/relationships/requests/CreateRelationshipRequest.ts @@ -1,6 +1,6 @@ -import { ConnectorRelationshipCreationContentDerivation } from "../ConnectorRelationshipCreationContentDerivation"; +import { ArbitraryRelationshipCreationContentJSON, RelationshipCreationContentJSON } from "@nmshd/content"; export interface CreateRelationshipRequest { templateId: string; - creationContent: ConnectorRelationshipCreationContentDerivation; + creationContent: ArbitraryRelationshipCreationContentJSON | RelationshipCreationContentJSON; } diff --git a/packages/sdk/src/types/requests/ConnectorRequest.ts b/packages/sdk/src/types/requests/ConnectorRequest.ts index 5f89cbe8..4f98ec76 100644 --- a/packages/sdk/src/types/requests/ConnectorRequest.ts +++ b/packages/sdk/src/types/requests/ConnectorRequest.ts @@ -1,5 +1,4 @@ -import { ConnectorRequestContent } from "./ConnectorRequestContent"; -import { ConnectorResponse } from "./ConnectorResponse"; +import { RequestJSON, ResponseJSON } from "@nmshd/content"; export interface ConnectorRequest { id: string; @@ -7,14 +6,14 @@ export interface ConnectorRequest { peer: string; createdAt: string; status: ConnectorRequestStatus; - content: ConnectorRequestContent; + content: RequestJSON; source?: { type: "Message" | "RelationshipTemplate"; reference: string; }; response?: { createdAt: string; - content: ConnectorResponse; + content: ResponseJSON; source?: { type: "Message" | "Relationship"; reference: string; diff --git a/packages/sdk/src/types/requests/ConnectorRequestContent.ts b/packages/sdk/src/types/requests/ConnectorRequestContent.ts deleted file mode 100644 index b7a79f8e..00000000 --- a/packages/sdk/src/types/requests/ConnectorRequestContent.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { IQLQuery, ThirdPartyRelationshipAttributeQuery } from "../attributes"; -import { ConnectorIdentityAttribute, ConnectorRelationshipAttribute } from "../attributes/ConnectorAttribute"; -import { IdentityAttributeQuery } from "../attributes/IdentityAttributeQuery"; -import { RelationshipAttributeQuery } from "../attributes/RelationshipAttributeQuery"; - -export interface ConnectorRequestContent { - "@type": "Request"; - id?: string; - expiresAt?: string; - items: (ConnectorRequestItemDerivation | ConnectorRequestContentItemGroup)[]; - title?: string; - description?: string; - metadata?: object; -} - -export interface ConnectorRequestContentItemGroup { - "@type"?: "RequestItemGroup"; - title?: string; - description?: string; - metadata?: object; - items: ConnectorRequestItemDerivation[]; -} - -export type ConnectorRequestItemDerivation = - | CreateAttributeRequestItem - | DeleteAttributeRequestItem - | ShareAttributeRequestItem - | ProposeAttributeRequestItem - | ReadAttributeRequestItem - | ConsentRequestItem - | AuthenticationRequestItem - | FreeTextRequestItem - | RegisterAttributeListenerRequestItem; - -export interface ConnectorRequestContentItem { - "@type"?: string; - title?: string; - description?: string; - responseMetadata?: object; - mustBeAccepted: boolean; -} - -export interface CreateAttributeRequestItem extends ConnectorRequestContentItem { - "@type": "CreateAttributeRequestItem"; - attribute: ConnectorIdentityAttribute | ConnectorRelationshipAttribute; -} - -export interface ShareAttributeRequestItem extends ConnectorRequestContentItem { - "@type": "ShareAttributeRequestItem"; - attribute: ConnectorIdentityAttribute | ConnectorRelationshipAttribute; - sourceAttributeId: string; -} - -export interface ProposeAttributeRequestItem extends ConnectorRequestContentItem { - "@type": "ProposeAttributeRequestItem"; - query: IdentityAttributeQuery | RelationshipAttributeQuery | IQLQuery; - attribute: ConnectorIdentityAttribute | ConnectorRelationshipAttribute; -} - -export interface ReadAttributeRequestItem extends ConnectorRequestContentItem { - "@type": "ReadAttributeRequestItem"; - query: IdentityAttributeQuery | RelationshipAttributeQuery | ThirdPartyRelationshipAttributeQuery | IQLQuery; -} - -export interface ConsentRequestItem extends ConnectorRequestContentItem { - "@type": "ConsentRequestItem"; - consent: string; - link?: string; -} - -export interface AuthenticationRequestItem extends ConnectorRequestContentItem { - "@type": "AuthenticationRequestItem"; -} - -export interface FreeTextRequestItem extends ConnectorRequestContentItem { - "@type": "FreeTextRequestItem"; - freeText: string; -} - -export interface RegisterAttributeListenerRequestItem extends ConnectorRequestContentItem { - "@type": "RegisterAttributeListenerRequestItem"; - query: IdentityAttributeQuery | ThirdPartyRelationshipAttributeQuery; -} - -export interface DeleteAttributeRequestItem extends ConnectorRequestContentItem { - "@type": "DeleteAttributeRequestItem"; - attributeId: string; -} diff --git a/packages/sdk/src/types/requests/ConnectorResponse.ts b/packages/sdk/src/types/requests/ConnectorResponse.ts deleted file mode 100644 index b1d1a56f..00000000 --- a/packages/sdk/src/types/requests/ConnectorResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -export interface ConnectorResponse { - "@type": "Response"; - result: "Accepted" | "Rejected"; - requestId: string; - items: (ConnectorResponseItemGroup | ConnectorResponseItem)[]; -} - -export interface ConnectorResponseItem { - "@type": string; - result: ConnectorResponseItemResult; - [key: string]: any; -} - -export enum ConnectorResponseItemResult { - Accepted = "Accepted", - Rejected = "Rejected", - Failed = "Error" -} - -export interface ConnectorResponseItemGroup { - "@type": "ResponseItemGroup"; - items: ConnectorResponseItem[]; -} diff --git a/packages/sdk/src/types/requests/index.ts b/packages/sdk/src/types/requests/index.ts index b4d562c0..33926918 100644 --- a/packages/sdk/src/types/requests/index.ts +++ b/packages/sdk/src/types/requests/index.ts @@ -1,8 +1,6 @@ export * from "./ConnectorRequest"; -export * from "./ConnectorRequestContent"; export * from "./ConnectorRequests"; export * from "./ConnectorRequestValidationResult"; -export * from "./ConnectorResponse"; export * from "./requests/AcceptIncomingRequestRequest"; export * from "./requests/CanAcceptIncomingRequestRequest"; export * from "./requests/CanCreateOutgoingRequestRequest"; diff --git a/packages/sdk/src/types/requests/requests/CreateOutgoingRequestRequest.ts b/packages/sdk/src/types/requests/requests/CreateOutgoingRequestRequest.ts index 54eb1eb6..3ab122e8 100644 --- a/packages/sdk/src/types/requests/requests/CreateOutgoingRequestRequest.ts +++ b/packages/sdk/src/types/requests/requests/CreateOutgoingRequestRequest.ts @@ -1,6 +1,6 @@ -import { ConnectorRequestContent } from "../ConnectorRequestContent"; +import { RequestJSON } from "@nmshd/content"; export interface CreateOutgoingRequestRequest { - content: Omit & { "@type"?: "Request" }; + content: Omit & { "@type"?: "Request" }; peer: string; } diff --git a/src/ConnectorRuntime.ts b/src/ConnectorRuntime.ts index 41e09c75..781a31e5 100644 --- a/src/ConnectorRuntime.ts +++ b/src/ConnectorRuntime.ts @@ -6,7 +6,7 @@ import { NodeLoggerFactory } from "@js-soft/node-logger"; import { ApplicationError } from "@js-soft/ts-utils"; import { ConsumptionController } from "@nmshd/consumption"; import { ConsumptionServices, DataViewExpander, GetIdentityInfoResponse, ModuleConfiguration, Runtime, RuntimeHealth, RuntimeServices, TransportServices } from "@nmshd/runtime"; -import { AccountController, CoreErrors as TransportCoreErrors } from "@nmshd/transport"; +import { AccountController, TransportCoreErrors } from "@nmshd/transport"; import axios from "axios"; import fs from "fs"; import { HttpsProxyAgent } from "https-proxy-agent"; diff --git a/src/HealthChecker.ts b/src/HealthChecker.ts index 9e31e468..dd4f223c 100644 --- a/src/HealthChecker.ts +++ b/src/HealthChecker.ts @@ -1,7 +1,8 @@ import { MongoDbConnection } from "@js-soft/docdb-access-mongo"; import { ILogger } from "@js-soft/logging-abstractions"; +import { CoreDate } from "@nmshd/core-types"; import { RuntimeHealth } from "@nmshd/runtime"; -import { AbstractAuthenticator, CoreDate } from "@nmshd/transport"; +import { AbstractAuthenticator } from "@nmshd/transport"; import { AxiosInstance } from "axios"; export class HealthChecker { diff --git a/src/infrastructure/httpServer/middlewares/genericErrorHandler.ts b/src/infrastructure/httpServer/middlewares/genericErrorHandler.ts index fc5602de..6fb93b49 100644 --- a/src/infrastructure/httpServer/middlewares/genericErrorHandler.ts +++ b/src/infrastructure/httpServer/middlewares/genericErrorHandler.ts @@ -1,6 +1,6 @@ import { ApplicationError } from "@js-soft/ts-utils"; import { RuntimeErrors } from "@nmshd/runtime"; -import { RequestError, CoreErrors as TransportCoreErrors } from "@nmshd/transport"; +import { RequestError, TransportCoreErrors } from "@nmshd/transport"; import express from "express"; import stringify from "json-stringify-safe"; import { Errors } from "typescript-rest"; diff --git a/test/attributes.test.ts b/test/attributes.test.ts index 42927d2f..451dcbc9 100644 --- a/test/attributes.test.ts +++ b/test/attributes.test.ts @@ -1,5 +1,6 @@ import { DataEvent } from "@js-soft/ts-utils"; -import { ConnectorAttribute, ConnectorAttributeDeletionStatus, ConnectorHttpResponse } from "@nmshd/connector-sdk"; +import { ConnectorAttribute, ConnectorAttributeDeletionStatus, ConnectorHttpResponse, CreateRepositoryAttributeRequest, SucceedAttributeRequest } from "@nmshd/connector-sdk"; +import { GivenNameJSON, RelationshipAttributeConfidentiality } from "@nmshd/content"; import { ConnectorClientWithMetadata, Launcher } from "./lib/Launcher"; import { QueryParamConditions } from "./lib/QueryParamConditions"; import { getTimeout } from "./lib/setTimeout"; @@ -92,7 +93,7 @@ describe("Attributes", () => { }); test("should succeed a Repository Attribute", async () => { - const newRepositoryAttribute = { + const newRepositoryAttribute: CreateRepositoryAttributeRequest = { content: { value: { "@type": "GivenName", @@ -164,10 +165,10 @@ describe("Attributes", () => { value: "AGivenName" }, key: "key", - confidentiality: "public" + confidentiality: RelationshipAttributeConfidentiality.Public }); - const successionAttribute = { + const successionAttribute: SucceedAttributeRequest = { successorContent: { value: { "@type": "ProprietaryString", @@ -281,7 +282,7 @@ describe("Execute AttributeQueries", () => { value: "AGivenName" }, key: "someSpecialKey", - confidentiality: "public" + confidentiality: RelationshipAttributeConfidentiality.Public }); const executeRelationshipAttributeQueryResponse = await client2.attributes.executeRelationshipAttributeQuery({ @@ -298,7 +299,7 @@ describe("Execute AttributeQueries", () => { expect(executeRelationshipAttributeQueryResponse).toBeSuccessful(ValidationSchema.ConnectorAttribute); - expect(executeRelationshipAttributeQueryResponse.result.content.value.value).toBe("AGivenName"); + expect((executeRelationshipAttributeQueryResponse.result.content.value as GivenNameJSON).value).toBe("AGivenName"); }); }); @@ -561,7 +562,7 @@ describe("Delete attributes", () => { value: "ANewGivenName" }, key: "randomKey", - confidentiality: "public" + confidentiality: RelationshipAttributeConfidentiality.Public }); const outgoingRequests = await client3.outgoingRequests.createRequest({ diff --git a/test/iqlquery.test.ts b/test/iqlquery.test.ts index 7fee14d9..1cdb3c12 100644 --- a/test/iqlquery.test.ts +++ b/test/iqlquery.test.ts @@ -1,4 +1,5 @@ -import { ConnectorClient, ConnectorIdentityAttribute, ExecuteIQLQueryRequest, IQLQuery, ProposeAttributeRequestItem, ReadAttributeRequestItem } from "@nmshd/connector-sdk"; +import { ConnectorClient, ExecuteIQLQueryRequest, IQLQuery } from "@nmshd/connector-sdk"; +import { IdentityAttributeJSON, ProposeAttributeRequestItemJSON, ReadAttributeRequestItemJSON } from "@nmshd/content"; import { DateTime } from "luxon"; import { ConnectorClientWithMetadata, Launcher } from "./lib/Launcher"; import { getTimeout } from "./lib/setTimeout"; @@ -13,7 +14,7 @@ const launcher = new Launcher(); let client1: ConnectorClientWithMetadata; let client2: ConnectorClient; let client1Address: string; -let attributes: ConnectorIdentityAttribute[]; +let attributes: IdentityAttributeJSON[]; let attributeIds: string[]; beforeAll(async () => { @@ -90,7 +91,7 @@ test("Remote ReadAttributeRequest containing IQL Query", async () => { ]; /* Create request on C2. */ - const outRequest: ReadAttributeRequestItem = { + const outRequest: ReadAttributeRequestItemJSON = { "@type": "ReadAttributeRequestItem", mustBeAccepted: false, query: { @@ -113,7 +114,7 @@ test("Remote ReadAttributeRequest containing IQL Query", async () => { /* Extract and execute IQL query on C1. */ const incomingRequest = (await client1.incomingRequests.getRequest(requestId)).result; - const iqlQueryString = ((incomingRequest.content.items[0] as ReadAttributeRequestItem).query as IQLQuery).queryString; + const iqlQueryString = ((incomingRequest.content.items[0] as ReadAttributeRequestItemJSON).query as IQLQuery).queryString; const matchedAttributes = (await client1.attributes.executeIQLQuery({ query: { queryString: iqlQueryString } })).result; /* Reply to the response with the first matched attribute. Wait on C2 for @@ -140,7 +141,7 @@ test("Remote ProposeAttributeRequest containing IQL Query with existing attribut ]; /* Create request on C2. */ - const outRequest: ProposeAttributeRequestItem = { + const outRequest: ProposeAttributeRequestItemJSON = { "@type": "ProposeAttributeRequestItem", mustBeAccepted: true, query: { @@ -172,7 +173,7 @@ test("Remote ProposeAttributeRequest containing IQL Query with existing attribut /* Extract and execute IQL query on C1. */ const incomingRequest = (await client1.incomingRequests.getRequest(requestId)).result; - const iqlQueryString = ((incomingRequest.content.items[0] as ReadAttributeRequestItem).query as IQLQuery).queryString; + const iqlQueryString = ((incomingRequest.content.items[0] as ReadAttributeRequestItemJSON).query as IQLQuery).queryString; const matchedAttributes = (await client1.attributes.executeIQLQuery({ query: { queryString: iqlQueryString } })).result; /* Reply to the response with the first matched attribute. Wait on C2 for @@ -193,7 +194,7 @@ test("Remote ProposeAttributeRequest containing IQL Query with existing attribut test("Remote ProposeAttributeRequest containing IQL Query without existing attribute response", async () => { /* Create request on C2. */ - const outRequest: ProposeAttributeRequestItem = { + const outRequest: ProposeAttributeRequestItemJSON = { "@type": "ProposeAttributeRequestItem", mustBeAccepted: true, query: { @@ -224,14 +225,14 @@ test("Remote ProposeAttributeRequest containing IQL Query without existing attri /* Extract and execute IQL query on C1. */ const incomingRequest = (await client1.incomingRequests.getRequest(requestId)).result; - const incomingRequestItem: ProposeAttributeRequestItem = incomingRequest.content.items[0] as ProposeAttributeRequestItem; + const incomingRequestItem = incomingRequest.content.items[0] as ProposeAttributeRequestItemJSON; const iqlQueryString = (incomingRequestItem.query as IQLQuery).queryString; const matchedAttributes = (await client1.attributes.executeIQLQuery({ query: { queryString: iqlQueryString } })).result; expect(matchedAttributes).toHaveLength(0); incomingRequestItem.attribute.owner = client1Address; - const requestItemAttribute = incomingRequestItem.attribute; + const requestItemAttribute = incomingRequestItem.attribute as IdentityAttributeJSON; const attributeId = (await client1.attributes.createRepositoryAttribute({ content: { value: requestItemAttribute.value } })).result.id; /* Reply to the response with the first matched attribute. Wait on C2 for diff --git a/test/lib/testUtils.ts b/test/lib/testUtils.ts index 491470ee..d722745e 100644 --- a/test/lib/testUtils.ts +++ b/test/lib/testUtils.ts @@ -2,12 +2,10 @@ import { MongoDbConnection } from "@js-soft/docdb-access-mongo"; import { DataEvent, EventBus, SubscriptionTarget, sleep } from "@js-soft/ts-utils"; import { ConnectorAttribute, - ConnectorAttributeValue, ConnectorClient, ConnectorFile, ConnectorMessage, ConnectorRelationship, - ConnectorRelationshipAttribute, ConnectorRelationshipTemplate, ConnectorRequest, ConnectorRequestStatus, @@ -16,6 +14,7 @@ import { CreateRepositoryAttributeRequest, UploadOwnFileRequest } from "@nmshd/connector-sdk"; +import { AttributeValues, RelationshipAttributeJSON } from "@nmshd/content"; import fs from "fs"; import { DateTime } from "luxon"; import { ConnectorClientWithMetadata } from "./Launcher"; @@ -318,7 +317,7 @@ export async function createRepositoryAttribute(client: ConnectorClient, request export async function executeFullCreateAndShareRelationshipAttributeFlow( sender: ConnectorClientWithMetadata, recipient: ConnectorClientWithMetadata, - attributeContent: Omit + attributeContent: Omit ): Promise { const senderIdentityInfoResult = await sender.account.getIdentityInfo(); expect(senderIdentityInfoResult.isSuccess).toBe(true); @@ -377,17 +376,17 @@ export async function executeFullCreateAndShareRelationshipAttributeFlow( export async function executeFullCreateAndShareRepositoryAttributeFlow( sender: ConnectorClient, recipient: ConnectorClient, - attributeValue: ConnectorAttributeValue + attributeValue: AttributeValues.Identity.Json ): Promise; export async function executeFullCreateAndShareRepositoryAttributeFlow( sender: ConnectorClient, recipient: ConnectorClient[], - attributeValue: ConnectorAttributeValue + attributeValue: AttributeValues.Identity.Json ): Promise; export async function executeFullCreateAndShareRepositoryAttributeFlow( sender: ConnectorClient, recipients: ConnectorClient | ConnectorClient[], - attributeValue: ConnectorAttributeValue + attributeValue: AttributeValues.Identity.Json ): Promise { const createAttributeRequestResult = await sender.attributes.createRepositoryAttribute({ content: { value: attributeValue } }); const attribute = createAttributeRequestResult.result; diff --git a/test/outgoingRequests.test.ts b/test/outgoingRequests.test.ts index 116c20d0..379c7452 100644 --- a/test/outgoingRequests.test.ts +++ b/test/outgoingRequests.test.ts @@ -1,4 +1,5 @@ -import { ConnectorClient, ConnectorRequestStatus, ReadAttributeRequestItem } from "@nmshd/connector-sdk"; +import { ConnectorClient, ConnectorRequestStatus } from "@nmshd/connector-sdk"; +import { ReadAttributeRequestItemJSON } from "@nmshd/content"; import { DateTime } from "luxon"; import { Launcher } from "./lib/Launcher"; import { QueryParamConditions } from "./lib/QueryParamConditions"; @@ -32,7 +33,7 @@ describe("Outgoing Requests", () => { expect(sConsumptionRequest.status).toBe(ConnectorRequestStatus.Draft); expect(sConsumptionRequest.content.items).toHaveLength(1); expect(sConsumptionRequest.content.items[0]["@type"]).toBe("ReadAttributeRequestItem"); - expect((sConsumptionRequest.content.items[0] as ReadAttributeRequestItem).mustBeAccepted).toBe(false); + expect((sConsumptionRequest.content.items[0] as ReadAttributeRequestItemJSON).mustBeAccepted).toBe(false); }); test("should query outgoing requests", async () => { diff --git a/test/relationships.test.ts b/test/relationships.test.ts index 7a1ceee4..fd2c0909 100644 --- a/test/relationships.test.ts +++ b/test/relationships.test.ts @@ -1,4 +1,5 @@ import { ConnectorClient, ConnectorRelationshipAuditLogEntryReason, ConnectorRelationshipStatus } from "@nmshd/connector-sdk"; +import { RelationshipAttributeConfidentiality } from "@nmshd/content"; import { Launcher } from "./lib/Launcher"; import { QueryParamConditions } from "./lib/QueryParamConditions"; import { getTimeout } from "./lib/setTimeout"; @@ -225,7 +226,7 @@ describe("Relationships", () => { value: "AProprietaryString" }, key: "randomKey", - confidentiality: "public" + confidentiality: RelationshipAttributeConfidentiality.Public }); await executeFullCreateAndShareRepositoryAttributeFlow(client1, client2, {