@debugbundle/cli 1.1.2 → 1.2.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/dist/main.cjs +191 -38
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -14486,25 +14486,74 @@ var CaptureProbeEventsSchema = external_exports.enum(CaptureProbeEventsValues);
|
|
|
14486
14486
|
var RequestSignalClassificationValues = ["incident_signal", "context_signal"];
|
|
14487
14487
|
var RequestSignalClassificationSchema = external_exports.enum(RequestSignalClassificationValues);
|
|
14488
14488
|
var RECOMMENDED_IMMEDIATE_CLIENT_ERROR_STATUSES = [401, 403, 409, 422];
|
|
14489
|
+
var HTTP_METHOD_VALUES = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
|
|
14489
14490
|
var ImmediateClientErrorStatusSchema = external_exports.number().int().min(400).max(499);
|
|
14491
|
+
var HttpMethodSchema = external_exports.enum(HTTP_METHOD_VALUES);
|
|
14490
14492
|
function normalizeImmediateClientErrorStatuses(statuses) {
|
|
14491
14493
|
return Array.from(new Set(statuses)).sort((left, right) => left - right);
|
|
14492
14494
|
}
|
|
14493
14495
|
var ImmediateClientErrorStatusesSchema = external_exports.array(ImmediateClientErrorStatusSchema).max(12).transform((statuses) => normalizeImmediateClientErrorStatuses(statuses));
|
|
14496
|
+
function normalizePathPattern(value) {
|
|
14497
|
+
return value.trim().replace(/\/{2,}/g, "/");
|
|
14498
|
+
}
|
|
14499
|
+
function isValidPathPattern(value) {
|
|
14500
|
+
const normalized = normalizePathPattern(value);
|
|
14501
|
+
if (!normalized.startsWith("/") || normalized.includes("?") || normalized.includes("#")) {
|
|
14502
|
+
return false;
|
|
14503
|
+
}
|
|
14504
|
+
const wildcardIndex = normalized.indexOf("*");
|
|
14505
|
+
return wildcardIndex === -1 || wildcardIndex === normalized.length - 1;
|
|
14506
|
+
}
|
|
14507
|
+
function normalizeHttpMethods(methods) {
|
|
14508
|
+
if (methods === void 0 || methods.length === 0) {
|
|
14509
|
+
return [];
|
|
14510
|
+
}
|
|
14511
|
+
const normalized = methods.map((method) => method.toUpperCase()).filter(
|
|
14512
|
+
(method) => HTTP_METHOD_VALUES.includes(method)
|
|
14513
|
+
);
|
|
14514
|
+
return Array.from(new Set(normalized)).sort();
|
|
14515
|
+
}
|
|
14516
|
+
function normalizeImmediateClientErrorPathRules(rules) {
|
|
14517
|
+
const normalized = rules.map((rule) => ({
|
|
14518
|
+
status_code: rule.status_code,
|
|
14519
|
+
path_pattern: normalizePathPattern(rule.path_pattern),
|
|
14520
|
+
methods: normalizeHttpMethods(rule.methods)
|
|
14521
|
+
}));
|
|
14522
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
14523
|
+
for (const rule of normalized) {
|
|
14524
|
+
deduped.set(`${rule.status_code}:${rule.path_pattern}:${rule.methods.join(",")}`, rule);
|
|
14525
|
+
}
|
|
14526
|
+
return Array.from(deduped.values()).sort((left, right) => {
|
|
14527
|
+
if (left.status_code !== right.status_code) return left.status_code - right.status_code;
|
|
14528
|
+
const pathComparison = left.path_pattern.localeCompare(right.path_pattern);
|
|
14529
|
+
if (pathComparison !== 0) return pathComparison;
|
|
14530
|
+
return left.methods.join(",").localeCompare(right.methods.join(","));
|
|
14531
|
+
});
|
|
14532
|
+
}
|
|
14533
|
+
var ImmediateClientErrorPathRuleSchema = external_exports.object({
|
|
14534
|
+
status_code: ImmediateClientErrorStatusSchema,
|
|
14535
|
+
path_pattern: external_exports.string().min(1).max(256).transform(normalizePathPattern).refine(isValidPathPattern, {
|
|
14536
|
+
message: "path_pattern must start with / and may only use a terminal * wildcard"
|
|
14537
|
+
}),
|
|
14538
|
+
methods: external_exports.array(HttpMethodSchema).max(7).optional().default([]).transform(normalizeHttpMethods)
|
|
14539
|
+
});
|
|
14540
|
+
var ImmediateClientErrorPathRulesSchema = external_exports.array(ImmediateClientErrorPathRuleSchema).max(25).transform((rules) => normalizeImmediateClientErrorPathRules(rules));
|
|
14494
14541
|
var ResolvedCapturePolicySchema = external_exports.object({
|
|
14495
14542
|
preset: CapturePresetSchema,
|
|
14496
14543
|
capture_logs: CaptureLogsSchema,
|
|
14497
14544
|
capture_request_events: CaptureRequestEventsSchema,
|
|
14498
14545
|
capture_breadcrumbs: CaptureBreadcrumbsSchema,
|
|
14499
14546
|
capture_probe_events: CaptureProbeEventsSchema,
|
|
14500
|
-
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema
|
|
14547
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema,
|
|
14548
|
+
immediate_client_error_path_rules: ImmediateClientErrorPathRulesSchema.default([])
|
|
14501
14549
|
});
|
|
14502
14550
|
var CapturePolicyOverridesSchema = external_exports.object({
|
|
14503
14551
|
capture_logs: CaptureLogsSchema.nullable(),
|
|
14504
14552
|
capture_request_events: CaptureRequestEventsSchema.nullable(),
|
|
14505
14553
|
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable(),
|
|
14506
14554
|
capture_probe_events: CaptureProbeEventsSchema.nullable(),
|
|
14507
|
-
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable()
|
|
14555
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable(),
|
|
14556
|
+
immediate_client_error_path_rules: ImmediateClientErrorPathRulesSchema.nullable().default(null)
|
|
14508
14557
|
});
|
|
14509
14558
|
var CapturePolicyResponseSchema = external_exports.object({
|
|
14510
14559
|
access_mode: external_exports.enum(["manage", "preview"]),
|
|
@@ -14519,6 +14568,7 @@ var CapturePolicySchema = external_exports.object({
|
|
|
14519
14568
|
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable(),
|
|
14520
14569
|
capture_probe_events: CaptureProbeEventsSchema.nullable(),
|
|
14521
14570
|
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable(),
|
|
14571
|
+
immediate_client_error_path_rules: ImmediateClientErrorPathRulesSchema.nullable().default(null),
|
|
14522
14572
|
updated_at: external_exports.string().datetime()
|
|
14523
14573
|
});
|
|
14524
14574
|
var CapturePolicyUpdateSchema = external_exports.object({
|
|
@@ -14527,7 +14577,8 @@ var CapturePolicyUpdateSchema = external_exports.object({
|
|
|
14527
14577
|
capture_request_events: CaptureRequestEventsSchema.nullable().optional(),
|
|
14528
14578
|
capture_breadcrumbs: CaptureBreadcrumbsSchema.nullable().optional(),
|
|
14529
14579
|
capture_probe_events: CaptureProbeEventsSchema.nullable().optional(),
|
|
14530
|
-
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable().optional()
|
|
14580
|
+
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable().optional(),
|
|
14581
|
+
immediate_client_error_path_rules: ImmediateClientErrorPathRulesSchema.nullable().optional()
|
|
14531
14582
|
});
|
|
14532
14583
|
var PRESET_DEFAULTS = {
|
|
14533
14584
|
minimal: {
|
|
@@ -14535,30 +14586,69 @@ var PRESET_DEFAULTS = {
|
|
|
14535
14586
|
capture_request_events: "failures_only",
|
|
14536
14587
|
capture_breadcrumbs: "local_only",
|
|
14537
14588
|
capture_probe_events: "buffer_only",
|
|
14538
|
-
immediate_client_error_statuses: []
|
|
14589
|
+
immediate_client_error_statuses: [],
|
|
14590
|
+
immediate_client_error_path_rules: []
|
|
14539
14591
|
},
|
|
14540
14592
|
balanced: {
|
|
14541
14593
|
capture_logs: "warning",
|
|
14542
14594
|
capture_request_events: "failures_only",
|
|
14543
14595
|
capture_breadcrumbs: "exception_only",
|
|
14544
14596
|
capture_probe_events: "buffer_only",
|
|
14545
|
-
immediate_client_error_statuses: []
|
|
14597
|
+
immediate_client_error_statuses: [],
|
|
14598
|
+
immediate_client_error_path_rules: []
|
|
14546
14599
|
},
|
|
14547
14600
|
investigative: {
|
|
14548
14601
|
capture_logs: "info",
|
|
14549
14602
|
capture_request_events: "all",
|
|
14550
14603
|
capture_breadcrumbs: "standalone",
|
|
14551
14604
|
capture_probe_events: "standalone_when_activated",
|
|
14552
|
-
immediate_client_error_statuses: [...RECOMMENDED_IMMEDIATE_CLIENT_ERROR_STATUSES]
|
|
14605
|
+
immediate_client_error_statuses: [...RECOMMENDED_IMMEDIATE_CLIENT_ERROR_STATUSES],
|
|
14606
|
+
immediate_client_error_path_rules: []
|
|
14553
14607
|
}
|
|
14554
14608
|
};
|
|
14555
14609
|
var BALANCED_IMMEDIATE_REQUEST_STATUSES = /* @__PURE__ */ new Set([408, 423, 424, 425, 429]);
|
|
14556
14610
|
var INVESTIGATIVE_IMMEDIATE_REQUEST_STATUSES = /* @__PURE__ */ new Set([...BALANCED_IMMEDIATE_REQUEST_STATUSES, 409]);
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14611
|
+
function normalizeRequestPath(value) {
|
|
14612
|
+
if (typeof value !== "string") {
|
|
14613
|
+
return null;
|
|
14614
|
+
}
|
|
14615
|
+
const trimmed = value.trim();
|
|
14616
|
+
if (trimmed.length === 0) {
|
|
14617
|
+
return null;
|
|
14618
|
+
}
|
|
14619
|
+
const path = trimmed.startsWith("http://") || trimmed.startsWith("https://") ? (() => {
|
|
14620
|
+
try {
|
|
14621
|
+
return new URL(trimmed).pathname;
|
|
14622
|
+
} catch {
|
|
14623
|
+
return trimmed;
|
|
14624
|
+
}
|
|
14625
|
+
})() : trimmed;
|
|
14626
|
+
return (path.split(/[?#]/, 1)[0] ?? path).replace(/\/{2,}/g, "/");
|
|
14627
|
+
}
|
|
14628
|
+
function pathPatternMatches(rulePattern, requestPath) {
|
|
14629
|
+
const pattern = normalizePathPattern(rulePattern);
|
|
14630
|
+
if (!pattern.endsWith("*")) {
|
|
14631
|
+
return requestPath === pattern;
|
|
14632
|
+
}
|
|
14633
|
+
const prefix = pattern.slice(0, -1);
|
|
14634
|
+
return requestPath.startsWith(prefix);
|
|
14635
|
+
}
|
|
14636
|
+
function matchesImmediateClientErrorPathRule(input2) {
|
|
14637
|
+
const { responseStatus, immediateClientErrorPathRules = [] } = input2;
|
|
14638
|
+
if (responseStatus === null || !Number.isFinite(responseStatus) || immediateClientErrorPathRules.length === 0) {
|
|
14639
|
+
return false;
|
|
14640
|
+
}
|
|
14641
|
+
const requestPath = normalizeRequestPath(input2.requestPath);
|
|
14642
|
+
if (requestPath === null) {
|
|
14643
|
+
return false;
|
|
14644
|
+
}
|
|
14645
|
+
const httpMethod = typeof input2.httpMethod === "string" ? input2.httpMethod.toUpperCase() : null;
|
|
14646
|
+
return immediateClientErrorPathRules.some(
|
|
14647
|
+
(rule) => rule.status_code === responseStatus && (rule.methods.length === 0 || httpMethod !== null && rule.methods.includes(httpMethod)) && pathPatternMatches(rule.path_pattern, requestPath)
|
|
14648
|
+
);
|
|
14649
|
+
}
|
|
14560
14650
|
function classifyRequestStatus(input2) {
|
|
14561
|
-
const { responseStatus, capturePreset, immediateClientErrorStatuses = [] } = input2;
|
|
14651
|
+
const { responseStatus, capturePreset, immediateClientErrorStatuses = [], immediateClientErrorPathRules = [] } = input2;
|
|
14562
14652
|
if (responseStatus === null || !Number.isFinite(responseStatus)) {
|
|
14563
14653
|
return "context_signal";
|
|
14564
14654
|
}
|
|
@@ -14568,6 +14658,14 @@ function classifyRequestStatus(input2) {
|
|
|
14568
14658
|
if (immediateClientErrorStatuses.includes(responseStatus)) {
|
|
14569
14659
|
return "incident_signal";
|
|
14570
14660
|
}
|
|
14661
|
+
if (matchesImmediateClientErrorPathRule({
|
|
14662
|
+
responseStatus,
|
|
14663
|
+
requestPath: input2.requestPath,
|
|
14664
|
+
httpMethod: input2.httpMethod,
|
|
14665
|
+
immediateClientErrorPathRules
|
|
14666
|
+
})) {
|
|
14667
|
+
return "incident_signal";
|
|
14668
|
+
}
|
|
14571
14669
|
if (capturePreset === "investigative") {
|
|
14572
14670
|
return INVESTIGATIVE_IMMEDIATE_REQUEST_STATUSES.has(responseStatus) ? "incident_signal" : "context_signal";
|
|
14573
14671
|
}
|
|
@@ -14577,31 +14675,10 @@ function classifyRequestStatus(input2) {
|
|
|
14577
14675
|
return "context_signal";
|
|
14578
14676
|
}
|
|
14579
14677
|
function getRequestAnomalyThreshold(input2) {
|
|
14580
|
-
const { responseStatus
|
|
14678
|
+
const { responseStatus } = input2;
|
|
14581
14679
|
if (responseStatus === null || !Number.isFinite(responseStatus) || responseStatus < 400 || responseStatus >= 500) {
|
|
14582
14680
|
return null;
|
|
14583
14681
|
}
|
|
14584
|
-
if (capturePreset === "minimal") {
|
|
14585
|
-
return null;
|
|
14586
|
-
}
|
|
14587
|
-
if (capturePreset === "investigative") {
|
|
14588
|
-
return INVESTIGATIVE_ANOMALY_STATUSES.has(responseStatus) ? {
|
|
14589
|
-
minimum_occurrences_5m: 8,
|
|
14590
|
-
minimum_ratio_5m_to_1h: 2
|
|
14591
|
-
} : null;
|
|
14592
|
-
}
|
|
14593
|
-
if (BALANCED_STANDARD_ANOMALY_STATUSES.has(responseStatus)) {
|
|
14594
|
-
return {
|
|
14595
|
-
minimum_occurrences_5m: 20,
|
|
14596
|
-
minimum_ratio_5m_to_1h: 3
|
|
14597
|
-
};
|
|
14598
|
-
}
|
|
14599
|
-
if (BALANCED_HIGH_VOLUME_ANOMALY_STATUSES.has(responseStatus)) {
|
|
14600
|
-
return {
|
|
14601
|
-
minimum_occurrences_5m: 50,
|
|
14602
|
-
minimum_ratio_5m_to_1h: 5
|
|
14603
|
-
};
|
|
14604
|
-
}
|
|
14605
14682
|
return null;
|
|
14606
14683
|
}
|
|
14607
14684
|
|
|
@@ -17631,7 +17708,7 @@ function getRequestResponseStatus(payload) {
|
|
|
17631
17708
|
const status = payload?.["response_status"];
|
|
17632
17709
|
return typeof status === "number" && Number.isFinite(status) ? status : null;
|
|
17633
17710
|
}
|
|
17634
|
-
function classifyEvent(eventType, logLevel, probeActivationId, payload, capturePreset = "minimal", immediateClientErrorStatuses = []) {
|
|
17711
|
+
function classifyEvent(eventType, logLevel, probeActivationId, payload, capturePreset = "minimal", immediateClientErrorStatuses = [], immediateClientErrorPathRules = []) {
|
|
17635
17712
|
switch (eventType) {
|
|
17636
17713
|
case "backend_exception":
|
|
17637
17714
|
case "frontend_exception":
|
|
@@ -17643,7 +17720,14 @@ function classifyEvent(eventType, logLevel, probeActivationId, payload, captureP
|
|
|
17643
17720
|
return "context_signal";
|
|
17644
17721
|
case "request_event": {
|
|
17645
17722
|
const responseStatus = getRequestResponseStatus(payload);
|
|
17646
|
-
return classifyRequestStatus({
|
|
17723
|
+
return classifyRequestStatus({
|
|
17724
|
+
responseStatus,
|
|
17725
|
+
requestPath: payload?.["path"],
|
|
17726
|
+
httpMethod: payload?.["method"],
|
|
17727
|
+
capturePreset,
|
|
17728
|
+
immediateClientErrorStatuses,
|
|
17729
|
+
immediateClientErrorPathRules
|
|
17730
|
+
});
|
|
17647
17731
|
}
|
|
17648
17732
|
case "frontend_breadcrumb":
|
|
17649
17733
|
case "deploy_metadata":
|
|
@@ -17981,6 +18065,7 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
|
|
|
17981
18065
|
capture_breadcrumbs text,
|
|
17982
18066
|
capture_probe_events text,
|
|
17983
18067
|
immediate_client_error_statuses jsonb,
|
|
18068
|
+
immediate_client_error_path_rules jsonb,
|
|
17984
18069
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
17985
18070
|
)
|
|
17986
18071
|
`,
|
|
@@ -19336,6 +19421,13 @@ var STORAGE_SCHEMA_MIGRATIONS = [
|
|
|
19336
19421
|
ON plan_cleanup_tasks (completed_at, next_attempt_at, created_at)
|
|
19337
19422
|
`
|
|
19338
19423
|
]
|
|
19424
|
+
}),
|
|
19425
|
+
defineStorageSchemaMigration({
|
|
19426
|
+
id: "202606080001_add_capture_policy_client_error_path_rules",
|
|
19427
|
+
description: "Add path-scoped client error incident promotion rules to capture policies.",
|
|
19428
|
+
statements: [
|
|
19429
|
+
"ALTER TABLE capture_policies ADD COLUMN IF NOT EXISTS immediate_client_error_path_rules jsonb"
|
|
19430
|
+
]
|
|
19339
19431
|
})
|
|
19340
19432
|
];
|
|
19341
19433
|
|
|
@@ -29036,7 +29128,7 @@ var CLI_USAGE_LINES = [
|
|
|
29036
29128
|
" debugbundle weekly-report update <channel-id> [--day-of-week <day>] [--hour-of-day <0-23>] [--timezone <iana>] [--config-json <json>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
29037
29129
|
" debugbundle weekly-report delete <channel-id> [--auth-file <path>] [--json]",
|
|
29038
29130
|
" debugbundle capture-policy get --project <id> [--auth-file <path>] [--json]",
|
|
29039
|
-
" debugbundle capture-policy set --project <id> [--preset <minimal|balanced|investigative>] [--override <key=value>] [--client-error-incidents <preset-default|none|recommended|custom>] [--client-error-statuses <400,401,...>] [--auth-file <path>] [--json]",
|
|
29131
|
+
" debugbundle capture-policy set --project <id> [--preset <minimal|balanced|investigative>] [--override <key=value>] [--client-error-incidents <preset-default|none|recommended|custom>] [--client-error-statuses <400,401,...>] [--client-error-path-rule <404=/path/*@GET,POST>] [--client-error-path-rules-json <json|null>] [--auth-file <path>] [--json]",
|
|
29040
29132
|
" debugbundle capture-rule list --project-id <id> [--auth-file <path>] [--json]",
|
|
29041
29133
|
" debugbundle capture-rule suggest <incident-id> [--auth-file <path>] [--json]",
|
|
29042
29134
|
" debugbundle capture-rule create-from-suggestion <incident-id> --suggestion-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
@@ -32016,6 +32108,18 @@ function statusesEqual(left, right) {
|
|
|
32016
32108
|
function formatStatusList(statuses) {
|
|
32017
32109
|
return statuses.length === 0 ? "none" : statuses.join(", ");
|
|
32018
32110
|
}
|
|
32111
|
+
function formatClientErrorPathRules(response) {
|
|
32112
|
+
const rawOverride = response.overrides.immediate_client_error_path_rules ?? null;
|
|
32113
|
+
const rules = rawOverride ?? response.policy.immediate_client_error_path_rules ?? [];
|
|
32114
|
+
if (rules.length === 0) {
|
|
32115
|
+
return rawOverride === null ? "preset default (none)" : "none (explicit)";
|
|
32116
|
+
}
|
|
32117
|
+
const formatted = rules.map((rule) => {
|
|
32118
|
+
const methods = rule.methods.length === 0 ? "" : `@${rule.methods.join(",")}`;
|
|
32119
|
+
return `${rule.status_code}=${rule.path_pattern}${methods}`;
|
|
32120
|
+
});
|
|
32121
|
+
return `${rawOverride === null ? "preset default" : "custom"} (${formatted.join("; ")})`;
|
|
32122
|
+
}
|
|
32019
32123
|
function formatClientErrorIncidents(response) {
|
|
32020
32124
|
const rawOverride = response.overrides.immediate_client_error_statuses;
|
|
32021
32125
|
if (rawOverride === null) {
|
|
@@ -32037,7 +32141,8 @@ function formatPolicy(response) {
|
|
|
32037
32141
|
`capture_request_events: ${policy.capture_request_events}`,
|
|
32038
32142
|
`capture_breadcrumbs: ${policy.capture_breadcrumbs}`,
|
|
32039
32143
|
`capture_probe_events: ${policy.capture_probe_events}`,
|
|
32040
|
-
`client_error_incidents: ${formatClientErrorIncidents(response)}
|
|
32144
|
+
`client_error_incidents: ${formatClientErrorIncidents(response)}`,
|
|
32145
|
+
`client_error_path_rules: ${formatClientErrorPathRules(response)}`
|
|
32041
32146
|
].join("\n");
|
|
32042
32147
|
}
|
|
32043
32148
|
async function getCapturePolicyCommand(input2, api) {
|
|
@@ -32810,6 +32915,31 @@ async function handleCapturePolicyCommand(parsedArgv, dependencies) {
|
|
|
32810
32915
|
}
|
|
32811
32916
|
return normalized;
|
|
32812
32917
|
}
|
|
32918
|
+
function parseClientErrorPathRuleOption(value) {
|
|
32919
|
+
const separatorIndex = value.indexOf("=");
|
|
32920
|
+
if (separatorIndex <= 0 || separatorIndex === value.length - 1) {
|
|
32921
|
+
throw new CliInputError("Invalid value for --client-error-path-rule.");
|
|
32922
|
+
}
|
|
32923
|
+
const status = Number(value.slice(0, separatorIndex));
|
|
32924
|
+
if (!Number.isInteger(status) || status < 400 || status > 499) {
|
|
32925
|
+
throw new CliInputError("Invalid value for --client-error-path-rule.");
|
|
32926
|
+
}
|
|
32927
|
+
const ruleValue = value.slice(separatorIndex + 1);
|
|
32928
|
+
const methodSeparatorIndex = ruleValue.lastIndexOf("@");
|
|
32929
|
+
const pathPattern = methodSeparatorIndex === -1 ? ruleValue : ruleValue.slice(0, methodSeparatorIndex);
|
|
32930
|
+
const methods = methodSeparatorIndex === -1 ? [] : ruleValue.slice(methodSeparatorIndex + 1).split(",").map((method) => method.trim().toUpperCase()).filter((method) => method.length > 0);
|
|
32931
|
+
const parsed = ImmediateClientErrorPathRulesSchema.safeParse([
|
|
32932
|
+
{
|
|
32933
|
+
status_code: status,
|
|
32934
|
+
path_pattern: pathPattern,
|
|
32935
|
+
methods
|
|
32936
|
+
}
|
|
32937
|
+
]);
|
|
32938
|
+
if (!parsed.success || parsed.data[0] === void 0) {
|
|
32939
|
+
throw new CliInputError("Invalid value for --client-error-path-rule.");
|
|
32940
|
+
}
|
|
32941
|
+
return parsed.data[0];
|
|
32942
|
+
}
|
|
32813
32943
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
32814
32944
|
if (action === "get") {
|
|
32815
32945
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project"]);
|
|
@@ -32830,7 +32960,9 @@ async function handleCapturePolicyCommand(parsedArgv, dependencies) {
|
|
|
32830
32960
|
"preset",
|
|
32831
32961
|
"override",
|
|
32832
32962
|
"client-error-incidents",
|
|
32833
|
-
"client-error-statuses"
|
|
32963
|
+
"client-error-statuses",
|
|
32964
|
+
"client-error-path-rule",
|
|
32965
|
+
"client-error-path-rules-json"
|
|
32834
32966
|
]);
|
|
32835
32967
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
32836
32968
|
const projectId = readStringOption(parsedArgv, "project");
|
|
@@ -32857,9 +32989,14 @@ async function handleCapturePolicyCommand(parsedArgv, dependencies) {
|
|
|
32857
32989
|
}
|
|
32858
32990
|
const clientErrorIncidents = readStringOption(parsedArgv, "client-error-incidents");
|
|
32859
32991
|
const clientErrorStatuses = readStringOption(parsedArgv, "client-error-statuses");
|
|
32992
|
+
const clientErrorPathRuleOptions = readStringListOption(parsedArgv, "client-error-path-rule") ?? [];
|
|
32993
|
+
const clientErrorPathRulesJson = readJsonOption(parsedArgv, "client-error-path-rules-json");
|
|
32860
32994
|
if (clientErrorStatuses !== void 0 && clientErrorIncidents !== "custom") {
|
|
32861
32995
|
throw new CliInputError("Use --client-error-statuses only with --client-error-incidents custom.");
|
|
32862
32996
|
}
|
|
32997
|
+
if (clientErrorPathRuleOptions.length > 0 && clientErrorPathRulesJson !== void 0) {
|
|
32998
|
+
throw new CliInputError("Use either --client-error-path-rule or --client-error-path-rules-json, not both.");
|
|
32999
|
+
}
|
|
32863
33000
|
if (clientErrorIncidents !== void 0) {
|
|
32864
33001
|
switch (clientErrorIncidents) {
|
|
32865
33002
|
case "preset-default":
|
|
@@ -32881,6 +33018,22 @@ async function handleCapturePolicyCommand(parsedArgv, dependencies) {
|
|
|
32881
33018
|
throw new CliInputError("Invalid value for --client-error-incidents.");
|
|
32882
33019
|
}
|
|
32883
33020
|
}
|
|
33021
|
+
if (clientErrorPathRulesJson !== void 0) {
|
|
33022
|
+
if (clientErrorPathRulesJson === null) {
|
|
33023
|
+
update.immediate_client_error_path_rules = null;
|
|
33024
|
+
} else {
|
|
33025
|
+
const parsed = ImmediateClientErrorPathRulesSchema.safeParse(clientErrorPathRulesJson);
|
|
33026
|
+
if (!parsed.success) {
|
|
33027
|
+
throw new CliInputError("Invalid value for --client-error-path-rules-json.");
|
|
33028
|
+
}
|
|
33029
|
+
update.immediate_client_error_path_rules = parsed.data;
|
|
33030
|
+
}
|
|
33031
|
+
}
|
|
33032
|
+
if (clientErrorPathRuleOptions.length > 0) {
|
|
33033
|
+
update.immediate_client_error_path_rules = ImmediateClientErrorPathRulesSchema.parse(
|
|
33034
|
+
clientErrorPathRuleOptions.map(parseClientErrorPathRuleOption)
|
|
33035
|
+
);
|
|
33036
|
+
}
|
|
32884
33037
|
if (Object.keys(update).length === 0) {
|
|
32885
33038
|
throw new CliInputError("At least one capture policy field must be provided.");
|
|
32886
33039
|
}
|
|
@@ -34586,7 +34739,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
|
|
|
34586
34739
|
// package.json
|
|
34587
34740
|
var package_default = {
|
|
34588
34741
|
name: "@debugbundle/cli",
|
|
34589
|
-
version: "1.
|
|
34742
|
+
version: "1.2.0",
|
|
34590
34743
|
private: false,
|
|
34591
34744
|
description: "Command-line interface for DebugBundle",
|
|
34592
34745
|
license: "AGPL-3.0-only",
|