@nmshd/connector-tui 2.13.0 → 2.13.2
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/ConnectorTUI.js +1 -1
- package/dist/ConnectorTUIBase.js +8 -5
- package/dist/mixins/AddAcceptPendingRelationships.js +2 -2
- package/dist/mixins/AddAcceptPendingRequests.js +2 -4
- package/dist/mixins/AddDecomposeRelationship.js +2 -2
- package/dist/mixins/AddGetAttributesOfRelationship.js +2 -2
- package/dist/mixins/AddSendRequestByMessage.js +1 -1
- package/dist/mixins/AddTerminateRelationship.js +2 -2
- package/package.json +10 -10
- package/src/index.d.ts +2 -2
package/dist/ConnectorTUI.js
CHANGED
|
@@ -16,7 +16,7 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
|
16
16
|
if (!connectorVersionInfo)
|
|
17
17
|
return;
|
|
18
18
|
await this.#showStartupMessage(connectorVersionInfo);
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
20
20
|
while (true) {
|
|
21
21
|
const activeIdentityDeletionProcess = this.isDebugMode() ? await this.identityDeletionProcessEndpoint.getActiveIdentityDeletionProcess() : undefined;
|
|
22
22
|
if (activeIdentityDeletionProcess?.isSuccess && activeIdentityDeletionProcess.result.status === "Approved") {
|
package/dist/ConnectorTUIBase.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
2
3
|
import prompts from "prompts";
|
|
3
4
|
import { IdentityDeletionProcessEndpoint } from "./IdentityDeletionProcessEndpoint.js";
|
|
4
5
|
export class ConnectorTUIBase {
|
|
@@ -16,7 +17,7 @@ export class ConnectorTUIBase {
|
|
|
16
17
|
}
|
|
17
18
|
async selectRelationship(prompt, ...status) {
|
|
18
19
|
if (status.length === 0)
|
|
19
|
-
status.push(
|
|
20
|
+
status.push(RelationshipStatus.Active);
|
|
20
21
|
const choices = await this.getRelationshipChoices(status, true);
|
|
21
22
|
if (!choices)
|
|
22
23
|
return;
|
|
@@ -25,7 +26,7 @@ export class ConnectorTUIBase {
|
|
|
25
26
|
}
|
|
26
27
|
async selectRelationships(prompt, ...status) {
|
|
27
28
|
if (status.length === 0)
|
|
28
|
-
status.push(
|
|
29
|
+
status.push(RelationshipStatus.Active);
|
|
29
30
|
const choices = await this.getRelationshipChoices(status, false);
|
|
30
31
|
if (!choices)
|
|
31
32
|
return;
|
|
@@ -85,9 +86,11 @@ export class ConnectorTUIBase {
|
|
|
85
86
|
return result.files;
|
|
86
87
|
}
|
|
87
88
|
async getFileChoices() {
|
|
88
|
-
const
|
|
89
|
+
const currentDate = DateTime.utc().toISO();
|
|
90
|
+
const datesInFuture = `>=${currentDate}`;
|
|
91
|
+
const files = (await this.connectorClient.files.getOwnFiles({ expiresAt: datesInFuture })).result;
|
|
89
92
|
if (files.length === 0) {
|
|
90
|
-
console.log("No files found");
|
|
93
|
+
console.log("No appropriate files found");
|
|
91
94
|
return;
|
|
92
95
|
}
|
|
93
96
|
return files.map((f) => this.renderFile(f));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
import prompts from "prompts";
|
|
3
3
|
export function AddAcceptPendingRelationships(Base) {
|
|
4
4
|
return class AcceptPendingRelationships extends Base {
|
|
@@ -15,7 +15,7 @@ export function AddAcceptPendingRelationships(Base) {
|
|
|
15
15
|
if (result.sync) {
|
|
16
16
|
await this.connectorClient.account.sync();
|
|
17
17
|
}
|
|
18
|
-
const pendingRelationships = (await this.connectorClient.relationships.getRelationships({ status:
|
|
18
|
+
const pendingRelationships = (await this.connectorClient.relationships.getRelationships({ status: RelationshipStatus.Pending })).result;
|
|
19
19
|
for (const relationship of pendingRelationships) {
|
|
20
20
|
console.log(`Accepting relationship ${relationship.id}`);
|
|
21
21
|
await this.connectorClient.relationships.acceptRelationship(relationship.id);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocalRequestStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import prompts from "prompts";
|
|
4
4
|
export function AddAcceptPendingRequests(Base) {
|
|
@@ -16,9 +16,7 @@ export function AddAcceptPendingRequests(Base) {
|
|
|
16
16
|
if (result.sync) {
|
|
17
17
|
await this.connectorClient.account.sync();
|
|
18
18
|
}
|
|
19
|
-
const pendingRequests = (await this.connectorClient.incomingRequests.getRequests({
|
|
20
|
-
status: ConnectorRequestStatus.ManualDecisionRequired,
|
|
21
|
-
})).result;
|
|
19
|
+
const pendingRequests = (await this.connectorClient.incomingRequests.getRequests({ status: LocalRequestStatus.ManualDecisionRequired })).result;
|
|
22
20
|
for (const request of pendingRequests) {
|
|
23
21
|
const title = request.content.title ? `title ${request.content.title}` : "no title";
|
|
24
22
|
console.log(`Trying to accept request ${request.id} with ${title}...`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
export function AddDecomposeRelationship(Base) {
|
|
3
3
|
return class DecomposeRelationship extends Base {
|
|
4
4
|
constructor(...args) {
|
|
@@ -7,7 +7,7 @@ export function AddDecomposeRelationship(Base) {
|
|
|
7
7
|
}
|
|
8
8
|
async decomposeRelationship() {
|
|
9
9
|
await this.connectorClient.account.sync();
|
|
10
|
-
const relationship = await this.selectRelationship("Select relationship to decompose",
|
|
10
|
+
const relationship = await this.selectRelationship("Select relationship to decompose", RelationshipStatus.Terminated, RelationshipStatus.DeletionProposed);
|
|
11
11
|
if (!relationship)
|
|
12
12
|
return;
|
|
13
13
|
console.log(`Decomposing relationship ${relationship.id}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
export function AddGetAttributesOfRelationship(Base) {
|
|
3
3
|
return class GetAttributesOfRelationship extends Base {
|
|
4
4
|
constructor(...args) {
|
|
@@ -6,7 +6,7 @@ export function AddGetAttributesOfRelationship(Base) {
|
|
|
6
6
|
this.choices.push({ title: "Get Attributes Of Relationship", value: this.getAttributesOfRelationship });
|
|
7
7
|
}
|
|
8
8
|
async getAttributesOfRelationship() {
|
|
9
|
-
const relationship = await this.selectRelationship("From which relationship do you want to get the attributes?",
|
|
9
|
+
const relationship = await this.selectRelationship("From which relationship do you want to get the attributes?", RelationshipStatus.Active, RelationshipStatus.Pending, RelationshipStatus.Terminated, RelationshipStatus.DeletionProposed);
|
|
10
10
|
if (!relationship)
|
|
11
11
|
return console.log("No recipient selected");
|
|
12
12
|
const attributeResult = await this.connectorClient.relationships.getAttributesForRelationship(relationship.id);
|
|
@@ -12,7 +12,7 @@ export function AddSendRequestByMessage(Base) {
|
|
|
12
12
|
return console.log("No recipient selected");
|
|
13
13
|
const peer = recipient.peer;
|
|
14
14
|
const requestItems = [];
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
16
16
|
while (true) {
|
|
17
17
|
const whatRequest = await prompts({
|
|
18
18
|
message: "What kind of request do you want to send?",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
export function AddTerminateRelationship(Base) {
|
|
3
3
|
return class TerminateRelationship extends Base {
|
|
4
4
|
constructor(...args) {
|
|
@@ -7,7 +7,7 @@ export function AddTerminateRelationship(Base) {
|
|
|
7
7
|
}
|
|
8
8
|
async terminateRelationship() {
|
|
9
9
|
await this.connectorClient.account.sync();
|
|
10
|
-
const relationship = await this.selectRelationship("Select relationship to terminate",
|
|
10
|
+
const relationship = await this.selectRelationship("Select relationship to terminate", RelationshipStatus.Active);
|
|
11
11
|
if (!relationship)
|
|
12
12
|
return;
|
|
13
13
|
console.log(`Terminating relationship ${relationship.id}`);
|
package/package.json
CHANGED
|
@@ -28,34 +28,34 @@
|
|
|
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": "^6.
|
|
32
|
-
"axios": "^1.
|
|
31
|
+
"@nmshd/connector-sdk": "^6.35.0",
|
|
32
|
+
"axios": "^1.10.0",
|
|
33
33
|
"chalk": "^5.4.1",
|
|
34
|
-
"dotenv": "^
|
|
35
|
-
"luxon": "^3.
|
|
34
|
+
"dotenv": "^17.2.0",
|
|
35
|
+
"luxon": "^3.7.1",
|
|
36
36
|
"prompts": "^2.4.2",
|
|
37
37
|
"qrcode-terminal": "^0.12.0",
|
|
38
38
|
"yargs": "^18.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@js-soft/eslint-config-ts": "^
|
|
41
|
+
"@js-soft/eslint-config-ts": "^2.0.1",
|
|
42
42
|
"@js-soft/license-check": "^1.0.9",
|
|
43
43
|
"@types/luxon": "^3.6.2",
|
|
44
|
-
"@types/node": "^22.
|
|
44
|
+
"@types/node": "^22.16.4",
|
|
45
45
|
"@types/prompts": "^2.4.9",
|
|
46
46
|
"@types/qrcode-terminal": "^0.12.2",
|
|
47
47
|
"@types/yargs": "^17.0.33",
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"prettier": "^3.
|
|
48
|
+
"eslint": "^9.31.0",
|
|
49
|
+
"prettier": "^3.6.2",
|
|
50
50
|
"ts-node": "^10.9.2",
|
|
51
51
|
"typescript": "^5.8.3"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=22.
|
|
54
|
+
"node": ">=22.17.1"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|
|
58
58
|
"provenance": true
|
|
59
59
|
},
|
|
60
|
-
"version": "2.13.
|
|
60
|
+
"version": "2.13.2"
|
|
61
61
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// custom type definitions because `tsc` does not support private and protected members for anonymous classes
|
|
2
2
|
export declare class ConnectorTUI {
|
|
3
|
-
static create(baseUrl: string, apiKey: string): Promise<ConnectorTUI>
|
|
4
|
-
run(): Promise<void>
|
|
3
|
+
public static create(baseUrl: string, apiKey: string): Promise<ConnectorTUI>
|
|
4
|
+
public run(): Promise<void>
|
|
5
5
|
}
|