natureco-cli 2.23.6 → 2.23.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.23.6",
3
+ "version": "2.23.7",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -23,6 +23,7 @@
23
23
  "author": "NatureCo",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
+ "@inquirer/prompts": "^8.5.0",
26
27
  "@whiskeysockets/baileys": "^7.0.0-rc10",
27
28
  "chalk": "^4.1.2",
28
29
  "commander": "^11.1.0",
@@ -1,11 +1,32 @@
1
- let promptFn;
1
+ const { select, input, password, confirm } = require('@inquirer/prompts');
2
2
 
3
3
  module.exports = {
4
4
  async prompt(questions) {
5
- if (!promptFn) {
6
- const mod = await import('inquirer');
7
- promptFn = mod.default?.prompt || mod.default || mod.prompt;
5
+ const results = {};
6
+ for (const q of questions) {
7
+ if (q.type === 'list') {
8
+ results[q.name] = await select({
9
+ message: q.message,
10
+ choices: q.choices.map(c =>
11
+ typeof c === 'string' ? { value: c, name: c } : c
12
+ )
13
+ });
14
+ } else if (q.type === 'password') {
15
+ results[q.name] = await password({ message: q.message, mask: q.mask });
16
+ } else if (q.type === 'checkbox') {
17
+ const { checkbox } = require('@inquirer/prompts');
18
+ results[q.name] = await checkbox({
19
+ message: q.message,
20
+ choices: q.choices.map(c =>
21
+ typeof c === 'string' ? { value: c, name: c } : c
22
+ )
23
+ });
24
+ } else if (q.type === 'confirm') {
25
+ results[q.name] = await confirm({ message: q.message, default: q.default });
26
+ } else {
27
+ results[q.name] = await input({ message: q.message, default: q.default });
28
+ }
8
29
  }
9
- return promptFn(questions);
30
+ return results;
10
31
  }
11
32
  };