@nmshd/connector-tui 0.0.1-beta.1

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/.env.example ADDED
@@ -0,0 +1,3 @@
1
+ BASE_URL=
2
+ API_KEY=
3
+ CONNECTOR_DISPLAY_NAME=
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2021 j&s-soft GmbH
2
+
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
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Connector TUI
2
+
3
+ > A terminal user interface for Demos.
4
+ >
5
+ > Showcase how to integrate Enmeshed and use the SDK.
6
+ >
7
+ > This TUI only works with Enmeshed v2 (Connector version 3.0.0+)
8
+
9
+ ## Installation
10
+
11
+ Create a `.env` file in the folder you want to execute the TUI from and fill in the values:
12
+
13
+ ```txt
14
+ BASE_URL=
15
+ API_KEY=
16
+ CONNECTOR_DISPLAY_NAME=
17
+ ```
18
+
19
+ If you want to execute this TUI as a package you can install it using `npm i -g @nmshd/connector-tui@beta` and run `connector_tui` or simply run `npx @nmshd/connector-tui@beta`.
20
+
21
+ ## Run Local / Dev Time
22
+
23
+ 1. (only for the first time) `npm install` and copy `.env.example` to `.env` and fill in the values.
24
+ 2. `npm start`
Binary file
Binary file
@@ -0,0 +1 @@
1
+ upload
@@ -0,0 +1,21 @@
1
+ import { ConnectorRelationshipStatus } from "@nmshd/connector-sdk";
2
+ import prompts from "prompts";
3
+ import { CONNECTOR_CLIENT } from "./globals";
4
+ function acceptRelationship(r) {
5
+ console.log(`Accepting relationship ${r.id}`);
6
+ return CONNECTOR_CLIENT.relationships.acceptRelationshipChange(r.id, r.changes[0].id);
7
+ }
8
+ export async function acceptPendingRelationships() {
9
+ const result = await prompts({
10
+ message: "Do you want to sync before accepting pending relationships?",
11
+ type: "confirm",
12
+ name: "sync",
13
+ });
14
+ if (result.sync) {
15
+ await CONNECTOR_CLIENT.account.sync();
16
+ }
17
+ const pendingRelationships = (await CONNECTOR_CLIENT.relationships.getRelationships({
18
+ status: ConnectorRelationshipStatus.PENDING,
19
+ })).result;
20
+ await Promise.all(pendingRelationships.map(acceptRelationship));
21
+ }
@@ -0,0 +1,10 @@
1
+ import { CONNECTOR_CLIENT } from "./globals";
2
+ import { selectRelationship } from "./selectors";
3
+ export async function getAttributesOfContact() {
4
+ const relationship = await selectRelationship("From which contact do you want to get the attributes?");
5
+ if (!relationship)
6
+ return console.log("No recipient selected");
7
+ const attributeResult = await CONNECTOR_CLIENT.relationships.getAttributesForRelationship(relationship.id);
8
+ const attributes = attributeResult.result.filter((a) => a.content.owner === relationship.peer);
9
+ attributes.map((attribute) => console.log(`${attribute.id}: ${attribute.content.value["@type"]} = ${attribute.content.value.value}`));
10
+ }
@@ -0,0 +1,8 @@
1
+ import { ConnectorClient } from "@nmshd/connector-sdk";
2
+ import dotenv from "dotenv";
3
+ dotenv.config();
4
+ export const CONNECTOR_CLIENT = ConnectorClient.create({
5
+ baseUrl: process.env.BASE_URL,
6
+ apiKey: process.env.API_KEY,
7
+ });
8
+ export const CONNECTOR_ADDRESS = (await CONNECTOR_CLIENT.account.getIdentityInfo()).result.address;
@@ -0,0 +1,8 @@
1
+ export { acceptPendingRelationships } from "./acceptPendingRelationships";
2
+ export { getAttributesOfContact } from "./getAttributesOfContact";
3
+ export { CONNECTOR_CLIENT } from "./globals";
4
+ export { sendMail } from "./sendMail";
5
+ export { sendRequestByMessage } from "./sendRequestByMessage";
6
+ export { shareRequestByTemplate } from "./shareRequestByTemplate";
7
+ export { sync } from "./sync";
8
+ export { uploadFile } from "./uploadFile";
@@ -0,0 +1,27 @@
1
+ import prompts from "prompts";
2
+ import { CONNECTOR_CLIENT } from "../globals";
3
+ function renderFile(file) {
4
+ return { title: file.title, value: file };
5
+ }
6
+ async function getChoices() {
7
+ const files = (await CONNECTOR_CLIENT.files.getFiles()).result;
8
+ if (files.length === 0) {
9
+ console.log("No files found");
10
+ return;
11
+ }
12
+ return files.map((f) => renderFile(f));
13
+ }
14
+ export async function selectFile(prompt) {
15
+ const choices = await getChoices();
16
+ if (!choices)
17
+ return;
18
+ const result = await prompts({ message: prompt, type: "select", name: "file", choices: choices });
19
+ return result.file;
20
+ }
21
+ export async function selectFiles(prompt) {
22
+ const choices = await getChoices();
23
+ if (!choices)
24
+ return;
25
+ const result = await prompts({ message: prompt, type: "multiselect", name: "files", choices: choices });
26
+ return result.files;
27
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./files";
2
+ export * from "./relationships";
@@ -0,0 +1,50 @@
1
+ import { ConnectorRelationshipStatus } from "@nmshd/connector-sdk";
2
+ import prompts from "prompts";
3
+ import { CONNECTOR_CLIENT } from "../globals";
4
+ async function renderRelationship(relationship, returnRelationship) {
5
+ const value = returnRelationship ? relationship : relationship.peer;
6
+ const response = await CONNECTOR_CLIENT.relationships.getAttributesForRelationship(relationship.id);
7
+ const relationshipAttributes = response.result.filter((a) => a.content.owner === relationship.peer);
8
+ const displayName = relationshipAttributes.find((a) => a.content.value["@type"] === "DisplayName");
9
+ if (displayName) {
10
+ return { title: `${relationship.peer} (${displayName.content.value.value})`, value };
11
+ }
12
+ const surname = relationshipAttributes.find((a) => a.content.value["@type"] === "Surname");
13
+ const givenName = relationshipAttributes.find((a) => a.content.value["@type"] === "GivenName");
14
+ if (surname || givenName) {
15
+ const name = `${surname?.content.value.value || ""} ${givenName?.content.value.value || ""}`.trim();
16
+ return {
17
+ title: `${relationship.peer} (${name})`,
18
+ value,
19
+ };
20
+ }
21
+ return { title: relationship.peer, value };
22
+ }
23
+ async function getChoices(status, returnRelationship) {
24
+ const relationships = (await CONNECTOR_CLIENT.relationships.getRelationships({ status })).result;
25
+ if (relationships.length === 0) {
26
+ console.log(`No relationships with status '${status}' found`);
27
+ return;
28
+ }
29
+ const choices = await Promise.all(relationships.map((r) => renderRelationship(r, returnRelationship)));
30
+ return choices;
31
+ }
32
+ export async function selectRelationship(prompt, status = ConnectorRelationshipStatus.ACTIVE) {
33
+ const choices = await getChoices(status, true);
34
+ if (!choices)
35
+ return;
36
+ const recipientsResult = await prompts({ message: prompt, type: "select", name: "recipient", choices });
37
+ return recipientsResult.recipient;
38
+ }
39
+ export async function selectRelationships(prompt, status = ConnectorRelationshipStatus.ACTIVE) {
40
+ const choices = await getChoices(status, false);
41
+ if (!choices)
42
+ return;
43
+ const recipientsResult = await prompts({ message: prompt, type: "multiselect", name: "recipients", choices });
44
+ const recipients = recipientsResult.recipients;
45
+ if (!recipients || recipients.length === 0) {
46
+ console.log("No recipients selected");
47
+ return;
48
+ }
49
+ return recipients;
50
+ }
@@ -0,0 +1,34 @@
1
+ import prompts from "prompts";
2
+ import { CONNECTOR_CLIENT } from "./globals";
3
+ import { selectFiles, selectRelationships } from "./selectors";
4
+ export async function sendMail() {
5
+ const recipients = await selectRelationships("Which recipient(s) do you want to send the message to?");
6
+ if (!recipients)
7
+ return;
8
+ const attachments = await selectFiles("Which file(s) do you want to send?");
9
+ const result = await prompts([
10
+ {
11
+ message: "Whats the subject?",
12
+ type: "text",
13
+ name: "subject",
14
+ initial: "A Subject",
15
+ },
16
+ {
17
+ message: "Whats the body?",
18
+ type: "text",
19
+ name: "body",
20
+ initial: "A Body",
21
+ },
22
+ ]);
23
+ const content = {
24
+ "@type": "Mail",
25
+ to: recipients,
26
+ subject: result.subject,
27
+ body: result.body,
28
+ };
29
+ const sendMessageResult = await CONNECTOR_CLIENT.messages.sendMessage({ recipients, content, attachments });
30
+ if (sendMessageResult.isError) {
31
+ return console.error("Error while sending message", sendMessageResult.error);
32
+ }
33
+ console.log(`Message sent to [${recipients.join(", ")}]`);
34
+ }
@@ -0,0 +1,186 @@
1
+ import prompts from "prompts";
2
+ import { CONNECTOR_CLIENT } from "./globals";
3
+ import { selectRelationship } from "./selectors";
4
+ export async function sendRequestByMessage() {
5
+ const recipient = await selectRelationship("Which relationship do you want to send the request to?");
6
+ if (!recipient)
7
+ return console.log("No recipient selected");
8
+ const peer = recipient.peer;
9
+ const whatRequest = await prompts({
10
+ message: "What kind of request do you want to send?",
11
+ type: "select",
12
+ name: "requestMethod",
13
+ choices: [
14
+ { title: "ReadRelationshipAttributeRequest", value: createReadRelationshipAttributeRequest },
15
+ { title: "ReadIdentityAttributeRequest", value: createReadIdentityAttributeRequest },
16
+ { title: "ProposeAttributeRequest", value: createProposeAttributeRequest },
17
+ { title: "CreateRelationshipAttributeRequest", value: createCreateRelationshipAttributeRequest },
18
+ ],
19
+ });
20
+ if (!whatRequest.requestMethod)
21
+ return console.log("No request method selected");
22
+ const response = await whatRequest.requestMethod(peer);
23
+ if (response.isError) {
24
+ return console.error("Error while creating LocalRequest", response.error);
25
+ }
26
+ const messageResult = await CONNECTOR_CLIENT.messages.sendMessage({
27
+ recipients: [peer],
28
+ content: response.result.content,
29
+ });
30
+ if (messageResult.isError) {
31
+ return console.error("Error while sending message", messageResult.error);
32
+ }
33
+ console.log(`Request sent to '${peer}'`);
34
+ }
35
+ async function createReadRelationshipAttributeRequest(peer) {
36
+ const result = await prompts([
37
+ {
38
+ message: "Whats the attribute type you would like to query?",
39
+ type: "text",
40
+ name: "attributeType",
41
+ initial: "An attribute type",
42
+ },
43
+ {
44
+ message: "Whats the key of the attribute you would like to query?",
45
+ type: "text",
46
+ name: "key",
47
+ initial: "Key of RelationshipAttribute",
48
+ },
49
+ {
50
+ message: "Whats the third party address?",
51
+ type: "text",
52
+ name: "thirdParty",
53
+ initial: "Third party address",
54
+ },
55
+ ]);
56
+ return await CONNECTOR_CLIENT.outgoingRequests.createRequest({
57
+ peer,
58
+ content: {
59
+ items: [
60
+ {
61
+ "@type": "ReadAttributeRequestItem",
62
+ mustBeAccepted: true,
63
+ query: {
64
+ "@type": "RelationshipAttributeQuery",
65
+ owner: "",
66
+ valueType: result.attributeType,
67
+ attributeCreationHints: {
68
+ title: `A ${result.attributeType} attribute`,
69
+ confidentiality: "public",
70
+ },
71
+ key: result.key,
72
+ thirdParty: result.thirdParty ? result.thirdParty : undefined,
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ });
78
+ }
79
+ async function createReadIdentityAttributeRequest(peer) {
80
+ const result = await prompts([
81
+ {
82
+ message: "Whats the attribute type you would like to query?",
83
+ type: "text",
84
+ name: "attributeType",
85
+ initial: "An attribute type",
86
+ },
87
+ ]);
88
+ return await CONNECTOR_CLIENT.outgoingRequests.createRequest({
89
+ peer,
90
+ content: {
91
+ items: [
92
+ {
93
+ "@type": "ReadAttributeRequestItem",
94
+ mustBeAccepted: true,
95
+ query: {
96
+ "@type": "IdentityAttributeQuery",
97
+ valueType: result.attributeType,
98
+ },
99
+ },
100
+ ],
101
+ },
102
+ });
103
+ }
104
+ async function createProposeAttributeRequest(peer) {
105
+ const result = await prompts([
106
+ {
107
+ message: "Whats the attribute type you would like to create?",
108
+ type: "text",
109
+ name: "attributeType",
110
+ initial: "An attribute type",
111
+ },
112
+ {
113
+ message: "Whats the value of your Attribute?",
114
+ type: "text",
115
+ name: "value",
116
+ initial: "Value",
117
+ },
118
+ ]);
119
+ return await CONNECTOR_CLIENT.outgoingRequests.createRequest({
120
+ peer,
121
+ content: {
122
+ items: [
123
+ {
124
+ "@type": "ProposeAttributeRequestItem",
125
+ mustBeAccepted: true,
126
+ query: {
127
+ "@type": "IdentityAttributeQuery",
128
+ valueType: result.attributeType,
129
+ },
130
+ attribute: {
131
+ "@type": "IdentityAttribute",
132
+ owner: "",
133
+ value: {
134
+ "@type": result.attributeType,
135
+ value: result.value,
136
+ },
137
+ },
138
+ },
139
+ ],
140
+ },
141
+ });
142
+ }
143
+ async function createCreateRelationshipAttributeRequest(peer) {
144
+ const result = await prompts([
145
+ {
146
+ message: "Whats the title of the RelationshipAttribute you would like to create?",
147
+ type: "text",
148
+ name: "title",
149
+ initial: "Title of RelationshipAttribute",
150
+ },
151
+ {
152
+ message: "Whats the key of the RelationshipAttribute you would like to create?",
153
+ type: "text",
154
+ name: "key",
155
+ initial: "Key of RelationshipAttribute",
156
+ },
157
+ {
158
+ message: "Whats the value of your Attribute?",
159
+ type: "text",
160
+ name: "value",
161
+ initial: "Value",
162
+ },
163
+ ]);
164
+ return await CONNECTOR_CLIENT.outgoingRequests.createRequest({
165
+ peer,
166
+ content: {
167
+ items: [
168
+ {
169
+ "@type": "CreateRelationshipAttributeRequestItem",
170
+ mustBeAccepted: true,
171
+ attribute: {
172
+ "@type": "RelationshipAttribute",
173
+ owner: "",
174
+ key: result.key,
175
+ confidentiality: "public",
176
+ value: {
177
+ "@type": "ProprietaryString",
178
+ value: result.value,
179
+ title: result.title,
180
+ },
181
+ },
182
+ },
183
+ ],
184
+ },
185
+ });
186
+ }
@@ -0,0 +1,102 @@
1
+ import { DateTime } from "luxon";
2
+ import qrcode from "qrcode-terminal";
3
+ import { CONNECTOR_ADDRESS, CONNECTOR_CLIENT } from "./globals";
4
+ export async function shareRequestByTemplate() {
5
+ const name = process.env.CONNECTOR_DISPLAY_NAME || "ConnectorV2 Demo";
6
+ const displayName = await getOrCreateConnectorDisplayName(name);
7
+ const request = {
8
+ items: [
9
+ {
10
+ "@type": "RequestItemGroup",
11
+ mustBeAccepted: true,
12
+ title: "Shared Attributes",
13
+ items: [
14
+ {
15
+ "@type": "ShareAttributeRequestItem",
16
+ mustBeAccepted: true,
17
+ attribute: { ...displayName.content, owner: "" },
18
+ sourceAttributeId: displayName.id,
19
+ },
20
+ ],
21
+ },
22
+ {
23
+ "@type": "RequestItemGroup",
24
+ mustBeAccepted: true,
25
+ title: "Requested Attributes",
26
+ items: [
27
+ {
28
+ "@type": "ReadAttributeRequestItem",
29
+ mustBeAccepted: true,
30
+ query: {
31
+ "@type": "IdentityAttributeQuery",
32
+ valueType: "Surname",
33
+ },
34
+ },
35
+ {
36
+ "@type": "ReadAttributeRequestItem",
37
+ mustBeAccepted: true,
38
+ query: {
39
+ "@type": "IdentityAttributeQuery",
40
+ valueType: "GivenName",
41
+ },
42
+ },
43
+ {
44
+ "@type": "ReadAttributeRequestItem",
45
+ mustBeAccepted: false,
46
+ query: {
47
+ "@type": "IdentityAttributeQuery",
48
+ valueType: "EMailAddress",
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ };
55
+ await createQRCodeForRelationshipTemplate(request, name);
56
+ }
57
+ async function getOrCreateConnectorDisplayName(displayName) {
58
+ const response = await CONNECTOR_CLIENT.attributes.getValidAttributes({
59
+ content: {
60
+ owner: CONNECTOR_ADDRESS,
61
+ value: {
62
+ "@type": "DisplayName",
63
+ },
64
+ },
65
+ shareInfo: {
66
+ peer: "!",
67
+ },
68
+ });
69
+ if (response.result.length > 0) {
70
+ return response.result[0];
71
+ }
72
+ const createAttributeResponse = await CONNECTOR_CLIENT.attributes.createAttribute({
73
+ content: {
74
+ "@type": "IdentityAttribute",
75
+ owner: CONNECTOR_ADDRESS,
76
+ value: {
77
+ "@type": "DisplayName",
78
+ value: displayName,
79
+ },
80
+ },
81
+ });
82
+ return createAttributeResponse.result;
83
+ }
84
+ async function createQRCodeForRelationshipTemplate(request, name) {
85
+ const templateBody = {
86
+ "@type": "RelationshipTemplateBody",
87
+ title: `Kontaktanfrage mit ${name}`,
88
+ metadata: {
89
+ webSessionId: "12345",
90
+ },
91
+ onNewRelationship: request,
92
+ };
93
+ const template = await CONNECTOR_CLIENT.relationshipTemplates.createOwnRelationshipTemplate({
94
+ content: templateBody,
95
+ expiresAt: DateTime.now().plus({ days: 2 }).toISO(),
96
+ });
97
+ const templateId = template.result.id;
98
+ const tokenResponse = await CONNECTOR_CLIENT.relationshipTemplates.createTokenForOwnRelationshipTemplate(templateId);
99
+ const url = `nmshd://qr#${tokenResponse.result.truncatedReference}`;
100
+ console.log(url);
101
+ qrcode.generate(url, { small: true });
102
+ }
@@ -0,0 +1,9 @@
1
+ import { CONNECTOR_CLIENT } from "./globals";
2
+ export async function sync() {
3
+ const syncRequest = await CONNECTOR_CLIENT.account.sync();
4
+ if (syncRequest.isError) {
5
+ console.error(syncRequest.error);
6
+ return;
7
+ }
8
+ console.log(syncRequest.result);
9
+ }
@@ -0,0 +1,43 @@
1
+ import fs from "fs";
2
+ import { DateTime } from "luxon";
3
+ import path from "path";
4
+ import qrcode from "qrcode-terminal";
5
+ import url from "url";
6
+ import { CONNECTOR_CLIENT } from "./globals";
7
+ import prompts from "prompts";
8
+ const assetFolder = path.resolve(url.fileURLToPath(new URL(".", import.meta.url)), "../../__assets__");
9
+ export async function uploadFile() {
10
+ const filenames = await fs.promises.readdir(assetFolder);
11
+ const result = await prompts([
12
+ {
13
+ message: "Which file do you want to upload?",
14
+ type: "select",
15
+ name: "filename",
16
+ choices: filenames.map((filename) => ({ title: filename, value: filename })),
17
+ },
18
+ {
19
+ message: "Whats the files title?",
20
+ type: "text",
21
+ name: "title",
22
+ initial: "aFile",
23
+ },
24
+ ]);
25
+ const title = result.title;
26
+ const expiresAt = DateTime.local().plus({ days: 1 }).toISO();
27
+ const filename = result.filename;
28
+ if (!title || !filename)
29
+ return console.log("No file / title selected");
30
+ const file = await fs.promises.readFile(path.resolve(assetFolder, filename));
31
+ const uploadedFile = await CONNECTOR_CLIENT.files.uploadOwnFile({ title, expiresAt, file, filename });
32
+ const render = await prompts({
33
+ name: "yesno",
34
+ message: "Do you want to render a QR Code for this file?",
35
+ type: "confirm",
36
+ initial: true,
37
+ });
38
+ if (render.yesno) {
39
+ const url = `nmshd://qr#${uploadedFile.result.truncatedReference}`;
40
+ console.log(url);
41
+ qrcode.generate(url, { small: true });
42
+ }
43
+ }
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ import chalk from "chalk";
2
+ import { readFile } from "fs/promises";
3
+ import prompts from "prompts";
4
+ import { acceptPendingRelationships, CONNECTOR_CLIENT, getAttributesOfContact, sendMail, sendRequestByMessage, shareRequestByTemplate, sync, uploadFile, } from "./functionality";
5
+ const connectorVersionInfo = await CONNECTOR_CLIENT.monitoring.getVersion();
6
+ if (!connectorVersionInfo.version.startsWith("3.")) {
7
+ console.log(`This TUI is made for Enmeshed V2 connectors (starting with version 3.0.0 of the connector). Current version: ${connectorVersionInfo.version}`);
8
+ process.exit(1);
9
+ }
10
+ const jsonString = (await readFile(new URL("../package.json", import.meta.url))).toString();
11
+ const packageJson = JSON.parse(jsonString);
12
+ console.log(`Welcome to the ${chalk.blue("Enmeshed V2 TUI")}!`);
13
+ console.log(`TUI Version: ${chalk.yellow(packageJson.version)}`);
14
+ console.log(`Connector version: ${chalk.yellow(connectorVersionInfo.version)}`);
15
+ console.log("");
16
+ while (true) {
17
+ const result = await prompts({
18
+ type: "select",
19
+ name: "action",
20
+ message: "What do you want to do?",
21
+ choices: [
22
+ { title: "Sync", value: sync },
23
+ { title: "Accept Pending Relationships", value: acceptPendingRelationships },
24
+ { title: "Upload File", value: uploadFile },
25
+ { title: "Send Mail", value: sendMail },
26
+ { title: "Send Request By Message", value: sendRequestByMessage },
27
+ { title: "Share Request By Template", value: shareRequestByTemplate },
28
+ { title: "Get Attributes of Contact", value: getAttributesOfContact },
29
+ { title: "Exit", value: "exit" },
30
+ ],
31
+ });
32
+ if (!result.action)
33
+ break;
34
+ if (typeof result.action === "function") {
35
+ try {
36
+ await result.action();
37
+ }
38
+ catch (error) {
39
+ console.log(chalk.red("An Error occurred: "), error);
40
+ }
41
+ }
42
+ else {
43
+ break;
44
+ }
45
+ }
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env -S node --experimental-specifier-resolution node
2
+
3
+ await import("./dist/index.js")
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nmshd/connector-tui",
3
+ "version": "0.0.1-beta.1",
4
+ "repository": "github:nmshd/connector-tui",
5
+ "license": "MIT",
6
+ "author": "j&s-soft GmbH",
7
+ "type": "module",
8
+ "main": "index.js",
9
+ "bin": {
10
+ "connector_tui": "index.js"
11
+ },
12
+ "files": [
13
+ "index.js",
14
+ "dist",
15
+ "__assets__",
16
+ ".env.example"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "start": "clear && ts-node --esm --experimental-specifier-resolution node ./src/index.ts",
21
+ "test": "echo 'no test specified'"
22
+ },
23
+ "dependencies": {
24
+ "@nmshd/connector-sdk": "^2.0.0-beta.7",
25
+ "chalk": "^5.0.1",
26
+ "dotenv": "^16.0.2",
27
+ "luxon": "^3.0.3",
28
+ "prompts": "^2.4.2",
29
+ "qrcode-terminal": "^0.12.0"
30
+ },
31
+ "devDependencies": {
32
+ "@js-soft/license-check": "^1.0.5",
33
+ "@types/luxon": "^3.0.1",
34
+ "@types/node": "^18.7.15",
35
+ "@types/prompts": "^2.0.14",
36
+ "@types/qrcode-terminal": "^0.12.0",
37
+ "ts-node": "^10.9.1",
38
+ "typescript": "^4.8.2"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }