@nmshd/connector-tui 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ConnectorTUIBase.js
CHANGED
|
@@ -59,8 +59,8 @@ export class ConnectorTUIBase {
|
|
|
59
59
|
}
|
|
60
60
|
const surname = relationshipAttributes.find((a) => a.content.value["@type"] === "Surname");
|
|
61
61
|
const givenName = relationshipAttributes.find((a) => a.content.value["@type"] === "GivenName");
|
|
62
|
-
if (
|
|
63
|
-
const name = `${
|
|
62
|
+
if (givenName || surname) {
|
|
63
|
+
const name = `${givenName?.content.value?.value ?? ""} ${surname?.content.value?.value ?? ""}`.trim();
|
|
64
64
|
return {
|
|
65
65
|
title: `${relationship.peer} (${name})`,
|
|
66
66
|
value,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
|
+
import prompts from "prompts";
|
|
3
|
+
export function AddDeleteAttribute(Base) {
|
|
4
|
+
return class DeleteAttribute extends Base {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
this.choices.push({ title: "Delete Attribute", value: this.deleteAttribute });
|
|
8
|
+
}
|
|
9
|
+
async deleteAttribute() {
|
|
10
|
+
const attributeType = await prompts({
|
|
11
|
+
message: "Do you want to delete an own Attribute?",
|
|
12
|
+
type: "confirm",
|
|
13
|
+
name: "own",
|
|
14
|
+
});
|
|
15
|
+
if (attributeType.own) {
|
|
16
|
+
const query = { content: { owner: this.connectorAddress } };
|
|
17
|
+
const attribute = await this.selectAttribute("Which Attribute would you like to delete?", query);
|
|
18
|
+
if (!attribute) {
|
|
19
|
+
console.log("No Attribute selected");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const result = await this.connectorClient.attributes.deleteAttributeAndNotify(attribute.id);
|
|
23
|
+
if (result.isError) {
|
|
24
|
+
console.log(result.error);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log("Deleted Attribute successfully");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const relationship = await this.selectRelationship("From which peer do you want to delete an Attribute?", RelationshipStatus.Active, RelationshipStatus.Pending, RelationshipStatus.Terminated, RelationshipStatus.DeletionProposed);
|
|
31
|
+
if (!relationship) {
|
|
32
|
+
console.log("No peer selected");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const query = {
|
|
36
|
+
"@type": ["PeerIdentityAttribute", "PeerRelationshipAttribute", "ThirdPartyRelationshipAttribute"],
|
|
37
|
+
peer: relationship.peerIdentity.address,
|
|
38
|
+
};
|
|
39
|
+
const attribute = await this.selectAttribute("Which Attribute would you like to delete?", query);
|
|
40
|
+
if (!attribute) {
|
|
41
|
+
console.log("No Attribute selected");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const result = await this.connectorClient.attributes.deleteAttributeAndNotify(attribute.id);
|
|
45
|
+
if (result.isError) {
|
|
46
|
+
console.log(result.error);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
console.log("Deleted Attribute successfully");
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -22,6 +22,16 @@ export function AddSendMail(Base) {
|
|
|
22
22
|
type: "text",
|
|
23
23
|
name: "body",
|
|
24
24
|
initial: "A Body",
|
|
25
|
+
format: (value) => value.replaceAll("\\n", "\n"),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
message: "What's the body format?",
|
|
29
|
+
type: "select",
|
|
30
|
+
name: "bodyFormat",
|
|
31
|
+
choices: [
|
|
32
|
+
{ title: "PlainText", value: "PlainText" },
|
|
33
|
+
{ title: "Markdown", value: "Markdown" },
|
|
34
|
+
],
|
|
25
35
|
},
|
|
26
36
|
]);
|
|
27
37
|
const content = {
|
|
@@ -29,6 +39,7 @@ export function AddSendMail(Base) {
|
|
|
29
39
|
to: recipients,
|
|
30
40
|
subject: result.subject,
|
|
31
41
|
body: result.body,
|
|
42
|
+
bodyFormat: result.bodyFormat,
|
|
32
43
|
};
|
|
33
44
|
const sendMessageResult = await this.connectorClient.messages.sendMessage({ recipients, content, attachments: attachments?.map((a) => a.id) });
|
|
34
45
|
if (sendMessageResult.isError) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConnectorTUIBase } from "../ConnectorTUIBase.js";
|
|
2
|
-
import { AddAcceptPendingRelationships, AddAcceptPendingRequests, AddConnectorInfo, AddDecomposeRelationship, AddExit, AddGetAttributesOfRelationship, AddIdentityDeletionProcess, AddSendMail, AddSendPremadeRequestByMessage, AddSendRequestByMessage, AddShareRequestByTemplate, AddSync, AddTerminateRelationship, AddUploadFile, } from "./index.js";
|
|
2
|
+
import { AddAcceptPendingRelationships, AddAcceptPendingRequests, AddConnectorInfo, AddDecomposeRelationship, AddDeleteAttribute, AddExit, AddGetAttributesOfRelationship, AddIdentityDeletionProcess, AddSendMail, AddSendPremadeRequestByMessage, AddSendRequestByMessage, AddShareRequestByTemplate, AddSync, AddTerminateRelationship, AddUploadFile, } from "./index.js";
|
|
3
3
|
export class ConnectorTUIBaseWithMixins
|
|
4
4
|
//
|
|
5
|
-
extends AddExit(AddConnectorInfo(AddDecomposeRelationship(AddTerminateRelationship(AddAcceptPendingRelationships(AddAcceptPendingRequests(AddGetAttributesOfRelationship(AddSendMail(AddSendPremadeRequestByMessage(AddSendRequestByMessage(AddShareRequestByTemplate(AddSync(AddUploadFile(AddIdentityDeletionProcess(
|
|
5
|
+
extends AddExit(AddConnectorInfo(AddDecomposeRelationship(AddTerminateRelationship(AddAcceptPendingRelationships(AddAcceptPendingRequests(AddDeleteAttribute(AddGetAttributesOfRelationship(AddSendMail(AddSendPremadeRequestByMessage(AddSendRequestByMessage(AddShareRequestByTemplate(AddSync(AddUploadFile(AddIdentityDeletionProcess(
|
|
6
6
|
//
|
|
7
|
-
ConnectorTUIBase)))))))))))))) {
|
|
7
|
+
ConnectorTUIBase))))))))))))))) {
|
|
8
8
|
}
|
package/dist/mixins/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./AddAcceptPendingRelationships.js";
|
|
|
2
2
|
export * from "./AddAcceptPendingRequests.js";
|
|
3
3
|
export * from "./AddConnectorInfo.js";
|
|
4
4
|
export * from "./AddDecomposeRelationship.js";
|
|
5
|
+
export * from "./AddDeleteAttribute.js";
|
|
5
6
|
export * from "./AddExit.js";
|
|
6
7
|
export * from "./AddGetAttributesOfRelationship.js";
|
|
7
8
|
export * from "./AddIdentityDeletionProcess.js";
|
package/package.json
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"watch": "node --watch --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/run.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nmshd/connector-sdk": "^7.
|
|
32
|
-
"axios": "^1.13.
|
|
31
|
+
"@nmshd/connector-sdk": "^7.2.2",
|
|
32
|
+
"axios": "^1.13.2",
|
|
33
33
|
"chalk": "^5.6.2",
|
|
34
34
|
"dotenv": "^17.2.3",
|
|
35
35
|
"luxon": "^3.7.2",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"@js-soft/eslint-config-ts": "^2.0.4",
|
|
42
42
|
"@js-soft/license-check": "^1.0.10",
|
|
43
43
|
"@types/luxon": "^3.7.1",
|
|
44
|
-
"@types/node": "^24.10.
|
|
44
|
+
"@types/node": "^24.10.2",
|
|
45
45
|
"@types/prompts": "^2.4.9",
|
|
46
46
|
"@types/qrcode-terminal": "^0.12.2",
|
|
47
|
-
"@types/yargs": "^17.0.
|
|
47
|
+
"@types/yargs": "^17.0.35",
|
|
48
48
|
"eslint": "^9.39.1",
|
|
49
|
-
"prettier": "^3.
|
|
49
|
+
"prettier": "^3.7.4",
|
|
50
50
|
"ts-node": "^10.9.2",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=24.11.
|
|
54
|
+
"node": ">=24.11.1"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|
|
58
58
|
"provenance": true
|
|
59
59
|
},
|
|
60
|
-
"version": "3.
|
|
60
|
+
"version": "3.1.1"
|
|
61
61
|
}
|