@autofleet/rabbit 1.5.4 → 1.5.6

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 {
@@ -145,7 +168,10 @@ class RabbitMq {
145
168
  yield c.assertQueue(queue);
146
169
  yield c.prefetch(limit, true);
147
170
  return Promise.all([
148
- c.consume(queue, (msg) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
171
+ c.consume(queue, (msg) => {
172
+ outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
173
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
174
+ }),
149
175
  ]);
150
176
  }));
151
177
  });
@@ -163,7 +189,10 @@ class RabbitMq {
163
189
  yield c.prefetch(limit, true);
164
190
  return Promise.all([
165
191
  c.bindQueue(queue, exchange, ''),
166
- c.consume(queue, (msg) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
192
+ c.consume(queue, (msg) => {
193
+ outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
194
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
195
+ }),
167
196
  ]);
168
197
  }));
169
198
  });
@@ -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.6",
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 {
@@ -157,7 +158,13 @@ class RabbitMq {
157
158
  await c.assertQueue(queue);
158
159
  await c.prefetch(limit, true);
159
160
  return Promise.all([
160
- c.consume(queue, (msg: any) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
161
+ c.consume(
162
+ queue,
163
+ (msg: any) => {
164
+ newTrace(traceTypes.RABBIT);
165
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
166
+ },
167
+ ),
161
168
  ]);
162
169
  });
163
170
  }
@@ -175,7 +182,13 @@ class RabbitMq {
175
182
  await c.prefetch(limit, true);
176
183
  return Promise.all([
177
184
  c.bindQueue(queue, exchange, ''),
178
- c.consume(queue, (msg: any) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
185
+ c.consume(
186
+ queue,
187
+ (msg: any) => {
188
+ newTrace(traceTypes.RABBIT);
189
+ callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue));
190
+ },
191
+ ),
179
192
  ]);
180
193
  });
181
194
  }
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
  }