qrusty-client 0.1.0
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 +69 -0
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/index.html +65 -0
- package/docs/index.js.html +136 -0
- package/docs/module-QrustyClient-QrustyClient.html +1317 -0
- package/docs/module-QrustyClient.html +172 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/styles/jsdoc-default.css +358 -0
- package/docs/styles/prettify-jsdoc.css +111 -0
- package/docs/styles/prettify-tomorrow.css +132 -0
- package/index.js +85 -0
- package/jsdoc.json +13 -0
- package/package.json +19 -0
- package/test.js +20 -0
|
Binary file
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Home</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<div id="main">
|
|
19
|
+
|
|
20
|
+
<h1 class="page-title">Home</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<h3> </h3>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<nav>
|
|
53
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-QrustyClient.html">QrustyClient</a></li></ul><h3>Classes</h3><ul><li><a href="module-QrustyClient-QrustyClient.html">QrustyClient</a></li></ul>
|
|
54
|
+
</nav>
|
|
55
|
+
|
|
56
|
+
<br class="clear">
|
|
57
|
+
|
|
58
|
+
<footer>
|
|
59
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Wed Aug 20 2025 02:57:25 GMT+0000 (Coordinated Universal Time)
|
|
60
|
+
</footer>
|
|
61
|
+
|
|
62
|
+
<script> prettyPrint(); </script>
|
|
63
|
+
<script src="scripts/linenumber.js"> </script>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: index.js</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<div id="main">
|
|
19
|
+
|
|
20
|
+
<h1 class="page-title">Source: index.js</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<section>
|
|
28
|
+
<article>
|
|
29
|
+
<pre class="prettyprint source linenums"><code>/**
|
|
30
|
+
* QrustyClient - Node.js client for the qrusty priority queue API
|
|
31
|
+
* @module QrustyClient
|
|
32
|
+
*/
|
|
33
|
+
const axios = require('axios');
|
|
34
|
+
|
|
35
|
+
class QrustyClient {
|
|
36
|
+
/**
|
|
37
|
+
* Create a new QrustyClient
|
|
38
|
+
* @param {string} baseUrl - Base URL of the qrusty server
|
|
39
|
+
*/
|
|
40
|
+
constructor(baseUrl) {
|
|
41
|
+
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Publish a message to a queue
|
|
46
|
+
* @param {string} queue
|
|
47
|
+
* @param {number} priority
|
|
48
|
+
* @param {object} payload
|
|
49
|
+
* @param {number} [maxRetries=3]
|
|
50
|
+
* @returns {Promise<object>}
|
|
51
|
+
*/
|
|
52
|
+
async publish(queue, priority, payload, maxRetries = 3) {
|
|
53
|
+
const data = { queue, priority, payload, max_retries: maxRetries };
|
|
54
|
+
const resp = await axios.post(`${this.baseUrl}/publish`, data);
|
|
55
|
+
return resp.data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Consume a message from a queue
|
|
60
|
+
* @param {string} queue
|
|
61
|
+
* @param {string} consumerId
|
|
62
|
+
* @param {number} [timeoutSeconds=30]
|
|
63
|
+
* @returns {Promise<object>}
|
|
64
|
+
*/
|
|
65
|
+
async consume(queue, consumerId, timeoutSeconds = 30) {
|
|
66
|
+
const data = { consumer_id: consumerId, timeout_seconds: timeoutSeconds };
|
|
67
|
+
const resp = await axios.post(`${this.baseUrl}/consume/${queue}`, data);
|
|
68
|
+
return resp.data;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Acknowledge a message
|
|
73
|
+
* @param {string} queue
|
|
74
|
+
* @param {string} messageId
|
|
75
|
+
* @param {string} consumerId
|
|
76
|
+
* @returns {Promise<object>}
|
|
77
|
+
*/
|
|
78
|
+
async ack(queue, messageId, consumerId) {
|
|
79
|
+
const data = { message_id: messageId, consumer_id: consumerId };
|
|
80
|
+
const resp = await axios.post(`${this.baseUrl}/ack/${queue}`, data);
|
|
81
|
+
return resp.data;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Purge a queue
|
|
86
|
+
* @param {string} queue
|
|
87
|
+
* @returns {Promise<object>}
|
|
88
|
+
*/
|
|
89
|
+
async purge(queue) {
|
|
90
|
+
const resp = await axios.post(`${this.baseUrl}/purge-queue/${queue}`);
|
|
91
|
+
return resp.data;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get stats for all queues
|
|
96
|
+
* @returns {Promise<object>}
|
|
97
|
+
*/
|
|
98
|
+
async stats() {
|
|
99
|
+
const resp = await axios.get(`${this.baseUrl}/stats`);
|
|
100
|
+
return resp.data;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* List all queues
|
|
105
|
+
* @returns {Promise<object>}
|
|
106
|
+
*/
|
|
107
|
+
async listQueues() {
|
|
108
|
+
const resp = await axios.get(`${this.baseUrl}/queues`);
|
|
109
|
+
return resp.data;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = QrustyClient;
|
|
114
|
+
</code></pre>
|
|
115
|
+
</article>
|
|
116
|
+
</section>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<nav>
|
|
124
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-QrustyClient.html">QrustyClient</a></li></ul><h3>Classes</h3><ul><li><a href="module-QrustyClient-QrustyClient.html">QrustyClient</a></li></ul>
|
|
125
|
+
</nav>
|
|
126
|
+
|
|
127
|
+
<br class="clear">
|
|
128
|
+
|
|
129
|
+
<footer>
|
|
130
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Wed Aug 20 2025 02:57:25 GMT+0000 (Coordinated Universal Time)
|
|
131
|
+
</footer>
|
|
132
|
+
|
|
133
|
+
<script> prettyPrint(); </script>
|
|
134
|
+
<script src="scripts/linenumber.js"> </script>
|
|
135
|
+
</body>
|
|
136
|
+
</html>
|