amqp-extension 1.1.1 → 2.0.1
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/.eslintrc +1 -1
- package/CHANGELOG.md +20 -0
- package/README.MD +3 -3
- package/commitlint.config.js +1 -1
- package/dist/config/module.d.ts +1 -1
- package/dist/config/type.d.ts +3 -3
- package/dist/config/utils.d.ts +1 -1
- package/dist/connection/module.d.ts +3 -3
- package/dist/consume/module.d.ts +2 -2
- package/dist/consume/type.d.ts +1 -1
- package/dist/consume/utils.d.ts +2 -2
- package/dist/exchange/constants.js +1 -1
- package/dist/exchange/type.d.ts +2 -2
- package/dist/exchange/utils.d.ts +2 -2
- package/dist/publish/module.d.ts +1 -1
- package/dist/publish/module.js +5 -5
- package/dist/publish/type.d.ts +3 -3
- package/dist/publish/utils.d.ts +2 -2
- package/dist/publish/utils.js +1 -1
- package/dist/type.d.ts +3 -3
- package/package.json +16 -28
- package/release.config.js +1 -8
- package/tsconfig.eslint.json +11 -0
package/.eslintrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [2.0.1](https://github.com/Tada5hi/amqp-extension/compare/v2.0.0...v2.0.1) (2023-11-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump (dev-) dependencies & resolved linting issues ([25b74ce](https://github.com/Tada5hi/amqp-extension/commit/25b74ceb3b83581b1f67bc7b09c6c68029e87252))
|
|
7
|
+
|
|
8
|
+
# [2.0.0](https://github.com/Tada5hi/amqp-extension/compare/v1.1.1...v2.0.0) (2023-02-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add generic type to publish option ([6f67912](https://github.com/Tada5hi/amqp-extension/commit/6f679129b4e295757b728e0df625ce276d708fe4))
|
|
14
|
+
* **deps:** bump @types/amqplib ([de1316b](https://github.com/Tada5hi/amqp-extension/commit/de1316bd33885387ca88b761d03962692ba01d7f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### BREAKING CHANGES
|
|
18
|
+
|
|
19
|
+
* bump version
|
|
20
|
+
|
|
1
21
|
## [1.1.1](https://github.com/Tada5hi/amqp-extension/compare/v1.1.0...v1.1.1) (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
|
-
|
|
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/commitlint.config.js
CHANGED
package/dist/config/module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, ConfigInput } from './type';
|
|
1
|
+
import type { Config, ConfigInput } from './type';
|
|
2
2
|
export declare function setConfig(key: string | ConfigInput, value?: ConfigInput): Config;
|
|
3
3
|
export declare function hasConfig(key?: string): boolean;
|
|
4
4
|
export declare function getConfig(key?: string | ConfigInput): Config;
|
package/dist/config/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Options } from 'amqplib';
|
|
2
|
-
import { ExchangeOptions } from '../exchange';
|
|
3
|
-
import { ConsumeOptions, PublishOptions } from '../type';
|
|
1
|
+
import type { Options } from 'amqplib';
|
|
2
|
+
import type { ExchangeOptions } from '../exchange';
|
|
3
|
+
import type { ConsumeOptions, PublishOptions } from '../type';
|
|
4
4
|
export type Config = {
|
|
5
5
|
alias: string;
|
|
6
6
|
connection: Options.Connect | string;
|
package/dist/config/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ConfigInput } from '../config';
|
|
1
|
+
import type { Connection, Options } from 'amqplib';
|
|
2
|
+
import type { ConfigInput } from '../config';
|
|
3
3
|
export declare function clearConnections(): Promise<void>;
|
|
4
4
|
export declare function hasConnection(key?: string): boolean;
|
|
5
5
|
export declare function getConnections(): Record<string, Connection>;
|
|
6
6
|
export declare function useConnection(key: string | ConfigInput): Promise<Connection>;
|
|
7
|
-
export declare function createConnection(config: Options.Connect | string): Promise<
|
|
7
|
+
export declare function createConnection(config: Options.Connect | string): Promise<Connection>;
|
package/dist/consume/module.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ConsumeOptions } from '../type';
|
|
2
|
-
import { ConsumeHandlers } from './type';
|
|
1
|
+
import type { ConsumeOptions } from '../type';
|
|
2
|
+
import type { ConsumeHandlers } from './type';
|
|
3
3
|
export declare function consume(options: ConsumeOptions, handlers: ConsumeHandlers): Promise<void>;
|
package/dist/consume/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Channel, ConsumeMessage } from 'amqplib';
|
|
2
|
-
import { ConsumeHandlerAnyKey } from './static';
|
|
2
|
+
import type { ConsumeHandlerAnyKey } from './static';
|
|
3
3
|
export { ConsumeMessage, };
|
|
4
4
|
export type ConsumeMessageHandler = (message: ConsumeMessage, channel: Channel) => Promise<void>;
|
|
5
5
|
export type ConsumeHandlerAnyKeyType = typeof ConsumeHandlerAnyKey;
|
package/dist/consume/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Options } from 'amqplib';
|
|
2
|
-
import { ConsumeOptions } from '../type';
|
|
1
|
+
import type { Options } from 'amqplib';
|
|
2
|
+
import type { ConsumeOptions } from '../type';
|
|
3
3
|
export declare function buildDriverConsumeOptions(options: ConsumeOptions): Options.Consume;
|
package/dist/exchange/type.d.ts
CHANGED
package/dist/exchange/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Options } from 'amqplib';
|
|
1
|
+
import type { Options } from 'amqplib';
|
|
2
2
|
import { ExchangeType } from './constants';
|
|
3
|
-
import { ExchangeOptions } from './type';
|
|
3
|
+
import type { ExchangeOptions } from './type';
|
|
4
4
|
export declare function isDefaultExchange(exchange?: `${ExchangeType}`): boolean;
|
|
5
5
|
export declare function buildDriverExchangeOptions(options: ExchangeOptions): Options.AssertExchange;
|
package/dist/publish/module.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PublishOptionsExtended } from './type';
|
|
1
|
+
import type { PublishOptionsExtended } from './type';
|
|
2
2
|
export declare function publish(options: PublishOptionsExtended): Promise<void>;
|
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
|
-
import { PublishOptions } from '../type';
|
|
2
|
-
export type PublishOptionsExtended = {
|
|
1
|
+
import type { PublishOptions } from '../type';
|
|
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.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Options } from 'amqplib';
|
|
2
|
-
import { PublishOptionsExtended } from './type';
|
|
1
|
+
import type { Options } from 'amqplib';
|
|
2
|
+
import type { PublishOptionsExtended } from './type';
|
|
3
3
|
export declare function buildDriverPublishOptions(options: PublishOptionsExtended): Options.Publish;
|
package/dist/publish/utils.js
CHANGED
package/dist/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Options } from 'amqplib';
|
|
2
|
-
import { ConfigInput } from './config';
|
|
3
|
-
import { ExchangeOptions } from './exchange';
|
|
1
|
+
import type { Options } from 'amqplib';
|
|
2
|
+
import type { ConfigInput } from './config';
|
|
3
|
+
import type { ExchangeOptions } from './exchange';
|
|
4
4
|
type CommonOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Config key or object.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amqp-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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,37 +35,25 @@
|
|
|
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.3",
|
|
39
39
|
"amqplib": "^0.10.3",
|
|
40
|
-
"smob": "^
|
|
41
|
-
"uuid": "^9.0.
|
|
40
|
+
"smob": "^1.4.1",
|
|
41
|
+
"uuid": "^9.0.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@commitlint
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
51
|
-
"@tada5hi/eslint-config-typescript": "^1.1.1",
|
|
52
|
-
"@tada5hi/tsconfig": "^0.4.0",
|
|
53
|
-
"@types/jest": "^27.4.1",
|
|
54
|
-
"@types/node": "^18.11.9",
|
|
44
|
+
"@tada5hi/commitlint-config": "^1.1.3",
|
|
45
|
+
"@tada5hi/eslint-config-typescript": "^1.2.6",
|
|
46
|
+
"@tada5hi/semantic-release": "^0.3.0",
|
|
47
|
+
"@tada5hi/tsconfig": "^0.5.0",
|
|
48
|
+
"@types/jest": "^29.5.7",
|
|
49
|
+
"@types/node": "^20.8.10",
|
|
55
50
|
"@types/uuid": "^8.3.4",
|
|
56
|
-
"codecov": "^3.8.3",
|
|
57
|
-
"coveralls": "^3.1.0",
|
|
58
51
|
"cross-env": "^7.0.3",
|
|
59
|
-
"eslint": "^8.
|
|
60
|
-
"husky": "^8.0.
|
|
61
|
-
"jest": "^
|
|
62
|
-
"semantic-release": "^
|
|
63
|
-
"ts-jest": "^
|
|
64
|
-
"typescript": "^
|
|
65
|
-
},
|
|
66
|
-
"config": {
|
|
67
|
-
"commitizen": {
|
|
68
|
-
"path": "@commitlint/cz-commitlint"
|
|
69
|
-
}
|
|
52
|
+
"eslint": "^8.53.0",
|
|
53
|
+
"husky": "^8.0.3",
|
|
54
|
+
"jest": "^29.7.0",
|
|
55
|
+
"semantic-release": "^22.0.7",
|
|
56
|
+
"ts-jest": "^29.1.1",
|
|
57
|
+
"typescript": "^5.2.2"
|
|
70
58
|
}
|
|
71
59
|
}
|
package/release.config.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"
|
|
3
|
-
"@semantic-release/commit-analyzer",
|
|
4
|
-
"@semantic-release/release-notes-generator",
|
|
5
|
-
"@semantic-release/changelog",
|
|
6
|
-
"@semantic-release/npm",
|
|
7
|
-
"@semantic-release/git",
|
|
8
|
-
"@semantic-release/github"
|
|
9
|
-
]
|
|
2
|
+
"extends": "@tada5hi/semantic-release"
|
|
10
3
|
}
|