amqp-extension 1.1.0 → 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 CHANGED
@@ -1,3 +1,23 @@
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
+
14
+ ## [1.1.1](https://github.com/Tada5hi/amqp-extension/compare/v1.1.0...v1.1.1) (2023-02-03)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * expose amqplib types \n\n BREAKING CHANGE: bump to v2 ([5156649](https://github.com/Tada5hi/amqp-extension/commit/515664904e54c0767fb495bf7c6993101b0f169f))
20
+
1
21
  # [1.1.0](https://github.com/Tada5hi/amqp-extension/compare/v1.0.5...v1.1.0) (2023-02-03)
2
22
 
3
23
 
package/README.MD CHANGED
@@ -56,7 +56,7 @@ setConfig({
56
56
 
57
57
  (async () => {
58
58
  await publish({
59
- data: {
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
- data: {
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
- data: {
318
+ content: {
319
319
  type: 'resourceCreated'
320
320
  }
321
321
  });
@@ -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.data)) {
21
- buffer = options.data;
20
+ if (Buffer.isBuffer(options.content)) {
21
+ buffer = options.content;
22
22
  }
23
- else if (typeof options.data === 'string') {
24
- buffer = Buffer.from(options.data, 'utf-8');
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.data), 'utf-8');
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);
@@ -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
- data: any;
12
+ content: T;
13
13
  } & PublishOptions;
@@ -7,7 +7,7 @@ function buildDriverPublishOptions(options) {
7
7
  'alias',
8
8
  'exchange',
9
9
  'queueName',
10
- 'data',
10
+ 'content',
11
11
  'id',
12
12
  ]);
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amqp-extension",
3
- "version": "1.1.0",
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,6 +35,7 @@
35
35
  },
36
36
  "homepage": "https://github.com/Tada5hi/amqp-extension#readme",
37
37
  "dependencies": {
38
+ "@types/amqplib": "^0.10.1",
38
39
  "amqplib": "^0.10.3",
39
40
  "smob": "^0.1.0",
40
41
  "uuid": "^9.0.0"
@@ -49,7 +50,6 @@
49
50
  "@semantic-release/release-notes-generator": "^10.0.3",
50
51
  "@tada5hi/eslint-config-typescript": "^1.1.1",
51
52
  "@tada5hi/tsconfig": "^0.4.0",
52
- "@types/amqplib": "^0.10.0",
53
53
  "@types/jest": "^27.4.1",
54
54
  "@types/node": "^18.11.9",
55
55
  "@types/uuid": "^8.3.4",