@spooled/sdk 1.0.40 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -4
- package/dist/{index-DA_znF4h.d.cts → index-BzfyWvfc.d.cts} +187 -76
- package/dist/{index-DA_znF4h.d.ts → index-BzfyWvfc.d.ts} +187 -76
- package/dist/index.cjs +185 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +185 -31
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +7 -1
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +1 -1
- package/dist/worker/index.d.ts +1 -1
- package/dist/worker/index.js +7 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -107,11 +107,11 @@ declare const DEFAULT_CONFIG: {
|
|
|
107
107
|
successThreshold: number;
|
|
108
108
|
timeout: number;
|
|
109
109
|
};
|
|
110
|
-
readonly userAgent: "@spooled/sdk-nodejs/1.0
|
|
110
|
+
readonly userAgent: "@spooled/sdk-nodejs/1.2.0";
|
|
111
111
|
readonly autoRefreshToken: true;
|
|
112
112
|
};
|
|
113
113
|
/** SDK version */
|
|
114
|
-
declare const SDK_VERSION = "1.0
|
|
114
|
+
declare const SDK_VERSION = "1.2.0";
|
|
115
115
|
/** API version prefix */
|
|
116
116
|
declare const API_VERSION = "v1";
|
|
117
117
|
/**
|
|
@@ -403,17 +403,32 @@ interface CurrentUserResponse {
|
|
|
403
403
|
interface ValidateTokenParams {
|
|
404
404
|
token: string;
|
|
405
405
|
}
|
|
406
|
-
/** Token validation
|
|
406
|
+
/** Token validation claims after camelCase. API `org_id` becomes `orgId`. */
|
|
407
|
+
interface TokenClaims {
|
|
408
|
+
organizationId: string;
|
|
409
|
+
orgId?: string;
|
|
410
|
+
apiKeyId: string;
|
|
411
|
+
queues: string[];
|
|
412
|
+
exp: number;
|
|
413
|
+
iat: number;
|
|
414
|
+
}
|
|
415
|
+
/** POST /auth/validate — `{ valid, error?, claims? }`. `message` is mapped from `error`. */
|
|
407
416
|
interface ValidateTokenResponse {
|
|
408
417
|
valid: boolean;
|
|
409
418
|
message?: string;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
419
|
+
error?: string;
|
|
420
|
+
claims?: TokenClaims;
|
|
421
|
+
}
|
|
422
|
+
/** POST /auth/email/start — backend sends message + email_sent_to, not success */
|
|
423
|
+
interface StartEmailLoginResponse {
|
|
424
|
+
message: string;
|
|
425
|
+
emailSentTo: string;
|
|
426
|
+
}
|
|
427
|
+
/** GET /auth/check-email */
|
|
428
|
+
interface CheckEmailResponse {
|
|
429
|
+
exists: boolean;
|
|
430
|
+
available: boolean;
|
|
431
|
+
signupEnabled: boolean;
|
|
417
432
|
}
|
|
418
433
|
|
|
419
434
|
/**
|
|
@@ -451,21 +466,20 @@ declare class AuthResource {
|
|
|
451
466
|
me(): Promise<CurrentUserResponse>;
|
|
452
467
|
/**
|
|
453
468
|
* Validate a token
|
|
469
|
+
*
|
|
470
|
+
* POST /auth/validate is `{ valid, error?, claims? }`. Claims use `org_id`
|
|
471
|
+
* (camelCased `orgId`), not `organizationId`. Invalid tokens send `error`,
|
|
472
|
+
* not `message`.
|
|
454
473
|
*/
|
|
455
474
|
validate(params: ValidateTokenParams): Promise<ValidateTokenResponse>;
|
|
456
475
|
/**
|
|
457
|
-
* Start email-based login flow (sends
|
|
476
|
+
* Start email-based login flow (sends a 6-digit code)
|
|
458
477
|
*/
|
|
459
|
-
startEmailLogin(email: string): Promise<
|
|
460
|
-
success: boolean;
|
|
461
|
-
message: string;
|
|
462
|
-
}>;
|
|
478
|
+
startEmailLogin(email: string): Promise<StartEmailLoginResponse>;
|
|
463
479
|
/**
|
|
464
|
-
* Check
|
|
480
|
+
* Check whether an email is registered (GET /auth/check-email)
|
|
465
481
|
*/
|
|
466
|
-
checkEmail(email: string): Promise<
|
|
467
|
-
exists: boolean;
|
|
468
|
-
}>;
|
|
482
|
+
checkEmail(email: string): Promise<CheckEmailResponse>;
|
|
469
483
|
}
|
|
470
484
|
|
|
471
485
|
/**
|
|
@@ -543,8 +557,8 @@ interface Job {
|
|
|
543
557
|
organizationId: string;
|
|
544
558
|
queueName: string;
|
|
545
559
|
status: JobStatus;
|
|
546
|
-
payload:
|
|
547
|
-
result?:
|
|
560
|
+
payload: JsonValue;
|
|
561
|
+
result?: JsonValue;
|
|
548
562
|
retryCount: number;
|
|
549
563
|
maxRetries: number;
|
|
550
564
|
lastError?: string;
|
|
@@ -554,7 +568,7 @@ interface Job {
|
|
|
554
568
|
completedAt?: string;
|
|
555
569
|
expiresAt?: string;
|
|
556
570
|
priority: number;
|
|
557
|
-
tags?:
|
|
571
|
+
tags?: JsonValue;
|
|
558
572
|
timeoutSeconds: number;
|
|
559
573
|
parentJobId?: string;
|
|
560
574
|
completionWebhook?: string;
|
|
@@ -566,6 +580,8 @@ interface Job {
|
|
|
566
580
|
workflowId?: string;
|
|
567
581
|
dependencyMode?: string;
|
|
568
582
|
dependenciesMet?: boolean;
|
|
583
|
+
/** From payload.job_type on GET; list summaries send it top-level. */
|
|
584
|
+
jobType?: string;
|
|
569
585
|
}
|
|
570
586
|
/** Job summary for list responses */
|
|
571
587
|
interface JobSummary {
|
|
@@ -573,7 +589,12 @@ interface JobSummary {
|
|
|
573
589
|
queueName: string;
|
|
574
590
|
status: JobStatus;
|
|
575
591
|
priority: number;
|
|
576
|
-
|
|
592
|
+
attempt: number;
|
|
593
|
+
maxRetries: number;
|
|
594
|
+
/** From payload.job_type (empty string when absent). */
|
|
595
|
+
jobType?: string;
|
|
596
|
+
/** From list/DLQ `last_error` (null/absent when none). */
|
|
597
|
+
lastError?: string | null;
|
|
577
598
|
createdAt: string;
|
|
578
599
|
scheduledAt?: string;
|
|
579
600
|
startedAt?: string;
|
|
@@ -583,8 +604,8 @@ interface JobSummary {
|
|
|
583
604
|
interface CreateJobParams {
|
|
584
605
|
/** Queue name (1-100 chars, alphanumeric/-/_/.) */
|
|
585
606
|
queueName: string;
|
|
586
|
-
/** Job payload */
|
|
587
|
-
payload:
|
|
607
|
+
/** Job payload (any JSON) */
|
|
608
|
+
payload: JsonValue;
|
|
588
609
|
/** Priority (-100 to 100, default 0) */
|
|
589
610
|
priority?: number;
|
|
590
611
|
/** Maximum retries (0-100, default 3) */
|
|
@@ -597,8 +618,8 @@ interface CreateJobParams {
|
|
|
597
618
|
expiresAt?: Date | string;
|
|
598
619
|
/** Idempotency key for deduplication (max 255 chars) */
|
|
599
620
|
idempotencyKey?: string;
|
|
600
|
-
/** Tags for filtering */
|
|
601
|
-
tags?:
|
|
621
|
+
/** Tags for filtering (object or string array) */
|
|
622
|
+
tags?: JsonValue;
|
|
602
623
|
/** Parent job ID for DAG workflows */
|
|
603
624
|
parentJobId?: string;
|
|
604
625
|
/** Webhook URL for completion notification */
|
|
@@ -642,7 +663,7 @@ interface BatchJobStatus {
|
|
|
642
663
|
interface ClaimedJob {
|
|
643
664
|
id: string;
|
|
644
665
|
queueName: string;
|
|
645
|
-
payload:
|
|
666
|
+
payload: JsonValue;
|
|
646
667
|
retryCount: number;
|
|
647
668
|
maxRetries: number;
|
|
648
669
|
timeoutSeconds: number;
|
|
@@ -674,8 +695,8 @@ interface ClaimJobsResult {
|
|
|
674
695
|
interface CompleteJobParams {
|
|
675
696
|
/** Worker ID that owns the job */
|
|
676
697
|
workerId: string;
|
|
677
|
-
/** Optional result payload */
|
|
678
|
-
result?:
|
|
698
|
+
/** Optional result payload (any JSON) */
|
|
699
|
+
result?: JsonValue;
|
|
679
700
|
/** Lease fencing token from the claimed job (rejects stale leases when set) */
|
|
680
701
|
leaseId?: string;
|
|
681
702
|
}
|
|
@@ -705,7 +726,7 @@ interface BoostPriorityResponse {
|
|
|
705
726
|
}
|
|
706
727
|
/** Item for bulk enqueue */
|
|
707
728
|
interface BulkJobItem {
|
|
708
|
-
payload:
|
|
729
|
+
payload: JsonValue;
|
|
709
730
|
priority?: number;
|
|
710
731
|
idempotencyKey?: string;
|
|
711
732
|
scheduledAt?: Date | string;
|
|
@@ -1006,6 +1027,18 @@ interface WorkerSummary {
|
|
|
1006
1027
|
interface RegisterWorkerParams {
|
|
1007
1028
|
/** Queue name to process */
|
|
1008
1029
|
queueName: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* Stable worker identifier (1-128 chars, `[A-Za-z0-9._-]`).
|
|
1032
|
+
*
|
|
1033
|
+
* Supplying one makes registration an upsert, so a restarting worker reuses
|
|
1034
|
+
* a single row and re-registering an id you already own is not charged
|
|
1035
|
+
* against the plan worker cap. Omit it and the server mints a UUID, which
|
|
1036
|
+
* means every restart leaves the old row occupying the cap until the
|
|
1037
|
+
* stale-worker reaper clears it (~2 minutes) — enough for a crash-looping
|
|
1038
|
+
* worker on a tight plan to 429 itself out of registering. An id owned by a
|
|
1039
|
+
* different organization is rejected with HTTP 409.
|
|
1040
|
+
*/
|
|
1041
|
+
workerId?: string;
|
|
1009
1042
|
/** Worker hostname */
|
|
1010
1043
|
hostname: string;
|
|
1011
1044
|
/** Worker type identifier */
|
|
@@ -1080,7 +1113,7 @@ interface Schedule {
|
|
|
1080
1113
|
cronExpression: string;
|
|
1081
1114
|
timezone: string;
|
|
1082
1115
|
queueName: string;
|
|
1083
|
-
payloadTemplate:
|
|
1116
|
+
payloadTemplate: JsonValue;
|
|
1084
1117
|
priority: number;
|
|
1085
1118
|
maxRetries: number;
|
|
1086
1119
|
timeoutSeconds: number;
|
|
@@ -1088,8 +1121,8 @@ interface Schedule {
|
|
|
1088
1121
|
lastRunAt?: string;
|
|
1089
1122
|
nextRunAt?: string;
|
|
1090
1123
|
runCount: number;
|
|
1091
|
-
tags?:
|
|
1092
|
-
metadata?:
|
|
1124
|
+
tags?: JsonValue;
|
|
1125
|
+
metadata?: JsonValue;
|
|
1093
1126
|
createdAt: string;
|
|
1094
1127
|
updatedAt: string;
|
|
1095
1128
|
}
|
|
@@ -1110,7 +1143,7 @@ interface CreateScheduleParams {
|
|
|
1110
1143
|
* (HTTP 422), so this is typed as non-optional to surface the omission at
|
|
1111
1144
|
* compile time rather than as a runtime 422.
|
|
1112
1145
|
*/
|
|
1113
|
-
payloadTemplate:
|
|
1146
|
+
payloadTemplate: JsonValue;
|
|
1114
1147
|
/** Job priority (-100 to 100) */
|
|
1115
1148
|
priority?: number;
|
|
1116
1149
|
/** Max retries for scheduled jobs (0-100) */
|
|
@@ -1118,9 +1151,9 @@ interface CreateScheduleParams {
|
|
|
1118
1151
|
/** Timeout in seconds (1-86400) */
|
|
1119
1152
|
timeoutSeconds?: number;
|
|
1120
1153
|
/** Tags for created jobs */
|
|
1121
|
-
tags?:
|
|
1154
|
+
tags?: JsonValue;
|
|
1122
1155
|
/** Additional metadata */
|
|
1123
|
-
metadata?:
|
|
1156
|
+
metadata?: JsonValue;
|
|
1124
1157
|
}
|
|
1125
1158
|
/** Response for creating a schedule */
|
|
1126
1159
|
interface CreateScheduleResponse {
|
|
@@ -1135,13 +1168,13 @@ interface UpdateScheduleParams {
|
|
|
1135
1168
|
description?: string;
|
|
1136
1169
|
cronExpression?: string;
|
|
1137
1170
|
timezone?: string;
|
|
1138
|
-
payloadTemplate?:
|
|
1171
|
+
payloadTemplate?: JsonValue;
|
|
1139
1172
|
priority?: number;
|
|
1140
1173
|
maxRetries?: number;
|
|
1141
1174
|
timeoutSeconds?: number;
|
|
1142
1175
|
isActive?: boolean;
|
|
1143
|
-
tags?:
|
|
1144
|
-
metadata?:
|
|
1176
|
+
tags?: JsonValue;
|
|
1177
|
+
metadata?: JsonValue;
|
|
1145
1178
|
}
|
|
1146
1179
|
/** Parameters for listing schedules */
|
|
1147
1180
|
interface ListSchedulesParams extends ListParams {
|
|
@@ -1151,7 +1184,7 @@ interface ListSchedulesParams extends ListParams {
|
|
|
1151
1184
|
/** Response for manual trigger */
|
|
1152
1185
|
interface TriggerScheduleResponse {
|
|
1153
1186
|
jobId: string;
|
|
1154
|
-
|
|
1187
|
+
triggeredAt: string;
|
|
1155
1188
|
}
|
|
1156
1189
|
/** Schedule execution run */
|
|
1157
1190
|
interface ScheduleRun {
|
|
@@ -1287,31 +1320,33 @@ interface ListWorkflowsParams extends ListParams {
|
|
|
1287
1320
|
/** Filter by status */
|
|
1288
1321
|
status?: WorkflowStatus;
|
|
1289
1322
|
}
|
|
1290
|
-
/**
|
|
1291
|
-
interface
|
|
1323
|
+
/** One edge on GET /jobs/{id}/dependencies */
|
|
1324
|
+
interface DependencyInfo {
|
|
1292
1325
|
jobId: string;
|
|
1326
|
+
queueName: string;
|
|
1293
1327
|
status: string;
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
dependents:
|
|
1300
|
-
|
|
1301
|
-
status: string;
|
|
1302
|
-
dependencyType: string;
|
|
1303
|
-
}>;
|
|
1328
|
+
}
|
|
1329
|
+
/** GET /jobs/{id}/dependencies */
|
|
1330
|
+
interface JobWithDependencies {
|
|
1331
|
+
jobId: string;
|
|
1332
|
+
dependencies: DependencyInfo[];
|
|
1333
|
+
dependents: DependencyInfo[];
|
|
1334
|
+
dependenciesMet: boolean;
|
|
1304
1335
|
}
|
|
1305
1336
|
/** Parameters for adding dependencies */
|
|
1306
1337
|
interface AddDependenciesParams {
|
|
1307
|
-
/** Job IDs that this job depends on */
|
|
1308
|
-
dependsOnJobIds
|
|
1309
|
-
|
|
1338
|
+
/** Job IDs that this job depends on (backend `depends_on`) */
|
|
1339
|
+
dependsOnJobIds?: string[];
|
|
1340
|
+
dependsOn?: string[];
|
|
1341
|
+
/** Backend `dependency_mode`: all (default) or any */
|
|
1342
|
+
dependencyMode?: "all" | "any";
|
|
1343
|
+
/** Accepted when it is `all` or `any`; other values are ignored */
|
|
1310
1344
|
dependencyType?: string;
|
|
1311
1345
|
}
|
|
1312
1346
|
/** Response for adding dependencies */
|
|
1313
1347
|
interface AddDependenciesResponse {
|
|
1314
1348
|
added: number;
|
|
1349
|
+
dependenciesMet: boolean;
|
|
1315
1350
|
dependencies: Array<{
|
|
1316
1351
|
jobId: string;
|
|
1317
1352
|
dependsOnJobId: string;
|
|
@@ -1485,9 +1520,24 @@ interface OutgoingWebhook {
|
|
|
1485
1520
|
url: string;
|
|
1486
1521
|
events: WebhookEventType[];
|
|
1487
1522
|
enabled: boolean;
|
|
1523
|
+
/**
|
|
1524
|
+
* Consecutive failed deliveries.
|
|
1525
|
+
*
|
|
1526
|
+
* Counted once per DELIVERY, not once per retry attempt, so for the same
|
|
1527
|
+
* real-world failures this is roughly 5x smaller than a per-attempt count.
|
|
1528
|
+
* A successful delivery resets it to 0, including a successful manual retry
|
|
1529
|
+
* via `retryDelivery()`. At 20 the webhook is disabled automatically.
|
|
1530
|
+
*/
|
|
1488
1531
|
failureCount: number;
|
|
1489
1532
|
lastTriggeredAt?: string;
|
|
1490
|
-
|
|
1533
|
+
/**
|
|
1534
|
+
* Outcome of the most recent delivery.
|
|
1535
|
+
*
|
|
1536
|
+
* `"auto_disabled"` means 20 consecutive failed deliveries disabled the
|
|
1537
|
+
* webhook: `enabled` is now false and no further events are delivered until
|
|
1538
|
+
* it is re-enabled with `update(id, { enabled: true })`.
|
|
1539
|
+
*/
|
|
1540
|
+
lastStatus?: "success" | "failed" | "auto_disabled";
|
|
1491
1541
|
createdAt: string;
|
|
1492
1542
|
updatedAt: string;
|
|
1493
1543
|
}
|
|
@@ -1504,12 +1554,34 @@ interface CreateOutgoingWebhookParams {
|
|
|
1504
1554
|
/** Whether enabled (default: true) */
|
|
1505
1555
|
enabled?: boolean;
|
|
1506
1556
|
}
|
|
1507
|
-
/**
|
|
1557
|
+
/**
|
|
1558
|
+
* Parameters for updating an outgoing webhook.
|
|
1559
|
+
*
|
|
1560
|
+
* Every field is optional and only the fields you send are changed.
|
|
1561
|
+
*/
|
|
1508
1562
|
interface UpdateOutgoingWebhookParams {
|
|
1509
1563
|
name?: string;
|
|
1510
1564
|
url?: string;
|
|
1511
1565
|
events?: WebhookEventType[];
|
|
1512
|
-
|
|
1566
|
+
/**
|
|
1567
|
+
* HMAC secret used to sign deliveries.
|
|
1568
|
+
*
|
|
1569
|
+
* Omit the field to keep the current secret, pass a string to replace it, or
|
|
1570
|
+
* pass `null` to CLEAR it. Clearing is destructive: deliveries then go out
|
|
1571
|
+
* unsigned, with no `X-Spooled-Signature` header, and the old secret cannot
|
|
1572
|
+
* be recovered. Client code that reserialises an unchanged webhook must send
|
|
1573
|
+
* `undefined` (or drop the key) rather than `null`, or it will wipe a live
|
|
1574
|
+
* secret.
|
|
1575
|
+
*/
|
|
1576
|
+
secret?: string | null;
|
|
1577
|
+
/**
|
|
1578
|
+
* Whether the webhook receives events.
|
|
1579
|
+
*
|
|
1580
|
+
* Setting this to `true` is the recovery path for a webhook that was
|
|
1581
|
+
* auto-disabled after 20 consecutive failed deliveries. Re-enabling is
|
|
1582
|
+
* charged against the plan webhook cap, so it can fail with HTTP 429
|
|
1583
|
+
* `QUOTA_EXCEEDED` even though no webhook is being created.
|
|
1584
|
+
*/
|
|
1513
1585
|
enabled?: boolean;
|
|
1514
1586
|
}
|
|
1515
1587
|
/** Response for webhook test */
|
|
@@ -1519,7 +1591,15 @@ interface TestWebhookResponse {
|
|
|
1519
1591
|
responseTimeMs: number;
|
|
1520
1592
|
error?: string;
|
|
1521
1593
|
}
|
|
1522
|
-
/**
|
|
1594
|
+
/**
|
|
1595
|
+
* Webhook delivery record.
|
|
1596
|
+
*
|
|
1597
|
+
* Delivery history is retained, not permanent: rows are removed by the
|
|
1598
|
+
* per-organization retention sweep using the plan's history retention window
|
|
1599
|
+
* (free 1 day, starter 7, pro 30, enterprise 90). Only the newest 100
|
|
1600
|
+
* deliveries per webhook are readable through the API in any case, so copy
|
|
1601
|
+
* anything you need as a durable audit record into your own store.
|
|
1602
|
+
*/
|
|
1523
1603
|
interface OutgoingWebhookDelivery {
|
|
1524
1604
|
id: string;
|
|
1525
1605
|
webhookId: string;
|
|
@@ -1593,6 +1673,12 @@ interface ApiKeySummary {
|
|
|
1593
1673
|
rateLimit?: number;
|
|
1594
1674
|
isActive: boolean;
|
|
1595
1675
|
createdAt: string;
|
|
1676
|
+
/**
|
|
1677
|
+
* Coarse last-use timestamp, written at most once per key per 5 minutes
|
|
1678
|
+
* rather than on every request. Treat it as "used recently", not as a live
|
|
1679
|
+
* signal: it can lag actual use by up to 5 minutes, so it cannot answer
|
|
1680
|
+
* "is this key in use right now" and idle-key checks must allow for the lag.
|
|
1681
|
+
*/
|
|
1596
1682
|
lastUsed?: string;
|
|
1597
1683
|
expiresAt?: string;
|
|
1598
1684
|
}
|
|
@@ -1781,10 +1867,12 @@ interface CheckSlugResponse {
|
|
|
1781
1867
|
error?: string;
|
|
1782
1868
|
suggestion?: string;
|
|
1783
1869
|
}
|
|
1784
|
-
/**
|
|
1870
|
+
/** GET/POST /organizations/webhook-token — backend sends webhook_token + webhook_url */
|
|
1785
1871
|
interface WebhookTokenResponse {
|
|
1786
|
-
/**
|
|
1787
|
-
|
|
1872
|
+
/** Org webhook token. Null on GET when none is configured. */
|
|
1873
|
+
webhookToken: string | null;
|
|
1874
|
+
/** Inbound webhook URL for this organization */
|
|
1875
|
+
webhookUrl: string;
|
|
1788
1876
|
}
|
|
1789
1877
|
|
|
1790
1878
|
/**
|
|
@@ -1842,8 +1930,8 @@ declare class OrganizationsResource {
|
|
|
1842
1930
|
*
|
|
1843
1931
|
* @example
|
|
1844
1932
|
* ```typescript
|
|
1845
|
-
* const {
|
|
1846
|
-
* console.log('Webhook token:',
|
|
1933
|
+
* const { webhookToken, webhookUrl } = await client.organizations.getWebhookToken();
|
|
1934
|
+
* console.log('Webhook token:', webhookToken);
|
|
1847
1935
|
* ```
|
|
1848
1936
|
*/
|
|
1849
1937
|
getWebhookToken(): Promise<WebhookTokenResponse>;
|
|
@@ -1855,7 +1943,7 @@ declare class OrganizationsResource {
|
|
|
1855
1943
|
*
|
|
1856
1944
|
* @example
|
|
1857
1945
|
* ```typescript
|
|
1858
|
-
* const {
|
|
1946
|
+
* const { webhookToken: newToken } = await client.organizations.regenerateWebhookToken();
|
|
1859
1947
|
* console.log('New webhook token:', newToken);
|
|
1860
1948
|
* ```
|
|
1861
1949
|
*/
|
|
@@ -1863,8 +1951,9 @@ declare class OrganizationsResource {
|
|
|
1863
1951
|
/**
|
|
1864
1952
|
* Clear/delete the webhook token for the current organization.
|
|
1865
1953
|
*
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1954
|
+
* POST /organizations/webhook-token/clear requires `{ confirm: true }`.
|
|
1955
|
+
* An empty body 422s. The API currently rejects the operation and tells
|
|
1956
|
+
* callers to use regenerateWebhookToken() instead.
|
|
1868
1957
|
*
|
|
1869
1958
|
* @example
|
|
1870
1959
|
* ```typescript
|
|
@@ -2193,6 +2282,12 @@ interface IngestCustomWebhookParams {
|
|
|
2193
2282
|
idempotencyKey?: string;
|
|
2194
2283
|
priority?: number;
|
|
2195
2284
|
}
|
|
2285
|
+
/** POST /webhooks/{org_id}/custom — OpenAPI WebhookResponse after camelCase. */
|
|
2286
|
+
interface IngestCustomWebhookResponse {
|
|
2287
|
+
jobId?: string;
|
|
2288
|
+
queueName?: string;
|
|
2289
|
+
status?: string;
|
|
2290
|
+
}
|
|
2196
2291
|
interface IngestGitHubWebhookOptions {
|
|
2197
2292
|
/** Value for X-GitHub-Event header (e.g. "pull_request") */
|
|
2198
2293
|
githubEvent: string;
|
|
@@ -2243,12 +2338,13 @@ declare class WebhookIngestionResource {
|
|
|
2243
2338
|
/**
|
|
2244
2339
|
* Ingest a custom webhook.
|
|
2245
2340
|
*
|
|
2246
|
-
* POST /api/v1/webhooks/{org_id}/custom
|
|
2341
|
+
* POST /api/v1/webhooks/{org_id}/custom returns `{ jobId, queueName, status }`.
|
|
2342
|
+
* An older empty 200 maps to an empty object rather than throwing.
|
|
2247
2343
|
*/
|
|
2248
2344
|
custom(orgId: string, params: IngestCustomWebhookParams, opts?: {
|
|
2249
2345
|
webhookToken?: string;
|
|
2250
2346
|
forwardedProto?: string;
|
|
2251
|
-
}): Promise<
|
|
2347
|
+
}): Promise<IngestCustomWebhookResponse>;
|
|
2252
2348
|
}
|
|
2253
2349
|
|
|
2254
2350
|
/**
|
|
@@ -3292,6 +3388,16 @@ declare function createClient(options: SpooledClientConfig): SpooledClient;
|
|
|
3292
3388
|
interface SpooledWorkerOptions {
|
|
3293
3389
|
/** Queue name to process */
|
|
3294
3390
|
queueName: string;
|
|
3391
|
+
/**
|
|
3392
|
+
* Stable worker identifier (1-128 chars, `[A-Za-z0-9._-]`).
|
|
3393
|
+
*
|
|
3394
|
+
* Set this on any worker that restarts or redeploys: registration becomes an
|
|
3395
|
+
* upsert, so the process reuses one row instead of leaving the previous
|
|
3396
|
+
* registration to occupy the plan worker cap until the stale-worker reaper
|
|
3397
|
+
* clears it (~2 minutes). Omit it and the server mints a UUID on every
|
|
3398
|
+
* start. An id owned by a different organization is rejected with HTTP 409.
|
|
3399
|
+
*/
|
|
3400
|
+
workerId?: string;
|
|
3295
3401
|
/** Worker hostname (default: auto-detected) */
|
|
3296
3402
|
hostname?: string;
|
|
3297
3403
|
/** Worker type identifier */
|
|
@@ -3321,8 +3427,8 @@ interface JobContext {
|
|
|
3321
3427
|
jobId: string;
|
|
3322
3428
|
/** Queue name */
|
|
3323
3429
|
queueName: string;
|
|
3324
|
-
/** Job payload */
|
|
3325
|
-
payload:
|
|
3430
|
+
/** Job payload (any JSON) */
|
|
3431
|
+
payload: JsonValue;
|
|
3326
3432
|
/** Current retry count */
|
|
3327
3433
|
retryCount: number;
|
|
3328
3434
|
/** Maximum retries */
|
|
@@ -3335,11 +3441,11 @@ interface JobContext {
|
|
|
3335
3441
|
log: (level: "debug" | "info" | "warn" | "error", message: string, meta?: unknown) => void;
|
|
3336
3442
|
}
|
|
3337
3443
|
/** Job handler function */
|
|
3338
|
-
type JobHandler = (context: JobContext) => Promise<
|
|
3444
|
+
type JobHandler = (context: JobContext) => Promise<JsonValue | void>;
|
|
3339
3445
|
/** Job processing result */
|
|
3340
3446
|
interface JobResult {
|
|
3341
3447
|
success: boolean;
|
|
3342
|
-
result?:
|
|
3448
|
+
result?: JsonValue;
|
|
3343
3449
|
error?: string;
|
|
3344
3450
|
}
|
|
3345
3451
|
/** Worker event types */
|
|
@@ -3368,7 +3474,7 @@ interface WorkerEventData {
|
|
|
3368
3474
|
"job:completed": {
|
|
3369
3475
|
jobId: string;
|
|
3370
3476
|
queueName: string;
|
|
3371
|
-
result?:
|
|
3477
|
+
result?: JsonValue;
|
|
3372
3478
|
};
|
|
3373
3479
|
"job:failed": {
|
|
3374
3480
|
jobId: string;
|
|
@@ -3422,6 +3528,11 @@ type EventHandler<E extends WorkerEvent> = (data: WorkerEventData[E]) => void;
|
|
|
3422
3528
|
*/
|
|
3423
3529
|
declare class SpooledWorker {
|
|
3424
3530
|
private readonly client;
|
|
3531
|
+
/**
|
|
3532
|
+
* Options with every defaultable field filled in. `workerId` stays optional:
|
|
3533
|
+
* there is no sensible default for it, and omitting it is what makes the
|
|
3534
|
+
* server mint a UUID.
|
|
3535
|
+
*/
|
|
3425
3536
|
private readonly options;
|
|
3426
3537
|
private readonly debug;
|
|
3427
3538
|
private state;
|
|
@@ -3480,4 +3591,4 @@ declare class SpooledWorker {
|
|
|
3480
3591
|
private sleep;
|
|
3481
3592
|
}
|
|
3482
3593
|
|
|
3483
|
-
export { type
|
|
3594
|
+
export { type CreateWorkflowParams as $, API_VERSION as A, type BatchJobStatus as B, type ConnectionState as C, type BulkEnqueueResponse as D, type BulkJobItem as E, type CheckEmailResponse as F, type CheckSlugResponse as G, CircuitBreaker as H, type CircuitBreakerConfig as I, CircuitState as J, type ClaimJobsParams as K, type ClaimJobsResult as L, type ClaimedJob as M, type CompleteJobParams as N, type CreateApiKeyParams as O, type CreateApiKeyResponse as P, type CreateBillingPortalParams as Q, type RealtimeConnectionOptions as R, type SubscriptionFilter as S, type CreateBillingPortalResponse as T, type CreateJobParams as U, type CreateJobResult as V, type CreateOrganizationParams as W, type CreateOrganizationResponse as X, type CreateOutgoingWebhookParams as Y, type CreateScheduleParams as Z, type CreateScheduleResponse as _, type RealtimeEventType as a, type IngestGitHubWebhookOptions as a$, type CreateWorkflowResponse as a0, type CurrentUserResponse as a1, DEFAULT_CONFIG as a2, type DashboardData as a3, DashboardResource as a4, type DashboardWorkerSummary as a5, type DebugFn as a6, type DependencyInfo as a7, type DependencyMode as a8, type FailJobParams as a9, type GrpcHeartbeatRequest as aA, type GrpcHeartbeatResponse as aB, type GrpcHeartbeatResponse_Legacy as aC, type GrpcJob as aD, GrpcJobStatus as aE, GrpcJobStatusNumber as aF, type GrpcProcessRequest as aG, type GrpcProcessResponse as aH, GrpcQueueOperations as aI, type GrpcRegisterWorkerParams as aJ, type GrpcRegisterWorkerRequest as aK, type GrpcRegisterWorkerResponse as aL, type GrpcRegisterWorkerResponse_Legacy as aM, type GrpcRenewLeaseParams as aN, type GrpcRenewLeaseRequest as aO, type GrpcRenewLeaseResponse as aP, type GrpcRenewLeaseResponse_Legacy as aQ, type GrpcStreamJobsRequest as aR, type GrpcTimestamp as aS, GrpcWorkerOperations as aT, HealthResource as aU, type HealthResponse as aV, type HeartbeatEvent as aW, type HeartbeatJobParams as aX, HttpClient as aY, type IngestCustomWebhookParams as aZ, type IngestCustomWebhookResponse as a_, type GrpcClientOptions as aa, type GrpcCompleteJobParams as ab, type GrpcCompleteJobResponse as ac, type GrpcCompleteRequest as ad, type GrpcCompleteResponse as ae, type GrpcDequeueJobParams as af, type GrpcDequeueJobResponse as ag, type GrpcDequeueRequest as ah, type GrpcDequeueResponse as ai, type GrpcDeregisterRequest as aj, type GrpcDeregisterResponse as ak, type GrpcEnqueueJobParams as al, type GrpcEnqueueJobResponse as am, type GrpcEnqueueRequest as an, type GrpcEnqueueResponse as ao, type GrpcErrorResponse as ap, type GrpcFailJobParams as aq, type GrpcFailJobResponse as ar, type GrpcFailRequest as as, type GrpcFailResponse as at, type GrpcGetJobRequest as au, type GrpcGetJobResponse as av, type GrpcGetQueueStatsRequest as aw, type GrpcGetQueueStatsResponse as ax, type GrpcGetQueueStatsResponse_Legacy as ay, type GrpcHeartbeatParams as az, type RealtimeEvent as b, type RetryDlqParams as b$, type IngestStripeWebhookOptions as b0, type InitialApiKey as b1, type Job as b2, type JobCompletedEvent as b3, type JobContext as b4, type JobCreatedEvent as b5, type JobFailedEvent as b6, type JobHandler as b7, type JobProgressEvent as b8, type JobResult as b9, type OutgoingWebhook as bA, type OutgoingWebhookDelivery as bB, type PaginatedResponse as bC, type PaginationParams as bD, type PauseQueueResponse as bE, type PlanCount as bF, type PlanLimits as bG, type PlanTier as bH, type ProcessJobsStream as bI, type PurgeDlqParams as bJ, type PurgeDlqResponse as bK, type QueueConfig as bL, type QueueConfigSummary as bM, type QueuePausedEvent as bN, type QueueResumedEvent as bO, type QueueStats as bP, type QueueSummary as bQ, QueuesResource as bR, type RealtimeEventData as bS, type RecentActivity as bT, type RefreshTokenParams as bU, type RefreshTokenResponse as bV, type RegisterWorkerParams as bW, type RegisterWorkerResponse as bX, type ResolvedConfig as bY, type ResourceUsage as bZ, type ResumeQueueResponse as b_, type JobStartedEvent as ba, type JobStats as bb, type JobStatus as bc, type JobStatusChangedEvent as bd, type JobStream as be, type JobSummary as bf, type JobSummaryStats as bg, type JobWithDependencies as bh, JobsResource as bi, type JsonArray as bj, type JsonObject as bk, type JsonPrimitive as bl, type JsonValue as bm, type ListDlqParams as bn, type ListJobsParams as bo, type ListParams as bp, type ListSchedulesParams as bq, type ListWorkflowsParams as br, type LoginParams as bs, type LoginResponse as bt, MetricsResource as bu, type Organization as bv, type OrganizationMember as bw, type OrganizationSummary as bx, type OrganizationUsage as by, OrganizationsResource as bz, type RetryConfig as c, type RetryDlqResponse as c0, SDK_VERSION as c1, type Schedule as c2, type ScheduleRun as c3, type ScheduleRunStatus as c4, type ScheduleTriggeredEvent as c5, SchedulesResource as c6, SpooledClient as c7, type SpooledClientConfig as c8, SpooledGrpcClient as c9, type WorkerEvent as cA, type WorkerEventData as cB, type WorkerHeartbeatParams as cC, type WorkerRegisteredEvent as cD, type WorkerState as cE, type WorkerStatus as cF, type WorkerSummary as cG, WorkersResource as cH, type Workflow as cI, type WorkflowJob as cJ, type WorkflowJobDefinition as cK, type WorkflowJobStatus as cL, type WorkflowResponse as cM, type WorkflowStatus as cN, WorkflowsResource as cO, asyncIterableFromStream as cP, createCircuitBreaker as cQ, createClient as cR, createHttpClient as cS, createJobStream as cT, createPaginatedResponse as cU, createProcessJobsStream as cV, dateToTimestamp as cW, resolveConfig as cX, timestampToDate as cY, validateConfig as cZ, type ActiveJob as c_, SpooledRealtime as ca, type SpooledRealtimeOptions as cb, SpooledWorker as cc, type SpooledWorkerOptions as cd, type StartEmailLoginResponse as ce, type StreamOptions as cf, type SystemInfo as cg, type TestWebhookResponse as ch, type TokenClaims as ci, type TriggerScheduleResponse as cj, type UpdateApiKeyParams as ck, type UpdateOrganizationParams as cl, type UpdateOutgoingWebhookParams as cm, type UpdateQueueConfigParams as cn, type UpdateScheduleParams as co, type UsageItem as cp, type UsageWarning as cq, type ValidateTokenParams as cr, type ValidateTokenResponse as cs, type WebhookDeliveryStatus as ct, type WebhookEventType as cu, WebhookIngestionResource as cv, type WebhookTokenResponse as cw, WebhooksResource as cx, type Worker as cy, type WorkerDeregisteredEvent as cz, type AddDependenciesParams as d, type AddDependenciesResponse as e, type AdminApiKeyResponse as f, type AdminCreateApiKeyParams as g, type AdminCreateOrganizationParams as h, type AdminCreateOrganizationResponse as i, type AdminDeleteOrganizationParams as j, type AdminListOrganizationsParams as k, type AdminOrganizationDetail as l, type AdminOrganizationList as m, type AdminOrganizationSummary as n, type AdminPlanLimits as o, type AdminPlatformStats as p, AdminResource as q, type AdminUpdateOrganizationParams as r, type AdminUsageStats as s, type ApiKeySummary as t, ApiKeysResource as u, AuthResource as v, BillingResource as w, type BillingStatus as x, type BoostPriorityResponse as y, type BulkEnqueueParams as z };
|