@redocly/cli 2.37.0 → 2.38.0

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/lib/index.js CHANGED
@@ -6,12 +6,10 @@ import {
6
6
  ulid
7
7
  } from "./chunks/ICAVAH7N.js";
8
8
  import {
9
- AbortFlowError,
10
9
  capitalize,
11
10
  cleanColors,
12
11
  dumpBundle,
13
12
  escapeLanguageName,
14
- exitWithError,
15
13
  formatPath,
16
14
  getAliasOrPath,
17
15
  getAndValidateFileExtension,
@@ -30,7 +28,11 @@ import {
30
28
  saveBundle,
31
29
  sortTopLevelKeys,
32
30
  writeToFileByExtension
33
- } from "./chunks/4UQ4YHWW.js";
31
+ } from "./chunks/QUMOPKXU.js";
32
+ import {
33
+ AbortFlowError,
34
+ exitWithError
35
+ } from "./chunks/FL4Q7PMA.js";
34
36
  import {
35
37
  RedoclyOAuthClient,
36
38
  ReuniteApi,
@@ -39,26 +41,29 @@ import {
39
41
  getDomain,
40
42
  getProxyUrl,
41
43
  getReuniteUrl,
42
- require_undici,
43
44
  shouldBypassProxy
44
- } from "./chunks/U3LS66ZD.js";
45
+ } from "./chunks/K5FO6VRS.js";
45
46
  import {
46
47
  ANONYMOUS_ID_CACHE_FILE,
47
48
  DEFAULT_FETCH_TIMEOUT,
48
49
  OTEL_URL
49
50
  } from "./chunks/Y6DTFCLS.js";
50
- import "./chunks/YCTAWG2U.js";
51
+ import "./chunks/4FB5ZIPP.js";
51
52
  import {
52
53
  engines,
53
54
  name,
54
55
  version
55
- } from "./chunks/IVW4MILQ.js";
56
+ } from "./chunks/PIMMKQJ7.js";
57
+ import {
58
+ require_undici
59
+ } from "./chunks/XB6C62FW.js";
56
60
  import {
57
61
  RESET_ESCAPE_CODE,
58
62
  calculateTotals,
59
63
  conditionallyMaskSecrets
60
- } from "./chunks/FRVYIHIR.js";
64
+ } from "./chunks/M5T4PDSH.js";
61
65
  import "./chunks/VXIQEZPR.js";
66
+ import "./chunks/UUU33DK3.js";
62
67
  import {
63
68
  BaseResolver,
64
69
  HandledError,
@@ -109,7 +114,7 @@ import {
109
114
  white,
110
115
  xmlEscape,
111
116
  yellow
112
- } from "./chunks/CPNIO4J3.js";
117
+ } from "./chunks/MIPR6NCD.js";
113
118
  import "./chunks/Z2I5YXYN.js";
114
119
  import {
115
120
  __commonJS,
@@ -7704,7 +7709,7 @@ async function handleGenerateArazzo({
7704
7709
  config: config3
7705
7710
  };
7706
7711
  try {
7707
- const { generate } = await import("./chunks/ZHITMP73.js");
7712
+ const { generate } = await import("./chunks/EDHFTO4X.js");
7708
7713
  logger.info(gray("\n Generating Arazzo description... \n"));
7709
7714
  const generatedArazzo = await generate(options);
7710
7715
  writeFileSync2(outputFile, stringifyYaml(generatedArazzo));
@@ -9180,7 +9185,7 @@ async function handleRespect({
9180
9185
  let mtlsCerts;
9181
9186
  let harLogs;
9182
9187
  try {
9183
- const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/ZHITMP73.js");
9188
+ const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/EDHFTO4X.js");
9184
9189
  const workingDir = config3.configPath ? dirname4(config3.configPath) : process.cwd();
9185
9190
  if (argv.mtls) {
9186
9191
  mtlsCerts = resolveMtlsCertificates(argv.mtls, workingDir);
@@ -12700,7 +12705,7 @@ async function sendTelemetry({
12700
12705
  $0: _,
12701
12706
  ...args
12702
12707
  } = argv;
12703
- const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/M7TYKZDD.js");
12708
+ const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/N2TQJ4KM.js");
12704
12709
  const oauthClient = new RedoclyOAuthClient2();
12705
12710
  const reuniteUrl = getReuniteUrl(config3, args.residency);
12706
12711
  const logged_in = await oauthClient.isAuthorized(reuniteUrl);
@@ -12748,7 +12753,7 @@ async function sendTelemetry({
12748
12753
  category: "product",
12749
12754
  data: eventData
12750
12755
  });
12751
- const { otelTelemetry } = await import("./chunks/LJUXYC4S.js");
12756
+ const { otelTelemetry } = await import("./chunks/G76UYYPW.js");
12752
12757
  otelTelemetry.send(cloudEvent);
12753
12758
  } catch (err) {
12754
12759
  }
@@ -13578,7 +13583,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13578
13583
  return true;
13579
13584
  }),
13580
13585
  async (argv) => {
13581
- const { handlerBuildCommand } = await import("./chunks/QFYLVVG2.js");
13586
+ const { handlerBuildCommand } = await import("./chunks/OPV3WWWU.js");
13582
13587
  commandWrapper(handlerBuildCommand)(argv);
13583
13588
  }
13584
13589
  ).command(
@@ -13776,6 +13781,144 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13776
13781
  async (argv) => {
13777
13782
  commandWrapper(handleScorecardClassic)(argv);
13778
13783
  }
13784
+ ).command(
13785
+ "drift <traffic>",
13786
+ "Detect drift between recorded HTTP traffic and an OpenAPI description [experimental].",
13787
+ (yargs) => yargs.env("REDOCLY_CLI_DRIFT").positional("traffic", {
13788
+ describe: "Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",
13789
+ type: "string"
13790
+ }).option({
13791
+ api: {
13792
+ describe: "OpenAPI description file or folder to validate against.",
13793
+ type: "string",
13794
+ demandOption: true
13795
+ },
13796
+ "traffic-format": {
13797
+ describe: "Traffic input format.",
13798
+ choices: [
13799
+ "auto",
13800
+ "har",
13801
+ "kong",
13802
+ "nginx-json",
13803
+ "apache-json",
13804
+ "ndjson"
13805
+ ],
13806
+ default: "auto"
13807
+ },
13808
+ "report-format": {
13809
+ describe: "Output format.",
13810
+ alias: "format",
13811
+ choices: ["pretty", "json", "csv", "sarif"],
13812
+ default: "pretty"
13813
+ },
13814
+ "match-mode": {
13815
+ describe: "Endpoint matching mode (how requests are located via the description servers). Mutually exclusive with --server.",
13816
+ choices: ["strict-host", "basepath"],
13817
+ defaultDescription: "strict-host"
13818
+ },
13819
+ "ignore-cookies": {
13820
+ describe: "Ignore cookie-based checks (useful for logs exported without cookies).",
13821
+ type: "boolean",
13822
+ default: false
13823
+ },
13824
+ "max-findings": {
13825
+ describe: "Maximum findings shown in pretty output.",
13826
+ type: "number",
13827
+ default: 10
13828
+ },
13829
+ "min-severity": {
13830
+ describe: "Discard findings below this severity from the report.",
13831
+ choices: ["info", "warning", "error"],
13832
+ default: "info"
13833
+ },
13834
+ rules: {
13835
+ describe: "Comma-separated builtin rules to run.",
13836
+ type: "string"
13837
+ },
13838
+ output: {
13839
+ alias: "o",
13840
+ describe: "Write the drift report (in the format selected with --format) to this file instead of stdout.",
13841
+ type: "string"
13842
+ },
13843
+ server: {
13844
+ describe: "Server URL the traffic was captured against: only requests under it are considered, and the rest of their URL is treated as the API path. It replaces the description servers and the remaining path is matched against the description paths directly. Mutually exclusive with --match-mode.",
13845
+ type: "string"
13846
+ },
13847
+ config: { describe: "Path to the config file.", type: "string" },
13848
+ "lint-config": {
13849
+ describe: "Severity level for config file linting.",
13850
+ choices: ["warn", "error", "off"],
13851
+ default: "warn"
13852
+ }
13853
+ }),
13854
+ async (argv) => {
13855
+ const { handleDrift } = await import("./chunks/U2FUDUNT.js");
13856
+ commandWrapper(handleDrift)(argv);
13857
+ }
13858
+ ).command(
13859
+ "proxy",
13860
+ "Capture live HTTP traffic through a reverse proxy into a HAR file, optionally validating it against an OpenAPI description [experimental].",
13861
+ (yargs) => yargs.env("REDOCLY_CLI_PROXY").option({
13862
+ target: {
13863
+ describe: "Upstream base URL to forward captured requests to.",
13864
+ type: "string",
13865
+ demandOption: true
13866
+ },
13867
+ port: {
13868
+ describe: "Port the proxy listens on.",
13869
+ type: "number",
13870
+ default: 4040
13871
+ },
13872
+ host: {
13873
+ describe: "Host the proxy binds to.",
13874
+ type: "string",
13875
+ default: "127.0.0.1"
13876
+ },
13877
+ har: {
13878
+ describe: "Path to the HAR file where captured traffic is written.",
13879
+ type: "string",
13880
+ demandOption: true
13881
+ },
13882
+ api: {
13883
+ describe: "OpenAPI description file or folder to validate captured traffic against (live).",
13884
+ type: "string"
13885
+ },
13886
+ "report-format": {
13887
+ describe: "Output format for the validation report printed on shutdown.",
13888
+ alias: "format",
13889
+ choices: ["pretty", "json", "csv", "sarif"],
13890
+ default: "pretty"
13891
+ },
13892
+ "match-mode": {
13893
+ describe: "Endpoint matching mode.",
13894
+ choices: ["strict-host", "basepath"],
13895
+ default: "strict-host"
13896
+ },
13897
+ "ignore-cookies": {
13898
+ describe: "Ignore cookie-based checks.",
13899
+ type: "boolean",
13900
+ default: false
13901
+ },
13902
+ "max-findings": {
13903
+ describe: "Maximum findings shown in pretty output.",
13904
+ type: "number",
13905
+ default: 10
13906
+ },
13907
+ rules: {
13908
+ describe: "Comma-separated builtin rules to run.",
13909
+ type: "string"
13910
+ },
13911
+ config: { describe: "Path to the config file.", type: "string" },
13912
+ "lint-config": {
13913
+ describe: "Severity level for config file linting.",
13914
+ choices: ["warn", "error", "off"],
13915
+ default: "warn"
13916
+ }
13917
+ }),
13918
+ async (argv) => {
13919
+ const { handleProxy } = await import("./chunks/NPHT727D.js");
13920
+ commandWrapper(handleProxy)(argv);
13921
+ }
13779
13922
  ).completion("completion", "Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([notifyUpdateCliVersion]).strict().argv;
13780
13923
  /*! Bundled license information:
13781
13924
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/cli",
3
- "version": "2.37.0",
3
+ "version": "2.38.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",