@upstash/qstash
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -37,3 +37,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
var _a, _b; | ||
var _a; | ||
const headers = new Headers(req.headers); | ||
@@ -70,5 +70,10 @@ headers.set("Authorization", this.authorization); | ||
if (res.status < 200 || res.status >= 300) { | ||
throw new QstashError((_b = yield res.text()) != null ? _b : res.statusText); | ||
const body = yield res.text(); | ||
throw new QstashError(body.length > 0 ? body : `Error: status=${res.status}`); | ||
} | ||
return yield res.json(); | ||
if (req.parseResponseAsJson === false) { | ||
return void 0; | ||
} else { | ||
return yield res.json(); | ||
} | ||
}); | ||
@@ -251,7 +256,8 @@ } | ||
*/ | ||
listMessages() { | ||
listMessages(opts) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "dlq", "messages"] | ||
path: ["v2", "dlq"], | ||
query: { cursor: opts == null ? void 0 : opts.cursor } | ||
}); | ||
@@ -267,3 +273,5 @@ }); | ||
method: "DELETE", | ||
path: ["v2", "dlq", "messages", dlqMessageId] | ||
path: ["v2", "dlq", dlqMessageId], | ||
parseResponseAsJson: false | ||
// there is no response | ||
}); | ||
@@ -270,0 +278,0 @@ }); |
@@ -85,2 +85,8 @@ /** | ||
query?: Record<string, string | number | boolean | undefined>; | ||
/** | ||
* if enabled, call `res.json()` | ||
* | ||
* @default true | ||
*/ | ||
parseResponseAsJson?: boolean; | ||
}; | ||
@@ -349,3 +355,8 @@ type UpstashResponse<TResult> = TResult & { | ||
*/ | ||
listMessages(): Promise<DlqMessage[]>; | ||
listMessages(opts?: { | ||
cursor?: string; | ||
}): Promise<{ | ||
messages: DlqMessage[]; | ||
cursor?: string; | ||
}>; | ||
/** | ||
@@ -352,0 +363,0 @@ * Remove a message from the dlq using it's `dlqId` |
@@ -37,3 +37,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
var _a, _b; | ||
var _a; | ||
const headers = new Headers(req.headers); | ||
@@ -70,5 +70,10 @@ headers.set("Authorization", this.authorization); | ||
if (res.status < 200 || res.status >= 300) { | ||
throw new QstashError((_b = yield res.text()) != null ? _b : res.statusText); | ||
const body = yield res.text(); | ||
throw new QstashError(body.length > 0 ? body : `Error: status=${res.status}`); | ||
} | ||
return yield res.json(); | ||
if (req.parseResponseAsJson === false) { | ||
return void 0; | ||
} else { | ||
return yield res.json(); | ||
} | ||
}); | ||
@@ -251,7 +256,8 @@ } | ||
*/ | ||
listMessages() { | ||
listMessages(opts) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "dlq", "messages"] | ||
path: ["v2", "dlq"], | ||
query: { cursor: opts == null ? void 0 : opts.cursor } | ||
}); | ||
@@ -267,3 +273,5 @@ }); | ||
method: "DELETE", | ||
path: ["v2", "dlq", "messages", dlqMessageId] | ||
path: ["v2", "dlq", dlqMessageId], | ||
parseResponseAsJson: false | ||
// there is no response | ||
}); | ||
@@ -270,0 +278,0 @@ }); |
{ | ||
"name": "@upstash/qstash", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Official Typescript client for QStash", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
165168
2228