@nmshd/connector-tui 2.3.0 → 2.5.0
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,6 +93,8 @@ 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
|
});
|
|
@@ -176,13 +183,13 @@ export function AddSendRequestByMessage(Base) {
|
|
|
176
183
|
name: "thirdParties",
|
|
177
184
|
},
|
|
178
185
|
]);
|
|
179
|
-
const title = result.attributeTitle
|
|
186
|
+
const title = result.attributeTitle ?? `A ${result.attributeType} attribute`;
|
|
180
187
|
const requestItem = {
|
|
181
188
|
"@type": "ReadAttributeRequestItem",
|
|
182
189
|
mustBeAccepted: true,
|
|
183
190
|
query: {
|
|
184
191
|
"@type": "RelationshipAttributeQuery",
|
|
185
|
-
owner: result.owner
|
|
192
|
+
owner: result.owner ?? "",
|
|
186
193
|
attributeCreationHints: {
|
|
187
194
|
title: title,
|
|
188
195
|
description: result.attributeDescription,
|
|
@@ -227,7 +234,7 @@ export function AddSendRequestByMessage(Base) {
|
|
|
227
234
|
mustBeAccepted: true,
|
|
228
235
|
query: {
|
|
229
236
|
"@type": "ThirdPartyRelationshipAttributeQuery",
|
|
230
|
-
owner: result.owner
|
|
237
|
+
owner: result.owner ?? "",
|
|
231
238
|
key: result.key,
|
|
232
239
|
thirdParty: thirdParties,
|
|
233
240
|
},
|
|
@@ -508,6 +515,11 @@ export function AddSendRequestByMessage(Base) {
|
|
|
508
515
|
type: "text",
|
|
509
516
|
name: "link",
|
|
510
517
|
},
|
|
518
|
+
{
|
|
519
|
+
message: "[Optional] Enter a link display text",
|
|
520
|
+
type: "text",
|
|
521
|
+
name: "linkDisplayText",
|
|
522
|
+
},
|
|
511
523
|
{
|
|
512
524
|
message: "[Optional] Enter a consentKey to know which consent the user agreed to",
|
|
513
525
|
type: "text",
|
|
@@ -515,12 +527,13 @@ export function AddSendRequestByMessage(Base) {
|
|
|
515
527
|
},
|
|
516
528
|
]);
|
|
517
529
|
const responseMetadata = result.consentKey ? { consentKey: result.consentKey } : undefined;
|
|
518
|
-
const link = result.link
|
|
530
|
+
const link = result.link ?? undefined;
|
|
519
531
|
const requestItem = {
|
|
520
532
|
"@type": "ConsentRequestItem",
|
|
521
533
|
mustBeAccepted: true,
|
|
522
534
|
consent: result.consent,
|
|
523
535
|
link,
|
|
536
|
+
linkDisplayText: link ? result.linkDisplayText : undefined,
|
|
524
537
|
metadata: responseMetadata,
|
|
525
538
|
};
|
|
526
539
|
return requestItem;
|
|
@@ -580,5 +593,16 @@ export function AddSendRequestByMessage(Base) {
|
|
|
580
593
|
};
|
|
581
594
|
return requestItem;
|
|
582
595
|
}
|
|
596
|
+
async createTransferFileOwnershipRequestItem() {
|
|
597
|
+
const result = await this.selectFile("The ownership of which File do you want to transfer?");
|
|
598
|
+
if (!result)
|
|
599
|
+
return;
|
|
600
|
+
const requestItem = {
|
|
601
|
+
"@type": "TransferFileOwnershipRequestItem",
|
|
602
|
+
mustBeAccepted: true,
|
|
603
|
+
fileReference: result.truncatedReference,
|
|
604
|
+
};
|
|
605
|
+
return requestItem;
|
|
606
|
+
}
|
|
583
607
|
};
|
|
584
608
|
}
|
|
@@ -31,7 +31,7 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
31
31
|
mustBeAccepted: true,
|
|
32
32
|
query: {
|
|
33
33
|
"@type": "IdentityAttributeQuery",
|
|
34
|
-
valueType: "
|
|
34
|
+
valueType: "GivenName",
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
{
|
|
@@ -39,7 +39,7 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
39
39
|
mustBeAccepted: true,
|
|
40
40
|
query: {
|
|
41
41
|
"@type": "IdentityAttributeQuery",
|
|
42
|
-
valueType: "
|
|
42
|
+
valueType: "Surname",
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -52,7 +52,7 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
54
|
};
|
|
55
|
-
const
|
|
55
|
+
const onNewRelationship = { "@type": "Request", items: [] };
|
|
56
56
|
const result = await prompts({
|
|
57
57
|
message: "Do you want to send your connector's name?",
|
|
58
58
|
type: "confirm",
|
|
@@ -60,10 +60,32 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
60
60
|
initial: true,
|
|
61
61
|
});
|
|
62
62
|
if (result.includeName)
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
onNewRelationship.items.push(sharedAttributes);
|
|
64
|
+
onNewRelationship.items.push(requestedAttributes);
|
|
65
|
+
const onExistingRelationship = {
|
|
66
|
+
"@type": "Request",
|
|
67
|
+
title: "Existing Relationship",
|
|
68
|
+
description: "Please accept the following request, because you already have a relationship with the requestor.",
|
|
69
|
+
items: [
|
|
70
|
+
{
|
|
71
|
+
"@type": "RequestItemGroup",
|
|
72
|
+
title: "A Title",
|
|
73
|
+
description: "A Description that is long enough to show what a long description looks like in the app when rendered inside the expandable area",
|
|
74
|
+
items: [
|
|
75
|
+
{
|
|
76
|
+
"@type": "ReadAttributeRequestItem",
|
|
77
|
+
mustBeAccepted: true,
|
|
78
|
+
query: {
|
|
79
|
+
"@type": "IdentityAttributeQuery",
|
|
80
|
+
valueType: "GivenName",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
65
87
|
const passwordProtection = await this.createPasswordProtection();
|
|
66
|
-
await this.createQRCodeForRelationshipTemplate(
|
|
88
|
+
await this.createQRCodeForRelationshipTemplate(onNewRelationship, onExistingRelationship, name, passwordProtection);
|
|
67
89
|
}
|
|
68
90
|
async getOrCreateConnectorDisplayName(displayName) {
|
|
69
91
|
const response = await this.connectorClient.attributes.getValidAttributes({
|
|
@@ -132,14 +154,15 @@ export function AddShareRequestByTemplate(Base) {
|
|
|
132
154
|
});
|
|
133
155
|
return { password: password.password, passwordIsPin: true };
|
|
134
156
|
}
|
|
135
|
-
async createQRCodeForRelationshipTemplate(
|
|
157
|
+
async createQRCodeForRelationshipTemplate(onNewRelationship, onExistingRelationship, name, passwordProtection) {
|
|
136
158
|
const content = {
|
|
137
159
|
"@type": "RelationshipTemplateContent",
|
|
138
160
|
title: `Kontaktanfrage mit ${name}`,
|
|
139
161
|
metadata: {
|
|
140
162
|
webSessionId: "12345",
|
|
141
163
|
},
|
|
142
|
-
onNewRelationship
|
|
164
|
+
onNewRelationship,
|
|
165
|
+
onExistingRelationship,
|
|
143
166
|
};
|
|
144
167
|
const template = await this.connectorClient.relationshipTemplates.createOwnRelationshipTemplate({
|
|
145
168
|
content,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmshd/connector-tui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"repository": "github:nmshd/connector-tui",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "j&s-soft AG",
|
|
@@ -29,27 +29,27 @@
|
|
|
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.
|
|
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"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@js-soft/eslint-config-ts": "^1.6.
|
|
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
|
-
"prettier": "^3.5.
|
|
50
|
+
"prettier": "^3.5.3",
|
|
51
51
|
"ts-node": "^10.9.2",
|
|
52
|
-
"typescript": "^5.
|
|
52
|
+
"typescript": "^5.8.3"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=19.0.0"
|