@spooled/sdk 1.0.16 → 1.0.17

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.
@@ -1262,6 +1262,52 @@ interface AddDependenciesResponse {
1262
1262
  dependencyType: string;
1263
1263
  }>;
1264
1264
  }
1265
+ /** Job within a workflow */
1266
+ interface WorkflowJob {
1267
+ /** Job ID */
1268
+ id: string;
1269
+ /** Workflow ID this job belongs to */
1270
+ workflowId: string;
1271
+ /** Job key within the workflow */
1272
+ key: string;
1273
+ /** Queue name */
1274
+ queueName: string;
1275
+ /** Current job status */
1276
+ status: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'deadletter';
1277
+ /** Job payload */
1278
+ payload: JsonObject;
1279
+ /** Job result (if completed) */
1280
+ result?: JsonObject;
1281
+ /** Error message (if failed) */
1282
+ error?: string;
1283
+ /** Job IDs this job depends on */
1284
+ dependsOn: string[];
1285
+ /** Job priority */
1286
+ priority: number;
1287
+ /** Maximum retries */
1288
+ maxRetries: number;
1289
+ /** Current attempt number */
1290
+ attempt: number;
1291
+ /** Timeout in seconds */
1292
+ timeoutSeconds?: number;
1293
+ /** When the job was created */
1294
+ createdAt: string;
1295
+ /** When the job started running */
1296
+ startedAt?: string;
1297
+ /** When the job completed */
1298
+ completedAt?: string;
1299
+ }
1300
+ /** Workflow job status summary */
1301
+ interface WorkflowJobStatus {
1302
+ /** Job ID */
1303
+ jobId: string;
1304
+ /** Job key within the workflow */
1305
+ key: string;
1306
+ /** Current status */
1307
+ status: string;
1308
+ /** Progress percentage (0-100) */
1309
+ progress?: number;
1310
+ }
1265
1311
 
1266
1312
  /**
1267
1313
  * Workflows Resource
@@ -1269,17 +1315,75 @@ interface AddDependenciesResponse {
1269
1315
  * Handles workflow operations including job dependencies.
1270
1316
  */
1271
1317
 
1272
- /** Job dependency operations */
1273
- interface JobDependencyOperations {
1274
- /** Get job dependencies */
1318
+ /** Workflow job operations */
1319
+ interface WorkflowJobOperations {
1320
+ /**
1321
+ * List all jobs in a workflow.
1322
+ *
1323
+ * @param workflowId - The workflow ID
1324
+ * @example
1325
+ * ```typescript
1326
+ * const jobs = await client.workflows.jobs.list('wf_123');
1327
+ * console.log('Jobs:', jobs.map(j => j.key));
1328
+ * ```
1329
+ */
1330
+ list(workflowId: string): Promise<WorkflowJob[]>;
1331
+ /**
1332
+ * Get a specific job within a workflow.
1333
+ *
1334
+ * @param workflowId - The workflow ID
1335
+ * @param jobId - The job ID
1336
+ * @example
1337
+ * ```typescript
1338
+ * const job = await client.workflows.jobs.get('wf_123', 'job_456');
1339
+ * console.log('Job status:', job.status);
1340
+ * ```
1341
+ */
1342
+ get(workflowId: string, jobId: string): Promise<WorkflowJob>;
1343
+ /**
1344
+ * Get the status of all jobs in a workflow.
1345
+ *
1346
+ * Returns a summary of each job's status and progress.
1347
+ *
1348
+ * @param workflowId - The workflow ID
1349
+ * @example
1350
+ * ```typescript
1351
+ * const statuses = await client.workflows.jobs.getStatus('wf_123');
1352
+ * for (const s of statuses) {
1353
+ * console.log(`${s.key}: ${s.status}`);
1354
+ * }
1355
+ * ```
1356
+ */
1357
+ getStatus(workflowId: string): Promise<WorkflowJobStatus[]>;
1358
+ /**
1359
+ * Get job dependencies.
1360
+ *
1361
+ * @param jobId - The job ID
1362
+ * @example
1363
+ * ```typescript
1364
+ * const deps = await client.workflows.jobs.getDependencies('job_456');
1365
+ * console.log('Depends on:', deps.dependencies);
1366
+ * ```
1367
+ */
1275
1368
  getDependencies(jobId: string): Promise<JobWithDependencies>;
1276
- /** Add dependencies to a job */
1369
+ /**
1370
+ * Add dependencies to a job.
1371
+ *
1372
+ * @param jobId - The job ID
1373
+ * @param params - Dependencies to add
1374
+ * @example
1375
+ * ```typescript
1376
+ * await client.workflows.jobs.addDependencies('job_456', {
1377
+ * dependsOnJobIds: ['job_123'],
1378
+ * });
1379
+ * ```
1380
+ */
1277
1381
  addDependencies(jobId: string, params: AddDependenciesParams): Promise<AddDependenciesResponse>;
1278
1382
  }
1279
1383
  declare class WorkflowsResource {
1280
1384
  private readonly http;
1281
- /** Job dependency operations */
1282
- readonly jobs: JobDependencyOperations;
1385
+ /** Workflow job operations */
1386
+ readonly jobs: WorkflowJobOperations;
1283
1387
  constructor(http: HttpClient);
1284
1388
  /**
1285
1389
  * List all workflows
@@ -1304,6 +1408,9 @@ declare class WorkflowsResource {
1304
1408
  * Only workflows with status 'failed' can be retried.
1305
1409
  */
1306
1410
  retry(id: string): Promise<WorkflowResponse>;
1411
+ private listWorkflowJobs;
1412
+ private getWorkflowJob;
1413
+ private getWorkflowJobsStatus;
1307
1414
  private getJobDependencies;
1308
1415
  private addJobDependencies;
1309
1416
  }
@@ -1618,11 +1725,16 @@ interface CheckSlugResponse {
1618
1725
  error?: string;
1619
1726
  suggestion?: string;
1620
1727
  }
1728
+ /** Webhook token response */
1729
+ interface WebhookTokenResponse {
1730
+ /** The webhook verification token */
1731
+ token: string;
1732
+ }
1621
1733
 
1622
1734
  /**
1623
1735
  * Organizations Resource
1624
1736
  *
1625
- * Handles organization operations.
1737
+ * Handles organization operations including webhook token management.
1626
1738
  */
1627
1739
 
1628
1740
  declare class OrganizationsResource {
@@ -1666,6 +1778,44 @@ declare class OrganizationsResource {
1666
1778
  generateSlug(name: string): Promise<{
1667
1779
  slug: string;
1668
1780
  }>;
1781
+ /**
1782
+ * Get the webhook token for the current organization.
1783
+ *
1784
+ * This token is used to verify incoming webhook payloads from Spooled.
1785
+ * Use this token to validate webhook signatures.
1786
+ *
1787
+ * @example
1788
+ * ```typescript
1789
+ * const { token } = await client.organizations.getWebhookToken();
1790
+ * console.log('Webhook token:', token);
1791
+ * ```
1792
+ */
1793
+ getWebhookToken(): Promise<WebhookTokenResponse>;
1794
+ /**
1795
+ * Regenerate the webhook token for the current organization.
1796
+ *
1797
+ * This invalidates the old token immediately. All webhook signature
1798
+ * verification using the old token will fail after regeneration.
1799
+ *
1800
+ * @example
1801
+ * ```typescript
1802
+ * const { token: newToken } = await client.organizations.regenerateWebhookToken();
1803
+ * console.log('New webhook token:', newToken);
1804
+ * ```
1805
+ */
1806
+ regenerateWebhookToken(): Promise<WebhookTokenResponse>;
1807
+ /**
1808
+ * Clear/delete the webhook token for the current organization.
1809
+ *
1810
+ * After this, webhook signature verification will fail until a new
1811
+ * token is generated via regenerateWebhookToken().
1812
+ *
1813
+ * @example
1814
+ * ```typescript
1815
+ * await client.organizations.clearWebhookToken();
1816
+ * ```
1817
+ */
1818
+ clearWebhookToken(): Promise<void>;
1669
1819
  }
1670
1820
 
1671
1821
  /**
@@ -3190,4 +3340,4 @@ declare class SpooledWorker {
3190
3340
  private sleep;
3191
3341
  }
3192
3342
 
3193
- export { type WorkerEvent as $, API_VERSION as A, BillingResource as B, type ConnectionState as C, type DebugFn as D, type JobFailedEvent as E, type JobProgressEvent as F, type JobStatusChangedEvent as G, HealthResource as H, type QueuePausedEvent as I, JobsResource as J, type QueueResumedEvent as K, type WorkerRegisteredEvent as L, MetricsResource as M, type WorkerDeregisteredEvent as N, OrganizationsResource as O, type ScheduleTriggeredEvent as P, QueuesResource as Q, type RealtimeConnectionOptions as R, type SubscriptionFilter as S, type HeartbeatEvent as T, SpooledWorker as U, type SpooledWorkerOptions as V, WorkersResource as W, type WorkerState as X, type JobHandler as Y, type JobContext as Z, type JobResult as _, type RealtimeEventType as a, type WorkflowResponse as a$, type WorkerEventData as a0, CircuitBreaker as a1, CircuitState as a2, createCircuitBreaker as a3, HttpClient as a4, createHttpClient as a5, type JsonPrimitive as a6, type JsonValue as a7, type JsonObject as a8, type JsonArray as a9, type BulkJobItem as aA, type BulkEnqueueParams as aB, type BulkEnqueueResponse as aC, type ListDlqParams as aD, type RetryDlqParams as aE, type RetryDlqResponse as aF, type PurgeDlqParams as aG, type PurgeDlqResponse as aH, type QueueConfig as aI, type QueueConfigSummary as aJ, type QueueStats as aK, type UpdateQueueConfigParams as aL, type PauseQueueResponse as aM, type ResumeQueueResponse as aN, type Worker as aO, type WorkerSummary as aP, type RegisterWorkerParams as aQ, type RegisterWorkerResponse as aR, type WorkerHeartbeatParams as aS, type Schedule as aT, type CreateScheduleParams as aU, type CreateScheduleResponse as aV, type UpdateScheduleParams as aW, type ListSchedulesParams as aX, type TriggerScheduleResponse as aY, type ScheduleRun as aZ, type Workflow as a_, type JobStatus as aa, type WorkerStatus as ab, type WorkflowStatus as ac, type PlanTier as ad, type ScheduleRunStatus as ae, type WebhookDeliveryStatus as af, type WebhookEventType as ag, type DependencyMode as ah, type PaginationParams as ai, type ListParams as aj, type PaginatedResponse as ak, createPaginatedResponse as al, type Job as am, type JobSummary as an, type CreateJobParams as ao, type CreateJobResult as ap, type ListJobsParams as aq, type JobStats as ar, type BatchJobStatus as as, type ClaimedJob as at, type ClaimJobsParams as au, type ClaimJobsResult as av, type CompleteJobParams as aw, type FailJobParams as ax, type HeartbeatJobParams as ay, type BoostPriorityResponse as az, type RealtimeEvent as b, SpooledGrpcClient as b$, type WorkflowJobDefinition as b0, type CreateWorkflowParams as b1, type CreateWorkflowResponse as b2, type ListWorkflowsParams as b3, type JobWithDependencies as b4, type AddDependenciesParams as b5, type AddDependenciesResponse as b6, type OutgoingWebhook as b7, type CreateOutgoingWebhookParams as b8, type UpdateOutgoingWebhookParams as b9, type BillingStatus as bA, type CreateBillingPortalParams as bB, type CreateBillingPortalResponse as bC, type DashboardData as bD, type SystemInfo as bE, type JobSummaryStats as bF, type QueueSummary as bG, type DashboardWorkerSummary as bH, type RecentActivity as bI, type HealthResponse as bJ, type AdminListOrganizationsParams as bK, type AdminUsageStats as bL, type AdminOrganizationSummary as bM, type AdminOrganizationList as bN, type AdminOrganizationDetail as bO, type AdminUpdateOrganizationParams as bP, type AdminCreateOrganizationParams as bQ, type AdminApiKeyResponse as bR, type AdminCreateOrganizationResponse as bS, type AdminCreateApiKeyParams as bT, type AdminDeleteOrganizationParams as bU, type PlanCount as bV, type AdminPlatformStats as bW, type AdminPlanLimits as bX, type IngestCustomWebhookParams as bY, type IngestGitHubWebhookOptions as bZ, type IngestStripeWebhookOptions as b_, type TestWebhookResponse as ba, type OutgoingWebhookDelivery as bb, type ApiKeySummary as bc, type CreateApiKeyParams as bd, type CreateApiKeyResponse as be, type UpdateApiKeyParams as bf, type Organization as bg, type OrganizationSummary as bh, type CreateOrganizationParams as bi, type InitialApiKey as bj, type CreateOrganizationResponse as bk, type UpdateOrganizationParams as bl, type OrganizationUsage as bm, type PlanLimits as bn, type ResourceUsage as bo, type UsageItem as bp, type UsageWarning as bq, type OrganizationMember as br, type CheckSlugResponse as bs, type LoginParams as bt, type LoginResponse as bu, type RefreshTokenParams as bv, type RefreshTokenResponse as bw, type CurrentUserResponse as bx, type ValidateTokenParams as by, type ValidateTokenResponse as bz, type RetryConfig as c, GrpcQueueOperations as c0, GrpcWorkerOperations as c1, asyncIterableFromStream as c2, createJobStream as c3, createProcessJobsStream as c4, type StreamOptions as c5, type JobStream as c6, type ProcessJobsStream as c7, GrpcJobStatus as c8, GrpcJobStatusNumber as c9, type GrpcDeregisterRequest as cA, type GrpcDeregisterResponse as cB, type GrpcClientOptions as cC, type GrpcEnqueueJobParams as cD, type GrpcEnqueueJobResponse as cE, type GrpcDequeueJobParams as cF, type GrpcDequeueJobResponse as cG, type GrpcCompleteJobParams as cH, type GrpcCompleteJobResponse as cI, type GrpcFailJobParams as cJ, type GrpcFailJobResponse as cK, type GrpcRenewLeaseParams as cL, type GrpcRenewLeaseResponse_Legacy as cM, type GrpcGetQueueStatsResponse_Legacy as cN, type GrpcRegisterWorkerParams as cO, type GrpcRegisterWorkerResponse_Legacy as cP, type GrpcHeartbeatParams as cQ, type GrpcHeartbeatResponse_Legacy as cR, type ActiveJob as cS, type GrpcTimestamp as ca, timestampToDate as cb, dateToTimestamp as cc, type GrpcJob as cd, type GrpcEnqueueRequest as ce, type GrpcEnqueueResponse as cf, type GrpcDequeueRequest as cg, type GrpcDequeueResponse as ch, type GrpcCompleteRequest as ci, type GrpcCompleteResponse as cj, type GrpcFailRequest as ck, type GrpcFailResponse as cl, type GrpcRenewLeaseRequest as cm, type GrpcRenewLeaseResponse as cn, type GrpcGetJobRequest as co, type GrpcGetJobResponse as cp, type GrpcGetQueueStatsRequest as cq, type GrpcGetQueueStatsResponse as cr, type GrpcStreamJobsRequest as cs, type GrpcProcessRequest as ct, type GrpcErrorResponse as cu, type GrpcProcessResponse as cv, type GrpcRegisterWorkerRequest as cw, type GrpcRegisterWorkerResponse as cx, type GrpcHeartbeatRequest as cy, type GrpcHeartbeatResponse as cz, SpooledClient as d, createClient as e, type SpooledClientConfig as f, type ResolvedConfig as g, type CircuitBreakerConfig as h, DEFAULT_CONFIG as i, SDK_VERSION as j, AuthResource as k, SchedulesResource as l, WorkflowsResource as m, WebhooksResource as n, ApiKeysResource as o, DashboardResource as p, AdminResource as q, resolveConfig as r, WebhookIngestionResource as s, SpooledRealtime as t, type SpooledRealtimeOptions as u, validateConfig as v, type RealtimeEventData as w, type JobCreatedEvent as x, type JobStartedEvent as y, type JobCompletedEvent as z };
3343
+ export { type WorkerEvent as $, API_VERSION as A, BillingResource as B, type ConnectionState as C, type DebugFn as D, type JobFailedEvent as E, type JobProgressEvent as F, type JobStatusChangedEvent as G, HealthResource as H, type QueuePausedEvent as I, JobsResource as J, type QueueResumedEvent as K, type WorkerRegisteredEvent as L, MetricsResource as M, type WorkerDeregisteredEvent as N, OrganizationsResource as O, type ScheduleTriggeredEvent as P, QueuesResource as Q, type RealtimeConnectionOptions as R, type SubscriptionFilter as S, type HeartbeatEvent as T, SpooledWorker as U, type SpooledWorkerOptions as V, WorkersResource as W, type WorkerState as X, type JobHandler as Y, type JobContext as Z, type JobResult as _, type RealtimeEventType as a, type WorkflowResponse as a$, type WorkerEventData as a0, CircuitBreaker as a1, CircuitState as a2, createCircuitBreaker as a3, HttpClient as a4, createHttpClient as a5, type JsonPrimitive as a6, type JsonValue as a7, type JsonObject as a8, type JsonArray as a9, type BulkJobItem as aA, type BulkEnqueueParams as aB, type BulkEnqueueResponse as aC, type ListDlqParams as aD, type RetryDlqParams as aE, type RetryDlqResponse as aF, type PurgeDlqParams as aG, type PurgeDlqResponse as aH, type QueueConfig as aI, type QueueConfigSummary as aJ, type QueueStats as aK, type UpdateQueueConfigParams as aL, type PauseQueueResponse as aM, type ResumeQueueResponse as aN, type Worker as aO, type WorkerSummary as aP, type RegisterWorkerParams as aQ, type RegisterWorkerResponse as aR, type WorkerHeartbeatParams as aS, type Schedule as aT, type CreateScheduleParams as aU, type CreateScheduleResponse as aV, type UpdateScheduleParams as aW, type ListSchedulesParams as aX, type TriggerScheduleResponse as aY, type ScheduleRun as aZ, type Workflow as a_, type JobStatus as aa, type WorkerStatus as ab, type WorkflowStatus as ac, type PlanTier as ad, type ScheduleRunStatus as ae, type WebhookDeliveryStatus as af, type WebhookEventType as ag, type DependencyMode as ah, type PaginationParams as ai, type ListParams as aj, type PaginatedResponse as ak, createPaginatedResponse as al, type Job as am, type JobSummary as an, type CreateJobParams as ao, type CreateJobResult as ap, type ListJobsParams as aq, type JobStats as ar, type BatchJobStatus as as, type ClaimedJob as at, type ClaimJobsParams as au, type ClaimJobsResult as av, type CompleteJobParams as aw, type FailJobParams as ax, type HeartbeatJobParams as ay, type BoostPriorityResponse as az, type RealtimeEvent as b, type IngestCustomWebhookParams as b$, type WorkflowJobDefinition as b0, type CreateWorkflowParams as b1, type CreateWorkflowResponse as b2, type ListWorkflowsParams as b3, type JobWithDependencies as b4, type AddDependenciesParams as b5, type AddDependenciesResponse as b6, type WorkflowJob as b7, type WorkflowJobStatus as b8, type OutgoingWebhook as b9, type CurrentUserResponse as bA, type ValidateTokenParams as bB, type ValidateTokenResponse as bC, type BillingStatus as bD, type CreateBillingPortalParams as bE, type CreateBillingPortalResponse as bF, type DashboardData as bG, type SystemInfo as bH, type JobSummaryStats as bI, type QueueSummary as bJ, type DashboardWorkerSummary as bK, type RecentActivity as bL, type HealthResponse as bM, type AdminListOrganizationsParams as bN, type AdminUsageStats as bO, type AdminOrganizationSummary as bP, type AdminOrganizationList as bQ, type AdminOrganizationDetail as bR, type AdminUpdateOrganizationParams as bS, type AdminCreateOrganizationParams as bT, type AdminApiKeyResponse as bU, type AdminCreateOrganizationResponse as bV, type AdminCreateApiKeyParams as bW, type AdminDeleteOrganizationParams as bX, type PlanCount as bY, type AdminPlatformStats as bZ, type AdminPlanLimits as b_, type CreateOutgoingWebhookParams as ba, type UpdateOutgoingWebhookParams as bb, type TestWebhookResponse as bc, type OutgoingWebhookDelivery as bd, type ApiKeySummary as be, type CreateApiKeyParams as bf, type CreateApiKeyResponse as bg, type UpdateApiKeyParams as bh, type Organization as bi, type OrganizationSummary as bj, type CreateOrganizationParams as bk, type InitialApiKey as bl, type CreateOrganizationResponse as bm, type UpdateOrganizationParams as bn, type OrganizationUsage as bo, type PlanLimits as bp, type ResourceUsage as bq, type UsageItem as br, type UsageWarning as bs, type OrganizationMember as bt, type CheckSlugResponse as bu, type WebhookTokenResponse as bv, type LoginParams as bw, type LoginResponse as bx, type RefreshTokenParams as by, type RefreshTokenResponse as bz, type RetryConfig as c, type IngestGitHubWebhookOptions as c0, type IngestStripeWebhookOptions as c1, SpooledGrpcClient as c2, GrpcQueueOperations as c3, GrpcWorkerOperations as c4, asyncIterableFromStream as c5, createJobStream as c6, createProcessJobsStream as c7, type StreamOptions as c8, type JobStream as c9, type GrpcRegisterWorkerResponse as cA, type GrpcHeartbeatRequest as cB, type GrpcHeartbeatResponse as cC, type GrpcDeregisterRequest as cD, type GrpcDeregisterResponse as cE, type GrpcClientOptions as cF, type GrpcEnqueueJobParams as cG, type GrpcEnqueueJobResponse as cH, type GrpcDequeueJobParams as cI, type GrpcDequeueJobResponse as cJ, type GrpcCompleteJobParams as cK, type GrpcCompleteJobResponse as cL, type GrpcFailJobParams as cM, type GrpcFailJobResponse as cN, type GrpcRenewLeaseParams as cO, type GrpcRenewLeaseResponse_Legacy as cP, type GrpcGetQueueStatsResponse_Legacy as cQ, type GrpcRegisterWorkerParams as cR, type GrpcRegisterWorkerResponse_Legacy as cS, type GrpcHeartbeatParams as cT, type GrpcHeartbeatResponse_Legacy as cU, type ActiveJob as cV, type ProcessJobsStream as ca, GrpcJobStatus as cb, GrpcJobStatusNumber as cc, type GrpcTimestamp as cd, timestampToDate as ce, dateToTimestamp as cf, type GrpcJob as cg, type GrpcEnqueueRequest as ch, type GrpcEnqueueResponse as ci, type GrpcDequeueRequest as cj, type GrpcDequeueResponse as ck, type GrpcCompleteRequest as cl, type GrpcCompleteResponse as cm, type GrpcFailRequest as cn, type GrpcFailResponse as co, type GrpcRenewLeaseRequest as cp, type GrpcRenewLeaseResponse as cq, type GrpcGetJobRequest as cr, type GrpcGetJobResponse as cs, type GrpcGetQueueStatsRequest as ct, type GrpcGetQueueStatsResponse as cu, type GrpcStreamJobsRequest as cv, type GrpcProcessRequest as cw, type GrpcErrorResponse as cx, type GrpcProcessResponse as cy, type GrpcRegisterWorkerRequest as cz, SpooledClient as d, createClient as e, type SpooledClientConfig as f, type ResolvedConfig as g, type CircuitBreakerConfig as h, DEFAULT_CONFIG as i, SDK_VERSION as j, AuthResource as k, SchedulesResource as l, WorkflowsResource as m, WebhooksResource as n, ApiKeysResource as o, DashboardResource as p, AdminResource as q, resolveConfig as r, WebhookIngestionResource as s, SpooledRealtime as t, type SpooledRealtimeOptions as u, validateConfig as v, type RealtimeEventData as w, type JobCreatedEvent as x, type JobStartedEvent as y, type JobCompletedEvent as z };
@@ -1262,6 +1262,52 @@ interface AddDependenciesResponse {
1262
1262
  dependencyType: string;
1263
1263
  }>;
1264
1264
  }
1265
+ /** Job within a workflow */
1266
+ interface WorkflowJob {
1267
+ /** Job ID */
1268
+ id: string;
1269
+ /** Workflow ID this job belongs to */
1270
+ workflowId: string;
1271
+ /** Job key within the workflow */
1272
+ key: string;
1273
+ /** Queue name */
1274
+ queueName: string;
1275
+ /** Current job status */
1276
+ status: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'deadletter';
1277
+ /** Job payload */
1278
+ payload: JsonObject;
1279
+ /** Job result (if completed) */
1280
+ result?: JsonObject;
1281
+ /** Error message (if failed) */
1282
+ error?: string;
1283
+ /** Job IDs this job depends on */
1284
+ dependsOn: string[];
1285
+ /** Job priority */
1286
+ priority: number;
1287
+ /** Maximum retries */
1288
+ maxRetries: number;
1289
+ /** Current attempt number */
1290
+ attempt: number;
1291
+ /** Timeout in seconds */
1292
+ timeoutSeconds?: number;
1293
+ /** When the job was created */
1294
+ createdAt: string;
1295
+ /** When the job started running */
1296
+ startedAt?: string;
1297
+ /** When the job completed */
1298
+ completedAt?: string;
1299
+ }
1300
+ /** Workflow job status summary */
1301
+ interface WorkflowJobStatus {
1302
+ /** Job ID */
1303
+ jobId: string;
1304
+ /** Job key within the workflow */
1305
+ key: string;
1306
+ /** Current status */
1307
+ status: string;
1308
+ /** Progress percentage (0-100) */
1309
+ progress?: number;
1310
+ }
1265
1311
 
1266
1312
  /**
1267
1313
  * Workflows Resource
@@ -1269,17 +1315,75 @@ interface AddDependenciesResponse {
1269
1315
  * Handles workflow operations including job dependencies.
1270
1316
  */
1271
1317
 
1272
- /** Job dependency operations */
1273
- interface JobDependencyOperations {
1274
- /** Get job dependencies */
1318
+ /** Workflow job operations */
1319
+ interface WorkflowJobOperations {
1320
+ /**
1321
+ * List all jobs in a workflow.
1322
+ *
1323
+ * @param workflowId - The workflow ID
1324
+ * @example
1325
+ * ```typescript
1326
+ * const jobs = await client.workflows.jobs.list('wf_123');
1327
+ * console.log('Jobs:', jobs.map(j => j.key));
1328
+ * ```
1329
+ */
1330
+ list(workflowId: string): Promise<WorkflowJob[]>;
1331
+ /**
1332
+ * Get a specific job within a workflow.
1333
+ *
1334
+ * @param workflowId - The workflow ID
1335
+ * @param jobId - The job ID
1336
+ * @example
1337
+ * ```typescript
1338
+ * const job = await client.workflows.jobs.get('wf_123', 'job_456');
1339
+ * console.log('Job status:', job.status);
1340
+ * ```
1341
+ */
1342
+ get(workflowId: string, jobId: string): Promise<WorkflowJob>;
1343
+ /**
1344
+ * Get the status of all jobs in a workflow.
1345
+ *
1346
+ * Returns a summary of each job's status and progress.
1347
+ *
1348
+ * @param workflowId - The workflow ID
1349
+ * @example
1350
+ * ```typescript
1351
+ * const statuses = await client.workflows.jobs.getStatus('wf_123');
1352
+ * for (const s of statuses) {
1353
+ * console.log(`${s.key}: ${s.status}`);
1354
+ * }
1355
+ * ```
1356
+ */
1357
+ getStatus(workflowId: string): Promise<WorkflowJobStatus[]>;
1358
+ /**
1359
+ * Get job dependencies.
1360
+ *
1361
+ * @param jobId - The job ID
1362
+ * @example
1363
+ * ```typescript
1364
+ * const deps = await client.workflows.jobs.getDependencies('job_456');
1365
+ * console.log('Depends on:', deps.dependencies);
1366
+ * ```
1367
+ */
1275
1368
  getDependencies(jobId: string): Promise<JobWithDependencies>;
1276
- /** Add dependencies to a job */
1369
+ /**
1370
+ * Add dependencies to a job.
1371
+ *
1372
+ * @param jobId - The job ID
1373
+ * @param params - Dependencies to add
1374
+ * @example
1375
+ * ```typescript
1376
+ * await client.workflows.jobs.addDependencies('job_456', {
1377
+ * dependsOnJobIds: ['job_123'],
1378
+ * });
1379
+ * ```
1380
+ */
1277
1381
  addDependencies(jobId: string, params: AddDependenciesParams): Promise<AddDependenciesResponse>;
1278
1382
  }
1279
1383
  declare class WorkflowsResource {
1280
1384
  private readonly http;
1281
- /** Job dependency operations */
1282
- readonly jobs: JobDependencyOperations;
1385
+ /** Workflow job operations */
1386
+ readonly jobs: WorkflowJobOperations;
1283
1387
  constructor(http: HttpClient);
1284
1388
  /**
1285
1389
  * List all workflows
@@ -1304,6 +1408,9 @@ declare class WorkflowsResource {
1304
1408
  * Only workflows with status 'failed' can be retried.
1305
1409
  */
1306
1410
  retry(id: string): Promise<WorkflowResponse>;
1411
+ private listWorkflowJobs;
1412
+ private getWorkflowJob;
1413
+ private getWorkflowJobsStatus;
1307
1414
  private getJobDependencies;
1308
1415
  private addJobDependencies;
1309
1416
  }
@@ -1618,11 +1725,16 @@ interface CheckSlugResponse {
1618
1725
  error?: string;
1619
1726
  suggestion?: string;
1620
1727
  }
1728
+ /** Webhook token response */
1729
+ interface WebhookTokenResponse {
1730
+ /** The webhook verification token */
1731
+ token: string;
1732
+ }
1621
1733
 
1622
1734
  /**
1623
1735
  * Organizations Resource
1624
1736
  *
1625
- * Handles organization operations.
1737
+ * Handles organization operations including webhook token management.
1626
1738
  */
1627
1739
 
1628
1740
  declare class OrganizationsResource {
@@ -1666,6 +1778,44 @@ declare class OrganizationsResource {
1666
1778
  generateSlug(name: string): Promise<{
1667
1779
  slug: string;
1668
1780
  }>;
1781
+ /**
1782
+ * Get the webhook token for the current organization.
1783
+ *
1784
+ * This token is used to verify incoming webhook payloads from Spooled.
1785
+ * Use this token to validate webhook signatures.
1786
+ *
1787
+ * @example
1788
+ * ```typescript
1789
+ * const { token } = await client.organizations.getWebhookToken();
1790
+ * console.log('Webhook token:', token);
1791
+ * ```
1792
+ */
1793
+ getWebhookToken(): Promise<WebhookTokenResponse>;
1794
+ /**
1795
+ * Regenerate the webhook token for the current organization.
1796
+ *
1797
+ * This invalidates the old token immediately. All webhook signature
1798
+ * verification using the old token will fail after regeneration.
1799
+ *
1800
+ * @example
1801
+ * ```typescript
1802
+ * const { token: newToken } = await client.organizations.regenerateWebhookToken();
1803
+ * console.log('New webhook token:', newToken);
1804
+ * ```
1805
+ */
1806
+ regenerateWebhookToken(): Promise<WebhookTokenResponse>;
1807
+ /**
1808
+ * Clear/delete the webhook token for the current organization.
1809
+ *
1810
+ * After this, webhook signature verification will fail until a new
1811
+ * token is generated via regenerateWebhookToken().
1812
+ *
1813
+ * @example
1814
+ * ```typescript
1815
+ * await client.organizations.clearWebhookToken();
1816
+ * ```
1817
+ */
1818
+ clearWebhookToken(): Promise<void>;
1669
1819
  }
1670
1820
 
1671
1821
  /**
@@ -3190,4 +3340,4 @@ declare class SpooledWorker {
3190
3340
  private sleep;
3191
3341
  }
3192
3342
 
3193
- export { type WorkerEvent as $, API_VERSION as A, BillingResource as B, type ConnectionState as C, type DebugFn as D, type JobFailedEvent as E, type JobProgressEvent as F, type JobStatusChangedEvent as G, HealthResource as H, type QueuePausedEvent as I, JobsResource as J, type QueueResumedEvent as K, type WorkerRegisteredEvent as L, MetricsResource as M, type WorkerDeregisteredEvent as N, OrganizationsResource as O, type ScheduleTriggeredEvent as P, QueuesResource as Q, type RealtimeConnectionOptions as R, type SubscriptionFilter as S, type HeartbeatEvent as T, SpooledWorker as U, type SpooledWorkerOptions as V, WorkersResource as W, type WorkerState as X, type JobHandler as Y, type JobContext as Z, type JobResult as _, type RealtimeEventType as a, type WorkflowResponse as a$, type WorkerEventData as a0, CircuitBreaker as a1, CircuitState as a2, createCircuitBreaker as a3, HttpClient as a4, createHttpClient as a5, type JsonPrimitive as a6, type JsonValue as a7, type JsonObject as a8, type JsonArray as a9, type BulkJobItem as aA, type BulkEnqueueParams as aB, type BulkEnqueueResponse as aC, type ListDlqParams as aD, type RetryDlqParams as aE, type RetryDlqResponse as aF, type PurgeDlqParams as aG, type PurgeDlqResponse as aH, type QueueConfig as aI, type QueueConfigSummary as aJ, type QueueStats as aK, type UpdateQueueConfigParams as aL, type PauseQueueResponse as aM, type ResumeQueueResponse as aN, type Worker as aO, type WorkerSummary as aP, type RegisterWorkerParams as aQ, type RegisterWorkerResponse as aR, type WorkerHeartbeatParams as aS, type Schedule as aT, type CreateScheduleParams as aU, type CreateScheduleResponse as aV, type UpdateScheduleParams as aW, type ListSchedulesParams as aX, type TriggerScheduleResponse as aY, type ScheduleRun as aZ, type Workflow as a_, type JobStatus as aa, type WorkerStatus as ab, type WorkflowStatus as ac, type PlanTier as ad, type ScheduleRunStatus as ae, type WebhookDeliveryStatus as af, type WebhookEventType as ag, type DependencyMode as ah, type PaginationParams as ai, type ListParams as aj, type PaginatedResponse as ak, createPaginatedResponse as al, type Job as am, type JobSummary as an, type CreateJobParams as ao, type CreateJobResult as ap, type ListJobsParams as aq, type JobStats as ar, type BatchJobStatus as as, type ClaimedJob as at, type ClaimJobsParams as au, type ClaimJobsResult as av, type CompleteJobParams as aw, type FailJobParams as ax, type HeartbeatJobParams as ay, type BoostPriorityResponse as az, type RealtimeEvent as b, SpooledGrpcClient as b$, type WorkflowJobDefinition as b0, type CreateWorkflowParams as b1, type CreateWorkflowResponse as b2, type ListWorkflowsParams as b3, type JobWithDependencies as b4, type AddDependenciesParams as b5, type AddDependenciesResponse as b6, type OutgoingWebhook as b7, type CreateOutgoingWebhookParams as b8, type UpdateOutgoingWebhookParams as b9, type BillingStatus as bA, type CreateBillingPortalParams as bB, type CreateBillingPortalResponse as bC, type DashboardData as bD, type SystemInfo as bE, type JobSummaryStats as bF, type QueueSummary as bG, type DashboardWorkerSummary as bH, type RecentActivity as bI, type HealthResponse as bJ, type AdminListOrganizationsParams as bK, type AdminUsageStats as bL, type AdminOrganizationSummary as bM, type AdminOrganizationList as bN, type AdminOrganizationDetail as bO, type AdminUpdateOrganizationParams as bP, type AdminCreateOrganizationParams as bQ, type AdminApiKeyResponse as bR, type AdminCreateOrganizationResponse as bS, type AdminCreateApiKeyParams as bT, type AdminDeleteOrganizationParams as bU, type PlanCount as bV, type AdminPlatformStats as bW, type AdminPlanLimits as bX, type IngestCustomWebhookParams as bY, type IngestGitHubWebhookOptions as bZ, type IngestStripeWebhookOptions as b_, type TestWebhookResponse as ba, type OutgoingWebhookDelivery as bb, type ApiKeySummary as bc, type CreateApiKeyParams as bd, type CreateApiKeyResponse as be, type UpdateApiKeyParams as bf, type Organization as bg, type OrganizationSummary as bh, type CreateOrganizationParams as bi, type InitialApiKey as bj, type CreateOrganizationResponse as bk, type UpdateOrganizationParams as bl, type OrganizationUsage as bm, type PlanLimits as bn, type ResourceUsage as bo, type UsageItem as bp, type UsageWarning as bq, type OrganizationMember as br, type CheckSlugResponse as bs, type LoginParams as bt, type LoginResponse as bu, type RefreshTokenParams as bv, type RefreshTokenResponse as bw, type CurrentUserResponse as bx, type ValidateTokenParams as by, type ValidateTokenResponse as bz, type RetryConfig as c, GrpcQueueOperations as c0, GrpcWorkerOperations as c1, asyncIterableFromStream as c2, createJobStream as c3, createProcessJobsStream as c4, type StreamOptions as c5, type JobStream as c6, type ProcessJobsStream as c7, GrpcJobStatus as c8, GrpcJobStatusNumber as c9, type GrpcDeregisterRequest as cA, type GrpcDeregisterResponse as cB, type GrpcClientOptions as cC, type GrpcEnqueueJobParams as cD, type GrpcEnqueueJobResponse as cE, type GrpcDequeueJobParams as cF, type GrpcDequeueJobResponse as cG, type GrpcCompleteJobParams as cH, type GrpcCompleteJobResponse as cI, type GrpcFailJobParams as cJ, type GrpcFailJobResponse as cK, type GrpcRenewLeaseParams as cL, type GrpcRenewLeaseResponse_Legacy as cM, type GrpcGetQueueStatsResponse_Legacy as cN, type GrpcRegisterWorkerParams as cO, type GrpcRegisterWorkerResponse_Legacy as cP, type GrpcHeartbeatParams as cQ, type GrpcHeartbeatResponse_Legacy as cR, type ActiveJob as cS, type GrpcTimestamp as ca, timestampToDate as cb, dateToTimestamp as cc, type GrpcJob as cd, type GrpcEnqueueRequest as ce, type GrpcEnqueueResponse as cf, type GrpcDequeueRequest as cg, type GrpcDequeueResponse as ch, type GrpcCompleteRequest as ci, type GrpcCompleteResponse as cj, type GrpcFailRequest as ck, type GrpcFailResponse as cl, type GrpcRenewLeaseRequest as cm, type GrpcRenewLeaseResponse as cn, type GrpcGetJobRequest as co, type GrpcGetJobResponse as cp, type GrpcGetQueueStatsRequest as cq, type GrpcGetQueueStatsResponse as cr, type GrpcStreamJobsRequest as cs, type GrpcProcessRequest as ct, type GrpcErrorResponse as cu, type GrpcProcessResponse as cv, type GrpcRegisterWorkerRequest as cw, type GrpcRegisterWorkerResponse as cx, type GrpcHeartbeatRequest as cy, type GrpcHeartbeatResponse as cz, SpooledClient as d, createClient as e, type SpooledClientConfig as f, type ResolvedConfig as g, type CircuitBreakerConfig as h, DEFAULT_CONFIG as i, SDK_VERSION as j, AuthResource as k, SchedulesResource as l, WorkflowsResource as m, WebhooksResource as n, ApiKeysResource as o, DashboardResource as p, AdminResource as q, resolveConfig as r, WebhookIngestionResource as s, SpooledRealtime as t, type SpooledRealtimeOptions as u, validateConfig as v, type RealtimeEventData as w, type JobCreatedEvent as x, type JobStartedEvent as y, type JobCompletedEvent as z };
3343
+ export { type WorkerEvent as $, API_VERSION as A, BillingResource as B, type ConnectionState as C, type DebugFn as D, type JobFailedEvent as E, type JobProgressEvent as F, type JobStatusChangedEvent as G, HealthResource as H, type QueuePausedEvent as I, JobsResource as J, type QueueResumedEvent as K, type WorkerRegisteredEvent as L, MetricsResource as M, type WorkerDeregisteredEvent as N, OrganizationsResource as O, type ScheduleTriggeredEvent as P, QueuesResource as Q, type RealtimeConnectionOptions as R, type SubscriptionFilter as S, type HeartbeatEvent as T, SpooledWorker as U, type SpooledWorkerOptions as V, WorkersResource as W, type WorkerState as X, type JobHandler as Y, type JobContext as Z, type JobResult as _, type RealtimeEventType as a, type WorkflowResponse as a$, type WorkerEventData as a0, CircuitBreaker as a1, CircuitState as a2, createCircuitBreaker as a3, HttpClient as a4, createHttpClient as a5, type JsonPrimitive as a6, type JsonValue as a7, type JsonObject as a8, type JsonArray as a9, type BulkJobItem as aA, type BulkEnqueueParams as aB, type BulkEnqueueResponse as aC, type ListDlqParams as aD, type RetryDlqParams as aE, type RetryDlqResponse as aF, type PurgeDlqParams as aG, type PurgeDlqResponse as aH, type QueueConfig as aI, type QueueConfigSummary as aJ, type QueueStats as aK, type UpdateQueueConfigParams as aL, type PauseQueueResponse as aM, type ResumeQueueResponse as aN, type Worker as aO, type WorkerSummary as aP, type RegisterWorkerParams as aQ, type RegisterWorkerResponse as aR, type WorkerHeartbeatParams as aS, type Schedule as aT, type CreateScheduleParams as aU, type CreateScheduleResponse as aV, type UpdateScheduleParams as aW, type ListSchedulesParams as aX, type TriggerScheduleResponse as aY, type ScheduleRun as aZ, type Workflow as a_, type JobStatus as aa, type WorkerStatus as ab, type WorkflowStatus as ac, type PlanTier as ad, type ScheduleRunStatus as ae, type WebhookDeliveryStatus as af, type WebhookEventType as ag, type DependencyMode as ah, type PaginationParams as ai, type ListParams as aj, type PaginatedResponse as ak, createPaginatedResponse as al, type Job as am, type JobSummary as an, type CreateJobParams as ao, type CreateJobResult as ap, type ListJobsParams as aq, type JobStats as ar, type BatchJobStatus as as, type ClaimedJob as at, type ClaimJobsParams as au, type ClaimJobsResult as av, type CompleteJobParams as aw, type FailJobParams as ax, type HeartbeatJobParams as ay, type BoostPriorityResponse as az, type RealtimeEvent as b, type IngestCustomWebhookParams as b$, type WorkflowJobDefinition as b0, type CreateWorkflowParams as b1, type CreateWorkflowResponse as b2, type ListWorkflowsParams as b3, type JobWithDependencies as b4, type AddDependenciesParams as b5, type AddDependenciesResponse as b6, type WorkflowJob as b7, type WorkflowJobStatus as b8, type OutgoingWebhook as b9, type CurrentUserResponse as bA, type ValidateTokenParams as bB, type ValidateTokenResponse as bC, type BillingStatus as bD, type CreateBillingPortalParams as bE, type CreateBillingPortalResponse as bF, type DashboardData as bG, type SystemInfo as bH, type JobSummaryStats as bI, type QueueSummary as bJ, type DashboardWorkerSummary as bK, type RecentActivity as bL, type HealthResponse as bM, type AdminListOrganizationsParams as bN, type AdminUsageStats as bO, type AdminOrganizationSummary as bP, type AdminOrganizationList as bQ, type AdminOrganizationDetail as bR, type AdminUpdateOrganizationParams as bS, type AdminCreateOrganizationParams as bT, type AdminApiKeyResponse as bU, type AdminCreateOrganizationResponse as bV, type AdminCreateApiKeyParams as bW, type AdminDeleteOrganizationParams as bX, type PlanCount as bY, type AdminPlatformStats as bZ, type AdminPlanLimits as b_, type CreateOutgoingWebhookParams as ba, type UpdateOutgoingWebhookParams as bb, type TestWebhookResponse as bc, type OutgoingWebhookDelivery as bd, type ApiKeySummary as be, type CreateApiKeyParams as bf, type CreateApiKeyResponse as bg, type UpdateApiKeyParams as bh, type Organization as bi, type OrganizationSummary as bj, type CreateOrganizationParams as bk, type InitialApiKey as bl, type CreateOrganizationResponse as bm, type UpdateOrganizationParams as bn, type OrganizationUsage as bo, type PlanLimits as bp, type ResourceUsage as bq, type UsageItem as br, type UsageWarning as bs, type OrganizationMember as bt, type CheckSlugResponse as bu, type WebhookTokenResponse as bv, type LoginParams as bw, type LoginResponse as bx, type RefreshTokenParams as by, type RefreshTokenResponse as bz, type RetryConfig as c, type IngestGitHubWebhookOptions as c0, type IngestStripeWebhookOptions as c1, SpooledGrpcClient as c2, GrpcQueueOperations as c3, GrpcWorkerOperations as c4, asyncIterableFromStream as c5, createJobStream as c6, createProcessJobsStream as c7, type StreamOptions as c8, type JobStream as c9, type GrpcRegisterWorkerResponse as cA, type GrpcHeartbeatRequest as cB, type GrpcHeartbeatResponse as cC, type GrpcDeregisterRequest as cD, type GrpcDeregisterResponse as cE, type GrpcClientOptions as cF, type GrpcEnqueueJobParams as cG, type GrpcEnqueueJobResponse as cH, type GrpcDequeueJobParams as cI, type GrpcDequeueJobResponse as cJ, type GrpcCompleteJobParams as cK, type GrpcCompleteJobResponse as cL, type GrpcFailJobParams as cM, type GrpcFailJobResponse as cN, type GrpcRenewLeaseParams as cO, type GrpcRenewLeaseResponse_Legacy as cP, type GrpcGetQueueStatsResponse_Legacy as cQ, type GrpcRegisterWorkerParams as cR, type GrpcRegisterWorkerResponse_Legacy as cS, type GrpcHeartbeatParams as cT, type GrpcHeartbeatResponse_Legacy as cU, type ActiveJob as cV, type ProcessJobsStream as ca, GrpcJobStatus as cb, GrpcJobStatusNumber as cc, type GrpcTimestamp as cd, timestampToDate as ce, dateToTimestamp as cf, type GrpcJob as cg, type GrpcEnqueueRequest as ch, type GrpcEnqueueResponse as ci, type GrpcDequeueRequest as cj, type GrpcDequeueResponse as ck, type GrpcCompleteRequest as cl, type GrpcCompleteResponse as cm, type GrpcFailRequest as cn, type GrpcFailResponse as co, type GrpcRenewLeaseRequest as cp, type GrpcRenewLeaseResponse as cq, type GrpcGetJobRequest as cr, type GrpcGetJobResponse as cs, type GrpcGetQueueStatsRequest as ct, type GrpcGetQueueStatsResponse as cu, type GrpcStreamJobsRequest as cv, type GrpcProcessRequest as cw, type GrpcErrorResponse as cx, type GrpcProcessResponse as cy, type GrpcRegisterWorkerRequest as cz, SpooledClient as d, createClient as e, type SpooledClientConfig as f, type ResolvedConfig as g, type CircuitBreakerConfig as h, DEFAULT_CONFIG as i, SDK_VERSION as j, AuthResource as k, SchedulesResource as l, WorkflowsResource as m, WebhooksResource as n, ApiKeysResource as o, DashboardResource as p, AdminResource as q, resolveConfig as r, WebhookIngestionResource as s, SpooledRealtime as t, type SpooledRealtimeOptions as u, validateConfig as v, type RealtimeEventData as w, type JobCreatedEvent as x, type JobStartedEvent as y, type JobCompletedEvent as z };
package/dist/index.cjs CHANGED
@@ -1238,11 +1238,14 @@ var WorkflowsResource = class {
1238
1238
  constructor(http) {
1239
1239
  this.http = http;
1240
1240
  this.jobs = {
1241
+ list: this.listWorkflowJobs.bind(this),
1242
+ get: this.getWorkflowJob.bind(this),
1243
+ getStatus: this.getWorkflowJobsStatus.bind(this),
1241
1244
  getDependencies: this.getJobDependencies.bind(this),
1242
1245
  addDependencies: this.addJobDependencies.bind(this)
1243
1246
  };
1244
1247
  }
1245
- /** Job dependency operations */
1248
+ /** Workflow job operations */
1246
1249
  jobs;
1247
1250
  /**
1248
1251
  * List all workflows
@@ -1277,7 +1280,16 @@ var WorkflowsResource = class {
1277
1280
  async retry(id) {
1278
1281
  return this.http.post(`/workflows/${id}/retry`);
1279
1282
  }
1280
- // Job dependency operations (private implementations)
1283
+ // Workflow job operations (private implementations)
1284
+ async listWorkflowJobs(workflowId) {
1285
+ return this.http.get(`/workflows/${workflowId}/jobs`);
1286
+ }
1287
+ async getWorkflowJob(workflowId, jobId) {
1288
+ return this.http.get(`/workflows/${workflowId}/jobs/${jobId}`);
1289
+ }
1290
+ async getWorkflowJobsStatus(workflowId) {
1291
+ return this.http.get(`/workflows/${workflowId}/jobs/status`);
1292
+ }
1281
1293
  async getJobDependencies(jobId) {
1282
1294
  return this.http.get(`/jobs/${jobId}/dependencies`);
1283
1295
  }
@@ -1441,6 +1453,50 @@ var OrganizationsResource = class {
1441
1453
  async generateSlug(name) {
1442
1454
  return this.http.post("/organizations/generate-slug", { name });
1443
1455
  }
1456
+ /**
1457
+ * Get the webhook token for the current organization.
1458
+ *
1459
+ * This token is used to verify incoming webhook payloads from Spooled.
1460
+ * Use this token to validate webhook signatures.
1461
+ *
1462
+ * @example
1463
+ * ```typescript
1464
+ * const { token } = await client.organizations.getWebhookToken();
1465
+ * console.log('Webhook token:', token);
1466
+ * ```
1467
+ */
1468
+ async getWebhookToken() {
1469
+ return this.http.get("/organizations/webhook-token");
1470
+ }
1471
+ /**
1472
+ * Regenerate the webhook token for the current organization.
1473
+ *
1474
+ * This invalidates the old token immediately. All webhook signature
1475
+ * verification using the old token will fail after regeneration.
1476
+ *
1477
+ * @example
1478
+ * ```typescript
1479
+ * const { token: newToken } = await client.organizations.regenerateWebhookToken();
1480
+ * console.log('New webhook token:', newToken);
1481
+ * ```
1482
+ */
1483
+ async regenerateWebhookToken() {
1484
+ return this.http.post("/organizations/webhook-token/regenerate");
1485
+ }
1486
+ /**
1487
+ * Clear/delete the webhook token for the current organization.
1488
+ *
1489
+ * After this, webhook signature verification will fail until a new
1490
+ * token is generated via regenerateWebhookToken().
1491
+ *
1492
+ * @example
1493
+ * ```typescript
1494
+ * await client.organizations.clearWebhookToken();
1495
+ * ```
1496
+ */
1497
+ async clearWebhookToken() {
1498
+ await this.http.post("/organizations/webhook-token/clear");
1499
+ }
1444
1500
  };
1445
1501
 
1446
1502
  // src/resources/billing.ts