@autofleet/rabbit 1.5.4 → 1.5.5

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/dist/example.js CHANGED
@@ -8,8 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const index_1 = require("./index");
15
+ const index_1 = __importDefault(require("./index"));
13
16
  process.env.RABBITMQ_SERVICE_HOST = '34.76.123.137:5672';
14
17
  const init = () => __awaiter(void 0, void 0, void 0, function* () {
15
18
  const rabbit = new index_1.default();
package/dist/index.js CHANGED
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
22
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
23
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +27,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
27
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
28
  });
10
29
  };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
11
33
  Object.defineProperty(exports, "__esModule", { value: true });
12
34
  /* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/ban-types,@typescript-eslint/no-unused-vars,consistent-return,no-async-promise-executor,no-param-reassign,no-empty */
13
35
  // eslint-disable-next-line max-classes-per-file
14
- const bluebird = require("bluebird");
36
+ const bluebird = __importStar(require("bluebird"));
15
37
  const amqp_connection_manager_1 = require("amqp-connection-manager");
16
38
  const events_1 = require("events");
17
- const rabbitError_1 = require("./rabbitError");
39
+ const outbreak_1 = require("@autofleet/outbreak");
40
+ const rabbitError_1 = __importDefault(require("./rabbitError"));
18
41
  const assertExchangeFanout = (c, exchangeName) => c.assertExchange(exchangeName, 'fanout');
19
42
  const connectionCreatedConst = 'connectionCreated';
20
43
  class RabbitMq {
@@ -138,6 +161,7 @@ class RabbitMq {
138
161
  }
139
162
  consume(queue, callback, options) {
140
163
  return __awaiter(this, void 0, void 0, function* () {
164
+ outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
141
165
  RabbitMq.validateName('queue', queue);
142
166
  const { limit } = (options && options.limit) ? options : { limit: 1 };
143
167
  const channel = yield this.assertChannel();
@@ -152,6 +176,7 @@ class RabbitMq {
152
176
  }
153
177
  consumeFromExchange(queue, exchange, callback, options) {
154
178
  return __awaiter(this, void 0, void 0, function* () {
179
+ outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
155
180
  RabbitMq.validateName('queue', queue);
156
181
  RabbitMq.validateName('exchange', exchange);
157
182
  const { limit } = (options && options.limit) ? options : { limit: 1 };
@@ -8,9 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  /* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/no-unused-vars */
13
- const index_1 = require("./index");
16
+ const index_1 = __importDefault(require("./index"));
14
17
  jest.setTimeout(120000);
15
18
  const rabbit = new index_1.default();
16
19
  const delay = () => new Promise((resolve) => setTimeout(() => resolve(), 500));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -14,6 +14,7 @@
14
14
  "dev": "nodemon"
15
15
  },
16
16
  "dependencies": {
17
+ "@autofleet/outbreak": "0.0.6",
17
18
  "@types/amqp-connection-manager": "^2.0.10",
18
19
  "@types/amqplib": "^0.5.16",
19
20
  "@types/jest": "^22.0.0",
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import * as bluebird from 'bluebird';
4
4
  import { ConfirmChannel } from 'amqplib';
5
5
  import { AmqpConnectionManager, ChannelWrapper, connect } from 'amqp-connection-manager';
6
6
  import { EventEmitter } from 'events';
7
+ import { newTrace, traceTypes } from '@autofleet/outbreak';
7
8
  import RabbitError from './rabbitError';
8
9
 
9
10
  interface ExchangesCache {
@@ -150,6 +151,7 @@ class RabbitMq {
150
151
  }
151
152
 
152
153
  async consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
154
+ newTrace(traceTypes.RABBIT);
153
155
  RabbitMq.validateName('queue', queue);
154
156
  const { limit } = (options && options.limit) ? options : { limit: 1 };
155
157
  const channel: ChannelWrapper = await this.assertChannel();
@@ -163,6 +165,7 @@ class RabbitMq {
163
165
  }
164
166
 
165
167
  async consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
168
+ newTrace(traceTypes.RABBIT);
166
169
  RabbitMq.validateName('queue', queue);
167
170
  RabbitMq.validateName('exchange', exchange);
168
171
  const { limit } = (options && options.limit) ? options : { limit: 1 };
package/tsconfig.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "module": "commonjs",
5
5
  "declaration": true,
6
6
  "outDir": "./dist",
7
- "strict": true
7
+ "strict": true,
8
+ "esModuleInterop": true
8
9
  }
9
10
  }