@spooled/sdk 1.0.28 → 1.0.30

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/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-BKzL6R4h.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 ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-BKzL6R4h.cjs';
1
+ import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-Dv2jBkfc.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 ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-Dv2jBkfc.cjs';
3
3
  import * as protoLoader from '@grpc/proto-loader';
4
4
  import { ServiceClientConstructor } from '@grpc/grpc-js';
5
5
 
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-BKzL6R4h.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 ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-BKzL6R4h.js';
1
+ import { R as RealtimeConnectionOptions, C as ConnectionState, S as SubscriptionFilter, a as RealtimeEventType, b as RealtimeEvent, c as RetryConfig } from './index-Dv2jBkfc.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 ApiKeySummary, u as ApiKeysResource, v as AuthResource, B as BatchJobStatus, w as BillingResource, x as BillingStatus, y as BoostPriorityResponse, z as BulkEnqueueParams, D as BulkEnqueueResponse, E as BulkJobItem, F as CheckSlugResponse, G as CircuitBreaker, H as CircuitBreakerConfig, I as CircuitState, J as ClaimJobsParams, K as ClaimJobsResult, L as ClaimedJob, M as CompleteJobParams, N as CreateApiKeyParams, O as CreateApiKeyResponse, P as CreateBillingPortalParams, Q as CreateBillingPortalResponse, T as CreateJobParams, U as CreateJobResult, V as CreateOrganizationParams, W as CreateOrganizationResponse, X as CreateOutgoingWebhookParams, Y as CreateScheduleParams, Z as CreateScheduleResponse, _ as CreateWorkflowParams, $ as CreateWorkflowResponse, a0 as CurrentUserResponse, a1 as DEFAULT_CONFIG, a2 as DashboardData, a3 as DashboardResource, a4 as DashboardWorkerSummary, a5 as DebugFn, a6 as DependencyMode, a7 as FailJobParams, a8 as GrpcClientOptions, a9 as GrpcCompleteJobParams, aa as GrpcCompleteJobResponse, ab as GrpcCompleteRequest, ac as GrpcCompleteResponse, ad as GrpcDequeueJobParams, ae as GrpcDequeueJobResponse, af as GrpcDequeueRequest, ag as GrpcDequeueResponse, ah as GrpcDeregisterRequest, ai as GrpcDeregisterResponse, aj as GrpcEnqueueJobParams, ak as GrpcEnqueueJobResponse, al as GrpcEnqueueRequest, am as GrpcEnqueueResponse, an as GrpcErrorResponse, ao as GrpcFailJobParams, ap as GrpcFailJobResponse, aq as GrpcFailRequest, ar as GrpcFailResponse, as as GrpcGetJobRequest, at as GrpcGetJobResponse, au as GrpcGetQueueStatsRequest, av as GrpcGetQueueStatsResponse, aw as GrpcGetQueueStatsResponse_Legacy, ax as GrpcHeartbeatParams, ay as GrpcHeartbeatRequest, az as GrpcHeartbeatResponse, aA as GrpcHeartbeatResponse_Legacy, aB as GrpcJob, aC as GrpcJobStatus, aD as GrpcJobStatusNumber, aE as GrpcProcessRequest, aF as GrpcProcessResponse, aG as GrpcQueueOperations, aH as GrpcRegisterWorkerParams, aI as GrpcRegisterWorkerRequest, aJ as GrpcRegisterWorkerResponse, aK as GrpcRegisterWorkerResponse_Legacy, aL as GrpcRenewLeaseParams, aM as GrpcRenewLeaseRequest, aN as GrpcRenewLeaseResponse, aO as GrpcRenewLeaseResponse_Legacy, aP as GrpcStreamJobsRequest, aQ as GrpcTimestamp, aR as GrpcWorkerOperations, aS as HealthResource, aT as HealthResponse, aU as HeartbeatEvent, aV as HeartbeatJobParams, aW as HttpClient, aX as IngestCustomWebhookParams, aY as IngestGitHubWebhookOptions, aZ as IngestStripeWebhookOptions, a_ as InitialApiKey, a$ as Job, b0 as JobCompletedEvent, b1 as JobContext, b2 as JobCreatedEvent, b3 as JobFailedEvent, b4 as JobHandler, b5 as JobProgressEvent, b6 as JobResult, b7 as JobStartedEvent, b8 as JobStats, b9 as JobStatus, ba as JobStatusChangedEvent, bb as JobStream, bc as JobSummary, bd as JobSummaryStats, be as JobWithDependencies, bf as JobsResource, bg as JsonArray, bh as JsonObject, bi as JsonPrimitive, bj as JsonValue, bk as ListDlqParams, bl as ListJobsParams, bm as ListParams, bn as ListSchedulesParams, bo as ListWorkflowsParams, bp as LoginParams, bq as LoginResponse, br as MetricsResource, bs as Organization, bt as OrganizationMember, bu as OrganizationSummary, bv as OrganizationUsage, bw as OrganizationsResource, bx as OutgoingWebhook, by as OutgoingWebhookDelivery, bz as PaginatedResponse, bA as PaginationParams, bB as PauseQueueResponse, bC as PlanCount, bD as PlanLimits, bE as PlanTier, bF as ProcessJobsStream, bG as PurgeDlqParams, bH as PurgeDlqResponse, bI as QueueConfig, bJ as QueueConfigSummary, bK as QueuePausedEvent, bL as QueueResumedEvent, bM as QueueStats, bN as QueueSummary, bO as QueuesResource, bP as RealtimeEventData, bQ as RecentActivity, bR as RefreshTokenParams, bS as RefreshTokenResponse, bT as RegisterWorkerParams, bU as RegisterWorkerResponse, bV as ResolvedConfig, bW as ResourceUsage, bX as ResumeQueueResponse, bY as RetryDlqParams, bZ as RetryDlqResponse, b_ as SDK_VERSION, b$ as Schedule, c0 as ScheduleRun, c1 as ScheduleRunStatus, c2 as ScheduleTriggeredEvent, c3 as SchedulesResource, c4 as SpooledClient, c5 as SpooledClientConfig, c6 as SpooledGrpcClient, c7 as SpooledRealtime, c8 as SpooledRealtimeOptions, c9 as SpooledWorker, ca as SpooledWorkerOptions, cb as StreamOptions, cc as SystemInfo, cd as TestWebhookResponse, ce as TriggerScheduleResponse, cf as UpdateApiKeyParams, cg as UpdateOrganizationParams, ch as UpdateOutgoingWebhookParams, ci as UpdateQueueConfigParams, cj as UpdateScheduleParams, ck as UsageItem, cl as UsageWarning, cm as ValidateTokenParams, cn as ValidateTokenResponse, co as WebhookDeliveryStatus, cp as WebhookEventType, cq as WebhookIngestionResource, cr as WebhookTokenResponse, cs as WebhooksResource, ct as Worker, cu as WorkerDeregisteredEvent, cv as WorkerEvent, cw as WorkerEventData, cx as WorkerHeartbeatParams, cy as WorkerRegisteredEvent, cz as WorkerState, cA as WorkerStatus, cB as WorkerSummary, cC as WorkersResource, cD as Workflow, cE as WorkflowJob, cF as WorkflowJobDefinition, cG as WorkflowJobStatus, cH as WorkflowResponse, cI as WorkflowStatus, cJ as WorkflowsResource, cK as asyncIterableFromStream, cL as createCircuitBreaker, cM as createClient, cN as createHttpClient, cO as createJobStream, cP as createPaginatedResponse, cQ as createProcessJobsStream, cR as dateToTimestamp, cS as resolveConfig, cT as timestampToDate, cU as validateConfig } from './index-Dv2jBkfc.js';
3
3
  import * as protoLoader from '@grpc/proto-loader';
4
4
  import { ServiceClientConstructor } from '@grpc/grpc-js';
5
5
 
package/dist/index.js CHANGED
@@ -304,9 +304,10 @@ async function parseErrorBody(response) {
304
304
  try {
305
305
  const body = await response.json();
306
306
  if (typeof body === "object" && body !== null) {
307
+ const message = (body.message ?? body.error) || response.statusText;
307
308
  return {
308
309
  code: body.code || "UNKNOWN_ERROR",
309
- message: body.message || response.statusText,
310
+ message,
310
311
  details: body.details
311
312
  };
312
313
  }
@@ -524,12 +525,17 @@ function createRetryWrapper(config) {
524
525
  }
525
526
 
526
527
  // src/utils/http.ts
528
+ var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "PUT", "DELETE"]);
527
529
  var HttpClient = class {
528
530
  config;
529
531
  circuitBreaker;
530
532
  debug;
531
533
  /** Current authentication token (API key or JWT) */
532
534
  authToken;
535
+ /** Optional function to mint a fresh access token (set when auto-refresh is enabled) */
536
+ refreshTokenFn = null;
537
+ /** Guard to prevent a refresh request from recursively triggering another refresh */
538
+ isRefreshing = false;
533
539
  constructor(config, circuitBreaker) {
534
540
  this.config = config;
535
541
  this.circuitBreaker = circuitBreaker;
@@ -543,9 +549,13 @@ var HttpClient = class {
543
549
  this.authToken = token;
544
550
  }
545
551
  /**
546
- * Set the token refresh function (for future use)
552
+ * Set the token refresh function.
553
+ *
554
+ * When set, an expired-token 401 on the data plane triggers a single
555
+ * refresh + retry of the original request with the new token.
547
556
  */
548
- setRefreshTokenFn(_fn) {
557
+ setRefreshTokenFn(fn) {
558
+ this.refreshTokenFn = fn;
549
559
  }
550
560
  /**
551
561
  * Build full URL with query parameters
@@ -615,7 +625,7 @@ var HttpClient = class {
615
625
  /**
616
626
  * Execute a single HTTP request (no retry)
617
627
  */
618
- async executeRequest(url, options) {
628
+ async executeRequest(url, options, hasRefreshed = false) {
619
629
  const method = options.method ?? "GET";
620
630
  const headers = this.buildHeaders(options.headers);
621
631
  const timeout = options.timeout ?? this.config.timeout;
@@ -644,6 +654,23 @@ var HttpClient = class {
644
654
  }
645
655
  this.debug?.(`Response: ${response.status}`, { url });
646
656
  if (!response.ok) {
657
+ if (response.status === 401 && this.refreshTokenFn && !hasRefreshed && !this.isRefreshing) {
658
+ let refreshed = false;
659
+ this.isRefreshing = true;
660
+ try {
661
+ const newToken = await this.refreshTokenFn();
662
+ this.setAuthToken(newToken);
663
+ refreshed = true;
664
+ } catch (refreshError) {
665
+ const message = refreshError instanceof Error ? refreshError.message : "unknown";
666
+ this.debug?.("Token refresh failed", { error: message });
667
+ } finally {
668
+ this.isRefreshing = false;
669
+ }
670
+ if (refreshed) {
671
+ return this.executeRequest(url, options, true);
672
+ }
673
+ }
647
674
  const apiError = await createErrorFromResponse(response);
648
675
  throw apiError;
649
676
  }
@@ -668,6 +695,7 @@ var HttpClient = class {
668
695
  */
669
696
  async request(path, options = {}) {
670
697
  const url = this.buildUrl(path, options.params, options.skipApiPrefix);
698
+ const method = options.method ?? "GET";
671
699
  const execute = async () => {
672
700
  return this.circuitBreaker.execute(() => this.executeRequest(url, options));
673
701
  };
@@ -675,13 +703,46 @@ var HttpClient = class {
675
703
  return execute();
676
704
  }
677
705
  return withRetry(execute, {
678
- config: this.config.retry,
706
+ config: this.resolveRetryConfig(method, options),
679
707
  signal: options.signal,
680
708
  onRetry: (attempt, error, delayMs) => {
681
709
  this.debug?.(`Retry attempt ${attempt} after ${delayMs}ms`, { error: error.message });
682
710
  }
683
711
  });
684
712
  }
713
+ /**
714
+ * Determine whether a request carries an idempotency key (making a
715
+ * non-idempotent method safe to retry).
716
+ */
717
+ hasIdempotencyKey(options) {
718
+ if (!options.headers) {
719
+ return false;
720
+ }
721
+ return Object.keys(options.headers).some((key) => key.toLowerCase() === "idempotency-key");
722
+ }
723
+ /**
724
+ * Resolve the retry configuration for a request.
725
+ *
726
+ * Idempotent methods (GET/PUT/DELETE) and any request carrying an
727
+ * idempotency key retry normally. Non-idempotent methods (POST/PATCH)
728
+ * without an idempotency key must NOT be retried on ambiguous failures
729
+ * (network/timeout/5xx) — doing so risks duplicate jobs, double claims,
730
+ * etc. They are still retried on 429, which is rejected before the
731
+ * server processes the request and is therefore side-effect-free.
732
+ */
733
+ resolveRetryConfig(method, options) {
734
+ const base = this.config.retry;
735
+ if (base.retryOn) {
736
+ return base;
737
+ }
738
+ if (IDEMPOTENT_METHODS.has(method) || this.hasIdempotencyKey(options)) {
739
+ return base;
740
+ }
741
+ return {
742
+ ...base,
743
+ retryOn: (error) => error instanceof RateLimitError
744
+ };
745
+ }
685
746
  /**
686
747
  * Make a GET request
687
748
  */
@@ -883,8 +944,9 @@ function createCircuitBreaker(config) {
883
944
 
884
945
  // src/resources/auth.ts
885
946
  var AuthResource = class {
886
- constructor(http) {
947
+ constructor(http, getRefreshToken) {
887
948
  this.http = http;
949
+ this.getRefreshToken = getRefreshToken;
888
950
  }
889
951
  /**
890
952
  * Exchange API key for JWT tokens
@@ -899,10 +961,15 @@ var AuthResource = class {
899
961
  return this.http.post("/auth/refresh", params);
900
962
  }
901
963
  /**
902
- * Logout and invalidate current token
964
+ * Logout and revoke the refresh token server-side.
965
+ *
966
+ * The backend requires the refresh token in the body to invalidate the
967
+ * session. When omitted, the client's current refresh token (if any) is
968
+ * used automatically.
903
969
  */
904
- async logout() {
905
- await this.http.post("/auth/logout");
970
+ async logout(refreshToken) {
971
+ const token = refreshToken ?? this.getRefreshToken?.();
972
+ await this.http.post("/auth/logout", token ? { refreshToken: token } : void 0);
906
973
  }
907
974
  /**
908
975
  * Get current user/session info
@@ -1766,13 +1833,16 @@ var WebSocketRealtimeClient = class {
1766
1833
  stateChangeHandlers = /* @__PURE__ */ new Set();
1767
1834
  constructor(options) {
1768
1835
  this.options = {
1769
- autoReconnect: true,
1770
- maxReconnectAttempts: 10,
1771
- reconnectDelay: 1e3,
1772
- maxReconnectDelay: 3e4,
1773
- debug: () => {
1774
- },
1775
- ...options
1836
+ ...options,
1837
+ autoReconnect: options.autoReconnect ?? true,
1838
+ maxReconnectAttempts: options.maxReconnectAttempts ?? 10,
1839
+ reconnectDelay: options.reconnectDelay ?? 1e3,
1840
+ maxReconnectDelay: options.maxReconnectDelay ?? 3e4,
1841
+ // Always resolve to a provider so reconnects can mint a fresh JWT.
1842
+ // Falls back to the static token when no provider is supplied.
1843
+ tokenProvider: options.tokenProvider ?? (async () => options.token),
1844
+ debug: options.debug ?? (() => {
1845
+ })
1776
1846
  };
1777
1847
  }
1778
1848
  /**
@@ -1799,8 +1869,14 @@ var WebSocketRealtimeClient = class {
1799
1869
  return;
1800
1870
  }
1801
1871
  this.setState("connecting");
1802
- const wsUrl = this.buildWsUrl();
1803
- this.options.debug(`Connecting to ${wsUrl}`);
1872
+ let wsUrl;
1873
+ try {
1874
+ wsUrl = await this.buildWsUrl();
1875
+ } catch (error) {
1876
+ this.setState("disconnected");
1877
+ throw new Error(`Failed to acquire realtime token: ${error}`);
1878
+ }
1879
+ this.options.debug(`Connecting to ${redactToken(wsUrl)}`);
1804
1880
  let WebSocketImpl;
1805
1881
  try {
1806
1882
  WebSocketImpl = await this.getWebSocketImpl();
@@ -1914,9 +1990,10 @@ var WebSocketRealtimeClient = class {
1914
1990
  return () => this.stateChangeHandlers.delete(handler);
1915
1991
  }
1916
1992
  // Private methods
1917
- buildWsUrl() {
1993
+ async buildWsUrl() {
1918
1994
  const wsBase = this.options.wsUrl;
1919
- return `${wsBase}/api/v1/ws?token=${encodeURIComponent(this.options.token)}`;
1995
+ const token = await this.options.tokenProvider();
1996
+ return `${wsBase}/api/v1/ws?token=${encodeURIComponent(token)}`;
1920
1997
  }
1921
1998
  setState(state) {
1922
1999
  if (this.state !== state) {
@@ -1926,7 +2003,7 @@ var WebSocketRealtimeClient = class {
1926
2003
  }
1927
2004
  handleMessage(data) {
1928
2005
  try {
1929
- const message = JSON.parse(data);
2006
+ const message = convertResponse(JSON.parse(data));
1930
2007
  if (message.type === "subscribed" || message.type === "unsubscribed" || message.type === "error") {
1931
2008
  this.handleCommandResponse(message);
1932
2009
  return;
@@ -1983,10 +2060,11 @@ var WebSocketRealtimeClient = class {
1983
2060
  scheduleReconnect() {
1984
2061
  this.setState("reconnecting");
1985
2062
  this.reconnectAttempts++;
1986
- const delay = Math.min(
2063
+ const baseDelay = Math.min(
1987
2064
  this.options.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1),
1988
2065
  this.options.maxReconnectDelay
1989
2066
  );
2067
+ const delay = Math.floor(baseDelay + Math.random() * baseDelay * 0.25);
1990
2068
  this.options.debug(`Scheduling reconnect attempt ${this.reconnectAttempts} in ${delay}ms`);
1991
2069
  this.reconnectTimer = setTimeout(async () => {
1992
2070
  try {
@@ -2034,6 +2112,9 @@ var WebSocketRealtimeClient = class {
2034
2112
  return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
2035
2113
  }
2036
2114
  };
2115
+ function redactToken(url) {
2116
+ return url.replace(/([?&](?:token|api_key)=)[^&]*/gi, "$1***");
2117
+ }
2037
2118
 
2038
2119
  // src/realtime/sse.ts
2039
2120
  var SseRealtimeClient = class {
@@ -2050,13 +2131,22 @@ var SseRealtimeClient = class {
2050
2131
  stateChangeHandlers = /* @__PURE__ */ new Set();
2051
2132
  constructor(options) {
2052
2133
  this.options = {
2053
- autoReconnect: true,
2054
- maxReconnectAttempts: 10,
2055
- reconnectDelay: 1e3,
2056
- maxReconnectDelay: 3e4,
2057
- debug: () => {
2058
- },
2059
- ...options
2134
+ ...options,
2135
+ autoReconnect: options.autoReconnect ?? true,
2136
+ maxReconnectAttempts: options.maxReconnectAttempts ?? 10,
2137
+ reconnectDelay: options.reconnectDelay ?? 1e3,
2138
+ maxReconnectDelay: options.maxReconnectDelay ?? 3e4,
2139
+ // Always resolve to a provider so reconnects can mint a fresh token.
2140
+ // Falls back to the static token when no provider is supplied.
2141
+ tokenProvider: options.tokenProvider ?? (async () => options.token),
2142
+ // Coalesce debug to a no-op AFTER the spread. A caller that omits debug
2143
+ // still passes `debug: undefined` explicitly (e.g. via SpooledRealtime),
2144
+ // and spreading that would overwrite a pre-spread default with undefined,
2145
+ // making connect() call `this.options.debug(...)` on undefined and throw
2146
+ // "this.options.debug is not a function". Guarding here keeps it callable
2147
+ // regardless of what the caller passes.
2148
+ debug: options.debug ?? (() => {
2149
+ })
2060
2150
  };
2061
2151
  }
2062
2152
  /**
@@ -2088,9 +2178,15 @@ var SseRealtimeClient = class {
2088
2178
  throw new Error("eventsource package is required for SSE in Node.js. Install it with: npm install eventsource");
2089
2179
  }
2090
2180
  }
2181
+ let token;
2182
+ try {
2183
+ token = await this.options.tokenProvider();
2184
+ } catch (error) {
2185
+ this.setState("disconnected");
2186
+ throw new Error(`Failed to acquire realtime token: ${error}`);
2187
+ }
2091
2188
  return new Promise((resolve, reject) => {
2092
2189
  try {
2093
- const token = this.options.token;
2094
2190
  this.eventSource = new EventSourceImpl(sseUrl, {
2095
2191
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2096
2192
  fetch: (input, init) => fetch(input, {
@@ -2114,6 +2210,10 @@ var SseRealtimeClient = class {
2114
2210
  this.options.debug("SSE error");
2115
2211
  if (this.state === "connecting") {
2116
2212
  this.setState("disconnected");
2213
+ if (this.eventSource) {
2214
+ this.eventSource.close();
2215
+ this.eventSource = null;
2216
+ }
2117
2217
  reject(new Error("SSE connection failed"));
2118
2218
  return;
2119
2219
  }
@@ -2198,7 +2298,7 @@ var SseRealtimeClient = class {
2198
2298
  }
2199
2299
  handleMessage(data) {
2200
2300
  try {
2201
- const event = JSON.parse(data);
2301
+ const event = convertResponse(JSON.parse(data));
2202
2302
  this.options.debug(`Received SSE event: ${event.type}`, event);
2203
2303
  const handlers = this.eventHandlers.get(event.type);
2204
2304
  if (handlers) {
@@ -2236,10 +2336,11 @@ var SseRealtimeClient = class {
2236
2336
  scheduleReconnect() {
2237
2337
  this.setState("reconnecting");
2238
2338
  this.reconnectAttempts++;
2239
- const delay = Math.min(
2339
+ const baseDelay = Math.min(
2240
2340
  this.options.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1),
2241
2341
  this.options.maxReconnectDelay
2242
2342
  );
2343
+ const delay = Math.floor(baseDelay + Math.random() * baseDelay * 0.25);
2243
2344
  this.options.debug(`Scheduling SSE reconnect attempt ${this.reconnectAttempts} in ${delay}ms`);
2244
2345
  this.reconnectTimer = setTimeout(async () => {
2245
2346
  try {
@@ -2260,6 +2361,7 @@ var SpooledRealtime = class {
2260
2361
  baseUrl: options.baseUrl,
2261
2362
  wsUrl: options.wsUrl,
2262
2363
  token: options.token,
2364
+ tokenProvider: options.tokenProvider,
2263
2365
  autoReconnect: options.autoReconnect,
2264
2366
  maxReconnectAttempts: options.maxReconnectAttempts,
2265
2367
  reconnectDelay: options.reconnectDelay,
@@ -2759,7 +2861,7 @@ var SpooledClient = class _SpooledClient {
2759
2861
  if (this.config.accessToken && this.config.refreshToken && this.config.autoRefreshToken) {
2760
2862
  this.http.setRefreshTokenFn(this.refreshAccessToken.bind(this));
2761
2863
  }
2762
- this.auth = new AuthResource(this.http);
2864
+ this.auth = new AuthResource(this.http, () => this.config.refreshToken);
2763
2865
  this.jobs = new JobsResource(this.http);
2764
2866
  this.queues = new QueuesResource(this.http);
2765
2867
  this.workers = new WorkersResource(this.http);
@@ -2838,8 +2940,15 @@ var SpooledClient = class _SpooledClient {
2838
2940
  baseUrl: this.config.baseUrl,
2839
2941
  wsUrl: this.config.wsUrl,
2840
2942
  token,
2943
+ // Provider so each (re)connect mints a fresh JWT via login/refresh,
2944
+ // rather than reusing the short-lived token captured above.
2945
+ tokenProvider: () => this.getJwtToken(),
2841
2946
  ...options,
2842
- debug: this.config.debug ?? void 0
2947
+ // Only forward debug when the client actually has a logger, so we never
2948
+ // hand the realtime layer an explicit `debug: undefined`. The WS/SSE
2949
+ // constructors also guard against this, but keeping the undefined out of
2950
+ // the option object makes the intent clear at the call site.
2951
+ ...this.config.debug ? { debug: this.config.debug } : {}
2843
2952
  });
2844
2953
  }
2845
2954
  /**
@@ -3145,9 +3254,11 @@ var SpooledWorker = class {
3145
3254
  this.waitForActiveJobs(),
3146
3255
  this.sleep(this.options.shutdownTimeout)
3147
3256
  ]);
3148
- for (const [jobId, active] of this.activeJobs.entries()) {
3257
+ const remaining = Array.from(this.activeJobs.entries());
3258
+ for (const [jobId, active] of remaining) {
3149
3259
  this.debug(`Force-failing job ${jobId} due to shutdown timeout`);
3150
3260
  await this.failJob(active.job, "Worker shutdown timeout");
3261
+ this.cleanupJob(jobId);
3151
3262
  }
3152
3263
  }
3153
3264
  if (this.workerId) {