@treatwell/moleculer-essentials 2.1.0 → 2.1.1-beta.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/dist/index.cjs CHANGED
@@ -14,6 +14,8 @@ var pino = require('pino');
14
14
  var node_os = require('node:os');
15
15
  var compat = require('es-toolkit/compat');
16
16
  var http = require('http');
17
+ var node_zlib = require('node:zlib');
18
+ var node_util = require('node:util');
17
19
 
18
20
  function getSchemaFromMoleculer(schema) {
19
21
  if (!schema) {
@@ -1376,6 +1378,7 @@ function flattenTags(obj, convertToString = false, path = "") {
1376
1378
  );
1377
1379
  }
1378
1380
 
1381
+ const gzipPromise = node_util.promisify(node_zlib.gzip);
1379
1382
  class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1380
1383
  opts = {};
1381
1384
  queue;
@@ -1436,9 +1439,10 @@ class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1436
1439
  try {
1437
1440
  const res = await fetch(`${this.opts.baseURL}/trace/v1`, {
1438
1441
  method: "post",
1439
- body: JSON.stringify(data),
1442
+ body: await gzipPromise(JSON.stringify(data)),
1440
1443
  headers: {
1441
1444
  "Content-Type": "application/json",
1445
+ "Content-Encoding": "gzip",
1442
1446
  "Api-Key": this.opts.insertKey,
1443
1447
  "Data-Format": "newrelic",
1444
1448
  "Data-Format-Version": "1"
package/dist/index.mjs CHANGED
@@ -14,6 +14,8 @@ import { pino } from 'pino';
14
14
  import { hostname } from 'node:os';
15
15
  import { merge, defaultsDeep, isObject } from 'es-toolkit/compat';
16
16
  import http, { STATUS_CODES } from 'http';
17
+ import { gzip } from 'node:zlib';
18
+ import { promisify } from 'node:util';
17
19
 
18
20
  function getSchemaFromMoleculer(schema) {
19
21
  if (!schema) {
@@ -1376,6 +1378,7 @@ function flattenTags(obj, convertToString = false, path = "") {
1376
1378
  );
1377
1379
  }
1378
1380
 
1381
+ const gzipPromise = promisify(gzip);
1379
1382
  class NewrelicTraceExporter extends TracerExporters.Base {
1380
1383
  opts = {};
1381
1384
  queue;
@@ -1436,9 +1439,10 @@ class NewrelicTraceExporter extends TracerExporters.Base {
1436
1439
  try {
1437
1440
  const res = await fetch(`${this.opts.baseURL}/trace/v1`, {
1438
1441
  method: "post",
1439
- body: JSON.stringify(data),
1442
+ body: await gzipPromise(JSON.stringify(data)),
1440
1443
  headers: {
1441
1444
  "Content-Type": "application/json",
1445
+ "Content-Encoding": "gzip",
1442
1446
  "Api-Key": this.opts.insertKey,
1443
1447
  "Data-Format": "newrelic",
1444
1448
  "Data-Format-Version": "1"
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/treatwell/moleculer-essentials"
8
8
  },
9
- "version": "2.1.0",
9
+ "version": "2.1.1-beta.1",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",