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
5
Versions
210
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.1.2-canary.0 to 2.1.2-canary.1

dist/chunk-EQTYEU4U.js

139

./dist/index.js

@@ -1,98 +0,9 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
// src/receiver.ts
var _jose = require('jose'); var jose = _interopRequireWildcard(_jose);
var _cryptojs = require('crypto-js'); var crypto = _interopRequireWildcard(_cryptojs);
var SignatureError = class extends Error {
constructor(message) {
super(message);
this.name = "SignatureError";
}
};
var Receiver = class {
constructor(config) {
this.currentSigningKey = config.currentSigningKey;
this.nextSigningKey = config.nextSigningKey;
}
/**
* Verify the signature of a request.
*
* Tries to verify the signature with the current signing key.
* If that fails, maybe because you have rotated the keys recently, it will
* try to verify the signature with the next signing key.
*
* If that fails, the signature is invalid and a `SignatureError` is thrown.
*/
verify(req) {
return __async(this, null, function* () {
const isValid = yield this.verifyWithKey(this.currentSigningKey, req);
if (isValid) {
return true;
}
return this.verifyWithKey(this.nextSigningKey, req);
});
}
/**
* Verify signature with a specific signing key
*/
verifyWithKey(key, req) {
return __async(this, null, function* () {
const jwt = yield jose.jwtVerify(req.signature, new TextEncoder().encode(key), {
issuer: "Upstash",
clockTolerance: req.clockTolerance
}).catch((e) => {
throw new SignatureError(e.message);
});
const p = jwt.payload;
if (typeof req.url !== "undefined" && p.sub !== req.url) {
throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);
}
const bodyHash = crypto.SHA256(req.body).toString(crypto.enc.Base64url);
const padding = new RegExp(/=+$/);
if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
}
return true;
});
}
};
var _chunkEQTYEU4Ujs = require('./chunk-EQTYEU4U.js');
// src/client/error.ts

@@ -125,3 +36,3 @@ var QstashError = class extends Error {

request(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
var _a, _b;

@@ -175,3 +86,3 @@ const headers = new Headers(req.headers);

addEndpoints(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -189,3 +100,3 @@ method: "POST",

removeEndpoints(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -203,3 +114,3 @@ method: "DELETE",

list() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -215,3 +126,3 @@ method: "GET",

get(name) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -227,3 +138,3 @@ method: "GET",

delete(name) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -246,3 +157,3 @@ method: "DELETE",

get(messageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -258,3 +169,3 @@ method: "GET",

delete(messageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -277,3 +188,3 @@ method: "DELETE",

create(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -291,3 +202,3 @@ method: "POST",

get(scheduleId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -303,3 +214,3 @@ method: "GET",

list() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -315,3 +226,3 @@ method: "GET",

delete(scheduleId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -334,3 +245,3 @@ method: "DELETE",

listMessages() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -346,3 +257,3 @@ method: "GET",

delete(dlqMessageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -398,3 +309,3 @@ method: "DELETE",

publish(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
var _a, _b;

@@ -435,6 +346,6 @@ const headers = new Headers(req.headers);

publishJSON(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
const headers = new Headers(req.headers);
headers.set("Content-Type", "application/json");
const res = yield this.publish(__spreadProps(__spreadValues({}, req), {
const res = yield this.publish(_chunkEQTYEU4Ujs.__spreadProps.call(void 0, _chunkEQTYEU4Ujs.__spreadValues.call(void 0, {}, req), {
headers,

@@ -466,3 +377,3 @@ body: JSON.stringify(req.body)

events(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
const query = {};

@@ -489,3 +400,3 @@ if ((req == null ? void 0 : req.cursor) && req.cursor > 0) {

exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.Receiver = Receiver; exports.Schedules = Schedules; exports.SignatureError = SignatureError; exports.Topics = Topics;
exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.Receiver = _chunkEQTYEU4Ujs.Receiver; exports.Schedules = Schedules; exports.SignatureError = _chunkEQTYEU4Ujs.SignatureError; exports.Topics = Topics;
//# sourceMappingURL=index.js.map

@@ -1,98 +0,9 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
// src/receiver.ts
var _jose = require('jose'); var jose = _interopRequireWildcard(_jose);
var _cryptojs = require('crypto-js'); var crypto = _interopRequireWildcard(_cryptojs);
var SignatureError = class extends Error {
constructor(message) {
super(message);
this.name = "SignatureError";
}
};
var Receiver = class {
constructor(config) {
this.currentSigningKey = config.currentSigningKey;
this.nextSigningKey = config.nextSigningKey;
}
/**
* Verify the signature of a request.
*
* Tries to verify the signature with the current signing key.
* If that fails, maybe because you have rotated the keys recently, it will
* try to verify the signature with the next signing key.
*
* If that fails, the signature is invalid and a `SignatureError` is thrown.
*/
verify(req) {
return __async(this, null, function* () {
const isValid = yield this.verifyWithKey(this.currentSigningKey, req);
if (isValid) {
return true;
}
return this.verifyWithKey(this.nextSigningKey, req);
});
}
/**
* Verify signature with a specific signing key
*/
verifyWithKey(key, req) {
return __async(this, null, function* () {
const jwt = yield jose.jwtVerify(req.signature, new TextEncoder().encode(key), {
issuer: "Upstash",
clockTolerance: req.clockTolerance
}).catch((e) => {
throw new SignatureError(e.message);
});
const p = jwt.payload;
if (typeof req.url !== "undefined" && p.sub !== req.url) {
throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);
}
const bodyHash = crypto.SHA256(req.body).toString(crypto.enc.Base64url);
const padding = new RegExp(/=+$/);
if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
}
return true;
});
}
};
var _chunkEQTYEU4Ujs = require('./chunk-EQTYEU4U.js');
// src/client/error.ts

@@ -125,3 +36,3 @@ var QstashError = class extends Error {

request(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
var _a, _b;

@@ -175,3 +86,3 @@ const headers = new Headers(req.headers);

addEndpoints(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -189,3 +100,3 @@ method: "POST",

removeEndpoints(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -203,3 +114,3 @@ method: "DELETE",

list() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -215,3 +126,3 @@ method: "GET",

get(name) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -227,3 +138,3 @@ method: "GET",

delete(name) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -246,3 +157,3 @@ method: "DELETE",

get(messageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -258,3 +169,3 @@ method: "GET",

delete(messageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -277,3 +188,3 @@ method: "DELETE",

create(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -291,3 +202,3 @@ method: "POST",

get(scheduleId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -303,3 +214,3 @@ method: "GET",

list() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -315,3 +226,3 @@ method: "GET",

delete(scheduleId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -334,3 +245,3 @@ method: "DELETE",

listMessages() {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -346,3 +257,3 @@ method: "GET",

delete(dlqMessageId) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
return yield this.http.request({

@@ -398,3 +309,3 @@ method: "DELETE",

publish(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
var _a, _b;

@@ -435,6 +346,6 @@ const headers = new Headers(req.headers);

publishJSON(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
const headers = new Headers(req.headers);
headers.set("Content-Type", "application/json");
const res = yield this.publish(__spreadProps(__spreadValues({}, req), {
const res = yield this.publish(_chunkEQTYEU4Ujs.__spreadProps.call(void 0, _chunkEQTYEU4Ujs.__spreadValues.call(void 0, {}, req), {
headers,

@@ -466,3 +377,3 @@ body: JSON.stringify(req.body)

events(req) {
return __async(this, null, function* () {
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () {
const query = {};

@@ -489,3 +400,3 @@ if ((req == null ? void 0 : req.cursor) && req.cursor > 0) {

exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.Receiver = Receiver; exports.Schedules = Schedules; exports.SignatureError = SignatureError; exports.Topics = Topics;
exports.Client = Client; exports.Messages = Messages; exports.QstashError = QstashError; exports.Receiver = _chunkEQTYEU4Ujs.Receiver; exports.Schedules = Schedules; exports.SignatureError = _chunkEQTYEU4Ujs.SignatureError; exports.Topics = Topics;
//# sourceMappingURL=index.js.map
{
"name": "@upstash/qstash",
"version": "2.1.2-canary.0",
"version": "2.1.2-canary.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

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