@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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authenticated fetch for Sentry API requests, shared by the CLI and MCP.
|
|
3
|
+
* Standard Web APIs only, so it runs in Node and Cloudflare Workers.
|
|
4
|
+
*
|
|
5
|
+
* Per request it sets the Authorization header, refreshes the credential once
|
|
6
|
+
* after a 401 (any method), times out each attempt, retries through
|
|
7
|
+
* `retry`, replays request bodies, optionally follows redirects only to
|
|
8
|
+
* trusted origins, and serves and invalidates cached GETs through an injected
|
|
9
|
+
* cache. The host supplies credentials, header rules, error classes, logging,
|
|
10
|
+
* and spans.
|
|
11
|
+
*/
|
|
12
|
+
import { type RetryPolicy } from "./retry.js";
|
|
13
|
+
import type { CacheLookup } from "./response-cache/policy.js";
|
|
14
|
+
type FetchInput = Request | string | URL;
|
|
15
|
+
/** The fields the transport reads; hosts extend it with their own. */
|
|
16
|
+
export type TransportCredential = {
|
|
17
|
+
token: string;
|
|
18
|
+
/** Stable hash of the login, for cache scoping; never a raw token. */
|
|
19
|
+
identity: string;
|
|
20
|
+
};
|
|
21
|
+
export type CredentialProvider<C extends TransportCredential> = {
|
|
22
|
+
/** The credential for a new request, before any refresh. Cache lookups use it. */
|
|
23
|
+
current(): C | Promise<C>;
|
|
24
|
+
/** Called after a cache miss, before the first attempt, to refresh ahead of expiry. */
|
|
25
|
+
prepare?(credential: C): Promise<C>;
|
|
26
|
+
/** After a 401: the refreshed credential, or undefined when it cannot refresh. */
|
|
27
|
+
refresh?(credential: C): Promise<C | undefined>;
|
|
28
|
+
/** The Authorization value. Throws for a malformed token. */
|
|
29
|
+
authorization?(credential: C): string;
|
|
30
|
+
};
|
|
31
|
+
/** How the caller reads a successful body; see {@link ApiTransportRequestOptions.responseBody}. */
|
|
32
|
+
export type ResponseBodyMode = "auto" | "buffer" | "stream";
|
|
33
|
+
/** The GET cache, keyed by the host. `CacheLookup` comes from `response-cache`. */
|
|
34
|
+
export type TransportCache = {
|
|
35
|
+
lookup(request: CachedRequest): Promise<CacheLookup | undefined>;
|
|
36
|
+
/** Store a successful GET; `response` is a clone the cache may consume. */
|
|
37
|
+
store(request: CachedRequest, response: Response): Promise<void>;
|
|
38
|
+
/** Drop entries a successful write to `url` made stale. */
|
|
39
|
+
invalidate(url: string, identity: string): Promise<void>;
|
|
40
|
+
};
|
|
41
|
+
export type CachedRequest = {
|
|
42
|
+
url: string;
|
|
43
|
+
/** For `Vary` matching. */
|
|
44
|
+
requestHeaders: Record<string, string>;
|
|
45
|
+
identity: string;
|
|
46
|
+
};
|
|
47
|
+
type TransportLogger = {
|
|
48
|
+
debug(message: string, ...args: unknown[]): void;
|
|
49
|
+
};
|
|
50
|
+
export type ApiTransportOptions<C extends TransportCredential> = {
|
|
51
|
+
/**
|
|
52
|
+
* Without credentials the transport leaves Authorization to the request,
|
|
53
|
+
* does not refresh, and does not cache, since entries are scoped to the
|
|
54
|
+
* credential's identity.
|
|
55
|
+
*/
|
|
56
|
+
credentials?: CredentialProvider<C>;
|
|
57
|
+
retry: RetryPolicy;
|
|
58
|
+
/** Per-attempt timeout, or a function of the request URL. Default: none. */
|
|
59
|
+
timeoutMs?: number | ((url: string) => number);
|
|
60
|
+
/** Underlying fetch, read on each call. Defaults to `globalThis.fetch`. */
|
|
61
|
+
fetch?: (input: FetchInput, init?: RequestInit) => Promise<Response>;
|
|
62
|
+
/** Sent when the request sets no `User-Agent`. */
|
|
63
|
+
userAgent?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Add host headers, such as tracing or proxy headers, before Authorization
|
|
66
|
+
* is set. Throw to reject the request, for example for an untrusted host.
|
|
67
|
+
*/
|
|
68
|
+
prepareHeaders?(headers: Headers, request: {
|
|
69
|
+
input: FetchInput;
|
|
70
|
+
credential: C;
|
|
71
|
+
}): void;
|
|
72
|
+
/** Writes the host knows are safe to replay, such as a catalog of idempotent operations. */
|
|
73
|
+
isIdempotent?(method: string, url: string): boolean;
|
|
74
|
+
/** Set to `1` on the request replayed after a credential refresh. */
|
|
75
|
+
refreshedRequestHeader?: string;
|
|
76
|
+
/** Which origins may receive the credential when following redirects. */
|
|
77
|
+
origins?: {
|
|
78
|
+
trusts(url: URL, credential: C): boolean;
|
|
79
|
+
/** The error for an untrusted or unusable redirect destination. */
|
|
80
|
+
reject(destination: string, credential: C): Error;
|
|
81
|
+
};
|
|
82
|
+
/** Host error classes. Without them the transport throws its own. */
|
|
83
|
+
errors?: {
|
|
84
|
+
/**
|
|
85
|
+
* The final attempt timed out. `idempotent` is false when a write may
|
|
86
|
+
* have been applied.
|
|
87
|
+
*/
|
|
88
|
+
timeout?(info: {
|
|
89
|
+
timeoutMs: number;
|
|
90
|
+
idempotent: boolean;
|
|
91
|
+
}): Error;
|
|
92
|
+
/** A fetch error to throw at once, without retrying, such as a TLS failure. */
|
|
93
|
+
fatal?(error: unknown): Error | undefined;
|
|
94
|
+
/** A 429 that is not retried. Undefined returns the response. */
|
|
95
|
+
rateLimited?(response: Response, info: {
|
|
96
|
+
path: string;
|
|
97
|
+
retryAfterMs: number | undefined;
|
|
98
|
+
}): Promise<Error | undefined>;
|
|
99
|
+
};
|
|
100
|
+
cache?: TransportCache;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the current scope skips cache reads, such as a tool call with
|
|
103
|
+
* `fresh: true`. Hosts back it with request-scoped state like
|
|
104
|
+
* `AsyncLocalStorage`. The response is still stored, replacing the entry.
|
|
105
|
+
*/
|
|
106
|
+
fresh?(): boolean;
|
|
107
|
+
logger?: TransportLogger;
|
|
108
|
+
/** Wrap each request, including cache lookups, in a host span. */
|
|
109
|
+
span?(request: {
|
|
110
|
+
method: string;
|
|
111
|
+
path: string;
|
|
112
|
+
}, run: () => Promise<Response>): Promise<Response>;
|
|
113
|
+
};
|
|
114
|
+
export type ApiTransportRequestOptions = {
|
|
115
|
+
/**
|
|
116
|
+
* Replaying the request is harmless, so 5xx, timeouts, and network errors
|
|
117
|
+
* retry for any method. For writes the server dedupes, such as
|
|
118
|
+
* content-addressed chunk uploads.
|
|
119
|
+
*/
|
|
120
|
+
idempotent?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* `buffer` reads a successful body within the attempt's timeout and retry
|
|
123
|
+
* budget; `auto` does so only when it has a `Content-Type`, as the
|
|
124
|
+
* `@sentry/api` auto parser returns a stream otherwise. Default `stream`.
|
|
125
|
+
*/
|
|
126
|
+
responseBody?: ResponseBodyMode;
|
|
127
|
+
/**
|
|
128
|
+
* Follow redirects manually, checking each destination with `origins`
|
|
129
|
+
* and recording where the response came from; see
|
|
130
|
+
* {@link getValidatedResponseSource}. Skips the cache.
|
|
131
|
+
*/
|
|
132
|
+
validateRedirects?: boolean;
|
|
133
|
+
};
|
|
134
|
+
export type ApiTransport = {
|
|
135
|
+
request(input: FetchInput, init?: RequestInit, options?: ApiTransportRequestOptions): Promise<Response>;
|
|
136
|
+
};
|
|
137
|
+
/** The request's last attempt hit the transport's own timeout. */
|
|
138
|
+
export declare class ApiTimeoutError extends Error {
|
|
139
|
+
readonly timeoutMs: number;
|
|
140
|
+
readonly idempotent: boolean;
|
|
141
|
+
constructor(timeoutMs: number, idempotent: boolean);
|
|
142
|
+
}
|
|
143
|
+
/** Where a response fetched with `validateRedirects` came from. */
|
|
144
|
+
export type ValidatedResponseSource = {
|
|
145
|
+
origin: string;
|
|
146
|
+
identity: string;
|
|
147
|
+
};
|
|
148
|
+
/** The final origin and credential identity of a `validateRedirects` response. */
|
|
149
|
+
export declare function getValidatedResponseSource(response: Response): ValidatedResponseSource | undefined;
|
|
150
|
+
/** Extract the full URL from a fetch input; `String(request)` is not its URL. */
|
|
151
|
+
export declare function extractInputUrl(input: FetchInput): string;
|
|
152
|
+
/** The URL pathname for logs and spans, or the raw input when it does not parse. */
|
|
153
|
+
export declare function extractUrlPath(input: FetchInput): string;
|
|
154
|
+
/** Create a transport; see {@link ApiTransportOptions}. */
|
|
155
|
+
export declare function createApiTransport<C extends TransportCredential>(config: ApiTransportOptions<C>): ApiTransport;
|
|
156
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response validation through the Standard Schema interface, so the shared
|
|
3
|
+
* client works with any validator that implements it. The MCP passes Zod
|
|
4
|
+
* schemas and the CLI valibot ones; this module depends on neither.
|
|
5
|
+
*/
|
|
6
|
+
import type { StandardSchemaV1 } from "./standard-schema.js";
|
|
7
|
+
/** A schema the host supplies to check a response body. */
|
|
8
|
+
export type ResponseSchema<Output = unknown> = StandardSchemaV1<unknown, Output>;
|
|
9
|
+
/** A response did not match the schema the caller validated it with. */
|
|
10
|
+
export declare class ApiResponseValidationError extends Error {
|
|
11
|
+
readonly issues: readonly StandardSchemaV1.Issue[];
|
|
12
|
+
constructor(issues: readonly StandardSchemaV1.Issue[]);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate `data` with `schema` and return the schema's output.
|
|
16
|
+
*
|
|
17
|
+
* Responses are validated synchronously, as every caller does today, so a
|
|
18
|
+
* schema with async refinements is rejected rather than awaited.
|
|
19
|
+
*
|
|
20
|
+
* @throws {ApiResponseValidationError} When `data` does not match
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateResponse<Schema extends StandardSchemaV1>(schema: Schema, data: unknown): StandardSchemaV1.InferOutput<Schema>;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -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,
|
|
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
|
|
8
|
+
export declare function setAuthParams(options: Pick<RequestOptions, 'auth' | 'query' | 'security'> & {
|
|
9
9
|
headers: Headers;
|
|
10
|
-
})
|
|
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,
|
|
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> {
|
package/dist/core/auth.gen.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
17
|
+
bodySerializer: (body: unknown) => FormData;
|
|
18
18
|
};
|
|
19
19
|
export declare const jsonBodySerializer: {
|
|
20
|
-
bodySerializer:
|
|
20
|
+
bodySerializer: (body: unknown) => string;
|
|
21
21
|
};
|
|
22
22
|
export declare const urlSearchParamsBodySerializer: {
|
|
23
|
-
bodySerializer:
|
|
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
|
|
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) =>
|
|
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
|
|
71
|
+
export declare function createSseClient<TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions): ServerSentEventsResult<TData>;
|
package/dist/core/types.gen.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
706
|
-
|
|
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"),
|
package/dist/operations.js
CHANGED
|
@@ -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
|
-
"
|
|
3519
|
+
"transactions",
|
|
3514
3520
|
"profiles",
|
|
3515
|
-
"
|
|
3516
|
-
"
|
|
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`. */
|