@nmshd/connector-tui 2.4.0 → 2.5.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
|
@@ -85,7 +85,7 @@ export class ConnectorTUIBase {
|
|
|
85
85
|
return result.files;
|
|
86
86
|
}
|
|
87
87
|
async getFileChoices() {
|
|
88
|
-
const files = (await this.connectorClient.files.
|
|
88
|
+
const files = (await this.connectorClient.files.getOwnFiles()).result;
|
|
89
89
|
if (files.length === 0) {
|
|
90
90
|
console.log("No files found");
|
|
91
91
|
return;
|
|
@@ -67,6 +67,10 @@ export function AddSendRequestByMessage(Base) {
|
|
|
67
67
|
title: "FreeTextRequestItem",
|
|
68
68
|
value: this.createFreeTextRequestItem.bind(this),
|
|
69
69
|
},
|
|
70
|
+
{
|
|
71
|
+
title: "TransferFileOwnershipRequestItem",
|
|
72
|
+
value: this.createTransferFileOwnershipRequestItem.bind(this),
|
|
73
|
+
},
|
|
70
74
|
{
|
|
71
75
|
title: "No more items please",
|
|
72
76
|
value: "no-more",
|
|
@@ -79,7 +83,8 @@ export function AddSendRequestByMessage(Base) {
|
|
|
79
83
|
break;
|
|
80
84
|
}
|
|
81
85
|
const requestItemJSON = await whatRequest.requestMethod(peer);
|
|
82
|
-
|
|
86
|
+
if (requestItemJSON)
|
|
87
|
+
requestItems.push(requestItemJSON);
|
|
83
88
|
}
|
|
84
89
|
if (requestItems.length === 0) {
|
|
85
90
|
console.error("You have to add at least one item.");
|
|
@@ -88,11 +93,23 @@ export function AddSendRequestByMessage(Base) {
|
|
|
88
93
|
const response = await this.connectorClient.outgoingRequests.createRequest({
|
|
89
94
|
peer,
|
|
90
95
|
content: {
|
|
96
|
+
title: "The title of the Request",
|
|
97
|
+
description: "The description of the Request",
|
|
91
98
|
items: requestItems,
|
|
92
99
|
},
|
|
93
100
|
});
|
|
94
101
|
if (response.isError) {
|
|
95
|
-
|
|
102
|
+
console.error("Error while creating LocalRequest", response.error);
|
|
103
|
+
const details = await this.connectorClient.outgoingRequests.canCreateRequest({
|
|
104
|
+
peer,
|
|
105
|
+
content: {
|
|
106
|
+
title: "The title of the Request",
|
|
107
|
+
description: "The description of the Request",
|
|
108
|
+
items: requestItems,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
console.log("Details: ", details.result);
|
|
112
|
+
return;
|
|
96
113
|
}
|
|
97
114
|
const messageResponse = await this.connectorClient.messages.sendMessage({
|
|
98
115
|
recipients: [peer],
|
|
@@ -508,6 +525,11 @@ export function AddSendRequestByMessage(Base) {
|
|
|
508
525
|
type: "text",
|
|
509
526
|
name: "link",
|
|
510
527
|
},
|
|
528
|
+
{
|
|
529
|
+
message: "[Optional] Enter a link display text",
|
|
530
|
+
type: "text",
|
|
531
|
+
name: "linkDisplayText",
|
|
532
|
+
},
|
|
511
533
|
{
|
|
512
534
|
message: "[Optional] Enter a consentKey to know which consent the user agreed to",
|
|
513
535
|
type: "text",
|
|
@@ -521,6 +543,7 @@ export function AddSendRequestByMessage(Base) {
|
|
|
521
543
|
mustBeAccepted: true,
|
|
522
544
|
consent: result.consent,
|
|
523
545
|
link,
|
|
546
|
+
linkDisplayText: link ? result.linkDisplayText : undefined,
|
|
524
547
|
metadata: responseMetadata,
|
|
525
548
|
};
|
|
526
549
|
return requestItem;
|
|
@@ -580,5 +603,23 @@ export function AddSendRequestByMessage(Base) {
|
|
|
580
603
|
};
|
|
581
604
|
return requestItem;
|
|
582
605
|
}
|
|
606
|
+
async createTransferFileOwnershipRequestItem() {
|
|
607
|
+
const file = await this.selectFile("The ownership of which File do you want to transfer?");
|
|
608
|
+
const result = await prompts({
|
|
609
|
+
name: "requireManualDecision",
|
|
610
|
+
message: "Do you want to require a manual decision?",
|
|
611
|
+
initial: false,
|
|
612
|
+
type: "confirm",
|
|
613
|
+
});
|
|
614
|
+
if (!file)
|
|
615
|
+
return;
|
|
616
|
+
const requestItem = {
|
|
617
|
+
"@type": "TransferFileOwnershipRequestItem",
|
|
618
|
+
mustBeAccepted: true,
|
|
619
|
+
requireManualDecision: result.requireManualDecision,
|
|
620
|
+
fileReference: file.truncatedReference,
|
|
621
|
+
};
|
|
622
|
+
return requestItem;
|
|
623
|
+
}
|
|
583
624
|
};
|
|
584
625
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmshd/connector-tui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"repository": "github:nmshd/connector-tui",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "j&s-soft AG",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"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"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nmshd/connector-sdk": "^6.
|
|
33
|
-
"axios": "^1.8.
|
|
32
|
+
"@nmshd/connector-sdk": "^6.21.0",
|
|
33
|
+
"axios": "^1.8.4",
|
|
34
34
|
"chalk": "^5.4.1",
|
|
35
35
|
"dotenv": "^16.4.7",
|
|
36
|
-
"luxon": "^3.
|
|
36
|
+
"luxon": "^3.6.1",
|
|
37
37
|
"prompts": "^2.4.2",
|
|
38
38
|
"qrcode-terminal": "^0.12.0",
|
|
39
39
|
"yargs": "^17.7.2"
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@js-soft/eslint-config-ts": "^1.6.14",
|
|
43
43
|
"@js-soft/license-check": "^1.0.9",
|
|
44
|
-
"@types/luxon": "^3.
|
|
45
|
-
"@types/node": "^22.
|
|
44
|
+
"@types/luxon": "^3.6.2",
|
|
45
|
+
"@types/node": "^22.14.0",
|
|
46
46
|
"@types/prompts": "^2.4.9",
|
|
47
47
|
"@types/qrcode-terminal": "^0.12.2",
|
|
48
48
|
"@types/yargs": "^17.0.33",
|
|
49
49
|
"eslint": "^8.57.0",
|
|
50
50
|
"prettier": "^3.5.3",
|
|
51
51
|
"ts-node": "^10.9.2",
|
|
52
|
-
"typescript": "^5.8.
|
|
52
|
+
"typescript": "^5.8.3"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=19.0.0"
|