@upstash/qstash 2.9.1-rc.1 → 2.9.1
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/{chunk-RUCOF5QZ.mjs → chunk-DT2X63FB.mjs} +166 -184
- package/{chunk-STWPT5EV.mjs → chunk-JO26IBSH.mjs} +1 -1
- package/{chunk-SN6OPGRS.mjs → chunk-KDHOB7B5.mjs} +1 -1
- package/{client-Gv4WRTxB.d.ts → client-jh_SomWB.d.mts} +195 -143
- package/{client-Gv4WRTxB.d.mts → client-jh_SomWB.d.ts} +195 -143
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +165 -184
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +165 -184
- package/h3.mjs +3 -3
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +165 -184
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +166 -183
- package/index.mjs +4 -2
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +165 -184
- package/nextjs.mjs +1 -1
- package/nuxt.mjs +3 -3
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +165 -184
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +165 -184
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +165 -184
- package/workflow.mjs +1 -1
package/cloudflare.js
CHANGED
|
@@ -392,43 +392,6 @@ function decodeBase64(base64) {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function buildBulkActionFilterPayload(request, options) {
|
|
396
|
-
const hasDlqIds = "dlqIds" in request && request.dlqIds !== void 0;
|
|
397
|
-
const hasAll = "all" in request && Boolean(request.all);
|
|
398
|
-
const filterKeys = Object.keys(request).filter((k) => k !== "dlqIds" && k !== "all");
|
|
399
|
-
const hasFilters = filterKeys.length > 0;
|
|
400
|
-
if (hasDlqIds && hasAll) {
|
|
401
|
-
throw new QstashError("dlqIds and all: true are mutually exclusive.");
|
|
402
|
-
}
|
|
403
|
-
if (hasDlqIds && hasFilters) {
|
|
404
|
-
throw new QstashError(
|
|
405
|
-
`dlqIds cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
if (hasAll && hasFilters) {
|
|
409
|
-
throw new QstashError(
|
|
410
|
-
`all: true cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
if (hasAll)
|
|
414
|
-
return {};
|
|
415
|
-
const { urlGroup, callerIp, ...rest } = request;
|
|
416
|
-
const payload = {
|
|
417
|
-
...rest,
|
|
418
|
-
...urlGroup === void 0 || typeof urlGroup !== "string" ? {} : { topicName: urlGroup },
|
|
419
|
-
...callerIp === void 0 || typeof callerIp !== "string" ? {} : options?.callerIpCasing ? { callerIP: callerIp } : { callerIp }
|
|
420
|
-
};
|
|
421
|
-
if (Object.keys(payload).length === 0) {
|
|
422
|
-
throw new QstashError(
|
|
423
|
-
"No filters provided. Pass { all: true } to explicitly target all messages."
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
return payload;
|
|
427
|
-
}
|
|
428
|
-
function normalizeCursor(response) {
|
|
429
|
-
const cursor = response.cursor;
|
|
430
|
-
return { ...response, cursor: cursor || void 0 };
|
|
431
|
-
}
|
|
432
395
|
function getRuntime() {
|
|
433
396
|
if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
|
|
434
397
|
return `bun@${process.versions.bun}`;
|
|
@@ -658,20 +621,17 @@ var DLQ = class {
|
|
|
658
621
|
/**
|
|
659
622
|
* List messages in the dlq
|
|
660
623
|
*/
|
|
661
|
-
async listMessages(options
|
|
662
|
-
const { urlGroup, ...restFilter } = options.filter ?? {};
|
|
624
|
+
async listMessages(options) {
|
|
663
625
|
const filterPayload = {
|
|
664
|
-
...
|
|
665
|
-
|
|
626
|
+
...options?.filter,
|
|
627
|
+
topicName: options?.filter?.urlGroup
|
|
666
628
|
};
|
|
667
629
|
const messagesPayload = await this.http.request({
|
|
668
630
|
method: "GET",
|
|
669
631
|
path: ["v2", "dlq"],
|
|
670
632
|
query: {
|
|
671
|
-
cursor: options
|
|
672
|
-
count: options
|
|
673
|
-
order: options.order,
|
|
674
|
-
trimBody: options.trimBody,
|
|
633
|
+
cursor: options?.cursor,
|
|
634
|
+
count: options?.count,
|
|
675
635
|
...filterPayload
|
|
676
636
|
}
|
|
677
637
|
});
|
|
@@ -687,70 +647,127 @@ var DLQ = class {
|
|
|
687
647
|
};
|
|
688
648
|
}
|
|
689
649
|
/**
|
|
690
|
-
* Remove
|
|
691
|
-
*
|
|
692
|
-
* Can be called with:
|
|
693
|
-
* - A single dlqId: `delete("id")`
|
|
694
|
-
* - An array of dlqIds: `delete(["id1", "id2"])`
|
|
695
|
-
* - An object with dlqIds: `delete({ dlqIds: ["id1", "id2"] })`
|
|
696
|
-
* - A filter object: `delete({ url: "https://example.com", label: "label" })`
|
|
697
|
-
* - All messages: `delete({ all: true })`
|
|
698
|
-
*
|
|
699
|
-
* Note: passing an empty array returns `{ deleted: 0 }` without making a request.
|
|
650
|
+
* Remove a message from the dlq using it's `dlqId`
|
|
700
651
|
*/
|
|
701
|
-
async delete(
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
return { deleted: 1 };
|
|
709
|
-
}
|
|
710
|
-
if (Array.isArray(request) && request.length === 0)
|
|
711
|
-
return { deleted: 0 };
|
|
712
|
-
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
713
|
-
return normalizeCursor(
|
|
714
|
-
await this.http.request({
|
|
715
|
-
method: "DELETE",
|
|
716
|
-
path: ["v2", "dlq"],
|
|
717
|
-
query: buildBulkActionFilterPayload(filters)
|
|
718
|
-
})
|
|
719
|
-
);
|
|
652
|
+
async delete(dlqMessageId) {
|
|
653
|
+
return await this.http.request({
|
|
654
|
+
method: "DELETE",
|
|
655
|
+
path: ["v2", "dlq", dlqMessageId],
|
|
656
|
+
parseResponseAsJson: false
|
|
657
|
+
// there is no response
|
|
658
|
+
});
|
|
720
659
|
}
|
|
721
660
|
/**
|
|
722
661
|
* Remove multiple messages from the dlq using their `dlqId`s
|
|
723
|
-
*
|
|
724
|
-
* @deprecated Use `delete` instead
|
|
725
662
|
*/
|
|
726
663
|
async deleteMany(request) {
|
|
727
|
-
return await this.
|
|
664
|
+
return await this.http.request({
|
|
665
|
+
method: "DELETE",
|
|
666
|
+
path: ["v2", "dlq"],
|
|
667
|
+
headers: { "Content-Type": "application/json" },
|
|
668
|
+
body: JSON.stringify({ dlqIds: request.dlqIds })
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
// src/client/flow-control.ts
|
|
674
|
+
var FlowControlApi = class {
|
|
675
|
+
http;
|
|
676
|
+
constructor(http) {
|
|
677
|
+
this.http = http;
|
|
728
678
|
}
|
|
729
679
|
/**
|
|
730
|
-
*
|
|
680
|
+
* Get a single flow control by key.
|
|
681
|
+
*/
|
|
682
|
+
async get(flowControlKey) {
|
|
683
|
+
return await this.http.request({
|
|
684
|
+
method: "GET",
|
|
685
|
+
path: ["v2", "flowControl", flowControlKey]
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Get the global parallelism info.
|
|
690
|
+
*/
|
|
691
|
+
async getGlobalParallelism() {
|
|
692
|
+
const response = await this.http.request({
|
|
693
|
+
method: "GET",
|
|
694
|
+
path: ["v2", "globalParallelism"]
|
|
695
|
+
});
|
|
696
|
+
return {
|
|
697
|
+
parallelismMax: response.parallelismMax ?? 0,
|
|
698
|
+
parallelismCount: response.parallelismCount ?? 0
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Pause message delivery for a flow-control key.
|
|
731
703
|
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
704
|
+
* Messages already in the waitlist will remain there.
|
|
705
|
+
* New incoming messages will be added directly to the waitlist.
|
|
706
|
+
*/
|
|
707
|
+
async pause(flowControlKey) {
|
|
708
|
+
await this.http.request({
|
|
709
|
+
method: "POST",
|
|
710
|
+
path: ["v2", "flowControl", flowControlKey, "pause"],
|
|
711
|
+
parseResponseAsJson: false
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Resume message delivery for a flow-control key.
|
|
716
|
+
*/
|
|
717
|
+
async resume(flowControlKey) {
|
|
718
|
+
await this.http.request({
|
|
719
|
+
method: "POST",
|
|
720
|
+
path: ["v2", "flowControl", flowControlKey, "resume"],
|
|
721
|
+
parseResponseAsJson: false
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Pin a processing configuration for a flow-control key.
|
|
738
726
|
*
|
|
739
|
-
*
|
|
727
|
+
* While pinned, the system ignores configurations provided by incoming
|
|
728
|
+
* messages and uses the pinned configuration instead.
|
|
740
729
|
*/
|
|
741
|
-
async
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
730
|
+
async pin(flowControlKey, options) {
|
|
731
|
+
await this.http.request({
|
|
732
|
+
method: "POST",
|
|
733
|
+
path: ["v2", "flowControl", flowControlKey, "pin"],
|
|
734
|
+
query: {
|
|
735
|
+
parallelism: options.parallelism,
|
|
736
|
+
rate: options.rate,
|
|
737
|
+
period: options.period
|
|
738
|
+
},
|
|
739
|
+
parseResponseAsJson: false
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Remove the pinned configuration for a flow-control key.
|
|
744
|
+
*
|
|
745
|
+
* After unpinning, the system resumes updating the configuration
|
|
746
|
+
* based on incoming messages.
|
|
747
|
+
*/
|
|
748
|
+
async unpin(flowControlKey, options) {
|
|
749
|
+
await this.http.request({
|
|
750
|
+
method: "POST",
|
|
751
|
+
path: ["v2", "flowControl", flowControlKey, "unpin"],
|
|
752
|
+
query: {
|
|
753
|
+
parallelism: options.parallelism,
|
|
754
|
+
rate: options.rate
|
|
755
|
+
},
|
|
756
|
+
parseResponseAsJson: false
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Reset the rate configuration state for a flow-control key.
|
|
761
|
+
*
|
|
762
|
+
* Clears the current rate count and immediately ends the current period.
|
|
763
|
+
* The current timestamp becomes the start of the new rate period.
|
|
764
|
+
*/
|
|
765
|
+
async resetRate(flowControlKey) {
|
|
766
|
+
await this.http.request({
|
|
767
|
+
method: "POST",
|
|
768
|
+
path: ["v2", "flowControl", flowControlKey, "resetRate"],
|
|
769
|
+
parseResponseAsJson: false
|
|
770
|
+
});
|
|
754
771
|
}
|
|
755
772
|
};
|
|
756
773
|
|
|
@@ -851,15 +868,7 @@ var HttpClient = class {
|
|
|
851
868
|
const url = new URL([request.baseUrl ?? this.baseUrl, ...request.path].join("/"));
|
|
852
869
|
if (request.query) {
|
|
853
870
|
for (const [key, value] of Object.entries(request.query)) {
|
|
854
|
-
if (value
|
|
855
|
-
continue;
|
|
856
|
-
if (Array.isArray(value)) {
|
|
857
|
-
for (const item of value) {
|
|
858
|
-
url.searchParams.append(key, item);
|
|
859
|
-
}
|
|
860
|
-
} else if (value instanceof Date) {
|
|
861
|
-
url.searchParams.set(key, value.getTime().toString());
|
|
862
|
-
} else {
|
|
871
|
+
if (value !== void 0) {
|
|
863
872
|
url.searchParams.set(key, value.toString());
|
|
864
873
|
}
|
|
865
874
|
}
|
|
@@ -1090,57 +1099,29 @@ var Messages = class {
|
|
|
1090
1099
|
return message;
|
|
1091
1100
|
}
|
|
1092
1101
|
/**
|
|
1093
|
-
* Cancel
|
|
1094
|
-
*
|
|
1095
|
-
* Can be called with:
|
|
1096
|
-
* - A single messageId: `cancel("id")`
|
|
1097
|
-
* - An array of messageIds: `cancel(["id1", "id2"])`
|
|
1098
|
-
* - A filter object: `cancel({ flowControlKey: "key", label: "label" })`
|
|
1099
|
-
* - All messages: `cancel({ all: true })`
|
|
1100
|
-
*/
|
|
1101
|
-
async cancel(request) {
|
|
1102
|
-
if (typeof request === "string") {
|
|
1103
|
-
return await this.http.request({
|
|
1104
|
-
method: "DELETE",
|
|
1105
|
-
path: ["v2", "messages", request]
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1108
|
-
if (Array.isArray(request) && request.length === 0)
|
|
1109
|
-
return { cancelled: 0 };
|
|
1110
|
-
const filters = Array.isArray(request) ? { messageIds: request } : request;
|
|
1111
|
-
return await this.http.request({
|
|
1112
|
-
method: "DELETE",
|
|
1113
|
-
path: ["v2", "messages"],
|
|
1114
|
-
query: buildBulkActionFilterPayload(filters, { callerIpCasing: true })
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Delete a message.
|
|
1119
|
-
*
|
|
1120
|
-
* @deprecated Use `cancel(messageId: string)` instead
|
|
1102
|
+
* Cancel a message
|
|
1121
1103
|
*/
|
|
1122
1104
|
async delete(messageId) {
|
|
1123
|
-
await this.http.request({
|
|
1105
|
+
return await this.http.request({
|
|
1124
1106
|
method: "DELETE",
|
|
1125
1107
|
path: ["v2", "messages", messageId],
|
|
1126
1108
|
parseResponseAsJson: false
|
|
1127
1109
|
});
|
|
1128
1110
|
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Cancel multiple messages by their messageIds.
|
|
1131
|
-
*
|
|
1132
|
-
* @deprecated Use `cancel(messageIds: string[])` instead
|
|
1133
|
-
*/
|
|
1134
1111
|
async deleteMany(messageIds) {
|
|
1135
|
-
const result = await this.
|
|
1112
|
+
const result = await this.http.request({
|
|
1113
|
+
method: "DELETE",
|
|
1114
|
+
path: ["v2", "messages"],
|
|
1115
|
+
headers: { "Content-Type": "application/json" },
|
|
1116
|
+
body: JSON.stringify({ messageIds })
|
|
1117
|
+
});
|
|
1136
1118
|
return result.cancelled;
|
|
1137
1119
|
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Cancel all messages
|
|
1140
|
-
* @deprecated Use `cancel({all: true})` to cancel all
|
|
1141
|
-
*/
|
|
1142
1120
|
async deleteAll() {
|
|
1143
|
-
const result = await this.
|
|
1121
|
+
const result = await this.http.request({
|
|
1122
|
+
method: "DELETE",
|
|
1123
|
+
path: ["v2", "messages"]
|
|
1124
|
+
});
|
|
1144
1125
|
return result.cancelled;
|
|
1145
1126
|
}
|
|
1146
1127
|
};
|
|
@@ -1474,7 +1455,7 @@ var UrlGroups = class {
|
|
|
1474
1455
|
};
|
|
1475
1456
|
|
|
1476
1457
|
// version.ts
|
|
1477
|
-
var VERSION = "v2.9.1
|
|
1458
|
+
var VERSION = "v2.9.1";
|
|
1478
1459
|
|
|
1479
1460
|
// src/client/client.ts
|
|
1480
1461
|
var Client = class {
|
|
@@ -1545,6 +1526,14 @@ var Client = class {
|
|
|
1545
1526
|
get schedules() {
|
|
1546
1527
|
return new Schedules(this.http);
|
|
1547
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Access the flow control API.
|
|
1531
|
+
*
|
|
1532
|
+
* List, get, or reset flow controls.
|
|
1533
|
+
*/
|
|
1534
|
+
get flowControl() {
|
|
1535
|
+
return new FlowControlApi(this.http);
|
|
1536
|
+
}
|
|
1548
1537
|
/**
|
|
1549
1538
|
* Access the workflow API.
|
|
1550
1539
|
*
|
|
@@ -1669,47 +1658,39 @@ var Client = class {
|
|
|
1669
1658
|
* }
|
|
1670
1659
|
* ```
|
|
1671
1660
|
*/
|
|
1672
|
-
async logs(request
|
|
1673
|
-
const {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
toDate,
|
|
1690
|
-
callerIp
|
|
1691
|
-
};
|
|
1692
|
-
let cursorString;
|
|
1693
|
-
if (typeof request.cursor === "number" && request.cursor > 0) {
|
|
1694
|
-
cursorString = request.cursor.toString();
|
|
1695
|
-
} else if (typeof request.cursor === "string" && request.cursor !== "") {
|
|
1696
|
-
cursorString = request.cursor;
|
|
1697
|
-
}
|
|
1698
|
-
const query = {
|
|
1699
|
-
cursor: cursorString,
|
|
1700
|
-
count: request.count ?? filterCount,
|
|
1701
|
-
order: request.order,
|
|
1702
|
-
trimBody: request.trimBody,
|
|
1703
|
-
messageIds,
|
|
1704
|
-
...filterPayload
|
|
1705
|
-
};
|
|
1661
|
+
async logs(request) {
|
|
1662
|
+
const query = {};
|
|
1663
|
+
if (typeof request?.cursor === "number" && request.cursor > 0) {
|
|
1664
|
+
query.cursor = request.cursor.toString();
|
|
1665
|
+
} else if (typeof request?.cursor === "string" && request.cursor !== "") {
|
|
1666
|
+
query.cursor = request.cursor;
|
|
1667
|
+
}
|
|
1668
|
+
for (const [key, value] of Object.entries(request?.filter ?? {})) {
|
|
1669
|
+
if (typeof value === "number" && value < 0) {
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
if (key === "urlGroup") {
|
|
1673
|
+
query.topicName = value.toString();
|
|
1674
|
+
} else if (typeof value !== "undefined") {
|
|
1675
|
+
query[key] = value.toString();
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1706
1678
|
const responsePayload = await this.http.request({
|
|
1707
1679
|
path: ["v2", "events"],
|
|
1708
1680
|
method: "GET",
|
|
1709
1681
|
query
|
|
1710
1682
|
});
|
|
1711
|
-
const logs = responsePayload.events.map((event) =>
|
|
1712
|
-
|
|
1683
|
+
const logs = responsePayload.events.map((event) => {
|
|
1684
|
+
return {
|
|
1685
|
+
...event,
|
|
1686
|
+
urlGroup: event.topicName
|
|
1687
|
+
};
|
|
1688
|
+
});
|
|
1689
|
+
return {
|
|
1690
|
+
cursor: responsePayload.cursor,
|
|
1691
|
+
logs,
|
|
1692
|
+
events: logs
|
|
1693
|
+
};
|
|
1713
1694
|
}
|
|
1714
1695
|
/**
|
|
1715
1696
|
* @deprecated Will be removed in the next major release. Use the `logs` method instead.
|
package/cloudflare.mjs
CHANGED
package/h3.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import {
|
|
3
|
+
import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.mjs';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
package/h3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import {
|
|
3
|
+
import { ae as RouteFunction, af as WorkflowServeOptions } from './client-jh_SomWB.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|