@redocly/cli 0.0.0-snapshot.1785229997 → 0.0.0-snapshot.1785230554

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.
@@ -2,10 +2,10 @@ import { createRequire as __createRequire } from 'node:module';
2
2
  const require = __createRequire(import.meta.url);
3
3
  import {
4
4
  RedoclyOAuthClient
5
- } from "./UIDQCTVI.js";
5
+ } from "./MVYT2TYI.js";
6
6
  import "./Y6DTFCLS.js";
7
7
  import "./4FB5ZIPP.js";
8
- import "./3UGBCSN6.js";
8
+ import "./R3N3E2X6.js";
9
9
  import "./XB6C62FW.js";
10
10
  import "./UUU33DK3.js";
11
11
  import "./Z3EJWJEX.js";
@@ -3070,35 +3070,6 @@ var {
3070
3070
  bgWhiteBright
3071
3071
  } = createColors();
3072
3072
 
3073
- // ../respect-core/lib/modules/context-parser/resolve-workflow-reference.js
3074
- function parseSourceDescriptionWorkflowRef(ref) {
3075
- if (!ref.startsWith("$sourceDescriptions.")) {
3076
- return void 0;
3077
- }
3078
- const parts = ref.split(".");
3079
- if (parts.length === 3 && parts[1] && parts[2]) {
3080
- return { sourceDescriptionName: parts[1], workflowId: parts[2], isLegacyForm: false };
3081
- }
3082
- if (parts.length === 4 && parts[2] === "workflows" && parts[1] && parts[3]) {
3083
- return { sourceDescriptionName: parts[1], workflowId: parts[3], isLegacyForm: true };
3084
- }
3085
- return void 0;
3086
- }
3087
- function resolveWorkflowReference({ ref, ctx }) {
3088
- if (!ref) {
3089
- return void 0;
3090
- }
3091
- if (!ref.startsWith("$")) {
3092
- return "workflows" in ctx ? ctx.workflows?.find((workflow) => workflow.workflowId === ref) : void 0;
3093
- }
3094
- const parsedRef = parseSourceDescriptionWorkflowRef(ref);
3095
- if (!parsedRef) {
3096
- return void 0;
3097
- }
3098
- const workflows = ctx.$sourceDescriptions?.[parsedRef.sourceDescriptionName]?.workflows;
3099
- return Array.isArray(workflows) ? workflows.find((workflow) => workflow.workflowId === parsedRef.workflowId) : void 0;
3100
- }
3101
-
3102
3073
  // ../respect-core/lib/modules/context-parser/get-value-from-context.js
3103
3074
  var hasCurlyBraces = (input) => {
3104
3075
  return /\{.*?\}/.test(input);
@@ -3331,35 +3302,18 @@ var resolveValue = (value2, ctx, logger) => {
3331
3302
  if (path5.startsWith("$file(") && path5.endsWith(")")) {
3332
3303
  return path5.slice(7, -2);
3333
3304
  }
3334
- if (path5.startsWith("$sourceDescriptions.")) {
3335
- const parsedRef = parseSourceDescriptionWorkflowRef(path5);
3336
- if (parsedRef) {
3337
- const { sourceDescriptionName, workflowId: reference, isLegacyForm } = parsedRef;
3338
- const sourceDescriptions = getFrom(ctx)("$sourceDescriptions");
3339
- const sourceDescriptionDocument = sourceDescriptions?.[sourceDescriptionName];
3340
- if (!sourceDescriptionDocument) {
3341
- throw new Error(`Can't resolve ${red(path5)}: source description ${red(sourceDescriptionName)} is not found. Available source descriptions: ${Object.keys(sourceDescriptions ?? {}).join(", ")}.`);
3342
- }
3343
- const workflow = resolveWorkflowReference({ ref: path5, ctx });
3344
- if (workflow) {
3345
- return workflow;
3346
- }
3347
- if (!isLegacyForm) {
3348
- const sourceDescriptionObject = ("sourceDescriptions" in ctx ? ctx.sourceDescriptions : void 0)?.find(({ name }) => name === sourceDescriptionName);
3349
- if (sourceDescriptionObject && Object.prototype.hasOwnProperty.call(sourceDescriptionObject, reference)) {
3350
- return sourceDescriptionObject[reference];
3351
- }
3352
- if (Object.prototype.hasOwnProperty.call(sourceDescriptionDocument, reference)) {
3353
- return sourceDescriptionDocument[reference];
3354
- }
3355
- }
3356
- const availableWorkflows = (Array.isArray(sourceDescriptionDocument.workflows) ? sourceDescriptionDocument.workflows : []).map((workflow2) => workflow2.workflowId).join(", ");
3357
- const availableWorkflowsHint = availableWorkflows ? ` Available workflows: ${availableWorkflows}.` : "";
3358
- throw new Error(isLegacyForm ? `Can't resolve ${red(path5)}: workflow ${red(reference)} is not found in source description ${red(sourceDescriptionName)}.${availableWorkflowsHint}` : `Can't resolve ${red(path5)}: ${red(reference)} does not match a workflow or a field of source description ${red(sourceDescriptionName)}.${availableWorkflowsHint}`);
3305
+ if (path5.startsWith("$sourceDescriptions.") && path5.includes(".workflows.")) {
3306
+ const parts = path5.split(".");
3307
+ const sourceDescriptionName = parts[1];
3308
+ const workflowId = parts[3];
3309
+ if (!sourceDescriptionName || !workflowId) {
3310
+ return void 0;
3359
3311
  }
3360
- if (path5.split(".")[2] === "workflows") {
3361
- throw new Error(`Can't resolve ${red(path5)}: invalid workflow reference format. Use $sourceDescriptions.<name>.<workflowId> or $sourceDescriptions.<name>.workflows.<workflowId>.`);
3312
+ const sourceDescriptions = getFrom(ctx)("$sourceDescriptions");
3313
+ if (!sourceDescriptions[sourceDescriptionName]) {
3314
+ return void 0;
3362
3315
  }
3316
+ return sourceDescriptions[sourceDescriptionName].workflows.find((workflow) => workflow.workflowId === workflowId);
3363
3317
  }
3364
3318
  if (path5 && path5.trim().startsWith("faker.")) {
3365
3319
  return getFakeData({ pointer: path5, ctx, logger });
@@ -17282,7 +17236,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17282
17236
  const successActionsToRun = (onSuccess || workflow?.successActions || []).map((action) => resolveReusableComponentItem(action, ctx));
17283
17237
  const resolvedParameters = parameters?.map((parameter) => resolveReusableComponentItem(parameter, ctx));
17284
17238
  if (targetWorkflowRef) {
17285
- const targetWorkflow = resolveWorkflowReference({ ref: targetWorkflowRef, ctx });
17239
+ const targetWorkflow = ctx.workflows.find((w32) => w32.workflowId === targetWorkflowRef) || getValueFromContext({ value: targetWorkflowRef, ctx, logger: ctx.options.logger });
17286
17240
  if (!targetWorkflow) {
17287
17241
  const failedCall = {
17288
17242
  name: CHECKS.UNEXPECTED_ERROR,
@@ -17291,9 +17245,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17291
17245
  severity: ctx.severity["UNEXPECTED_ERROR"]
17292
17246
  };
17293
17247
  step.checks.push(failedCall);
17294
- ctx.executedSteps.push(step);
17295
- printUnknownStep(step, ctx.options.logger);
17296
- return { shouldEnd: true };
17248
+ return;
17297
17249
  }
17298
17250
  const workflowCtx = await resolveWorkflowContext(targetWorkflowRef, targetWorkflow, ctx, ctx.options.config);
17299
17251
  if (resolvedParameters && resolvedParameters.length > 0) {
@@ -17347,8 +17299,6 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17347
17299
  severity: ctx.severity["UNEXPECTED_ERROR"]
17348
17300
  };
17349
17301
  step.checks.push(failedCall);
17350
- ctx.executedSteps.push(step);
17351
- printUnknownStep(step, ctx.options.logger);
17352
17302
  }
17353
17303
  ctx.$steps[stepId] = {
17354
17304
  outputs
@@ -17462,23 +17412,10 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17462
17412
  }
17463
17413
  }
17464
17414
  async function runActions(actions = [], kind, executedStepsCount2) {
17465
- function failStepWithActionError(message) {
17466
- step.checks.push({
17467
- name: CHECKS.UNEXPECTED_ERROR,
17468
- message,
17469
- passed: false,
17470
- severity: ctx.severity["UNEXPECTED_ERROR"]
17471
- });
17472
- if (!ctx.executedSteps.includes(step)) {
17473
- ctx.executedSteps.push(step);
17474
- printUnknownStep(step, ctx.options.logger);
17475
- }
17476
- return { shouldEnd: true };
17477
- }
17478
17415
  for (const action of actions) {
17479
17416
  const { type, criteria } = action;
17480
17417
  if (action.workflowId && action.stepId) {
17481
- return failStepWithActionError(`Cannot use both workflowId: ${action.workflowId} and stepId: ${action.stepId} in ${action.type} action`);
17418
+ throw new Error(`Cannot use both workflowId: ${action.workflowId} and stepId: ${action.stepId} in ${action.type} action`);
17482
17419
  }
17483
17420
  const matchesCriteria = checkCriteria({
17484
17421
  workflowId,
@@ -17487,10 +17424,11 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17487
17424
  ctx
17488
17425
  }).every((check) => check.passed);
17489
17426
  if (matchesCriteria) {
17490
- const targetWorkflow = action.workflowId ? resolveWorkflowReference({ ref: action.workflowId, ctx }) : void 0;
17491
- if (action.workflowId && !targetWorkflow) {
17492
- return failStepWithActionError(`Workflow ${red(action.workflowId)} referenced in the ${type} action of step ${red(stepId)} is not found.`);
17493
- }
17427
+ const targetWorkflow = action.workflowId ? getValueFromContext({
17428
+ value: action.workflowId,
17429
+ ctx,
17430
+ logger: ctx.options.logger
17431
+ }) : void 0;
17494
17432
  const targetCtx = action.workflowId && targetWorkflow ? await resolveWorkflowContext(action.workflowId, targetWorkflow, ctx, ctx.options.config) : { ...ctx, executedSteps: [] };
17495
17433
  const targetStep = action.stepId ? action.stepId : void 0;
17496
17434
  if (type === "retry") {
@@ -17524,7 +17462,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17524
17462
  } else if (targetStep) {
17525
17463
  const stepToRun = workflow?.steps.find((s55) => s55.stepId === targetStep);
17526
17464
  if (!stepToRun) {
17527
- return failStepWithActionError(`Step ${targetStep} not found in workflow ${workflowId}`);
17465
+ throw new Error(`Step ${targetStep} not found in workflow ${workflowId}`);
17528
17466
  }
17529
17467
  await runStep({
17530
17468
  step: stepToRun,
@@ -17550,7 +17488,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
17550
17488
  return { shouldEnd: true };
17551
17489
  } else if (type === "goto") {
17552
17490
  if (!targetWorkflow && !targetStep) {
17553
- return failStepWithActionError("Either workflowId or stepId must be provided in goto action");
17491
+ throw new Error("Either workflowId or stepId must be provided in goto action");
17554
17492
  }
17555
17493
  if (targetWorkflow || targetStep) {
17556
17494
  printActionsSeparator({
@@ -17618,42 +17556,7 @@ async function runWorkflows({ testDescription, options, executedStepsCount }) {
17618
17556
  for (const workflow of workflows) {
17619
17557
  ctx.executedSteps = [];
17620
17558
  if (workflow.dependsOn?.length) {
17621
- try {
17622
- await handleDependsOn({ workflow, ctx, config: options.config, executedStepsCount });
17623
- } catch (error) {
17624
- if (!(error instanceof WorkflowDependencyError)) {
17625
- throw error;
17626
- }
17627
- const failureTime = performance.now();
17628
- const failedStep = {
17629
- stepId: "dependsOn",
17630
- checks: [
17631
- {
17632
- name: CHECKS.UNEXPECTED_ERROR,
17633
- message: error.message,
17634
- passed: false,
17635
- severity: ctx.severity["UNEXPECTED_ERROR"]
17636
- }
17637
- ]
17638
- };
17639
- printWorkflowSeparator({
17640
- fileName: basename3(ctx.options.filePath),
17641
- workflowName: workflow.workflowId,
17642
- logger: options.logger
17643
- });
17644
- printUnknownStep(failedStep, options.logger);
17645
- executedWorkflows.push({
17646
- type: "workflow",
17647
- workflowId: workflow.workflowId,
17648
- startTime: failureTime,
17649
- endTime: failureTime,
17650
- totalTimeMs: 0,
17651
- executedSteps: [failedStep],
17652
- ctx,
17653
- globalTimeoutError: false
17654
- });
17655
- continue;
17656
- }
17559
+ await handleDependsOn({ workflow, ctx, config: options.config, executedStepsCount });
17657
17560
  }
17658
17561
  const workflowExecutionResult = await runWorkflow({
17659
17562
  workflowInput: workflow.workflowId,
@@ -17767,19 +17670,15 @@ async function runWorkflow({ workflowInput, ctx, fromStepId, skipLineSeparator,
17767
17670
  globalTimeoutError: hasFailedTimeoutSteps
17768
17671
  };
17769
17672
  }
17770
- var WorkflowDependencyError = class extends Error {
17771
- };
17772
17673
  async function handleDependsOn({ workflow, ctx, config, executedStepsCount }) {
17773
17674
  if (!workflow.dependsOn?.length)
17774
17675
  return;
17775
- const resolvedDependencies = workflow.dependsOn.map((workflowId) => {
17776
- const resolvedWorkflow = resolveWorkflowReference({ ref: workflowId, ctx });
17777
- if (!resolvedWorkflow) {
17778
- throw new WorkflowDependencyError(`Workflow ${red(workflowId)} from dependsOn of workflow ${red(workflow.workflowId)} is not found.`);
17779
- }
17780
- return { workflowId, resolvedWorkflow };
17781
- });
17782
- const dependenciesWorkflows = await Promise.all(resolvedDependencies.map(async ({ workflowId, resolvedWorkflow }) => {
17676
+ const dependenciesWorkflows = await Promise.all(workflow.dependsOn.map(async (workflowId) => {
17677
+ const resolvedWorkflow = getValueFromContext({
17678
+ value: workflowId,
17679
+ ctx,
17680
+ logger: ctx.options.logger
17681
+ });
17783
17682
  const workflowCtx = await resolveWorkflowContext(workflowId, resolvedWorkflow, ctx, config);
17784
17683
  printRequiredWorkflowSeparator(workflow.workflowId, ctx.options.logger);
17785
17684
  return runWorkflow({
@@ -17789,9 +17688,10 @@ async function handleDependsOn({ workflow, ctx, config, executedStepsCount }) {
17789
17688
  executedStepsCount
17790
17689
  });
17791
17690
  }));
17792
- const failedDependencies = dependenciesWorkflows.filter((dependencyWorkflow) => calculateTotals([dependencyWorkflow]).steps.failed > 0).map((dependencyWorkflow) => dependencyWorkflow.workflowId);
17793
- if (failedDependencies.length) {
17794
- throw new WorkflowDependencyError(`Dependent workflows of workflow ${red(workflow.workflowId)} have failed steps: ${red(failedDependencies.join(", "))}.`);
17691
+ const totals = calculateTotals(dependenciesWorkflows);
17692
+ const hasProblems = totals.steps.failed > 0;
17693
+ if (hasProblems) {
17694
+ throw new Error("Dependent workflows has failed steps");
17795
17695
  }
17796
17696
  }
17797
17697
  async function resolveWorkflowContext(workflowId, resolvedWorkflow, ctx, config) {
@@ -8,7 +8,7 @@ import {
8
8
  } from "./4FB5ZIPP.js";
9
9
  import {
10
10
  version
11
- } from "./3UGBCSN6.js";
11
+ } from "./R3N3E2X6.js";
12
12
  import {
13
13
  require_undici
14
14
  } from "./XB6C62FW.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  redocStandaloneSri,
15
15
  redocVersion
16
- } from "./3UGBCSN6.js";
16
+ } from "./R3N3E2X6.js";
17
17
  import {
18
18
  require_json_pointer,
19
19
  require_openapi_sampler
@@ -10,7 +10,7 @@ import {
10
10
  } from "./Y6DTFCLS.js";
11
11
  import {
12
12
  version
13
- } from "./3UGBCSN6.js";
13
+ } from "./R3N3E2X6.js";
14
14
  import {
15
15
  diag,
16
16
  esm_exports,
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "@redocly/cli",
7
- version: "0.0.0-snapshot.1785229997",
7
+ version: "0.0.0-snapshot.1785230554",
8
8
  description: "",
9
9
  license: "MIT",
10
10
  bin: {
@@ -49,8 +49,8 @@ var package_default = {
49
49
  "@opentelemetry/sdk-trace-node": "2.8.0",
50
50
  "@opentelemetry/semantic-conventions": "1.41.1",
51
51
  "@redocly/cli-otel": "0.3.4",
52
- "@redocly/openapi-core": "0.0.0-snapshot.1785229997",
53
- "@redocly/respect-core": "0.0.0-snapshot.1785229997",
52
+ "@redocly/openapi-core": "0.0.0-snapshot.1785230554",
53
+ "@redocly/respect-core": "0.0.0-snapshot.1785230554",
54
54
  "@types/cookie": "0.6.0",
55
55
  "@types/har-format": "^1.2.16",
56
56
  "@types/react": "^17.0.0 || ^18.2.21 || ^19.2.16",
@@ -8,7 +8,7 @@ import {
8
8
  maskSecrets,
9
9
  parseRuntimeExpression,
10
10
  run
11
- } from "./ADJRH7PP.js";
11
+ } from "./JR2DXWZO.js";
12
12
  import "./VXIQEZPR.js";
13
13
  import "./UUU33DK3.js";
14
14
  import "./Z3EJWJEX.js";
package/lib/index.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  getProxyUrl,
48
48
  getReuniteUrl,
49
49
  shouldBypassProxy
50
- } from "./chunks/UIDQCTVI.js";
50
+ } from "./chunks/MVYT2TYI.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/3UGBCSN6.js";
61
+ } from "./chunks/R3N3E2X6.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/ADJRH7PP.js";
69
+ } from "./chunks/JR2DXWZO.js";
70
70
  import "./chunks/VXIQEZPR.js";
71
71
  import "./chunks/UUU33DK3.js";
72
72
  import {
@@ -7715,7 +7715,7 @@ async function handleGenerateArazzo({
7715
7715
  config: config3
7716
7716
  };
7717
7717
  try {
7718
- const { generate } = await import("./chunks/T2IFVCFM.js");
7718
+ const { generate } = await import("./chunks/UV3RHVRI.js");
7719
7719
  logger.info(gray("\n Generating Arazzo description... \n"));
7720
7720
  const generatedArazzo = await generate(options);
7721
7721
  writeFileSync2(outputFile, stringifyYaml(generatedArazzo));
@@ -9072,14 +9072,14 @@ function mapJsonStep(step, workflowId, ctx) {
9072
9072
  stepId: step.stepId,
9073
9073
  workflowId,
9074
9074
  request: {
9075
- method: publicStep?.request?.method || "",
9075
+ method: publicStep.request?.method || "",
9076
9076
  url: step.response?.requestUrl || "",
9077
- headers: publicStep?.request?.header || {},
9078
- body: publicStep?.request?.body
9077
+ headers: publicStep.request?.header || {},
9078
+ body: publicStep.request?.body
9079
9079
  },
9080
9080
  response: {
9081
9081
  statusCode: step.response?.statusCode || 0,
9082
- body: publicStep?.response?.body,
9082
+ body: publicStep.response?.body,
9083
9083
  headers: step.response?.header || {},
9084
9084
  time: step.response?.time || 0,
9085
9085
  size: step.response?.responseSize
@@ -9088,7 +9088,7 @@ function mapJsonStep(step, workflowId, ctx) {
9088
9088
  ...check,
9089
9089
  status: calculateCheckStatus(check)
9090
9090
  })),
9091
- totalTimeMs: publicStep?.response?.time || 0,
9091
+ totalTimeMs: publicStep.response?.time || 0,
9092
9092
  retriesLeft: step.retriesLeft,
9093
9093
  status: calculateStepStatus(step.checks)
9094
9094
  };
@@ -9167,7 +9167,7 @@ async function handleRespect({
9167
9167
  let mtlsCerts;
9168
9168
  let harLogs;
9169
9169
  try {
9170
- const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/T2IFVCFM.js");
9170
+ const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/UV3RHVRI.js");
9171
9171
  const workingDir = config3.configPath ? dirname4(config3.configPath) : process.cwd();
9172
9172
  if (argv.mtls) {
9173
9173
  mtlsCerts = resolveMtlsCertificates(argv.mtls, workingDir);
@@ -12643,7 +12643,7 @@ async function sendTelemetry({
12643
12643
  $0: _,
12644
12644
  ...args
12645
12645
  } = argv;
12646
- const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/O5U7AESV.js");
12646
+ const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/HV6PGCEU.js");
12647
12647
  const oauthClient = new RedoclyOAuthClient2();
12648
12648
  const reuniteUrl = getReuniteUrl(config3, args.residency);
12649
12649
  const logged_in = await oauthClient.isAuthorized(reuniteUrl);
@@ -12691,7 +12691,7 @@ async function sendTelemetry({
12691
12691
  category: "product",
12692
12692
  data: eventData
12693
12693
  });
12694
- const { otelTelemetry } = await import("./chunks/DCWPEC35.js");
12694
+ const { otelTelemetry } = await import("./chunks/QCELG3VF.js");
12695
12695
  otelTelemetry.send(cloudEvent);
12696
12696
  } catch (err) {
12697
12697
  }
@@ -13525,7 +13525,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
13525
13525
  return true;
13526
13526
  }),
13527
13527
  async (argv) => {
13528
- const { handlerBuildCommand } = await import("./chunks/WTUD47FM.js");
13528
+ const { handlerBuildCommand } = await import("./chunks/N55G56UJ.js");
13529
13529
  commandWrapper(handlerBuildCommand)(argv);
13530
13530
  }
13531
13531
  ).command(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/cli",
3
- "version": "0.0.0-snapshot.1785229997",
3
+ "version": "0.0.0-snapshot.1785230554",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",