@sentry/api 0.444.0 → 0.445.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.
@@ -3,6 +3,7 @@ export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
3
3
  export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
4
4
  export { buildClientParams } from '../core/params.gen';
5
5
  export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
6
+ export type { ServerSentEventsResult } from '../core/serverSentEvents.gen';
6
7
  export { createClient } from './client.gen';
7
8
  export type { PreparedClient } from './client.gen';
8
9
  export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
@@ -48,7 +48,7 @@ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<Re
48
48
  export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
49
49
  responseStyle: TResponseStyle;
50
50
  throwOnError: ThrowOnError;
51
- }>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
51
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
52
52
  /**
53
53
  * Any body that you want to add to your request.
54
54
  *
@@ -64,6 +64,7 @@ export interface RequestOptions<TData = unknown, TResponseStyle extends Response
64
64
  url: Url;
65
65
  }
66
66
  export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
67
+ headers: Headers;
67
68
  serializedBody?: string;
68
69
  }
69
70
  export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = Promise<ThrowOnError extends true ? {
@@ -77,7 +78,7 @@ export interface ClientOptions {
77
78
  throwOnError?: boolean;
78
79
  }
79
80
  type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: (Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) & RequireThrowOnError<ThrowOnError>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
80
- type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
81
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
81
82
  type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: (Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) & RequireThrowOnError<ThrowOnError>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
82
83
  type BuildUrlFn = <TData extends {
83
84
  body?: unknown;
@@ -1,17 +1,19 @@
1
1
  import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
2
2
  import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
3
- export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
3
+ export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => ((queryParams: T) => string);
4
4
  /**
5
5
  * Infers parseAs value from provided Content-Type header.
6
6
  */
7
7
  export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
8
- export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
8
+ export declare function setAuthParams(options: Pick<RequestOptions, 'auth' | 'query' | 'security'> & {
9
9
  headers: Headers;
10
- }) => Promise<void>;
10
+ }): Promise<void>;
11
11
  export declare const buildUrl: Client['buildUrl'];
12
12
  export declare const mergeConfigs: (a: Config, b: Config) => Config;
13
13
  export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
14
- type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res | undefined, request: Req, options: Options) => Err | Promise<Err>;
14
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
15
+ /** response may be undefined due to a network error where no response object is produced */
16
+ response: Res | undefined, request: Req, options: Options) => Err | Promise<Err>;
15
17
  type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
16
18
  type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
17
19
  declare class Interceptors<Interceptor> {
@@ -6,6 +6,13 @@ export interface Auth {
6
6
  * @default 'header'
7
7
  */
8
8
  in?: 'header' | 'query' | 'cookie';
9
+ /**
10
+ * A unique identifier for the security scheme.
11
+ *
12
+ * Defined only when there are multiple security schemes whose `Auth`
13
+ * shape would otherwise be identical.
14
+ */
15
+ key?: string;
9
16
  /**
10
17
  * Header or query parameter name.
11
18
  *
@@ -1,6 +1,6 @@
1
1
  import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';
2
2
  export type QuerySerializer = (query: Record<string, unknown>) => string;
3
- export type BodySerializer = (body: any) => any;
3
+ export type BodySerializer = (body: unknown) => unknown;
4
4
  type QuerySerializerOptionsObject = {
5
5
  allowReserved?: boolean;
6
6
  array?: Partial<SerializerOptions<ArrayStyle>>;
@@ -14,12 +14,12 @@ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
14
14
  parameters?: Record<string, QuerySerializerOptionsObject>;
15
15
  };
16
16
  export declare const formDataBodySerializer: {
17
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData;
17
+ bodySerializer: (body: unknown) => FormData;
18
18
  };
19
19
  export declare const jsonBodySerializer: {
20
- bodySerializer: <T>(body: T) => string;
20
+ bodySerializer: (body: unknown) => string;
21
21
  };
22
22
  export declare const urlSearchParamsBodySerializer: {
23
- bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string;
23
+ bodySerializer: (body: unknown) => string;
24
24
  };
25
25
  export {};
@@ -39,5 +39,5 @@ interface Params {
39
39
  path: Record<string, unknown>;
40
40
  query: Record<string, unknown>;
41
41
  }
42
- export declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params;
42
+ export declare function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params;
43
43
  export {};
@@ -7,7 +7,7 @@ export type JsonValue = null | string | number | boolean | JsonValue[] | {
7
7
  /**
8
8
  * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
9
9
  */
10
- export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => {} | null | undefined;
10
+ export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => unknown | undefined;
11
11
  /**
12
12
  * Safely stringifies a value and parses it back into a JsonValue.
13
13
  */
@@ -68,4 +68,4 @@ export interface StreamEvent<TData = unknown> {
68
68
  export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
69
69
  stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
70
70
  };
71
- export declare const createSseClient: <TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions) => ServerSentEventsResult<TData>;
71
+ export declare function createSseClient<TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions): ServerSentEventsResult<TData>;
@@ -61,7 +61,7 @@ export interface Config {
61
61
  requestValidator?: (data: unknown) => Promise<unknown>;
62
62
  /**
63
63
  * A function transforming response data before it's returned. This is useful
64
- * for post-processing data, e.g. converting ISO strings into Date objects.
64
+ * for post-processing data, e.g., converting ISO strings into Date objects.
65
65
  */
66
66
  responseTransformer?: (data: unknown) => Promise<unknown>;
67
67
  /**
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ var callWithTypedErrors = async (call, documentedStatuses) => {
75
75
  };
76
76
 
77
77
  // src/core/serverSentEvents.gen.ts
78
- var createSseClient = ({
78
+ function createSseClient({
79
79
  onRequest,
80
80
  onSseError,
81
81
  onSseEvent,
@@ -87,7 +87,7 @@ var createSseClient = ({
87
87
  sseSleepFn,
88
88
  url,
89
89
  ...options
90
- }) => {
90
+ }) {
91
91
  let lastEventId;
92
92
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
93
93
  const createStream = async function* () {
@@ -134,8 +134,7 @@ var createSseClient = ({
134
134
  if (done)
135
135
  break;
136
136
  buffer += value;
137
- buffer = buffer.replace(/\r\n/g, `
138
- `).replace(/\r/g, `
137
+ buffer = buffer.replace(/\r\n?/g, `
139
138
  `);
140
139
  const chunks = buffer.split(`
141
140
 
@@ -208,7 +207,7 @@ var createSseClient = ({
208
207
  };
209
208
  const stream = createStream();
210
209
  return { stream };
211
- };
210
+ }
212
211
 
213
212
  // src/core/pathSerializer.gen.ts
214
213
  var separatorArrayExplode = (style) => {
@@ -527,11 +526,8 @@ var checkForExistence = (options, name) => {
527
526
  }
528
527
  return false;
529
528
  };
530
- var setAuthParams = async ({
531
- security,
532
- ...options
533
- }) => {
534
- for (const auth of security) {
529
+ async function setAuthParams(options) {
530
+ for (const auth of options.security ?? []) {
535
531
  if (checkForExistence(options, auth.name)) {
536
532
  continue;
537
533
  }
@@ -556,7 +552,7 @@ var setAuthParams = async ({
556
552
  break;
557
553
  }
558
554
  }
559
- };
555
+ }
560
556
  var buildUrl = (options) => getUrl({
561
557
  baseUrl: options.baseUrl,
562
558
  path: options.path,
@@ -688,10 +684,7 @@ var createClient = (config = {}) => {
688
684
  serializedBody: undefined
689
685
  };
690
686
  if (opts.security) {
691
- await setAuthParams({
692
- ...opts,
693
- security: opts.security
694
- });
687
+ await setAuthParams(opts);
695
688
  }
696
689
  if (opts.requestValidator) {
697
690
  await opts.requestValidator(opts);
@@ -702,8 +695,9 @@ var createClient = (config = {}) => {
702
695
  if (opts.body === undefined || opts.serializedBody === "") {
703
696
  opts.headers.delete("Content-Type");
704
697
  }
705
- const url = buildUrl(opts);
706
- return { opts, url };
698
+ const resolvedOpts = opts;
699
+ const url = buildUrl(resolvedOpts);
700
+ return { opts: resolvedOpts, url };
707
701
  };
708
702
  const prepare = async (options) => {
709
703
  const { opts, url } = await beforeRequest(options);
@@ -731,13 +725,11 @@ var createClient = (config = {}) => {
731
725
  } catch (error) {
732
726
  let finalError2 = error;
733
727
  for (const fn of interceptors.error.fns) {
734
- if (fn) {
728
+ if (fn)
735
729
  finalError2 = await fn(finalError2, undefined, request2, opts);
736
- }
737
730
  }
738
- if (opts.throwOnError) {
731
+ if (opts.throwOnError)
739
732
  throw finalError2;
740
- }
741
733
  return { error: finalError2, request: request2, response: undefined };
742
734
  }
743
735
  for (const fn of interceptors.response.fns) {
@@ -805,13 +797,11 @@ var createClient = (config = {}) => {
805
797
  } catch {}
806
798
  let finalError = new SentryApiError(response.status, body, response, false, undefined, { request: request2, rawBody: textError });
807
799
  for (const fn of interceptors.error.fns) {
808
- if (fn) {
800
+ if (fn)
809
801
  finalError = await fn(finalError, response, request2, opts);
810
- }
811
802
  }
812
- if (opts.throwOnError) {
803
+ if (opts.throwOnError)
813
804
  throw finalError;
814
- }
815
805
  return { error: finalError, ...result };
816
806
  };
817
807
  const makeMethodFn = (method) => (options) => request({ ...options, method });
@@ -820,7 +810,6 @@ var createClient = (config = {}) => {
820
810
  return createSseClient({
821
811
  ...opts,
822
812
  body: opts.body,
823
- headers: opts.headers,
824
813
  method,
825
814
  onRequest: async (url2, init) => {
826
815
  let request2 = new Request(url2, init);
@@ -835,8 +824,9 @@ var createClient = (config = {}) => {
835
824
  url
836
825
  });
837
826
  };
827
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
838
828
  return {
839
- buildUrl,
829
+ buildUrl: _buildUrl,
840
830
  connect: makeMethodFn("CONNECT"),
841
831
  delete: makeMethodFn("DELETE"),
842
832
  get: makeMethodFn("GET"),
@@ -3504,24 +3504,24 @@ Requires profiling to be enabled for the organization.`,
3504
3504
  description: "The end of the period of time for the query, expected in ISO-8601 format. For example, `2001-12-14T12:34:56.7890`.",
3505
3505
  type: "string"
3506
3506
  },
3507
+ {
3508
+ name: "fingerprint",
3509
+ required: false,
3510
+ description: "A UInt32 function fingerprint. Only valid when `dataSource=functions`.",
3511
+ type: "integer"
3512
+ },
3507
3513
  {
3508
3514
  name: "dataSource",
3509
3515
  required: false,
3510
- description: "Source dataset to build the flamegraph from. Defaults to `functions` when `fingerprint` is set and `transactions` otherwise.",
3516
+ description: "Source dataset to build the flamegraph from. Defaults to `functions` when `fingerprint` is set and `transactions` otherwise.\n\n* `transactions`\n* `profiles`\n* `functions`\n* `spans`",
3511
3517
  type: "string",
3512
3518
  enum: [
3513
- "functions",
3519
+ "transactions",
3514
3520
  "profiles",
3515
- "spans",
3516
- "transactions"
3521
+ "functions",
3522
+ "spans"
3517
3523
  ]
3518
3524
  },
3519
- {
3520
- name: "fingerprint",
3521
- required: false,
3522
- description: "A UInt32 function fingerprint. Only valid when `dataSource=functions`.",
3523
- type: "integer"
3524
- },
3525
3525
  {
3526
3526
  name: "query",
3527
3527
  required: false,
@@ -5891,16 +5891,6 @@ time range.`,
5891
5891
  description: "The end of the period of time for the query, expected in ISO-8601 format. For example, `2001-12-14T12:34:56.7890`.",
5892
5892
  type: "string"
5893
5893
  },
5894
- {
5895
- name: "itemType",
5896
- required: false,
5897
- description: "The trace item dataset to compute statistics for. Defaults to `spans`.",
5898
- type: "string",
5899
- enum: [
5900
- "occurrences",
5901
- "spans"
5902
- ]
5903
- },
5904
5894
  {
5905
5895
  name: "query",
5906
5896
  required: false,
@@ -5919,6 +5909,16 @@ time range.`,
5919
5909
  description: "Maximum number of trace items to sample when computing statistics. Defaults to `1000`, which is also the maximum.",
5920
5910
  type: "integer"
5921
5911
  },
5912
+ {
5913
+ name: "itemType",
5914
+ required: false,
5915
+ description: "The trace item dataset to compute statistics for. Defaults to `spans`.\n\n* `spans`\n* `occurrences`",
5916
+ type: "string",
5917
+ enum: [
5918
+ "spans",
5919
+ "occurrences"
5920
+ ]
5921
+ },
5922
5922
  {
5923
5923
  name: "cursor",
5924
5924
  required: false,
@@ -7556,8 +7556,12 @@ whether an update is available.`,
7556
7556
  {
7557
7557
  name: "platform",
7558
7558
  required: true,
7559
- description: 'Platform: "apple" or "android".',
7560
- type: "string"
7559
+ description: 'Platform: "apple" or "android".\n\n* `apple` - Apple\n* `android` - Android',
7560
+ type: "string",
7561
+ enum: [
7562
+ "apple",
7563
+ "android"
7564
+ ]
7561
7565
  },
7562
7566
  {
7563
7567
  name: "buildVersion",
@@ -1,4 +1,4 @@
1
- import type { DeleteOrganizationIssuesData, GetOrganizationIssueAutofixStateData, GetOrganizationIssueData, GetOrganizationIssueEventData, GetOrganizationIssueIntegrationData, GetOrganizationProfilingFlamegraphData, GetOrganizationReleaseData, GetOrganizationReplayCountData, GetOrganizationReplayData, GetOrganizationStatsSummaryData, GetOrganizationTraceData, GetOrganizationTraceMetaData, GetProjectEventData, ListOrganizationDashboardsData, ListOrganizationEnvironmentsData, ListOrganizationEventsData, ListOrganizationEventsDroppedData, ListOrganizationEventsTimeseriesData, ListOrganizationFlagLogsData, ListOrganizationIssueTagValuesData, ListOrganizationIssueViewsData, ListOrganizationIssuesData, ListOrganizationProjectKeysData, ListOrganizationReplaysData, ListOrganizationReposData, ListOrganizationStatsV2Data, ListOrganizationTagsData, ListOrganizationTraceItemAttributesData, ListOrganizationTraceItemsStatsData, ListOrganizationTraceMetricsData, ListProjectCodeOwnersData, ListProjectEnvironmentsData, ListProjectIssuesData, ListProjectSeerRepositoriesData, ListProjectStatsData, ResolveOrganizationShortIdData, RetrieveOrganizationAiConversationData, UpdateOrganizationIssuesData } from './types.gen';
1
+ import type { DeleteOrganizationIssuesData, GetOrganizationIssueAutofixStateData, GetOrganizationIssueData, GetOrganizationIssueEventData, GetOrganizationIssueIntegrationData, GetOrganizationProfilingFlamegraphData, GetOrganizationReleaseData, GetOrganizationReplayCountData, GetOrganizationReplayData, GetOrganizationStatsSummaryData, GetOrganizationTraceData, GetOrganizationTraceMetaData, GetProjectEventData, GetProjectInstallableBuildLatestData, ListOrganizationDashboardsData, ListOrganizationEnvironmentsData, ListOrganizationEventsData, ListOrganizationEventsDroppedData, ListOrganizationEventsTimeseriesData, ListOrganizationFlagLogsData, ListOrganizationIssueTagValuesData, ListOrganizationIssueViewsData, ListOrganizationIssuesData, ListOrganizationProjectKeysData, ListOrganizationReplaysData, ListOrganizationReposData, ListOrganizationStatsV2Data, ListOrganizationTagsData, ListOrganizationTraceItemAttributesData, ListOrganizationTraceItemsStatsData, ListOrganizationTraceMetricsData, ListProjectCodeOwnersData, ListProjectEnvironmentsData, ListProjectIssuesData, ListProjectSeerRepositoriesData, ListProjectStatsData, ResolveOrganizationShortIdData, RetrieveOrganizationAiConversationData, UpdateOrganizationIssuesData } from './types.gen';
2
2
  /** A value of the `sort` query parameter of `deleteOrganizationIssues`. */
3
3
  export type DeleteOrganizationIssuesQuerySort = NonNullable<NonNullable<DeleteOrganizationIssuesData['query']>["sort"]>;
4
4
  /** A value of the `llmFormat` query parameter of `getOrganizationIssueAutofixState`. */
@@ -41,6 +41,8 @@ export type GetOrganizationTraceMetaQueryIncludeUptime = NonNullable<NonNullable
41
41
  export type GetOrganizationTraceQueryIncludeUptime = NonNullable<NonNullable<GetOrganizationTraceData['query']>["include_uptime"]>;
42
42
  /** A value of the `collapse` query parameter of `getProjectEvent`. */
43
43
  export type GetProjectEventQueryCollapse = NonNullable<NonNullable<GetProjectEventData['query']>["collapse"]>[number];
44
+ /** A value of the `platform` query parameter of `getProjectInstallableBuildLatest`. */
45
+ export type GetProjectInstallableBuildLatestQueryPlatform = NonNullable<NonNullable<GetProjectInstallableBuildLatestData['query']>["platform"]>;
44
46
  /** A value of the `filter` query parameter of `listOrganizationDashboards`. */
45
47
  export type ListOrganizationDashboardsQueryFilter = NonNullable<NonNullable<ListOrganizationDashboardsData['query']>["filter"]>[number];
46
48
  /** A value of the `pin` query parameter of `listOrganizationDashboards`. */