@redocly/cli 2.41.0 → 2.41.2

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
@@ -28,16 +28,16 @@ import {
28
28
  saveBundle,
29
29
  sortTopLevelKeys,
30
30
  writeToFileByExtension
31
- } from "./chunks/XDNYWH7V.js";
31
+ } from "./chunks/3UUTQVCJ.js";
32
32
  import {
33
33
  OPENAPI3_COMPONENT_NAMES,
34
34
  OPENAPI3_METHOD_NAMES,
35
35
  Spinner
36
- } from "./chunks/LCWGF7G6.js";
36
+ } from "./chunks/KPMZLKQG.js";
37
37
  import {
38
38
  AbortFlowError,
39
39
  exitWithError
40
- } from "./chunks/DT4UM7U4.js";
40
+ } from "./chunks/T6UZU3XM.js";
41
41
  import {
42
42
  RedoclyOAuthClient,
43
43
  ReuniteApi,
@@ -47,7 +47,7 @@ import {
47
47
  getProxyUrl,
48
48
  getReuniteUrl,
49
49
  shouldBypassProxy
50
- } from "./chunks/Q3KTKRJH.js";
50
+ } from "./chunks/ASYQPOQY.js";
51
51
  import {
52
52
  ANONYMOUS_ID_CACHE_FILE,
53
53
  DEFAULT_FETCH_TIMEOUT,
@@ -58,7 +58,7 @@ import {
58
58
  engines,
59
59
  name,
60
60
  version
61
- } from "./chunks/Z5H4OEIW.js";
61
+ } from "./chunks/GFU5KGSW.js";
62
62
  import {
63
63
  require_undici
64
64
  } from "./chunks/XB6C62FW.js";
@@ -66,7 +66,7 @@ import {
66
66
  RESET_ESCAPE_CODE,
67
67
  calculateTotals,
68
68
  conditionallyMaskSecrets
69
- } from "./chunks/6ABF7ZRJ.js";
69
+ } from "./chunks/KRMBH6JF.js";
70
70
  import "./chunks/VXIQEZPR.js";
71
71
  import "./chunks/UUU33DK3.js";
72
72
  import {
@@ -94,6 +94,7 @@ import {
94
94
  green,
95
95
  isAbsoluteUrl,
96
96
  isEmptyObject,
97
+ isGraphqlRef,
97
98
  isMappingRef,
98
99
  isNotEmptyObject,
99
100
  isPlainObject,
@@ -119,7 +120,7 @@ import {
119
120
  white,
120
121
  xmlEscape,
121
122
  yellow
122
- } from "./chunks/YK6T7IHG.js";
123
+ } from "./chunks/Z2664VV5.js";
123
124
  import "./chunks/Z2I5YXYN.js";
124
125
  import {
125
126
  __commonJS,
@@ -7714,7 +7715,7 @@ async function handleGenerateArazzo({
7714
7715
  config: config3
7715
7716
  };
7716
7717
  try {
7717
- const { generate } = await import("./chunks/VMHXZFTB.js");
7718
+ const { generate } = await import("./chunks/A3VFVVHD.js");
7718
7719
  logger.info(gray("\n Generating Arazzo description... \n"));
7719
7720
  const generatedArazzo = await generate(options);
7720
7721
  writeFileSync2(outputFile, stringifyYaml(generatedArazzo));
@@ -8396,7 +8397,7 @@ Please choose only one!`
8396
8397
  for (const document of documents) {
8397
8398
  try {
8398
8399
  const version3 = detectSpec(document.parsed);
8399
- collectSpecData?.(document.parsed);
8400
+ collectSpecData?.(document);
8400
8401
  if (version3 !== "oas3_0" && version3 !== "oas3_1" && version3 !== "oas3_2") {
8401
8402
  return exitWithError(
8402
8403
  `Only OpenAPI 3.0, 3.1, and 3.2 are supported: ${blue(document.source.absoluteRef)}.`
@@ -9071,14 +9072,14 @@ function mapJsonStep(step, workflowId, ctx) {
9071
9072
  stepId: step.stepId,
9072
9073
  workflowId,
9073
9074
  request: {
9074
- method: publicStep.request?.method || "",
9075
+ method: publicStep?.request?.method || "",
9075
9076
  url: step.response?.requestUrl || "",
9076
- headers: publicStep.request?.header || {},
9077
- body: publicStep.request?.body
9077
+ headers: publicStep?.request?.header || {},
9078
+ body: publicStep?.request?.body
9078
9079
  },
9079
9080
  response: {
9080
9081
  statusCode: step.response?.statusCode || 0,
9081
- body: publicStep.response?.body,
9082
+ body: publicStep?.response?.body,
9082
9083
  headers: step.response?.header || {},
9083
9084
  time: step.response?.time || 0,
9084
9085
  size: step.response?.responseSize
@@ -9087,7 +9088,7 @@ function mapJsonStep(step, workflowId, ctx) {
9087
9088
  ...check,
9088
9089
  status: calculateCheckStatus(check)
9089
9090
  })),
9090
- totalTimeMs: publicStep.response?.time || 0,
9091
+ totalTimeMs: publicStep?.response?.time || 0,
9091
9092
  retriesLeft: step.retriesLeft,
9092
9093
  status: calculateStepStatus(step.checks)
9093
9094
  };
@@ -9166,7 +9167,7 @@ async function handleRespect({
9166
9167
  let mtlsCerts;
9167
9168
  let harLogs;
9168
9169
  try {
9169
- const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/VMHXZFTB.js");
9170
+ const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/A3VFVVHD.js");
9170
9171
  const workingDir = config3.configPath ? dirname4(config3.configPath) : process.cwd();
9171
9172
  if (argv.mtls) {
9172
9173
  mtlsCerts = resolveMtlsCertificates(argv.mtls, workingDir);
@@ -10382,7 +10383,7 @@ async function handleScore({ argv, config: config3, collectSpecData }) {
10382
10383
  const [{ path: path28 }] = await getFallbackApisOrExit(argv.api ? [argv.api] : [], config3);
10383
10384
  const externalRefResolver = new BaseResolver(config3.resolve);
10384
10385
  const { bundle: document } = await bundle({ config: config3, ref: path28 });
10385
- collectSpecData?.(document.parsed);
10386
+ collectSpecData?.(document);
10386
10387
  const specVersion = detectSpec(document.parsed);
10387
10388
  if (getMajorSpecVersion(specVersion) !== "oas3") {
10388
10389
  return exitWithError(
@@ -11212,7 +11213,7 @@ async function handleScorecardClassic({
11212
11213
  }
11213
11214
  const externalRefResolver = new BaseResolver(config3.resolve);
11214
11215
  const document = await externalRefResolver.resolveDocument(null, path28, true);
11215
- collectSpecData?.(document.parsed);
11216
+ collectSpecData?.(document);
11216
11217
  const documentInfo = document.parsed?.info;
11217
11218
  const builtInMetadata = documentInfo?.["x-metadata"] || {};
11218
11219
  const metadata = {
@@ -11851,7 +11852,7 @@ async function handleSplit({ argv, collectSpecData }) {
11851
11852
  const ext = getAndValidateFileExtension(api);
11852
11853
  if (!fs13.existsSync(api)) exitWithError(`File ${blue(api)} does not exist.`);
11853
11854
  const definition = readYaml(api);
11854
- collectSpecData?.(definition);
11855
+ collectSpecData?.({ parsed: definition });
11855
11856
  const specVersion = detectSpec(definition);
11856
11857
  switch (specVersion) {
11857
11858
  case "async2":
@@ -11991,7 +11992,7 @@ async function handleStats({ argv, config: config3, collectSpecData }) {
11991
11992
  const [{ path: path28 }] = await getFallbackApisOrExit(argv.api ? [argv.api] : [], config3);
11992
11993
  const externalRefResolver = new BaseResolver(config3.resolve);
11993
11994
  const { bundle: document } = await bundle({ config: config3, ref: path28 });
11994
- collectSpecData?.(document.parsed);
11995
+ collectSpecData?.(document);
11995
11996
  const specVersion = detectSpec(document.parsed);
11996
11997
  const types = normalizeTypes(config3.extendTypes(getTypes(specVersion), specVersion), config3);
11997
11998
  const { statsVisitor, statsAccumulator } = resolveStatsVisitorAndAccumulator(specVersion);
@@ -12642,7 +12643,7 @@ async function sendTelemetry({
12642
12643
  $0: _,
12643
12644
  ...args
12644
12645
  } = argv;
12645
- const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/SZLWDHZK.js");
12646
+ const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/7IX44JLO.js");
12646
12647
  const oauthClient = new RedoclyOAuthClient2();
12647
12648
  const reuniteUrl = getReuniteUrl(config3, args.residency);
12648
12649
  const logged_in = await oauthClient.isAuthorized(reuniteUrl);
@@ -12681,6 +12682,8 @@ async function sendTelemetry({
12681
12682
  type: "com.redocly.command.ran",
12682
12683
  source: "urn:redocly:cli",
12683
12684
  origin: "redocly-cli",
12685
+ env: "production",
12686
+ // should become "production" ab build time
12684
12687
  osPlatform: os.platform(),
12685
12688
  actor: {
12686
12689
  id: anonymous_id,
@@ -12690,7 +12693,7 @@ async function sendTelemetry({
12690
12693
  category: "product",
12691
12694
  data: eventData
12692
12695
  });
12693
- const { otelTelemetry } = await import("./chunks/5YSNZVUA.js");
12696
+ const { otelTelemetry } = await import("./chunks/BVP23YP7.js");
12694
12697
  otelTelemetry.send(cloudEvent);
12695
12698
  } catch (err) {
12696
12699
  }
@@ -12905,24 +12908,28 @@ function commandWrapper(commandHandler) {
12905
12908
  const respectXSecurityAuthTypes = /* @__PURE__ */ new Set();
12906
12909
  const respectSourceDescriptionTypes = /* @__PURE__ */ new Set();
12907
12910
  const respectCriterionObjectTypes = /* @__PURE__ */ new Set();
12908
- const collectSpecData = (document) => {
12911
+ const collectSpecData = ({ parsed: document, source }) => {
12912
+ specVersion = "unknown";
12913
+ specKeyword = void 0;
12914
+ specFullVersion = void 0;
12915
+ if (source?.absoluteRef && isGraphqlRef(source.absoluteRef)) {
12916
+ specVersion = "graphql";
12917
+ return;
12918
+ }
12909
12919
  try {
12910
12920
  specVersion = detectSpec(document);
12911
12921
  } catch (err) {
12912
- specVersion = `unsupported`;
12922
+ specVersion = "unsupported";
12913
12923
  }
12914
12924
  if (!isPlainObject(document)) return;
12915
12925
  specKeyword = document?.openapi ? "openapi" : document?.swagger ? "swagger" : document?.asyncapi ? "asyncapi" : document?.arazzo ? "arazzo" : document?.overlay ? "overlay" : void 0;
12916
12926
  if (specKeyword) {
12917
12927
  specFullVersion = document[specKeyword];
12918
- } else {
12919
- specFullVersion = void 0;
12920
12928
  }
12921
12929
  if (getMajorSpecVersion(specVersion) === "arazzo1") {
12922
- const arazzoDocument = document;
12923
- collectXSecurityAuthTypes(arazzoDocument, respectXSecurityAuthTypes);
12924
- collectSourceDescriptionTypes(arazzoDocument, respectSourceDescriptionTypes);
12925
- collectCriterionObjectTypes(arazzoDocument, respectCriterionObjectTypes);
12930
+ collectXSecurityAuthTypes(document, respectXSecurityAuthTypes);
12931
+ collectSourceDescriptionTypes(document, respectSourceDescriptionTypes);
12932
+ collectCriterionObjectTypes(document, respectCriterionObjectTypes);
12926
12933
  }
12927
12934
  };
12928
12935
  try {
@@ -13520,7 +13527,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13520
13527
  return true;
13521
13528
  }),
13522
13529
  async (argv) => {
13523
- const { handlerBuildCommand } = await import("./chunks/7H6CC6CT.js");
13530
+ const { handlerBuildCommand } = await import("./chunks/7MOL2QVN.js");
13524
13531
  commandWrapper(handlerBuildCommand)(argv);
13525
13532
  }
13526
13533
  ).command(
@@ -13741,7 +13748,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13741
13748
  config: { describe: "Path to the config file.", type: "string" }
13742
13749
  }),
13743
13750
  async (argv) => {
13744
- const { handleGenerateSpec } = await import("./chunks/PFPGSTSG.js");
13751
+ const { handleGenerateSpec } = await import("./chunks/7F5O43EU.js");
13745
13752
  commandWrapper(handleGenerateSpec)(argv);
13746
13753
  }
13747
13754
  ).command(
@@ -13856,7 +13863,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13856
13863
  }
13857
13864
  }),
13858
13865
  async (argv) => {
13859
- const { handleDrift } = await import("./chunks/HQDT5XFP.js");
13866
+ const { handleDrift } = await import("./chunks/NW3XJZXQ.js");
13860
13867
  commandWrapper(handleDrift)(argv);
13861
13868
  }
13862
13869
  ).command(
@@ -13924,7 +13931,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13924
13931
  }
13925
13932
  }),
13926
13933
  async (argv) => {
13927
- const { handleProxy } = await import("./chunks/GOFLD5MJ.js");
13934
+ const { handleProxy } = await import("./chunks/NLIKC7UP.js");
13928
13935
  commandWrapper(handleProxy)(argv);
13929
13936
  }
13930
13937
  ).completion("completion", "Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([notifyUpdateCliVersion]).strict().argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/cli",
3
- "version": "2.41.0",
3
+ "version": "2.41.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",