@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/README.md +1 -1
- package/THIRD_PARTY_NOTICES +4 -4
- package/lib/chunks/{ER45DAHG.js → 3CX2Z7JI.js} +7 -3
- package/lib/chunks/{XDNYWH7V.js → 3UUTQVCJ.js} +2 -2
- package/lib/chunks/{PFPGSTSG.js → 7F5O43EU.js} +5 -5
- package/lib/chunks/{SZLWDHZK.js → 7IX44JLO.js} +3 -3
- package/lib/chunks/{7H6CC6CT.js → 7MOL2QVN.js} +132 -88
- package/lib/chunks/{VMHXZFTB.js → A3VFVVHD.js} +2 -2
- package/lib/chunks/{Q3KTKRJH.js → ASYQPOQY.js} +2 -2
- package/lib/chunks/{5YSNZVUA.js → BVP23YP7.js} +1 -1
- package/lib/chunks/{Z5H4OEIW.js → GFU5KGSW.js} +3 -3
- package/lib/chunks/{LCWGF7G6.js → KPMZLKQG.js} +1 -1
- package/lib/chunks/{6ABF7ZRJ.js → KRMBH6JF.js} +137 -34
- package/lib/chunks/{GOFLD5MJ.js → NLIKC7UP.js} +4 -4
- package/lib/chunks/{HQDT5XFP.js → NW3XJZXQ.js} +5 -5
- package/lib/chunks/{GBUMU6BX.js → P6UGG7F6.js} +2 -2
- package/lib/chunks/{ZBZADNJT.js → RRC5IDC3.js} +18 -6
- package/lib/chunks/{DT4UM7U4.js → T6UZU3XM.js} +1 -1
- package/lib/chunks/{YK6T7IHG.js → Z2664VV5.js} +20 -13
- package/lib/index.js +40 -33
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
lint,
|
|
18
18
|
pluralize,
|
|
19
19
|
require__
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./Z2664VV5.js";
|
|
21
21
|
import {
|
|
22
22
|
__commonJS,
|
|
23
23
|
__toESM
|
|
@@ -3070,6 +3070,35 @@ 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
|
+
|
|
3073
3102
|
// ../respect-core/lib/modules/context-parser/get-value-from-context.js
|
|
3074
3103
|
var hasCurlyBraces = (input) => {
|
|
3075
3104
|
return /\{.*?\}/.test(input);
|
|
@@ -3302,18 +3331,35 @@ var resolveValue = (value2, ctx, logger) => {
|
|
|
3302
3331
|
if (path5.startsWith("$file(") && path5.endsWith(")")) {
|
|
3303
3332
|
return path5.slice(7, -2);
|
|
3304
3333
|
}
|
|
3305
|
-
if (path5.startsWith("$sourceDescriptions.")
|
|
3306
|
-
const
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
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}`);
|
|
3311
3359
|
}
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
return void 0;
|
|
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>.`);
|
|
3315
3362
|
}
|
|
3316
|
-
return sourceDescriptions[sourceDescriptionName].workflows.find((workflow) => workflow.workflowId === workflowId);
|
|
3317
3363
|
}
|
|
3318
3364
|
if (path5 && path5.trim().startsWith("faker.")) {
|
|
3319
3365
|
return getFakeData({ pointer: path5, ctx, logger });
|
|
@@ -5946,7 +5992,7 @@ function resolveDescriptionNameFromPath(descriptionPath) {
|
|
|
5946
5992
|
async function generateArazzoDescription(opts) {
|
|
5947
5993
|
const { descriptionPath, outputFile, collectSpecData } = opts;
|
|
5948
5994
|
const document = await bundleOpenApi(opts) || {};
|
|
5949
|
-
collectSpecData?.(document);
|
|
5995
|
+
collectSpecData?.({ parsed: document });
|
|
5950
5996
|
const { paths: pathsObject, info, security: rootSecurity, components } = document;
|
|
5951
5997
|
const sourceDescriptionName = resolveDescriptionNameFromPath(descriptionPath);
|
|
5952
5998
|
const resolvedDescriptionPath = outputFile ? path2.relative(path2.dirname(outputFile), path2.resolve(descriptionPath)) : descriptionPath;
|
|
@@ -11972,7 +12018,7 @@ async function bundleArazzo(options) {
|
|
|
11972
12018
|
if (!isTestFile(fileName, bundledDocument.bundle.parsed)) {
|
|
11973
12019
|
throw new Error(`No test files found. File ${fileName} does not follows naming pattern "*.[yaml | yml | json]" or have not valid "Arazzo" description.`);
|
|
11974
12020
|
}
|
|
11975
|
-
collectSpecData?.(bundledDocument.bundle
|
|
12021
|
+
collectSpecData?.(bundledDocument.bundle);
|
|
11976
12022
|
const errorLintProblems = lintProblems.filter((problem) => problem.severity === "error");
|
|
11977
12023
|
if (errorLintProblems.length) {
|
|
11978
12024
|
throw new Error(`${red("Found errors in Arazzo description")} ${bold(fileName)}`);
|
|
@@ -17236,7 +17282,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17236
17282
|
const successActionsToRun = (onSuccess || workflow?.successActions || []).map((action) => resolveReusableComponentItem(action, ctx));
|
|
17237
17283
|
const resolvedParameters = parameters?.map((parameter) => resolveReusableComponentItem(parameter, ctx));
|
|
17238
17284
|
if (targetWorkflowRef) {
|
|
17239
|
-
const targetWorkflow =
|
|
17285
|
+
const targetWorkflow = resolveWorkflowReference({ ref: targetWorkflowRef, ctx });
|
|
17240
17286
|
if (!targetWorkflow) {
|
|
17241
17287
|
const failedCall = {
|
|
17242
17288
|
name: CHECKS.UNEXPECTED_ERROR,
|
|
@@ -17245,7 +17291,9 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17245
17291
|
severity: ctx.severity["UNEXPECTED_ERROR"]
|
|
17246
17292
|
};
|
|
17247
17293
|
step.checks.push(failedCall);
|
|
17248
|
-
|
|
17294
|
+
ctx.executedSteps.push(step);
|
|
17295
|
+
printUnknownStep(step, ctx.options.logger);
|
|
17296
|
+
return { shouldEnd: true };
|
|
17249
17297
|
}
|
|
17250
17298
|
const workflowCtx = await resolveWorkflowContext(targetWorkflowRef, targetWorkflow, ctx, ctx.options.config);
|
|
17251
17299
|
if (resolvedParameters && resolvedParameters.length > 0) {
|
|
@@ -17299,6 +17347,8 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17299
17347
|
severity: ctx.severity["UNEXPECTED_ERROR"]
|
|
17300
17348
|
};
|
|
17301
17349
|
step.checks.push(failedCall);
|
|
17350
|
+
ctx.executedSteps.push(step);
|
|
17351
|
+
printUnknownStep(step, ctx.options.logger);
|
|
17302
17352
|
}
|
|
17303
17353
|
ctx.$steps[stepId] = {
|
|
17304
17354
|
outputs
|
|
@@ -17412,10 +17462,26 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17412
17462
|
}
|
|
17413
17463
|
}
|
|
17414
17464
|
async function runActions(actions = [], kind, executedStepsCount2) {
|
|
17465
|
+
function failStepWithActionError(message) {
|
|
17466
|
+
const failedCheck = {
|
|
17467
|
+
name: CHECKS.UNEXPECTED_ERROR,
|
|
17468
|
+
message,
|
|
17469
|
+
passed: false,
|
|
17470
|
+
severity: ctx.severity["UNEXPECTED_ERROR"]
|
|
17471
|
+
};
|
|
17472
|
+
step.checks.push(failedCheck);
|
|
17473
|
+
if (!ctx.executedSteps.includes(step)) {
|
|
17474
|
+
ctx.executedSteps.push(step);
|
|
17475
|
+
printUnknownStep(step, ctx.options.logger);
|
|
17476
|
+
} else {
|
|
17477
|
+
printUnknownStep({ ...step, checks: [failedCheck] }, ctx.options.logger);
|
|
17478
|
+
}
|
|
17479
|
+
return { shouldEnd: true };
|
|
17480
|
+
}
|
|
17415
17481
|
for (const action of actions) {
|
|
17416
17482
|
const { type, criteria } = action;
|
|
17417
17483
|
if (action.workflowId && action.stepId) {
|
|
17418
|
-
|
|
17484
|
+
return failStepWithActionError(`Cannot use both workflowId: ${action.workflowId} and stepId: ${action.stepId} in ${action.type} action`);
|
|
17419
17485
|
}
|
|
17420
17486
|
const matchesCriteria = checkCriteria({
|
|
17421
17487
|
workflowId,
|
|
@@ -17424,11 +17490,10 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17424
17490
|
ctx
|
|
17425
17491
|
}).every((check) => check.passed);
|
|
17426
17492
|
if (matchesCriteria) {
|
|
17427
|
-
const targetWorkflow = action.workflowId ?
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
|
|
17431
|
-
}) : void 0;
|
|
17493
|
+
const targetWorkflow = action.workflowId ? resolveWorkflowReference({ ref: action.workflowId, ctx }) : void 0;
|
|
17494
|
+
if (action.workflowId && !targetWorkflow) {
|
|
17495
|
+
return failStepWithActionError(`Workflow ${red(action.workflowId)} referenced in the ${type} action of step ${red(stepId)} is not found.`);
|
|
17496
|
+
}
|
|
17432
17497
|
const targetCtx = action.workflowId && targetWorkflow ? await resolveWorkflowContext(action.workflowId, targetWorkflow, ctx, ctx.options.config) : { ...ctx, executedSteps: [] };
|
|
17433
17498
|
const targetStep = action.stepId ? action.stepId : void 0;
|
|
17434
17499
|
if (type === "retry") {
|
|
@@ -17462,7 +17527,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17462
17527
|
} else if (targetStep) {
|
|
17463
17528
|
const stepToRun = workflow?.steps.find((s55) => s55.stepId === targetStep);
|
|
17464
17529
|
if (!stepToRun) {
|
|
17465
|
-
|
|
17530
|
+
return failStepWithActionError(`Step ${targetStep} not found in workflow ${workflowId}`);
|
|
17466
17531
|
}
|
|
17467
17532
|
await runStep({
|
|
17468
17533
|
step: stepToRun,
|
|
@@ -17488,7 +17553,7 @@ async function runStep({ step, ctx, workflowId, retriesLeft, executedStepsCount
|
|
|
17488
17553
|
return { shouldEnd: true };
|
|
17489
17554
|
} else if (type === "goto") {
|
|
17490
17555
|
if (!targetWorkflow && !targetStep) {
|
|
17491
|
-
|
|
17556
|
+
return failStepWithActionError("Either workflowId or stepId must be provided in goto action");
|
|
17492
17557
|
}
|
|
17493
17558
|
if (targetWorkflow || targetStep) {
|
|
17494
17559
|
printActionsSeparator({
|
|
@@ -17556,7 +17621,42 @@ async function runWorkflows({ testDescription, options, executedStepsCount }) {
|
|
|
17556
17621
|
for (const workflow of workflows) {
|
|
17557
17622
|
ctx.executedSteps = [];
|
|
17558
17623
|
if (workflow.dependsOn?.length) {
|
|
17559
|
-
|
|
17624
|
+
try {
|
|
17625
|
+
await handleDependsOn({ workflow, ctx, config: options.config, executedStepsCount });
|
|
17626
|
+
} catch (error) {
|
|
17627
|
+
if (!(error instanceof WorkflowDependencyError)) {
|
|
17628
|
+
throw error;
|
|
17629
|
+
}
|
|
17630
|
+
const failureTime = performance.now();
|
|
17631
|
+
const failedStep = {
|
|
17632
|
+
stepId: "dependsOn",
|
|
17633
|
+
checks: [
|
|
17634
|
+
{
|
|
17635
|
+
name: CHECKS.UNEXPECTED_ERROR,
|
|
17636
|
+
message: error.message,
|
|
17637
|
+
passed: false,
|
|
17638
|
+
severity: ctx.severity["UNEXPECTED_ERROR"]
|
|
17639
|
+
}
|
|
17640
|
+
]
|
|
17641
|
+
};
|
|
17642
|
+
printWorkflowSeparator({
|
|
17643
|
+
fileName: basename3(ctx.options.filePath),
|
|
17644
|
+
workflowName: workflow.workflowId,
|
|
17645
|
+
logger: options.logger
|
|
17646
|
+
});
|
|
17647
|
+
printUnknownStep(failedStep, options.logger);
|
|
17648
|
+
executedWorkflows.push({
|
|
17649
|
+
type: "workflow",
|
|
17650
|
+
workflowId: workflow.workflowId,
|
|
17651
|
+
startTime: failureTime,
|
|
17652
|
+
endTime: failureTime,
|
|
17653
|
+
totalTimeMs: 0,
|
|
17654
|
+
executedSteps: [failedStep],
|
|
17655
|
+
ctx,
|
|
17656
|
+
globalTimeoutError: false
|
|
17657
|
+
});
|
|
17658
|
+
continue;
|
|
17659
|
+
}
|
|
17560
17660
|
}
|
|
17561
17661
|
const workflowExecutionResult = await runWorkflow({
|
|
17562
17662
|
workflowInput: workflow.workflowId,
|
|
@@ -17670,15 +17770,19 @@ async function runWorkflow({ workflowInput, ctx, fromStepId, skipLineSeparator,
|
|
|
17670
17770
|
globalTimeoutError: hasFailedTimeoutSteps
|
|
17671
17771
|
};
|
|
17672
17772
|
}
|
|
17773
|
+
var WorkflowDependencyError = class extends Error {
|
|
17774
|
+
};
|
|
17673
17775
|
async function handleDependsOn({ workflow, ctx, config, executedStepsCount }) {
|
|
17674
17776
|
if (!workflow.dependsOn?.length)
|
|
17675
17777
|
return;
|
|
17676
|
-
const
|
|
17677
|
-
const resolvedWorkflow =
|
|
17678
|
-
|
|
17679
|
-
|
|
17680
|
-
|
|
17681
|
-
}
|
|
17778
|
+
const resolvedDependencies = workflow.dependsOn.map((workflowId) => {
|
|
17779
|
+
const resolvedWorkflow = resolveWorkflowReference({ ref: workflowId, ctx });
|
|
17780
|
+
if (!resolvedWorkflow) {
|
|
17781
|
+
throw new WorkflowDependencyError(`Workflow ${red(workflowId)} from dependsOn of workflow ${red(workflow.workflowId)} is not found.`);
|
|
17782
|
+
}
|
|
17783
|
+
return { workflowId, resolvedWorkflow };
|
|
17784
|
+
});
|
|
17785
|
+
const dependenciesWorkflows = await Promise.all(resolvedDependencies.map(async ({ workflowId, resolvedWorkflow }) => {
|
|
17682
17786
|
const workflowCtx = await resolveWorkflowContext(workflowId, resolvedWorkflow, ctx, config);
|
|
17683
17787
|
printRequiredWorkflowSeparator(workflow.workflowId, ctx.options.logger);
|
|
17684
17788
|
return runWorkflow({
|
|
@@ -17688,10 +17792,9 @@ async function handleDependsOn({ workflow, ctx, config, executedStepsCount }) {
|
|
|
17688
17792
|
executedStepsCount
|
|
17689
17793
|
});
|
|
17690
17794
|
}));
|
|
17691
|
-
const
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
throw new Error("Dependent workflows has failed steps");
|
|
17795
|
+
const failedDependencies = dependenciesWorkflows.filter((dependencyWorkflow) => calculateTotals([dependencyWorkflow]).steps.failed > 0).map((dependencyWorkflow) => dependencyWorkflow.workflowId);
|
|
17796
|
+
if (failedDependencies.length) {
|
|
17797
|
+
throw new WorkflowDependencyError(`Dependent workflows of workflow ${red(workflow.workflowId)} have failed steps: ${red(failedDependencies.join(", "))}.`);
|
|
17695
17798
|
}
|
|
17696
17799
|
}
|
|
17697
17800
|
async function resolveWorkflowContext(workflowId, resolvedWorkflow, ctx, config) {
|
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
loadOpenApiIndex,
|
|
6
6
|
parseCsv,
|
|
7
7
|
renderReport
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./RRC5IDC3.js";
|
|
9
9
|
import {
|
|
10
10
|
createNormalizedExchange,
|
|
11
11
|
isJsonMime,
|
|
12
12
|
normalizeFsPath
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./3CX2Z7JI.js";
|
|
14
14
|
import {
|
|
15
15
|
AbortFlowError,
|
|
16
16
|
exitWithError
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./T6UZU3XM.js";
|
|
18
18
|
import {
|
|
19
19
|
require_undici
|
|
20
20
|
} from "./XB6C62FW.js";
|
|
21
21
|
import {
|
|
22
22
|
isPlainObject,
|
|
23
23
|
logger
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./Z2664VV5.js";
|
|
25
25
|
import "./Z2I5YXYN.js";
|
|
26
26
|
import {
|
|
27
27
|
__toESM
|
|
@@ -2,24 +2,24 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
selectTrafficParser
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./P6UGG7F6.js";
|
|
6
6
|
import {
|
|
7
7
|
ValidationSession,
|
|
8
8
|
loadOpenApiIndex,
|
|
9
9
|
parseCsv,
|
|
10
10
|
renderReport
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./RRC5IDC3.js";
|
|
12
12
|
import {
|
|
13
13
|
listFilesRecursively,
|
|
14
14
|
normalizeFsPath
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./3CX2Z7JI.js";
|
|
16
16
|
import {
|
|
17
17
|
AbortFlowError,
|
|
18
18
|
exitWithError
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./T6UZU3XM.js";
|
|
20
20
|
import {
|
|
21
21
|
logger
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./Z2664VV5.js";
|
|
23
23
|
import "./Z2I5YXYN.js";
|
|
24
24
|
import "./5ILQMFXK.js";
|
|
25
25
|
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
pickHeaderContentType,
|
|
11
11
|
readProbe,
|
|
12
12
|
streamNdjsonObjects
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./3CX2Z7JI.js";
|
|
14
14
|
import {
|
|
15
15
|
isPlainObject
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./Z2664VV5.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/drift/log-formats/har.ts
|
|
19
19
|
import path from "node:path";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
resolvePathForServer,
|
|
14
14
|
shouldIgnoreHeaderAsUndocumented,
|
|
15
15
|
splitSetCookieHeader
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./3CX2Z7JI.js";
|
|
17
17
|
import {
|
|
18
18
|
BaseResolver,
|
|
19
19
|
blue,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
require_dist,
|
|
36
36
|
walkDocument,
|
|
37
37
|
yellow
|
|
38
|
-
} from "./
|
|
38
|
+
} from "./Z2664VV5.js";
|
|
39
39
|
import {
|
|
40
40
|
__toESM
|
|
41
41
|
} from "./5ILQMFXK.js";
|
|
@@ -1751,6 +1751,7 @@ function relaxRequiredForTarget(schema, target, ancestors = /* @__PURE__ */ new
|
|
|
1751
1751
|
}
|
|
1752
1752
|
var SchemaValidator = class {
|
|
1753
1753
|
ajv;
|
|
1754
|
+
fallbackAjv;
|
|
1754
1755
|
objectSchemaCaches = {
|
|
1755
1756
|
none: /* @__PURE__ */ new WeakMap(),
|
|
1756
1757
|
request: /* @__PURE__ */ new WeakMap(),
|
|
@@ -1758,10 +1759,11 @@ var SchemaValidator = class {
|
|
|
1758
1759
|
};
|
|
1759
1760
|
scalarSchemaCache = /* @__PURE__ */ new Map();
|
|
1760
1761
|
constructor(options) {
|
|
1761
|
-
|
|
1762
|
+
const ajvOptions = {
|
|
1762
1763
|
strict: false,
|
|
1763
1764
|
allErrors: true,
|
|
1764
1765
|
allowUnionTypes: true,
|
|
1766
|
+
discriminator: true,
|
|
1765
1767
|
coerceTypes: options?.coerceTypes ? "array" : false,
|
|
1766
1768
|
validateFormats: true,
|
|
1767
1769
|
verbose: true,
|
|
@@ -1770,8 +1772,11 @@ var SchemaValidator = class {
|
|
|
1770
1772
|
// Treat it as a no-op format to avoid noisy unknown-format warnings.
|
|
1771
1773
|
enum: true
|
|
1772
1774
|
}
|
|
1773
|
-
}
|
|
1775
|
+
};
|
|
1776
|
+
this.ajv = new AjvConstructor(ajvOptions);
|
|
1777
|
+
this.fallbackAjv = new AjvConstructor({ ...ajvOptions, discriminator: false });
|
|
1774
1778
|
applyFormats(this.ajv);
|
|
1779
|
+
applyFormats(this.fallbackAjv);
|
|
1775
1780
|
}
|
|
1776
1781
|
validate(schema, value, target) {
|
|
1777
1782
|
if (schema === void 0) {
|
|
@@ -1802,7 +1807,7 @@ var SchemaValidator = class {
|
|
|
1802
1807
|
return cached2;
|
|
1803
1808
|
}
|
|
1804
1809
|
const effectiveSchema = target ? relaxRequiredForTarget(schema, target) : schema;
|
|
1805
|
-
const compiled2 = this.
|
|
1810
|
+
const compiled2 = this.compileSchema(effectiveSchema);
|
|
1806
1811
|
cache.set(schema, compiled2);
|
|
1807
1812
|
return compiled2;
|
|
1808
1813
|
}
|
|
@@ -1811,10 +1816,17 @@ var SchemaValidator = class {
|
|
|
1811
1816
|
if (cached) {
|
|
1812
1817
|
return cached;
|
|
1813
1818
|
}
|
|
1814
|
-
const compiled = this.
|
|
1819
|
+
const compiled = this.compileSchema(schema);
|
|
1815
1820
|
this.scalarSchemaCache.set(cacheKey, compiled);
|
|
1816
1821
|
return compiled;
|
|
1817
1822
|
}
|
|
1823
|
+
compileSchema(schema) {
|
|
1824
|
+
try {
|
|
1825
|
+
return this.ajv.compile(schema);
|
|
1826
|
+
} catch {
|
|
1827
|
+
return this.fallbackAjv.compile(schema);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1818
1830
|
};
|
|
1819
1831
|
|
|
1820
1832
|
// src/commands/drift/engine/validation-session.ts
|
|
@@ -20538,6 +20538,17 @@ function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd,
|
|
|
20538
20538
|
style
|
|
20539
20539
|
});
|
|
20540
20540
|
}
|
|
20541
|
+
function insertFlowPairMappingEvent(state, snapshot) {
|
|
20542
|
+
state.events.splice(snapshot.eventsLength, 0, {
|
|
20543
|
+
type: 3,
|
|
20544
|
+
start: snapshot.position,
|
|
20545
|
+
anchorStart: NO_RANGE$1,
|
|
20546
|
+
anchorEnd: NO_RANGE$1,
|
|
20547
|
+
tagStart: NO_RANGE$1,
|
|
20548
|
+
tagEnd: NO_RANGE$1,
|
|
20549
|
+
style: 2
|
|
20550
|
+
});
|
|
20551
|
+
}
|
|
20541
20552
|
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = 1, indent = -1, fast = false) {
|
|
20542
20553
|
state.events.push({
|
|
20543
20554
|
type: 4,
|
|
@@ -20981,12 +20992,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
20981
20992
|
state.position++;
|
|
20982
20993
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
20983
20994
|
if (!isMapping) {
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
20987
|
-
skipFlowSeparationSpace(state, nodeIndent);
|
|
20988
|
-
state.position++;
|
|
20989
|
-
skipFlowSeparationSpace(state, nodeIndent);
|
|
20995
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
20996
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
20990
20997
|
} else if (!keyWasRead) addEmptyScalarEvent(state);
|
|
20991
20998
|
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
20992
20999
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
@@ -20996,9 +21003,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
20996
21003
|
addEmptyScalarEvent(state);
|
|
20997
21004
|
} else if (isMapping) addEmptyScalarEvent(state);
|
|
20998
21005
|
else if (isPair) {
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
21006
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
21007
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
21002
21008
|
addEmptyScalarEvent(state);
|
|
21003
21009
|
addPopEvent(state);
|
|
21004
21010
|
}
|
|
@@ -21637,7 +21643,7 @@ function isNsCharOrWhitespace(c2) {
|
|
|
21637
21643
|
function isPlainSafe(c2, prev, inblock) {
|
|
21638
21644
|
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c2);
|
|
21639
21645
|
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c2);
|
|
21640
|
-
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET) && c2 !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c2 === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
21646
|
+
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET) && c2 !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c2 === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar && (inblock || c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET);
|
|
21641
21647
|
}
|
|
21642
21648
|
function isPlainSafeFirst(c2) {
|
|
21643
21649
|
return isPrintable(c2) && c2 !== CHAR_BOM && !isWhitespace(c2) && c2 !== CHAR_MINUS && c2 !== CHAR_QUESTION && c2 !== CHAR_COLON && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET && c2 !== CHAR_SHARP && c2 !== CHAR_AMPERSAND && c2 !== CHAR_ASTERISK && c2 !== CHAR_EXCLAMATION && c2 !== CHAR_VERTICAL_LINE && c2 !== CHAR_EQUALS && c2 !== CHAR_GREATER_THAN && c2 !== CHAR_SINGLE_QUOTE && c2 !== CHAR_DOUBLE_QUOTE && c2 !== CHAR_PERCENT && c2 !== CHAR_COMMERCIAL_AT && c2 !== CHAR_GRAVE_ACCENT;
|
|
@@ -38154,7 +38160,7 @@ async function bundle(opts) {
|
|
|
38154
38160
|
if (document instanceof Error) {
|
|
38155
38161
|
throw document;
|
|
38156
38162
|
}
|
|
38157
|
-
opts.collectSpecData?.(document
|
|
38163
|
+
opts.collectSpecData?.(document);
|
|
38158
38164
|
return bundleDocument({
|
|
38159
38165
|
document,
|
|
38160
38166
|
...opts,
|
|
@@ -39144,7 +39150,7 @@ var redoclyConfigSchemaWithoutTheme2 = {
|
|
|
39144
39150
|
async function lint(opts) {
|
|
39145
39151
|
const { ref, externalRefResolver = new BaseResolver(opts.config.resolve) } = opts;
|
|
39146
39152
|
const document = await externalRefResolver.resolveDocument(null, ref, true);
|
|
39147
|
-
opts.collectSpecData?.(document
|
|
39153
|
+
opts.collectSpecData?.(document);
|
|
39148
39154
|
return lintDocument({
|
|
39149
39155
|
document,
|
|
39150
39156
|
...opts,
|
|
@@ -39297,6 +39303,7 @@ export {
|
|
|
39297
39303
|
detectSpec,
|
|
39298
39304
|
require_dist,
|
|
39299
39305
|
isSupportedExtension,
|
|
39306
|
+
isGraphqlRef,
|
|
39300
39307
|
ResolveError,
|
|
39301
39308
|
BaseResolver,
|
|
39302
39309
|
resolveDocument,
|
|
@@ -39320,5 +39327,5 @@ export {
|
|
|
39320
39327
|
/*! Bundled license information:
|
|
39321
39328
|
|
|
39322
39329
|
js-yaml/dist/js-yaml.mjs:
|
|
39323
|
-
(*! js-yaml 5.2.
|
|
39330
|
+
(*! js-yaml 5.2.2 https://github.com/nodeca/js-yaml @license MIT *)
|
|
39324
39331
|
*/
|