@upstash/qstash
Advanced tools
Comparing version
@@ -116,69 +116,2 @@ /** | ||
type Endpoint = { | ||
/** | ||
* The name of the endpoint (optional) | ||
*/ | ||
name?: string; | ||
/** | ||
* The url of the endpoint | ||
*/ | ||
url: string; | ||
}; | ||
type AddEndpointsRequest = { | ||
/** | ||
* The name of the topic. | ||
* Must be unique and only contain alphanumeric, hyphen, underscore and periods. | ||
*/ | ||
name: string; | ||
endpoints: Endpoint[]; | ||
}; | ||
type RemoveEndpointsRequest = { | ||
/** | ||
* The name of the topic. | ||
* Must be unique and only contain alphanumeric, hyphen, underscore and periods. | ||
*/ | ||
name: string; | ||
endpoints: ({ | ||
name: string; | ||
url?: string; | ||
} | { | ||
name?: string; | ||
url: string; | ||
})[]; | ||
}; | ||
type Topic = { | ||
/** | ||
* The name of this topic. | ||
*/ | ||
name: string; | ||
/** | ||
* A list of all subscribed endpoints | ||
*/ | ||
endpoints: Endpoint[]; | ||
}; | ||
declare class Topics { | ||
private readonly http; | ||
constructor(http: Requester); | ||
/** | ||
* Create a new topic with the given name and endpoints | ||
*/ | ||
addEndpoints(req: AddEndpointsRequest): Promise<void>; | ||
/** | ||
* Remove endpoints from a topic. | ||
*/ | ||
removeEndpoints(req: RemoveEndpointsRequest): Promise<void>; | ||
/** | ||
* Get a list of all topics. | ||
*/ | ||
list(): Promise<Topic[]>; | ||
/** | ||
* Get a single topic | ||
*/ | ||
get(name: string): Promise<Topic>; | ||
/** | ||
* Delete a topic | ||
*/ | ||
delete(name: string): Promise<void>; | ||
} | ||
type Message = { | ||
@@ -218,3 +151,3 @@ /** | ||
/** | ||
* A unix timestamp (milliseconds) when this messages was crated. | ||
* A unix timestamp (milliseconds) when this messages was created. | ||
*/ | ||
@@ -226,2 +159,6 @@ createdAt: number; | ||
callback?: string; | ||
/** | ||
* The failure callback url if configured. | ||
*/ | ||
failureCallback?: string; | ||
}; | ||
@@ -241,2 +178,23 @@ declare class Messages { | ||
type DlqMessage = Message & { | ||
dlqId: string; | ||
}; | ||
declare class DLQ { | ||
private readonly http; | ||
constructor(http: Requester); | ||
/** | ||
* List messages in the dlq | ||
*/ | ||
listMessages(opts?: { | ||
cursor?: string; | ||
}): Promise<{ | ||
messages: DlqMessage[]; | ||
cursor?: string; | ||
}>; | ||
/** | ||
* Remove a message from the dlq using it's `dlqId` | ||
*/ | ||
delete(dlqMessageId: string): Promise<void>; | ||
} | ||
type Schedule = { | ||
@@ -253,2 +211,3 @@ scheduleId: string; | ||
callback?: string; | ||
failureCallback?: string; | ||
}; | ||
@@ -285,3 +244,3 @@ type CreateScheduleRequest = { | ||
/** | ||
* In case your destination server is unavaialble or returns a status code outside of the 200-299 | ||
* In case your destination server is unavailable or returns a status code outside of the 200-299 | ||
* range, we will retry the request after a certain amount of time. | ||
@@ -303,2 +262,10 @@ * | ||
/** | ||
* Use a failure callback url to handle messages that could not be delivered. | ||
* | ||
* The failure callback url must be publicly accessible | ||
* | ||
* @default undefined | ||
*/ | ||
failureCallback?: string; | ||
/** | ||
* The method to use when sending a request to your API | ||
@@ -337,2 +304,69 @@ * | ||
type Endpoint = { | ||
/** | ||
* The name of the endpoint (optional) | ||
*/ | ||
name?: string; | ||
/** | ||
* The url of the endpoint | ||
*/ | ||
url: string; | ||
}; | ||
type AddEndpointsRequest = { | ||
/** | ||
* The name of the topic. | ||
* Must be unique and only contain alphanumeric, hyphen, underscore and periods. | ||
*/ | ||
name: string; | ||
endpoints: Endpoint[]; | ||
}; | ||
type RemoveEndpointsRequest = { | ||
/** | ||
* The name of the topic. | ||
* Must be unique and only contain alphanumeric, hyphen, underscore and periods. | ||
*/ | ||
name: string; | ||
endpoints: ({ | ||
name: string; | ||
url?: string; | ||
} | { | ||
name?: string; | ||
url: string; | ||
})[]; | ||
}; | ||
type Topic = { | ||
/** | ||
* The name of this topic. | ||
*/ | ||
name: string; | ||
/** | ||
* A list of all subscribed endpoints | ||
*/ | ||
endpoints: Endpoint[]; | ||
}; | ||
declare class Topics { | ||
private readonly http; | ||
constructor(http: Requester); | ||
/** | ||
* Create a new topic with the given name and endpoints | ||
*/ | ||
addEndpoints(req: AddEndpointsRequest): Promise<void>; | ||
/** | ||
* Remove endpoints from a topic. | ||
*/ | ||
removeEndpoints(req: RemoveEndpointsRequest): Promise<void>; | ||
/** | ||
* Get a list of all topics. | ||
*/ | ||
list(): Promise<Topic[]>; | ||
/** | ||
* Get a single topic | ||
*/ | ||
get(name: string): Promise<Topic>; | ||
/** | ||
* Delete a topic | ||
*/ | ||
delete(name: string): Promise<void>; | ||
} | ||
type State = "CREATED" | "ACTIVE" | "DELIVERED" | "ERROR" | "RETRY" | "FAILED"; | ||
@@ -353,23 +387,2 @@ type Event = { | ||
type DlqMessage = Message & { | ||
dlqId: string; | ||
}; | ||
declare class DLQ { | ||
private readonly http; | ||
constructor(http: Requester); | ||
/** | ||
* List messages in the dlq | ||
*/ | ||
listMessages(opts?: { | ||
cursor?: string; | ||
}): Promise<{ | ||
messages: DlqMessage[]; | ||
cursor?: string; | ||
}>; | ||
/** | ||
* Remove a message from the dlq using it's `dlqId` | ||
*/ | ||
delete(dlqMessageId: string): Promise<void>; | ||
} | ||
type ClientConfig = { | ||
@@ -474,2 +487,10 @@ /** | ||
/** | ||
* Use a failure callback url to handle messages that could not be delivered. | ||
* | ||
* The failure callback url must be publicly accessible | ||
* | ||
* @default undefined | ||
*/ | ||
failureCallback?: string; | ||
/** | ||
* The method to use when sending a request to your API | ||
@@ -476,0 +497,0 @@ * |
@@ -9,2 +9,34 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
// src/client/dlq.ts | ||
var DLQ = class { | ||
constructor(http) { | ||
this.http = http; | ||
} | ||
/** | ||
* List messages in the dlq | ||
*/ | ||
listMessages(opts) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "dlq"], | ||
query: { cursor: opts == null ? void 0 : opts.cursor } | ||
}); | ||
}); | ||
} | ||
/** | ||
* Remove a message from the dlq using it's `dlqId` | ||
*/ | ||
delete(dlqMessageId) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "DELETE", | ||
path: ["v2", "dlq", dlqMessageId], | ||
parseResponseAsJson: false | ||
// there is no response | ||
}); | ||
}); | ||
} | ||
}; | ||
// src/client/error.ts | ||
@@ -94,71 +126,2 @@ var QstashError = class extends Error { | ||
// src/client/topics.ts | ||
var Topics = class { | ||
constructor(http) { | ||
this.http = http; | ||
} | ||
/** | ||
* Create a new topic with the given name and endpoints | ||
*/ | ||
addEndpoints(req) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
yield this.http.request({ | ||
method: "POST", | ||
path: ["v2", "topics", req.name, "endpoints"], | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ endpoints: req.endpoints }), | ||
parseResponseAsJson: false | ||
}); | ||
}); | ||
} | ||
/** | ||
* Remove endpoints from a topic. | ||
*/ | ||
removeEndpoints(req) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
yield this.http.request({ | ||
method: "DELETE", | ||
path: ["v2", "topics", req.name, "endpoints"], | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ endpoints: req.endpoints }), | ||
parseResponseAsJson: false | ||
}); | ||
}); | ||
} | ||
/** | ||
* Get a list of all topics. | ||
*/ | ||
list() { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "topics"] | ||
}); | ||
}); | ||
} | ||
/** | ||
* Get a single topic | ||
*/ | ||
get(name) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "topics", name] | ||
}); | ||
}); | ||
} | ||
/** | ||
* Delete a topic | ||
*/ | ||
delete(name) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "DELETE", | ||
path: ["v2", "topics", name], | ||
parseResponseAsJson: false | ||
}); | ||
}); | ||
} | ||
}; | ||
// src/client/messages.ts | ||
@@ -221,2 +184,5 @@ var Messages = class { | ||
} | ||
if (typeof req.failureCallback !== "undefined") { | ||
headers.set("Upstash-Failure-Callback", req.failureCallback); | ||
} | ||
return yield this.http.request({ | ||
@@ -266,4 +232,4 @@ method: "POST", | ||
// src/client/dlq.ts | ||
var DLQ = class { | ||
// src/client/topics.ts | ||
var Topics = class { | ||
constructor(http) { | ||
@@ -273,10 +239,37 @@ this.http = http; | ||
/** | ||
* List messages in the dlq | ||
* Create a new topic with the given name and endpoints | ||
*/ | ||
listMessages(opts) { | ||
addEndpoints(req) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
yield this.http.request({ | ||
method: "POST", | ||
path: ["v2", "topics", req.name, "endpoints"], | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ endpoints: req.endpoints }), | ||
parseResponseAsJson: false | ||
}); | ||
}); | ||
} | ||
/** | ||
* Remove endpoints from a topic. | ||
*/ | ||
removeEndpoints(req) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
yield this.http.request({ | ||
method: "DELETE", | ||
path: ["v2", "topics", req.name, "endpoints"], | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ endpoints: req.endpoints }), | ||
parseResponseAsJson: false | ||
}); | ||
}); | ||
} | ||
/** | ||
* Get a list of all topics. | ||
*/ | ||
list() { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "dlq"], | ||
query: { cursor: opts == null ? void 0 : opts.cursor } | ||
path: ["v2", "topics"] | ||
}); | ||
@@ -286,11 +279,21 @@ }); | ||
/** | ||
* Remove a message from the dlq using it's `dlqId` | ||
* Get a single topic | ||
*/ | ||
delete(dlqMessageId) { | ||
get(name) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "GET", | ||
path: ["v2", "topics", name] | ||
}); | ||
}); | ||
} | ||
/** | ||
* Delete a topic | ||
*/ | ||
delete(name) { | ||
return _chunkEQTYEU4Ujs.__async.call(void 0, this, null, function* () { | ||
return yield this.http.request({ | ||
method: "DELETE", | ||
path: ["v2", "dlq", dlqMessageId], | ||
path: ["v2", "topics", name], | ||
parseResponseAsJson: false | ||
// there is no response | ||
}); | ||
@@ -365,2 +368,5 @@ }); | ||
} | ||
if (typeof req.failureCallback !== "undefined") { | ||
headers.set("Upstash-Failure-Callback", req.failureCallback); | ||
} | ||
const res = yield this.http.request({ | ||
@@ -367,0 +373,0 @@ path: ["v2", "publish", (_b = req.url) != null ? _b : req.topic], |
{ | ||
"name": "@upstash/qstash", | ||
"version": "2.1.9", | ||
"version": "v2.1.11-canary", | ||
"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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
161417
2.34%1912
1.76%1
Infinity%3
50%