fastify-rabbitmq 1.4.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/README.md +6 -3
- package/lib/cjs/errors.js +1 -1
- package/lib/cjs/index.js +59 -15
- package/lib/cjs/validation.js +51 -12
- package/lib/esm/decorate.js +0 -1
- package/lib/esm/errors.js +0 -1
- package/lib/esm/index.js +2 -3
- package/lib/esm/types.js +0 -1
- package/lib/esm/validation.js +0 -1
- package/package.json +37 -36
- package/lib/esm/decorate.d.ts +0 -13
- package/lib/esm/decorate.js.map +0 -1
- package/lib/esm/errors.d.ts +0 -14
- package/lib/esm/errors.js.map +0 -1
- package/lib/esm/index.d.ts +0 -26
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/types.d.ts +0 -12
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/validation.d.ts +0 -2
- package/lib/esm/validation.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,19 +5,22 @@ It uses the [rabbitmq-client](https://github.com/cody-greene/node-rabbitmq-clien
|
|
|
5
5
|
|
|
6
6
|
The build exports this to valid ESM and CJS for ease of cross-compatibility.
|
|
7
7
|
|
|
8
|
+
If you are using this NPM package, please consider giving it a :star: star.
|
|
9
|
+
This will increase its visibility and solicit more contribution from the outside.
|
|
10
|
+
|
|
8
11
|
## Table of Contents
|
|
9
12
|
|
|
10
13
|
1. [Install](#install)
|
|
11
14
|
2. [Basic Usage](#basic-usage)
|
|
12
15
|
3. [Full Documentation](#full-documentation)
|
|
13
|
-
1
|
|
16
|
+
1. [Options](#options)
|
|
14
17
|
4. [Acknowledgements](#acknowledgements)
|
|
15
18
|
5. [License](#license)
|
|
16
19
|
|
|
17
20
|
## Install
|
|
18
21
|
|
|
19
|
-
```
|
|
20
|
-
npm
|
|
22
|
+
```
|
|
23
|
+
npm install fastify-rabbitmq
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
## Basic Usage
|
package/lib/cjs/errors.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.errors = void 0;
|
|
7
|
-
|
|
7
|
+
var error_1 = __importDefault(require("@fastify/error"));
|
|
8
8
|
exports.errors = {
|
|
9
9
|
/** Error if there is an invalid option used during registration. */
|
|
10
10
|
FASTIFY_RABBIT_MQ_ERR_INVALID_OPTS: (0, error_1.default)('FASTIFY_RABBIT_MQ_ERR_INVALID_OPTS', 'Invalid options: %s'),
|
package/lib/cjs/index.js
CHANGED
|
@@ -13,27 +13,63 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
16
52
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
54
|
};
|
|
19
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
56
|
exports.decorateFastifyInstance = void 0;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
57
|
+
var fastify_plugin_1 = __importDefault(require("fastify-plugin"));
|
|
58
|
+
var rabbitmq_client_1 = require("rabbitmq-client");
|
|
59
|
+
var errors_js_1 = require("./errors.js");
|
|
60
|
+
var validation_js_1 = require("./validation.js");
|
|
25
61
|
__exportStar(require("./types.js"), exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (typeof namespace !== 'undefined') {
|
|
29
|
-
fastify.log.debug('[fastify-rabbitmq] Namespace: %s', namespace);
|
|
62
|
+
var decorateFastifyInstance = function (fastify, options, connection) {
|
|
63
|
+
var _a = options.namespace, namespace = _a === void 0 ? '' : _a;
|
|
64
|
+
if (typeof namespace !== 'undefined' && namespace !== '') {
|
|
65
|
+
fastify.log.debug('[fastify-rabbitmq] Namespace Attempt: %s', namespace);
|
|
30
66
|
}
|
|
31
67
|
if (typeof namespace !== 'undefined' && namespace !== '') {
|
|
32
68
|
if (typeof fastify.rabbitmq === 'undefined') {
|
|
33
69
|
fastify.decorate('rabbitmq', Object.create(null));
|
|
34
70
|
}
|
|
35
71
|
if (typeof fastify.rabbitmq[namespace] !== 'undefined') {
|
|
36
|
-
throw new errors_js_1.errors.FASTIFY_RABBIT_MQ_ERR_SETUP_ERRORS(
|
|
72
|
+
throw new errors_js_1.errors.FASTIFY_RABBIT_MQ_ERR_SETUP_ERRORS("Already registered with namespace: ".concat(namespace));
|
|
37
73
|
}
|
|
38
74
|
fastify.log.trace('[fastify-rabbitmq] Decorate Fastify with Namespace: %', namespace);
|
|
39
75
|
fastify.rabbitmq[namespace] = connection;
|
|
@@ -67,10 +103,18 @@ exports.decorateFastifyInstance = decorateFastifyInstance;
|
|
|
67
103
|
* @see [https://cody-greene.github.io/node-rabbitmq-client/latest/index.html](https://cody-greene.github.io/node-rabbitmq-client/latest/index.html)
|
|
68
104
|
*
|
|
69
105
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
106
|
+
var fastifyRabbit = (0, fastify_plugin_1.default)(function (fastify, opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
+
var connection, c;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0: return [4 /*yield*/, (0, validation_js_1.validateOpts)(opts)];
|
|
111
|
+
case 1:
|
|
112
|
+
_a.sent();
|
|
113
|
+
connection = opts.connection;
|
|
114
|
+
c = new rabbitmq_client_1.Connection(connection);
|
|
115
|
+
decorateFastifyInstance(fastify, opts, c);
|
|
116
|
+
return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}); });
|
|
76
120
|
exports.default = fastifyRabbit;
|
package/lib/cjs/validation.js
CHANGED
|
@@ -1,17 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.validateOpts = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// Mandatory
|
|
11
|
-
if (typeof options.connection !== 'undefined') {
|
|
12
|
-
if (typeof options.connection !== 'object') {
|
|
13
|
-
// we need to do some sort of check here to make sure RabbitMQOptions is "valid"
|
|
40
|
+
var errors_js_1 = require("./errors.js");
|
|
41
|
+
var validateOpts = function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
// Mandatory
|
|
44
|
+
if (typeof options.connection === 'undefined') {
|
|
45
|
+
throw new errors_js_1.errors.FASTIFY_RABBIT_MQ_ERR_INVALID_OPTS('connection or findServers must be defined.');
|
|
14
46
|
}
|
|
15
|
-
|
|
16
|
-
|
|
47
|
+
// Mandatory
|
|
48
|
+
if (typeof options.connection !== 'undefined') {
|
|
49
|
+
if (typeof options.connection !== 'object') {
|
|
50
|
+
// we need to do some sort of check here to make sure RabbitMQOptions is "valid"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
});
|
|
55
|
+
}); };
|
|
17
56
|
exports.validateOpts = validateOpts;
|
package/lib/esm/decorate.js
CHANGED
package/lib/esm/errors.js
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { validateOpts } from './validation.js';
|
|
|
5
5
|
export * from './types.js';
|
|
6
6
|
const decorateFastifyInstance = (fastify, options, connection) => {
|
|
7
7
|
const { namespace = '' } = options;
|
|
8
|
-
if (typeof namespace !== 'undefined') {
|
|
9
|
-
fastify.log.debug('[fastify-rabbitmq] Namespace: %s', namespace);
|
|
8
|
+
if (typeof namespace !== 'undefined' && namespace !== '') {
|
|
9
|
+
fastify.log.debug('[fastify-rabbitmq] Namespace Attempt: %s', namespace);
|
|
10
10
|
}
|
|
11
11
|
if (typeof namespace !== 'undefined' && namespace !== '') {
|
|
12
12
|
if (typeof fastify.rabbitmq === 'undefined') {
|
|
@@ -54,4 +54,3 @@ const fastifyRabbit = fp(async (fastify, opts) => {
|
|
|
54
54
|
});
|
|
55
55
|
export default fastifyRabbit;
|
|
56
56
|
export { decorateFastifyInstance };
|
|
57
|
-
//# sourceMappingURL=index.js.map
|
package/lib/esm/types.js
CHANGED
package/lib/esm/validation.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastify-rabbitmq",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A Fastify RabbitMQ Plugin Developed in Pure TypeScript.",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -14,31 +14,30 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"lib
|
|
17
|
+
"lib/"
|
|
18
18
|
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20.0.0"
|
|
21
|
+
},
|
|
19
22
|
"scripts": {
|
|
20
23
|
"clean": "rm -rf lib coverage",
|
|
21
|
-
"build": "tsc && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && ./bin/build-types.sh",
|
|
22
|
-
"build:watch": "tsc -w",
|
|
23
|
-
"
|
|
24
|
-
"lint
|
|
24
|
+
"build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && ./bin/build-types.sh",
|
|
25
|
+
"build:watch": "tsc -p tsconfig.esm.json -w",
|
|
26
|
+
"npmPkgJsonLint": "npmPkgJsonLint .",
|
|
27
|
+
"lint": "npmPkgJsonLint . && ts-standard | snazzy",
|
|
28
|
+
"lint:fix": "npmPkgJsonLint . && ts-standard --fix | snazzy",
|
|
25
29
|
"pack": "npm pack",
|
|
26
|
-
"prepublishOnly": "npm run clean && npm run build && npm run
|
|
27
|
-
"test": "
|
|
28
|
-
"test:
|
|
29
|
-
"test:
|
|
30
|
-
"test:coverage": "
|
|
30
|
+
"prepublishOnly": "npm run clean && npm run build && npm run pack",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:verbose": "vitest run --reporter verbose",
|
|
33
|
+
"test:watch": "vitest watch",
|
|
34
|
+
"test:coverage": "vitest --coverage",
|
|
31
35
|
"typedoc": "typedoc",
|
|
32
36
|
"typedoc:watch": "typedoc -watch",
|
|
33
37
|
"semantic-release": "semantic-release",
|
|
34
38
|
"semantic-release:dry-run": "semantic-release --dry-run",
|
|
35
|
-
"update": "npx npm-check-updates -u && npm run update:post-update",
|
|
36
|
-
"update:
|
|
37
|
-
"update:minor": "npx npm-check-updates --target minor -u && npm run update:post-update",
|
|
38
|
-
"update:newest": "npx npm-check-updates --target newest",
|
|
39
|
-
"update:patch": "npx npm-check-updates --target patch",
|
|
40
|
-
"update:semver": "npx npm-check-updates --target semver",
|
|
41
|
-
"update:post-update": "npm install && npm run test:ci"
|
|
39
|
+
"update": "npx npm-check-updates -u --enginesNode && npm run update:post-update",
|
|
40
|
+
"update:post-update": "npm install && npm run test"
|
|
42
41
|
},
|
|
43
42
|
"repository": {
|
|
44
43
|
"type": "git",
|
|
@@ -60,31 +59,33 @@
|
|
|
60
59
|
"dependencies": {
|
|
61
60
|
"@fastify/error": "^3.4.1",
|
|
62
61
|
"fastify-plugin": "^4.5.1",
|
|
63
|
-
"rabbitmq-client": "^4.
|
|
62
|
+
"rabbitmq-client": "^4.5.1"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@semantic-release/changelog": "^6.0.3",
|
|
67
|
-
"@semantic-release/commit-analyzer": "^11.1.0",
|
|
68
66
|
"@semantic-release/git": "^10.0.1",
|
|
69
|
-
"@semantic-release
|
|
70
|
-
"@
|
|
71
|
-
"@types/
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"fastify": "^4.
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"npm-check-updates": "^16.14.12",
|
|
67
|
+
"@the-rabbit-hole/semantic-release-config": "^1.5.0",
|
|
68
|
+
"@types/node": "^20.11.24",
|
|
69
|
+
"@types/randomstring": "^1.1.12",
|
|
70
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
71
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
72
|
+
"@vitest/ui": "^1.3.1",
|
|
73
|
+
"fastify": "^4.26.1",
|
|
74
|
+
"npm-check-updates": "^16.14.15",
|
|
75
|
+
"npm-package-json-lint": "^7.1.0",
|
|
79
76
|
"pre-commit": "^1.2.2",
|
|
80
|
-
"semantic-release": "^
|
|
77
|
+
"semantic-release": "^23.0.2",
|
|
81
78
|
"snazzy": "^9.0.0",
|
|
82
|
-
"ts-jest": "^29.1.1",
|
|
83
79
|
"ts-node": "^10.9.2",
|
|
84
80
|
"ts-standard": "^12.0.2",
|
|
85
|
-
"tsd": "^0.30.
|
|
86
|
-
"typedoc": "^0.25.
|
|
87
|
-
"typescript": "^5.3.3"
|
|
81
|
+
"tsd": "^0.30.7",
|
|
82
|
+
"typedoc": "^0.25.9",
|
|
83
|
+
"typescript": "^5.3.3",
|
|
84
|
+
"vitest": "^1.3.1"
|
|
88
85
|
},
|
|
89
|
-
"
|
|
86
|
+
"precommit": [
|
|
87
|
+
"test",
|
|
88
|
+
"build",
|
|
89
|
+
"lint:fix"
|
|
90
|
+
]
|
|
90
91
|
}
|
package/lib/esm/decorate.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ConnectionOptions } from 'rabbitmq-client';
|
|
2
|
-
export interface FastifyRabbitMQOptions {
|
|
3
|
-
/**
|
|
4
|
-
* @since 1.0.0
|
|
5
|
-
* @description Connection String or object pointing to the RabbitMQ Broker Services
|
|
6
|
-
*/
|
|
7
|
-
connection: string | ConnectionOptions;
|
|
8
|
-
/**
|
|
9
|
-
* @since 1.0.0
|
|
10
|
-
* @description To set the custom nNamespace within this plugin instance. Used to register this plugin more than one time.
|
|
11
|
-
*/
|
|
12
|
-
namespace?: string;
|
|
13
|
-
}
|
package/lib/esm/decorate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorate.js","sourceRoot":"","sources":["../../src/decorate.ts"],"names":[],"mappings":""}
|
package/lib/esm/errors.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const errors: {
|
|
2
|
-
/** Error if there is an invalid option used during registration. */
|
|
3
|
-
FASTIFY_RABBIT_MQ_ERR_INVALID_OPTS: import("@fastify/error").FastifyErrorConstructor<{
|
|
4
|
-
code: "FASTIFY_RABBIT_MQ_ERR_INVALID_OPTS";
|
|
5
|
-
}, [any?, any?, any?]>;
|
|
6
|
-
/** Error if there is an setup error of the plugin itself. */
|
|
7
|
-
FASTIFY_RABBIT_MQ_ERR_SETUP_ERRORS: import("@fastify/error").FastifyErrorConstructor<{
|
|
8
|
-
code: "FASTIFY_RABBIT_MQ_ERR_SETUP_ERRORS";
|
|
9
|
-
}, [any?, any?, any?]>;
|
|
10
|
-
/** If an invalid usage error was done, this error would pop up. */
|
|
11
|
-
FASTIFY_RABBIT_MQ_ERR_USAGE: import("@fastify/error").FastifyErrorConstructor<{
|
|
12
|
-
code: "FASTIFY_RABBIT_MQ_ERR_USAGE";
|
|
13
|
-
}, [any?, any?, any?]>;
|
|
14
|
-
};
|
package/lib/esm/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAA;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,oEAAoE;IACpE,kCAAkC,EAAE,WAAW,CAC7C,oCAAoC,EACpC,qBAAqB,CACtB;IACD,6DAA6D;IAC7D,kCAAkC,EAAE,WAAW,CAC7C,oCAAoC,EACpC,iBAAiB,CAClB;IACD,mEAAmE;IACnE,2BAA2B,EAAE,WAAW,CACtC,6BAA6B,EAC7B,iBAAiB,CAClB;CACF,CAAA"}
|
package/lib/esm/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FastifyInstance } from 'fastify';
|
|
2
|
-
import { ConnectionOptions } from 'rabbitmq-client';
|
|
3
|
-
import { FastifyRabbitMQOptions } from './decorate.js';
|
|
4
|
-
export * from './types.js';
|
|
5
|
-
declare const decorateFastifyInstance: (fastify: FastifyInstance, options: FastifyRabbitMQOptions, connection: any) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Main Function
|
|
8
|
-
* @since 1.0.0
|
|
9
|
-
* @example
|
|
10
|
-
* This is the basics on how to use this plugin:
|
|
11
|
-
* ```js
|
|
12
|
-
* app.register(fastifyRabbit, {
|
|
13
|
-
* connection: 'amqp://guest:guest@localhost'
|
|
14
|
-
* })
|
|
15
|
-
* ```
|
|
16
|
-
* This will allow you to read from your Fastify "object" and
|
|
17
|
-
* use this plugin at the "rabbitmq" level. From there you can execute and maintain
|
|
18
|
-
* the RabbitMQ Connection using the 'rabbitmq-client' package, which is wrapping around
|
|
19
|
-
* this plugin to execute functions it provides.
|
|
20
|
-
*
|
|
21
|
-
* @see [https://cody-greene.github.io/node-rabbitmq-client/latest/index.html](https://cody-greene.github.io/node-rabbitmq-client/latest/index.html)
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
declare const fastifyRabbit: import("fastify").FastifyPluginCallback<FastifyRabbitMQOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
25
|
-
export default fastifyRabbit;
|
|
26
|
-
export { decorateFastifyInstance, FastifyRabbitMQOptions, ConnectionOptions };
|
package/lib/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC/B,OAAO,EAAqB,UAAU,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAErF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,cAAc,YAAY,CAAA;AAE1B,MAAM,uBAAuB,GAAG,CAAC,OAAwB,EAAE,OAA+B,EAAE,UAAe,EAAQ,EAAE;IACnH,MAAM,EACJ,SAAS,GAAG,EAAE,EACf,GAAG,OAAO,CAAA;IAEX,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAA;IAClE,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;QACzD,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QACnD,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,WAAW,EAAE,CAAC;YACvD,MAAM,IAAI,MAAM,CAAC,kCAAkC,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAA;QACxG,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,uDAAuD,EAAE,SAAS,CAAC,CAAA;QACrF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,UAAU,CAAA;IAC1C,CAAC;SAAM,CAAC;QACN,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YAC5C,MAAM,IAAI,MAAM,CAAC,kCAAkC,CAAC,qBAAqB,CAAC,CAAA;QAC5E,CAAC;IACH,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACxD,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,aAAa,GAAG,EAAE,CAAyB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACvE,MAAM,YAAY,CAAC,IAAI,CAAC,CAAA;IAExB,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;IAE3B,MAAM,CAAC,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAE5C,uBAAuB,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA;AAEF,eAAe,aAAa,CAAA;AAE5B,OAAO,EAAE,uBAAuB,EAA6C,CAAA"}
|
package/lib/esm/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Connection as RabbitMQConnection } from 'rabbitmq-client';
|
|
2
|
-
declare module 'fastify' {
|
|
3
|
-
interface FastifyInstance {
|
|
4
|
-
/** Main Decorator for Fastify **/
|
|
5
|
-
rabbitmq: RabbitMQConnection & fastifyRabbitMQ.FastifyRabbitMQNO;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare namespace fastifyRabbitMQ {
|
|
9
|
-
interface FastifyRabbitMQNO {
|
|
10
|
-
[namespace: string]: RabbitMQConnection;
|
|
11
|
-
}
|
|
12
|
-
}
|
package/lib/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/lib/esm/validation.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAiB,EAAE;IACnF,YAAY;IACZ,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW,EAAE,CAAC;QAC9C,MAAM,IAAI,MAAM,CAAC,kCAAkC,CAAC,4CAA4C,CAAC,CAAA;IACnG,CAAC;IAED,YAAY;IACZ,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW,EAAE,CAAC;QAC9C,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC3C,gFAAgF;QAClF,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
|