@nmshd/connector-tui 0.0.3 → 0.1.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.
@@ -46,6 +46,7 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
46
46
  console.log(`Welcome to the ${chalk.blue("Enmeshed V2 TUI")}!`);
47
47
  console.log(`TUI Version: ${chalk.yellow(packageJson.version)}`);
48
48
  console.log(`Connector version: ${chalk.yellow(connectorVersionInfo.version)}`);
49
+ console.log(`Connector Address: ${chalk.yellow(this.connectorAddress)}`);
49
50
  console.log("");
50
51
  }
51
52
  }
@@ -28,7 +28,12 @@ export class ConnectorTUIBase {
28
28
  return recipients;
29
29
  }
30
30
  async getRelationshipChoices(status, returnRelationship) {
31
- const relationships = (await this.connectorClient.relationships.getRelationships({ status })).result;
31
+ const relationshipsResult = await this.connectorClient.relationships.getRelationships({ status });
32
+ if (relationshipsResult.isError) {
33
+ console.error(relationshipsResult.error);
34
+ return;
35
+ }
36
+ const relationships = relationshipsResult.result;
32
37
  if (relationships.length === 0) {
33
38
  console.log(`No relationships with status '${status}' found`);
34
39
  return;
@@ -0,0 +1,51 @@
1
+ import { ConnectorRequestStatus } from "@nmshd/connector-sdk";
2
+ import prompts from "prompts";
3
+ export function AddAcceptPendingRequests(Base) {
4
+ return class Sync extends Base {
5
+ constructor(...args) {
6
+ super(...args);
7
+ this.choices.push({ title: "Accept Pending Requests", value: this.acceptPendingRequests });
8
+ }
9
+ async acceptPendingRequests() {
10
+ const result = await prompts({
11
+ message: "Do you want to sync before accepting pending requests?",
12
+ type: "confirm",
13
+ name: "sync",
14
+ });
15
+ if (result.sync) {
16
+ await this.connectorClient.account.sync();
17
+ }
18
+ const pendingRequests = (await this.connectorClient.incomingRequests.getRequests({
19
+ status: ConnectorRequestStatus.ManualDecisionRequired,
20
+ })).result;
21
+ for (const request of pendingRequests) {
22
+ const title = request.content.title ? `title ${request.content.title}` : "no title";
23
+ console.log(`Trying to accept request ${request.id} with ${title}...`);
24
+ const items = [];
25
+ for (const item of request.content.items) {
26
+ if (item["@type"] === "RequestItemGroup") {
27
+ const acceptItems = [];
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ for (const _itemOfGroup of item.items) {
30
+ acceptItems.push({ accept: true });
31
+ }
32
+ items.push({ items: acceptItems });
33
+ }
34
+ else {
35
+ items.push({ accept: true });
36
+ }
37
+ }
38
+ const canAcceptResult = await this.connectorClient.incomingRequests.canAccept(request.id, { items: items });
39
+ if (canAcceptResult.isError) {
40
+ console.log(canAcceptResult.error);
41
+ return;
42
+ }
43
+ const acceptResult = await this.connectorClient.incomingRequests.accept(request.id, { items: items });
44
+ if (acceptResult.isError) {
45
+ console.log(acceptResult.error);
46
+ return;
47
+ }
48
+ }
49
+ }
50
+ };
51
+ }
@@ -0,0 +1,36 @@
1
+ export function AddGetAttributesOfRelationship(Base) {
2
+ return class AddGetAttributesOfRelationship extends Base {
3
+ constructor(...args) {
4
+ super(...args);
5
+ this.choices.push({ title: "Get Attributes Of Relationship", value: this.getAttributesOfRelationship });
6
+ }
7
+ async getAttributesOfRelationship() {
8
+ const relationship = await this.selectRelationship("From which relationship do you want to get the attributes?");
9
+ if (!relationship)
10
+ return console.log("No recipient selected");
11
+ const attributeResult = await this.connectorClient.relationships.getAttributesForRelationship(relationship.id);
12
+ if (attributeResult.isError) {
13
+ console.log(attributeResult.error);
14
+ return;
15
+ }
16
+ const attributes = attributeResult.result.filter((a) => a.content.owner === relationship.peer || a.content["@type"] === "RelationshipAttribute");
17
+ attributes.map((attribute) => {
18
+ if (!attribute?.content?.value.value) {
19
+ console.log(`${attribute.id}: ${attribute.content.value["@type"]}`);
20
+ for (const propertyName in attribute.content.value) {
21
+ if (propertyName === "@type")
22
+ continue;
23
+ console.log(` ${propertyName}: ${attribute.content.value[propertyName]}`);
24
+ }
25
+ }
26
+ else if (attribute.content["@type"] === "RelationshipAttribute") {
27
+ console.log(`${attribute.id}: ${attribute.content.value.title} [${attribute.content.value["@type"]}] = ${attribute.content.value.value}`);
28
+ }
29
+ else {
30
+ console.log(`${attribute.id}: ${attribute.content.value["@type"]} = ${attribute.content.value.value}`);
31
+ }
32
+ return attribute;
33
+ });
34
+ }
35
+ };
36
+ }
@@ -1,6 +1,6 @@
1
1
  import prompts from "prompts";
2
2
  export function AddSendRequestByMessage(Base) {
3
- return class Sync extends Base {
3
+ return class SendRequestByMessage extends Base {
4
4
  constructor(...args) {
5
5
  super(...args);
6
6
  this.choices.push({ title: "Send Request By Message", value: this.sendRequestByMessage });
@@ -10,125 +10,297 @@ export function AddSendRequestByMessage(Base) {
10
10
  if (!recipient)
11
11
  return console.log("No recipient selected");
12
12
  const peer = recipient.peer;
13
- const whatRequest = await prompts({
14
- message: "What kind of request do you want to send?",
13
+ const requestItems = [];
14
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition,no-constant-condition
15
+ while (true) {
16
+ const whatRequest = await prompts({
17
+ message: "What kind of request do you want to send?",
18
+ type: "select",
19
+ name: "requestMethod",
20
+ choices: [
21
+ {
22
+ title: "ReadAttributeRequestItem",
23
+ value: this.createReadAttributeRequestItem.bind(this),
24
+ },
25
+ {
26
+ title: "ProposeAttributeRequestItem",
27
+ value: this.createProposeAttributeRequestItem.bind(this),
28
+ },
29
+ {
30
+ title: "CreateRelationshipAttributeRequestItem",
31
+ value: this.createCreateRelationshipAttributeRequestItem.bind(this),
32
+ },
33
+ {
34
+ title: "CreateIdentityAttributeRequestItem",
35
+ value: this.createCreateIdentityAttributeRequestItem.bind(this),
36
+ },
37
+ {
38
+ title: "ConsentRequestItem",
39
+ value: this.createConsentRequestItem.bind(this),
40
+ },
41
+ {
42
+ title: "AuthenticationRequestItem",
43
+ value: this.createAuthenticationRequestItem.bind(this),
44
+ },
45
+ {
46
+ title: "No more items please",
47
+ value: "no-more",
48
+ },
49
+ ],
50
+ });
51
+ if (!whatRequest.requestMethod)
52
+ return;
53
+ if (typeof whatRequest.requestMethod !== "function") {
54
+ break;
55
+ }
56
+ const requestItemJSON = await whatRequest.requestMethod(peer);
57
+ requestItems.push(requestItemJSON);
58
+ }
59
+ if (requestItems.length === 0) {
60
+ console.error("You have to add at least one item.");
61
+ return;
62
+ }
63
+ const response = await this.connectorClient.outgoingRequests.createRequest({
64
+ peer,
65
+ content: {
66
+ items: requestItems,
67
+ },
68
+ });
69
+ if (response.isError) {
70
+ return console.error("Error while creating LocalRequest", response.error);
71
+ }
72
+ const messageResponse = await this.connectorClient.messages.sendMessage({
73
+ recipients: [peer],
74
+ content: response.result.content,
75
+ });
76
+ if (messageResponse.isError) {
77
+ return console.error("Error while sending message", messageResponse.error);
78
+ }
79
+ console.log("The following Request was sent:", JSON.stringify(response.result.content, null, 2));
80
+ console.log(`Request sent to '${peer}'`);
81
+ }
82
+ async createReadAttributeRequestItem() {
83
+ const whatAttribute = await prompts({
84
+ message: "What kind of Attribute do you want to read?",
15
85
  type: "select",
16
- name: "requestMethod",
86
+ name: "attributeType",
17
87
  choices: [
18
88
  {
19
- title: "ReadRelationshipAttributeRequest",
20
- value: this.createReadRelationshipAttributeRequest.bind(this),
89
+ title: "Identity Attribute",
90
+ value: "IdentityAttribute",
21
91
  },
22
92
  {
23
- title: "ReadIdentityAttributeRequest",
24
- value: this.createReadIdentityAttributeRequest.bind(this),
93
+ title: "Relationship Attribute",
94
+ value: "RelationshipAttribute",
25
95
  },
26
96
  {
27
- title: "ProposeAttributeRequest",
28
- value: this.createProposeAttributeRequest.bind(this),
29
- },
30
- {
31
- title: "CreateRelationshipAttributeRequest",
32
- value: this.createCreateRelationshipAttributeRequest.bind(this),
97
+ title: "Third Party Relationship Attribute",
98
+ value: "ThirdPartyRelationshipAttribute",
33
99
  },
34
100
  ],
35
101
  });
36
- if (!whatRequest.requestMethod)
37
- return console.log("No request method selected");
38
- const response = await whatRequest.requestMethod(peer);
39
- if (response.isError) {
40
- return console.error("Error while creating LocalRequest", response.error);
102
+ switch (whatAttribute.attributeType) {
103
+ case "IdentityAttribute":
104
+ return await this.createReadIdentityAttributeRequestItem();
105
+ case "RelationshipAttribute":
106
+ return await this.createReadRelationshipAttributeRequestItem();
107
+ case "ThirdPartyRelationshipAttribute":
108
+ return await this.createReadThirdPartyRelationshipAttributeRequestItem();
109
+ default:
110
+ return console.log("Invalid attribute type");
41
111
  }
42
- const messageResult = await this.connectorClient.messages.sendMessage({
43
- recipients: [peer],
44
- content: response.result.content,
45
- });
46
- if (messageResult.isError) {
47
- return console.error("Error while sending message", messageResult.error);
48
- }
49
- console.log(`Request sent to '${peer}'`);
50
112
  }
51
- async createReadRelationshipAttributeRequest(peer) {
113
+ async createReadRelationshipAttributeRequestItem() {
52
114
  const result = await prompts([
53
115
  {
54
- message: "Whats the attribute type you would like to query?",
116
+ message: "What's the attribute type you would like to query?",
55
117
  type: "text",
56
118
  name: "attributeType",
57
- initial: "An attribute type",
58
119
  },
59
120
  {
60
- message: "Whats the key of the attribute you would like to query?",
121
+ message: "What's the title of the RelationshipAttribute?",
122
+ type: "text",
123
+ name: "attributeTitle",
124
+ initial: "Attribute Title",
125
+ },
126
+ {
127
+ message: "What's the description of the RelationshipAttribute?",
128
+ type: "text",
129
+ name: "attributeDescription",
130
+ initial: "Attribute Title",
131
+ },
132
+ {
133
+ message: "What's the key of the attribute you would like to query?",
61
134
  type: "text",
62
135
  name: "key",
63
136
  initial: "Key of RelationshipAttribute",
64
137
  },
65
138
  {
66
- message: "Whats the third party address?",
139
+ message: "Who is the owner of the RelationshipAttribute?",
67
140
  type: "text",
68
- name: "thirdParty",
69
- initial: "Third party address",
141
+ name: "owner",
142
+ },
143
+ {
144
+ message: "What are the third party addresses? (comma-separated, optional)",
145
+ type: "text",
146
+ name: "thirdParties",
70
147
  },
71
148
  ]);
72
- return await this.connectorClient.outgoingRequests.createRequest({
73
- peer,
74
- content: {
75
- items: [
76
- {
77
- "@type": "ReadAttributeRequestItem",
78
- mustBeAccepted: true,
79
- query: {
80
- "@type": "RelationshipAttributeQuery",
81
- owner: "",
82
- attributeCreationHints: {
83
- title: `A ${result.attributeType} attribute`,
84
- confidentiality: "public",
85
- valueType: result.attributeType,
86
- },
87
- key: result.key,
88
- },
89
- },
90
- ],
149
+ const title = result.attributeTitle ? result.attributeTitle : `A ${result.attributeType} attribute`;
150
+ const requestItem = {
151
+ "@type": "ReadAttributeRequestItem",
152
+ mustBeAccepted: true,
153
+ query: {
154
+ "@type": "RelationshipAttributeQuery",
155
+ owner: result.owner ? result.owner : "",
156
+ attributeCreationHints: {
157
+ title: title,
158
+ description: result.attributeDescription,
159
+ confidentiality: "public",
160
+ valueType: result.attributeType,
161
+ },
162
+ key: result.key,
91
163
  },
92
- });
164
+ };
165
+ return requestItem;
93
166
  }
94
- async createReadIdentityAttributeRequest(peer) {
167
+ async createReadThirdPartyRelationshipAttributeRequestItem() {
95
168
  const result = await prompts([
96
169
  {
97
- message: "Whats the attribute type you would like to query?",
170
+ message: "What's the attribute type you would like to query?",
98
171
  type: "text",
99
172
  name: "attributeType",
100
- initial: "An attribute type",
173
+ },
174
+ {
175
+ message: "What's the key of the attribute you would like to query?",
176
+ type: "text",
177
+ name: "key",
178
+ initial: "Key of RelationshipAttribute",
179
+ },
180
+ {
181
+ message: "Who is the owner of the RelationshipAttribute?",
182
+ type: "text",
183
+ name: "owner",
184
+ },
185
+ {
186
+ message: "What are the third party addresses? (comma-separated)",
187
+ type: "text",
188
+ name: "thirdParties",
101
189
  },
102
190
  ]);
103
- return await this.connectorClient.outgoingRequests.createRequest({
104
- peer,
105
- content: {
106
- items: [
107
- {
108
- "@type": "ReadAttributeRequestItem",
109
- mustBeAccepted: true,
110
- query: {
111
- "@type": "IdentityAttributeQuery",
112
- valueType: result.attributeType,
113
- },
114
- },
115
- ],
191
+ const thirdParties = result.thirdParties
192
+ .split(",")
193
+ .map((address) => address.trim())
194
+ .filter((address) => address.length > 0);
195
+ const requestItem = {
196
+ "@type": "ReadAttributeRequestItem",
197
+ mustBeAccepted: true,
198
+ query: {
199
+ "@type": "ThirdPartyRelationshipAttributeQuery",
200
+ owner: result.owner ? result.owner : "",
201
+ key: result.key,
202
+ thirdParty: thirdParties,
116
203
  },
117
- });
204
+ };
205
+ return requestItem;
206
+ }
207
+ async createReadIdentityAttributeRequestItem() {
208
+ const result = await prompts([
209
+ {
210
+ message: "What's the attribute type you would like to query?",
211
+ type: "text",
212
+ name: "attributeType",
213
+ },
214
+ ]);
215
+ const requestItem = {
216
+ "@type": "ReadAttributeRequestItem",
217
+ mustBeAccepted: true,
218
+ query: {
219
+ "@type": "IdentityAttributeQuery",
220
+ valueType: result.attributeType,
221
+ },
222
+ };
223
+ return requestItem;
118
224
  }
119
- async createProposeAttributeRequest(peer) {
225
+ async createProposeAttributeRequestItem() {
120
226
  const result = await prompts([
121
227
  {
122
- message: "Whats the attribute type you would like to create?",
228
+ message: "What's the attribute type you would like to create?",
123
229
  type: "text",
124
230
  name: "attributeType",
125
- initial: "An attribute type",
126
231
  },
127
232
  {
128
- message: "Whats the value of your Attribute?",
233
+ message: "What's the value of your Attribute?",
234
+ type: "text",
235
+ name: "value",
236
+ },
237
+ ]);
238
+ const requestItem = {
239
+ "@type": "ProposeAttributeRequestItem",
240
+ mustBeAccepted: true,
241
+ query: {
242
+ "@type": "IdentityAttributeQuery",
243
+ valueType: result.attributeType,
244
+ },
245
+ attribute: {
246
+ "@type": "IdentityAttribute",
247
+ owner: "",
248
+ value: {
249
+ "@type": result.attributeType,
250
+ value: result.value,
251
+ },
252
+ },
253
+ };
254
+ return requestItem;
255
+ }
256
+ async createCreateRelationshipAttributeRequestItem() {
257
+ const result = await prompts([
258
+ {
259
+ message: "What's the title of the RelationshipAttribute you would like to create?",
260
+ type: "text",
261
+ name: "title",
262
+ initial: "Title of RelationshipAttribute",
263
+ },
264
+ {
265
+ message: "What's the key of the RelationshipAttribute you would like to create?",
266
+ type: "text",
267
+ name: "key",
268
+ initial: "Key of RelationshipAttribute",
269
+ },
270
+ {
271
+ message: "What's the value of your Attribute?",
272
+ type: "text",
273
+ name: "value",
274
+ },
275
+ ]);
276
+ const requestItem = {
277
+ "@type": "CreateAttributeRequestItem",
278
+ mustBeAccepted: true,
279
+ attribute: {
280
+ "@type": "RelationshipAttribute",
281
+ owner: "",
282
+ key: result.key,
283
+ confidentiality: "public",
284
+ value: {
285
+ "@type": "ProprietaryString",
286
+ value: result.value,
287
+ title: result.title,
288
+ },
289
+ },
290
+ };
291
+ return requestItem;
292
+ }
293
+ async createCreateIdentityAttributeRequestItem(peer) {
294
+ const result = await prompts([
295
+ {
296
+ message: "What's the value type of the IdentityAttribute you would like to create?",
297
+ type: "text",
298
+ name: "valueType",
299
+ },
300
+ {
301
+ message: "What's the value of the Attribute?",
129
302
  type: "text",
130
303
  name: "value",
131
- initial: "Value",
132
304
  },
133
305
  ]);
134
306
  return await this.connectorClient.outgoingRequests.createRequest({
@@ -136,17 +308,13 @@ export function AddSendRequestByMessage(Base) {
136
308
  content: {
137
309
  items: [
138
310
  {
139
- "@type": "ProposeAttributeRequestItem",
311
+ "@type": "CreateAttributeRequestItem",
140
312
  mustBeAccepted: true,
141
- query: {
142
- "@type": "IdentityAttributeQuery",
143
- valueType: result.attributeType,
144
- },
145
313
  attribute: {
146
314
  "@type": "IdentityAttribute",
147
- owner: "",
315
+ owner: peer,
148
316
  value: {
149
- "@type": result.attributeType,
317
+ "@type": result.valueType,
150
318
  value: result.value,
151
319
  },
152
320
  },
@@ -155,45 +323,64 @@ export function AddSendRequestByMessage(Base) {
155
323
  },
156
324
  });
157
325
  }
158
- async createCreateRelationshipAttributeRequest(peer) {
326
+ async createConsentRequestItem(peer) {
159
327
  const result = await prompts([
160
328
  {
161
- message: "Whats the title of the RelationshipAttribute you would like to create?",
329
+ message: "What's the consent the peer should agree to?",
162
330
  type: "text",
163
- name: "title",
164
- initial: "Title of RelationshipAttribute",
331
+ name: "consent",
165
332
  },
166
333
  {
167
- message: "Whats the key of the RelationshipAttribute you would like to create?",
334
+ message: "[Optional] Enter the URL to to the consent details?",
168
335
  type: "text",
169
- name: "key",
170
- initial: "Key of RelationshipAttribute",
336
+ name: "link",
171
337
  },
172
338
  {
173
- message: "Whats the value of your Attribute?",
339
+ message: "[Optional] Enter a consentKey to know which consent the user agreed to",
174
340
  type: "text",
175
- name: "value",
176
- initial: "Value",
341
+ name: "consentKey",
177
342
  },
178
343
  ]);
344
+ const responseMetadata = result.consentKey ? { consentKey: result.consentKey } : undefined;
345
+ const link = result.link ? result.link : undefined;
179
346
  return await this.connectorClient.outgoingRequests.createRequest({
180
347
  peer,
181
348
  content: {
182
349
  items: [
183
350
  {
184
- "@type": "CreateAttributeRequestItem",
351
+ "@type": "ConsentRequestItem",
185
352
  mustBeAccepted: true,
186
- attribute: {
187
- "@type": "RelationshipAttribute",
188
- owner: "",
189
- key: result.key,
190
- confidentiality: "public",
191
- value: {
192
- "@type": "ProprietaryString",
193
- value: result.value,
194
- title: result.title,
195
- },
196
- },
353
+ consent: result.consent,
354
+ link,
355
+ responseMetadata,
356
+ },
357
+ ],
358
+ },
359
+ });
360
+ }
361
+ async createAuthenticationRequestItem(peer) {
362
+ const result = await prompts([
363
+ {
364
+ message: "Enter a title of the authentication",
365
+ type: "text",
366
+ name: "title",
367
+ },
368
+ {
369
+ message: "[Optional] Enter an unique authenticationToken to know which authentication did the user grant",
370
+ type: "text",
371
+ name: "authenticationToken",
372
+ },
373
+ ]);
374
+ const responseMetadata = result.authenticationToken ? { authenticationToken: result.authenticationToken } : undefined;
375
+ return await this.connectorClient.outgoingRequests.createRequest({
376
+ peer,
377
+ content: {
378
+ items: [
379
+ {
380
+ "@type": "AuthenticationRequestItem",
381
+ mustBeAccepted: true,
382
+ title: result.title,
383
+ responseMetadata,
197
384
  },
198
385
  ],
199
386
  },
@@ -1,7 +1,8 @@
1
1
  import { ConnectorTUIBase } from "../ConnectorTUIBase";
2
2
  import { AddAcceptPendingRelationships } from "./AddAcceptPendingRelationships";
3
+ import { AddAcceptPendingRequests } from "./AddAcceptPendingRequests";
3
4
  import { AddExit } from "./AddExit";
4
- import { AddGetAttributesOfContact } from "./AddGetAttributesOfContact";
5
+ import { AddGetAttributesOfRelationship } from "./AddGetAttributesOfRelationship";
5
6
  import { AddSendMail } from "./AddSendMail";
6
7
  import { AddSendRequestByMessage } from "./AddSendRequestByMessage";
7
8
  import { AddShareRequestByTemplate } from "./AddShareRequestByTemplate";
@@ -11,9 +12,9 @@ export class ConnectorTUIBaseWithMixins
11
12
  //
12
13
  extends AddExit(
13
14
  //
14
- AddAcceptPendingRelationships(
15
+ AddAcceptPendingRelationships(AddAcceptPendingRequests(
15
16
  //
16
- AddGetAttributesOfContact(
17
+ AddGetAttributesOfRelationship(
17
18
  //
18
19
  AddSendMail(
19
20
  //
@@ -25,5 +26,5 @@ AddSync(
25
26
  //
26
27
  AddUploadFile(
27
28
  //
28
- ConnectorTUIBase)))))))) {
29
+ ConnectorTUIBase))))))))) {
29
30
  }
@@ -1,6 +1,7 @@
1
1
  export * from "./AddAcceptPendingRelationships";
2
+ export * from "./AddAcceptPendingRequests";
2
3
  export * from "./AddExit";
3
- export * from "./AddGetAttributesOfContact";
4
+ export * from "./AddGetAttributesOfRelationship";
4
5
  export * from "./AddSendMail";
5
6
  export * from "./AddSendRequestByMessage";
6
7
  export * from "./AddShareRequestByTemplate";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nmshd/connector-tui",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "repository": "github:nmshd/connector-tui",
5
5
  "license": "MIT",
6
6
  "author": "j&s-soft GmbH",
@@ -20,30 +20,30 @@
20
20
  "lint": "npm run lint:prettier && npm run lint:eslint",
21
21
  "lint:eslint": "eslint --ext .ts ./src",
22
22
  "lint:prettier": "prettier --check ./src",
23
- "start": "clear && ts-node --esm --experimental-specifier-resolution node ./src/index.ts",
23
+ "start": "ts-node --esm --experimental-specifier-resolution node ./src/index.ts",
24
24
  "test": "echo 'no test specified'"
25
25
  },
26
26
  "dependencies": {
27
- "@nmshd/connector-sdk": "^2.0.4",
27
+ "@nmshd/connector-sdk": "^2.1.1",
28
28
  "chalk": "^5.1.2",
29
29
  "dotenv": "^16.0.3",
30
- "luxon": "^3.1.0",
30
+ "luxon": "^3.1.1",
31
31
  "prompts": "^2.4.2",
32
32
  "qrcode-terminal": "^0.12.0",
33
33
  "yargs": "^17.6.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@js-soft/eslint-config-ts": "^1.6.1",
37
- "@js-soft/license-check": "^1.0.5",
38
- "@types/luxon": "^3.0.2",
39
- "@types/node": "^18.11.9",
37
+ "@js-soft/license-check": "^1.0.6",
38
+ "@types/luxon": "^3.1.0",
39
+ "@types/node": "^18.11.10",
40
40
  "@types/prompts": "^2.4.1",
41
41
  "@types/qrcode-terminal": "^0.12.0",
42
- "@types/yargs": "^17.0.13",
43
- "eslint": "^8.26.0",
44
- "prettier": "^2.7.1",
42
+ "@types/yargs": "^17.0.15",
43
+ "eslint": "^8.29.0",
44
+ "prettier": "^2.8.0",
45
45
  "ts-node": "^10.9.1",
46
- "typescript": "^4.8.4"
46
+ "typescript": "^4.9.3"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -1,16 +0,0 @@
1
- export function AddGetAttributesOfContact(Base) {
2
- return class Sync extends Base {
3
- constructor(...args) {
4
- super(...args);
5
- this.choices.push({ title: "Get Attributes Of Contact", value: this.getAttributesOfContact });
6
- }
7
- async getAttributesOfContact() {
8
- const relationship = await this.selectRelationship("From which contact do you want to get the attributes?");
9
- if (!relationship)
10
- return console.log("No recipient selected");
11
- const attributeResult = await this.connectorClient.relationships.getAttributesForRelationship(relationship.id);
12
- const attributes = attributeResult.result.filter((a) => a.content.owner === relationship.peer);
13
- attributes.map((attribute) => console.log(`${attribute.id}: ${attribute.content.value["@type"]} = ${attribute.content.value.value}`));
14
- }
15
- };
16
- }