@upstash/qstash 2.9.0 → 2.9.1-rc.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-QYBCXZKB.mjs → chunk-RUCOF5QZ.mjs} +189 -61
- package/{chunk-M7SEEFAC.mjs → chunk-SN6OPGRS.mjs} +1 -1
- package/{chunk-H5OAU75L.mjs → chunk-STWPT5EV.mjs} +1 -1
- package/{client-BVG9vt90.d.ts → client-Gv4WRTxB.d.mts} +147 -68
- package/{client-BVG9vt90.d.mts → client-Gv4WRTxB.d.ts} +147 -68
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +189 -61
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +189 -61
- package/h3.mjs +3 -3
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +189 -61
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +188 -60
- package/index.mjs +2 -2
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +189 -61
- 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 +189 -61
- package/solidjs.mjs +2 -2
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +189 -61
- package/svelte.mjs +2 -2
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +189 -61
- package/workflow.mjs +1 -1
package/solidjs.js
CHANGED
|
@@ -393,6 +393,43 @@ function decodeBase64(base64) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
+
function buildBulkActionFilterPayload(request, options) {
|
|
397
|
+
const hasDlqIds = "dlqIds" in request && request.dlqIds !== void 0;
|
|
398
|
+
const hasAll = "all" in request && Boolean(request.all);
|
|
399
|
+
const filterKeys = Object.keys(request).filter((k) => k !== "dlqIds" && k !== "all");
|
|
400
|
+
const hasFilters = filterKeys.length > 0;
|
|
401
|
+
if (hasDlqIds && hasAll) {
|
|
402
|
+
throw new QstashError("dlqIds and all: true are mutually exclusive.");
|
|
403
|
+
}
|
|
404
|
+
if (hasDlqIds && hasFilters) {
|
|
405
|
+
throw new QstashError(
|
|
406
|
+
`dlqIds cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
if (hasAll && hasFilters) {
|
|
410
|
+
throw new QstashError(
|
|
411
|
+
`all: true cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
if (hasAll)
|
|
415
|
+
return {};
|
|
416
|
+
const { urlGroup, callerIp, ...rest } = request;
|
|
417
|
+
const payload = {
|
|
418
|
+
...rest,
|
|
419
|
+
...urlGroup === void 0 || typeof urlGroup !== "string" ? {} : { topicName: urlGroup },
|
|
420
|
+
...callerIp === void 0 || typeof callerIp !== "string" ? {} : options?.callerIpCasing ? { callerIP: callerIp } : { callerIp }
|
|
421
|
+
};
|
|
422
|
+
if (Object.keys(payload).length === 0) {
|
|
423
|
+
throw new QstashError(
|
|
424
|
+
"No filters provided. Pass { all: true } to explicitly target all messages."
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return payload;
|
|
428
|
+
}
|
|
429
|
+
function normalizeCursor(response) {
|
|
430
|
+
const cursor = response.cursor;
|
|
431
|
+
return { ...response, cursor: cursor || void 0 };
|
|
432
|
+
}
|
|
396
433
|
function getRuntime() {
|
|
397
434
|
if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
|
|
398
435
|
return `bun@${process.versions.bun}`;
|
|
@@ -622,17 +659,20 @@ var DLQ = class {
|
|
|
622
659
|
/**
|
|
623
660
|
* List messages in the dlq
|
|
624
661
|
*/
|
|
625
|
-
async listMessages(options) {
|
|
662
|
+
async listMessages(options = {}) {
|
|
663
|
+
const { urlGroup, ...restFilter } = options.filter ?? {};
|
|
626
664
|
const filterPayload = {
|
|
627
|
-
...
|
|
628
|
-
topicName:
|
|
665
|
+
...restFilter,
|
|
666
|
+
...urlGroup === void 0 ? {} : { topicName: urlGroup }
|
|
629
667
|
};
|
|
630
668
|
const messagesPayload = await this.http.request({
|
|
631
669
|
method: "GET",
|
|
632
670
|
path: ["v2", "dlq"],
|
|
633
671
|
query: {
|
|
634
|
-
cursor: options
|
|
635
|
-
count: options
|
|
672
|
+
cursor: options.cursor,
|
|
673
|
+
count: options.count,
|
|
674
|
+
order: options.order,
|
|
675
|
+
trimBody: options.trimBody,
|
|
636
676
|
...filterPayload
|
|
637
677
|
}
|
|
638
678
|
});
|
|
@@ -648,26 +688,70 @@ var DLQ = class {
|
|
|
648
688
|
};
|
|
649
689
|
}
|
|
650
690
|
/**
|
|
651
|
-
* Remove
|
|
691
|
+
* Remove messages from the dlq.
|
|
692
|
+
*
|
|
693
|
+
* Can be called with:
|
|
694
|
+
* - A single dlqId: `delete("id")`
|
|
695
|
+
* - An array of dlqIds: `delete(["id1", "id2"])`
|
|
696
|
+
* - An object with dlqIds: `delete({ dlqIds: ["id1", "id2"] })`
|
|
697
|
+
* - A filter object: `delete({ url: "https://example.com", label: "label" })`
|
|
698
|
+
* - All messages: `delete({ all: true })`
|
|
699
|
+
*
|
|
700
|
+
* Note: passing an empty array returns `{ deleted: 0 }` without making a request.
|
|
652
701
|
*/
|
|
653
|
-
async delete(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
702
|
+
async delete(request) {
|
|
703
|
+
if (typeof request === "string") {
|
|
704
|
+
await this.http.request({
|
|
705
|
+
method: "DELETE",
|
|
706
|
+
path: ["v2", "dlq", request],
|
|
707
|
+
parseResponseAsJson: false
|
|
708
|
+
});
|
|
709
|
+
return { deleted: 1 };
|
|
710
|
+
}
|
|
711
|
+
if (Array.isArray(request) && request.length === 0)
|
|
712
|
+
return { deleted: 0 };
|
|
713
|
+
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
714
|
+
return normalizeCursor(
|
|
715
|
+
await this.http.request({
|
|
716
|
+
method: "DELETE",
|
|
717
|
+
path: ["v2", "dlq"],
|
|
718
|
+
query: buildBulkActionFilterPayload(filters)
|
|
719
|
+
})
|
|
720
|
+
);
|
|
660
721
|
}
|
|
661
722
|
/**
|
|
662
723
|
* Remove multiple messages from the dlq using their `dlqId`s
|
|
724
|
+
*
|
|
725
|
+
* @deprecated Use `delete` instead
|
|
663
726
|
*/
|
|
664
727
|
async deleteMany(request) {
|
|
665
|
-
return await this.
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
728
|
+
return await this.delete(request);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Retry messages from the dlq.
|
|
732
|
+
*
|
|
733
|
+
* Can be called with:
|
|
734
|
+
* - A single dlqId: `retry("id")`
|
|
735
|
+
* - An array of dlqIds: `retry(["id1", "id2"])`
|
|
736
|
+
* - An object with dlqIds: `retry({ dlqIds: ["id1", "id2"] })`
|
|
737
|
+
* - A filter object: `retry({ url: "https://example.com", label: "label" })`
|
|
738
|
+
* - All messages: `retry({ all: true })`
|
|
739
|
+
*
|
|
740
|
+
* Note: passing an empty array returns `{ responses: [] }` without making a request.
|
|
741
|
+
*/
|
|
742
|
+
async retry(request) {
|
|
743
|
+
if (typeof request === "string")
|
|
744
|
+
request = [request];
|
|
745
|
+
if (Array.isArray(request) && request.length === 0)
|
|
746
|
+
return { responses: [] };
|
|
747
|
+
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
748
|
+
return normalizeCursor(
|
|
749
|
+
await this.http.request({
|
|
750
|
+
method: "POST",
|
|
751
|
+
path: ["v2", "dlq", "retry"],
|
|
752
|
+
query: buildBulkActionFilterPayload(filters)
|
|
753
|
+
})
|
|
754
|
+
);
|
|
671
755
|
}
|
|
672
756
|
};
|
|
673
757
|
|
|
@@ -768,7 +852,15 @@ var HttpClient = class {
|
|
|
768
852
|
const url = new URL([request.baseUrl ?? this.baseUrl, ...request.path].join("/"));
|
|
769
853
|
if (request.query) {
|
|
770
854
|
for (const [key, value] of Object.entries(request.query)) {
|
|
771
|
-
if (value
|
|
855
|
+
if (value === void 0)
|
|
856
|
+
continue;
|
|
857
|
+
if (Array.isArray(value)) {
|
|
858
|
+
for (const item of value) {
|
|
859
|
+
url.searchParams.append(key, item);
|
|
860
|
+
}
|
|
861
|
+
} else if (value instanceof Date) {
|
|
862
|
+
url.searchParams.set(key, value.getTime().toString());
|
|
863
|
+
} else {
|
|
772
864
|
url.searchParams.set(key, value.toString());
|
|
773
865
|
}
|
|
774
866
|
}
|
|
@@ -999,29 +1091,57 @@ var Messages = class {
|
|
|
999
1091
|
return message;
|
|
1000
1092
|
}
|
|
1001
1093
|
/**
|
|
1002
|
-
* Cancel
|
|
1094
|
+
* Cancel messages.
|
|
1095
|
+
*
|
|
1096
|
+
* Can be called with:
|
|
1097
|
+
* - A single messageId: `cancel("id")`
|
|
1098
|
+
* - An array of messageIds: `cancel(["id1", "id2"])`
|
|
1099
|
+
* - A filter object: `cancel({ flowControlKey: "key", label: "label" })`
|
|
1100
|
+
* - All messages: `cancel({ all: true })`
|
|
1003
1101
|
*/
|
|
1004
|
-
async
|
|
1102
|
+
async cancel(request) {
|
|
1103
|
+
if (typeof request === "string") {
|
|
1104
|
+
return await this.http.request({
|
|
1105
|
+
method: "DELETE",
|
|
1106
|
+
path: ["v2", "messages", request]
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
if (Array.isArray(request) && request.length === 0)
|
|
1110
|
+
return { cancelled: 0 };
|
|
1111
|
+
const filters = Array.isArray(request) ? { messageIds: request } : request;
|
|
1005
1112
|
return await this.http.request({
|
|
1113
|
+
method: "DELETE",
|
|
1114
|
+
path: ["v2", "messages"],
|
|
1115
|
+
query: buildBulkActionFilterPayload(filters, { callerIpCasing: true })
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Delete a message.
|
|
1120
|
+
*
|
|
1121
|
+
* @deprecated Use `cancel(messageId: string)` instead
|
|
1122
|
+
*/
|
|
1123
|
+
async delete(messageId) {
|
|
1124
|
+
await this.http.request({
|
|
1006
1125
|
method: "DELETE",
|
|
1007
1126
|
path: ["v2", "messages", messageId],
|
|
1008
1127
|
parseResponseAsJson: false
|
|
1009
1128
|
});
|
|
1010
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Cancel multiple messages by their messageIds.
|
|
1132
|
+
*
|
|
1133
|
+
* @deprecated Use `cancel(messageIds: string[])` instead
|
|
1134
|
+
*/
|
|
1011
1135
|
async deleteMany(messageIds) {
|
|
1012
|
-
const result = await this.
|
|
1013
|
-
method: "DELETE",
|
|
1014
|
-
path: ["v2", "messages"],
|
|
1015
|
-
headers: { "Content-Type": "application/json" },
|
|
1016
|
-
body: JSON.stringify({ messageIds })
|
|
1017
|
-
});
|
|
1136
|
+
const result = await this.cancel(messageIds);
|
|
1018
1137
|
return result.cancelled;
|
|
1019
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Cancel all messages
|
|
1141
|
+
* @deprecated Use `cancel({all: true})` to cancel all
|
|
1142
|
+
*/
|
|
1020
1143
|
async deleteAll() {
|
|
1021
|
-
const result = await this.
|
|
1022
|
-
method: "DELETE",
|
|
1023
|
-
path: ["v2", "messages"]
|
|
1024
|
-
});
|
|
1144
|
+
const result = await this.cancel({ all: true });
|
|
1025
1145
|
return result.cancelled;
|
|
1026
1146
|
}
|
|
1027
1147
|
};
|
|
@@ -2741,7 +2861,7 @@ var Workflow = class {
|
|
|
2741
2861
|
};
|
|
2742
2862
|
|
|
2743
2863
|
// version.ts
|
|
2744
|
-
var VERSION = "v2.9.
|
|
2864
|
+
var VERSION = "v2.9.1-rc.1";
|
|
2745
2865
|
|
|
2746
2866
|
// src/client/client.ts
|
|
2747
2867
|
var Client = class {
|
|
@@ -2936,39 +3056,47 @@ var Client = class {
|
|
|
2936
3056
|
* }
|
|
2937
3057
|
* ```
|
|
2938
3058
|
*/
|
|
2939
|
-
async logs(request) {
|
|
2940
|
-
const
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
3059
|
+
async logs(request = {}) {
|
|
3060
|
+
const {
|
|
3061
|
+
urlGroup,
|
|
3062
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3063
|
+
topicName,
|
|
3064
|
+
fromDate,
|
|
3065
|
+
toDate,
|
|
3066
|
+
callerIp,
|
|
3067
|
+
messageIds,
|
|
3068
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3069
|
+
count: filterCount,
|
|
3070
|
+
...restFilter
|
|
3071
|
+
} = request.filter ?? {};
|
|
3072
|
+
const filterPayload = {
|
|
3073
|
+
...restFilter,
|
|
3074
|
+
topicName: urlGroup ?? topicName,
|
|
3075
|
+
fromDate,
|
|
3076
|
+
toDate,
|
|
3077
|
+
callerIp
|
|
3078
|
+
};
|
|
3079
|
+
let cursorString;
|
|
3080
|
+
if (typeof request.cursor === "number" && request.cursor > 0) {
|
|
3081
|
+
cursorString = request.cursor.toString();
|
|
3082
|
+
} else if (typeof request.cursor === "string" && request.cursor !== "") {
|
|
3083
|
+
cursorString = request.cursor;
|
|
3084
|
+
}
|
|
3085
|
+
const query = {
|
|
3086
|
+
cursor: cursorString,
|
|
3087
|
+
count: request.count ?? filterCount,
|
|
3088
|
+
order: request.order,
|
|
3089
|
+
trimBody: request.trimBody,
|
|
3090
|
+
messageIds,
|
|
3091
|
+
...filterPayload
|
|
3092
|
+
};
|
|
2956
3093
|
const responsePayload = await this.http.request({
|
|
2957
3094
|
path: ["v2", "events"],
|
|
2958
3095
|
method: "GET",
|
|
2959
3096
|
query
|
|
2960
3097
|
});
|
|
2961
|
-
const logs = responsePayload.events.map((event) => {
|
|
2962
|
-
|
|
2963
|
-
...event,
|
|
2964
|
-
urlGroup: event.topicName
|
|
2965
|
-
};
|
|
2966
|
-
});
|
|
2967
|
-
return {
|
|
2968
|
-
cursor: responsePayload.cursor,
|
|
2969
|
-
logs,
|
|
2970
|
-
events: logs
|
|
2971
|
-
};
|
|
3098
|
+
const logs = responsePayload.events.map((event) => ({ ...event, urlGroup: event.topicName }));
|
|
3099
|
+
return { cursor: responsePayload.cursor, logs, events: logs };
|
|
2972
3100
|
}
|
|
2973
3101
|
/**
|
|
2974
3102
|
* @deprecated Will be removed in the next major release. Use the `logs` method instead.
|
package/solidjs.mjs
CHANGED
package/svelte.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { aa as RouteFunction, ab as WorkflowServeOptions } from './client-Gv4WRTxB.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
package/svelte.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { aa as RouteFunction, ab as WorkflowServeOptions } from './client-Gv4WRTxB.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
package/svelte.js
CHANGED
|
@@ -393,6 +393,43 @@ function decodeBase64(base64) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
+
function buildBulkActionFilterPayload(request, options) {
|
|
397
|
+
const hasDlqIds = "dlqIds" in request && request.dlqIds !== void 0;
|
|
398
|
+
const hasAll = "all" in request && Boolean(request.all);
|
|
399
|
+
const filterKeys = Object.keys(request).filter((k) => k !== "dlqIds" && k !== "all");
|
|
400
|
+
const hasFilters = filterKeys.length > 0;
|
|
401
|
+
if (hasDlqIds && hasAll) {
|
|
402
|
+
throw new QstashError("dlqIds and all: true are mutually exclusive.");
|
|
403
|
+
}
|
|
404
|
+
if (hasDlqIds && hasFilters) {
|
|
405
|
+
throw new QstashError(
|
|
406
|
+
`dlqIds cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
if (hasAll && hasFilters) {
|
|
410
|
+
throw new QstashError(
|
|
411
|
+
`all: true cannot be combined with filter fields: ${filterKeys.join(", ")}.`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
if (hasAll)
|
|
415
|
+
return {};
|
|
416
|
+
const { urlGroup, callerIp, ...rest } = request;
|
|
417
|
+
const payload = {
|
|
418
|
+
...rest,
|
|
419
|
+
...urlGroup === void 0 || typeof urlGroup !== "string" ? {} : { topicName: urlGroup },
|
|
420
|
+
...callerIp === void 0 || typeof callerIp !== "string" ? {} : options?.callerIpCasing ? { callerIP: callerIp } : { callerIp }
|
|
421
|
+
};
|
|
422
|
+
if (Object.keys(payload).length === 0) {
|
|
423
|
+
throw new QstashError(
|
|
424
|
+
"No filters provided. Pass { all: true } to explicitly target all messages."
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return payload;
|
|
428
|
+
}
|
|
429
|
+
function normalizeCursor(response) {
|
|
430
|
+
const cursor = response.cursor;
|
|
431
|
+
return { ...response, cursor: cursor || void 0 };
|
|
432
|
+
}
|
|
396
433
|
function getRuntime() {
|
|
397
434
|
if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
|
|
398
435
|
return `bun@${process.versions.bun}`;
|
|
@@ -622,17 +659,20 @@ var DLQ = class {
|
|
|
622
659
|
/**
|
|
623
660
|
* List messages in the dlq
|
|
624
661
|
*/
|
|
625
|
-
async listMessages(options) {
|
|
662
|
+
async listMessages(options = {}) {
|
|
663
|
+
const { urlGroup, ...restFilter } = options.filter ?? {};
|
|
626
664
|
const filterPayload = {
|
|
627
|
-
...
|
|
628
|
-
topicName:
|
|
665
|
+
...restFilter,
|
|
666
|
+
...urlGroup === void 0 ? {} : { topicName: urlGroup }
|
|
629
667
|
};
|
|
630
668
|
const messagesPayload = await this.http.request({
|
|
631
669
|
method: "GET",
|
|
632
670
|
path: ["v2", "dlq"],
|
|
633
671
|
query: {
|
|
634
|
-
cursor: options
|
|
635
|
-
count: options
|
|
672
|
+
cursor: options.cursor,
|
|
673
|
+
count: options.count,
|
|
674
|
+
order: options.order,
|
|
675
|
+
trimBody: options.trimBody,
|
|
636
676
|
...filterPayload
|
|
637
677
|
}
|
|
638
678
|
});
|
|
@@ -648,26 +688,70 @@ var DLQ = class {
|
|
|
648
688
|
};
|
|
649
689
|
}
|
|
650
690
|
/**
|
|
651
|
-
* Remove
|
|
691
|
+
* Remove messages from the dlq.
|
|
692
|
+
*
|
|
693
|
+
* Can be called with:
|
|
694
|
+
* - A single dlqId: `delete("id")`
|
|
695
|
+
* - An array of dlqIds: `delete(["id1", "id2"])`
|
|
696
|
+
* - An object with dlqIds: `delete({ dlqIds: ["id1", "id2"] })`
|
|
697
|
+
* - A filter object: `delete({ url: "https://example.com", label: "label" })`
|
|
698
|
+
* - All messages: `delete({ all: true })`
|
|
699
|
+
*
|
|
700
|
+
* Note: passing an empty array returns `{ deleted: 0 }` without making a request.
|
|
652
701
|
*/
|
|
653
|
-
async delete(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
702
|
+
async delete(request) {
|
|
703
|
+
if (typeof request === "string") {
|
|
704
|
+
await this.http.request({
|
|
705
|
+
method: "DELETE",
|
|
706
|
+
path: ["v2", "dlq", request],
|
|
707
|
+
parseResponseAsJson: false
|
|
708
|
+
});
|
|
709
|
+
return { deleted: 1 };
|
|
710
|
+
}
|
|
711
|
+
if (Array.isArray(request) && request.length === 0)
|
|
712
|
+
return { deleted: 0 };
|
|
713
|
+
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
714
|
+
return normalizeCursor(
|
|
715
|
+
await this.http.request({
|
|
716
|
+
method: "DELETE",
|
|
717
|
+
path: ["v2", "dlq"],
|
|
718
|
+
query: buildBulkActionFilterPayload(filters)
|
|
719
|
+
})
|
|
720
|
+
);
|
|
660
721
|
}
|
|
661
722
|
/**
|
|
662
723
|
* Remove multiple messages from the dlq using their `dlqId`s
|
|
724
|
+
*
|
|
725
|
+
* @deprecated Use `delete` instead
|
|
663
726
|
*/
|
|
664
727
|
async deleteMany(request) {
|
|
665
|
-
return await this.
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
728
|
+
return await this.delete(request);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Retry messages from the dlq.
|
|
732
|
+
*
|
|
733
|
+
* Can be called with:
|
|
734
|
+
* - A single dlqId: `retry("id")`
|
|
735
|
+
* - An array of dlqIds: `retry(["id1", "id2"])`
|
|
736
|
+
* - An object with dlqIds: `retry({ dlqIds: ["id1", "id2"] })`
|
|
737
|
+
* - A filter object: `retry({ url: "https://example.com", label: "label" })`
|
|
738
|
+
* - All messages: `retry({ all: true })`
|
|
739
|
+
*
|
|
740
|
+
* Note: passing an empty array returns `{ responses: [] }` without making a request.
|
|
741
|
+
*/
|
|
742
|
+
async retry(request) {
|
|
743
|
+
if (typeof request === "string")
|
|
744
|
+
request = [request];
|
|
745
|
+
if (Array.isArray(request) && request.length === 0)
|
|
746
|
+
return { responses: [] };
|
|
747
|
+
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
748
|
+
return normalizeCursor(
|
|
749
|
+
await this.http.request({
|
|
750
|
+
method: "POST",
|
|
751
|
+
path: ["v2", "dlq", "retry"],
|
|
752
|
+
query: buildBulkActionFilterPayload(filters)
|
|
753
|
+
})
|
|
754
|
+
);
|
|
671
755
|
}
|
|
672
756
|
};
|
|
673
757
|
|
|
@@ -768,7 +852,15 @@ var HttpClient = class {
|
|
|
768
852
|
const url = new URL([request.baseUrl ?? this.baseUrl, ...request.path].join("/"));
|
|
769
853
|
if (request.query) {
|
|
770
854
|
for (const [key, value] of Object.entries(request.query)) {
|
|
771
|
-
if (value
|
|
855
|
+
if (value === void 0)
|
|
856
|
+
continue;
|
|
857
|
+
if (Array.isArray(value)) {
|
|
858
|
+
for (const item of value) {
|
|
859
|
+
url.searchParams.append(key, item);
|
|
860
|
+
}
|
|
861
|
+
} else if (value instanceof Date) {
|
|
862
|
+
url.searchParams.set(key, value.getTime().toString());
|
|
863
|
+
} else {
|
|
772
864
|
url.searchParams.set(key, value.toString());
|
|
773
865
|
}
|
|
774
866
|
}
|
|
@@ -999,29 +1091,57 @@ var Messages = class {
|
|
|
999
1091
|
return message;
|
|
1000
1092
|
}
|
|
1001
1093
|
/**
|
|
1002
|
-
* Cancel
|
|
1094
|
+
* Cancel messages.
|
|
1095
|
+
*
|
|
1096
|
+
* Can be called with:
|
|
1097
|
+
* - A single messageId: `cancel("id")`
|
|
1098
|
+
* - An array of messageIds: `cancel(["id1", "id2"])`
|
|
1099
|
+
* - A filter object: `cancel({ flowControlKey: "key", label: "label" })`
|
|
1100
|
+
* - All messages: `cancel({ all: true })`
|
|
1003
1101
|
*/
|
|
1004
|
-
async
|
|
1102
|
+
async cancel(request) {
|
|
1103
|
+
if (typeof request === "string") {
|
|
1104
|
+
return await this.http.request({
|
|
1105
|
+
method: "DELETE",
|
|
1106
|
+
path: ["v2", "messages", request]
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
if (Array.isArray(request) && request.length === 0)
|
|
1110
|
+
return { cancelled: 0 };
|
|
1111
|
+
const filters = Array.isArray(request) ? { messageIds: request } : request;
|
|
1005
1112
|
return await this.http.request({
|
|
1113
|
+
method: "DELETE",
|
|
1114
|
+
path: ["v2", "messages"],
|
|
1115
|
+
query: buildBulkActionFilterPayload(filters, { callerIpCasing: true })
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Delete a message.
|
|
1120
|
+
*
|
|
1121
|
+
* @deprecated Use `cancel(messageId: string)` instead
|
|
1122
|
+
*/
|
|
1123
|
+
async delete(messageId) {
|
|
1124
|
+
await this.http.request({
|
|
1006
1125
|
method: "DELETE",
|
|
1007
1126
|
path: ["v2", "messages", messageId],
|
|
1008
1127
|
parseResponseAsJson: false
|
|
1009
1128
|
});
|
|
1010
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Cancel multiple messages by their messageIds.
|
|
1132
|
+
*
|
|
1133
|
+
* @deprecated Use `cancel(messageIds: string[])` instead
|
|
1134
|
+
*/
|
|
1011
1135
|
async deleteMany(messageIds) {
|
|
1012
|
-
const result = await this.
|
|
1013
|
-
method: "DELETE",
|
|
1014
|
-
path: ["v2", "messages"],
|
|
1015
|
-
headers: { "Content-Type": "application/json" },
|
|
1016
|
-
body: JSON.stringify({ messageIds })
|
|
1017
|
-
});
|
|
1136
|
+
const result = await this.cancel(messageIds);
|
|
1018
1137
|
return result.cancelled;
|
|
1019
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Cancel all messages
|
|
1141
|
+
* @deprecated Use `cancel({all: true})` to cancel all
|
|
1142
|
+
*/
|
|
1020
1143
|
async deleteAll() {
|
|
1021
|
-
const result = await this.
|
|
1022
|
-
method: "DELETE",
|
|
1023
|
-
path: ["v2", "messages"]
|
|
1024
|
-
});
|
|
1144
|
+
const result = await this.cancel({ all: true });
|
|
1025
1145
|
return result.cancelled;
|
|
1026
1146
|
}
|
|
1027
1147
|
};
|
|
@@ -2741,7 +2861,7 @@ var Workflow = class {
|
|
|
2741
2861
|
};
|
|
2742
2862
|
|
|
2743
2863
|
// version.ts
|
|
2744
|
-
var VERSION = "v2.9.
|
|
2864
|
+
var VERSION = "v2.9.1-rc.1";
|
|
2745
2865
|
|
|
2746
2866
|
// src/client/client.ts
|
|
2747
2867
|
var Client = class {
|
|
@@ -2936,39 +3056,47 @@ var Client = class {
|
|
|
2936
3056
|
* }
|
|
2937
3057
|
* ```
|
|
2938
3058
|
*/
|
|
2939
|
-
async logs(request) {
|
|
2940
|
-
const
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
3059
|
+
async logs(request = {}) {
|
|
3060
|
+
const {
|
|
3061
|
+
urlGroup,
|
|
3062
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3063
|
+
topicName,
|
|
3064
|
+
fromDate,
|
|
3065
|
+
toDate,
|
|
3066
|
+
callerIp,
|
|
3067
|
+
messageIds,
|
|
3068
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3069
|
+
count: filterCount,
|
|
3070
|
+
...restFilter
|
|
3071
|
+
} = request.filter ?? {};
|
|
3072
|
+
const filterPayload = {
|
|
3073
|
+
...restFilter,
|
|
3074
|
+
topicName: urlGroup ?? topicName,
|
|
3075
|
+
fromDate,
|
|
3076
|
+
toDate,
|
|
3077
|
+
callerIp
|
|
3078
|
+
};
|
|
3079
|
+
let cursorString;
|
|
3080
|
+
if (typeof request.cursor === "number" && request.cursor > 0) {
|
|
3081
|
+
cursorString = request.cursor.toString();
|
|
3082
|
+
} else if (typeof request.cursor === "string" && request.cursor !== "") {
|
|
3083
|
+
cursorString = request.cursor;
|
|
3084
|
+
}
|
|
3085
|
+
const query = {
|
|
3086
|
+
cursor: cursorString,
|
|
3087
|
+
count: request.count ?? filterCount,
|
|
3088
|
+
order: request.order,
|
|
3089
|
+
trimBody: request.trimBody,
|
|
3090
|
+
messageIds,
|
|
3091
|
+
...filterPayload
|
|
3092
|
+
};
|
|
2956
3093
|
const responsePayload = await this.http.request({
|
|
2957
3094
|
path: ["v2", "events"],
|
|
2958
3095
|
method: "GET",
|
|
2959
3096
|
query
|
|
2960
3097
|
});
|
|
2961
|
-
const logs = responsePayload.events.map((event) => {
|
|
2962
|
-
|
|
2963
|
-
...event,
|
|
2964
|
-
urlGroup: event.topicName
|
|
2965
|
-
};
|
|
2966
|
-
});
|
|
2967
|
-
return {
|
|
2968
|
-
cursor: responsePayload.cursor,
|
|
2969
|
-
logs,
|
|
2970
|
-
events: logs
|
|
2971
|
-
};
|
|
3098
|
+
const logs = responsePayload.events.map((event) => ({ ...event, urlGroup: event.topicName }));
|
|
3099
|
+
return { cursor: responsePayload.cursor, logs, events: logs };
|
|
2972
3100
|
}
|
|
2973
3101
|
/**
|
|
2974
3102
|
* @deprecated Will be removed in the next major release. Use the `logs` method instead.
|
package/svelte.mjs
CHANGED