@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
|
@@ -103,7 +103,7 @@ type LogPayload = Omit<Log, "urlGroup"> & {
|
|
|
103
103
|
topicName: string;
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
|
-
* Deprecated. Use the `
|
|
106
|
+
* Deprecated. Use the `LogPayload` type instead.
|
|
107
107
|
*
|
|
108
108
|
* @deprecated
|
|
109
109
|
*/
|
|
@@ -464,7 +464,7 @@ type UpstashRequest = {
|
|
|
464
464
|
* A string to set request's method.
|
|
465
465
|
*/
|
|
466
466
|
method?: HTTPMethods;
|
|
467
|
-
query?: Record<string, string | number | boolean | undefined>;
|
|
467
|
+
query?: Record<string, string | number | boolean | Date | string[] | undefined>;
|
|
468
468
|
/**
|
|
469
469
|
* if enabled, call `res.json()`
|
|
470
470
|
*
|
|
@@ -505,6 +505,81 @@ type RetryConfig = false | {
|
|
|
505
505
|
backoff?: (retryCount: number) => number;
|
|
506
506
|
};
|
|
507
507
|
|
|
508
|
+
type NeverAll<T> = {
|
|
509
|
+
[K in keyof T]?: never;
|
|
510
|
+
};
|
|
511
|
+
type RequireAtLeastOne<T> = {
|
|
512
|
+
[K in keyof T]-?: Required<Pick<T, K>>;
|
|
513
|
+
}[keyof T];
|
|
514
|
+
/**
|
|
515
|
+
* Three-way exclusive union: at-least-one-filter OR `{ all: true }` OR IDs.
|
|
516
|
+
* Exactly one branch can be satisfied at a time.
|
|
517
|
+
*
|
|
518
|
+
* The filter and all branches intentionally omit `NeverAll<Ids>` so that
|
|
519
|
+
* TypeScript's `"key" in request` narrowing correctly isolates the IDs branch.
|
|
520
|
+
* Excess-property checks on object literals still prevent mixing ID keys with filters.
|
|
521
|
+
*/
|
|
522
|
+
type FilterAllOrIds<F extends Record<string, unknown>, Ids extends Record<string, unknown>> = (F & RequireAtLeastOne<F> & {
|
|
523
|
+
all?: never;
|
|
524
|
+
}) | ({
|
|
525
|
+
all: true;
|
|
526
|
+
} & NeverAll<F>) | (Ids & NeverAll<F> & {
|
|
527
|
+
all?: never;
|
|
528
|
+
});
|
|
529
|
+
/** Shared filter fields accepted by every qstash & workflow endpoint. */
|
|
530
|
+
type UniversalFilterFields = {
|
|
531
|
+
/**
|
|
532
|
+
* aslkdjasd
|
|
533
|
+
*/
|
|
534
|
+
fromDate?: Date | number;
|
|
535
|
+
toDate?: Date | number;
|
|
536
|
+
callerIp?: string;
|
|
537
|
+
label?: string;
|
|
538
|
+
flowControlKey?: string;
|
|
539
|
+
};
|
|
540
|
+
/** QStash-specific identity filters (DLQ + message endpoints). */
|
|
541
|
+
type QStashIdentityFields = {
|
|
542
|
+
messageId?: string;
|
|
543
|
+
url?: string;
|
|
544
|
+
urlGroup?: string;
|
|
545
|
+
scheduleId?: string;
|
|
546
|
+
queueName?: string;
|
|
547
|
+
};
|
|
548
|
+
/** DLQ-specific response filter. */
|
|
549
|
+
type DLQResponseFields = {
|
|
550
|
+
responseStatus?: number;
|
|
551
|
+
};
|
|
552
|
+
/** Logs-specific filter fields exclusive to log endpoints. */
|
|
553
|
+
type LogsFilterFields = {
|
|
554
|
+
state?: State;
|
|
555
|
+
messageIds?: string[];
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Doesn't allow a single messageId because this is a bulk action
|
|
559
|
+
*/
|
|
560
|
+
type MessageCancelFilters = FilterAllOrIds<UniversalFilterFields & Omit<QStashIdentityFields, "messageId">, {
|
|
561
|
+
messageIds: string[];
|
|
562
|
+
}>;
|
|
563
|
+
type DLQBulkActionFilters = FilterAllOrIds<UniversalFilterFields & QStashIdentityFields & DLQResponseFields, {
|
|
564
|
+
dlqIds: string | string[];
|
|
565
|
+
}>;
|
|
566
|
+
type DLQListFilters = UniversalFilterFields & QStashIdentityFields & DLQResponseFields;
|
|
567
|
+
type LogsListFilters = UniversalFilterFields & QStashIdentityFields & LogsFilterFields & {
|
|
568
|
+
/**
|
|
569
|
+
* @deprecated use `urlGroup` instead
|
|
570
|
+
*/
|
|
571
|
+
topicName?: string;
|
|
572
|
+
/**
|
|
573
|
+
* @deprecated use `count` option in the root instead of the `filter` object
|
|
574
|
+
*
|
|
575
|
+
* Example:
|
|
576
|
+
* ```ts
|
|
577
|
+
* await client.logs({ count: 50 })
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
count?: number;
|
|
581
|
+
};
|
|
582
|
+
|
|
508
583
|
type Message = {
|
|
509
584
|
/**
|
|
510
585
|
* A unique identifier for this message.
|
|
@@ -627,10 +702,33 @@ declare class Messages {
|
|
|
627
702
|
*/
|
|
628
703
|
get(messageId: string): Promise<Message>;
|
|
629
704
|
/**
|
|
630
|
-
* Cancel
|
|
705
|
+
* Cancel messages.
|
|
706
|
+
*
|
|
707
|
+
* Can be called with:
|
|
708
|
+
* - A single messageId: `cancel("id")`
|
|
709
|
+
* - An array of messageIds: `cancel(["id1", "id2"])`
|
|
710
|
+
* - A filter object: `cancel({ flowControlKey: "key", label: "label" })`
|
|
711
|
+
* - All messages: `cancel({ all: true })`
|
|
712
|
+
*/
|
|
713
|
+
cancel(request: string | string[] | MessageCancelFilters): Promise<{
|
|
714
|
+
cancelled: number;
|
|
715
|
+
}>;
|
|
716
|
+
/**
|
|
717
|
+
* Delete a message.
|
|
718
|
+
*
|
|
719
|
+
* @deprecated Use `cancel(messageId: string)` instead
|
|
631
720
|
*/
|
|
632
721
|
delete(messageId: string): Promise<void>;
|
|
722
|
+
/**
|
|
723
|
+
* Cancel multiple messages by their messageIds.
|
|
724
|
+
*
|
|
725
|
+
* @deprecated Use `cancel(messageIds: string[])` instead
|
|
726
|
+
*/
|
|
633
727
|
deleteMany(messageIds: string[]): Promise<number>;
|
|
728
|
+
/**
|
|
729
|
+
* Cancel all messages
|
|
730
|
+
* @deprecated Use `cancel({all: true})` to cancel all
|
|
731
|
+
*/
|
|
634
732
|
deleteAll(): Promise<number>;
|
|
635
733
|
}
|
|
636
734
|
|
|
@@ -658,52 +756,6 @@ type DlqMessage = Message & {
|
|
|
658
756
|
*/
|
|
659
757
|
responseBodyBase64?: string;
|
|
660
758
|
};
|
|
661
|
-
type DLQFilter = {
|
|
662
|
-
/**
|
|
663
|
-
* Filter DLQ entries by message id
|
|
664
|
-
*/
|
|
665
|
-
messageId?: string;
|
|
666
|
-
/**
|
|
667
|
-
* Filter DLQ entries by url
|
|
668
|
-
*/
|
|
669
|
-
url?: string;
|
|
670
|
-
/**
|
|
671
|
-
* Filter DLQ entries by url group name
|
|
672
|
-
*/
|
|
673
|
-
urlGroup?: string;
|
|
674
|
-
/**
|
|
675
|
-
* Filter DLQ entries by api name
|
|
676
|
-
*/
|
|
677
|
-
api?: string;
|
|
678
|
-
/**
|
|
679
|
-
* Filter DLQ entries by queue name
|
|
680
|
-
*/
|
|
681
|
-
queueName?: string;
|
|
682
|
-
/**
|
|
683
|
-
* Filter DLQ entries by schedule id
|
|
684
|
-
*/
|
|
685
|
-
scheduleId?: string;
|
|
686
|
-
/**
|
|
687
|
-
* Filter DLQ entries by starting time, in milliseconds
|
|
688
|
-
*/
|
|
689
|
-
fromDate?: number;
|
|
690
|
-
/**
|
|
691
|
-
* Filter DLQ entries by ending time, in milliseconds
|
|
692
|
-
*/
|
|
693
|
-
toDate?: number;
|
|
694
|
-
/**
|
|
695
|
-
* Filter DLQ entries by label
|
|
696
|
-
*/
|
|
697
|
-
label?: string;
|
|
698
|
-
/**
|
|
699
|
-
* Filter DLQ entries by HTTP status of the response
|
|
700
|
-
*/
|
|
701
|
-
responseStatus?: number;
|
|
702
|
-
/**
|
|
703
|
-
* Filter DLQ entries by IP address of the publisher of the message
|
|
704
|
-
*/
|
|
705
|
-
callerIp?: string;
|
|
706
|
-
};
|
|
707
759
|
declare class DLQ {
|
|
708
760
|
private readonly http;
|
|
709
761
|
constructor(http: Requester);
|
|
@@ -713,22 +765,58 @@ declare class DLQ {
|
|
|
713
765
|
listMessages(options?: {
|
|
714
766
|
cursor?: string;
|
|
715
767
|
count?: number;
|
|
716
|
-
|
|
768
|
+
/** Defaults to `latestFirst` */
|
|
769
|
+
order?: "earliestFirst" | "latestFirst";
|
|
770
|
+
trimBody?: number;
|
|
771
|
+
filter?: DLQListFilters;
|
|
717
772
|
}): Promise<{
|
|
718
773
|
messages: DlqMessage[];
|
|
719
774
|
cursor?: string;
|
|
720
775
|
}>;
|
|
721
776
|
/**
|
|
722
|
-
* Remove
|
|
777
|
+
* Remove messages from the dlq.
|
|
778
|
+
*
|
|
779
|
+
* Can be called with:
|
|
780
|
+
* - A single dlqId: `delete("id")`
|
|
781
|
+
* - An array of dlqIds: `delete(["id1", "id2"])`
|
|
782
|
+
* - An object with dlqIds: `delete({ dlqIds: ["id1", "id2"] })`
|
|
783
|
+
* - A filter object: `delete({ url: "https://example.com", label: "label" })`
|
|
784
|
+
* - All messages: `delete({ all: true })`
|
|
785
|
+
*
|
|
786
|
+
* Note: passing an empty array returns `{ deleted: 0 }` without making a request.
|
|
723
787
|
*/
|
|
724
|
-
delete(
|
|
788
|
+
delete(request: string | string[] | DLQBulkActionFilters): Promise<{
|
|
789
|
+
deleted: number;
|
|
790
|
+
cursor?: string;
|
|
791
|
+
}>;
|
|
725
792
|
/**
|
|
726
793
|
* Remove multiple messages from the dlq using their `dlqId`s
|
|
794
|
+
*
|
|
795
|
+
* @deprecated Use `delete` instead
|
|
727
796
|
*/
|
|
728
797
|
deleteMany(request: {
|
|
729
798
|
dlqIds: string[];
|
|
730
799
|
}): Promise<{
|
|
731
800
|
deleted: number;
|
|
801
|
+
cursor?: string;
|
|
802
|
+
}>;
|
|
803
|
+
/**
|
|
804
|
+
* Retry messages from the dlq.
|
|
805
|
+
*
|
|
806
|
+
* Can be called with:
|
|
807
|
+
* - A single dlqId: `retry("id")`
|
|
808
|
+
* - An array of dlqIds: `retry(["id1", "id2"])`
|
|
809
|
+
* - An object with dlqIds: `retry({ dlqIds: ["id1", "id2"] })`
|
|
810
|
+
* - A filter object: `retry({ url: "https://example.com", label: "label" })`
|
|
811
|
+
* - All messages: `retry({ all: true })`
|
|
812
|
+
*
|
|
813
|
+
* Note: passing an empty array returns `{ responses: [] }` without making a request.
|
|
814
|
+
*/
|
|
815
|
+
retry(request: string | string[] | DLQBulkActionFilters): Promise<{
|
|
816
|
+
cursor?: string;
|
|
817
|
+
responses: {
|
|
818
|
+
messageId: string;
|
|
819
|
+
}[];
|
|
732
820
|
}>;
|
|
733
821
|
}
|
|
734
822
|
|
|
@@ -2034,7 +2122,12 @@ type PublishJsonRequest = Omit<PublishRequest, "body"> & {
|
|
|
2034
2122
|
};
|
|
2035
2123
|
type LogsRequest = {
|
|
2036
2124
|
cursor?: string | number;
|
|
2037
|
-
|
|
2125
|
+
/** Max 1000. Defaults to 10 when `groupBy` is used. */
|
|
2126
|
+
count?: number;
|
|
2127
|
+
/** Defaults to `latestFirst` */
|
|
2128
|
+
order?: "earliestFirst" | "latestFirst";
|
|
2129
|
+
trimBody?: number;
|
|
2130
|
+
filter?: LogsListFilters;
|
|
2038
2131
|
};
|
|
2039
2132
|
/**
|
|
2040
2133
|
* Deprecated. Use `LogsRequest` instead.
|
|
@@ -2042,20 +2135,6 @@ type LogsRequest = {
|
|
|
2042
2135
|
* @deprecated
|
|
2043
2136
|
*/
|
|
2044
2137
|
type EventsRequest = LogsRequest;
|
|
2045
|
-
type LogsRequestFilter = {
|
|
2046
|
-
messageId?: string;
|
|
2047
|
-
state?: State;
|
|
2048
|
-
url?: string;
|
|
2049
|
-
urlGroup?: string;
|
|
2050
|
-
topicName?: string;
|
|
2051
|
-
api?: string;
|
|
2052
|
-
scheduleId?: string;
|
|
2053
|
-
queueName?: string;
|
|
2054
|
-
fromDate?: number;
|
|
2055
|
-
toDate?: number;
|
|
2056
|
-
count?: number;
|
|
2057
|
-
label?: string;
|
|
2058
|
-
};
|
|
2059
2138
|
type GetLogsResponse = {
|
|
2060
2139
|
cursor?: string;
|
|
2061
2140
|
logs: Log[];
|
|
@@ -2206,4 +2285,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
2206
2285
|
urlGroup: string;
|
|
2207
2286
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
2208
2287
|
|
|
2209
|
-
export { type
|
|
2288
|
+
export { type ChatCompletionChunk as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type LogPayload as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetLogsResponse as G, type HTTPMethods as H, type EventPayload as I, type GetLogsPayload as J, type GetEventsPayload as K, type LLMOwner as L, type Message as M, type BodyInit as N, type HeadersInit as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type RequestOptions as T, type UniversalFilterFields as U, type VerifyRequest as V, type WithCursor as W, type FlowControl as X, Chat as Y, type ChatCompletionMessage as Z, type ChatCompletion as _, type ReceiverConfig as a, type StreamEnabled as a0, type StreamDisabled as a1, type StreamParameter as a2, type OpenAIChatModel as a3, type PromptChatRequest as a4, type ChatRequest as a5, upstash as a6, openai as a7, anthropic as a8, custom as a9, type RouteFunction as aa, type WorkflowServeOptions as ab, Workflow as ac, processOptions as ad, serve as ae, WorkflowContext as af, DisabledWorkflowContext as ag, type WorkflowClient as ah, type WorkflowReceiver as ai, StepTypes as aj, type StepType as ak, type RawStep as al, type SyncStepFunction as am, type AsyncStepFunction as an, type StepFunction as ao, type ParallelCallState as ap, type FinishCondition as aq, type RequiredExceptFields as ar, type LogLevel as as, type WorkflowLoggerOptions as at, WorkflowLogger as au, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type LogsRequest as g, type EventsRequest as h, type GetEventsResponse as i, Client as j, type PublishToApiResponse as k, type PublishToUrlResponse as l, type PublishToUrlGroupsResponse as m, type PublishResponse as n, type MessagePayload as o, Messages as p, type Schedule as q, type CreateScheduleRequest as r, Schedules as s, type Endpoint as t, type RemoveEndpointsRequest as u, type UrlGroup as v, UrlGroups as w, type State as x, type Log as y, type Event as z };
|
package/cloudflare.d.mts
CHANGED
package/cloudflare.d.ts
CHANGED
package/cloudflare.js
CHANGED
|
@@ -392,6 +392,43 @@ 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
|
+
}
|
|
395
432
|
function getRuntime() {
|
|
396
433
|
if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
|
|
397
434
|
return `bun@${process.versions.bun}`;
|
|
@@ -621,17 +658,20 @@ var DLQ = class {
|
|
|
621
658
|
/**
|
|
622
659
|
* List messages in the dlq
|
|
623
660
|
*/
|
|
624
|
-
async listMessages(options) {
|
|
661
|
+
async listMessages(options = {}) {
|
|
662
|
+
const { urlGroup, ...restFilter } = options.filter ?? {};
|
|
625
663
|
const filterPayload = {
|
|
626
|
-
...
|
|
627
|
-
topicName:
|
|
664
|
+
...restFilter,
|
|
665
|
+
...urlGroup === void 0 ? {} : { topicName: urlGroup }
|
|
628
666
|
};
|
|
629
667
|
const messagesPayload = await this.http.request({
|
|
630
668
|
method: "GET",
|
|
631
669
|
path: ["v2", "dlq"],
|
|
632
670
|
query: {
|
|
633
|
-
cursor: options
|
|
634
|
-
count: options
|
|
671
|
+
cursor: options.cursor,
|
|
672
|
+
count: options.count,
|
|
673
|
+
order: options.order,
|
|
674
|
+
trimBody: options.trimBody,
|
|
635
675
|
...filterPayload
|
|
636
676
|
}
|
|
637
677
|
});
|
|
@@ -647,26 +687,70 @@ var DLQ = class {
|
|
|
647
687
|
};
|
|
648
688
|
}
|
|
649
689
|
/**
|
|
650
|
-
* Remove
|
|
690
|
+
* Remove messages from the dlq.
|
|
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.
|
|
651
700
|
*/
|
|
652
|
-
async delete(
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
701
|
+
async delete(request) {
|
|
702
|
+
if (typeof request === "string") {
|
|
703
|
+
await this.http.request({
|
|
704
|
+
method: "DELETE",
|
|
705
|
+
path: ["v2", "dlq", request],
|
|
706
|
+
parseResponseAsJson: false
|
|
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
|
+
);
|
|
659
720
|
}
|
|
660
721
|
/**
|
|
661
722
|
* Remove multiple messages from the dlq using their `dlqId`s
|
|
723
|
+
*
|
|
724
|
+
* @deprecated Use `delete` instead
|
|
662
725
|
*/
|
|
663
726
|
async deleteMany(request) {
|
|
664
|
-
return await this.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
727
|
+
return await this.delete(request);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Retry messages from the dlq.
|
|
731
|
+
*
|
|
732
|
+
* Can be called with:
|
|
733
|
+
* - A single dlqId: `retry("id")`
|
|
734
|
+
* - An array of dlqIds: `retry(["id1", "id2"])`
|
|
735
|
+
* - An object with dlqIds: `retry({ dlqIds: ["id1", "id2"] })`
|
|
736
|
+
* - A filter object: `retry({ url: "https://example.com", label: "label" })`
|
|
737
|
+
* - All messages: `retry({ all: true })`
|
|
738
|
+
*
|
|
739
|
+
* Note: passing an empty array returns `{ responses: [] }` without making a request.
|
|
740
|
+
*/
|
|
741
|
+
async retry(request) {
|
|
742
|
+
if (typeof request === "string")
|
|
743
|
+
request = [request];
|
|
744
|
+
if (Array.isArray(request) && request.length === 0)
|
|
745
|
+
return { responses: [] };
|
|
746
|
+
const filters = Array.isArray(request) ? { dlqIds: request } : request;
|
|
747
|
+
return normalizeCursor(
|
|
748
|
+
await this.http.request({
|
|
749
|
+
method: "POST",
|
|
750
|
+
path: ["v2", "dlq", "retry"],
|
|
751
|
+
query: buildBulkActionFilterPayload(filters)
|
|
752
|
+
})
|
|
753
|
+
);
|
|
670
754
|
}
|
|
671
755
|
};
|
|
672
756
|
|
|
@@ -767,7 +851,15 @@ var HttpClient = class {
|
|
|
767
851
|
const url = new URL([request.baseUrl ?? this.baseUrl, ...request.path].join("/"));
|
|
768
852
|
if (request.query) {
|
|
769
853
|
for (const [key, value] of Object.entries(request.query)) {
|
|
770
|
-
if (value
|
|
854
|
+
if (value === void 0)
|
|
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 {
|
|
771
863
|
url.searchParams.set(key, value.toString());
|
|
772
864
|
}
|
|
773
865
|
}
|
|
@@ -998,29 +1090,57 @@ var Messages = class {
|
|
|
998
1090
|
return message;
|
|
999
1091
|
}
|
|
1000
1092
|
/**
|
|
1001
|
-
* Cancel
|
|
1093
|
+
* Cancel messages.
|
|
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 })`
|
|
1002
1100
|
*/
|
|
1003
|
-
async
|
|
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;
|
|
1004
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
|
|
1121
|
+
*/
|
|
1122
|
+
async delete(messageId) {
|
|
1123
|
+
await this.http.request({
|
|
1005
1124
|
method: "DELETE",
|
|
1006
1125
|
path: ["v2", "messages", messageId],
|
|
1007
1126
|
parseResponseAsJson: false
|
|
1008
1127
|
});
|
|
1009
1128
|
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Cancel multiple messages by their messageIds.
|
|
1131
|
+
*
|
|
1132
|
+
* @deprecated Use `cancel(messageIds: string[])` instead
|
|
1133
|
+
*/
|
|
1010
1134
|
async deleteMany(messageIds) {
|
|
1011
|
-
const result = await this.
|
|
1012
|
-
method: "DELETE",
|
|
1013
|
-
path: ["v2", "messages"],
|
|
1014
|
-
headers: { "Content-Type": "application/json" },
|
|
1015
|
-
body: JSON.stringify({ messageIds })
|
|
1016
|
-
});
|
|
1135
|
+
const result = await this.cancel(messageIds);
|
|
1017
1136
|
return result.cancelled;
|
|
1018
1137
|
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Cancel all messages
|
|
1140
|
+
* @deprecated Use `cancel({all: true})` to cancel all
|
|
1141
|
+
*/
|
|
1019
1142
|
async deleteAll() {
|
|
1020
|
-
const result = await this.
|
|
1021
|
-
method: "DELETE",
|
|
1022
|
-
path: ["v2", "messages"]
|
|
1023
|
-
});
|
|
1143
|
+
const result = await this.cancel({ all: true });
|
|
1024
1144
|
return result.cancelled;
|
|
1025
1145
|
}
|
|
1026
1146
|
};
|
|
@@ -1354,7 +1474,7 @@ var UrlGroups = class {
|
|
|
1354
1474
|
};
|
|
1355
1475
|
|
|
1356
1476
|
// version.ts
|
|
1357
|
-
var VERSION = "v2.9.
|
|
1477
|
+
var VERSION = "v2.9.1-rc.1";
|
|
1358
1478
|
|
|
1359
1479
|
// src/client/client.ts
|
|
1360
1480
|
var Client = class {
|
|
@@ -1549,39 +1669,47 @@ var Client = class {
|
|
|
1549
1669
|
* }
|
|
1550
1670
|
* ```
|
|
1551
1671
|
*/
|
|
1552
|
-
async logs(request) {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1672
|
+
async logs(request = {}) {
|
|
1673
|
+
const {
|
|
1674
|
+
urlGroup,
|
|
1675
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1676
|
+
topicName,
|
|
1677
|
+
fromDate,
|
|
1678
|
+
toDate,
|
|
1679
|
+
callerIp,
|
|
1680
|
+
messageIds,
|
|
1681
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1682
|
+
count: filterCount,
|
|
1683
|
+
...restFilter
|
|
1684
|
+
} = request.filter ?? {};
|
|
1685
|
+
const filterPayload = {
|
|
1686
|
+
...restFilter,
|
|
1687
|
+
topicName: urlGroup ?? topicName,
|
|
1688
|
+
fromDate,
|
|
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
|
+
};
|
|
1569
1706
|
const responsePayload = await this.http.request({
|
|
1570
1707
|
path: ["v2", "events"],
|
|
1571
1708
|
method: "GET",
|
|
1572
1709
|
query
|
|
1573
1710
|
});
|
|
1574
|
-
const logs = responsePayload.events.map((event) => {
|
|
1575
|
-
|
|
1576
|
-
...event,
|
|
1577
|
-
urlGroup: event.topicName
|
|
1578
|
-
};
|
|
1579
|
-
});
|
|
1580
|
-
return {
|
|
1581
|
-
cursor: responsePayload.cursor,
|
|
1582
|
-
logs,
|
|
1583
|
-
events: logs
|
|
1584
|
-
};
|
|
1711
|
+
const logs = responsePayload.events.map((event) => ({ ...event, urlGroup: event.topicName }));
|
|
1712
|
+
return { cursor: responsePayload.cursor, logs, events: logs };
|
|
1585
1713
|
}
|
|
1586
1714
|
/**
|
|
1587
1715
|
* @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 { aa as RouteFunction, ab as WorkflowServeOptions } from './client-Gv4WRTxB.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 { aa as RouteFunction, ab as WorkflowServeOptions } from './client-Gv4WRTxB.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|