New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@upstash/qstash

Package Overview
Dependencies
Maintainers
6
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@upstash/qstash - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

9

dist/index.d.ts

@@ -553,2 +553,3 @@ /**

get schedules(): Schedules;
private processHeaders;
publish<TRequest extends PublishRequest>(req: TRequest): Promise<PublishResponse<TRequest>>;

@@ -561,2 +562,10 @@ /**

/**
* Batch publish messages to QStash.
*/
batch(req: PublishRequest[]): Promise<(PublishToUrlResponse | PublishToTopicResponse)[]>;
/**
* Batch publish messages to QStash, serializing each body to JSON.
*/
batchJSON<TBody extends BodyInit = BodyInit, TRequest extends PublishRequest<TBody> = PublishRequest<TBody>>(req: TRequest[]): Promise<(PublishToUrlResponse | PublishToTopicResponse)[]>;
/**
* Retrieve your logs.

@@ -563,0 +572,0 @@ *

98

dist/index.js

@@ -371,30 +371,35 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

}
processHeaders(req) {
var _a;
const headers = prefixHeaders(new Headers(req.headers));
headers.set("Upstash-Method", (_a = req.method) != null ? _a : "POST");
if (typeof req.delay !== "undefined") {
headers.set("Upstash-Delay", `${req.delay.toFixed()}s`);
}
if (typeof req.notBefore !== "undefined") {
headers.set("Upstash-Not-Before", req.notBefore.toFixed());
}
if (typeof req.deduplicationId !== "undefined") {
headers.set("Upstash-Deduplication-Id", req.deduplicationId);
}
if (typeof req.contentBasedDeduplication !== "undefined") {
headers.set("Upstash-Content-Based-Deduplication", "true");
}
if (typeof req.retries !== "undefined") {
headers.set("Upstash-Retries", req.retries.toFixed());
}
if (typeof req.callback !== "undefined") {
headers.set("Upstash-Callback", req.callback);
}
if (typeof req.failureCallback !== "undefined") {
headers.set("Upstash-Failure-Callback", req.failureCallback);
}
return headers;
}
publish(req) {
return _chunkEROSIHWEjs.__async.call(void 0, this, null, function* () {
var _a, _b;
const headers = prefixHeaders(new Headers(req.headers));
headers.set("Upstash-Method", (_a = req.method) != null ? _a : "POST");
if (typeof req.delay !== "undefined") {
headers.set("Upstash-Delay", `${req.delay.toFixed()}s`);
}
if (typeof req.notBefore !== "undefined") {
headers.set("Upstash-Not-Before", req.notBefore.toFixed());
}
if (typeof req.deduplicationId !== "undefined") {
headers.set("Upstash-Deduplication-Id", req.deduplicationId);
}
if (typeof req.contentBasedDeduplication !== "undefined") {
headers.set("Upstash-Content-Based-Deduplication", "true");
}
if (typeof req.retries !== "undefined") {
headers.set("Upstash-Retries", req.retries.toFixed());
}
if (typeof req.callback !== "undefined") {
headers.set("Upstash-Callback", req.callback);
}
if (typeof req.failureCallback !== "undefined") {
headers.set("Upstash-Failure-Callback", req.failureCallback);
}
var _a;
const headers = this.processHeaders(req);
const res = yield this.http.request({
path: ["v2", "publish", (_b = req.url) != null ? _b : req.topic],
path: ["v2", "publish", (_a = req.url) != null ? _a : req.topic],
body: req.body,

@@ -423,2 +428,45 @@ headers,

/**
* Batch publish messages to QStash.
*/
batch(req) {
return _chunkEROSIHWEjs.__async.call(void 0, this, null, function* () {
var _a;
const messages = [];
for (const message of req) {
const headers = this.processHeaders(message);
const headerEntries = Object.fromEntries(headers.entries());
messages.push({
destination: (_a = message.url) != null ? _a : message.topic,
headers: headerEntries,
body: message.body
});
}
const res = yield this.http.request({
path: ["v2", "batch"],
body: JSON.stringify(messages),
headers: {
"Content-Type": "application/json"
},
method: "POST"
});
return res;
});
}
/**
* Batch publish messages to QStash, serializing each body to JSON.
*/
batchJSON(req) {
return _chunkEROSIHWEjs.__async.call(void 0, this, null, function* () {
for (const message of req) {
if ("body" in message) {
message.body = JSON.stringify(message.body);
}
message.headers = new Headers(message.headers);
message.headers.set("Content-Type", "application/json");
}
const res = yield this.batch(req);
return res;
});
}
/**
* Retrieve your logs.

@@ -425,0 +473,0 @@ *

{
"name": "@upstash/qstash",
"version": "v2.4.0",
"version": "v2.4.1",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc