@nmshd/connector-tui 2.14.0 → 2.15.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/ConnectorTUI.js +3 -3
- package/dist/ConnectorTUIBase.js +0 -3
- package/dist/client/ConnectorClient.js +9 -0
- package/dist/{IdentityDeletionProcessEndpoint.js → client/IdentityDeletionProcessEndpoint.js} +1 -1
- package/dist/mixins/AddIdentityDeletionProcess.js +3 -3
- package/dist/mixins/AddSendRequestByMessage.js +24 -0
- package/package.json +3 -3
package/dist/ConnectorTUI.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ConnectorClient } from "@nmshd/connector-sdk";
|
|
2
1
|
import chalk from "chalk";
|
|
3
2
|
import { readFile } from "fs/promises";
|
|
4
3
|
import { DateTime } from "luxon";
|
|
5
4
|
import prompts from "prompts";
|
|
5
|
+
import { ConnectorClient } from "./client/ConnectorClient.js";
|
|
6
6
|
import { ConnectorTUIBaseWithMixins } from "./mixins/index.js";
|
|
7
7
|
export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
8
8
|
static async create(baseUrl, apiKey) {
|
|
9
|
-
const client = ConnectorClient
|
|
9
|
+
const client = new ConnectorClient({ baseUrl, apiKey });
|
|
10
10
|
const address = (await client.account.getIdentityInfo()).result.address;
|
|
11
11
|
const support = await client.monitoring.getSupport();
|
|
12
12
|
return new ConnectorTUI(client, address, support);
|
|
@@ -18,7 +18,7 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
|
18
18
|
await this.#showStartupMessage(connectorVersionInfo);
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
20
20
|
while (true) {
|
|
21
|
-
const activeIdentityDeletionProcess = this.isDebugMode() ? await this.
|
|
21
|
+
const activeIdentityDeletionProcess = this.isDebugMode() ? await this.connectorClient.identityDeletionProcess.getActiveIdentityDeletionProcess() : undefined;
|
|
22
22
|
if (activeIdentityDeletionProcess?.isSuccess && activeIdentityDeletionProcess.result.status === "Approved") {
|
|
23
23
|
const gracePeriodEndsAtDateTime = DateTime.fromISO(activeIdentityDeletionProcess.result.gracePeriodEndsAt);
|
|
24
24
|
if (gracePeriodEndsAtDateTime.diffNow().milliseconds < 0) {
|
package/dist/ConnectorTUIBase.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { RelationshipStatus } from "@nmshd/connector-sdk";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import prompts from "prompts";
|
|
4
|
-
import { IdentityDeletionProcessEndpoint } from "./IdentityDeletionProcessEndpoint.js";
|
|
5
4
|
export class ConnectorTUIBase {
|
|
6
5
|
connectorClient;
|
|
7
6
|
connectorAddress;
|
|
8
7
|
support;
|
|
9
8
|
choices = [];
|
|
10
9
|
choicesInDeletion = [];
|
|
11
|
-
identityDeletionProcessEndpoint;
|
|
12
10
|
constructor(connectorClient, connectorAddress, support) {
|
|
13
11
|
this.connectorClient = connectorClient;
|
|
14
12
|
this.connectorAddress = connectorAddress;
|
|
15
13
|
this.support = support;
|
|
16
|
-
this.identityDeletionProcessEndpoint = new IdentityDeletionProcessEndpoint(this.connectorClient.account["httpClient"]);
|
|
17
14
|
}
|
|
18
15
|
async selectRelationship(prompt, ...status) {
|
|
19
16
|
if (status.length === 0)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConnectorClient as BaseConnectorClient } from "@nmshd/connector-sdk";
|
|
2
|
+
import { IdentityDeletionProcessEndpoint } from "./IdentityDeletionProcessEndpoint.js";
|
|
3
|
+
export class ConnectorClient extends BaseConnectorClient {
|
|
4
|
+
identityDeletionProcess;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super(config);
|
|
7
|
+
this.identityDeletionProcess = new IdentityDeletionProcessEndpoint(this.axiosInstance);
|
|
8
|
+
}
|
|
9
|
+
}
|
package/dist/{IdentityDeletionProcessEndpoint.js → client/IdentityDeletionProcessEndpoint.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Endpoint } from "@nmshd/connector-sdk
|
|
1
|
+
import { Endpoint } from "@nmshd/connector-sdk";
|
|
2
2
|
export var IdentityDeletionProcessStatus;
|
|
3
3
|
(function (IdentityDeletionProcessStatus) {
|
|
4
4
|
IdentityDeletionProcessStatus["WaitingForApproval"] = "WaitingForApproval";
|
|
@@ -13,7 +13,7 @@ export function AddIdentityDeletionProcess(Base) {
|
|
|
13
13
|
}
|
|
14
14
|
async identityDeletionProcess() {
|
|
15
15
|
const choices = [];
|
|
16
|
-
const activeIdentityDeletionProcess = await this.
|
|
16
|
+
const activeIdentityDeletionProcess = await this.connectorClient.identityDeletionProcess.getActiveIdentityDeletionProcess();
|
|
17
17
|
if (activeIdentityDeletionProcess.isSuccess) {
|
|
18
18
|
choices.push({ title: "Show IdentityDeletionProcess", value: "Show" });
|
|
19
19
|
if (activeIdentityDeletionProcess.result.status === "Approved") {
|
|
@@ -49,12 +49,12 @@ export function AddIdentityDeletionProcess(Base) {
|
|
|
49
49
|
});
|
|
50
50
|
const oneSecondInDays = 1 / (24 * 60 * 60);
|
|
51
51
|
const lengthOfGracePeriodInDays = confirmation["IdentityDeletionProcess grace period"] ? oneSecondInDays : undefined;
|
|
52
|
-
const identityDeletionProcess = (await this.
|
|
52
|
+
const identityDeletionProcess = (await this.connectorClient.identityDeletionProcess.initiateIdentityDeletionProcess(lengthOfGracePeriodInDays)).result;
|
|
53
53
|
console.log("Identity Deletion Process initiated.");
|
|
54
54
|
this.showIdentityDeletionProcesses(identityDeletionProcess);
|
|
55
55
|
}
|
|
56
56
|
async cancelIdentityDeletionProcess() {
|
|
57
|
-
const identityDeletionProcess = (await this.
|
|
57
|
+
const identityDeletionProcess = (await this.connectorClient.identityDeletionProcess.cancelIdentityDeletionProcess()).result;
|
|
58
58
|
console.log("Identity Deletion Process canceled.");
|
|
59
59
|
this.showIdentityDeletionProcesses(identityDeletionProcess);
|
|
60
60
|
}
|
|
@@ -283,6 +283,15 @@ export function AddSendRequestByMessage(Base) {
|
|
|
283
283
|
type: "text",
|
|
284
284
|
name: "valueType",
|
|
285
285
|
},
|
|
286
|
+
{
|
|
287
|
+
message: "Type in the comma separated tags the fallback attribute should have",
|
|
288
|
+
type: "text",
|
|
289
|
+
format: (value) => value
|
|
290
|
+
.split(",")
|
|
291
|
+
.map((tag) => tag.trim())
|
|
292
|
+
.filter((tag) => tag.length > 0),
|
|
293
|
+
name: "tags",
|
|
294
|
+
},
|
|
286
295
|
]);
|
|
287
296
|
const requestItem = {
|
|
288
297
|
"@type": "ReadAttributeRequestItem",
|
|
@@ -292,6 +301,7 @@ export function AddSendRequestByMessage(Base) {
|
|
|
292
301
|
queryString: result.queryString,
|
|
293
302
|
attributeCreationHints: {
|
|
294
303
|
valueType: result.valueType,
|
|
304
|
+
tags: result.tags.length > 0 ? result.tags : undefined,
|
|
295
305
|
},
|
|
296
306
|
},
|
|
297
307
|
};
|
|
@@ -403,6 +413,15 @@ export function AddSendRequestByMessage(Base) {
|
|
|
403
413
|
type: "text",
|
|
404
414
|
name: "value",
|
|
405
415
|
},
|
|
416
|
+
{
|
|
417
|
+
message: "Type in the comma separated tags your proposed attribute or created attributes should have",
|
|
418
|
+
type: "text",
|
|
419
|
+
format: (value) => value
|
|
420
|
+
.split(",")
|
|
421
|
+
.map((tag) => tag.trim())
|
|
422
|
+
.filter((tag) => tag.length > 0),
|
|
423
|
+
name: "tags",
|
|
424
|
+
},
|
|
406
425
|
]);
|
|
407
426
|
const requestItem = {
|
|
408
427
|
"@type": "ProposeAttributeRequestItem",
|
|
@@ -410,6 +429,10 @@ export function AddSendRequestByMessage(Base) {
|
|
|
410
429
|
query: {
|
|
411
430
|
"@type": "IQLQuery",
|
|
412
431
|
queryString: result.queryString,
|
|
432
|
+
attributeCreationHints: {
|
|
433
|
+
valueType: result.attributeType,
|
|
434
|
+
tags: result.tags.length > 0 ? result.tags : undefined,
|
|
435
|
+
},
|
|
413
436
|
},
|
|
414
437
|
attribute: {
|
|
415
438
|
"@type": "IdentityAttribute",
|
|
@@ -418,6 +441,7 @@ export function AddSendRequestByMessage(Base) {
|
|
|
418
441
|
"@type": result.attributeType,
|
|
419
442
|
value: result.value,
|
|
420
443
|
},
|
|
444
|
+
tags: result.tags.length > 0 ? result.tags : undefined,
|
|
421
445
|
},
|
|
422
446
|
};
|
|
423
447
|
return requestItem;
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
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.36.
|
|
31
|
+
"@nmshd/connector-sdk": "^6.36.4",
|
|
32
32
|
"axios": "^1.11.0",
|
|
33
33
|
"chalk": "^5.6.0",
|
|
34
34
|
"dotenv": "^17.2.1",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"typescript": "^5.9.2"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=22.
|
|
54
|
+
"node": ">=22.19.0"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|
|
58
58
|
"provenance": true
|
|
59
59
|
},
|
|
60
|
-
"version": "2.
|
|
60
|
+
"version": "2.15.0"
|
|
61
61
|
}
|