amqp-extension 1.1.1 → 2.0.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/CHANGELOG.md +13 -0
- package/README.MD +3 -3
- package/dist/publish/module.js +5 -5
- package/dist/publish/type.d.ts +2 -2
- package/dist/publish/utils.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [2.0.0](https://github.com/Tada5hi/amqp-extension/compare/v1.1.1...v2.0.0) (2023-02-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add generic type to publish option ([6f67912](https://github.com/Tada5hi/amqp-extension/commit/6f679129b4e295757b728e0df625ce276d708fe4))
|
|
7
|
+
* **deps:** bump @types/amqplib ([de1316b](https://github.com/Tada5hi/amqp-extension/commit/de1316bd33885387ca88b761d03962692ba01d7f))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* bump version
|
|
13
|
+
|
|
1
14
|
## [1.1.1](https://github.com/Tada5hi/amqp-extension/compare/v1.1.0...v1.1.1) (2023-02-03)
|
|
2
15
|
|
|
3
16
|
|
package/README.MD
CHANGED
|
@@ -56,7 +56,7 @@ setConfig({
|
|
|
56
56
|
|
|
57
57
|
(async () => {
|
|
58
58
|
await publish({
|
|
59
|
-
|
|
59
|
+
content: {
|
|
60
60
|
type: 'resourceCreated',
|
|
61
61
|
name: 'foo'
|
|
62
62
|
}
|
|
@@ -148,7 +148,7 @@ setConfig({
|
|
|
148
148
|
await publish({
|
|
149
149
|
routingKey: '<routing-key>',
|
|
150
150
|
alias: 'foo', // <--- use another connection :)
|
|
151
|
-
|
|
151
|
+
content: {
|
|
152
152
|
foo: 'bar'
|
|
153
153
|
}
|
|
154
154
|
});
|
|
@@ -315,7 +315,7 @@ import {
|
|
|
315
315
|
|
|
316
316
|
(async () => {
|
|
317
317
|
await publish({
|
|
318
|
-
|
|
318
|
+
content: {
|
|
319
319
|
type: 'resourceCreated'
|
|
320
320
|
}
|
|
321
321
|
});
|
package/dist/publish/module.js
CHANGED
|
@@ -17,14 +17,14 @@ const utils_1 = require("./utils");
|
|
|
17
17
|
/* istanbul ignore next */
|
|
18
18
|
async function publish(options) {
|
|
19
19
|
let buffer;
|
|
20
|
-
if (Buffer.isBuffer(options.
|
|
21
|
-
buffer = options.
|
|
20
|
+
if (Buffer.isBuffer(options.content)) {
|
|
21
|
+
buffer = options.content;
|
|
22
22
|
}
|
|
23
|
-
else if (typeof options.
|
|
24
|
-
buffer = Buffer.from(options.
|
|
23
|
+
else if (typeof options.content === 'string') {
|
|
24
|
+
buffer = Buffer.from(options.content, 'utf-8');
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
buffer = Buffer.from(JSON.stringify(options.
|
|
27
|
+
buffer = Buffer.from(JSON.stringify(options.content), 'utf-8');
|
|
28
28
|
}
|
|
29
29
|
const config = (0, config_1.getConfig)(options.alias);
|
|
30
30
|
const connection = await (0, connection_1.useConnection)(config.alias);
|
package/dist/publish/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublishOptions } from '../type';
|
|
2
|
-
export type PublishOptionsExtended = {
|
|
2
|
+
export type PublishOptionsExtended<T = any> = {
|
|
3
3
|
/**
|
|
4
4
|
* Alias for: messageId
|
|
5
5
|
*
|
|
@@ -9,5 +9,5 @@ export type PublishOptionsExtended = {
|
|
|
9
9
|
/**
|
|
10
10
|
* The message data.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
content: T;
|
|
13
13
|
} & PublishOptions;
|
package/dist/publish/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amqp-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "An amqp extension with functions and utility functions to consume and publish queue messages.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Tada5hi/amqp-extension#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@types/amqplib": "^0.10.
|
|
38
|
+
"@types/amqplib": "^0.10.1",
|
|
39
39
|
"amqplib": "^0.10.3",
|
|
40
40
|
"smob": "^0.1.0",
|
|
41
41
|
"uuid": "^9.0.0"
|