squiss-ts 4.2.1 → 4.2.2

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/Message.js CHANGED
@@ -23,7 +23,7 @@ class Message extends events_1.EventEmitter {
23
23
  }
24
24
  this._squiss = opts.squiss;
25
25
  this._handled = false;
26
- this.attributes = attributeUtils_1.parseMessageAttributes(opts.msg.MessageAttributes);
26
+ this.attributes = (0, attributeUtils_1.parseMessageAttributes)(opts.msg.MessageAttributes);
27
27
  this.sqsAttributes = opts.msg.Attributes || {};
28
28
  this._s3Retriever = opts.s3Retriever;
29
29
  this._s3Retain = opts.s3Retain;
@@ -49,7 +49,7 @@ class Message extends events_1.EventEmitter {
49
49
  .then((resolvedBody) => {
50
50
  if (this.attributes[gzipUtils_1.GZIP_MARKER] === 1) {
51
51
  delete this.attributes[gzipUtils_1.GZIP_MARKER];
52
- return gzipUtils_1.decompressMessage(resolvedBody);
52
+ return (0, gzipUtils_1.decompressMessage)(resolvedBody);
53
53
  }
54
54
  else {
55
55
  return Promise.resolve(resolvedBody);
@@ -107,13 +107,13 @@ class Message extends events_1.EventEmitter {
107
107
  _getBlobMessage() {
108
108
  const uploadData = JSON.parse(this.body);
109
109
  const s3 = this._s3Retriever();
110
- return s3Utils_1.getBlob(s3, uploadData)
110
+ return (0, s3Utils_1.getBlob)(s3, uploadData)
111
111
  .then((resolvedBody) => {
112
112
  this.emit('s3Download', uploadData);
113
113
  this._squiss.emit('s3Download', { data: uploadData, message: this });
114
114
  if (!this._s3Retain) {
115
115
  this._deleteCallback = () => {
116
- return s3Utils_1.deleteBlob(s3, uploadData)
116
+ return (0, s3Utils_1.deleteBlob)(s3, uploadData)
117
117
  .then(() => {
118
118
  this.emit('s3Delete', uploadData);
119
119
  this._squiss.emit('s3Delete', { data: uploadData, message: this });
package/dist/Squiss.js CHANGED
@@ -341,7 +341,7 @@ class Squiss extends events_1.EventEmitter {
341
341
  this._paused = true;
342
342
  return;
343
343
  }
344
- const params = Utils_1.removeEmptyKeys({
344
+ const params = (0, Utils_1.removeEmptyKeys)({
345
345
  QueueUrl: queueUrl, MaxNumberOfMessages: maxMessagesToGet,
346
346
  WaitTimeSeconds: this._opts.receiveWaitTimeSecs,
347
347
  MessageAttributeNames: this._opts.receiveAttributes,
@@ -420,7 +420,7 @@ class Squiss extends events_1.EventEmitter {
420
420
  this._deleteMessages(delBatch);
421
421
  }
422
422
  _isLargeMessage(message, minSize) {
423
- const messageSize = messageSizeUtils_1.getMessageSize(message);
423
+ const messageSize = (0, messageSizeUtils_1.getMessageSize)(message);
424
424
  if (minSize) {
425
425
  return Promise.resolve(messageSize > minSize);
426
426
  }
@@ -430,17 +430,17 @@ class Squiss extends events_1.EventEmitter {
430
430
  });
431
431
  }
432
432
  _prepareMessageParams(message, delay, attributes) {
433
- const messageStr = ts_type_guards_1.isString(message) ? message : JSON.stringify(message);
433
+ const messageStr = (0, ts_type_guards_1.isString)(message) ? message : JSON.stringify(message);
434
434
  const params = { MessageBody: messageStr, DelaySeconds: delay };
435
435
  attributes = Object.assign({}, attributes);
436
436
  params.MessageGroupId = attributes.FIFO_MessageGroupId;
437
437
  delete attributes.FIFO_MessageGroupId;
438
438
  params.MessageDeduplicationId = attributes.FIFO_MessageDeduplicationId;
439
439
  delete attributes.FIFO_MessageDeduplicationId;
440
- params.MessageAttributes = attributeUtils_1.createMessageAttributes(attributes);
440
+ params.MessageAttributes = (0, attributeUtils_1.createMessageAttributes)(attributes);
441
441
  let getMessagePromise = Promise.resolve(messageStr);
442
- if (this._opts.gzip && (!this._opts.minGzipSize || messageSizeUtils_1.getMessageSize(params) >= this._opts.minGzipSize)) {
443
- getMessagePromise = gzipUtils_1.compressMessage(messageStr);
442
+ if (this._opts.gzip && (!this._opts.minGzipSize || (0, messageSizeUtils_1.getMessageSize)(params) >= this._opts.minGzipSize)) {
443
+ getMessagePromise = (0, gzipUtils_1.compressMessage)(messageStr);
444
444
  params.MessageAttributes = params.MessageAttributes || {};
445
445
  params.MessageAttributes[gzipUtils_1.GZIP_MARKER] = {
446
446
  StringValue: `1`,
@@ -461,7 +461,7 @@ class Squiss extends events_1.EventEmitter {
461
461
  if (!isLarge) {
462
462
  return Promise.resolve(params);
463
463
  }
464
- return s3Utils_1.uploadBlob(this.getS3(), this._opts.s3Bucket, finalMessage, this._opts.s3Prefix || '')
464
+ return (0, s3Utils_1.uploadBlob)(this.getS3(), this._opts.s3Bucket, finalMessage, this._opts.s3Prefix || '')
465
465
  .then((uploadData) => {
466
466
  this.emit('s3Upload', uploadData);
467
467
  params.MessageBody = JSON.stringify(uploadData);
@@ -484,7 +484,7 @@ class Squiss extends events_1.EventEmitter {
484
484
  return this._prepareMessageParams(message, delay, attributes)
485
485
  .then(this._handleLargeMessagePrepare.bind(this))
486
486
  .then((params) => {
487
- return Utils_1.removeEmptyKeys(params);
487
+ return (0, Utils_1.removeEmptyKeys)(params);
488
488
  });
489
489
  }
490
490
  _initSqs() {
@@ -536,7 +536,7 @@ class Squiss extends events_1.EventEmitter {
536
536
  let currentBatchSize = 0;
537
537
  let currentBatchLength = 0;
538
538
  requests.forEach((message) => {
539
- const messageSize = messageSizeUtils_1.getMessageSize(message);
539
+ const messageSize = (0, messageSizeUtils_1.getMessageSize)(message);
540
540
  if (currentBatchLength % AWS_MAX_SEND_BATCH === 0 ||
541
541
  currentBatchSize + messageSize >= queueMaximumMessageSize) {
542
542
  currentBatchLength = currentBatchSize = 0;
@@ -42,19 +42,19 @@ const createAttributeValue = (unparsedAttribute) => {
42
42
  if (unparsedAttribute === undefined || unparsedAttribute === null) {
43
43
  unparsedAttribute = '';
44
44
  }
45
- if (ts_type_guards_1.isNumber(unparsedAttribute)) {
45
+ if ((0, ts_type_guards_1.isNumber)(unparsedAttribute)) {
46
46
  return {
47
47
  DataType: NUMBER_TYPE,
48
48
  StringValue: String(unparsedAttribute),
49
49
  };
50
50
  }
51
- else if (ts_type_guards_1.isString(unparsedAttribute)) {
51
+ else if ((0, ts_type_guards_1.isString)(unparsedAttribute)) {
52
52
  return {
53
53
  DataType: STRING_TYPE,
54
54
  StringValue: unparsedAttribute,
55
55
  };
56
56
  }
57
- else if (ts_type_guards_1.isBoolean(unparsedAttribute)) {
57
+ else if ((0, ts_type_guards_1.isBoolean)(unparsedAttribute)) {
58
58
  return {
59
59
  DataType: STRING_TYPE,
60
60
  StringValue: `${unparsedAttribute}`,
package/dist/gzipUtils.js CHANGED
@@ -6,7 +6,7 @@ const semver_1 = require("semver");
6
6
  let compress;
7
7
  let decompress;
8
8
  /* istanbul ignore next */
9
- if (semver_1.gte(process.version, '10.16.0')) {
9
+ if ((0, semver_1.gte)(process.version, '10.16.0')) {
10
10
  const { brotliCompress, brotliDecompress } = require('zlib');
11
11
  const { promisify } = require('util');
12
12
  compress = promisify(brotliCompress);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSizeInBytes = exports.getMessageSize = void 0;
4
4
  const getMessageSize = (message) => {
5
5
  const msgAttributesSize = getMsgAttributesSize(message.MessageAttributes);
6
- const msgBodySize = exports.getSizeInBytes(message.MessageBody);
6
+ const msgBodySize = (0, exports.getSizeInBytes)(message.MessageBody);
7
7
  return msgAttributesSize + msgBodySize;
8
8
  };
9
9
  exports.getMessageSize = getMessageSize;
@@ -16,12 +16,12 @@ const getMsgAttributesSize = (attributes) => {
16
16
  attributes = attributes || {};
17
17
  for (const attribute in attributes) {
18
18
  if (attributes.hasOwnProperty(attribute)) {
19
- totalMsgAttributesSize += exports.getSizeInBytes(attribute);
19
+ totalMsgAttributesSize += (0, exports.getSizeInBytes)(attribute);
20
20
  const val = attributes[attribute];
21
- totalMsgAttributesSize += exports.getSizeInBytes(val.DataType);
22
- totalMsgAttributesSize += exports.getSizeInBytes(val.StringValue);
21
+ totalMsgAttributesSize += (0, exports.getSizeInBytes)(val.DataType);
22
+ totalMsgAttributesSize += (0, exports.getSizeInBytes)(val.StringValue);
23
23
  // @ts-ignore
24
- totalMsgAttributesSize += exports.getSizeInBytes(val.BinaryValue);
24
+ totalMsgAttributesSize += (0, exports.getSizeInBytes)(val.BinaryValue);
25
25
  }
26
26
  }
27
27
  return totalMsgAttributesSize;
package/dist/s3Utils.js CHANGED
@@ -5,8 +5,8 @@ const uuid_1 = require("uuid");
5
5
  const messageSizeUtils_1 = require("./messageSizeUtils");
6
6
  exports.S3_MARKER = '__SQS_S3__';
7
7
  const uploadBlob = (s3, bucket, blob, prefix) => {
8
- const key = `${prefix}${uuid_1.v4()}`;
9
- const size = messageSizeUtils_1.getSizeInBytes(blob);
8
+ const key = `${prefix}${(0, uuid_1.v4)()}`;
9
+ const size = (0, messageSizeUtils_1.getSizeInBytes)(blob);
10
10
  return s3.putObject({
11
11
  Body: blob,
12
12
  Bucket: bucket,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squiss-ts",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "High-volume SQS poller",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "aws-sdk": "^2.720.0",
51
51
  "linked-list": "^2.1.0",
52
- "semver": "^7.3.5",
52
+ "semver": "7.3.5",
53
53
  "ts-type-guards": "^0.7.0",
54
54
  "uuid": "^8.3.2"
55
55
  },
@@ -61,7 +61,7 @@
61
61
  "@types/mocha": "^8.0.0",
62
62
  "@types/node": "^14.0.26",
63
63
  "@types/proxyquire": "^1.3.28",
64
- "@types/semver": "^7.3.1",
64
+ "@types/semver": "7.3.1",
65
65
  "@types/uuid": "^8.0.0",
66
66
  "chai": "^4.2.0",
67
67
  "chai-as-promised": "^7.1.1",