apiblaze 0.21.0 → 0.21.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/dist/index.js +4 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1291,7 +1291,7 @@ var import_commander = require("commander");
|
|
|
1291
1291
|
var import_chalk57 = __toESM(require("chalk"));
|
|
1292
1292
|
|
|
1293
1293
|
// package.json
|
|
1294
|
-
var version = "0.21.
|
|
1294
|
+
var version = "0.21.1";
|
|
1295
1295
|
|
|
1296
1296
|
// src/index.ts
|
|
1297
1297
|
init_types();
|
|
@@ -4959,12 +4959,12 @@ function afterDash(sentence) {
|
|
|
4959
4959
|
}
|
|
4960
4960
|
async function pickFamilies(families, opts = {}) {
|
|
4961
4961
|
const { default: inquirer3 } = await import("inquirer");
|
|
4962
|
-
console.log(import_chalk16.default.dim("
|
|
4962
|
+
console.log(import_chalk16.default.dim(" Uncheck everything to skip."));
|
|
4963
4963
|
const short = opts.compact && families.filter((f) => !f.skipped_reason).length <= 3;
|
|
4964
4964
|
const { picked } = await inquirer3.prompt([{
|
|
4965
4965
|
type: "checkbox",
|
|
4966
4966
|
name: "picked",
|
|
4967
|
-
message: "
|
|
4967
|
+
message: "Should only creators of a resource in the API be able to amend that resource?",
|
|
4968
4968
|
pageSize: 15,
|
|
4969
4969
|
choices: families.map((f) => {
|
|
4970
4970
|
const key = short ? lastSegment(f.key) : f.key.replace(/^\//, "");
|
|
@@ -4974,7 +4974,7 @@ async function pickFamilies(families, opts = {}) {
|
|
|
4974
4974
|
return picked ?? [];
|
|
4975
4975
|
}
|
|
4976
4976
|
async function chooseSecure(args) {
|
|
4977
|
-
const { openapi,
|
|
4977
|
+
const { openapi, name, interactive, quiet, compact } = args;
|
|
4978
4978
|
const say = (s) => {
|
|
4979
4979
|
if (!quiet) console.log(s);
|
|
4980
4980
|
};
|
|
@@ -4982,20 +4982,6 @@ async function chooseSecure(args) {
|
|
|
4982
4982
|
say(import_chalk16.default.dim(` No OpenAPI spec \u2014 nothing to protect yet. Run \`${B.cli} rule ${name}\` after you add one.`));
|
|
4983
4983
|
return null;
|
|
4984
4984
|
}
|
|
4985
|
-
if (interactive) {
|
|
4986
|
-
const { default: inquirer3 } = await import("inquirer");
|
|
4987
|
-
const { lock } = await inquirer3.prompt([{
|
|
4988
|
-
type: "confirm",
|
|
4989
|
-
name: "lock",
|
|
4990
|
-
message: "Do you want to prevent unauthorized users from taking unauthorized actions?",
|
|
4991
|
-
default: true
|
|
4992
|
-
}]);
|
|
4993
|
-
if (lock && auth.doors.includes("api_key")) {
|
|
4994
|
-
console.log(import_chalk16.default.dim(" Behind the API key, the rules check who is calling: your server says so with X-End-User-Id,"));
|
|
4995
|
-
console.log(import_chalk16.default.dim(` or the key itself is issued to a person (${B.cli} apikeys mint --for).`));
|
|
4996
|
-
}
|
|
4997
|
-
if (!lock) return null;
|
|
4998
|
-
}
|
|
4999
4985
|
const spinner = quiet ? null : (0, import_ora6.default)("Reading your OpenAPI spec\u2026").start();
|
|
5000
4986
|
const { status, data } = await proposeFromSpec(openapi).catch((err) => ({ status: 0, data: { error: err.message } }));
|
|
5001
4987
|
if (status !== 200 || !data || !Array.isArray(data.families)) {
|