@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.
- package/README.md +28 -0
- package/dist/api-client/api-path.d.ts +34 -0
- package/dist/api-client/auth-token.d.ts +6 -0
- package/dist/api-client/core.d.ts +84 -0
- package/dist/api-client/endpoints/client-keys.d.ts +38 -0
- package/dist/api-client/endpoints/dashboards.d.ts +23 -0
- package/dist/api-client/endpoints/index.d.ts +18 -0
- package/dist/api-client/endpoints/index.js +762 -0
- package/dist/api-client/endpoints/monitors.d.ts +49 -0
- package/dist/api-client/endpoints/organizations.d.ts +35 -0
- package/dist/api-client/endpoints/profiling.d.ts +32 -0
- package/dist/api-client/endpoints/projects.d.ts +63 -0
- package/dist/api-client/endpoints/releases.d.ts +45 -0
- package/dist/api-client/endpoints/replays.d.ts +53 -0
- package/dist/api-client/endpoints/repositories.d.ts +31 -0
- package/dist/api-client/endpoints/snapshots.d.ts +29 -0
- package/dist/api-client/endpoints/teams.d.ts +23 -0
- package/dist/api-client/endpoints/traces.d.ts +25 -0
- package/dist/api-client/endpoints/uptime-monitors.d.ts +61 -0
- package/dist/api-client/errors.d.ts +151 -0
- package/dist/api-client/idempotent-operations.d.ts +33 -0
- package/dist/api-client/index.d.ts +20 -0
- package/dist/api-client/index.js +1647 -0
- package/dist/api-client/pagination.d.ts +119 -0
- package/dist/api-client/response-cache/body.d.ts +31 -0
- package/dist/api-client/response-cache/index.d.ts +14 -0
- package/dist/api-client/response-cache/invalidation.d.ts +42 -0
- package/dist/api-client/response-cache/keys.d.ts +25 -0
- package/dist/api-client/response-cache/memory-store.d.ts +37 -0
- package/dist/api-client/response-cache/policy.d.ts +81 -0
- package/dist/api-client/response-cache/store.d.ts +52 -0
- package/dist/api-client/response-cache/tiers.d.ts +28 -0
- package/dist/api-client/response.d.ts +27 -0
- package/dist/api-client/retry.d.ts +57 -0
- package/dist/api-client/standard-schema.d.ts +65 -0
- package/dist/api-client/time-params.d.ts +46 -0
- package/dist/api-client/transport.d.ts +156 -0
- package/dist/api-client/validate.d.ts +22 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/types.gen.d.ts +3 -2
- package/dist/client/utils.gen.d.ts +6 -4
- package/dist/core/auth.gen.d.ts +7 -0
- package/dist/core/bodySerializer.gen.d.ts +4 -4
- package/dist/core/params.gen.d.ts +1 -1
- package/dist/core/queryKeySerializer.gen.d.ts +1 -1
- package/dist/core/serverSentEvents.gen.d.ts +1 -1
- package/dist/core/types.gen.d.ts +1 -1
- package/dist/index.js +17 -27
- package/dist/operations.js +26 -22
- package/dist/query-enums.gen.d.ts +3 -1
- package/dist/sdk.gen.d.ts +275 -275
- package/dist/sentry-client.gen.d.ts +279 -279
- package/dist/types.gen.d.ts +33 -22
- package/dist/valibot.gen.d.ts +10148 -7222
- package/dist/valibot.js +16113 -15129
- package/dist/zod.gen.d.ts +29212 -20450
- package/dist/zod.js +16465 -26585
- package/package.json +19 -3
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
// src/api-client/endpoints/client-keys.ts
|
|
2
|
+
import {
|
|
3
|
+
apiPath,
|
|
4
|
+
validateResponse
|
|
5
|
+
} from "@sentry/api/client";
|
|
6
|
+
async function listClientKeys({ core, origin }, { organizationSlug, projectSlug }, schema) {
|
|
7
|
+
const body = await core.requestJson(origin, apiPath`/projects/${organizationSlug}/${projectSlug}/keys/`);
|
|
8
|
+
return validateResponse(schema, body);
|
|
9
|
+
}
|
|
10
|
+
async function createClientKey({ core, origin }, {
|
|
11
|
+
organizationSlug,
|
|
12
|
+
projectSlug,
|
|
13
|
+
name
|
|
14
|
+
}, schema) {
|
|
15
|
+
const body = await core.requestJson(origin, apiPath`/projects/${organizationSlug}/${projectSlug}/keys/`, { method: "POST", body: JSON.stringify({ name }) });
|
|
16
|
+
return validateResponse(schema, body);
|
|
17
|
+
}
|
|
18
|
+
async function updateClientKey({ core, origin }, {
|
|
19
|
+
organizationSlug,
|
|
20
|
+
projectSlug,
|
|
21
|
+
keyId,
|
|
22
|
+
name,
|
|
23
|
+
isActive,
|
|
24
|
+
rateLimit,
|
|
25
|
+
browserSdkVersion,
|
|
26
|
+
dynamicSdkLoaderOptions
|
|
27
|
+
}, schema) {
|
|
28
|
+
const data = {};
|
|
29
|
+
if (name !== undefined) {
|
|
30
|
+
data.name = name;
|
|
31
|
+
}
|
|
32
|
+
if (isActive !== undefined) {
|
|
33
|
+
data.isActive = isActive;
|
|
34
|
+
}
|
|
35
|
+
if (rateLimit !== undefined) {
|
|
36
|
+
data.rateLimit = rateLimit;
|
|
37
|
+
}
|
|
38
|
+
if (browserSdkVersion !== undefined) {
|
|
39
|
+
data.browserSdkVersion = browserSdkVersion;
|
|
40
|
+
}
|
|
41
|
+
if (dynamicSdkLoaderOptions !== undefined) {
|
|
42
|
+
data.dynamicSdkLoaderOptions = dynamicSdkLoaderOptions;
|
|
43
|
+
}
|
|
44
|
+
const body = await core.requestJson(origin, apiPath`/projects/${organizationSlug}/${projectSlug}/keys/${keyId}/`, { method: "PUT", body: JSON.stringify(data) });
|
|
45
|
+
return validateResponse(schema, body);
|
|
46
|
+
}
|
|
47
|
+
// src/api-client/endpoints/dashboards.ts
|
|
48
|
+
import {
|
|
49
|
+
apiPath as apiPath2,
|
|
50
|
+
nextPageCursor,
|
|
51
|
+
readJsonResponse,
|
|
52
|
+
validateResponse as validateResponse2
|
|
53
|
+
} from "@sentry/api/client";
|
|
54
|
+
async function listDashboards({ core, origin }, { organizationSlug, query, sortBy, limit = 10, cursor }, schema) {
|
|
55
|
+
const params = new URLSearchParams;
|
|
56
|
+
params.set("per_page", String(limit));
|
|
57
|
+
if (query) {
|
|
58
|
+
params.set("query", query);
|
|
59
|
+
}
|
|
60
|
+
if (sortBy) {
|
|
61
|
+
params.set("sort", sortBy);
|
|
62
|
+
}
|
|
63
|
+
if (cursor) {
|
|
64
|
+
params.set("cursor", cursor);
|
|
65
|
+
}
|
|
66
|
+
const response = await core.request(origin, `${apiPath2`/organizations/${organizationSlug}/dashboards/`}?${params.toString()}`);
|
|
67
|
+
return {
|
|
68
|
+
items: validateResponse2(schema, await readJsonResponse(response)),
|
|
69
|
+
nextCursor: nextPageCursor(response)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function getDashboard({ core, origin }, { organizationSlug, dashboardId }, schema) {
|
|
73
|
+
const body = await core.requestJson(origin, apiPath2`/organizations/${organizationSlug}/dashboards/${dashboardId}/`);
|
|
74
|
+
return validateResponse2(schema, body);
|
|
75
|
+
}
|
|
76
|
+
// src/api-client/endpoints/monitors.ts
|
|
77
|
+
import {
|
|
78
|
+
apiPath as apiPath3,
|
|
79
|
+
applyStatsMixinTimeParams,
|
|
80
|
+
applyTimeParams,
|
|
81
|
+
defaultStatsPeriod,
|
|
82
|
+
parseStatsPeriod,
|
|
83
|
+
validateResponse as validateResponse3,
|
|
84
|
+
withQuery
|
|
85
|
+
} from "@sentry/api/client";
|
|
86
|
+
async function listMonitors({ core, origin }, {
|
|
87
|
+
organizationSlug,
|
|
88
|
+
projectSlug,
|
|
89
|
+
environment,
|
|
90
|
+
owner,
|
|
91
|
+
query,
|
|
92
|
+
limit
|
|
93
|
+
}, schema) {
|
|
94
|
+
const params = new URLSearchParams;
|
|
95
|
+
if (projectSlug) {
|
|
96
|
+
params.append("projectSlug", projectSlug);
|
|
97
|
+
}
|
|
98
|
+
if (environment) {
|
|
99
|
+
params.append("environment", environment);
|
|
100
|
+
}
|
|
101
|
+
if (owner) {
|
|
102
|
+
params.append("owner", owner);
|
|
103
|
+
}
|
|
104
|
+
if (query) {
|
|
105
|
+
params.set("query", query);
|
|
106
|
+
}
|
|
107
|
+
if (limit !== undefined) {
|
|
108
|
+
params.set("per_page", String(limit));
|
|
109
|
+
}
|
|
110
|
+
const body = await core.requestJson(origin, withQuery(apiPath3`/organizations/${organizationSlug}/monitors/`, params));
|
|
111
|
+
return validateResponse3(schema, body);
|
|
112
|
+
}
|
|
113
|
+
function monitorPath({ organizationSlug, projectSlug, monitorSlug }, suffix = "") {
|
|
114
|
+
const path = projectSlug ? apiPath3`/projects/${organizationSlug}/${projectSlug}/monitors/${monitorSlug}/` : apiPath3`/organizations/${organizationSlug}/monitors/${monitorSlug}/`;
|
|
115
|
+
return `${path}${suffix}`;
|
|
116
|
+
}
|
|
117
|
+
function environmentQuery(environment) {
|
|
118
|
+
const params = new URLSearchParams;
|
|
119
|
+
if (environment) {
|
|
120
|
+
params.append("environment", environment);
|
|
121
|
+
}
|
|
122
|
+
return params;
|
|
123
|
+
}
|
|
124
|
+
async function getMonitor({ core, origin }, params, schema) {
|
|
125
|
+
const body = await core.requestJson(origin, withQuery(monitorPath(params), environmentQuery(params.environment)));
|
|
126
|
+
return validateResponse3(schema, body);
|
|
127
|
+
}
|
|
128
|
+
async function deleteMonitorEnvironment({ core, origin }, {
|
|
129
|
+
organizationSlug,
|
|
130
|
+
projectSlug,
|
|
131
|
+
monitorSlug,
|
|
132
|
+
environment
|
|
133
|
+
}) {
|
|
134
|
+
await core.request(origin, apiPath3`/projects/${organizationSlug}/${projectSlug}/monitors/${monitorSlug}/environments/${environment}/`, { method: "DELETE" }, { allowStatuses: [404] });
|
|
135
|
+
}
|
|
136
|
+
async function listMonitorCheckIns({ core, origin }, params, schema) {
|
|
137
|
+
const query = environmentQuery(params.environment);
|
|
138
|
+
if (params.limit !== undefined) {
|
|
139
|
+
query.set("per_page", String(params.limit));
|
|
140
|
+
}
|
|
141
|
+
const statsPeriod = defaultStatsPeriod(params);
|
|
142
|
+
if (statsPeriod) {
|
|
143
|
+
parseStatsPeriod(statsPeriod);
|
|
144
|
+
}
|
|
145
|
+
applyTimeParams(query, statsPeriod, params.start, params.end);
|
|
146
|
+
const body = await core.requestJson(origin, withQuery(monitorPath(params, "checkins/"), query));
|
|
147
|
+
return validateResponse3(schema, body);
|
|
148
|
+
}
|
|
149
|
+
async function getMonitorStats({ core, origin }, params, schema) {
|
|
150
|
+
const query = environmentQuery(params.environment);
|
|
151
|
+
applyStatsMixinTimeParams(query, defaultStatsPeriod(params), params.start, params.end, params.rollup);
|
|
152
|
+
const body = await core.requestJson(origin, withQuery(monitorPath(params, "stats/"), query));
|
|
153
|
+
return validateResponse3(schema, body);
|
|
154
|
+
}
|
|
155
|
+
// src/api-client/endpoints/organizations.ts
|
|
156
|
+
import { listOrganizations as listOrganizationsOperation } from "@sentry/api";
|
|
157
|
+
import {
|
|
158
|
+
apiPath as apiPath4,
|
|
159
|
+
listPage,
|
|
160
|
+
validateResponse as validateResponse4,
|
|
161
|
+
withQuery as withQuery2
|
|
162
|
+
} from "@sentry/api/client";
|
|
163
|
+
async function getAuthenticatedUser({ core, origin }, schema) {
|
|
164
|
+
return validateResponse4(schema, await core.requestJson(origin, "/auth/"));
|
|
165
|
+
}
|
|
166
|
+
async function listOrganizations({ core, origin }, params, schema) {
|
|
167
|
+
const client = core.sdkClient(origin, "/organizations/");
|
|
168
|
+
return await listPage((perPage, cursor) => listOrganizationsOperation({
|
|
169
|
+
client,
|
|
170
|
+
query: { per_page: perPage, query: params.query, cursor },
|
|
171
|
+
throwOnError: true
|
|
172
|
+
}), schema, params.limit ?? 25, params.cursor);
|
|
173
|
+
}
|
|
174
|
+
async function getOrganization({ core, origin }, params, schema) {
|
|
175
|
+
const query = new URLSearchParams;
|
|
176
|
+
if (params.includeFeatureFlags) {
|
|
177
|
+
query.set("include_feature_flags", "1");
|
|
178
|
+
}
|
|
179
|
+
if (params.detailed === false) {
|
|
180
|
+
query.set("detailed", "0");
|
|
181
|
+
}
|
|
182
|
+
const body = await core.requestJson(origin, withQuery2(apiPath4`/organizations/${params.organizationSlug}/`, query));
|
|
183
|
+
return validateResponse4(schema, body);
|
|
184
|
+
}
|
|
185
|
+
async function updateAgenticOnboardingStatus({ core, origin }, { organizationSlug, update }, schema) {
|
|
186
|
+
const body = await core.requestJson(origin, apiPath4`/organizations/${organizationSlug}/onboarding/agent/status/`, { method: "POST", body: JSON.stringify(update) });
|
|
187
|
+
return validateResponse4(schema, body);
|
|
188
|
+
}
|
|
189
|
+
// src/api-client/endpoints/profiling.ts
|
|
190
|
+
import {
|
|
191
|
+
apiPath as apiPath5,
|
|
192
|
+
validateResponse as validateResponse5
|
|
193
|
+
} from "@sentry/api/client";
|
|
194
|
+
async function getFlamegraph({ core, origin }, {
|
|
195
|
+
organizationSlug,
|
|
196
|
+
projectId,
|
|
197
|
+
transactionName,
|
|
198
|
+
statsPeriod = "7d"
|
|
199
|
+
}, schema) {
|
|
200
|
+
const query = new URLSearchParams;
|
|
201
|
+
query.set("project", projectId.toString());
|
|
202
|
+
const escapedTransaction = transactionName.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
203
|
+
query.set("query", `event.type:transaction transaction:"${escapedTransaction}"`);
|
|
204
|
+
query.set("statsPeriod", statsPeriod);
|
|
205
|
+
const body = await core.requestJson(origin, apiPath5`/organizations/${organizationSlug}/profiling/flamegraph/` + `?${query.toString()}`);
|
|
206
|
+
return validateResponse5(schema, body);
|
|
207
|
+
}
|
|
208
|
+
async function getTransactionProfile({ core, origin }, {
|
|
209
|
+
organizationSlug,
|
|
210
|
+
projectSlugOrId,
|
|
211
|
+
profileId
|
|
212
|
+
}, schema) {
|
|
213
|
+
const body = await core.requestJson(origin, apiPath5`/projects/${organizationSlug}/${projectSlugOrId}/profiling/profiles/${profileId}/`);
|
|
214
|
+
return validateResponse5(schema, body);
|
|
215
|
+
}
|
|
216
|
+
async function getProfileChunks({ core, origin }, {
|
|
217
|
+
organizationSlug,
|
|
218
|
+
profilerId,
|
|
219
|
+
projectId,
|
|
220
|
+
start,
|
|
221
|
+
end
|
|
222
|
+
}, schema) {
|
|
223
|
+
const query = new URLSearchParams;
|
|
224
|
+
query.set("profiler_id", profilerId);
|
|
225
|
+
query.set("project", projectId.toString());
|
|
226
|
+
query.set("start", start);
|
|
227
|
+
query.set("end", end);
|
|
228
|
+
const body = await core.requestJson(origin, apiPath5`/organizations/${organizationSlug}/profiling/chunks/` + `?${query.toString()}`);
|
|
229
|
+
return validateResponse5(schema, body);
|
|
230
|
+
}
|
|
231
|
+
// src/api-client/endpoints/projects.ts
|
|
232
|
+
import { listOrganizationProjects } from "@sentry/api";
|
|
233
|
+
import {
|
|
234
|
+
apiPath as apiPath6,
|
|
235
|
+
fetchAllPages,
|
|
236
|
+
listPage as listPage2,
|
|
237
|
+
MAX_LIST_PAGES,
|
|
238
|
+
nextPageCursor as nextPageCursor2,
|
|
239
|
+
readJsonResponse as readJsonResponse2,
|
|
240
|
+
validateResponse as validateResponse6,
|
|
241
|
+
withQuery as withQuery3
|
|
242
|
+
} from "@sentry/api/client";
|
|
243
|
+
async function listProjects({ core, origin }, params, schema) {
|
|
244
|
+
const client = core.sdkClient(origin, apiPath6`/organizations/${params.organizationSlug}/projects/`);
|
|
245
|
+
return await listPage2((perPage, cursor) => listOrganizationProjects({
|
|
246
|
+
client,
|
|
247
|
+
path: { organization_id_or_slug: params.organizationSlug },
|
|
248
|
+
query: { per_page: perPage, query: params.query, cursor },
|
|
249
|
+
throwOnError: true
|
|
250
|
+
}), schema, params.limit ?? 25, params.cursor);
|
|
251
|
+
}
|
|
252
|
+
async function getProject({ core, origin }, { organizationSlug, projectSlugOrId, collapse }, schema) {
|
|
253
|
+
const query = new URLSearchParams;
|
|
254
|
+
if (collapse) {
|
|
255
|
+
query.set("collapse", collapse);
|
|
256
|
+
}
|
|
257
|
+
const body = await core.requestJson(origin, withQuery3(apiPath6`/projects/${organizationSlug}/${projectSlugOrId}/`, query));
|
|
258
|
+
return validateResponse6(schema, body);
|
|
259
|
+
}
|
|
260
|
+
async function createProject({ core, origin }, { organizationSlug, teamSlug, name, slug, platform }, schema) {
|
|
261
|
+
const data = { name };
|
|
262
|
+
if (slug) {
|
|
263
|
+
data.slug = slug;
|
|
264
|
+
}
|
|
265
|
+
if (platform) {
|
|
266
|
+
data.platform = platform;
|
|
267
|
+
}
|
|
268
|
+
const body = await core.requestJson(origin, apiPath6`/teams/${organizationSlug}/${teamSlug}/projects/`, { method: "POST", body: JSON.stringify(data) });
|
|
269
|
+
return validateResponse6(schema, body);
|
|
270
|
+
}
|
|
271
|
+
async function updateProject({ core, origin }, { organizationSlug, projectSlug, name, slug, platform }, schema) {
|
|
272
|
+
const data = {};
|
|
273
|
+
if (name)
|
|
274
|
+
data.name = name;
|
|
275
|
+
if (slug)
|
|
276
|
+
data.slug = slug;
|
|
277
|
+
if (platform)
|
|
278
|
+
data.platform = platform;
|
|
279
|
+
const body = await core.requestJson(origin, apiPath6`/projects/${organizationSlug}/${projectSlug}/`, { method: "PUT", body: JSON.stringify(data) });
|
|
280
|
+
return validateResponse6(schema, body);
|
|
281
|
+
}
|
|
282
|
+
async function listProjectTeams({ core, origin }, { organizationSlug, projectSlug }, schema) {
|
|
283
|
+
const result = await fetchAllPages(async (cursor) => {
|
|
284
|
+
const query = new URLSearchParams;
|
|
285
|
+
query.set("per_page", "100");
|
|
286
|
+
if (cursor) {
|
|
287
|
+
query.set("cursor", cursor);
|
|
288
|
+
}
|
|
289
|
+
const response = await core.request(origin, `${apiPath6`/projects/${organizationSlug}/${projectSlug}/teams/`}?${query.toString()}`);
|
|
290
|
+
return {
|
|
291
|
+
data: await readJsonResponse2(response),
|
|
292
|
+
nextCursor: nextPageCursor2(response) ?? undefined
|
|
293
|
+
};
|
|
294
|
+
}, (data) => validateResponse6(schema, data), MAX_LIST_PAGES);
|
|
295
|
+
if (!result.ok) {
|
|
296
|
+
throw new Error(result.reason === "page-cap" ? "API pagination exceeded its page limit" : "API returned a repeated pagination cursor");
|
|
297
|
+
}
|
|
298
|
+
return result.items;
|
|
299
|
+
}
|
|
300
|
+
async function addProjectTeam({ core, origin }, {
|
|
301
|
+
organizationSlug,
|
|
302
|
+
projectSlug,
|
|
303
|
+
teamSlug
|
|
304
|
+
}) {
|
|
305
|
+
await core.request(origin, apiPath6`/projects/${organizationSlug}/${projectSlug}/teams/${teamSlug}/`, { method: "POST", body: JSON.stringify({}) });
|
|
306
|
+
}
|
|
307
|
+
async function removeProjectTeam({ core, origin }, {
|
|
308
|
+
organizationSlug,
|
|
309
|
+
projectSlug,
|
|
310
|
+
teamSlug
|
|
311
|
+
}) {
|
|
312
|
+
await core.request(origin, apiPath6`/projects/${organizationSlug}/${projectSlug}/teams/${teamSlug}/`, { method: "DELETE" });
|
|
313
|
+
}
|
|
314
|
+
// src/api-client/endpoints/releases.ts
|
|
315
|
+
import {
|
|
316
|
+
apiPath as apiPath7,
|
|
317
|
+
validateResponse as validateResponse7,
|
|
318
|
+
withQuery as withQuery4
|
|
319
|
+
} from "@sentry/api/client";
|
|
320
|
+
async function listReleases({ core, origin }, { organizationSlug, projectSlug, query, limit }, schema) {
|
|
321
|
+
const params = new URLSearchParams;
|
|
322
|
+
if (query) {
|
|
323
|
+
params.set("query", query);
|
|
324
|
+
}
|
|
325
|
+
if (limit !== undefined) {
|
|
326
|
+
params.set("per_page", String(limit));
|
|
327
|
+
}
|
|
328
|
+
const path = projectSlug ? apiPath7`/projects/${organizationSlug}/${projectSlug}/releases/` : apiPath7`/organizations/${organizationSlug}/releases/`;
|
|
329
|
+
const body = await core.requestJson(origin, withQuery4(path, params));
|
|
330
|
+
return validateResponse7(schema, body);
|
|
331
|
+
}
|
|
332
|
+
async function getRelease({ core, origin }, {
|
|
333
|
+
organizationSlug,
|
|
334
|
+
releaseVersion,
|
|
335
|
+
projectSlugOrId,
|
|
336
|
+
includeHealth
|
|
337
|
+
}, schema) {
|
|
338
|
+
const params = new URLSearchParams;
|
|
339
|
+
if (includeHealth) {
|
|
340
|
+
params.set("health", "1");
|
|
341
|
+
}
|
|
342
|
+
const path = projectSlugOrId ? apiPath7`/projects/${organizationSlug}/${projectSlugOrId}/releases/${releaseVersion}/` : apiPath7`/organizations/${organizationSlug}/releases/${releaseVersion}/`;
|
|
343
|
+
const body = await core.requestJson(origin, withQuery4(path, params));
|
|
344
|
+
return validateResponse7(schema, body);
|
|
345
|
+
}
|
|
346
|
+
async function listReleaseDeploys({ core, origin }, {
|
|
347
|
+
organizationSlug,
|
|
348
|
+
releaseVersion,
|
|
349
|
+
projectSlugOrId,
|
|
350
|
+
limit
|
|
351
|
+
}, schema) {
|
|
352
|
+
const params = new URLSearchParams;
|
|
353
|
+
if (projectSlugOrId) {
|
|
354
|
+
params.set(/^\d+$/.test(projectSlugOrId) ? "project" : "projectSlug", projectSlugOrId);
|
|
355
|
+
}
|
|
356
|
+
if (limit !== undefined) {
|
|
357
|
+
params.set("per_page", String(limit));
|
|
358
|
+
}
|
|
359
|
+
const path = apiPath7`/organizations/${organizationSlug}/releases/${releaseVersion}/deploys/`;
|
|
360
|
+
const body = await core.requestJson(origin, withQuery4(path, params));
|
|
361
|
+
return validateResponse7(schema, body);
|
|
362
|
+
}
|
|
363
|
+
async function listReleaseCommits({ core, origin }, {
|
|
364
|
+
organizationSlug,
|
|
365
|
+
releaseVersion,
|
|
366
|
+
projectSlugOrId,
|
|
367
|
+
limit
|
|
368
|
+
}, schema) {
|
|
369
|
+
const params = new URLSearchParams;
|
|
370
|
+
if (limit !== undefined) {
|
|
371
|
+
params.set("per_page", String(limit));
|
|
372
|
+
}
|
|
373
|
+
const path = projectSlugOrId ? apiPath7`/projects/${organizationSlug}/${projectSlugOrId}/releases/${releaseVersion}/commits/` : apiPath7`/organizations/${organizationSlug}/releases/${releaseVersion}/commits/`;
|
|
374
|
+
const body = await core.requestJson(origin, withQuery4(path, params));
|
|
375
|
+
return validateResponse7(schema, body);
|
|
376
|
+
}
|
|
377
|
+
async function getEventCommitters({ core, origin }, { organizationSlug, projectSlug, eventId }, schema) {
|
|
378
|
+
const body = await core.requestJson(origin, apiPath7`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/committers/`);
|
|
379
|
+
return validateResponse7(schema, body);
|
|
380
|
+
}
|
|
381
|
+
// src/api-client/endpoints/replays.ts
|
|
382
|
+
import {
|
|
383
|
+
apiPath as apiPath8,
|
|
384
|
+
applyTimeParams as applyTimeParams2,
|
|
385
|
+
nextPageCursor as nextPageCursor3,
|
|
386
|
+
readJsonResponse as readJsonResponse3,
|
|
387
|
+
validateResponse as validateResponse8,
|
|
388
|
+
withQuery as withQuery5
|
|
389
|
+
} from "@sentry/api/client";
|
|
390
|
+
var REPLAY_SEGMENTS_PER_PAGE = 100;
|
|
391
|
+
async function searchReplays({ core, origin }, {
|
|
392
|
+
organizationSlug,
|
|
393
|
+
query,
|
|
394
|
+
limit,
|
|
395
|
+
projectId,
|
|
396
|
+
sort,
|
|
397
|
+
environment,
|
|
398
|
+
statsPeriod,
|
|
399
|
+
start,
|
|
400
|
+
end,
|
|
401
|
+
fields
|
|
402
|
+
}, schema) {
|
|
403
|
+
const params = new URLSearchParams;
|
|
404
|
+
if (query) {
|
|
405
|
+
params.set("query", query);
|
|
406
|
+
}
|
|
407
|
+
if (limit !== undefined) {
|
|
408
|
+
params.set("per_page", String(limit));
|
|
409
|
+
}
|
|
410
|
+
if (projectId) {
|
|
411
|
+
params.append("project", projectId);
|
|
412
|
+
}
|
|
413
|
+
if (sort) {
|
|
414
|
+
params.set("sort", sort);
|
|
415
|
+
}
|
|
416
|
+
if (environment) {
|
|
417
|
+
const environments = Array.isArray(environment) ? environment : [environment];
|
|
418
|
+
for (const value of environments) {
|
|
419
|
+
params.append("environment", value);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
for (const field of fields ?? []) {
|
|
423
|
+
params.append("field", field);
|
|
424
|
+
}
|
|
425
|
+
applyTimeParams2(params, statsPeriod, start, end);
|
|
426
|
+
const body = await core.requestJson(origin, withQuery5(apiPath8`/organizations/${organizationSlug}/replays/`, params));
|
|
427
|
+
return validateResponse8(schema, body);
|
|
428
|
+
}
|
|
429
|
+
async function getReplay({ core, origin }, {
|
|
430
|
+
organizationSlug,
|
|
431
|
+
replayId
|
|
432
|
+
}, schema) {
|
|
433
|
+
const body = await core.requestJson(origin, apiPath8`/organizations/${organizationSlug}/replays/${replayId}/`);
|
|
434
|
+
return validateResponse8(schema, body);
|
|
435
|
+
}
|
|
436
|
+
async function listIssueReplayIds({ core, origin }, { organizationSlug, issueId, dataSource }, schema) {
|
|
437
|
+
const params = new URLSearchParams;
|
|
438
|
+
params.set("returnIds", "true");
|
|
439
|
+
params.set("query", `issue.id:[${String(issueId)}]`);
|
|
440
|
+
params.set("data_source", dataSource);
|
|
441
|
+
params.set("statsPeriod", "90d");
|
|
442
|
+
params.append("project", "-1");
|
|
443
|
+
const body = await core.requestJson(origin, apiPath8`/organizations/${organizationSlug}/replay-count/` + `?${params.toString()}`);
|
|
444
|
+
return validateResponse8(schema, body);
|
|
445
|
+
}
|
|
446
|
+
async function visitReplayRecordingSegments({ core, origin }, {
|
|
447
|
+
organizationSlug,
|
|
448
|
+
projectSlugOrId,
|
|
449
|
+
replayId,
|
|
450
|
+
maxSegments
|
|
451
|
+
}, pageSchema, onSegment) {
|
|
452
|
+
let cursor = null;
|
|
453
|
+
let segmentsRead = 0;
|
|
454
|
+
do {
|
|
455
|
+
const params = new URLSearchParams;
|
|
456
|
+
params.set("per_page", String(REPLAY_SEGMENTS_PER_PAGE));
|
|
457
|
+
if (cursor) {
|
|
458
|
+
params.set("cursor", cursor);
|
|
459
|
+
}
|
|
460
|
+
const response = await core.request(origin, apiPath8`/projects/${organizationSlug}/${projectSlugOrId}/replays/${replayId}/recording-segments/` + `?${params.toString()}`, { method: "GET" });
|
|
461
|
+
const page = validateResponse8(pageSchema, await readJsonResponse3(response));
|
|
462
|
+
for (const segment of page) {
|
|
463
|
+
if (segmentsRead >= maxSegments) {
|
|
464
|
+
return { segmentsRead, truncated: true };
|
|
465
|
+
}
|
|
466
|
+
onSegment(segment);
|
|
467
|
+
segmentsRead += 1;
|
|
468
|
+
}
|
|
469
|
+
cursor = nextPageCursor3(response);
|
|
470
|
+
if (cursor && (segmentsRead >= maxSegments || page.length === 0)) {
|
|
471
|
+
return { segmentsRead, truncated: true };
|
|
472
|
+
}
|
|
473
|
+
} while (cursor);
|
|
474
|
+
return { segmentsRead, truncated: false };
|
|
475
|
+
}
|
|
476
|
+
// src/api-client/endpoints/repositories.ts
|
|
477
|
+
import {
|
|
478
|
+
apiPath as apiPath9,
|
|
479
|
+
fetchAllPages as fetchAllPages2,
|
|
480
|
+
MAX_LIST_PAGES as MAX_LIST_PAGES2,
|
|
481
|
+
nextPageCursor as nextPageCursor4,
|
|
482
|
+
readJsonResponse as readJsonResponse4,
|
|
483
|
+
validateResponse as validateResponse9
|
|
484
|
+
} from "@sentry/api/client";
|
|
485
|
+
async function listRepositories({ core, origin }, { organizationSlug, query }, schema) {
|
|
486
|
+
const result = await fetchAllPages2(async (cursor) => {
|
|
487
|
+
const params = new URLSearchParams;
|
|
488
|
+
params.set("per_page", "100");
|
|
489
|
+
if (query) {
|
|
490
|
+
params.set("query", query);
|
|
491
|
+
}
|
|
492
|
+
if (cursor) {
|
|
493
|
+
params.set("cursor", cursor);
|
|
494
|
+
}
|
|
495
|
+
const response = await core.request(origin, `${apiPath9`/organizations/${organizationSlug}/repos/`}?${params.toString()}`, { method: "GET" });
|
|
496
|
+
return {
|
|
497
|
+
data: await readJsonResponse4(response),
|
|
498
|
+
nextCursor: nextPageCursor4(response) ?? undefined
|
|
499
|
+
};
|
|
500
|
+
}, (data) => validateResponse9(schema, data), MAX_LIST_PAGES2);
|
|
501
|
+
if (!result.ok) {
|
|
502
|
+
throw new Error(result.reason === "page-cap" ? "API pagination exceeded its page limit" : "API returned a repeated pagination cursor");
|
|
503
|
+
}
|
|
504
|
+
return result.items;
|
|
505
|
+
}
|
|
506
|
+
async function linkProjectRepository({ core, origin }, {
|
|
507
|
+
organizationSlug,
|
|
508
|
+
projectSlug,
|
|
509
|
+
repository,
|
|
510
|
+
provider
|
|
511
|
+
}, schema) {
|
|
512
|
+
const body = await core.requestJson(origin, apiPath9`/organizations/${organizationSlug}/code-mappings/bulk/`, {
|
|
513
|
+
method: "POST",
|
|
514
|
+
body: JSON.stringify({
|
|
515
|
+
project: projectSlug,
|
|
516
|
+
repository,
|
|
517
|
+
provider,
|
|
518
|
+
mappings: [{ stackRoot: "", sourceRoot: "" }]
|
|
519
|
+
})
|
|
520
|
+
});
|
|
521
|
+
return validateResponse9(schema, body);
|
|
522
|
+
}
|
|
523
|
+
// src/api-client/endpoints/snapshots.ts
|
|
524
|
+
import { apiPath as apiPath10, withQuery as withQuery6 } from "@sentry/api/client";
|
|
525
|
+
async function getSnapshot({ core, origin }, {
|
|
526
|
+
organizationSlug,
|
|
527
|
+
snapshotId,
|
|
528
|
+
compactMetadata = true
|
|
529
|
+
}) {
|
|
530
|
+
const query = new URLSearchParams;
|
|
531
|
+
if (compactMetadata) {
|
|
532
|
+
query.set("compact_metadata", "true");
|
|
533
|
+
}
|
|
534
|
+
return await core.requestJson(origin, withQuery6(apiPath10`/organizations/${organizationSlug}/preprodartifacts/snapshots/${snapshotId}/`, query));
|
|
535
|
+
}
|
|
536
|
+
async function getSnapshotImage({ core, origin }, {
|
|
537
|
+
organizationSlug,
|
|
538
|
+
snapshotId,
|
|
539
|
+
imageIdentifier
|
|
540
|
+
}) {
|
|
541
|
+
return await core.requestJson(origin, apiPath10`/organizations/${organizationSlug}/preprodartifacts/snapshots/${snapshotId}/images/${imageIdentifier}/`);
|
|
542
|
+
}
|
|
543
|
+
async function getLatestBaseSnapshot({ core, origin }, {
|
|
544
|
+
organizationSlug,
|
|
545
|
+
appId,
|
|
546
|
+
branch,
|
|
547
|
+
project,
|
|
548
|
+
projectSlug,
|
|
549
|
+
compactMetadata = true
|
|
550
|
+
}) {
|
|
551
|
+
const query = new URLSearchParams;
|
|
552
|
+
query.set("app_id", appId);
|
|
553
|
+
if (branch)
|
|
554
|
+
query.set("branch", branch);
|
|
555
|
+
if (project)
|
|
556
|
+
query.set("project", project);
|
|
557
|
+
if (projectSlug)
|
|
558
|
+
query.set("projectSlug", projectSlug);
|
|
559
|
+
if (compactMetadata)
|
|
560
|
+
query.set("compact_metadata", "true");
|
|
561
|
+
return await core.requestJson(origin, apiPath10`/organizations/${organizationSlug}/preprodartifacts/snapshots/latest-base/` + `?${query.toString()}`);
|
|
562
|
+
}
|
|
563
|
+
// src/api-client/endpoints/teams.ts
|
|
564
|
+
import { listOrganizationTeams } from "@sentry/api";
|
|
565
|
+
import {
|
|
566
|
+
apiPath as apiPath11,
|
|
567
|
+
listPage as listPage3,
|
|
568
|
+
validateResponse as validateResponse10
|
|
569
|
+
} from "@sentry/api/client";
|
|
570
|
+
async function listTeams({ core, origin }, params, schema) {
|
|
571
|
+
const client = core.sdkClient(origin, apiPath11`/organizations/${params.organizationSlug}/teams/`);
|
|
572
|
+
return await listPage3((perPage, cursor) => listOrganizationTeams({
|
|
573
|
+
client,
|
|
574
|
+
path: { organization_id_or_slug: params.organizationSlug },
|
|
575
|
+
query: { per_page: perPage, query: params.query, cursor },
|
|
576
|
+
throwOnError: true
|
|
577
|
+
}), schema, params.limit ?? 25, params.cursor);
|
|
578
|
+
}
|
|
579
|
+
async function createTeam({ core, origin }, { organizationSlug, name }, schema) {
|
|
580
|
+
const body = await core.requestJson(origin, apiPath11`/organizations/${organizationSlug}/teams/`, { method: "POST", body: JSON.stringify({ name }) });
|
|
581
|
+
return validateResponse10(schema, body);
|
|
582
|
+
}
|
|
583
|
+
// src/api-client/endpoints/traces.ts
|
|
584
|
+
import {
|
|
585
|
+
apiPath as apiPath12,
|
|
586
|
+
validateResponse as validateResponse11
|
|
587
|
+
} from "@sentry/api/client";
|
|
588
|
+
async function getTraceMeta({ core, origin }, { organizationSlug, traceId, statsPeriod = "14d" }, schema) {
|
|
589
|
+
const query = new URLSearchParams({ statsPeriod });
|
|
590
|
+
const body = await core.requestJson(origin, apiPath12`/organizations/${organizationSlug}/trace-meta/${traceId}/` + `?${query.toString()}`);
|
|
591
|
+
return validateResponse11(schema, body);
|
|
592
|
+
}
|
|
593
|
+
async function getTrace({ core, origin }, {
|
|
594
|
+
organizationSlug,
|
|
595
|
+
traceId,
|
|
596
|
+
limit = 1000,
|
|
597
|
+
project = "-1",
|
|
598
|
+
statsPeriod = "14d"
|
|
599
|
+
}, schema) {
|
|
600
|
+
const query = new URLSearchParams;
|
|
601
|
+
query.set("limit", String(limit));
|
|
602
|
+
query.set("project", project);
|
|
603
|
+
query.set("statsPeriod", statsPeriod);
|
|
604
|
+
const body = await core.requestJson(origin, apiPath12`/organizations/${organizationSlug}/trace/${traceId}/` + `?${query.toString()}`);
|
|
605
|
+
return validateResponse11(schema, body);
|
|
606
|
+
}
|
|
607
|
+
// src/api-client/endpoints/uptime-monitors.ts
|
|
608
|
+
import {
|
|
609
|
+
apiPath as apiPath13,
|
|
610
|
+
applyTimeParams as applyTimeParams3,
|
|
611
|
+
defaultStatsPeriod as defaultStatsPeriod2,
|
|
612
|
+
parseStatsPeriod as parseStatsPeriod2,
|
|
613
|
+
validateResponse as validateResponse12,
|
|
614
|
+
withQuery as withQuery7
|
|
615
|
+
} from "@sentry/api/client";
|
|
616
|
+
async function listUptimeMonitors({ core, origin }, {
|
|
617
|
+
organizationSlug,
|
|
618
|
+
projectId,
|
|
619
|
+
environment,
|
|
620
|
+
owner,
|
|
621
|
+
query,
|
|
622
|
+
limit
|
|
623
|
+
}, schema) {
|
|
624
|
+
const params = new URLSearchParams;
|
|
625
|
+
if (projectId) {
|
|
626
|
+
params.append("project", projectId);
|
|
627
|
+
}
|
|
628
|
+
if (environment) {
|
|
629
|
+
params.append("environment", environment);
|
|
630
|
+
}
|
|
631
|
+
if (owner) {
|
|
632
|
+
params.append("owner", owner);
|
|
633
|
+
}
|
|
634
|
+
if (query) {
|
|
635
|
+
params.set("query", query);
|
|
636
|
+
}
|
|
637
|
+
if (limit !== undefined) {
|
|
638
|
+
params.set("per_page", String(limit));
|
|
639
|
+
}
|
|
640
|
+
const body = await core.requestJson(origin, withQuery7(apiPath13`/organizations/${organizationSlug}/uptime/`, params));
|
|
641
|
+
return validateResponse12(schema, body);
|
|
642
|
+
}
|
|
643
|
+
function uptimeMonitorPath({
|
|
644
|
+
organizationSlug,
|
|
645
|
+
projectSlug,
|
|
646
|
+
uptimeMonitorId
|
|
647
|
+
}) {
|
|
648
|
+
return apiPath13`/projects/${organizationSlug}/${projectSlug}/uptime/${uptimeMonitorId}/`;
|
|
649
|
+
}
|
|
650
|
+
async function getUptimeMonitor({ core, origin }, params, schema) {
|
|
651
|
+
const body = await core.requestJson(origin, uptimeMonitorPath(params));
|
|
652
|
+
return validateResponse12(schema, body);
|
|
653
|
+
}
|
|
654
|
+
async function listUptimeMonitorChecks({ core, origin }, params, schema) {
|
|
655
|
+
const query = new URLSearchParams;
|
|
656
|
+
if (params.limit !== undefined) {
|
|
657
|
+
query.set("per_page", String(params.limit));
|
|
658
|
+
}
|
|
659
|
+
const statsPeriod = defaultStatsPeriod2(params);
|
|
660
|
+
if (statsPeriod) {
|
|
661
|
+
parseStatsPeriod2(statsPeriod);
|
|
662
|
+
}
|
|
663
|
+
applyTimeParams3(query, statsPeriod, params.start, params.end);
|
|
664
|
+
const body = await core.requestJson(origin, withQuery7(`${uptimeMonitorPath(params)}checks/`, query));
|
|
665
|
+
return validateResponse12(schema, body);
|
|
666
|
+
}
|
|
667
|
+
var UPTIME_MONITOR_FIELDS = [
|
|
668
|
+
"name",
|
|
669
|
+
"url",
|
|
670
|
+
"intervalSeconds",
|
|
671
|
+
"timeoutMs",
|
|
672
|
+
"method",
|
|
673
|
+
"headers",
|
|
674
|
+
"body",
|
|
675
|
+
"assertion",
|
|
676
|
+
"status",
|
|
677
|
+
"owner",
|
|
678
|
+
"environment",
|
|
679
|
+
"traceSampling",
|
|
680
|
+
"responseCaptureEnabled",
|
|
681
|
+
"recoveryThreshold",
|
|
682
|
+
"downtimeThreshold"
|
|
683
|
+
];
|
|
684
|
+
function uptimeMonitorBody(fields) {
|
|
685
|
+
const payload = {};
|
|
686
|
+
for (const field of UPTIME_MONITOR_FIELDS) {
|
|
687
|
+
if (fields[field] !== undefined) {
|
|
688
|
+
payload[field] = fields[field];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return JSON.stringify(payload);
|
|
692
|
+
}
|
|
693
|
+
async function createUptimeMonitor({ core, origin }, {
|
|
694
|
+
organizationSlug,
|
|
695
|
+
projectSlug,
|
|
696
|
+
...fields
|
|
697
|
+
}, schema) {
|
|
698
|
+
const body = await core.requestJson(origin, apiPath13`/projects/${organizationSlug}/${projectSlug}/uptime/`, { method: "POST", body: uptimeMonitorBody(fields) });
|
|
699
|
+
return validateResponse12(schema, body);
|
|
700
|
+
}
|
|
701
|
+
async function updateUptimeMonitor({ core, origin }, {
|
|
702
|
+
organizationSlug,
|
|
703
|
+
projectSlug,
|
|
704
|
+
uptimeMonitorId,
|
|
705
|
+
...fields
|
|
706
|
+
}, schema) {
|
|
707
|
+
const body = await core.requestJson(origin, uptimeMonitorPath({ organizationSlug, projectSlug, uptimeMonitorId }), { method: "PUT", body: uptimeMonitorBody(fields) });
|
|
708
|
+
return validateResponse12(schema, body);
|
|
709
|
+
}
|
|
710
|
+
async function deleteUptimeMonitor({ core, origin }, params) {
|
|
711
|
+
await core.request(origin, uptimeMonitorPath(params), { method: "DELETE" }, { allowStatuses: [404] });
|
|
712
|
+
}
|
|
713
|
+
export {
|
|
714
|
+
visitReplayRecordingSegments,
|
|
715
|
+
updateUptimeMonitor,
|
|
716
|
+
updateProject,
|
|
717
|
+
updateClientKey,
|
|
718
|
+
updateAgenticOnboardingStatus,
|
|
719
|
+
searchReplays,
|
|
720
|
+
removeProjectTeam,
|
|
721
|
+
listUptimeMonitors,
|
|
722
|
+
listUptimeMonitorChecks,
|
|
723
|
+
listTeams,
|
|
724
|
+
listRepositories,
|
|
725
|
+
listReleases,
|
|
726
|
+
listReleaseDeploys,
|
|
727
|
+
listReleaseCommits,
|
|
728
|
+
listProjects,
|
|
729
|
+
listProjectTeams,
|
|
730
|
+
listOrganizations,
|
|
731
|
+
listMonitors,
|
|
732
|
+
listMonitorCheckIns,
|
|
733
|
+
listIssueReplayIds,
|
|
734
|
+
listDashboards,
|
|
735
|
+
listClientKeys,
|
|
736
|
+
linkProjectRepository,
|
|
737
|
+
getUptimeMonitor,
|
|
738
|
+
getTransactionProfile,
|
|
739
|
+
getTraceMeta,
|
|
740
|
+
getTrace,
|
|
741
|
+
getSnapshotImage,
|
|
742
|
+
getSnapshot,
|
|
743
|
+
getReplay,
|
|
744
|
+
getRelease,
|
|
745
|
+
getProject,
|
|
746
|
+
getProfileChunks,
|
|
747
|
+
getOrganization,
|
|
748
|
+
getMonitorStats,
|
|
749
|
+
getMonitor,
|
|
750
|
+
getLatestBaseSnapshot,
|
|
751
|
+
getFlamegraph,
|
|
752
|
+
getEventCommitters,
|
|
753
|
+
getDashboard,
|
|
754
|
+
getAuthenticatedUser,
|
|
755
|
+
deleteUptimeMonitor,
|
|
756
|
+
deleteMonitorEnvironment,
|
|
757
|
+
createUptimeMonitor,
|
|
758
|
+
createTeam,
|
|
759
|
+
createProject,
|
|
760
|
+
createClientKey,
|
|
761
|
+
addProjectTeam
|
|
762
|
+
};
|