@nmshd/connector-tui 2.2.1 → 2.2.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.
@@ -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.checkConnectorVersion();
15
+ const connectorVersionInfo = await this.#checkConnectorVersion();
16
16
  if (!connectorVersionInfo)
17
17
  return;
18
- await this.showStartupMessage(connectorVersionInfo);
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
- #!/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();
1
+ export { ConnectorTUI } from "./ConnectorTUI.js";
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.2.1",
3
+ "version": "2.2.2",
4
4
  "repository": "github:nmshd/connector-tui",
5
5
  "license": "MIT",
6
6
  "author": "j&s-soft GmbH",
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/index.js",
11
- "connector_tui": "dist/index.js",
12
- "ctui": "dist/index.js"
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",
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ // custom type definitions because `tsc` does not support private and protected members for anonymous classes
2
+ export declare class ConnectorTUI {
3
+ static create(baseUrl: string, apiKey: string): Promise<ConnectorTUI>
4
+ run(): Promise<void>
5
+ }