From aefbf3d455ca5c535e8458b4b2e2837b37027a5e Mon Sep 17 00:00:00 2001 From: Javier Sierra Date: Mon, 20 Nov 2023 13:14:44 +0100 Subject: [PATCH] feat: add inquirer checkbox validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes  #31 --- package-lock.json | 120 ++++++++++++++++---------------- package.json | 2 +- src/services/user-flow-steps.js | 2 +- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6c5b8d..adb8e59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "license": "MIT", "dependencies": { - "@inquirer/prompts": "^3.1.2", + "@inquirer/prompts": "^3.3.0", "@os3/open-api-mocker": "^2.1.0", "commander": "^11.1.0" }, @@ -770,11 +770,11 @@ "peer": true }, "node_modules/@inquirer/checkbox": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.4.0.tgz", - "integrity": "sha512-7YcekwCvMTjrgjUursrH6AGZUSPw7gKPMvp0VhM3iq9mL46a7AeCfOTQTW0UPeiIfWmZK8wHyAD6wIhfDyLHpw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.5.0.tgz", + "integrity": "sha512-3cKJkW1vIZAs4NaS0reFsnpAjP0azffYII4I2R7PTI7ZTMg5Y1at4vzXccOH3762b2c2L4drBhpJpf9uiaGNxA==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", @@ -785,11 +785,11 @@ } }, "node_modules/@inquirer/confirm": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-2.0.14.tgz", - "integrity": "sha512-Elzo5VX5lO1q9xy8CChDtDQNVLaucufdZBAM12qdfX1L3NQ+TypnZytGmWDXHBTpBTwuhEuwxNvUw7B0HCURkw==", + "version": "2.0.15", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-2.0.15.tgz", + "integrity": "sha512-hj8Q/z7sQXsF0DSpLQZVDhWYGN6KLM/gNjjqGkpKwBzljbQofGjn0ueHADy4HUY+OqDHmXuwk/bY+tZyIuuB0w==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "chalk": "^4.1.2" }, @@ -798,13 +798,13 @@ } }, "node_modules/@inquirer/core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-5.1.0.tgz", - "integrity": "sha512-EVnific72BhMOMo8mElvrYhGFWJZ73X6j0I+fITIPTsdAz6Z9A3w3csKy+XaH87/5QAEIQHR7RSCVXvQpIqNdQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-5.1.1.tgz", + "integrity": "sha512-IuJyZQUg75+L5AmopgnzxYrgcU6PJKL0hoIs332G1Gv55CnmZrhG6BzNOeZ5sOsTi1YCGOopw4rYICv74ejMFg==", "dependencies": { "@inquirer/type": "^1.1.5", - "@types/mute-stream": "^0.0.2", - "@types/node": "^20.8.2", + "@types/mute-stream": "^0.0.4", + "@types/node": "^20.9.0", "@types/wrap-ansi": "^3.0.0", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", @@ -822,19 +822,19 @@ } }, "node_modules/@inquirer/core/node_modules/@types/node": { - "version": "20.8.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.6.tgz", - "integrity": "sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ==", + "version": "20.9.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz", + "integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==", "dependencies": { - "undici-types": "~5.25.1" + "undici-types": "~5.26.4" } }, "node_modules/@inquirer/editor": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.12.tgz", - "integrity": "sha512-Y7zXQqcglPbbPkx0DPwx6HQFstJR5uex4hoQprjpdxSj8+Bf04+Og6mK/FNxoQbPvoNecegtmMGxDC+hVcMJZA==", + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.13.tgz", + "integrity": "sha512-gBxjqt0B9GLN0j6M/tkEcmcIvB2fo9Cw0f5NRqDTkYyB9AaCzj7qvgG0onQ3GVPbMyMbbP4tWYxrBOaOdKpzNA==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "chalk": "^4.1.2", "external-editor": "^3.1.0" @@ -844,11 +844,11 @@ } }, "node_modules/@inquirer/expand": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.13.tgz", - "integrity": "sha512-/+7CGCa7iyJIpli0NtukEAjSI7+wGgjYzsByLVSSAk3U696ZlCCP6iPtsWx6d1qfmaMmCzejcjylOj6OAeu4bA==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.14.tgz", + "integrity": "sha512-yS6fJ8jZYAsxdxuw2c8XTFMTvMR1NxZAw3LxDaFnqh7BZ++wTQ6rSp/2gGJhMacdZ85osb+tHxjVgx7F+ilv5g==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "chalk": "^4.1.2", "figures": "^3.2.0" @@ -858,11 +858,11 @@ } }, "node_modules/@inquirer/input": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.13.tgz", - "integrity": "sha512-gALuvSpZRYfqygPjlYWodMZ4TXwALvw7Pk4tRFhE1oMN79rLVlg88Z/X6JCUh+uV2qLaxxgbeP+cgPWTvuWsCg==", + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.14.tgz", + "integrity": "sha512-tISLGpUKXixIQue7jypNEShrdzJoLvEvZOJ4QRsw5XTfrIYfoWFqAjMQLerGs9CzR86yAI89JR6snHmKwnNddw==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "chalk": "^4.1.2" }, @@ -871,11 +871,11 @@ } }, "node_modules/@inquirer/password": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.13.tgz", - "integrity": "sha512-6STGbL4Vm6ohE2yDBOSENCpCeywnvPux5psZVpvblGDop1oPiZkdsVI+NhsA0c4BE6YT0fNVK8Oqxf5Dgt5k7g==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.14.tgz", + "integrity": "sha512-vL2BFxfMo8EvuGuZYlryiyAB3XsgtbxOcFs4H9WI9szAS/VZCAwdVqs8rqEeaAf/GV/eZOghIOYxvD91IsRWSg==", "dependencies": { - "@inquirer/input": "^1.2.13", + "@inquirer/input": "^1.2.14", "@inquirer/type": "^1.1.5", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2" @@ -885,30 +885,30 @@ } }, "node_modules/@inquirer/prompts": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-3.2.0.tgz", - "integrity": "sha512-sfT7eDoveChXr8iIfwUYkoVBjUcKqXluhjM0EVhRhN59ZuJCc5DAdnuKwaFXomwESDoN0f+2zHy+MpxUg+EZuQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-3.3.0.tgz", + "integrity": "sha512-BBCqdSnhNs+WziSIo4f/RNDu6HAj4R/Q5nMgJb5MNPFX8sJGCvj9BoALdmR0HTWXyDS7TO8euKj6W6vtqCQG7A==", "dependencies": { - "@inquirer/checkbox": "^1.4.0", - "@inquirer/confirm": "^2.0.14", - "@inquirer/core": "^5.1.0", - "@inquirer/editor": "^1.2.12", - "@inquirer/expand": "^1.1.13", - "@inquirer/input": "^1.2.13", - "@inquirer/password": "^1.1.13", - "@inquirer/rawlist": "^1.2.13", - "@inquirer/select": "^1.3.0" + "@inquirer/checkbox": "^1.5.0", + "@inquirer/confirm": "^2.0.15", + "@inquirer/core": "^5.1.1", + "@inquirer/editor": "^1.2.13", + "@inquirer/expand": "^1.1.14", + "@inquirer/input": "^1.2.14", + "@inquirer/password": "^1.1.14", + "@inquirer/rawlist": "^1.2.14", + "@inquirer/select": "^1.3.1" }, "engines": { "node": ">=14.18.0" } }, "node_modules/@inquirer/rawlist": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.13.tgz", - "integrity": "sha512-f+bASrCY2x2F90MrBYX7nUSetL6FsVLfskhGWEyVwj6VIXzc9T878z3v7KU3V10D1trWrCVHOdeqEcbnO68yhg==", + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.14.tgz", + "integrity": "sha512-xIYmDpYgfz2XGCKubSDLKEvadkIZAKbehHdWF082AyC2I4eHK44RUfXaoOAqnbqItZq4KHXS6jDJ78F2BmQvxg==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "chalk": "^4.1.2" }, @@ -917,11 +917,11 @@ } }, "node_modules/@inquirer/select": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.3.0.tgz", - "integrity": "sha512-3sL5odCDYI+i+piAFqFa5ULDUKEpc0U1zEY4Wm6gjP6nMAHWM8r1UzMlpQXCyHny91Tz+oeSLeKinAde0z6R7w==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.3.1.tgz", + "integrity": "sha512-EgOPHv7XOHEqiBwBJTyiMg9r57ySyW4oyYCumGp+pGyOaXQaLb2kTnccWI6NFd9HSi5kDJhF7YjA+3RfMQJ2JQ==", "dependencies": { - "@inquirer/core": "^5.1.0", + "@inquirer/core": "^5.1.1", "@inquirer/type": "^1.1.5", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", @@ -2151,9 +2151,9 @@ "dev": true }, "node_modules/@types/mute-stream": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.2.tgz", - "integrity": "sha512-FpiGjk6+IOrN0lZEfUUjdra1csU1VxwYFj4S0Zj+TJpu5x5mZW30RkEZojTadrNZHNmpCHgoE62IQZAH0OeuIA==", + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz", + "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==", "dependencies": { "@types/node": "*" } @@ -14634,9 +14634,9 @@ } }, "node_modules/undici-types": { - "version": "5.25.3", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", - "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==" + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unique-string": { "version": "3.0.0", diff --git a/package.json b/package.json index 75b6cce..c9c3ff6 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "author": "", "license": "MIT", "dependencies": { - "@inquirer/prompts": "^3.1.2", + "@inquirer/prompts": "^3.3.0", "@os3/open-api-mocker": "^2.1.0", "commander": "^11.1.0" }, diff --git a/src/services/user-flow-steps.js b/src/services/user-flow-steps.js index 714b315..a7881b1 100644 --- a/src/services/user-flow-steps.js +++ b/src/services/user-flow-steps.js @@ -88,7 +88,7 @@ async function init({ origin, schemaPaths, ports } = {}) { choices: schemas.map((schema) => { return { value: schema.filePath }; }), - // TODO: pending validation to ensure that at least one schema is selected. Waiting next inquirer release. + required: true, }); const selectedSchemas = ports?.length ? assignPorts(schemasToMock, ports) : await askForPorts(schemasToMock);