import { a as HttpRequest, c as OpenCloudHooks, d as Page, f as Result, h as OpenCloudErrorOptions, i as HttpClient, l as RequestConfig, m as OpenCloudError, n as AdmissionWaitObserver, o as HttpResponse, p as SleepFunc, r as AdmissionWaitReason, s as OpenCloudClientOptions, t as AdmissionWaitEvent, u as RequestOptions } from "./types-C3Egi37J.mjs"; import { a as TRANSIENT_TRANSPORT_CODES, c as NetworkError, d as ApiErrorOptions, f as ApiRequestContext, l as NetworkErrorOptions, o as RateLimitError, p as requestContextOf, r as RESPONSE_UNPARSEABLE, s as RateLimitErrorOptions, t as GATEWAY_REJECTED, u as ApiError } from "./retry-DXEklFrt.mjs"; //#region src/client/fetch-http-client.d.ts /** * Creates the fetch-backed HTTP transport Ocale uses by default. * * Wrap the returned transport to add tracing, metrics, recording, or other * request-level behavior while retaining Ocale's authentication, timeout, * upload, response-parsing, and error-classification semantics. * * @returns Ocale's default fetch-backed HTTP transport. * @since 0.3.1 * * @example * * ```ts * import { * createFetchHttpClient, * type HttpClient, * type HttpRequest, * } from "@bedrock-rbx/ocale"; * import { * type DeleteExperienceIconParameters, * UniversesClient, * } from "@bedrock-rbx/ocale/universes"; * * const defaultHttpClient = createFetchHttpClient(); * let observedRequests: ReadonlyArray = []; * const tracedHttpClient: HttpClient = { * async request(request, config) { * observedRequests = [...observedRequests, request]; * return defaultHttpClient.request(request, config); * }, * }; * // A data URL keeps this executable example offline. Production clients * // normally omit baseUrl and use Ocale's Roblox Open Cloud default. * const commonOptions = { apiKey: "your-key", baseUrl: "data:,#" }; * const client = new UniversesClient({ * ...commonOptions, * httpClient: tracedHttpClient, * }); * const undecoratedClient = new UniversesClient({ * ...commonOptions, * httpClient: defaultHttpClient, * }); * const parameters: DeleteExperienceIconParameters = { * languageCode: "en", * universeId: "42", * }; * expect(client).toBeInstanceOf(UniversesClient); * return Promise.all([ * client.icon.delete(parameters), * undecoratedClient.icon.delete(parameters), * ]).then(([result, undecoratedResult]) => { * expect(observedRequests).toStrictEqual([{ * method: "DELETE", * url: "/legacy-game-internationalization/v1/game-icon/games/42/language-codes/en", * }]); * expect(result).toStrictEqual({ data: undefined, success: true }); * expect(result).toStrictEqual(undecoratedResult); * }); * ``` */ declare const createFetchHttpClient: () => HttpClient; //#endregion //#region src/errors/permission-error.d.ts /** * Options for constructing a {@link PermissionError}. * * @since 0.1.0 */ interface PermissionErrorOptions extends ApiErrorOptions { /** * Stable identifier of the Open Cloud operation that returned the * permission failure (matches `OperationLimit.operationKey`, e.g. * `"developer-products.create"`). */ operationKey: string; /** * Scope strings the API key or OAuth token must carry for the failing * operation, sourced from the vendored OpenAPI schema's `x-roblox-scopes` * for that operationId. */ requiredScopes: ReadonlyArray; } /** * Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation * whose required scopes are known. Subclass of {@link ApiError} carrying the * scope strings the operation requires plus the operation key, so a consumer * can name them when guiding the user to their API key settings. * * The scopes are what the operation needs, not a diagnosis of what the * credential lacks: a 403 does mean the scopes fall short, but Roblox also * answers 401 for a key that is invalid, disabled, or expired. Check * {@link ApiError.statusCode} before wording the failure as a missing scope. * * @since 0.1.0 * * @example * * ```ts * import { PermissionError } from "@bedrock-rbx/ocale"; * * const error = new PermissionError("HTTP 403", { * operationKey: "developer-products.create", * requiredScopes: ["creator-store-product:write"], * statusCode: 403, * }); * * expect(error).toBeInstanceOf(PermissionError); * expect(error.requiredScopes).toStrictEqual(["creator-store-product:write"]); * expect(error.operationKey).toBe("developer-products.create"); * ``` */ declare class PermissionError extends ApiError { override readonly name: string; readonly operationKey: string; readonly requiredScopes: ReadonlyArray; /** * Creates a new PermissionError. * * @param message - Human-readable error description. * @param options - Error options including status code, the operation key, * and the scopes the caller's credential must carry. */ constructor(message: string, options: PermissionErrorOptions); } //#endregion //#region src/errors/poll-aborted.d.ts /** * Options for constructing a {@link PollAbortedError}. * * @since 0.1.0 */ interface PollAbortedErrorOptions extends ErrorOptions { /** Whatever `AbortSignal.reason` was at the moment of abort. */ readonly reason?: unknown; } /** * Returned when `pollUntilDone` is interrupted by an `AbortSignal` before * a terminal task state is reached. The `reason` field mirrors * `AbortSignal.reason` so callers can distinguish intentional cancellation * from unexpected abort sources. * * @since 0.1.0 * * @example * * ```ts * import { PollAbortedError } from "@bedrock-rbx/ocale"; * * const error = new PollAbortedError("polling was aborted", { * reason: "user cancelled", * }); * * expect(error).toBeInstanceOf(PollAbortedError); * expect(error.reason).toBe("user cancelled"); * ``` */ declare class PollAbortedError extends OpenCloudError { override readonly name: string; readonly reason?: unknown; /** * Creates a new PollAbortedError. * * @param message - Human-readable description of the abort. * @param options - Error options including the abort reason. */ constructor(message: string, options?: PollAbortedErrorOptions); } //#endregion //#region src/errors/poll-timeout.d.ts /** * Options for {@link PollTimeoutError}. The `T` type parameter captures the * resource-specific task variant the caller polled for; defaults to `unknown` * so the class can be reused by future Resources without forcing a parallel * hierarchy. * * @since 0.1.0 * * @template T - Resource-specific task type being polled. */ interface PollTimeoutErrorOptions extends ErrorOptions { /** Last task observed before the timeout budget was exhausted. */ readonly lastObservedTask?: T | undefined; /** Total wall-clock budget supplied by the caller, in ms. */ readonly timeoutMs: number; } /** * Returned when `pollUntilDone` exhausts its wall-clock budget without * observing a terminal task state. Carries the last task polled so callers * can inspect state and decide whether to retry with a fresh budget. * * @since 0.1.0 * * @template T - Resource-specific task type being polled. * * @example * * ```ts * import { PollTimeoutError } from "@bedrock-rbx/ocale"; * * const error = new PollTimeoutError("polling timed out after 5 s", { * lastObservedTask: { state: "PROCESSING" as const }, * timeoutMs: 5000, * }); * * expect(error).toBeInstanceOf(PollTimeoutError); * expect(error.timeoutMs).toBe(5000); * expect(error.lastObservedTask).toStrictEqual({ state: "PROCESSING" }); * ``` */ declare class PollTimeoutError extends OpenCloudError { readonly lastObservedTask: T | undefined; override readonly name: string; readonly timeoutMs: number; /** * Creates a new PollTimeoutError. * * @param message - Human-readable description of the timeout. * @param options - Error options including the budget and last-observed task. */ constructor(message: string, options: PollTimeoutErrorOptions); } //#endregion //#region src/errors/request-aborted.d.ts /** * Options for constructing a {@link RequestAbortedError}. * * @since 0.3.1 */ interface RequestAbortedErrorOptions extends ErrorOptions { /** Whatever `AbortSignal.reason` was at the moment of cancellation. */ readonly reason?: unknown; } /** * Returned when a caller's `AbortSignal` cancels an Open Cloud request. * The reason is preserved so intentional cancellation can be distinguished * from transport failures and SDK-owned request timeouts. * * @since 0.3.1 * * @example * * ```ts * import { RequestAbortedError } from "@bedrock-rbx/ocale"; * * const error = new RequestAbortedError("Request was aborted", { * reason: "superseded", * }); * * expect(error).toBeInstanceOf(RequestAbortedError); * expect(error.reason).toBe("superseded"); * ``` */ declare class RequestAbortedError extends OpenCloudError { override readonly name: string; readonly reason?: unknown; /** * Creates a new RequestAbortedError. * * @param message - Human-readable description of the cancellation. * @param options - Error options including the caller's abort reason. */ constructor(message: string, options?: RequestAbortedErrorOptions); } //#endregion //#region src/errors/request-deadline-exceeded.d.ts /** * Options for constructing a {@link RequestDeadlineExceededError}. * * @since 0.3.2 */ interface RequestDeadlineExceededErrorOptions extends ErrorOptions { /** Absolute caller-supplied deadline, as Unix epoch milliseconds. */ readonly deadlineMs: number; /** Time left when the SDK refused or ended the wait. */ readonly remainingMs: number; /** Intended wait duration, when it was known before waiting. */ readonly waitMs?: number | undefined; /** SDK admission mechanism whose wait could not meet the deadline. */ readonly waitReason?: AdmissionWaitReason | undefined; } /** * Returned when a logical request cannot complete by its absolute deadline. * Optional wait details identify an SDK-managed admission wait that was * refused. This is distinct from caller cancellation so consumers can report * exhausted wall-clock budget accurately. * * @since 0.3.2 * * @example * * ```ts * import { RequestDeadlineExceededError } from "@bedrock-rbx/ocale"; * * const error = new RequestDeadlineExceededError("Request deadline elapsed", { * deadlineMs: 1_000_000, * remainingMs: 0, * waitReason: "operation-queue", * }); * * expect(error.remainingMs).toBe(0); * expect(error.waitReason).toBe("operation-queue"); * ``` */ declare class RequestDeadlineExceededError extends OpenCloudError { /** Absolute caller-supplied deadline, as Unix epoch milliseconds. */ readonly deadlineMs: number; override readonly name: string; /** Time left when the SDK refused or ended the wait. */ readonly remainingMs: number; /** Intended wait duration, when known. */ readonly waitMs: number | undefined; /** SDK admission mechanism whose wait could not meet the deadline. */ readonly waitReason: AdmissionWaitReason | undefined; /** * Creates a new RequestDeadlineExceededError. * * @param message - Human-readable description of the exhausted deadline. * @param options - Deadline, remaining budget, and optional wait details. */ constructor(message: string, options: RequestDeadlineExceededErrorOptions); } //#endregion //#region src/errors/retry-delay-exceeded.d.ts /** * Options for constructing a {@link RetryDelayExceededError}. * * @since 0.3.2 */ interface RetryDelayExceededErrorOptions extends ErrorOptions { /** Absolute caller-supplied deadline, as Unix epoch milliseconds. */ readonly deadlineMs: number; /** Time left when the SDK refused the retry delay. */ readonly remainingMs: number; /** Computed retry delay that could not fit before the deadline. */ readonly retryAfterMs: number; } /** * Returned when the SDK refuses a retry delay that cannot complete before the * request deadline. This is distinct from cancellation so consumers can * report the server's stated retry time without waiting for it. * * @since 0.3.2 * * @example * * ```ts * import { RetryDelayExceededError } from "@bedrock-rbx/ocale"; * * const error = new RetryDelayExceededError("Retry delay exceeds the request deadline", { * deadlineMs: 1_000_000, * remainingMs: 495_000, * retryAfterMs: 1_856_000, * }); * * expect(error.retryAfterMs).toBe(1_856_000); * expect(error.remainingMs).toBe(495_000); * ``` */ declare class RetryDelayExceededError extends RequestDeadlineExceededError { override readonly name: string; /** Computed retry delay refused by the SDK, in milliseconds. */ readonly retryAfterMs: number; /** Computed retry delay refused by the SDK, in seconds. */ readonly retryAfterSeconds: number; /** * Creates a new RetryDelayExceededError. * * @param message - Human-readable description of the refused retry delay. * @param options - Refused delay, deadline budget, and original failure. */ constructor(message: string, options: RetryDelayExceededErrorOptions); } //#endregion //#region src/errors/validation.d.ts /** * Closed discriminator for a {@link ValidationError}. Consumers can * exhaustively `switch` over this union so TypeScript will refuse to compile * if a new variant is added without a handler. * * @since 0.1.0 */ type ValidationErrorCode = "empty_body" | "empty_image_ids" | "empty_update" | "format_mismatch" | "incomplete_ref" | "invalid_image_id"; /** * Options for constructing a {@link ValidationError}. * * @since 0.1.0 */ interface ValidationErrorOptions extends ErrorOptions { /** Machine-readable discriminator identifying the validation failure. */ code: ValidationErrorCode; } /** * Thrown locally when caller-supplied input is rejected before any HTTP * round-trip. The `code` discriminator lets consumers branch on local-input * errors separately from server-side errors. * * @since 0.1.0 * * @example * * ```ts * import { ValidationError } from "@bedrock-rbx/ocale"; * * const error = new ValidationError("Place body is empty", { * code: "empty_body", * }); * * expect(error).toBeInstanceOf(ValidationError); * expect(error.code).toBe("empty_body"); * ``` */ declare class ValidationError extends OpenCloudError { override readonly code: ValidationErrorCode; override readonly name: string; /** * Creates a new ValidationError. * * @param message - Human-readable error description. * @param options - Error options including the validation failure code. */ constructor(message: string, options: ValidationErrorOptions); } //#endregion export { type AdmissionWaitEvent, type AdmissionWaitObserver, type AdmissionWaitReason, ApiError, type ApiErrorOptions, type ApiRequestContext, GATEWAY_REJECTED, type HttpClient, type HttpRequest, type HttpResponse, NetworkError, type NetworkErrorOptions, type OpenCloudClientOptions, OpenCloudError, type OpenCloudErrorOptions, type OpenCloudHooks, type Page, PermissionError, type PermissionErrorOptions, PollAbortedError, type PollAbortedErrorOptions, PollTimeoutError, type PollTimeoutErrorOptions, RESPONSE_UNPARSEABLE, RateLimitError, type RateLimitErrorOptions, RequestAbortedError, type RequestAbortedErrorOptions, type RequestConfig, RequestDeadlineExceededError, type RequestDeadlineExceededErrorOptions, type RequestOptions, type Result, RetryDelayExceededError, type RetryDelayExceededErrorOptions, type SleepFunc, TRANSIENT_TRANSPORT_CODES, ValidationError, type ValidationErrorCode, type ValidationErrorOptions, createFetchHttpClient, requestContextOf }; //# sourceMappingURL=index.d.mts.map