@upstash/qstash 2.7.22 → 2.7.23

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 CHANGED
@@ -131,6 +131,25 @@ const result = await client.publishJSON({
131
131
 
132
132
  See [the documentation](https://docs.upstash.com/qstash) for details.
133
133
 
134
+ ## Telemetry
135
+
136
+ This sdk sends anonymous telemetry headers to help us improve your experience.
137
+ We collect the following:
138
+
139
+ - SDK version
140
+ - Platform (Cloudflare, AWS or Vercel)
141
+ - Runtime version (node@18.x)
142
+
143
+ You can opt out by setting the `UPSTASH_DISABLE_TELEMETRY` environment variable
144
+ to any truthy value. Or setting `enableTelemetry: false` in the client options.
145
+
146
+ ```ts
147
+ const client = new Client({
148
+ token: "<QSTASH_TOKEN>",
149
+ enableTelemetry: false,
150
+ });
151
+ ```
152
+
134
153
  ## Contributing
135
154
 
136
155
  ### Setup
@@ -203,6 +203,7 @@ var HttpClient = class {
203
203
  options;
204
204
  retry;
205
205
  headers;
206
+ telemetryHeaders;
206
207
  constructor(config) {
207
208
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
208
209
  this.authorization = config.authorization;
@@ -215,6 +216,7 @@ var HttpClient = class {
215
216
  backoff: config.retry?.backoff ?? ((retryCount) => Math.exp(retryCount) * 50)
216
217
  };
217
218
  this.headers = config.headers;
219
+ this.telemetryHeaders = config.telemetryHeaders;
218
220
  }
219
221
  async request(request) {
220
222
  const { response } = await this.requestWithBackoff(request);
@@ -729,7 +731,7 @@ function prefixHeaders(headers) {
729
731
  }
730
732
  return headers;
731
733
  }
732
- function wrapWithGlobalHeaders(headers, globalHeaders) {
734
+ function wrapWithGlobalHeaders(headers, globalHeaders, telemetryHeaders) {
733
735
  if (!globalHeaders) {
734
736
  return headers;
735
737
  }
@@ -737,6 +739,11 @@ function wrapWithGlobalHeaders(headers, globalHeaders) {
737
739
  headers.forEach((value, key) => {
738
740
  finalHeaders.set(key, value);
739
741
  });
742
+ telemetryHeaders?.forEach((value, key) => {
743
+ if (!value)
744
+ return;
745
+ finalHeaders.append(key, value);
746
+ });
740
747
  return finalHeaders;
741
748
  }
742
749
  function processHeaders(request) {
@@ -826,6 +833,15 @@ function decodeBase64(base64) {
826
833
  }
827
834
  }
828
835
  }
836
+ function getRuntime() {
837
+ if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
838
+ return `bun@${process.versions.bun}`;
839
+ if (typeof EdgeRuntime === "string")
840
+ return "edge-light";
841
+ else if (typeof process === "object" && typeof process.version === "string")
842
+ return `node@${process.version}`;
843
+ return "";
844
+ }
829
845
 
830
846
  // src/client/queue.ts
831
847
  var Queue = class {
@@ -900,7 +916,8 @@ var Queue = class {
900
916
  }
901
917
  const headers = wrapWithGlobalHeaders(
902
918
  processHeaders(request),
903
- this.http.headers
919
+ this.http.headers,
920
+ this.http.telemetryHeaders
904
921
  );
905
922
  const destination = getRequestPath(request);
906
923
  const response = await this.http.request({
@@ -1020,7 +1037,7 @@ var Schedules = class {
1020
1037
  }
1021
1038
  return await this.http.request({
1022
1039
  method: "POST",
1023
- headers: wrapWithGlobalHeaders(headers, this.http.headers),
1040
+ headers: wrapWithGlobalHeaders(headers, this.http.headers, this.http.telemetryHeaders),
1024
1041
  path: ["v2", "schedules", request.destination],
1025
1042
  body: request.body
1026
1043
  });
@@ -1146,20 +1163,37 @@ var UrlGroups = class {
1146
1163
  }
1147
1164
  };
1148
1165
 
1166
+ // version.ts
1167
+ var VERSION = "v2.7.23";
1168
+
1149
1169
  // src/client/client.ts
1150
1170
  var Client = class {
1151
1171
  http;
1152
1172
  token;
1153
1173
  constructor(config) {
1154
1174
  const environment = typeof process === "undefined" ? {} : process.env;
1155
- const baseUrl = config?.baseUrl ? config.baseUrl.replace(/\/$/, "") : environment.QSTASH_URL ?? "https://qstash.upstash.io";
1175
+ let baseUrl = (config?.baseUrl ?? environment.QSTASH_URL ?? "https://qstash.upstash.io").replace(/\/$/, "");
1176
+ if (baseUrl === "https://qstash.upstash.io/v2/publish") {
1177
+ baseUrl = "https://qstash.upstash.io";
1178
+ }
1156
1179
  const token = config?.token ?? environment.QSTASH_TOKEN;
1180
+ const enableTelemetry = environment.UPSTASH_DISABLE_TELEMETRY ? false : config?.enableTelemetry ?? true;
1181
+ const isCloudflare = typeof caches !== "undefined" && "default" in caches;
1182
+ const telemetryHeaders = new Headers(
1183
+ enableTelemetry ? {
1184
+ "Upstash-Telemetry-Sdk": `upstash-qstash-js@${VERSION}`,
1185
+ "Upstash-Telemetry-Platform": isCloudflare ? "cloudflare" : environment.VERCEL ? "vercel" : environment.AWS_REGION ? "aws" : "",
1186
+ "Upstash-Telemetry-Runtime": getRuntime()
1187
+ } : {}
1188
+ );
1157
1189
  this.http = new HttpClient({
1158
1190
  retry: config?.retry,
1159
1191
  baseUrl,
1160
1192
  authorization: `Bearer ${token}`,
1161
1193
  //@ts-expect-error caused by undici and bunjs type overlap
1162
- headers: prefixHeaders(new Headers(config?.headers ?? {}))
1194
+ headers: prefixHeaders(new Headers(config?.headers ?? {})),
1195
+ //@ts-expect-error caused by undici and bunjs type overlap
1196
+ telemetryHeaders
1163
1197
  });
1164
1198
  if (!token) {
1165
1199
  console.warn(
@@ -1241,7 +1275,8 @@ var Client = class {
1241
1275
  async publish(request) {
1242
1276
  const headers = wrapWithGlobalHeaders(
1243
1277
  processHeaders(request),
1244
- this.http.headers
1278
+ this.http.headers,
1279
+ this.http.telemetryHeaders
1245
1280
  );
1246
1281
  const response = await this.http.request({
1247
1282
  path: ["v2", "publish", getRequestPath(request)],
@@ -1272,7 +1307,11 @@ var Client = class {
1272
1307
  async batch(request) {
1273
1308
  const messages = [];
1274
1309
  for (const message of request) {
1275
- const headers = wrapWithGlobalHeaders(processHeaders(message), this.http.headers);
1310
+ const headers = wrapWithGlobalHeaders(
1311
+ processHeaders(message),
1312
+ this.http.headers,
1313
+ this.http.telemetryHeaders
1314
+ );
1276
1315
  const headerEntries = Object.fromEntries(headers.entries());
1277
1316
  messages.push({
1278
1317
  destination: getRequestPath(message),
@@ -1327,7 +1366,7 @@ var Client = class {
1327
1366
  * }
1328
1367
  * ```
1329
1368
  */
1330
- async events(request) {
1369
+ async logs(request) {
1331
1370
  const query = {};
1332
1371
  if (typeof request?.cursor === "number" && request.cursor > 0) {
1333
1372
  query.cursor = request.cursor.toString();
@@ -1349,16 +1388,42 @@ var Client = class {
1349
1388
  method: "GET",
1350
1389
  query
1351
1390
  });
1391
+ const logs = responsePayload.events.map((event) => {
1392
+ return {
1393
+ ...event,
1394
+ urlGroup: event.topicName
1395
+ };
1396
+ });
1352
1397
  return {
1353
1398
  cursor: responsePayload.cursor,
1354
- events: responsePayload.events.map((event) => {
1355
- return {
1356
- ...event,
1357
- urlGroup: event.topicName
1358
- };
1359
- })
1399
+ logs,
1400
+ events: logs
1360
1401
  };
1361
1402
  }
1403
+ /**
1404
+ * @deprecated Will be removed in the next major release. Use the `logs` method instead.
1405
+ *
1406
+ * Retrieve your logs.
1407
+ *
1408
+ * The logs endpoint is paginated and returns only 100 logs at a time.
1409
+ * If you want to receive more logs, you can use the cursor to paginate.
1410
+ *
1411
+ * The cursor is a unix timestamp with millisecond precision
1412
+ *
1413
+ * @example
1414
+ * ```ts
1415
+ * let cursor = Date.now()
1416
+ * const logs: Log[] = []
1417
+ * while (cursor > 0) {
1418
+ * const res = await qstash.logs({ cursor })
1419
+ * logs.push(...res.logs)
1420
+ * cursor = res.cursor ?? 0
1421
+ * }
1422
+ * ```
1423
+ */
1424
+ async events(request) {
1425
+ return await this.logs(request);
1426
+ }
1362
1427
  };
1363
1428
 
1364
1429
  // src/client/workflow/constants.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-MQSZDXFZ.mjs";
4
+ } from "./chunk-G7CVCBTL.mjs";
5
5
 
6
6
  // node_modules/defu/dist/defu.mjs
7
7
  function isPlainObject(value) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseProvider
3
- } from "./chunk-MQSZDXFZ.mjs";
3
+ } from "./chunk-G7CVCBTL.mjs";
4
4
 
5
5
  // src/client/api/email.ts
6
6
  var EmailProvider = class extends BaseProvider {
@@ -64,7 +64,7 @@ declare class Receiver {
64
64
 
65
65
  type State = "CREATED" | "ACTIVE" | "DELIVERED" | "ERROR" | "RETRY" | "FAILED";
66
66
  type HTTPMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
67
- type Event = {
67
+ type Log = {
68
68
  time: number;
69
69
  state: State;
70
70
  messageId: string;
@@ -77,13 +77,31 @@ type Event = {
77
77
  header?: Record<string, string>;
78
78
  body?: string;
79
79
  };
80
- type EventPayload = Omit<Event, "urlGroup"> & {
80
+ /**
81
+ * Deprecated. Use the `Log` type instead.
82
+ *
83
+ * @deprecated
84
+ */
85
+ type Event = Log;
86
+ type LogPayload = Omit<Log, "urlGroup"> & {
81
87
  topicName: string;
82
88
  };
83
- type GetEventsPayload = {
89
+ /**
90
+ * Deprecated. Use the `EventPayload` type instead.
91
+ *
92
+ * @deprecated
93
+ */
94
+ type EventPayload = LogPayload;
95
+ type GetLogsPayload = {
84
96
  cursor?: string;
85
- events: EventPayload[];
97
+ events: LogPayload[];
86
98
  };
99
+ /**
100
+ * Deprecated. use the `GetLogsPayload` type instead.
101
+ *
102
+ * @deprecated
103
+ */
104
+ type GetEventsPayload = GetLogsPayload;
87
105
  type WithCursor<T> = T & {
88
106
  cursor?: number;
89
107
  };
@@ -387,6 +405,7 @@ type Requester = {
387
405
  request: <TResult = unknown>(request: UpstashRequest) => Promise<UpstashResponse<TResult>>;
388
406
  requestStream: (request: UpstashRequest) => AsyncIterable<ChatCompletionChunk>;
389
407
  headers?: Headers;
408
+ telemetryHeaders?: Headers;
390
409
  };
391
410
  type RetryConfig = false | {
392
411
  /**
@@ -1631,6 +1650,13 @@ type ClientConfig = {
1631
1650
  * These can be overridden by the headers in the request.
1632
1651
  */
1633
1652
  headers?: HeadersInit;
1653
+ /**
1654
+ * Enable telemetry to help us improve the SDK.
1655
+ * The sdk will send the sdk version, platform and node version as telemetry headers.
1656
+ *
1657
+ * @default true
1658
+ */
1659
+ enableTelemetry?: boolean;
1634
1660
  };
1635
1661
  type PublishBatchRequest<TBody = BodyInit> = PublishRequest<TBody> & {
1636
1662
  queueName?: string;
@@ -1821,11 +1847,17 @@ type PublishJsonRequest = Omit<PublishRequest, "body"> & {
1821
1847
  */
1822
1848
  body: unknown;
1823
1849
  };
1824
- type EventsRequest = {
1850
+ type LogsRequest = {
1825
1851
  cursor?: string | number;
1826
- filter?: EventsRequestFilter;
1852
+ filter?: LogsRequestFilter;
1827
1853
  };
1828
- type EventsRequestFilter = {
1854
+ /**
1855
+ * Deprecated. Use `LogsRequest` instead.
1856
+ *
1857
+ * @deprecated
1858
+ */
1859
+ type EventsRequest = LogsRequest;
1860
+ type LogsRequestFilter = {
1829
1861
  messageId?: string;
1830
1862
  state?: State;
1831
1863
  url?: string;
@@ -1838,10 +1870,22 @@ type EventsRequestFilter = {
1838
1870
  toDate?: number;
1839
1871
  count?: number;
1840
1872
  };
1841
- type GetEventsResponse = {
1873
+ type GetLogsResponse = {
1842
1874
  cursor?: string;
1843
- events: Event[];
1875
+ logs: Log[];
1876
+ /**
1877
+ * Deprecated. Use the `logs` field instead.
1878
+ *
1879
+ * @deprecated
1880
+ */
1881
+ events: Log[];
1844
1882
  };
1883
+ /**
1884
+ * Deprecated. Use `GetLogsResponse` instead.
1885
+ *
1886
+ * @deprecated
1887
+ */
1888
+ type GetEventsResponse = GetLogsResponse;
1845
1889
  type QueueRequest = {
1846
1890
  queueName?: string;
1847
1891
  };
@@ -1936,7 +1980,29 @@ declare class Client {
1936
1980
  * }
1937
1981
  * ```
1938
1982
  */
1939
- events(request?: EventsRequest): Promise<GetEventsResponse>;
1983
+ logs(request?: LogsRequest): Promise<GetLogsResponse>;
1984
+ /**
1985
+ * @deprecated Will be removed in the next major release. Use the `logs` method instead.
1986
+ *
1987
+ * Retrieve your logs.
1988
+ *
1989
+ * The logs endpoint is paginated and returns only 100 logs at a time.
1990
+ * If you want to receive more logs, you can use the cursor to paginate.
1991
+ *
1992
+ * The cursor is a unix timestamp with millisecond precision
1993
+ *
1994
+ * @example
1995
+ * ```ts
1996
+ * let cursor = Date.now()
1997
+ * const logs: Log[] = []
1998
+ * while (cursor > 0) {
1999
+ * const res = await qstash.logs({ cursor })
2000
+ * logs.push(...res.logs)
2001
+ * cursor = res.cursor ?? 0
2002
+ * }
2003
+ * ```
2004
+ */
2005
+ events(request?: LogsRequest): Promise<GetLogsResponse>;
1940
2006
  }
1941
2007
  type PublishToApiResponse = {
1942
2008
  messageId: string;
@@ -1952,4 +2018,4 @@ type PublishResponse<TRequest> = TRequest extends {
1952
2018
  urlGroup: string;
1953
2019
  } ? PublishToUrlGroupsResponse : PublishToApiResponse;
1954
2020
 
1955
- export { type ChatRequest as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type RequestOptions as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type FlowControl as I, Chat as J, type ChatCompletionMessage as K, type LLMOwner as L, type Message as M, type ChatCompletion as N, type ChatCompletionChunk as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type StreamEnabled as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, type StreamDisabled as X, type StreamParameter as Y, type OpenAIChatModel as Z, type PromptChatRequest as _, type ReceiverConfig as a, upstash as a0, openai as a1, anthropic as a2, custom as a3, type RouteFunction as a4, type WorkflowServeOptions as a5, Workflow as a6, processOptions as a7, serve as a8, WorkflowContext as a9, DisabledWorkflowContext as aa, type WorkflowClient as ab, type WorkflowReceiver as ac, StepTypes as ad, type StepType as ae, type RawStep as af, type SyncStepFunction as ag, type AsyncStepFunction as ah, type StepFunction as ai, type ParallelCallState as aj, type FinishCondition as ak, type RequiredExceptFields as al, type LogLevel as am, type WorkflowLoggerOptions as an, WorkflowLogger as ao, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type EventsRequest as g, Client as h, type PublishToApiResponse as i, type PublishToUrlResponse as j, type PublishToUrlGroupsResponse as k, type PublishResponse as l, type MessagePayload as m, Messages as n, type Schedule as o, type CreateScheduleRequest as p, Schedules as q, type Endpoint as r, type RemoveEndpointsRequest as s, UrlGroups as t, type State as u, type Event as v, type EventPayload as w, type GetEventsPayload as x, type BodyInit as y, type HeadersInit as z };
2021
+ export { type StreamEnabled as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type EventPayload as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetLogsResponse as G, type HTTPMethods as H, type GetLogsPayload as I, type GetEventsPayload as J, type BodyInit as K, type LLMOwner as L, type Message as M, type HeadersInit as N, type RequestOptions as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type FlowControl as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, Chat as X, type ChatCompletionMessage as Y, type ChatCompletion as Z, type ChatCompletionChunk as _, type ReceiverConfig as a, type StreamDisabled as a0, type StreamParameter as a1, type OpenAIChatModel as a2, type PromptChatRequest as a3, type ChatRequest as a4, upstash as a5, openai as a6, anthropic as a7, custom as a8, type RouteFunction as a9, type WorkflowServeOptions as aa, Workflow as ab, processOptions as ac, serve as ad, WorkflowContext as ae, DisabledWorkflowContext as af, type WorkflowClient as ag, type WorkflowReceiver as ah, StepTypes as ai, type StepType as aj, type RawStep as ak, type SyncStepFunction as al, type AsyncStepFunction as am, type StepFunction as an, type ParallelCallState as ao, type FinishCondition as ap, type RequiredExceptFields as aq, type LogLevel as ar, type WorkflowLoggerOptions as as, WorkflowLogger as at, 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, UrlGroups as v, type State as w, type Log as x, type Event as y, type LogPayload as z };
@@ -64,7 +64,7 @@ declare class Receiver {
64
64
 
65
65
  type State = "CREATED" | "ACTIVE" | "DELIVERED" | "ERROR" | "RETRY" | "FAILED";
66
66
  type HTTPMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
67
- type Event = {
67
+ type Log = {
68
68
  time: number;
69
69
  state: State;
70
70
  messageId: string;
@@ -77,13 +77,31 @@ type Event = {
77
77
  header?: Record<string, string>;
78
78
  body?: string;
79
79
  };
80
- type EventPayload = Omit<Event, "urlGroup"> & {
80
+ /**
81
+ * Deprecated. Use the `Log` type instead.
82
+ *
83
+ * @deprecated
84
+ */
85
+ type Event = Log;
86
+ type LogPayload = Omit<Log, "urlGroup"> & {
81
87
  topicName: string;
82
88
  };
83
- type GetEventsPayload = {
89
+ /**
90
+ * Deprecated. Use the `EventPayload` type instead.
91
+ *
92
+ * @deprecated
93
+ */
94
+ type EventPayload = LogPayload;
95
+ type GetLogsPayload = {
84
96
  cursor?: string;
85
- events: EventPayload[];
97
+ events: LogPayload[];
86
98
  };
99
+ /**
100
+ * Deprecated. use the `GetLogsPayload` type instead.
101
+ *
102
+ * @deprecated
103
+ */
104
+ type GetEventsPayload = GetLogsPayload;
87
105
  type WithCursor<T> = T & {
88
106
  cursor?: number;
89
107
  };
@@ -387,6 +405,7 @@ type Requester = {
387
405
  request: <TResult = unknown>(request: UpstashRequest) => Promise<UpstashResponse<TResult>>;
388
406
  requestStream: (request: UpstashRequest) => AsyncIterable<ChatCompletionChunk>;
389
407
  headers?: Headers;
408
+ telemetryHeaders?: Headers;
390
409
  };
391
410
  type RetryConfig = false | {
392
411
  /**
@@ -1631,6 +1650,13 @@ type ClientConfig = {
1631
1650
  * These can be overridden by the headers in the request.
1632
1651
  */
1633
1652
  headers?: HeadersInit;
1653
+ /**
1654
+ * Enable telemetry to help us improve the SDK.
1655
+ * The sdk will send the sdk version, platform and node version as telemetry headers.
1656
+ *
1657
+ * @default true
1658
+ */
1659
+ enableTelemetry?: boolean;
1634
1660
  };
1635
1661
  type PublishBatchRequest<TBody = BodyInit> = PublishRequest<TBody> & {
1636
1662
  queueName?: string;
@@ -1821,11 +1847,17 @@ type PublishJsonRequest = Omit<PublishRequest, "body"> & {
1821
1847
  */
1822
1848
  body: unknown;
1823
1849
  };
1824
- type EventsRequest = {
1850
+ type LogsRequest = {
1825
1851
  cursor?: string | number;
1826
- filter?: EventsRequestFilter;
1852
+ filter?: LogsRequestFilter;
1827
1853
  };
1828
- type EventsRequestFilter = {
1854
+ /**
1855
+ * Deprecated. Use `LogsRequest` instead.
1856
+ *
1857
+ * @deprecated
1858
+ */
1859
+ type EventsRequest = LogsRequest;
1860
+ type LogsRequestFilter = {
1829
1861
  messageId?: string;
1830
1862
  state?: State;
1831
1863
  url?: string;
@@ -1838,10 +1870,22 @@ type EventsRequestFilter = {
1838
1870
  toDate?: number;
1839
1871
  count?: number;
1840
1872
  };
1841
- type GetEventsResponse = {
1873
+ type GetLogsResponse = {
1842
1874
  cursor?: string;
1843
- events: Event[];
1875
+ logs: Log[];
1876
+ /**
1877
+ * Deprecated. Use the `logs` field instead.
1878
+ *
1879
+ * @deprecated
1880
+ */
1881
+ events: Log[];
1844
1882
  };
1883
+ /**
1884
+ * Deprecated. Use `GetLogsResponse` instead.
1885
+ *
1886
+ * @deprecated
1887
+ */
1888
+ type GetEventsResponse = GetLogsResponse;
1845
1889
  type QueueRequest = {
1846
1890
  queueName?: string;
1847
1891
  };
@@ -1936,7 +1980,29 @@ declare class Client {
1936
1980
  * }
1937
1981
  * ```
1938
1982
  */
1939
- events(request?: EventsRequest): Promise<GetEventsResponse>;
1983
+ logs(request?: LogsRequest): Promise<GetLogsResponse>;
1984
+ /**
1985
+ * @deprecated Will be removed in the next major release. Use the `logs` method instead.
1986
+ *
1987
+ * Retrieve your logs.
1988
+ *
1989
+ * The logs endpoint is paginated and returns only 100 logs at a time.
1990
+ * If you want to receive more logs, you can use the cursor to paginate.
1991
+ *
1992
+ * The cursor is a unix timestamp with millisecond precision
1993
+ *
1994
+ * @example
1995
+ * ```ts
1996
+ * let cursor = Date.now()
1997
+ * const logs: Log[] = []
1998
+ * while (cursor > 0) {
1999
+ * const res = await qstash.logs({ cursor })
2000
+ * logs.push(...res.logs)
2001
+ * cursor = res.cursor ?? 0
2002
+ * }
2003
+ * ```
2004
+ */
2005
+ events(request?: LogsRequest): Promise<GetLogsResponse>;
1940
2006
  }
1941
2007
  type PublishToApiResponse = {
1942
2008
  messageId: string;
@@ -1952,4 +2018,4 @@ type PublishResponse<TRequest> = TRequest extends {
1952
2018
  urlGroup: string;
1953
2019
  } ? PublishToUrlGroupsResponse : PublishToApiResponse;
1954
2020
 
1955
- export { type ChatRequest as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type RequestOptions as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type FlowControl as I, Chat as J, type ChatCompletionMessage as K, type LLMOwner as L, type Message as M, type ChatCompletion as N, type ChatCompletionChunk as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type StreamEnabled as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, type StreamDisabled as X, type StreamParameter as Y, type OpenAIChatModel as Z, type PromptChatRequest as _, type ReceiverConfig as a, upstash as a0, openai as a1, anthropic as a2, custom as a3, type RouteFunction as a4, type WorkflowServeOptions as a5, Workflow as a6, processOptions as a7, serve as a8, WorkflowContext as a9, DisabledWorkflowContext as aa, type WorkflowClient as ab, type WorkflowReceiver as ac, StepTypes as ad, type StepType as ae, type RawStep as af, type SyncStepFunction as ag, type AsyncStepFunction as ah, type StepFunction as ai, type ParallelCallState as aj, type FinishCondition as ak, type RequiredExceptFields as al, type LogLevel as am, type WorkflowLoggerOptions as an, WorkflowLogger as ao, SignatureError as b, Receiver as c, type PublishBatchRequest as d, type PublishRequest as e, type PublishJsonRequest as f, type EventsRequest as g, Client as h, type PublishToApiResponse as i, type PublishToUrlResponse as j, type PublishToUrlGroupsResponse as k, type PublishResponse as l, type MessagePayload as m, Messages as n, type Schedule as o, type CreateScheduleRequest as p, Schedules as q, type Endpoint as r, type RemoveEndpointsRequest as s, UrlGroups as t, type State as u, type Event as v, type EventPayload as w, type GetEventsPayload as x, type BodyInit as y, type HeadersInit as z };
2021
+ export { type StreamEnabled as $, type AddEndpointsRequest as A, BaseProvider as B, type ChatRateLimit as C, type EventPayload as D, type EmailOwner as E, type FailureFunctionPayload as F, type GetLogsResponse as G, type HTTPMethods as H, type GetLogsPayload as I, type GetEventsPayload as J, type BodyInit as K, type LLMOwner as L, type Message as M, type HeadersInit as N, type RequestOptions as O, type ProviderInfo as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type FlowControl as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, Chat as X, type ChatCompletionMessage as Y, type ChatCompletion as Z, type ChatCompletionChunk as _, type ReceiverConfig as a, type StreamDisabled as a0, type StreamParameter as a1, type OpenAIChatModel as a2, type PromptChatRequest as a3, type ChatRequest as a4, upstash as a5, openai as a6, anthropic as a7, custom as a8, type RouteFunction as a9, type WorkflowServeOptions as aa, Workflow as ab, processOptions as ac, serve as ad, WorkflowContext as ae, DisabledWorkflowContext as af, type WorkflowClient as ag, type WorkflowReceiver as ah, StepTypes as ai, type StepType as aj, type RawStep as ak, type SyncStepFunction as al, type AsyncStepFunction as am, type StepFunction as an, type ParallelCallState as ao, type FinishCondition as ap, type RequiredExceptFields as aq, type LogLevel as ar, type WorkflowLoggerOptions as as, WorkflowLogger as at, 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, UrlGroups as v, type State as w, type Log as x, type Event as y, type LogPayload as z };
package/cloudflare.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.mjs';
1
+ import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-CYwLcEcQ.mjs';
2
2
  import 'neverthrow';
3
3
 
4
4
  type WorkflowBindings = {
package/cloudflare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a4 as RouteFunction, a5 as WorkflowServeOptions } from './client-vTeVVeh7.js';
1
+ import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-CYwLcEcQ.js';
2
2
  import 'neverthrow';
3
3
 
4
4
  type WorkflowBindings = {