@spooled/sdk 1.3.0 → 1.4.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 +79 -8
- package/dist/{index-BVWKEr6p.d.cts → index-DzTC8ld3.d.cts} +569 -95
- package/dist/{index-BVWKEr6p.d.ts → index-DzTC8ld3.d.ts} +569 -95
- package/dist/index.cjs +341 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -186
- package/dist/index.d.ts +3 -186
- package/dist/index.js +341 -126
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +1 -1
- package/dist/worker/index.d.ts +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +4 -3
- package/proto/spooled.proto +19 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-
|
|
2
|
-
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as
|
|
1
|
+
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-DzTC8ld3.cjs';
|
|
2
|
+
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as ApiErrorBody, u as ApiKeySummary, v as ApiKeysResource, w as AuthResource, x as AuthenticationError, y as AuthorizationError, B as BatchJobStatus, z as BillingResource, D as BillingStatus, E as BoostPriorityResponse, F as BulkEnqueueParams, G as BulkEnqueueResponse, H as BulkJobItem, I as CheckEmailResponse, J as CheckSlugResponse, K as CircuitBreaker, L as CircuitBreakerConfig, M as CircuitBreakerOpenError, N as CircuitBreakerOptions, O as CircuitState, P as CircuitStateChange, Q as ClaimJobsParams, T as ClaimJobsResult, U as ClaimedJob, V as CompleteJobParams, W as ConflictError, X as CreateApiKeyParams, Y as CreateApiKeyResponse, Z as CreateBillingPortalParams, _ as CreateBillingPortalResponse, $ as CreateJobParams, a0 as CreateJobResult, a1 as CreateOrganizationParams, a2 as CreateOrganizationResponse, a3 as CreateOutgoingWebhookParams, a4 as CreateScheduleParams, a5 as CreateScheduleResponse, a6 as CreateWorkflowParams, a7 as CreateWorkflowResponse, a8 as CurrentUserResponse, a9 as DEFAULT_CONFIG, aa as DashboardData, ab as DashboardResource, ac as DashboardWorkerSummary, ad as DebugFn, ae as DeleteQueueOptions, af as DependencyInfo, ag as DependencyMode, ah as FailJobParams, ai as GrpcClientOptions, aj as GrpcCompleteJobParams, ak as GrpcCompleteJobResponse, al as GrpcCompleteRequest, am as GrpcCompleteResponse, an as GrpcDequeueJobParams, ao as GrpcDequeueJobResponse, ap as GrpcDequeueRequest, aq as GrpcDequeueResponse, ar as GrpcDeregisterRequest, as as GrpcDeregisterResponse, at as GrpcEnqueueJobParams, au as GrpcEnqueueJobResponse, av as GrpcEnqueueRequest, aw as GrpcEnqueueResponse, ax as GrpcErrorResponse, ay as GrpcFailJobParams, az as GrpcFailJobResponse, aA as GrpcFailRequest, aB as GrpcFailResponse, aC as GrpcGetJobRequest, aD as GrpcGetJobResponse, aE as GrpcGetQueueStatsRequest, aF as GrpcGetQueueStatsResponse, aG as GrpcGetQueueStatsResponse_Legacy, aH as GrpcHeartbeatParams, aI as GrpcHeartbeatRequest, aJ as GrpcHeartbeatResponse, aK as GrpcHeartbeatResponse_Legacy, aL as GrpcJob, aM as GrpcJobStatus, aN as GrpcJobStatusNumber, aO as GrpcProcessRequest, aP as GrpcProcessResponse, aQ as GrpcQueueOperations, aR as GrpcRegisterWorkerParams, aS as GrpcRegisterWorkerRequest, aT as GrpcRegisterWorkerResponse, aU as GrpcRegisterWorkerResponse_Legacy, aV as GrpcRenewLeaseParams, aW as GrpcRenewLeaseRequest, aX as GrpcRenewLeaseResponse, aY as GrpcRenewLeaseResponse_Legacy, aZ as GrpcStreamJobsRequest, a_ as GrpcTimestamp, a$ as GrpcWorkerOperations, b0 as HealthResource, b1 as HealthResponse, b2 as HeartbeatEvent, b3 as HeartbeatJobParams, b4 as HttpClient, b5 as InboundDeliveryStatus, b6 as InboundWebhookDelivery, b7 as IngestCustomWebhookParams, b8 as IngestCustomWebhookResponse, b9 as IngestGitHubWebhookOptions, ba as IngestStripeWebhookOptions, bb as InitialApiKey, bc as Job, bd as JobCompletedEvent, be as JobContext, bf as JobCreatedEvent, bg as JobFailedEvent, bh as JobHandler, bi as JobHistoryEvent, bj as JobHistoryEventType, bk as JobHistoryParams, bl as JobProgressEvent, bm as JobResult, bn as JobSearchParams, bo as JobStartedEvent, bp as JobStats, bq as JobStatus, br as JobStatusChangedEvent, bs as JobStream, bt as JobSummary, bu as JobSummaryStats, bv as JobWithDependencies, bw as JobsResource, bx as JsonArray, by as JsonObject, bz as JsonPrimitive, bA as JsonValue, bB as ListDlqParams, bC as ListInboundDeliveriesParams, bD as ListJobsParams, bE as ListPage, bF as ListParams, bG as ListSchedulesParams, bH as ListWorkflowsParams, bI as LoginParams, bJ as LoginResponse, bK as MetricsResource, bL as NetworkError, bM as NotFoundError, bN as Organization, bO as OrganizationMember, bP as OrganizationSummary, bQ as OrganizationUsage, bR as OrganizationsResource, bS as OutgoingWebhook, bT as OutgoingWebhookDelivery, bU as PaginatedResponse, bV as PaginationParams, bW as PauseQueueResponse, bX as PayloadTooLargeError, bY as PlanCount, bZ as PlanLimits, b_ as PlanTier, b$ as ProcessJobsStream, c0 as PurgeDlqParams, c1 as PurgeDlqResponse, c2 as QueueConfig, c3 as QueueConfigSummary, c4 as QueuePausedEvent, c5 as QueueResumedEvent, c6 as QueueStats, c7 as QueueSummary, c8 as QueuesResource, c9 as RateLimitError, ca as RateLimitInfo, cb as RealtimeEventData, cc as RecentActivity, cd as RefreshTokenParams, ce as RefreshTokenResponse, cf as RegisterWorkerParams, cg as RegisterWorkerResponse, ch as ResolvedConfig, ci as ResourceUsage, cj as ResumeQueueResponse, ck as RetryDlqParams, cl as RetryDlqResponse, cm as SDK_VERSION, cn as Schedule, co as ScheduleRun, cp as ScheduleRunStatus, cq as ScheduleTriggeredEvent, cr as SchedulesResource, cs as ServerError, ct as SpooledClient, cu as SpooledClientConfig, cv as SpooledError, cw as SpooledGrpcClient, cx as SpooledRealtime, cy as SpooledRealtimeOptions, cz as SpooledWorker, cA as SpooledWorkerOptions, cB as StartEmailLoginResponse, cC as StreamOptions, cD as SystemInfo, cE as TestWebhookResponse, cF as TimeoutError, cG as TokenClaims, cH as TriggerScheduleResponse, cI as UnsupportedOperationError, cJ as UpdateApiKeyParams, cK as UpdateOrganizationParams, cL as UpdateOutgoingWebhookParams, cM as UpdateQueueConfigParams, cN as UpdateScheduleParams, cO as UsageItem, cP as UsageWarning, cQ as ValidateTokenParams, cR as ValidateTokenResponse, cS as ValidationError, cT as WebhookDeliveryStatus, cU as WebhookEventType, cV as WebhookFormat, cW as WebhookIngestionResource, cX as WebhookTokenResponse, cY as WebhooksResource, cZ as Worker, c_ as WorkerDeregisteredEvent, c$ as WorkerEvent, d0 as WorkerEventData, d1 as WorkerHeartbeatParams, d2 as WorkerRegisteredEvent, d3 as WorkerState, d4 as WorkerStatus, d5 as WorkerSummary, d6 as WorkersResource, d7 as Workflow, d8 as WorkflowJob, d9 as WorkflowJobDefinition, da as WorkflowJobStatus, db as WorkflowResponse, dc as WorkflowStatus, dd as WorkflowsResource, de as asyncIterableFromStream, df as createCircuitBreaker, dg as createClient, dh as createErrorFromResponse, di as createHttpClient, dj as createJobStream, dk as createPaginatedResponse, dl as createProcessJobsStream, dm as dateToTimestamp, dn as isCircuitBreakerFailure, dp as isRetryableError, dq as isSpooledError, dr as parseRateLimitHeaders, ds as resolveConfig, dt as timestampToDate, du as validateConfig } from './index-DzTC8ld3.cjs';
|
|
3
3
|
import * as protoLoader from '@grpc/proto-loader';
|
|
4
4
|
import { ServiceClientConstructor } from '@grpc/grpc-js';
|
|
5
5
|
|
|
@@ -171,189 +171,6 @@ declare class SseRealtimeClient {
|
|
|
171
171
|
private scheduleReconnect;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
/**
|
|
175
|
-
* Custom Error Classes
|
|
176
|
-
*
|
|
177
|
-
* Provides a hierarchy of error types for the Spooled SDK.
|
|
178
|
-
*/
|
|
179
|
-
/** Error response body from the API */
|
|
180
|
-
interface ApiErrorBody {
|
|
181
|
-
code: string;
|
|
182
|
-
message: string;
|
|
183
|
-
details?: Record<string, unknown>;
|
|
184
|
-
}
|
|
185
|
-
/** Rate limit information parsed from headers */
|
|
186
|
-
interface RateLimitInfo {
|
|
187
|
-
/** Maximum requests per window */
|
|
188
|
-
limit?: number;
|
|
189
|
-
/** Remaining requests in current window */
|
|
190
|
-
remaining?: number;
|
|
191
|
-
/** Unix timestamp when the window resets */
|
|
192
|
-
reset?: Date;
|
|
193
|
-
/** Seconds to wait before retrying */
|
|
194
|
-
retryAfter?: number;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Base error class for all Spooled SDK errors
|
|
198
|
-
*/
|
|
199
|
-
declare class SpooledError extends Error {
|
|
200
|
-
/** HTTP status code (if applicable) */
|
|
201
|
-
readonly statusCode: number;
|
|
202
|
-
/** Error code from API response */
|
|
203
|
-
readonly code: string;
|
|
204
|
-
/** Additional error details */
|
|
205
|
-
readonly details?: Record<string, unknown>;
|
|
206
|
-
/** Request ID for debugging */
|
|
207
|
-
readonly requestId?: string;
|
|
208
|
-
/** Original cause of the error */
|
|
209
|
-
readonly cause?: Error;
|
|
210
|
-
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>, requestId?: string, cause?: Error);
|
|
211
|
-
/**
|
|
212
|
-
* Whether this error is retryable.
|
|
213
|
-
*
|
|
214
|
-
* Only 408 (Request Timeout) is retryable among the plain 4xx statuses: the
|
|
215
|
-
* server gave up waiting for the request, so it never ran. Subclasses
|
|
216
|
-
* override this (5xx, network, timeout, rate limit).
|
|
217
|
-
*/
|
|
218
|
-
isRetryable(): boolean;
|
|
219
|
-
/** Convert to plain object for logging */
|
|
220
|
-
toJSON(): Record<string, unknown>;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Authentication error (401)
|
|
224
|
-
* Thrown when authentication fails (invalid/expired token or API key)
|
|
225
|
-
*/
|
|
226
|
-
declare class AuthenticationError extends SpooledError {
|
|
227
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Authorization error (403)
|
|
231
|
-
* Thrown when the authenticated user lacks permission
|
|
232
|
-
*/
|
|
233
|
-
declare class AuthorizationError extends SpooledError {
|
|
234
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Not found error (404)
|
|
238
|
-
* Thrown when a requested resource doesn't exist
|
|
239
|
-
*/
|
|
240
|
-
declare class NotFoundError extends SpooledError {
|
|
241
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Conflict error (409)
|
|
245
|
-
* Thrown when there's a conflict (e.g., duplicate resource)
|
|
246
|
-
*/
|
|
247
|
-
declare class ConflictError extends SpooledError {
|
|
248
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Validation error (400 or 422)
|
|
252
|
-
* Thrown when request validation fails.
|
|
253
|
-
*
|
|
254
|
-
* The API answers a field-rule failure (length, range) with 400 but a missing
|
|
255
|
-
* or mistyped JSON field with 422; both are the caller's request being invalid,
|
|
256
|
-
* so both surface as this class. `statusCode` tells them apart.
|
|
257
|
-
*/
|
|
258
|
-
declare class ValidationError extends SpooledError {
|
|
259
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string, statusCode?: 400 | 422);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Payload too large error (413)
|
|
263
|
-
* Thrown when request body exceeds size limit
|
|
264
|
-
*/
|
|
265
|
-
declare class PayloadTooLargeError extends SpooledError {
|
|
266
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Rate limit error (429)
|
|
270
|
-
* Thrown when rate limit is exceeded, or a plan quota is (see `isQuota`)
|
|
271
|
-
*/
|
|
272
|
-
declare class RateLimitError extends SpooledError {
|
|
273
|
-
/** Rate limit information */
|
|
274
|
-
readonly rateLimitInfo: RateLimitInfo;
|
|
275
|
-
constructor(message?: string, code?: string, rateLimitInfo?: RateLimitInfo, details?: Record<string, unknown>, requestId?: string);
|
|
276
|
-
/**
|
|
277
|
-
* True when this 429 is a plan quota or limit (daily job cap, active jobs,
|
|
278
|
-
* queue/worker/webhook caps) rather than per-second rate limiting.
|
|
279
|
-
*
|
|
280
|
-
* A quota does not clear for minutes or hours, so retrying it only blocks the
|
|
281
|
-
* caller for the whole backoff and, via the circuit breaker, takes every
|
|
282
|
-
* other call on the client down with it. It is never retried and never
|
|
283
|
-
* counted as a circuit breaker failure.
|
|
284
|
-
*
|
|
285
|
-
* Detection: the `QUOTA_EXCEEDED` code, or, for older plan-limit paths that
|
|
286
|
-
* answer with plain text wrapped as `RATE_LIMIT_EXCEEDED`, a "... limit
|
|
287
|
-
* reached" message that carries no `Retry-After`.
|
|
288
|
-
*/
|
|
289
|
-
get isQuota(): boolean;
|
|
290
|
-
isRetryable(): boolean;
|
|
291
|
-
/** Get the number of seconds to wait before retrying */
|
|
292
|
-
getRetryAfter(): number;
|
|
293
|
-
toJSON(): Record<string, unknown>;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Server error (5xx)
|
|
297
|
-
* Thrown when the server encounters an error
|
|
298
|
-
*/
|
|
299
|
-
declare class ServerError extends SpooledError {
|
|
300
|
-
constructor(message?: string, statusCode?: number, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
301
|
-
isRetryable(): boolean;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Network error
|
|
305
|
-
* Thrown when a network request fails (no response received)
|
|
306
|
-
*/
|
|
307
|
-
declare class NetworkError extends SpooledError {
|
|
308
|
-
constructor(message?: string, cause?: Error);
|
|
309
|
-
isRetryable(): boolean;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Timeout error
|
|
313
|
-
* Thrown when a request times out
|
|
314
|
-
*/
|
|
315
|
-
declare class TimeoutError extends SpooledError {
|
|
316
|
-
/** Timeout duration in milliseconds */
|
|
317
|
-
readonly timeoutMs: number;
|
|
318
|
-
constructor(message?: string, timeoutMs?: number);
|
|
319
|
-
isRetryable(): boolean;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Circuit breaker open error
|
|
323
|
-
* Thrown when the circuit breaker is open and rejecting requests
|
|
324
|
-
*/
|
|
325
|
-
declare class CircuitBreakerOpenError extends SpooledError {
|
|
326
|
-
constructor(message?: string);
|
|
327
|
-
isRetryable(): boolean;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Unsupported operation error
|
|
331
|
-
* Thrown by SDK methods whose route the Spooled API does not provide (or
|
|
332
|
-
* always rejects). It is raised before any network call, so code that still
|
|
333
|
-
* calls such a method fails loudly with an explanation instead of a 404.
|
|
334
|
-
*/
|
|
335
|
-
declare class UnsupportedOperationError extends SpooledError {
|
|
336
|
-
/** The SDK method that is not supported, e.g. `ingest.github` */
|
|
337
|
-
readonly operation: string;
|
|
338
|
-
constructor(operation: string, reason: string);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Parse rate limit headers from a Response
|
|
342
|
-
*/
|
|
343
|
-
declare function parseRateLimitHeaders(headers: Headers): RateLimitInfo;
|
|
344
|
-
/**
|
|
345
|
-
* Create an appropriate error from an HTTP response
|
|
346
|
-
*/
|
|
347
|
-
declare function createErrorFromResponse(response: Response): Promise<SpooledError>;
|
|
348
|
-
/**
|
|
349
|
-
* Check if an error is a SpooledError instance
|
|
350
|
-
*/
|
|
351
|
-
declare function isSpooledError(error: unknown): error is SpooledError;
|
|
352
|
-
/**
|
|
353
|
-
* Check if an error is retryable
|
|
354
|
-
*/
|
|
355
|
-
declare function isRetryableError(error: unknown): boolean;
|
|
356
|
-
|
|
357
174
|
/**
|
|
358
175
|
* Proto Loader Utility
|
|
359
176
|
*
|
|
@@ -497,4 +314,4 @@ declare function convertResponse<T>(body: T): T;
|
|
|
497
314
|
*/
|
|
498
315
|
declare function convertQueryParams(params: Record<string, string | number | boolean | undefined>): Record<string, string>;
|
|
499
316
|
|
|
500
|
-
export {
|
|
317
|
+
export { ConnectionState, PROTO_LOADER_OPTIONS, RealtimeConnectionOptions, RealtimeEvent, RealtimeEventType, RetryConfig, type SpooledProtoDefinition, SseRealtimeClient, SubscriptionFilter, WebSocketRealtimeClient, calculateDelay, camelToSnake, clearProtoCache, convertQueryParams, convertRequest, convertResponse, createRetryWrapper, getProtoPath, loadProtoDefinition, loadProtoDefinitionAsync, shouldRetry, sleep, snakeToCamel, toCamelCase, toSnakeCase, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-
|
|
2
|
-
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as
|
|
1
|
+
import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-DzTC8ld3.js';
|
|
2
|
+
export { A as API_VERSION, d as AddDependenciesParams, e as AddDependenciesResponse, f as AdminApiKeyResponse, g as AdminCreateApiKeyParams, h as AdminCreateOrganizationParams, i as AdminCreateOrganizationResponse, j as AdminDeleteOrganizationParams, k as AdminListOrganizationsParams, l as AdminOrganizationDetail, m as AdminOrganizationList, n as AdminOrganizationSummary, o as AdminPlanLimits, p as AdminPlatformStats, q as AdminResource, r as AdminUpdateOrganizationParams, s as AdminUsageStats, t as ApiErrorBody, u as ApiKeySummary, v as ApiKeysResource, w as AuthResource, x as AuthenticationError, y as AuthorizationError, B as BatchJobStatus, z as BillingResource, D as BillingStatus, E as BoostPriorityResponse, F as BulkEnqueueParams, G as BulkEnqueueResponse, H as BulkJobItem, I as CheckEmailResponse, J as CheckSlugResponse, K as CircuitBreaker, L as CircuitBreakerConfig, M as CircuitBreakerOpenError, N as CircuitBreakerOptions, O as CircuitState, P as CircuitStateChange, Q as ClaimJobsParams, T as ClaimJobsResult, U as ClaimedJob, V as CompleteJobParams, W as ConflictError, X as CreateApiKeyParams, Y as CreateApiKeyResponse, Z as CreateBillingPortalParams, _ as CreateBillingPortalResponse, $ as CreateJobParams, a0 as CreateJobResult, a1 as CreateOrganizationParams, a2 as CreateOrganizationResponse, a3 as CreateOutgoingWebhookParams, a4 as CreateScheduleParams, a5 as CreateScheduleResponse, a6 as CreateWorkflowParams, a7 as CreateWorkflowResponse, a8 as CurrentUserResponse, a9 as DEFAULT_CONFIG, aa as DashboardData, ab as DashboardResource, ac as DashboardWorkerSummary, ad as DebugFn, ae as DeleteQueueOptions, af as DependencyInfo, ag as DependencyMode, ah as FailJobParams, ai as GrpcClientOptions, aj as GrpcCompleteJobParams, ak as GrpcCompleteJobResponse, al as GrpcCompleteRequest, am as GrpcCompleteResponse, an as GrpcDequeueJobParams, ao as GrpcDequeueJobResponse, ap as GrpcDequeueRequest, aq as GrpcDequeueResponse, ar as GrpcDeregisterRequest, as as GrpcDeregisterResponse, at as GrpcEnqueueJobParams, au as GrpcEnqueueJobResponse, av as GrpcEnqueueRequest, aw as GrpcEnqueueResponse, ax as GrpcErrorResponse, ay as GrpcFailJobParams, az as GrpcFailJobResponse, aA as GrpcFailRequest, aB as GrpcFailResponse, aC as GrpcGetJobRequest, aD as GrpcGetJobResponse, aE as GrpcGetQueueStatsRequest, aF as GrpcGetQueueStatsResponse, aG as GrpcGetQueueStatsResponse_Legacy, aH as GrpcHeartbeatParams, aI as GrpcHeartbeatRequest, aJ as GrpcHeartbeatResponse, aK as GrpcHeartbeatResponse_Legacy, aL as GrpcJob, aM as GrpcJobStatus, aN as GrpcJobStatusNumber, aO as GrpcProcessRequest, aP as GrpcProcessResponse, aQ as GrpcQueueOperations, aR as GrpcRegisterWorkerParams, aS as GrpcRegisterWorkerRequest, aT as GrpcRegisterWorkerResponse, aU as GrpcRegisterWorkerResponse_Legacy, aV as GrpcRenewLeaseParams, aW as GrpcRenewLeaseRequest, aX as GrpcRenewLeaseResponse, aY as GrpcRenewLeaseResponse_Legacy, aZ as GrpcStreamJobsRequest, a_ as GrpcTimestamp, a$ as GrpcWorkerOperations, b0 as HealthResource, b1 as HealthResponse, b2 as HeartbeatEvent, b3 as HeartbeatJobParams, b4 as HttpClient, b5 as InboundDeliveryStatus, b6 as InboundWebhookDelivery, b7 as IngestCustomWebhookParams, b8 as IngestCustomWebhookResponse, b9 as IngestGitHubWebhookOptions, ba as IngestStripeWebhookOptions, bb as InitialApiKey, bc as Job, bd as JobCompletedEvent, be as JobContext, bf as JobCreatedEvent, bg as JobFailedEvent, bh as JobHandler, bi as JobHistoryEvent, bj as JobHistoryEventType, bk as JobHistoryParams, bl as JobProgressEvent, bm as JobResult, bn as JobSearchParams, bo as JobStartedEvent, bp as JobStats, bq as JobStatus, br as JobStatusChangedEvent, bs as JobStream, bt as JobSummary, bu as JobSummaryStats, bv as JobWithDependencies, bw as JobsResource, bx as JsonArray, by as JsonObject, bz as JsonPrimitive, bA as JsonValue, bB as ListDlqParams, bC as ListInboundDeliveriesParams, bD as ListJobsParams, bE as ListPage, bF as ListParams, bG as ListSchedulesParams, bH as ListWorkflowsParams, bI as LoginParams, bJ as LoginResponse, bK as MetricsResource, bL as NetworkError, bM as NotFoundError, bN as Organization, bO as OrganizationMember, bP as OrganizationSummary, bQ as OrganizationUsage, bR as OrganizationsResource, bS as OutgoingWebhook, bT as OutgoingWebhookDelivery, bU as PaginatedResponse, bV as PaginationParams, bW as PauseQueueResponse, bX as PayloadTooLargeError, bY as PlanCount, bZ as PlanLimits, b_ as PlanTier, b$ as ProcessJobsStream, c0 as PurgeDlqParams, c1 as PurgeDlqResponse, c2 as QueueConfig, c3 as QueueConfigSummary, c4 as QueuePausedEvent, c5 as QueueResumedEvent, c6 as QueueStats, c7 as QueueSummary, c8 as QueuesResource, c9 as RateLimitError, ca as RateLimitInfo, cb as RealtimeEventData, cc as RecentActivity, cd as RefreshTokenParams, ce as RefreshTokenResponse, cf as RegisterWorkerParams, cg as RegisterWorkerResponse, ch as ResolvedConfig, ci as ResourceUsage, cj as ResumeQueueResponse, ck as RetryDlqParams, cl as RetryDlqResponse, cm as SDK_VERSION, cn as Schedule, co as ScheduleRun, cp as ScheduleRunStatus, cq as ScheduleTriggeredEvent, cr as SchedulesResource, cs as ServerError, ct as SpooledClient, cu as SpooledClientConfig, cv as SpooledError, cw as SpooledGrpcClient, cx as SpooledRealtime, cy as SpooledRealtimeOptions, cz as SpooledWorker, cA as SpooledWorkerOptions, cB as StartEmailLoginResponse, cC as StreamOptions, cD as SystemInfo, cE as TestWebhookResponse, cF as TimeoutError, cG as TokenClaims, cH as TriggerScheduleResponse, cI as UnsupportedOperationError, cJ as UpdateApiKeyParams, cK as UpdateOrganizationParams, cL as UpdateOutgoingWebhookParams, cM as UpdateQueueConfigParams, cN as UpdateScheduleParams, cO as UsageItem, cP as UsageWarning, cQ as ValidateTokenParams, cR as ValidateTokenResponse, cS as ValidationError, cT as WebhookDeliveryStatus, cU as WebhookEventType, cV as WebhookFormat, cW as WebhookIngestionResource, cX as WebhookTokenResponse, cY as WebhooksResource, cZ as Worker, c_ as WorkerDeregisteredEvent, c$ as WorkerEvent, d0 as WorkerEventData, d1 as WorkerHeartbeatParams, d2 as WorkerRegisteredEvent, d3 as WorkerState, d4 as WorkerStatus, d5 as WorkerSummary, d6 as WorkersResource, d7 as Workflow, d8 as WorkflowJob, d9 as WorkflowJobDefinition, da as WorkflowJobStatus, db as WorkflowResponse, dc as WorkflowStatus, dd as WorkflowsResource, de as asyncIterableFromStream, df as createCircuitBreaker, dg as createClient, dh as createErrorFromResponse, di as createHttpClient, dj as createJobStream, dk as createPaginatedResponse, dl as createProcessJobsStream, dm as dateToTimestamp, dn as isCircuitBreakerFailure, dp as isRetryableError, dq as isSpooledError, dr as parseRateLimitHeaders, ds as resolveConfig, dt as timestampToDate, du as validateConfig } from './index-DzTC8ld3.js';
|
|
3
3
|
import * as protoLoader from '@grpc/proto-loader';
|
|
4
4
|
import { ServiceClientConstructor } from '@grpc/grpc-js';
|
|
5
5
|
|
|
@@ -171,189 +171,6 @@ declare class SseRealtimeClient {
|
|
|
171
171
|
private scheduleReconnect;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
/**
|
|
175
|
-
* Custom Error Classes
|
|
176
|
-
*
|
|
177
|
-
* Provides a hierarchy of error types for the Spooled SDK.
|
|
178
|
-
*/
|
|
179
|
-
/** Error response body from the API */
|
|
180
|
-
interface ApiErrorBody {
|
|
181
|
-
code: string;
|
|
182
|
-
message: string;
|
|
183
|
-
details?: Record<string, unknown>;
|
|
184
|
-
}
|
|
185
|
-
/** Rate limit information parsed from headers */
|
|
186
|
-
interface RateLimitInfo {
|
|
187
|
-
/** Maximum requests per window */
|
|
188
|
-
limit?: number;
|
|
189
|
-
/** Remaining requests in current window */
|
|
190
|
-
remaining?: number;
|
|
191
|
-
/** Unix timestamp when the window resets */
|
|
192
|
-
reset?: Date;
|
|
193
|
-
/** Seconds to wait before retrying */
|
|
194
|
-
retryAfter?: number;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Base error class for all Spooled SDK errors
|
|
198
|
-
*/
|
|
199
|
-
declare class SpooledError extends Error {
|
|
200
|
-
/** HTTP status code (if applicable) */
|
|
201
|
-
readonly statusCode: number;
|
|
202
|
-
/** Error code from API response */
|
|
203
|
-
readonly code: string;
|
|
204
|
-
/** Additional error details */
|
|
205
|
-
readonly details?: Record<string, unknown>;
|
|
206
|
-
/** Request ID for debugging */
|
|
207
|
-
readonly requestId?: string;
|
|
208
|
-
/** Original cause of the error */
|
|
209
|
-
readonly cause?: Error;
|
|
210
|
-
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>, requestId?: string, cause?: Error);
|
|
211
|
-
/**
|
|
212
|
-
* Whether this error is retryable.
|
|
213
|
-
*
|
|
214
|
-
* Only 408 (Request Timeout) is retryable among the plain 4xx statuses: the
|
|
215
|
-
* server gave up waiting for the request, so it never ran. Subclasses
|
|
216
|
-
* override this (5xx, network, timeout, rate limit).
|
|
217
|
-
*/
|
|
218
|
-
isRetryable(): boolean;
|
|
219
|
-
/** Convert to plain object for logging */
|
|
220
|
-
toJSON(): Record<string, unknown>;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Authentication error (401)
|
|
224
|
-
* Thrown when authentication fails (invalid/expired token or API key)
|
|
225
|
-
*/
|
|
226
|
-
declare class AuthenticationError extends SpooledError {
|
|
227
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Authorization error (403)
|
|
231
|
-
* Thrown when the authenticated user lacks permission
|
|
232
|
-
*/
|
|
233
|
-
declare class AuthorizationError extends SpooledError {
|
|
234
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Not found error (404)
|
|
238
|
-
* Thrown when a requested resource doesn't exist
|
|
239
|
-
*/
|
|
240
|
-
declare class NotFoundError extends SpooledError {
|
|
241
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Conflict error (409)
|
|
245
|
-
* Thrown when there's a conflict (e.g., duplicate resource)
|
|
246
|
-
*/
|
|
247
|
-
declare class ConflictError extends SpooledError {
|
|
248
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Validation error (400 or 422)
|
|
252
|
-
* Thrown when request validation fails.
|
|
253
|
-
*
|
|
254
|
-
* The API answers a field-rule failure (length, range) with 400 but a missing
|
|
255
|
-
* or mistyped JSON field with 422; both are the caller's request being invalid,
|
|
256
|
-
* so both surface as this class. `statusCode` tells them apart.
|
|
257
|
-
*/
|
|
258
|
-
declare class ValidationError extends SpooledError {
|
|
259
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string, statusCode?: 400 | 422);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Payload too large error (413)
|
|
263
|
-
* Thrown when request body exceeds size limit
|
|
264
|
-
*/
|
|
265
|
-
declare class PayloadTooLargeError extends SpooledError {
|
|
266
|
-
constructor(message?: string, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Rate limit error (429)
|
|
270
|
-
* Thrown when rate limit is exceeded, or a plan quota is (see `isQuota`)
|
|
271
|
-
*/
|
|
272
|
-
declare class RateLimitError extends SpooledError {
|
|
273
|
-
/** Rate limit information */
|
|
274
|
-
readonly rateLimitInfo: RateLimitInfo;
|
|
275
|
-
constructor(message?: string, code?: string, rateLimitInfo?: RateLimitInfo, details?: Record<string, unknown>, requestId?: string);
|
|
276
|
-
/**
|
|
277
|
-
* True when this 429 is a plan quota or limit (daily job cap, active jobs,
|
|
278
|
-
* queue/worker/webhook caps) rather than per-second rate limiting.
|
|
279
|
-
*
|
|
280
|
-
* A quota does not clear for minutes or hours, so retrying it only blocks the
|
|
281
|
-
* caller for the whole backoff and, via the circuit breaker, takes every
|
|
282
|
-
* other call on the client down with it. It is never retried and never
|
|
283
|
-
* counted as a circuit breaker failure.
|
|
284
|
-
*
|
|
285
|
-
* Detection: the `QUOTA_EXCEEDED` code, or, for older plan-limit paths that
|
|
286
|
-
* answer with plain text wrapped as `RATE_LIMIT_EXCEEDED`, a "... limit
|
|
287
|
-
* reached" message that carries no `Retry-After`.
|
|
288
|
-
*/
|
|
289
|
-
get isQuota(): boolean;
|
|
290
|
-
isRetryable(): boolean;
|
|
291
|
-
/** Get the number of seconds to wait before retrying */
|
|
292
|
-
getRetryAfter(): number;
|
|
293
|
-
toJSON(): Record<string, unknown>;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Server error (5xx)
|
|
297
|
-
* Thrown when the server encounters an error
|
|
298
|
-
*/
|
|
299
|
-
declare class ServerError extends SpooledError {
|
|
300
|
-
constructor(message?: string, statusCode?: number, code?: string, details?: Record<string, unknown>, requestId?: string);
|
|
301
|
-
isRetryable(): boolean;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Network error
|
|
305
|
-
* Thrown when a network request fails (no response received)
|
|
306
|
-
*/
|
|
307
|
-
declare class NetworkError extends SpooledError {
|
|
308
|
-
constructor(message?: string, cause?: Error);
|
|
309
|
-
isRetryable(): boolean;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Timeout error
|
|
313
|
-
* Thrown when a request times out
|
|
314
|
-
*/
|
|
315
|
-
declare class TimeoutError extends SpooledError {
|
|
316
|
-
/** Timeout duration in milliseconds */
|
|
317
|
-
readonly timeoutMs: number;
|
|
318
|
-
constructor(message?: string, timeoutMs?: number);
|
|
319
|
-
isRetryable(): boolean;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Circuit breaker open error
|
|
323
|
-
* Thrown when the circuit breaker is open and rejecting requests
|
|
324
|
-
*/
|
|
325
|
-
declare class CircuitBreakerOpenError extends SpooledError {
|
|
326
|
-
constructor(message?: string);
|
|
327
|
-
isRetryable(): boolean;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Unsupported operation error
|
|
331
|
-
* Thrown by SDK methods whose route the Spooled API does not provide (or
|
|
332
|
-
* always rejects). It is raised before any network call, so code that still
|
|
333
|
-
* calls such a method fails loudly with an explanation instead of a 404.
|
|
334
|
-
*/
|
|
335
|
-
declare class UnsupportedOperationError extends SpooledError {
|
|
336
|
-
/** The SDK method that is not supported, e.g. `ingest.github` */
|
|
337
|
-
readonly operation: string;
|
|
338
|
-
constructor(operation: string, reason: string);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Parse rate limit headers from a Response
|
|
342
|
-
*/
|
|
343
|
-
declare function parseRateLimitHeaders(headers: Headers): RateLimitInfo;
|
|
344
|
-
/**
|
|
345
|
-
* Create an appropriate error from an HTTP response
|
|
346
|
-
*/
|
|
347
|
-
declare function createErrorFromResponse(response: Response): Promise<SpooledError>;
|
|
348
|
-
/**
|
|
349
|
-
* Check if an error is a SpooledError instance
|
|
350
|
-
*/
|
|
351
|
-
declare function isSpooledError(error: unknown): error is SpooledError;
|
|
352
|
-
/**
|
|
353
|
-
* Check if an error is retryable
|
|
354
|
-
*/
|
|
355
|
-
declare function isRetryableError(error: unknown): boolean;
|
|
356
|
-
|
|
357
174
|
/**
|
|
358
175
|
* Proto Loader Utility
|
|
359
176
|
*
|
|
@@ -497,4 +314,4 @@ declare function convertResponse<T>(body: T): T;
|
|
|
497
314
|
*/
|
|
498
315
|
declare function convertQueryParams(params: Record<string, string | number | boolean | undefined>): Record<string, string>;
|
|
499
316
|
|
|
500
|
-
export {
|
|
317
|
+
export { ConnectionState, PROTO_LOADER_OPTIONS, RealtimeConnectionOptions, RealtimeEvent, RealtimeEventType, RetryConfig, type SpooledProtoDefinition, SseRealtimeClient, SubscriptionFilter, WebSocketRealtimeClient, calculateDelay, camelToSnake, clearProtoCache, convertQueryParams, convertRequest, convertResponse, createRetryWrapper, getProtoPath, loadProtoDefinition, loadProtoDefinitionAsync, shouldRetry, sleep, snakeToCamel, toCamelCase, toSnakeCase, withRetry };
|