@sentry/api 0.444.0 → 0.446.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.
Files changed (58) hide show
  1. package/README.md +28 -0
  2. package/dist/api-client/api-path.d.ts +34 -0
  3. package/dist/api-client/auth-token.d.ts +6 -0
  4. package/dist/api-client/core.d.ts +84 -0
  5. package/dist/api-client/endpoints/client-keys.d.ts +38 -0
  6. package/dist/api-client/endpoints/dashboards.d.ts +23 -0
  7. package/dist/api-client/endpoints/index.d.ts +18 -0
  8. package/dist/api-client/endpoints/index.js +762 -0
  9. package/dist/api-client/endpoints/monitors.d.ts +49 -0
  10. package/dist/api-client/endpoints/organizations.d.ts +35 -0
  11. package/dist/api-client/endpoints/profiling.d.ts +32 -0
  12. package/dist/api-client/endpoints/projects.d.ts +63 -0
  13. package/dist/api-client/endpoints/releases.d.ts +45 -0
  14. package/dist/api-client/endpoints/replays.d.ts +53 -0
  15. package/dist/api-client/endpoints/repositories.d.ts +31 -0
  16. package/dist/api-client/endpoints/snapshots.d.ts +29 -0
  17. package/dist/api-client/endpoints/teams.d.ts +23 -0
  18. package/dist/api-client/endpoints/traces.d.ts +25 -0
  19. package/dist/api-client/endpoints/uptime-monitors.d.ts +61 -0
  20. package/dist/api-client/errors.d.ts +151 -0
  21. package/dist/api-client/idempotent-operations.d.ts +33 -0
  22. package/dist/api-client/index.d.ts +20 -0
  23. package/dist/api-client/index.js +1647 -0
  24. package/dist/api-client/pagination.d.ts +119 -0
  25. package/dist/api-client/response-cache/body.d.ts +31 -0
  26. package/dist/api-client/response-cache/index.d.ts +14 -0
  27. package/dist/api-client/response-cache/invalidation.d.ts +42 -0
  28. package/dist/api-client/response-cache/keys.d.ts +25 -0
  29. package/dist/api-client/response-cache/memory-store.d.ts +37 -0
  30. package/dist/api-client/response-cache/policy.d.ts +81 -0
  31. package/dist/api-client/response-cache/store.d.ts +52 -0
  32. package/dist/api-client/response-cache/tiers.d.ts +28 -0
  33. package/dist/api-client/response.d.ts +27 -0
  34. package/dist/api-client/retry.d.ts +57 -0
  35. package/dist/api-client/standard-schema.d.ts +65 -0
  36. package/dist/api-client/time-params.d.ts +46 -0
  37. package/dist/api-client/transport.d.ts +156 -0
  38. package/dist/api-client/validate.d.ts +22 -0
  39. package/dist/client/index.d.ts +1 -0
  40. package/dist/client/types.gen.d.ts +3 -2
  41. package/dist/client/utils.gen.d.ts +6 -4
  42. package/dist/core/auth.gen.d.ts +7 -0
  43. package/dist/core/bodySerializer.gen.d.ts +4 -4
  44. package/dist/core/params.gen.d.ts +1 -1
  45. package/dist/core/queryKeySerializer.gen.d.ts +1 -1
  46. package/dist/core/serverSentEvents.gen.d.ts +1 -1
  47. package/dist/core/types.gen.d.ts +1 -1
  48. package/dist/index.js +17 -27
  49. package/dist/operations.js +26 -22
  50. package/dist/query-enums.gen.d.ts +3 -1
  51. package/dist/sdk.gen.d.ts +275 -275
  52. package/dist/sentry-client.gen.d.ts +279 -279
  53. package/dist/types.gen.d.ts +33 -22
  54. package/dist/valibot.gen.d.ts +10148 -7222
  55. package/dist/valibot.js +16113 -15129
  56. package/dist/zod.gen.d.ts +29212 -20450
  57. package/dist/zod.js +16465 -26585
  58. package/package.json +19 -3
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Cron monitor endpoints. With a project, reads go to the project's
3
+ * endpoints, otherwise to the organization's. Each wrapper validates the
4
+ * response with the schema the host passes, so the host's schema decides the
5
+ * result type.
6
+ */
7
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
8
+ export type ListMonitorsParams = {
9
+ organizationSlug: string;
10
+ projectSlug?: string;
11
+ environment?: string;
12
+ owner?: string;
13
+ query?: string;
14
+ /** Page size. */
15
+ limit?: number;
16
+ };
17
+ /** The first page of the organization's cron monitors. */
18
+ export declare function listMonitors<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, environment, owner, query, limit, }: ListMonitorsParams, schema: ResponseSchema<T>): Promise<T>;
19
+ export type MonitorParams = {
20
+ organizationSlug: string;
21
+ projectSlug?: string;
22
+ monitorSlug: string;
23
+ environment?: string;
24
+ };
25
+ /** One cron monitor. */
26
+ export declare function getMonitor<T>({ core, origin }: ApiTarget, params: MonitorParams, schema: ResponseSchema<T>): Promise<T>;
27
+ /**
28
+ * Schedule deletion of one environment of a cron monitor. Sentry answers 202
29
+ * with no body; a 404 (already gone) is not an error.
30
+ */
31
+ export declare function deleteMonitorEnvironment({ core, origin }: ApiTarget, { organizationSlug, projectSlug, monitorSlug, environment, }: MonitorParams & {
32
+ projectSlug: string;
33
+ environment: string;
34
+ }): Promise<void>;
35
+ export type MonitorTimeRangeParams = MonitorParams & {
36
+ /** Relative range such as `24h`. Default: `24h` without `start` or `end`. */
37
+ statsPeriod?: string;
38
+ start?: string;
39
+ end?: string;
40
+ };
41
+ /** The first page of a cron monitor's check-ins in a time range. */
42
+ export declare function listMonitorCheckIns<T>({ core, origin }: ApiTarget, params: MonitorTimeRangeParams & {
43
+ limit?: number;
44
+ }, schema: ResponseSchema<T>): Promise<T>;
45
+ /** A cron monitor's check-in counts over a time range. */
46
+ export declare function getMonitorStats<T>({ core, origin }: ApiTarget, params: MonitorTimeRangeParams & {
47
+ /** Bucket size in seconds. */
48
+ rollup?: number;
49
+ }, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Organization and current-user endpoints. Each wrapper validates the
3
+ * response with the schema the host passes, so the host's schema decides the
4
+ * result type. Hosts pick the origin: user identity and the organization
5
+ * list live on the control host, an organization on its region.
6
+ */
7
+ import { type ApiTarget, type ListPage, type ResponseSchema } from "@sentry/api/client";
8
+ /** The user the request's credential belongs to (`GET /auth/`). */
9
+ export declare function getAuthenticatedUser<T>({ core, origin }: ApiTarget, schema: ResponseSchema<T>): Promise<T>;
10
+ export type ListOrganizationsParams = {
11
+ /** Filters by name or slug. */
12
+ query?: string;
13
+ /** Most organizations to return. Default: 25. */
14
+ limit?: number;
15
+ /** Resumes from a previous call's `nextCursor`. */
16
+ cursor?: string | null;
17
+ };
18
+ /** A page of the organizations the credential can access. */
19
+ export declare function listOrganizations<T>({ core, origin }: ApiTarget, params: ListOrganizationsParams, schema: ResponseSchema<T[]>): Promise<ListPage<T>>;
20
+ export type GetOrganizationParams = {
21
+ organizationSlug: string;
22
+ /** Include `features`, which Sentry omits otherwise. */
23
+ includeFeatureFlags?: boolean;
24
+ /** Set false to leave out projects and teams; Sentry defaults to true. */
25
+ detailed?: boolean;
26
+ };
27
+ /** One organization by slug. */
28
+ export declare function getOrganization<T>({ core, origin }: ApiTarget, params: GetOrganizationParams, schema: ResponseSchema<T>): Promise<T>;
29
+ export type UpdateAgenticOnboardingStatusParams = {
30
+ organizationSlug: string;
31
+ /** The status report, sent as the JSON body. */
32
+ update: object;
33
+ };
34
+ /** Report progress of an agent-driven onboarding run. */
35
+ export declare function updateAgenticOnboardingStatus<T>({ core, origin }: ApiTarget, { organizationSlug, update }: UpdateAgenticOnboardingStatusParams, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Profiling endpoints. Each wrapper validates the response with the schema
3
+ * the host passes, so the host's schema decides the result type.
4
+ */
5
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
6
+ export type GetFlamegraphParams = {
7
+ organizationSlug: string;
8
+ projectId: string | number;
9
+ /** Matched exactly; quotes and backslashes are escaped. */
10
+ transactionName: string;
11
+ /** Default: `7d`. */
12
+ statsPeriod?: string;
13
+ };
14
+ /** The aggregated flamegraph of a transaction's profiles. */
15
+ export declare function getFlamegraph<T>({ core, origin }: ApiTarget, { organizationSlug, projectId, transactionName, statsPeriod, }: GetFlamegraphParams, schema: ResponseSchema<T>): Promise<T>;
16
+ /** One transaction profile. */
17
+ export declare function getTransactionProfile<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlugOrId, profileId, }: {
18
+ organizationSlug: string;
19
+ projectSlugOrId: string | number;
20
+ profileId: string;
21
+ }, schema: ResponseSchema<T>): Promise<T>;
22
+ export type GetProfileChunksParams = {
23
+ organizationSlug: string;
24
+ profilerId: string;
25
+ projectId: string | number;
26
+ /** ISO timestamp. */
27
+ start: string;
28
+ /** ISO timestamp. */
29
+ end: string;
30
+ };
31
+ /** The continuous profile chunks of a profiler in a time range. */
32
+ export declare function getProfileChunks<T>({ core, origin }: ApiTarget, { organizationSlug, profilerId, projectId, start, end, }: GetProfileChunksParams, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Project endpoints: listing, reading, creating, and updating projects, and
3
+ * the teams assigned to a project. Each wrapper validates the response with
4
+ * the schema the host passes, so the host's schema decides the result type.
5
+ */
6
+ import { type ApiTarget, type ListPage, type ResponseSchema } from "@sentry/api/client";
7
+ export type ListProjectsParams = {
8
+ organizationSlug: string;
9
+ /** Filters by name or slug. */
10
+ query?: string;
11
+ /** Most projects to return. Default: 25. */
12
+ limit?: number;
13
+ /** Resumes from a previous call's `nextCursor`. */
14
+ cursor?: string | null;
15
+ };
16
+ /** A page of the organization's projects. */
17
+ export declare function listProjects<T>({ core, origin }: ApiTarget, params: ListProjectsParams, schema: ResponseSchema<T[]>): Promise<ListPage<T>>;
18
+ export type GetProjectParams = {
19
+ organizationSlug: string;
20
+ projectSlugOrId: string;
21
+ /** Return only the organization's ID and slug instead of all of it. */
22
+ collapse?: "organization";
23
+ };
24
+ /** One project by slug or ID. */
25
+ export declare function getProject<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlugOrId, collapse }: GetProjectParams, schema: ResponseSchema<T>): Promise<T>;
26
+ export type CreateProjectParams = {
27
+ organizationSlug: string;
28
+ /** The team that owns the new project. */
29
+ teamSlug: string;
30
+ name: string;
31
+ slug?: string | null;
32
+ platform?: string | null;
33
+ };
34
+ /** Create a project owned by a team. Empty `slug` and `platform` are left out. */
35
+ export declare function createProject<T>({ core, origin }: ApiTarget, { organizationSlug, teamSlug, name, slug, platform }: CreateProjectParams, schema: ResponseSchema<T>): Promise<T>;
36
+ export type UpdateProjectParams = {
37
+ organizationSlug: string;
38
+ projectSlug: string;
39
+ name?: string | null;
40
+ slug?: string | null;
41
+ platform?: string | null;
42
+ };
43
+ /** Update a project. Only non-empty fields are sent. */
44
+ export declare function updateProject<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, name, slug, platform }: UpdateProjectParams, schema: ResponseSchema<T>): Promise<T>;
45
+ export type ProjectTeamParams = {
46
+ organizationSlug: string;
47
+ projectSlug: string;
48
+ };
49
+ /**
50
+ * Every team assigned to a project, across all pages.
51
+ *
52
+ * @throws {Error} When a cursor repeats or the walk passes
53
+ * {@link MAX_LIST_PAGES}
54
+ */
55
+ export declare function listProjectTeams<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug }: ProjectTeamParams, schema: ResponseSchema<T[]>): Promise<T[]>;
56
+ /** Assign a team to a project. */
57
+ export declare function addProjectTeam({ core, origin }: ApiTarget, { organizationSlug, projectSlug, teamSlug, }: ProjectTeamParams & {
58
+ teamSlug: string;
59
+ }): Promise<void>;
60
+ /** Remove a team from a project. */
61
+ export declare function removeProjectTeam({ core, origin }: ApiTarget, { organizationSlug, projectSlug, teamSlug, }: ProjectTeamParams & {
62
+ teamSlug: string;
63
+ }): Promise<void>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Release endpoints: releases, their deploys and commits, and an event's
3
+ * suspect committers. With a project, release reads go to the project's
4
+ * endpoints, otherwise to the organization's. Each wrapper validates the
5
+ * response with the schema the host passes, so the host's schema decides the
6
+ * result type.
7
+ */
8
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
9
+ export type ListReleasesParams = {
10
+ organizationSlug: string;
11
+ projectSlug?: string;
12
+ /** Filters by version. */
13
+ query?: string;
14
+ /** Page size. */
15
+ limit?: number;
16
+ };
17
+ /** The first page of releases for the organization or one project. */
18
+ export declare function listReleases<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, query, limit }: ListReleasesParams, schema: ResponseSchema<T>): Promise<T>;
19
+ export type ReleaseParams = {
20
+ organizationSlug: string;
21
+ releaseVersion: string;
22
+ projectSlugOrId?: string;
23
+ };
24
+ /** One release, optionally with its health data. */
25
+ export declare function getRelease<T>({ core, origin }: ApiTarget, { organizationSlug, releaseVersion, projectSlugOrId, includeHealth, }: ReleaseParams & {
26
+ includeHealth?: boolean;
27
+ }, schema: ResponseSchema<T>): Promise<T>;
28
+ /**
29
+ * The first page of a release's deploys. A project narrows them, by ID when
30
+ * it is numeric and by slug otherwise.
31
+ */
32
+ export declare function listReleaseDeploys<T>({ core, origin }: ApiTarget, { organizationSlug, releaseVersion, projectSlugOrId, limit, }: ReleaseParams & {
33
+ limit?: number;
34
+ }, schema: ResponseSchema<T>): Promise<T>;
35
+ /** The first page of a release's commits. */
36
+ export declare function listReleaseCommits<T>({ core, origin }: ApiTarget, { organizationSlug, releaseVersion, projectSlugOrId, limit, }: ReleaseParams & {
37
+ limit?: number;
38
+ }, schema: ResponseSchema<T>): Promise<T>;
39
+ export type GetEventCommittersParams = {
40
+ organizationSlug: string;
41
+ projectSlug: string;
42
+ eventId: string;
43
+ };
44
+ /** The suspect commits of an event's issue, grouped by committer. */
45
+ export declare function getEventCommitters<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, eventId }: GetEventCommittersParams, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Session replay endpoints. Each wrapper validates the response with the
3
+ * schema the host passes, so the host's schema decides the result type.
4
+ */
5
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
6
+ export type SearchReplaysParams = {
7
+ organizationSlug: string;
8
+ query?: string;
9
+ /** Page size. */
10
+ limit?: number;
11
+ /** Numeric project ID. */
12
+ projectId?: string;
13
+ sort?: string;
14
+ environment?: string | string[];
15
+ statsPeriod?: string;
16
+ start?: string;
17
+ end?: string;
18
+ /** Fields to return. */
19
+ fields?: string[];
20
+ };
21
+ /** The first page of the organization's replays, in the `{ data }` envelope. */
22
+ export declare function searchReplays<T>({ core, origin }: ApiTarget, { organizationSlug, query, limit, projectId, sort, environment, statsPeriod, start, end, fields, }: SearchReplaysParams, schema: ResponseSchema<T>): Promise<T>;
23
+ /** One replay, in the `{ data }` envelope. */
24
+ export declare function getReplay<T>({ core, origin }: ApiTarget, { organizationSlug, replayId, }: {
25
+ organizationSlug: string;
26
+ replayId: string;
27
+ }, schema: ResponseSchema<T>): Promise<T>;
28
+ export type IssueReplayIdsParams = {
29
+ organizationSlug: string;
30
+ issueId: string | number;
31
+ dataSource: "discover" | "search_issues";
32
+ };
33
+ /**
34
+ * The IDs of an issue's replays in the last 90 days, across all projects,
35
+ * keyed by issue ID.
36
+ */
37
+ export declare function listIssueReplayIds<T>({ core, origin }: ApiTarget, { organizationSlug, issueId, dataSource }: IssueReplayIdsParams, schema: ResponseSchema<T>): Promise<T>;
38
+ export type ReplayRecordingSegmentsParams = {
39
+ organizationSlug: string;
40
+ projectSlugOrId: string;
41
+ replayId: string;
42
+ /** Most segments to visit. */
43
+ maxSegments: number;
44
+ };
45
+ /**
46
+ * Visit a replay's recording segments page by page, following the `Link`
47
+ * cursor. Segments go to `onSegment` as each page arrives instead of being
48
+ * collected, because full DOM snapshots make raw pages large.
49
+ */
50
+ export declare function visitReplayRecordingSegments<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlugOrId, replayId, maxSegments, }: ReplayRecordingSegmentsParams, pageSchema: ResponseSchema<T[]>, onSegment: (segment: T) => void): Promise<{
51
+ segmentsRead: number;
52
+ truncated: boolean;
53
+ }>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Repository endpoints: the organization's connected repositories and
3
+ * linking one to a project with a code mapping. Each wrapper validates the
4
+ * response with the schema the host passes, so the host's schema decides the
5
+ * result type.
6
+ */
7
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
8
+ export type ListRepositoriesParams = {
9
+ organizationSlug: string;
10
+ /** Filters by repository name. */
11
+ query?: string;
12
+ };
13
+ /**
14
+ * Every repository connected to the organization, across all pages.
15
+ *
16
+ * @throws {Error} When a cursor repeats or the walk passes
17
+ * {@link MAX_LIST_PAGES}
18
+ */
19
+ export declare function listRepositories<T>({ core, origin }: ApiTarget, { organizationSlug, query }: ListRepositoriesParams, schema: ResponseSchema<T[]>): Promise<T[]>;
20
+ export type LinkProjectRepositoryParams = {
21
+ organizationSlug: string;
22
+ projectSlug: string;
23
+ /** The repository's full name, such as `getsentry/sentry`. */
24
+ repository: string;
25
+ provider?: string | null;
26
+ };
27
+ /**
28
+ * Link a repository to a project with one code mapping whose stack and
29
+ * source roots are both the repository root.
30
+ */
31
+ export declare function linkProjectRepository<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, repository, provider, }: LinkProjectRepositoryParams, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Preprod snapshot endpoints. The responses are returned unvalidated: the
3
+ * callers read them as unknown JSON.
4
+ */
5
+ import { type ApiTarget } from "@sentry/api/client";
6
+ /** One snapshot, with compact image metadata unless `compactMetadata` is false. */
7
+ export declare function getSnapshot({ core, origin }: ApiTarget, { organizationSlug, snapshotId, compactMetadata, }: {
8
+ organizationSlug: string;
9
+ snapshotId: string;
10
+ compactMetadata?: boolean;
11
+ }): Promise<unknown>;
12
+ /** One image of a snapshot. */
13
+ export declare function getSnapshotImage({ core, origin }: ApiTarget, { organizationSlug, snapshotId, imageIdentifier, }: {
14
+ organizationSlug: string;
15
+ snapshotId: string;
16
+ imageIdentifier: string;
17
+ }): Promise<unknown>;
18
+ export type GetLatestBaseSnapshotParams = {
19
+ organizationSlug: string;
20
+ appId: string;
21
+ branch?: string;
22
+ /** Numeric project ID. */
23
+ project?: string;
24
+ projectSlug?: string;
25
+ /** Default: true. */
26
+ compactMetadata?: boolean;
27
+ };
28
+ /** The latest base snapshot of an app, optionally on one branch. */
29
+ export declare function getLatestBaseSnapshot({ core, origin }: ApiTarget, { organizationSlug, appId, branch, project, projectSlug, compactMetadata, }: GetLatestBaseSnapshotParams): Promise<unknown>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Team endpoints within an organization. Each wrapper validates the response
3
+ * with the schema the host passes, so the host's schema decides the result
4
+ * type.
5
+ */
6
+ import { type ApiTarget, type ListPage, type ResponseSchema } from "@sentry/api/client";
7
+ export type ListTeamsParams = {
8
+ organizationSlug: string;
9
+ /** Filters by name or slug. */
10
+ query?: string;
11
+ /** Most teams to return. Default: 25. */
12
+ limit?: number;
13
+ /** Resumes from a previous call's `nextCursor`. */
14
+ cursor?: string | null;
15
+ };
16
+ /** A page of the organization's teams. */
17
+ export declare function listTeams<T>({ core, origin }: ApiTarget, params: ListTeamsParams, schema: ResponseSchema<T[]>): Promise<ListPage<T>>;
18
+ export type CreateTeamParams = {
19
+ organizationSlug: string;
20
+ name: string;
21
+ };
22
+ /** Create a team in the organization. */
23
+ export declare function createTeam<T>({ core, origin }: ApiTarget, { organizationSlug, name }: CreateTeamParams, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Trace endpoints. Each wrapper validates the response with the schema the
3
+ * host passes, so the host's schema decides the result type.
4
+ */
5
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
6
+ export type TraceParams = {
7
+ organizationSlug: string;
8
+ /** 32-character hex trace ID. */
9
+ traceId: string;
10
+ /** Default: `14d`. */
11
+ statsPeriod?: string;
12
+ };
13
+ /** Span, error, and operation counts for a trace. */
14
+ export declare function getTraceMeta<T>({ core, origin }: ApiTarget, { organizationSlug, traceId, statsPeriod }: TraceParams, schema: ResponseSchema<T>): Promise<T>;
15
+ /**
16
+ * The trace's span tree. `limit` and `project` are the endpoint's declared
17
+ * parameters; the server currently ignores `project` and paginates
18
+ * internally, but they are still sent.
19
+ */
20
+ export declare function getTrace<T>({ core, origin }: ApiTarget, { organizationSlug, traceId, limit, project, statsPeriod, }: TraceParams & {
21
+ /** Span-count hint. Default: 1000. */
22
+ limit?: number;
23
+ /** Project filter hint. Default: `-1` (all projects). */
24
+ project?: string;
25
+ }, schema: ResponseSchema<T>): Promise<T>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Uptime monitor endpoints. Each wrapper validates the response with the
3
+ * schema the host passes, so the host's schema decides the result type.
4
+ */
5
+ import { type ApiTarget, type ResponseSchema } from "@sentry/api/client";
6
+ export type ListUptimeMonitorsParams = {
7
+ organizationSlug: string;
8
+ /** Numeric project ID; the endpoint filters by ID, not slug. */
9
+ projectId?: string;
10
+ environment?: string;
11
+ owner?: string;
12
+ query?: string;
13
+ /** Page size. */
14
+ limit?: number;
15
+ };
16
+ /** The first page of the organization's uptime monitors. */
17
+ export declare function listUptimeMonitors<T>({ core, origin }: ApiTarget, { organizationSlug, projectId, environment, owner, query, limit, }: ListUptimeMonitorsParams, schema: ResponseSchema<T>): Promise<T>;
18
+ export type UptimeMonitorParams = {
19
+ organizationSlug: string;
20
+ projectSlug: string;
21
+ uptimeMonitorId: string;
22
+ };
23
+ /** One uptime monitor. */
24
+ export declare function getUptimeMonitor<T>({ core, origin }: ApiTarget, params: UptimeMonitorParams, schema: ResponseSchema<T>): Promise<T>;
25
+ /** The first page of a monitor's checks in a time range, 24 hours by default. */
26
+ export declare function listUptimeMonitorChecks<T>({ core, origin }: ApiTarget, params: UptimeMonitorParams & {
27
+ statsPeriod?: string;
28
+ start?: string;
29
+ end?: string;
30
+ limit?: number;
31
+ }, schema: ResponseSchema<T>): Promise<T>;
32
+ /** The writable fields of an uptime monitor, in the order they are sent. */
33
+ export type UptimeMonitorFields = {
34
+ name?: string;
35
+ url?: string;
36
+ intervalSeconds?: number;
37
+ timeoutMs?: number;
38
+ method?: string;
39
+ headers?: Array<[string, string]>;
40
+ body?: string | null;
41
+ assertion?: unknown;
42
+ status?: "active" | "disabled";
43
+ owner?: string | null;
44
+ environment?: string | null;
45
+ traceSampling?: boolean;
46
+ responseCaptureEnabled?: boolean;
47
+ recoveryThreshold?: number;
48
+ downtimeThreshold?: number;
49
+ };
50
+ /** Create an uptime monitor in a project. */
51
+ export declare function createUptimeMonitor<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, ...fields }: {
52
+ organizationSlug: string;
53
+ projectSlug: string;
54
+ } & UptimeMonitorFields & Required<Pick<UptimeMonitorFields, "name" | "url" | "intervalSeconds" | "timeoutMs">>, schema: ResponseSchema<T>): Promise<T>;
55
+ /** Update an uptime monitor. Only the fields that are set are sent. */
56
+ export declare function updateUptimeMonitor<T>({ core, origin }: ApiTarget, { organizationSlug, projectSlug, uptimeMonitorId, ...fields }: UptimeMonitorParams & UptimeMonitorFields, schema: ResponseSchema<T>): Promise<T>;
57
+ /**
58
+ * Delete an uptime monitor. Sentry answers 202 with no body; a 404 (already
59
+ * gone) is not an error, so repeated deletes succeed.
60
+ */
61
+ export declare function deleteUptimeMonitor({ core, origin }: ApiTarget, params: UptimeMonitorParams): Promise<void>;
@@ -0,0 +1,151 @@
1
+ import { SentryApiError } from "@sentry/api";
2
+ /**
3
+ * Error thrown when user input validation fails.
4
+ * These errors should be returned to the user directly without logging to Sentry.
5
+ */
6
+ export declare class UserInputError extends Error {
7
+ constructor(message: string, options?: ErrorOptions);
8
+ }
9
+ /**
10
+ * Error thrown when configuration is invalid or missing.
11
+ * These errors should be returned to the user directly without logging to Sentry.
12
+ * Typically used for environment configuration issues, connection settings, etc.
13
+ */
14
+ export declare class ConfigurationError extends Error {
15
+ constructor(message: string, options?: ErrorOptions);
16
+ }
17
+ /**
18
+ * API Error Class Hierarchy
19
+ *
20
+ * This module defines a hierarchical error system for the Sentry API client
21
+ * that automatically categorizes errors based on HTTP status codes.
22
+ *
23
+ * Key principles:
24
+ * - Every class extends `SentryApiError`, the error the generated operations
25
+ * return, so `instanceof SentryApiError` matches API failures from both the
26
+ * operations and the request core
27
+ * - 4xx errors (ApiClientError) are user input errors, not reported to Sentry
28
+ * - 5xx errors (ApiServerError) are system errors, reported to Sentry
29
+ * - Specific error types provide additional context and helper methods
30
+ * - The hierarchy enables type-safe error handling without manual status checks
31
+ */
32
+ /**
33
+ * Base class for the request core's API errors.
34
+ * Contains common properties for all API error types.
35
+ * Status is optional since some errors (like client-side validation) don't have HTTP status codes.
36
+ * `body` is the parsed response body, the same value as `responseBody`;
37
+ * `response` is not kept, since the core has consumed it.
38
+ */
39
+ export declare class ApiError extends SentryApiError<number | undefined, unknown, false> {
40
+ readonly detail?: string | undefined;
41
+ readonly responseBody?: unknown | undefined;
42
+ constructor(message: string, status?: number, detail?: string | undefined, responseBody?: unknown | undefined);
43
+ }
44
+ /**
45
+ * Client errors (4xx) - User input errors that should NOT be reported to Sentry.
46
+ * These typically indicate issues with the request that the user can fix.
47
+ * Also includes client-side validation errors that don't have HTTP status codes.
48
+ */
49
+ export declare class ApiClientError extends ApiError {
50
+ constructor(message: string, status?: number, detail?: string, responseBody?: unknown);
51
+ /**
52
+ * Convert to a user-friendly formatted message.
53
+ * Returns the standard format: "API error (status): message" or just "API error: message" if no status.
54
+ * For 404 errors, adds helpful context about checking parameters.
55
+ */
56
+ toUserMessage(): string;
57
+ /**
58
+ * Check if this is a permission/authorization error (403)
59
+ */
60
+ isPermissionError(): boolean;
61
+ /**
62
+ * Check if this is a not found error (404)
63
+ */
64
+ isNotFoundError(): boolean;
65
+ /**
66
+ * Check if this is a validation error (400 or 422)
67
+ */
68
+ isValidationError(): boolean;
69
+ /**
70
+ * Check if this is an authentication error (401)
71
+ */
72
+ isAuthenticationError(): boolean;
73
+ /**
74
+ * Check if this is a rate limit error (429)
75
+ */
76
+ isRateLimitError(): boolean;
77
+ }
78
+ /**
79
+ * Permission denied error (403).
80
+ * Includes special handling for multi-project access errors.
81
+ */
82
+ export declare class ApiPermissionError extends ApiClientError {
83
+ constructor(message: string, detail?: string, responseBody?: unknown);
84
+ /**
85
+ * Check if this is the specific multi-project access error
86
+ */
87
+ isMultiProjectAccessError(): boolean;
88
+ }
89
+ /**
90
+ * Resource not found error (404).
91
+ * Can include additional context about what resource was not found.
92
+ */
93
+ export declare class ApiNotFoundError extends ApiClientError {
94
+ readonly resourceType?: string | undefined;
95
+ readonly resourceId?: string | undefined;
96
+ constructor(message: string, detail?: string, responseBody?: unknown, resourceType?: string | undefined, resourceId?: string | undefined);
97
+ }
98
+ /**
99
+ * Validation error (400 or 422 for API responses, or no status for client-side validation).
100
+ * Indicates the request was malformed or contained invalid data.
101
+ */
102
+ export declare class ApiValidationError extends ApiClientError {
103
+ readonly validationErrors?: Record<string, string[]> | undefined;
104
+ constructor(message: string, status?: 400 | 422, detail?: string, responseBody?: unknown, validationErrors?: Record<string, string[]> | undefined);
105
+ }
106
+ /**
107
+ * Authentication error (401).
108
+ * Indicates the request lacks valid authentication credentials.
109
+ */
110
+ export declare class ApiAuthenticationError extends ApiClientError {
111
+ constructor(message: string, detail?: string, responseBody?: unknown);
112
+ }
113
+ /**
114
+ * Rate limit error (429).
115
+ * `retryAfterMs` comes from the response's `Retry-After` or
116
+ * `X-Sentry-Rate-Limit-Reset` header, when it has one.
117
+ */
118
+ export declare class ApiRateLimitError extends ApiClientError {
119
+ readonly retryAfterMs?: number | undefined;
120
+ constructor(message: string, detail?: string, responseBody?: unknown, retryAfterMs?: number | undefined);
121
+ toUserMessage(): string;
122
+ }
123
+ /**
124
+ * Server errors (5xx) - System errors that SHOULD be reported to Sentry.
125
+ * These indicate problems with the server that are not the user's fault.
126
+ */
127
+ export declare class ApiServerError extends ApiError {
128
+ constructor(message: string, status: number, detail?: string, responseBody?: unknown);
129
+ /**
130
+ * Check if this is a gateway/proxy error (502, 503, 504)
131
+ */
132
+ isGatewayError(): boolean;
133
+ /**
134
+ * Check if this is an internal server error (500)
135
+ */
136
+ isInternalError(): boolean;
137
+ }
138
+ /**
139
+ * Factory function to create the appropriate error type based on HTTP status code.
140
+ * This centralizes the logic for determining which error class to instantiate.
141
+ * This is only used for actual API responses, so status is required.
142
+ */
143
+ export declare function createApiError(message: string, status: number, detail?: string, responseBody?: unknown, retryAfterMs?: number): ApiError;
144
+ /**
145
+ * Returns true if `error` is an `ApiAuthenticationError`, either directly or
146
+ * anywhere within the first few levels of `error.cause`. Tools that wrap
147
+ * upstream errors as `throw new Error(msg, { cause: apiError })` would
148
+ * otherwise hide the 401 signal from a direct `instanceof` check. Bounded
149
+ * depth guards against accidental cycles.
150
+ */
151
+ export declare function isApiAuthenticationErrorDeep(error: unknown): boolean;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Matching for the writes Sentry declares safe to replay, for the transport's
3
+ * `isIdempotent`. `@sentry/api` marks them `idempotent` from Sentry's
4
+ * `x-sentry-idempotent` OpenAPI extension, so no product hard-codes which
5
+ * writes may retry. Each product chooses how it loads the catalog: the CLI
6
+ * extracts the list at build time to keep startup fast, and MCP reads
7
+ * `@sentry/api/operations` directly.
8
+ */
9
+ /** A non-safe operation Sentry marks idempotent. */
10
+ export type IdempotentOperation = {
11
+ /** Uppercase HTTP method */
12
+ method: string;
13
+ /** OpenAPI path template, such as `/api/0/organizations/{org}/chunk-upload/` */
14
+ path: string;
15
+ };
16
+ /**
17
+ * The writes in a catalog that Sentry marks idempotent, sorted by path then
18
+ * method. Safe methods already retry, so they are left out to keep the list
19
+ * every request checks small.
20
+ */
21
+ export declare function selectIdempotentWrites(operations: readonly {
22
+ method: string;
23
+ path: string;
24
+ idempotent: boolean;
25
+ }[]): IdempotentOperation[];
26
+ /**
27
+ * Build `isIdempotent(method, url)` for a list of writes. The list is read on
28
+ * the first call, so a caller may pass a thunk that loads it lazily.
29
+ *
30
+ * Matches from the `/api/` segment on, so a self-hosted install served under
31
+ * a path prefix still matches.
32
+ */
33
+ export declare function createIdempotentOperationMatcher(operations: () => readonly IdempotentOperation[]): (method: string, url: string) => boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `@sentry/api/client`: the request layer the generated operations and
3
+ * hand-written endpoint wrappers share. It uses only web-standard APIs, so it
4
+ * runs in Node, Cloudflare Workers, and browsers. Hosts inject what differs
5
+ * between them: credentials, cache storage, the fresh-read scope, logging,
6
+ * and spans.
7
+ */
8
+ export * from "./api-path.js";
9
+ export * from "./auth-token.js";
10
+ export * from "./core.js";
11
+ export * from "./errors.js";
12
+ export * from "./idempotent-operations.js";
13
+ export * from "./pagination.js";
14
+ export * from "./response.js";
15
+ export * from "./response-cache/index.js";
16
+ export * from "./retry.js";
17
+ export type { StandardSchemaV1 } from "./standard-schema.js";
18
+ export * from "./time-params.js";
19
+ export * from "./transport.js";
20
+ export * from "./validate.js";