@nmshd/connector-tui 2.2.1 → 2.3.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 +1 -1
- package/dist/ConnectorTUI.js +4 -4
- package/dist/index.js +1 -25
- package/dist/mixins/AddSendRequestByMessage.js +19 -0
- package/dist/run.js +25 -0
- package/package.json +11 -9
- package/src/index.d.ts +5 -0
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
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
|
|
package/dist/ConnectorTUI.js
CHANGED
|
@@ -12,10 +12,10 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
|
12
12
|
return new ConnectorTUI(client, address, support);
|
|
13
13
|
}
|
|
14
14
|
async run() {
|
|
15
|
-
const connectorVersionInfo = await this
|
|
15
|
+
const connectorVersionInfo = await this.#checkConnectorVersion();
|
|
16
16
|
if (!connectorVersionInfo)
|
|
17
17
|
return;
|
|
18
|
-
await this
|
|
18
|
+
await this.#showStartupMessage(connectorVersionInfo);
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition
|
|
20
20
|
while (true) {
|
|
21
21
|
const activeIdentityDeletionProcess = this.isDebugMode() ? await this.identityDeletionProcessEndpoint.getActiveIdentityDeletionProcess() : undefined;
|
|
@@ -42,7 +42,7 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
async checkConnectorVersion() {
|
|
45
|
+
async #checkConnectorVersion() {
|
|
46
46
|
const connectorVersionInfo = await this.connectorClient.monitoring.getVersion();
|
|
47
47
|
// allow connector in debugging mode to be used
|
|
48
48
|
if (connectorVersionInfo.version === "{{version}}")
|
|
@@ -53,7 +53,7 @@ export class ConnectorTUI extends ConnectorTUIBaseWithMixins {
|
|
|
53
53
|
}
|
|
54
54
|
return connectorVersionInfo;
|
|
55
55
|
}
|
|
56
|
-
async showStartupMessage(connectorVersionInfo) {
|
|
56
|
+
async #showStartupMessage(connectorVersionInfo) {
|
|
57
57
|
const jsonString = (await readFile(new URL("../package.json", import.meta.url))).toString();
|
|
58
58
|
const packageJson = JSON.parse(jsonString);
|
|
59
59
|
const baseUrl = this.support.configuration.transportLibrary?.baseUrl;
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import dotenv from "dotenv";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import yargs from "yargs";
|
|
6
|
-
import { hideBin } from "yargs/helpers";
|
|
7
|
-
import { ConnectorTUI } from "./ConnectorTUI.js";
|
|
8
|
-
const argv = await yargs(hideBin(process.argv))
|
|
9
|
-
.option("env", {
|
|
10
|
-
alias: "e",
|
|
11
|
-
description: "location of the env file relative to cwd",
|
|
12
|
-
type: "string",
|
|
13
|
-
default: ".env",
|
|
14
|
-
})
|
|
15
|
-
.help()
|
|
16
|
-
.alias("help", "h").argv;
|
|
17
|
-
dotenv.config({ path: path.resolve(process.cwd(), argv.env) });
|
|
18
|
-
if (typeof process.env.BASE_URL === "undefined" || typeof process.env.API_KEY === "undefined") {
|
|
19
|
-
console.log(chalk.red("Please provide a BASE_URL and API_KEY in your .env file or as environment variables."));
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
const baseUrl = process.env.BASE_URL;
|
|
23
|
-
const apiKey = process.env.API_KEY;
|
|
24
|
-
const tui = await ConnectorTUI.create(baseUrl, apiKey);
|
|
25
|
-
await tui.run();
|
|
1
|
+
export { ConnectorTUI } from "./ConnectorTUI.js";
|
|
@@ -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",
|
|
@@ -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
|
}
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import dotenv from "dotenv";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import yargs from "yargs";
|
|
6
|
+
import { hideBin } from "yargs/helpers";
|
|
7
|
+
import { ConnectorTUI } from "./ConnectorTUI.js";
|
|
8
|
+
const argv = await yargs(hideBin(process.argv))
|
|
9
|
+
.option("env", {
|
|
10
|
+
alias: "e",
|
|
11
|
+
description: "location of the env file relative to cwd",
|
|
12
|
+
type: "string",
|
|
13
|
+
default: ".env",
|
|
14
|
+
})
|
|
15
|
+
.help()
|
|
16
|
+
.alias("help", "h").argv;
|
|
17
|
+
dotenv.config({ path: path.resolve(process.cwd(), argv.env) });
|
|
18
|
+
if (typeof process.env.BASE_URL === "undefined" || typeof process.env.API_KEY === "undefined") {
|
|
19
|
+
console.log(chalk.red("Please provide a BASE_URL and API_KEY in your .env file or as environment variables."));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const baseUrl = process.env.BASE_URL;
|
|
23
|
+
const apiKey = process.env.API_KEY;
|
|
24
|
+
const tui = await ConnectorTUI.create(baseUrl, apiKey);
|
|
25
|
+
await tui.run();
|
package/package.json
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmshd/connector-tui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"repository": "github:nmshd/connector-tui",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "j&s-soft
|
|
6
|
+
"author": "j&s-soft AG",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "index.js",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "src/index.d.ts",
|
|
9
10
|
"bin": {
|
|
10
|
-
"connector-tui": "dist/
|
|
11
|
-
"connector_tui": "dist/
|
|
12
|
-
"ctui": "dist/
|
|
11
|
+
"connector-tui": "dist/run.js",
|
|
12
|
+
"connector_tui": "dist/run.js",
|
|
13
|
+
"ctui": "dist/run.js"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"dist",
|
|
16
17
|
"__assets__",
|
|
17
|
-
".env.example"
|
|
18
|
+
".env.example",
|
|
19
|
+
"src/index.d.ts"
|
|
18
20
|
],
|
|
19
21
|
"scripts": {
|
|
20
22
|
"build": "tsc",
|
|
@@ -22,9 +24,9 @@
|
|
|
22
24
|
"lint:tsc": "tsc --noEmit",
|
|
23
25
|
"lint:eslint": "eslint --ext .ts ./src",
|
|
24
26
|
"lint:prettier": "prettier --check ./src",
|
|
25
|
-
"start": "node --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/
|
|
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",
|
|
26
28
|
"test": "echo 'no test specified'",
|
|
27
|
-
"watch": "node --watch --import 'data:text/javascript,import { register } from \"node:module\"; import { pathToFileURL } from \"node:url\"; register(\"ts-node/esm\", pathToFileURL(\"./\"));' src/
|
|
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"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
32
|
"@nmshd/connector-sdk": "^6.14.5",
|
package/src/index.d.ts
ADDED