@nmshd/connector-tui 2.2.2 → 2.4.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 j&s-soft GmbH
1
+ Copyright 2025 j&s-soft AG
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
@@ -63,6 +63,10 @@ export function AddSendRequestByMessage(Base) {
63
63
  title: "AuthenticationRequestItem",
64
64
  value: this.createAuthenticationRequestItem.bind(this),
65
65
  },
66
+ {
67
+ title: "FreeTextRequestItem",
68
+ value: this.createFreeTextRequestItem.bind(this),
69
+ },
66
70
  {
67
71
  title: "No more items please",
68
72
  value: "no-more",
@@ -172,13 +176,13 @@ export function AddSendRequestByMessage(Base) {
172
176
  name: "thirdParties",
173
177
  },
174
178
  ]);
175
- const title = result.attributeTitle ? result.attributeTitle : `A ${result.attributeType} attribute`;
179
+ const title = result.attributeTitle ?? `A ${result.attributeType} attribute`;
176
180
  const requestItem = {
177
181
  "@type": "ReadAttributeRequestItem",
178
182
  mustBeAccepted: true,
179
183
  query: {
180
184
  "@type": "RelationshipAttributeQuery",
181
- owner: result.owner ? result.owner : "",
185
+ owner: result.owner ?? "",
182
186
  attributeCreationHints: {
183
187
  title: title,
184
188
  description: result.attributeDescription,
@@ -223,7 +227,7 @@ export function AddSendRequestByMessage(Base) {
223
227
  mustBeAccepted: true,
224
228
  query: {
225
229
  "@type": "ThirdPartyRelationshipAttributeQuery",
226
- owner: result.owner ? result.owner : "",
230
+ owner: result.owner ?? "",
227
231
  key: result.key,
228
232
  thirdParty: thirdParties,
229
233
  },
@@ -511,7 +515,7 @@ export function AddSendRequestByMessage(Base) {
511
515
  },
512
516
  ]);
513
517
  const responseMetadata = result.consentKey ? { consentKey: result.consentKey } : undefined;
514
- const link = result.link ? result.link : undefined;
518
+ const link = result.link ?? undefined;
515
519
  const requestItem = {
516
520
  "@type": "ConsentRequestItem",
517
521
  mustBeAccepted: true,
@@ -561,5 +565,20 @@ export function AddSendRequestByMessage(Base) {
561
565
  };
562
566
  return requestItem;
563
567
  }
568
+ async createFreeTextRequestItem() {
569
+ const result = await prompts([
570
+ {
571
+ message: "Enter a free text",
572
+ type: "text",
573
+ name: "freeText",
574
+ },
575
+ ]);
576
+ const requestItem = {
577
+ "@type": "FreeTextRequestItem",
578
+ mustBeAccepted: true,
579
+ freeText: result.freeText,
580
+ };
581
+ return requestItem;
582
+ }
564
583
  };
565
584
  }
@@ -31,7 +31,7 @@ export function AddShareRequestByTemplate(Base) {
31
31
  mustBeAccepted: true,
32
32
  query: {
33
33
  "@type": "IdentityAttributeQuery",
34
- valueType: "Surname",
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: "GivenName",
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 request = { "@type": "Request", items: [] };
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
- request.items.push(sharedAttributes);
64
- request.items.push(requestedAttributes);
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(request, name, passwordProtection);
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(request, name, passwordProtection) {
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: request,
164
+ onNewRelationship,
165
+ onExistingRelationship,
143
166
  };
144
167
  const template = await this.connectorClient.relationshipTemplates.createOwnRelationshipTemplate({
145
168
  content,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@nmshd/connector-tui",
3
- "version": "2.2.2",
3
+ "version": "2.4.0",
4
4
  "repository": "github:nmshd/connector-tui",
5
5
  "license": "MIT",
6
- "author": "j&s-soft GmbH",
6
+ "author": "j&s-soft AG",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "types": "src/index.d.ts",
@@ -24,13 +24,13 @@
24
24
  "lint:tsc": "tsc --noEmit",
25
25
  "lint:eslint": "eslint --ext .ts ./src",
26
26
  "lint:prettier": "prettier --check ./src",
27
- "start": "node --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/index.ts",
27
+ "start": "node --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/run.ts",
28
28
  "test": "echo 'no test specified'",
29
- "watch": "node --watch --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/index.ts"
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.14.5",
33
- "axios": "^1.7.9",
32
+ "@nmshd/connector-sdk": "^6.16.3",
33
+ "axios": "^1.8.3",
34
34
  "chalk": "^5.4.1",
35
35
  "dotenv": "^16.4.7",
36
36
  "luxon": "^3.5.0",
@@ -39,17 +39,17 @@
39
39
  "yargs": "^17.7.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@js-soft/eslint-config-ts": "^1.6.13",
42
+ "@js-soft/eslint-config-ts": "^1.6.14",
43
43
  "@js-soft/license-check": "^1.0.9",
44
44
  "@types/luxon": "^3.4.2",
45
- "@types/node": "^22.13.4",
45
+ "@types/node": "^22.13.10",
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.1",
50
+ "prettier": "^3.5.3",
51
51
  "ts-node": "^10.9.2",
52
- "typescript": "^5.7.3"
52
+ "typescript": "^5.8.2"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=19.0.0"