@debugbundle/cli 1.13.1 → 1.14.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 +427 -250
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -75720,6 +75720,32 @@ var AnalyticsFlowCaptureSchemas = {
|
|
|
75720
75720
|
withdraw: Context.strict()
|
|
75721
75721
|
};
|
|
75722
75722
|
|
|
75723
|
+
// ../../packages/shared-types/src/analytics-query.ts
|
|
75724
|
+
var DEFAULT_LAST_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
75725
|
+
var MAX_LAST_MS = 370 * 24 * 60 * 60 * 1e3;
|
|
75726
|
+
var AnalyticsMetricsQuerySchema = external_exports.object({
|
|
75727
|
+
project_id: external_exports.string().uuid(),
|
|
75728
|
+
from: external_exports.string().datetime().optional(),
|
|
75729
|
+
to: external_exports.string().datetime().optional(),
|
|
75730
|
+
last: external_exports.string().trim().min(2).max(16).optional(),
|
|
75731
|
+
granularity: AnalyticsMetricsGranularitySchema.optional().default("day"),
|
|
75732
|
+
service: external_exports.string().trim().min(1).max(120).optional(),
|
|
75733
|
+
environment: external_exports.string().trim().min(1).max(120).optional(),
|
|
75734
|
+
route: external_exports.string().trim().min(1).max(2048).refine((value) => !value.includes("?") && !value.includes("#")).optional(),
|
|
75735
|
+
device_type: external_exports.string().trim().min(1).max(40).optional(),
|
|
75736
|
+
browser: external_exports.string().trim().min(1).max(80).optional(),
|
|
75737
|
+
os: external_exports.string().trim().min(1).max(80).optional(),
|
|
75738
|
+
language: external_exports.string().trim().min(1).max(40).optional(),
|
|
75739
|
+
country: external_exports.string().trim().min(1).max(8).optional(),
|
|
75740
|
+
auth_state: external_exports.enum(["anonymous", "authenticated", "unknown"]).optional(),
|
|
75741
|
+
referrer: external_exports.string().trim().min(1).max(255).optional(),
|
|
75742
|
+
utm_source: external_exports.string().trim().min(1).max(128).optional(),
|
|
75743
|
+
utm_medium: external_exports.string().trim().min(1).max(128).optional(),
|
|
75744
|
+
utm_campaign: external_exports.string().trim().min(1).max(128).optional(),
|
|
75745
|
+
custom_dimensions: external_exports.record(external_exports.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/), external_exports.string().max(128)).refine((value) => Object.keys(value).length <= 8).optional(),
|
|
75746
|
+
limit: external_exports.coerce.number().int().min(1).max(100).optional().default(10)
|
|
75747
|
+
}).strict();
|
|
75748
|
+
|
|
75723
75749
|
// ../../packages/shared-types/src/index.ts
|
|
75724
75750
|
var SeveritySchema = external_exports.enum(["low", "medium", "high", "critical"]);
|
|
75725
75751
|
var BundleSdkSchema = external_exports.object({
|
|
@@ -109002,7 +109028,12 @@ var WebhookLinksSchema = external_exports.object({
|
|
|
109002
109028
|
reproduction: external_exports.string().min(1).optional()
|
|
109003
109029
|
}).strict();
|
|
109004
109030
|
var BundleLifecycleWebhookPayloadSchema = external_exports.object({
|
|
109005
|
-
event: external_exports.enum([
|
|
109031
|
+
event: external_exports.enum([
|
|
109032
|
+
"bundle.created",
|
|
109033
|
+
"bundle.updated",
|
|
109034
|
+
"bundle.resolved",
|
|
109035
|
+
"improvement_bundle.created"
|
|
109036
|
+
]),
|
|
109006
109037
|
occurred_at: external_exports.string().datetime(),
|
|
109007
109038
|
project_id: external_exports.string().min(1),
|
|
109008
109039
|
bundle_id: external_exports.string().min(1),
|
|
@@ -109042,10 +109073,15 @@ var VerificationWebhookTestPayloadSchema = external_exports.object({
|
|
|
109042
109073
|
message: external_exports.string().min(1)
|
|
109043
109074
|
}).strict()
|
|
109044
109075
|
}).strict();
|
|
109076
|
+
var SyntheticWebhookTestPayloadSchema = VerificationWebhookTestPayloadSchema.extend({
|
|
109077
|
+
event: WebhookEventTypeSchema,
|
|
109078
|
+
event_type: WebhookEventTypeSchema
|
|
109079
|
+
});
|
|
109045
109080
|
var WebhookEventPayloadSchema = external_exports.union([
|
|
109046
109081
|
BundleLifecycleWebhookPayloadSchema,
|
|
109047
109082
|
IncidentLifecycleWebhookPayloadSchema,
|
|
109048
|
-
VerificationWebhookTestPayloadSchema
|
|
109083
|
+
VerificationWebhookTestPayloadSchema,
|
|
109084
|
+
SyntheticWebhookTestPayloadSchema
|
|
109049
109085
|
]);
|
|
109050
109086
|
var WebhookFiltersSchema = external_exports.object({
|
|
109051
109087
|
environment: external_exports.array(external_exports.string()).optional(),
|
|
@@ -109784,6 +109820,15 @@ async function expectNoContent(responsePromise) {
|
|
|
109784
109820
|
}
|
|
109785
109821
|
function createGitHubManagementApi(client) {
|
|
109786
109822
|
return {
|
|
109823
|
+
async disconnectInstallation(input3) {
|
|
109824
|
+
return expectNoContent(
|
|
109825
|
+
client.request({
|
|
109826
|
+
method: "DELETE",
|
|
109827
|
+
path: "/v1/github/installation",
|
|
109828
|
+
bearerToken: input3.bearerToken
|
|
109829
|
+
})
|
|
109830
|
+
);
|
|
109831
|
+
},
|
|
109787
109832
|
async getInstallation(input3) {
|
|
109788
109833
|
const query = input3.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(input3.projectId)}`;
|
|
109789
109834
|
return expectInstallation(
|
|
@@ -117835,9 +117880,10 @@ var CLI_USAGE_LINES = [
|
|
|
117835
117880
|
" debugbundle slack delete <destination-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
117836
117881
|
" debugbundle webhook list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
117837
117882
|
" debugbundle webhook create --project-id <id> --url <url> --event <event[,event]> [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
117838
|
-
" debugbundle webhook update <webhook-id> --project-id <id> [--url <url>] [--event <event[,event]>] [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
117883
|
+
" debugbundle webhook update <webhook-id> --project-id <id> [--url <url>] [--event <event[,event]>] [--filters-json <json>] [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
117884
|
+
" --filters-json replaces all filters ({} clears them); cannot be combined with individual filter flags.",
|
|
117839
117885
|
" debugbundle webhook delete <webhook-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
117840
|
-
" debugbundle webhook test <webhook-id> --project-id <id> [--event <verification.passed|verification.failed>] [--auth-file <path>] [--json]",
|
|
117886
|
+
" debugbundle webhook test <webhook-id> --project-id <id> [--event <bundle.created|bundle.updated|bundle.reopened|bundle.resolved|verification.passed|verification.failed|improvement_bundle.created|incident.spike_detected>] [--auth-file <path>] [--json]",
|
|
117841
117887
|
" debugbundle webhook deliveries <webhook-id> --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
117842
117888
|
" debugbundle webhook retry <webhook-id> <delivery-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
117843
117889
|
" debugbundle weekly-report list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
@@ -117851,7 +117897,7 @@ var CLI_USAGE_LINES = [
|
|
|
117851
117897
|
" debugbundle capture-rule suggest <incident-id> [--auth-file <path>] [--json]",
|
|
117852
117898
|
" 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]",
|
|
117853
117899
|
" debugbundle capture-rule create --project-id <id> --name <name> --action <demote|sample|drop> --matcher-json <json> [--description <text>] [--enabled <true|false>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
117854
|
-
" debugbundle capture-rule update <rule-id> --project-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--action <demote|sample|drop>] [--matcher-json <json>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--expires-at <ISO8601>] [--auth-file <path>] [--json]",
|
|
117900
|
+
" debugbundle capture-rule update <rule-id> --project-id <id> [--name <name>] [--description <text>] [--enabled <true|false>] [--action <demote|sample|drop>] [--matcher-json <json>] [--sample-rate <0-1>] [--sample-event-class <preserve|context>] [--expires-at <ISO8601|null>] [--auth-file <path>] [--json]",
|
|
117855
117901
|
" debugbundle capture-rule delete <rule-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
117856
117902
|
" debugbundle improvements list [--project-id <id>] [--environment <name>] [--service <name>] [--status <status>] [--severity <level>] [--kind <kind>] [--cursor <cursor>] [--limit <n>] [--auth-file <path>] [--json]",
|
|
117857
117903
|
" debugbundle improvements get <improvement-id> [--auth-file <path>] [--json]",
|
|
@@ -120666,7 +120712,10 @@ async function getGitHubStatusCommand(input3, api) {
|
|
|
120666
120712
|
${formatProjectRepo(repo)}`
|
|
120667
120713
|
};
|
|
120668
120714
|
} catch (error2) {
|
|
120669
|
-
return {
|
|
120715
|
+
return {
|
|
120716
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120717
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120718
|
+
};
|
|
120670
120719
|
}
|
|
120671
120720
|
}
|
|
120672
120721
|
async function listGitHubRepositoriesCommand(input3, api) {
|
|
@@ -120680,7 +120729,10 @@ async function listGitHubRepositoriesCommand(input3, api) {
|
|
|
120680
120729
|
output: input3.json ? JSON.stringify({ repositories }) : repositories.length === 0 ? "No GitHub repositories found." : repositories.map((repository) => `${repository.full_name} (${repository.default_branch})`).join("\n")
|
|
120681
120730
|
};
|
|
120682
120731
|
} catch (error2) {
|
|
120683
|
-
return {
|
|
120732
|
+
return {
|
|
120733
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120734
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120735
|
+
};
|
|
120684
120736
|
}
|
|
120685
120737
|
}
|
|
120686
120738
|
async function setProjectGitHubRepoCommand(input3, api) {
|
|
@@ -120703,7 +120755,10 @@ async function setProjectGitHubRepoCommand(input3, api) {
|
|
|
120703
120755
|
output: input3.json ? JSON.stringify({ repo: assignedRepo }) : `Project repo set: ${formatProjectRepo(assignedRepo)}`
|
|
120704
120756
|
};
|
|
120705
120757
|
} catch (error2) {
|
|
120706
|
-
return {
|
|
120758
|
+
return {
|
|
120759
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120760
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120761
|
+
};
|
|
120707
120762
|
}
|
|
120708
120763
|
}
|
|
120709
120764
|
async function removeProjectGitHubRepoCommand(input3, api) {
|
|
@@ -120714,7 +120769,10 @@ async function removeProjectGitHubRepoCommand(input3, api) {
|
|
|
120714
120769
|
output: input3.json ? JSON.stringify({ removed: true, project_id: input3.projectId }) : `Project repo removed: ${input3.projectId}`
|
|
120715
120770
|
};
|
|
120716
120771
|
} catch (error2) {
|
|
120717
|
-
return {
|
|
120772
|
+
return {
|
|
120773
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120774
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120775
|
+
};
|
|
120718
120776
|
}
|
|
120719
120777
|
}
|
|
120720
120778
|
async function listProjectGitHubRulesCommand(input3, api) {
|
|
@@ -120728,7 +120786,10 @@ async function listProjectGitHubRulesCommand(input3, api) {
|
|
|
120728
120786
|
output: input3.json ? JSON.stringify({ rules }) : formatGitHubRuleTable(rules)
|
|
120729
120787
|
};
|
|
120730
120788
|
} catch (error2) {
|
|
120731
|
-
return {
|
|
120789
|
+
return {
|
|
120790
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120791
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120792
|
+
};
|
|
120732
120793
|
}
|
|
120733
120794
|
}
|
|
120734
120795
|
async function listProjectGitHubDeliveriesCommand(input3, api) {
|
|
@@ -120744,7 +120805,10 @@ async function listProjectGitHubDeliveriesCommand(input3, api) {
|
|
|
120744
120805
|
output: input3.json ? JSON.stringify({ deliveries }) : formatGitHubDeliveryTable(deliveries)
|
|
120745
120806
|
};
|
|
120746
120807
|
} catch (error2) {
|
|
120747
|
-
return {
|
|
120808
|
+
return {
|
|
120809
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120810
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120811
|
+
};
|
|
120748
120812
|
}
|
|
120749
120813
|
}
|
|
120750
120814
|
async function retryProjectGitHubDeliveryCommand(input3, api) {
|
|
@@ -120759,7 +120823,10 @@ async function retryProjectGitHubDeliveryCommand(input3, api) {
|
|
|
120759
120823
|
output: input3.json ? JSON.stringify({ delivery }) : `GitHub delivery retried: ${delivery.delivery_id} | ${delivery.status}`
|
|
120760
120824
|
};
|
|
120761
120825
|
} catch (error2) {
|
|
120762
|
-
return {
|
|
120826
|
+
return {
|
|
120827
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120828
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120829
|
+
};
|
|
120763
120830
|
}
|
|
120764
120831
|
}
|
|
120765
120832
|
async function createProjectGitHubRuleCommand(input3, api) {
|
|
@@ -120782,7 +120849,10 @@ async function createProjectGitHubRuleCommand(input3, api) {
|
|
|
120782
120849
|
output: input3.json ? JSON.stringify({ rule }) : `GitHub rule created: ${rule.rule_id}`
|
|
120783
120850
|
};
|
|
120784
120851
|
} catch (error2) {
|
|
120785
|
-
return {
|
|
120852
|
+
return {
|
|
120853
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120854
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120855
|
+
};
|
|
120786
120856
|
}
|
|
120787
120857
|
}
|
|
120788
120858
|
async function updateProjectGitHubRuleCommand(input3, api) {
|
|
@@ -120806,7 +120876,10 @@ async function updateProjectGitHubRuleCommand(input3, api) {
|
|
|
120806
120876
|
output: input3.json ? JSON.stringify({ rule }) : `GitHub rule updated: ${rule.rule_id}`
|
|
120807
120877
|
};
|
|
120808
120878
|
} catch (error2) {
|
|
120809
|
-
return {
|
|
120879
|
+
return {
|
|
120880
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120881
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120882
|
+
};
|
|
120810
120883
|
}
|
|
120811
120884
|
}
|
|
120812
120885
|
async function deleteProjectGitHubRuleCommand(input3, api) {
|
|
@@ -120821,7 +120894,10 @@ async function deleteProjectGitHubRuleCommand(input3, api) {
|
|
|
120821
120894
|
output: input3.json ? JSON.stringify({ deleted: true, project_id: input3.projectId, rule_id: input3.ruleId }) : `GitHub rule deleted: ${input3.ruleId}`
|
|
120822
120895
|
};
|
|
120823
120896
|
} catch (error2) {
|
|
120824
|
-
return {
|
|
120897
|
+
return {
|
|
120898
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
120899
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
120900
|
+
};
|
|
120825
120901
|
}
|
|
120826
120902
|
}
|
|
120827
120903
|
async function getGitHubStatusWithAuthCommand(input3, dependencies) {
|
|
@@ -120991,6 +121067,33 @@ async function retryProjectGitHubDeliveryWithAuthCommand(input3, dependencies) {
|
|
|
120991
121067
|
)
|
|
120992
121068
|
});
|
|
120993
121069
|
}
|
|
121070
|
+
async function disconnectGitHubInstallationCommand(input3, api) {
|
|
121071
|
+
try {
|
|
121072
|
+
await api.disconnectInstallation({ bearerToken: input3.bearerToken });
|
|
121073
|
+
return {
|
|
121074
|
+
exitCode: 0,
|
|
121075
|
+
output: input3.json ? JSON.stringify({ disconnected: true }) : "GitHub installation disconnected for the active organization and all its projects."
|
|
121076
|
+
};
|
|
121077
|
+
} catch (error2) {
|
|
121078
|
+
return {
|
|
121079
|
+
exitCode: mapErrorToExitCode9(error2),
|
|
121080
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
121081
|
+
};
|
|
121082
|
+
}
|
|
121083
|
+
}
|
|
121084
|
+
async function disconnectGitHubInstallationWithAuthCommand(input3, dependencies) {
|
|
121085
|
+
return runAuthenticatedCliCommand(input3, {
|
|
121086
|
+
createApi: createAuthenticatedGitHubManagementApi,
|
|
121087
|
+
dependencies,
|
|
121088
|
+
runCommand: (authState, api) => disconnectGitHubInstallationCommand(
|
|
121089
|
+
{
|
|
121090
|
+
bearerToken: authState.bearer_token,
|
|
121091
|
+
...input3.json === void 0 ? {} : { json: input3.json }
|
|
121092
|
+
},
|
|
121093
|
+
api
|
|
121094
|
+
)
|
|
121095
|
+
});
|
|
121096
|
+
}
|
|
120994
121097
|
|
|
120995
121098
|
// src/improvement-commands.ts
|
|
120996
121099
|
function mapErrorToExitCode10(error2) {
|
|
@@ -121393,10 +121496,22 @@ async function setImprovementSettingsWithAuthCommand(input3, dependencies) {
|
|
|
121393
121496
|
// src/management-github-improvements-command-handlers.ts
|
|
121394
121497
|
async function handleGithubCommand(parsedArgv, dependencies) {
|
|
121395
121498
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
121499
|
+
if (action === "disconnect") {
|
|
121500
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
121501
|
+
ensureNoExtraPositionals(parsedArgv, 2);
|
|
121502
|
+
const input3 = appendCommonAuthOptions(
|
|
121503
|
+
parsedArgv,
|
|
121504
|
+
{}
|
|
121505
|
+
);
|
|
121506
|
+
return await (dependencies.disconnectGitHubInstallationCommand ?? disconnectGitHubInstallationWithAuthCommand)(input3);
|
|
121507
|
+
}
|
|
121396
121508
|
if (action === "status") {
|
|
121397
121509
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
121398
121510
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
121399
|
-
const input3 = appendCommonAuthOptions(
|
|
121511
|
+
const input3 = appendCommonAuthOptions(
|
|
121512
|
+
parsedArgv,
|
|
121513
|
+
{}
|
|
121514
|
+
);
|
|
121400
121515
|
const projectId = readStringOption(parsedArgv, "project-id");
|
|
121401
121516
|
if (projectId !== void 0) {
|
|
121402
121517
|
input3.projectId = projectId;
|
|
@@ -121406,7 +121521,10 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
121406
121521
|
if (action === "repos") {
|
|
121407
121522
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
121408
121523
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
121409
|
-
const input3 = appendCommonAuthOptions(
|
|
121524
|
+
const input3 = appendCommonAuthOptions(
|
|
121525
|
+
parsedArgv,
|
|
121526
|
+
{}
|
|
121527
|
+
);
|
|
121410
121528
|
const projectId = readStringOption(parsedArgv, "project-id");
|
|
121411
121529
|
if (projectId !== void 0) {
|
|
121412
121530
|
input3.projectId = projectId;
|
|
@@ -121467,9 +121585,7 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
121467
121585
|
const rulesAction = parsedArgv.positionals[2];
|
|
121468
121586
|
if (rulesAction === void 0) {
|
|
121469
121587
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
121470
|
-
return await (dependencies.listProjectGitHubRulesCommand ?? listProjectGitHubRulesWithAuthCommand)(
|
|
121471
|
-
appendCommonAuthOptions(parsedArgv, { projectId })
|
|
121472
|
-
);
|
|
121588
|
+
return await (dependencies.listProjectGitHubRulesCommand ?? listProjectGitHubRulesWithAuthCommand)(appendCommonAuthOptions(parsedArgv, { projectId }));
|
|
121473
121589
|
}
|
|
121474
121590
|
if (rulesAction === "create") {
|
|
121475
121591
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
@@ -121499,9 +121615,7 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
121499
121615
|
if (enabled !== void 0) {
|
|
121500
121616
|
commandInput.enabled = enabled;
|
|
121501
121617
|
}
|
|
121502
|
-
return await (dependencies.createProjectGitHubRuleCommand ?? createProjectGitHubRuleWithAuthCommand)(
|
|
121503
|
-
commandInput
|
|
121504
|
-
);
|
|
121618
|
+
return await (dependencies.createProjectGitHubRuleCommand ?? createProjectGitHubRuleWithAuthCommand)(commandInput);
|
|
121505
121619
|
}
|
|
121506
121620
|
if (rulesAction === "update") {
|
|
121507
121621
|
ensureNoExtraPositionals(parsedArgv, 4);
|
|
@@ -121523,7 +121637,8 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
121523
121637
|
if (eventTypes !== void 0) input3.eventTypes = eventTypes;
|
|
121524
121638
|
if (environments !== void 0) input3.environments = environments;
|
|
121525
121639
|
if (services !== void 0) input3.services = services;
|
|
121526
|
-
if (severityMin !== void 0)
|
|
121640
|
+
if (severityMin !== void 0)
|
|
121641
|
+
input3.severityMin = severityMin;
|
|
121527
121642
|
if (bundleType !== void 0) input3.bundleType = bundleType;
|
|
121528
121643
|
if (incidentStatus !== void 0) {
|
|
121529
121644
|
input3.incidentStatus = incidentStatus;
|
|
@@ -121565,18 +121680,30 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
121565
121680
|
if (projectId === void 0) {
|
|
121566
121681
|
throw new CliInputError("Missing required option --project-id.");
|
|
121567
121682
|
}
|
|
121568
|
-
return await (dependencies.removeProjectGitHubRepoCommand ?? removeProjectGitHubRepoWithAuthCommand)(
|
|
121569
|
-
appendCommonAuthOptions(parsedArgv, { projectId })
|
|
121570
|
-
);
|
|
121683
|
+
return await (dependencies.removeProjectGitHubRepoCommand ?? removeProjectGitHubRepoWithAuthCommand)(appendCommonAuthOptions(parsedArgv, { projectId }));
|
|
121571
121684
|
}
|
|
121572
121685
|
throw new CliInputError("Unknown github repo command.");
|
|
121573
121686
|
}
|
|
121574
121687
|
async function handleImprovementsCommand(parsedArgv, dependencies) {
|
|
121575
121688
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
121576
121689
|
if (action === "list") {
|
|
121577
|
-
expectNoUnknownOptions(parsedArgv, [
|
|
121690
|
+
expectNoUnknownOptions(parsedArgv, [
|
|
121691
|
+
"project-id",
|
|
121692
|
+
"environment",
|
|
121693
|
+
"service",
|
|
121694
|
+
"status",
|
|
121695
|
+
"severity",
|
|
121696
|
+
"kind",
|
|
121697
|
+
"cursor",
|
|
121698
|
+
"limit",
|
|
121699
|
+
"auth-file",
|
|
121700
|
+
"json"
|
|
121701
|
+
]);
|
|
121578
121702
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
121579
|
-
const input3 = appendCommonAuthOptions(
|
|
121703
|
+
const input3 = appendCommonAuthOptions(
|
|
121704
|
+
parsedArgv,
|
|
121705
|
+
{}
|
|
121706
|
+
);
|
|
121580
121707
|
const projectId = readStringOption(parsedArgv, "project-id");
|
|
121581
121708
|
if (projectId !== void 0) input3.projectId = projectId;
|
|
121582
121709
|
const environment = readStringOption(parsedArgv, "environment");
|
|
@@ -124889,10 +125016,14 @@ async function handleCapturePolicyCommand(parsedArgv, dependencies) {
|
|
|
124889
125016
|
const clientErrorPathRuleOptions = readStringListOption(parsedArgv, "client-error-path-rule") ?? [];
|
|
124890
125017
|
const clientErrorPathRulesJson = readJsonOption(parsedArgv, "client-error-path-rules-json");
|
|
124891
125018
|
if (clientErrorStatuses !== void 0 && clientErrorIncidents !== "custom") {
|
|
124892
|
-
throw new CliInputError(
|
|
125019
|
+
throw new CliInputError(
|
|
125020
|
+
"Use --client-error-statuses only with --client-error-incidents custom."
|
|
125021
|
+
);
|
|
124893
125022
|
}
|
|
124894
125023
|
if (clientErrorPathRuleOptions.length > 0 && clientErrorPathRulesJson !== void 0) {
|
|
124895
|
-
throw new CliInputError(
|
|
125024
|
+
throw new CliInputError(
|
|
125025
|
+
"Use either --client-error-path-rule or --client-error-path-rules-json, not both."
|
|
125026
|
+
);
|
|
124896
125027
|
}
|
|
124897
125028
|
if (clientErrorIncidents !== void 0) {
|
|
124898
125029
|
switch (clientErrorIncidents) {
|
|
@@ -125085,7 +125216,7 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
125085
125216
|
}
|
|
125086
125217
|
const expiresAt = readStringOption(parsedArgv, "expires-at");
|
|
125087
125218
|
if (expiresAt !== void 0) {
|
|
125088
|
-
update["expires_at"] = expiresAt;
|
|
125219
|
+
update["expires_at"] = expiresAt === "null" ? null : expiresAt;
|
|
125089
125220
|
}
|
|
125090
125221
|
if (Object.keys(update).length === 0) {
|
|
125091
125222
|
throw new CliInputError("At least one capture rule field must be provided.");
|
|
@@ -125117,7 +125248,15 @@ async function handleCaptureRuleCommand(parsedArgv, dependencies) {
|
|
|
125117
125248
|
async function handleProbeCommand(parsedArgv, dependencies) {
|
|
125118
125249
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
125119
125250
|
if (action === "activate") {
|
|
125120
|
-
expectNoUnknownOptions(parsedArgv, [
|
|
125251
|
+
expectNoUnknownOptions(parsedArgv, [
|
|
125252
|
+
"auth-file",
|
|
125253
|
+
"json",
|
|
125254
|
+
"label-pattern",
|
|
125255
|
+
"service",
|
|
125256
|
+
"environment",
|
|
125257
|
+
"ttl-seconds",
|
|
125258
|
+
"trigger-ttl-seconds"
|
|
125259
|
+
]);
|
|
125121
125260
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
125122
125261
|
const projectId = requirePositional(parsedArgv, 2, "project-id");
|
|
125123
125262
|
const labelPattern = readStringOption(parsedArgv, "label-pattern");
|
|
@@ -125170,7 +125309,9 @@ async function handleProbeCommand(parsedArgv, dependencies) {
|
|
|
125170
125309
|
function handleMemberCommand(parsedArgv, dependencies) {
|
|
125171
125310
|
void parsedArgv;
|
|
125172
125311
|
void dependencies;
|
|
125173
|
-
throw new CliInputError(
|
|
125312
|
+
throw new CliInputError(
|
|
125313
|
+
"Use `debugbundle project members ... --project-id <id>` for project collaboration commands."
|
|
125314
|
+
);
|
|
125174
125315
|
}
|
|
125175
125316
|
|
|
125176
125317
|
// src/alert-commands.ts
|
|
@@ -125652,8 +125793,161 @@ async function deleteSlackDestinationWithAuthCommand(input3, dependencies) {
|
|
|
125652
125793
|
});
|
|
125653
125794
|
}
|
|
125654
125795
|
|
|
125655
|
-
// src/
|
|
125796
|
+
// src/weekly-report-commands.ts
|
|
125656
125797
|
function mapErrorToExitCode22(error2) {
|
|
125798
|
+
if (!(error2 instanceof WeeklyReportApiError)) {
|
|
125799
|
+
return 1;
|
|
125800
|
+
}
|
|
125801
|
+
if (error2.status === 401) {
|
|
125802
|
+
return 2;
|
|
125803
|
+
}
|
|
125804
|
+
if (error2.status === 404) {
|
|
125805
|
+
return 3;
|
|
125806
|
+
}
|
|
125807
|
+
if (error2.status === 400) {
|
|
125808
|
+
return 4;
|
|
125809
|
+
}
|
|
125810
|
+
return 1;
|
|
125811
|
+
}
|
|
125812
|
+
function formatWeeklyReportChannelTable(channels) {
|
|
125813
|
+
if (channels.length === 0) {
|
|
125814
|
+
return "No weekly report channels found.";
|
|
125815
|
+
}
|
|
125816
|
+
return channels.map(
|
|
125817
|
+
(channel) => `${channel.channel_id} | ${channel.is_enabled ? "enabled" : "disabled"} | ${channel.channel} | ${channel.schedule.day_of_week}@${channel.schedule.hour_of_day} ${channel.schedule.timezone} | project=${channel.project_id}`
|
|
125818
|
+
).join("\n");
|
|
125819
|
+
}
|
|
125820
|
+
async function listWeeklyReportChannelsCommand(input3, api) {
|
|
125821
|
+
try {
|
|
125822
|
+
const channels = await api.listWeeklyReportChannels({
|
|
125823
|
+
bearerToken: input3.bearerToken,
|
|
125824
|
+
projectId: input3.projectId,
|
|
125825
|
+
...input3.limit !== void 0 ? { limit: input3.limit } : {}
|
|
125826
|
+
});
|
|
125827
|
+
return {
|
|
125828
|
+
exitCode: 0,
|
|
125829
|
+
output: input3.json ? JSON.stringify({ channels }) : formatWeeklyReportChannelTable(channels)
|
|
125830
|
+
};
|
|
125831
|
+
} catch (error2) {
|
|
125832
|
+
return { exitCode: mapErrorToExitCode22(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
125833
|
+
}
|
|
125834
|
+
}
|
|
125835
|
+
async function listWeeklyReportChannelsWithAuthCommand(input3, dependencies) {
|
|
125836
|
+
return runAuthenticatedCliCommand(input3, {
|
|
125837
|
+
createApi: createAuthenticatedWeeklyReportApi,
|
|
125838
|
+
dependencies,
|
|
125839
|
+
runCommand: (authState, api) => listWeeklyReportChannelsCommand(
|
|
125840
|
+
{
|
|
125841
|
+
bearerToken: authState.bearer_token,
|
|
125842
|
+
projectId: input3.projectId,
|
|
125843
|
+
...input3.limit !== void 0 ? { limit: input3.limit } : {},
|
|
125844
|
+
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
125845
|
+
},
|
|
125846
|
+
api
|
|
125847
|
+
)
|
|
125848
|
+
});
|
|
125849
|
+
}
|
|
125850
|
+
async function createWeeklyReportChannelCommand(input3, api) {
|
|
125851
|
+
try {
|
|
125852
|
+
const channel = await api.createWeeklyReportChannel({
|
|
125853
|
+
bearerToken: input3.bearerToken,
|
|
125854
|
+
projectId: input3.projectId,
|
|
125855
|
+
channel: input3.channel,
|
|
125856
|
+
config: input3.config,
|
|
125857
|
+
schedule: input3.schedule,
|
|
125858
|
+
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {}
|
|
125859
|
+
});
|
|
125860
|
+
return {
|
|
125861
|
+
exitCode: 0,
|
|
125862
|
+
output: input3.json ? JSON.stringify({ channel }) : `Weekly report channel created: ${channel.channel_id}`
|
|
125863
|
+
};
|
|
125864
|
+
} catch (error2) {
|
|
125865
|
+
return { exitCode: mapErrorToExitCode22(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
125866
|
+
}
|
|
125867
|
+
}
|
|
125868
|
+
async function createWeeklyReportChannelWithAuthCommand(input3, dependencies) {
|
|
125869
|
+
return runAuthenticatedCliCommand(input3, {
|
|
125870
|
+
createApi: createAuthenticatedWeeklyReportApi,
|
|
125871
|
+
dependencies,
|
|
125872
|
+
runCommand: (authState, api) => createWeeklyReportChannelCommand(
|
|
125873
|
+
{
|
|
125874
|
+
bearerToken: authState.bearer_token,
|
|
125875
|
+
projectId: input3.projectId,
|
|
125876
|
+
channel: input3.channel,
|
|
125877
|
+
config: input3.config,
|
|
125878
|
+
schedule: input3.schedule,
|
|
125879
|
+
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {},
|
|
125880
|
+
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
125881
|
+
},
|
|
125882
|
+
api
|
|
125883
|
+
)
|
|
125884
|
+
});
|
|
125885
|
+
}
|
|
125886
|
+
async function updateWeeklyReportChannelCommand(input3, api) {
|
|
125887
|
+
try {
|
|
125888
|
+
const channel = await api.updateWeeklyReportChannel({
|
|
125889
|
+
bearerToken: input3.bearerToken,
|
|
125890
|
+
channelId: input3.channelId,
|
|
125891
|
+
...input3.config !== void 0 ? { config: input3.config } : {},
|
|
125892
|
+
...input3.schedule !== void 0 ? { schedule: input3.schedule } : {},
|
|
125893
|
+
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {}
|
|
125894
|
+
});
|
|
125895
|
+
return {
|
|
125896
|
+
exitCode: 0,
|
|
125897
|
+
output: input3.json ? JSON.stringify({ channel }) : `Weekly report channel updated: ${channel.channel_id}`
|
|
125898
|
+
};
|
|
125899
|
+
} catch (error2) {
|
|
125900
|
+
return { exitCode: mapErrorToExitCode22(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
125901
|
+
}
|
|
125902
|
+
}
|
|
125903
|
+
async function updateWeeklyReportChannelWithAuthCommand(input3, dependencies) {
|
|
125904
|
+
return runAuthenticatedCliCommand(input3, {
|
|
125905
|
+
createApi: createAuthenticatedWeeklyReportApi,
|
|
125906
|
+
dependencies,
|
|
125907
|
+
runCommand: (authState, api) => updateWeeklyReportChannelCommand(
|
|
125908
|
+
{
|
|
125909
|
+
bearerToken: authState.bearer_token,
|
|
125910
|
+
channelId: input3.channelId,
|
|
125911
|
+
...input3.config !== void 0 ? { config: input3.config } : {},
|
|
125912
|
+
...input3.schedule !== void 0 ? { schedule: input3.schedule } : {},
|
|
125913
|
+
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {},
|
|
125914
|
+
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
125915
|
+
},
|
|
125916
|
+
api
|
|
125917
|
+
)
|
|
125918
|
+
});
|
|
125919
|
+
}
|
|
125920
|
+
async function deleteWeeklyReportChannelCommand(input3, api) {
|
|
125921
|
+
try {
|
|
125922
|
+
const deleted = await api.deleteWeeklyReportChannel({
|
|
125923
|
+
bearerToken: input3.bearerToken,
|
|
125924
|
+
channelId: input3.channelId
|
|
125925
|
+
});
|
|
125926
|
+
return {
|
|
125927
|
+
exitCode: 0,
|
|
125928
|
+
output: input3.json ? JSON.stringify({ channel: deleted }) : `Weekly report channel deleted: ${deleted.channel_id}`
|
|
125929
|
+
};
|
|
125930
|
+
} catch (error2) {
|
|
125931
|
+
return { exitCode: mapErrorToExitCode22(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
125932
|
+
}
|
|
125933
|
+
}
|
|
125934
|
+
async function deleteWeeklyReportChannelWithAuthCommand(input3, dependencies) {
|
|
125935
|
+
return runAuthenticatedCliCommand(input3, {
|
|
125936
|
+
createApi: createAuthenticatedWeeklyReportApi,
|
|
125937
|
+
dependencies,
|
|
125938
|
+
runCommand: (authState, api) => deleteWeeklyReportChannelCommand(
|
|
125939
|
+
{
|
|
125940
|
+
bearerToken: authState.bearer_token,
|
|
125941
|
+
channelId: input3.channelId,
|
|
125942
|
+
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
125943
|
+
},
|
|
125944
|
+
api
|
|
125945
|
+
)
|
|
125946
|
+
});
|
|
125947
|
+
}
|
|
125948
|
+
|
|
125949
|
+
// src/webhook-commands.ts
|
|
125950
|
+
function mapErrorToExitCode23(error2) {
|
|
125657
125951
|
if (!(error2 instanceof WebhookApiError)) {
|
|
125658
125952
|
return 1;
|
|
125659
125953
|
}
|
|
@@ -125681,7 +125975,9 @@ function formatWebhookDeliveriesTable(deliveries) {
|
|
|
125681
125975
|
if (deliveries.length === 0) {
|
|
125682
125976
|
return "No deliveries found.";
|
|
125683
125977
|
}
|
|
125684
|
-
return deliveries.map(
|
|
125978
|
+
return deliveries.map(
|
|
125979
|
+
(delivery) => `${delivery.delivery_id} | ${delivery.status} | ${delivery.event_type} | attempts=${delivery.attempt_count}`
|
|
125980
|
+
).join("\n");
|
|
125685
125981
|
}
|
|
125686
125982
|
async function listWebhooksCommand(input3, api) {
|
|
125687
125983
|
try {
|
|
@@ -125698,7 +125994,10 @@ async function listWebhooksCommand(input3, api) {
|
|
|
125698
125994
|
output: input3.json ? JSON.stringify({ webhooks }) : formatWebhookTable(webhooks)
|
|
125699
125995
|
};
|
|
125700
125996
|
} catch (error2) {
|
|
125701
|
-
return {
|
|
125997
|
+
return {
|
|
125998
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
125999
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126000
|
+
};
|
|
125702
126001
|
}
|
|
125703
126002
|
}
|
|
125704
126003
|
async function listWebhooksWithAuthCommand(input3, dependencies) {
|
|
@@ -125746,7 +126045,10 @@ async function createWebhookCommand(input3, api) {
|
|
|
125746
126045
|
Signing secret: ${webhook.signing_secret}`
|
|
125747
126046
|
};
|
|
125748
126047
|
} catch (error2) {
|
|
125749
|
-
return {
|
|
126048
|
+
return {
|
|
126049
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126050
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126051
|
+
};
|
|
125750
126052
|
}
|
|
125751
126053
|
}
|
|
125752
126054
|
async function createWebhookWithAuthCommand(input3, dependencies) {
|
|
@@ -125800,7 +126102,10 @@ async function updateWebhookCommand(input3, api) {
|
|
|
125800
126102
|
output: input3.json ? JSON.stringify({ webhook }) : `Webhook updated: ${webhook.webhook_id}`
|
|
125801
126103
|
};
|
|
125802
126104
|
} catch (error2) {
|
|
125803
|
-
return {
|
|
126105
|
+
return {
|
|
126106
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126107
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126108
|
+
};
|
|
125804
126109
|
}
|
|
125805
126110
|
}
|
|
125806
126111
|
async function updateWebhookWithAuthCommand(input3, dependencies) {
|
|
@@ -125846,7 +126151,10 @@ async function deleteWebhookCommand(input3, api) {
|
|
|
125846
126151
|
output: input3.json ? JSON.stringify({ webhook }) : `Webhook deleted: ${webhook.webhook_id}`
|
|
125847
126152
|
};
|
|
125848
126153
|
} catch (error2) {
|
|
125849
|
-
return {
|
|
126154
|
+
return {
|
|
126155
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126156
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126157
|
+
};
|
|
125850
126158
|
}
|
|
125851
126159
|
}
|
|
125852
126160
|
async function deleteWebhookWithAuthCommand(input3, dependencies) {
|
|
@@ -125884,7 +126192,10 @@ async function testWebhookCommand(input3, api) {
|
|
|
125884
126192
|
output: input3.json ? JSON.stringify({ delivery }) : `Webhook test queued: ${delivery.delivery_id} | ${delivery.event_type} | attempts=${delivery.attempt_count}`
|
|
125885
126193
|
};
|
|
125886
126194
|
} catch (error2) {
|
|
125887
|
-
return {
|
|
126195
|
+
return {
|
|
126196
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126197
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126198
|
+
};
|
|
125888
126199
|
}
|
|
125889
126200
|
}
|
|
125890
126201
|
async function testWebhookWithAuthCommand(input3, dependencies) {
|
|
@@ -125925,7 +126236,10 @@ async function listWebhookDeliveriesCommand(input3, api) {
|
|
|
125925
126236
|
output: input3.json ? JSON.stringify({ deliveries }) : formatWebhookDeliveriesTable(deliveries)
|
|
125926
126237
|
};
|
|
125927
126238
|
} catch (error2) {
|
|
125928
|
-
return {
|
|
126239
|
+
return {
|
|
126240
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126241
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126242
|
+
};
|
|
125929
126243
|
}
|
|
125930
126244
|
}
|
|
125931
126245
|
async function listWebhookDeliveriesWithAuthCommand(input3, dependencies) {
|
|
@@ -125963,7 +126277,10 @@ async function retryWebhookDeliveryCommand(input3, api) {
|
|
|
125963
126277
|
output: input3.json ? JSON.stringify(result) : `Delivery retried: ${result.delivery_id} | ${result.event_type}`
|
|
125964
126278
|
};
|
|
125965
126279
|
} catch (error2) {
|
|
125966
|
-
return {
|
|
126280
|
+
return {
|
|
126281
|
+
exitCode: mapErrorToExitCode23(error2),
|
|
126282
|
+
output: error2 instanceof Error ? error2.message : String(error2)
|
|
126283
|
+
};
|
|
125967
126284
|
}
|
|
125968
126285
|
}
|
|
125969
126286
|
async function retryWebhookDeliveryWithAuthCommand(input3, dependencies) {
|
|
@@ -125987,160 +126304,36 @@ async function retryWebhookDeliveryWithAuthCommand(input3, dependencies) {
|
|
|
125987
126304
|
});
|
|
125988
126305
|
}
|
|
125989
126306
|
|
|
125990
|
-
// src/
|
|
125991
|
-
function
|
|
125992
|
-
|
|
125993
|
-
|
|
125994
|
-
|
|
125995
|
-
|
|
125996
|
-
|
|
125997
|
-
|
|
125998
|
-
|
|
125999
|
-
|
|
126000
|
-
|
|
126001
|
-
|
|
126002
|
-
|
|
126003
|
-
|
|
126004
|
-
return 1;
|
|
126005
|
-
}
|
|
126006
|
-
function formatWeeklyReportChannelTable(channels) {
|
|
126007
|
-
if (channels.length === 0) {
|
|
126008
|
-
return "No weekly report channels found.";
|
|
126009
|
-
}
|
|
126010
|
-
return channels.map(
|
|
126011
|
-
(channel) => `${channel.channel_id} | ${channel.is_enabled ? "enabled" : "disabled"} | ${channel.channel} | ${channel.schedule.day_of_week}@${channel.schedule.hour_of_day} ${channel.schedule.timezone} | project=${channel.project_id}`
|
|
126012
|
-
).join("\n");
|
|
126013
|
-
}
|
|
126014
|
-
async function listWeeklyReportChannelsCommand(input3, api) {
|
|
126015
|
-
try {
|
|
126016
|
-
const channels = await api.listWeeklyReportChannels({
|
|
126017
|
-
bearerToken: input3.bearerToken,
|
|
126018
|
-
projectId: input3.projectId,
|
|
126019
|
-
...input3.limit !== void 0 ? { limit: input3.limit } : {}
|
|
126020
|
-
});
|
|
126021
|
-
return {
|
|
126022
|
-
exitCode: 0,
|
|
126023
|
-
output: input3.json ? JSON.stringify({ channels }) : formatWeeklyReportChannelTable(channels)
|
|
126024
|
-
};
|
|
126025
|
-
} catch (error2) {
|
|
126026
|
-
return { exitCode: mapErrorToExitCode23(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
126027
|
-
}
|
|
126028
|
-
}
|
|
126029
|
-
async function listWeeklyReportChannelsWithAuthCommand(input3, dependencies) {
|
|
126030
|
-
return runAuthenticatedCliCommand(input3, {
|
|
126031
|
-
createApi: createAuthenticatedWeeklyReportApi,
|
|
126032
|
-
dependencies,
|
|
126033
|
-
runCommand: (authState, api) => listWeeklyReportChannelsCommand(
|
|
126034
|
-
{
|
|
126035
|
-
bearerToken: authState.bearer_token,
|
|
126036
|
-
projectId: input3.projectId,
|
|
126037
|
-
...input3.limit !== void 0 ? { limit: input3.limit } : {},
|
|
126038
|
-
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
126039
|
-
},
|
|
126040
|
-
api
|
|
126041
|
-
)
|
|
126042
|
-
});
|
|
126043
|
-
}
|
|
126044
|
-
async function createWeeklyReportChannelCommand(input3, api) {
|
|
126045
|
-
try {
|
|
126046
|
-
const channel = await api.createWeeklyReportChannel({
|
|
126047
|
-
bearerToken: input3.bearerToken,
|
|
126048
|
-
projectId: input3.projectId,
|
|
126049
|
-
channel: input3.channel,
|
|
126050
|
-
config: input3.config,
|
|
126051
|
-
schedule: input3.schedule,
|
|
126052
|
-
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {}
|
|
126053
|
-
});
|
|
126054
|
-
return {
|
|
126055
|
-
exitCode: 0,
|
|
126056
|
-
output: input3.json ? JSON.stringify({ channel }) : `Weekly report channel created: ${channel.channel_id}`
|
|
126057
|
-
};
|
|
126058
|
-
} catch (error2) {
|
|
126059
|
-
return { exitCode: mapErrorToExitCode23(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
126060
|
-
}
|
|
126061
|
-
}
|
|
126062
|
-
async function createWeeklyReportChannelWithAuthCommand(input3, dependencies) {
|
|
126063
|
-
return runAuthenticatedCliCommand(input3, {
|
|
126064
|
-
createApi: createAuthenticatedWeeklyReportApi,
|
|
126065
|
-
dependencies,
|
|
126066
|
-
runCommand: (authState, api) => createWeeklyReportChannelCommand(
|
|
126067
|
-
{
|
|
126068
|
-
bearerToken: authState.bearer_token,
|
|
126069
|
-
projectId: input3.projectId,
|
|
126070
|
-
channel: input3.channel,
|
|
126071
|
-
config: input3.config,
|
|
126072
|
-
schedule: input3.schedule,
|
|
126073
|
-
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {},
|
|
126074
|
-
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
126075
|
-
},
|
|
126076
|
-
api
|
|
126077
|
-
)
|
|
126078
|
-
});
|
|
126079
|
-
}
|
|
126080
|
-
async function updateWeeklyReportChannelCommand(input3, api) {
|
|
126081
|
-
try {
|
|
126082
|
-
const channel = await api.updateWeeklyReportChannel({
|
|
126083
|
-
bearerToken: input3.bearerToken,
|
|
126084
|
-
channelId: input3.channelId,
|
|
126085
|
-
...input3.config !== void 0 ? { config: input3.config } : {},
|
|
126086
|
-
...input3.schedule !== void 0 ? { schedule: input3.schedule } : {},
|
|
126087
|
-
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {}
|
|
126088
|
-
});
|
|
126089
|
-
return {
|
|
126090
|
-
exitCode: 0,
|
|
126091
|
-
output: input3.json ? JSON.stringify({ channel }) : `Weekly report channel updated: ${channel.channel_id}`
|
|
126092
|
-
};
|
|
126093
|
-
} catch (error2) {
|
|
126094
|
-
return { exitCode: mapErrorToExitCode23(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
126307
|
+
// src/webhook-command-handler.ts
|
|
126308
|
+
function readWebhookFilters(parsedArgv) {
|
|
126309
|
+
const explicitFilters = readJsonOption(parsedArgv, "filters-json");
|
|
126310
|
+
if (explicitFilters !== void 0) {
|
|
126311
|
+
if (["environment", "service", "severity-min", "bundle-type", "verification"].some(
|
|
126312
|
+
(option) => parsedArgv.options.has(option)
|
|
126313
|
+
)) {
|
|
126314
|
+
throw new CliInputError("--filters-json cannot be combined with individual filter options.");
|
|
126315
|
+
}
|
|
126316
|
+
const parsed = WebhookFiltersSchema.safeParse(explicitFilters);
|
|
126317
|
+
if (!parsed.success) {
|
|
126318
|
+
throw new CliInputError("Invalid value for --filters-json.");
|
|
126319
|
+
}
|
|
126320
|
+
return parsed.data;
|
|
126095
126321
|
}
|
|
126096
|
-
}
|
|
126097
|
-
|
|
126098
|
-
|
|
126099
|
-
|
|
126100
|
-
|
|
126101
|
-
|
|
126102
|
-
|
|
126103
|
-
|
|
126104
|
-
channelId: input3.channelId,
|
|
126105
|
-
...input3.config !== void 0 ? { config: input3.config } : {},
|
|
126106
|
-
...input3.schedule !== void 0 ? { schedule: input3.schedule } : {},
|
|
126107
|
-
...input3.isEnabled !== void 0 ? { isEnabled: input3.isEnabled } : {},
|
|
126108
|
-
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
126109
|
-
},
|
|
126110
|
-
api
|
|
126111
|
-
)
|
|
126112
|
-
});
|
|
126113
|
-
}
|
|
126114
|
-
async function deleteWeeklyReportChannelCommand(input3, api) {
|
|
126115
|
-
try {
|
|
126116
|
-
const deleted = await api.deleteWeeklyReportChannel({
|
|
126117
|
-
bearerToken: input3.bearerToken,
|
|
126118
|
-
channelId: input3.channelId
|
|
126119
|
-
});
|
|
126120
|
-
return {
|
|
126121
|
-
exitCode: 0,
|
|
126122
|
-
output: input3.json ? JSON.stringify({ channel: deleted }) : `Weekly report channel deleted: ${deleted.channel_id}`
|
|
126123
|
-
};
|
|
126124
|
-
} catch (error2) {
|
|
126125
|
-
return { exitCode: mapErrorToExitCode23(error2), output: error2 instanceof Error ? error2.message : String(error2) };
|
|
126322
|
+
const filters = {};
|
|
126323
|
+
for (const [option, field] of [
|
|
126324
|
+
["environment", "environment"],
|
|
126325
|
+
["service", "service"],
|
|
126326
|
+
["bundle-type", "bundle_type"]
|
|
126327
|
+
]) {
|
|
126328
|
+
const values = readCsvOption(parsedArgv, option);
|
|
126329
|
+
if (values !== void 0) filters[field] = values;
|
|
126126
126330
|
}
|
|
126331
|
+
const severityMin = readStringOption(parsedArgv, "severity-min");
|
|
126332
|
+
if (severityMin !== void 0) filters["severity_min"] = severityMin;
|
|
126333
|
+
const verification = readBooleanStringOption(parsedArgv, "verification");
|
|
126334
|
+
if (verification !== void 0) filters["verification"] = verification;
|
|
126335
|
+
return Object.keys(filters).length > 0 ? filters : void 0;
|
|
126127
126336
|
}
|
|
126128
|
-
async function deleteWeeklyReportChannelWithAuthCommand(input3, dependencies) {
|
|
126129
|
-
return runAuthenticatedCliCommand(input3, {
|
|
126130
|
-
createApi: createAuthenticatedWeeklyReportApi,
|
|
126131
|
-
dependencies,
|
|
126132
|
-
runCommand: (authState, api) => deleteWeeklyReportChannelCommand(
|
|
126133
|
-
{
|
|
126134
|
-
bearerToken: authState.bearer_token,
|
|
126135
|
-
channelId: input3.channelId,
|
|
126136
|
-
...input3.json !== void 0 ? { json: input3.json } : {}
|
|
126137
|
-
},
|
|
126138
|
-
api
|
|
126139
|
-
)
|
|
126140
|
-
});
|
|
126141
|
-
}
|
|
126142
|
-
|
|
126143
|
-
// src/management-webhook-alert-slack-weekly-command-handlers.ts
|
|
126144
126337
|
async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
126145
126338
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
126146
126339
|
if (action === "list") {
|
|
@@ -126191,28 +126384,8 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126191
126384
|
url,
|
|
126192
126385
|
events: events2
|
|
126193
126386
|
});
|
|
126194
|
-
const filters =
|
|
126195
|
-
|
|
126196
|
-
if (environment !== void 0) {
|
|
126197
|
-
filters["environment"] = environment;
|
|
126198
|
-
}
|
|
126199
|
-
const service = readCsvOption(parsedArgv, "service");
|
|
126200
|
-
if (service !== void 0) {
|
|
126201
|
-
filters["service"] = service;
|
|
126202
|
-
}
|
|
126203
|
-
const severityMin = readStringOption(parsedArgv, "severity-min");
|
|
126204
|
-
if (severityMin !== void 0) {
|
|
126205
|
-
filters["severity_min"] = severityMin;
|
|
126206
|
-
}
|
|
126207
|
-
const bundleType = readCsvOption(parsedArgv, "bundle-type");
|
|
126208
|
-
if (bundleType !== void 0) {
|
|
126209
|
-
filters["bundle_type"] = bundleType;
|
|
126210
|
-
}
|
|
126211
|
-
const verification = readBooleanStringOption(parsedArgv, "verification");
|
|
126212
|
-
if (verification !== void 0) {
|
|
126213
|
-
filters["verification"] = verification;
|
|
126214
|
-
}
|
|
126215
|
-
if (Object.keys(filters).length > 0) {
|
|
126387
|
+
const filters = readWebhookFilters(parsedArgv);
|
|
126388
|
+
if (filters !== void 0) {
|
|
126216
126389
|
input3.filters = filters;
|
|
126217
126390
|
}
|
|
126218
126391
|
const isEnabled = readBooleanStringOption(parsedArgv, "is-enabled");
|
|
@@ -126233,6 +126406,7 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126233
126406
|
"severity-min",
|
|
126234
126407
|
"bundle-type",
|
|
126235
126408
|
"verification",
|
|
126409
|
+
"filters-json",
|
|
126236
126410
|
"is-enabled"
|
|
126237
126411
|
]);
|
|
126238
126412
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
@@ -126252,28 +126426,8 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126252
126426
|
if (events2 !== void 0) {
|
|
126253
126427
|
input3.events = events2;
|
|
126254
126428
|
}
|
|
126255
|
-
const filters =
|
|
126256
|
-
|
|
126257
|
-
if (environment !== void 0) {
|
|
126258
|
-
filters["environment"] = environment;
|
|
126259
|
-
}
|
|
126260
|
-
const service = readCsvOption(parsedArgv, "service");
|
|
126261
|
-
if (service !== void 0) {
|
|
126262
|
-
filters["service"] = service;
|
|
126263
|
-
}
|
|
126264
|
-
const severityMin = readStringOption(parsedArgv, "severity-min");
|
|
126265
|
-
if (severityMin !== void 0) {
|
|
126266
|
-
filters["severity_min"] = severityMin;
|
|
126267
|
-
}
|
|
126268
|
-
const bundleType = readCsvOption(parsedArgv, "bundle-type");
|
|
126269
|
-
if (bundleType !== void 0) {
|
|
126270
|
-
filters["bundle_type"] = bundleType;
|
|
126271
|
-
}
|
|
126272
|
-
const verification = readBooleanStringOption(parsedArgv, "verification");
|
|
126273
|
-
if (verification !== void 0) {
|
|
126274
|
-
filters["verification"] = verification;
|
|
126275
|
-
}
|
|
126276
|
-
if (Object.keys(filters).length > 0) {
|
|
126429
|
+
const filters = readWebhookFilters(parsedArgv);
|
|
126430
|
+
if (filters !== void 0) {
|
|
126277
126431
|
input3.filters = filters;
|
|
126278
126432
|
}
|
|
126279
126433
|
const isEnabled = readBooleanStringOption(parsedArgv, "is-enabled");
|
|
@@ -126312,10 +126466,11 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126312
126466
|
});
|
|
126313
126467
|
const eventType = readStringOption(parsedArgv, "event");
|
|
126314
126468
|
if (eventType !== void 0) {
|
|
126315
|
-
|
|
126469
|
+
const parsedEvent = WebhookEventTypeSchema.safeParse(eventType);
|
|
126470
|
+
if (!parsedEvent.success) {
|
|
126316
126471
|
throw new CliInputError("Invalid value for --event.");
|
|
126317
126472
|
}
|
|
126318
|
-
input3.eventType =
|
|
126473
|
+
input3.eventType = parsedEvent.data;
|
|
126319
126474
|
}
|
|
126320
126475
|
return await (dependencies.testWebhookCommand ?? testWebhookWithAuthCommand)(input3);
|
|
126321
126476
|
}
|
|
@@ -126334,7 +126489,9 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126334
126489
|
if (limit !== void 0) {
|
|
126335
126490
|
input3.limit = limit;
|
|
126336
126491
|
}
|
|
126337
|
-
return await (dependencies.listWebhookDeliveriesCommand ?? listWebhookDeliveriesWithAuthCommand)(
|
|
126492
|
+
return await (dependencies.listWebhookDeliveriesCommand ?? listWebhookDeliveriesWithAuthCommand)(
|
|
126493
|
+
input3
|
|
126494
|
+
);
|
|
126338
126495
|
}
|
|
126339
126496
|
if (action === "retry") {
|
|
126340
126497
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
@@ -126348,10 +126505,14 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
126348
126505
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id"),
|
|
126349
126506
|
deliveryId: requirePositional(parsedArgv, 3, "delivery-id")
|
|
126350
126507
|
});
|
|
126351
|
-
return await (dependencies.retryWebhookDeliveryCommand ?? retryWebhookDeliveryWithAuthCommand)(
|
|
126508
|
+
return await (dependencies.retryWebhookDeliveryCommand ?? retryWebhookDeliveryWithAuthCommand)(
|
|
126509
|
+
input3
|
|
126510
|
+
);
|
|
126352
126511
|
}
|
|
126353
126512
|
throw new CliInputError("Unknown webhook command.");
|
|
126354
126513
|
}
|
|
126514
|
+
|
|
126515
|
+
// src/management-webhook-alert-slack-weekly-command-handlers.ts
|
|
126355
126516
|
async function handleAlertCommand(parsedArgv, dependencies) {
|
|
126356
126517
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
126357
126518
|
if (action === "groups" || action === "group") {
|
|
@@ -126457,7 +126618,9 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
126457
126618
|
if (isEnabled !== void 0) {
|
|
126458
126619
|
input3.isEnabled = isEnabled;
|
|
126459
126620
|
}
|
|
126460
|
-
return await (dependencies.createAlertCommand ?? createAlertWithAuthCommand)(
|
|
126621
|
+
return await (dependencies.createAlertCommand ?? createAlertWithAuthCommand)(
|
|
126622
|
+
input3
|
|
126623
|
+
);
|
|
126461
126624
|
}
|
|
126462
126625
|
if (action === "update") {
|
|
126463
126626
|
expectNoUnknownOptions(parsedArgv, [
|
|
@@ -126521,7 +126684,9 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
126521
126684
|
if (input3.serviceId === void 0 && input3.channel === void 0 && input3.conditionType === void 0 && input3.severityMin === void 0 && input3.severityLifecycleScope === void 0 && input3.cooldownSeconds === void 0 && input3.config === void 0 && input3.rotateSigningSecret === void 0 && input3.isEnabled === void 0) {
|
|
126522
126685
|
throw new CliInputError("At least one alert field must be provided.");
|
|
126523
126686
|
}
|
|
126524
|
-
return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(
|
|
126687
|
+
return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(
|
|
126688
|
+
input3
|
|
126689
|
+
);
|
|
126525
126690
|
}
|
|
126526
126691
|
if (action === "delete") {
|
|
126527
126692
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
@@ -126568,7 +126733,9 @@ async function handleSlackCommand(parsedArgv, dependencies) {
|
|
|
126568
126733
|
if (returnTo !== void 0) {
|
|
126569
126734
|
input3.returnTo = returnTo;
|
|
126570
126735
|
}
|
|
126571
|
-
return await (dependencies.getSlackConnectUrlCommand ?? getSlackConnectUrlWithAuthCommand)(
|
|
126736
|
+
return await (dependencies.getSlackConnectUrlCommand ?? getSlackConnectUrlWithAuthCommand)(
|
|
126737
|
+
input3
|
|
126738
|
+
);
|
|
126572
126739
|
}
|
|
126573
126740
|
if (action === "test") {
|
|
126574
126741
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
@@ -126658,9 +126825,13 @@ async function handleWeeklyReportCommand(parsedArgv, dependencies) {
|
|
|
126658
126825
|
let weeklyReportConfig;
|
|
126659
126826
|
if (channel === "slack") {
|
|
126660
126827
|
if (typeof config2["slack_destination_id"] === "string") {
|
|
126661
|
-
weeklyReportConfig = {
|
|
126828
|
+
weeklyReportConfig = {
|
|
126829
|
+
slackDestinationId: String(config2["slack_destination_id"])
|
|
126830
|
+
};
|
|
126662
126831
|
} else {
|
|
126663
|
-
weeklyReportConfig = {
|
|
126832
|
+
weeklyReportConfig = {
|
|
126833
|
+
webhookUrl: String(config2["webhook_url"])
|
|
126834
|
+
};
|
|
126664
126835
|
}
|
|
126665
126836
|
} else {
|
|
126666
126837
|
weeklyReportConfig = { to: config2.to };
|
|
@@ -126700,7 +126871,9 @@ async function handleWeeklyReportCommand(parsedArgv, dependencies) {
|
|
|
126700
126871
|
const timezone = readStringOption(parsedArgv, "timezone");
|
|
126701
126872
|
if (dayOfWeek !== void 0 || hourOfDay !== void 0 || timezone !== void 0) {
|
|
126702
126873
|
if (dayOfWeek === void 0 || hourOfDay === void 0 || timezone === void 0) {
|
|
126703
|
-
throw new CliInputError(
|
|
126874
|
+
throw new CliInputError(
|
|
126875
|
+
"Weekly report schedule updates require --day-of-week, --hour-of-day, and --timezone together."
|
|
126876
|
+
);
|
|
126704
126877
|
}
|
|
126705
126878
|
input3.schedule = { dayOfWeek, hourOfDay, timezone };
|
|
126706
126879
|
}
|
|
@@ -126709,7 +126882,11 @@ async function handleWeeklyReportCommand(parsedArgv, dependencies) {
|
|
|
126709
126882
|
if (typeof config2 !== "object" || config2 === null) {
|
|
126710
126883
|
throw new CliInputError("Invalid value for --config-json.");
|
|
126711
126884
|
}
|
|
126712
|
-
input3.config = "slack_destination_id" in config2 ? {
|
|
126885
|
+
input3.config = "slack_destination_id" in config2 ? {
|
|
126886
|
+
slackDestinationId: String(
|
|
126887
|
+
config2["slack_destination_id"]
|
|
126888
|
+
)
|
|
126889
|
+
} : "webhook_url" in config2 ? { webhookUrl: String(config2["webhook_url"]) } : { to: config2.to };
|
|
126713
126890
|
}
|
|
126714
126891
|
const isEnabled = readBooleanStringOption(parsedArgv, "is-enabled");
|
|
126715
126892
|
if (isEnabled !== void 0) {
|
|
@@ -126776,7 +126953,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
|
|
|
126776
126953
|
// package.json
|
|
126777
126954
|
var package_default = {
|
|
126778
126955
|
name: "@debugbundle/cli",
|
|
126779
|
-
version: "1.
|
|
126956
|
+
version: "1.14.0",
|
|
126780
126957
|
private: false,
|
|
126781
126958
|
description: "Command-line interface for DebugBundle",
|
|
126782
126959
|
license: "Apache-2.0",
|