@spooled/sdk 1.0.28 → 1.0.29

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-CZorNMoD.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-CZorNMoD.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-CZorNMoD.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-CZorNMoD.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
@@ -1772,7 +1839,10 @@ var WebSocketRealtimeClient = class {
1772
1839
  maxReconnectDelay: 3e4,
1773
1840
  debug: () => {
1774
1841
  },
1775
- ...options
1842
+ ...options,
1843
+ // Always resolve to a provider so reconnects can mint a fresh JWT.
1844
+ // Falls back to the static token when no provider is supplied.
1845
+ tokenProvider: options.tokenProvider ?? (async () => options.token)
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 {
@@ -2056,7 +2137,10 @@ var SseRealtimeClient = class {
2056
2137
  maxReconnectDelay: 3e4,
2057
2138
  debug: () => {
2058
2139
  },
2059
- ...options
2140
+ ...options,
2141
+ // Always resolve to a provider so reconnects can mint a fresh token.
2142
+ // Falls back to the static token when no provider is supplied.
2143
+ tokenProvider: options.tokenProvider ?? (async () => options.token)
2060
2144
  };
2061
2145
  }
2062
2146
  /**
@@ -2088,9 +2172,15 @@ var SseRealtimeClient = class {
2088
2172
  throw new Error("eventsource package is required for SSE in Node.js. Install it with: npm install eventsource");
2089
2173
  }
2090
2174
  }
2175
+ let token;
2176
+ try {
2177
+ token = await this.options.tokenProvider();
2178
+ } catch (error) {
2179
+ this.setState("disconnected");
2180
+ throw new Error(`Failed to acquire realtime token: ${error}`);
2181
+ }
2091
2182
  return new Promise((resolve, reject) => {
2092
2183
  try {
2093
- const token = this.options.token;
2094
2184
  this.eventSource = new EventSourceImpl(sseUrl, {
2095
2185
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2096
2186
  fetch: (input, init) => fetch(input, {
@@ -2114,6 +2204,10 @@ var SseRealtimeClient = class {
2114
2204
  this.options.debug("SSE error");
2115
2205
  if (this.state === "connecting") {
2116
2206
  this.setState("disconnected");
2207
+ if (this.eventSource) {
2208
+ this.eventSource.close();
2209
+ this.eventSource = null;
2210
+ }
2117
2211
  reject(new Error("SSE connection failed"));
2118
2212
  return;
2119
2213
  }
@@ -2198,7 +2292,7 @@ var SseRealtimeClient = class {
2198
2292
  }
2199
2293
  handleMessage(data) {
2200
2294
  try {
2201
- const event = JSON.parse(data);
2295
+ const event = convertResponse(JSON.parse(data));
2202
2296
  this.options.debug(`Received SSE event: ${event.type}`, event);
2203
2297
  const handlers = this.eventHandlers.get(event.type);
2204
2298
  if (handlers) {
@@ -2236,10 +2330,11 @@ var SseRealtimeClient = class {
2236
2330
  scheduleReconnect() {
2237
2331
  this.setState("reconnecting");
2238
2332
  this.reconnectAttempts++;
2239
- const delay = Math.min(
2333
+ const baseDelay = Math.min(
2240
2334
  this.options.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1),
2241
2335
  this.options.maxReconnectDelay
2242
2336
  );
2337
+ const delay = Math.floor(baseDelay + Math.random() * baseDelay * 0.25);
2243
2338
  this.options.debug(`Scheduling SSE reconnect attempt ${this.reconnectAttempts} in ${delay}ms`);
2244
2339
  this.reconnectTimer = setTimeout(async () => {
2245
2340
  try {
@@ -2260,6 +2355,7 @@ var SpooledRealtime = class {
2260
2355
  baseUrl: options.baseUrl,
2261
2356
  wsUrl: options.wsUrl,
2262
2357
  token: options.token,
2358
+ tokenProvider: options.tokenProvider,
2263
2359
  autoReconnect: options.autoReconnect,
2264
2360
  maxReconnectAttempts: options.maxReconnectAttempts,
2265
2361
  reconnectDelay: options.reconnectDelay,
@@ -2759,7 +2855,7 @@ var SpooledClient = class _SpooledClient {
2759
2855
  if (this.config.accessToken && this.config.refreshToken && this.config.autoRefreshToken) {
2760
2856
  this.http.setRefreshTokenFn(this.refreshAccessToken.bind(this));
2761
2857
  }
2762
- this.auth = new AuthResource(this.http);
2858
+ this.auth = new AuthResource(this.http, () => this.config.refreshToken);
2763
2859
  this.jobs = new JobsResource(this.http);
2764
2860
  this.queues = new QueuesResource(this.http);
2765
2861
  this.workers = new WorkersResource(this.http);
@@ -2838,6 +2934,9 @@ var SpooledClient = class _SpooledClient {
2838
2934
  baseUrl: this.config.baseUrl,
2839
2935
  wsUrl: this.config.wsUrl,
2840
2936
  token,
2937
+ // Provider so each (re)connect mints a fresh JWT via login/refresh,
2938
+ // rather than reusing the short-lived token captured above.
2939
+ tokenProvider: () => this.getJwtToken(),
2841
2940
  ...options,
2842
2941
  debug: this.config.debug ?? void 0
2843
2942
  });
@@ -3145,9 +3244,11 @@ var SpooledWorker = class {
3145
3244
  this.waitForActiveJobs(),
3146
3245
  this.sleep(this.options.shutdownTimeout)
3147
3246
  ]);
3148
- for (const [jobId, active] of this.activeJobs.entries()) {
3247
+ const remaining = Array.from(this.activeJobs.entries());
3248
+ for (const [jobId, active] of remaining) {
3149
3249
  this.debug(`Force-failing job ${jobId} due to shutdown timeout`);
3150
3250
  await this.failJob(active.job, "Worker shutdown timeout");
3251
+ this.cleanupJob(jobId);
3151
3252
  }
3152
3253
  }
3153
3254
  if (this.workerId) {