Socket
Socket
Sign inDemoInstall

@elastic/transport

Package Overview
Dependencies
Maintainers
82
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/transport - npm Package Compare versions

Comparing version 8.1.0-beta.1 to 8.2.0

2

lib/connection/BaseConnection.js

@@ -25,3 +25,3 @@ "use strict";

const util_1 = require("util");
const Diagnostic_1 = (0, tslib_1.__importDefault)(require("../Diagnostic"));
const Diagnostic_1 = tslib_1.__importDefault(require("../Diagnostic"));
const errors_1 = require("../errors");

@@ -28,0 +28,0 @@ const symbols_1 = require("../symbols");

@@ -23,8 +23,8 @@ "use strict";

/* eslint-disable @typescript-eslint/restrict-template-expressions */
const hpagent_1 = (0, tslib_1.__importDefault)(require("hpagent"));
const http_1 = (0, tslib_1.__importDefault)(require("http"));
const https_1 = (0, tslib_1.__importDefault)(require("https"));
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const buffer_1 = (0, tslib_1.__importDefault)(require("buffer"));
const BaseConnection_1 = (0, tslib_1.__importStar)(require("./BaseConnection"));
const hpagent_1 = tslib_1.__importDefault(require("hpagent"));
const http_1 = tslib_1.__importDefault(require("http"));
const https_1 = tslib_1.__importDefault(require("https"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const buffer_1 = tslib_1.__importDefault(require("buffer"));
const BaseConnection_1 = tslib_1.__importStar(require("./BaseConnection"));
const symbols_1 = require("../symbols");

@@ -107,5 +107,8 @@ const stream_1 = require("stream");

}
const abortListener = () => {
request.abort();
};
this._openRequests++;
if (options.signal != null) {
options.signal.addEventListener('abort', () => request.abort(), { once: true });
options.signal.addEventListener('abort', abortListener, { once: true });
}

@@ -247,2 +250,10 @@ const onResponse = (response) => {

request.removeListener('socket', onSocket);
if (options.signal != null) {
if ('removeEventListener' in options.signal) {
options.signal.removeEventListener('abort', abortListener);
}
else {
options.signal.removeListener('abort', abortListener);
}
}
cleanedListeners = true;

@@ -249,0 +260,0 @@ }

@@ -23,8 +23,8 @@ "use strict";

const tslib_1 = require("tslib");
const BaseConnection_1 = (0, tslib_1.__importDefault)(require("./BaseConnection"));
const BaseConnection_1 = tslib_1.__importDefault(require("./BaseConnection"));
exports.BaseConnection = BaseConnection_1.default;
const HttpConnection_1 = (0, tslib_1.__importDefault)(require("./HttpConnection"));
const HttpConnection_1 = tslib_1.__importDefault(require("./HttpConnection"));
exports.HttpConnection = HttpConnection_1.default;
const UndiciConnection_1 = (0, tslib_1.__importDefault)(require("./UndiciConnection"));
const UndiciConnection_1 = tslib_1.__importDefault(require("./UndiciConnection"));
exports.UndiciConnection = UndiciConnection_1.default;
//# sourceMappingURL=index.js.map

@@ -25,5 +25,5 @@ "use strict";

const events_1 = require("events");
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const buffer_1 = (0, tslib_1.__importDefault)(require("buffer"));
const BaseConnection_1 = (0, tslib_1.__importStar)(require("./BaseConnection"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const buffer_1 = tslib_1.__importDefault(require("buffer"));
const BaseConnection_1 = tslib_1.__importStar(require("./BaseConnection"));
const undici_1 = require("undici");

@@ -63,3 +63,3 @@ const errors_1 = require("../errors");

const undiciOptions = {
keepAliveTimeout: 4000,
keepAliveTimeout: 600e3,
keepAliveMaxTimeout: 600e3,

@@ -188,22 +188,13 @@ keepAliveTimeoutThreshold: 1000,

if (isCompressed || isVectorTile) { // eslint-disable-line
const payload = [];
for await (const chunk of response.body) {
payload.push(chunk);
}
return {
statusCode: response.statusCode,
headers: response.headers,
body: Buffer.concat(payload)
body: Buffer.from(await response.body.arrayBuffer())
};
}
else {
let payload = '';
response.body.setEncoding('utf8');
for await (const chunk of response.body) {
payload += chunk;
}
return {
statusCode: response.statusCode,
headers: response.headers,
body: payload
body: await response.body.text()
};

@@ -210,0 +201,0 @@ }

@@ -24,4 +24,4 @@ "use strict";

const url_1 = require("url");
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const Diagnostic_1 = (0, tslib_1.__importDefault)(require("../Diagnostic"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const Diagnostic_1 = tslib_1.__importDefault(require("../Diagnostic"));
const symbols_1 = require("../symbols");

@@ -28,0 +28,0 @@ const connection_1 = require("../connection");

@@ -22,3 +22,3 @@ "use strict";

const tslib_1 = require("tslib");
const BaseConnectionPool_1 = (0, tslib_1.__importDefault)(require("./BaseConnectionPool"));
const BaseConnectionPool_1 = tslib_1.__importDefault(require("./BaseConnectionPool"));
class CloudConnectionPool extends BaseConnectionPool_1.default {

@@ -25,0 +25,0 @@ constructor(opts) {

@@ -22,5 +22,5 @@ "use strict";

const tslib_1 = require("tslib");
const BaseConnectionPool_1 = (0, tslib_1.__importDefault)(require("./BaseConnectionPool"));
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const BaseConnectionPool_1 = tslib_1.__importDefault(require("./BaseConnectionPool"));
const assert_1 = tslib_1.__importDefault(require("assert"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const connection_1 = require("../connection");

@@ -27,0 +27,0 @@ const debug = (0, debug_1.default)('elasticsearch');

@@ -23,10 +23,10 @@ "use strict";

const tslib_1 = require("tslib");
const BaseConnectionPool_1 = (0, tslib_1.__importDefault)(require("./BaseConnectionPool"));
const BaseConnectionPool_1 = tslib_1.__importDefault(require("./BaseConnectionPool"));
exports.BaseConnectionPool = BaseConnectionPool_1.default;
const WeightedConnectionPool_1 = (0, tslib_1.__importDefault)(require("./WeightedConnectionPool"));
const WeightedConnectionPool_1 = tslib_1.__importDefault(require("./WeightedConnectionPool"));
exports.WeightedConnectionPool = WeightedConnectionPool_1.default;
const ClusterConnectionPool_1 = (0, tslib_1.__importDefault)(require("./ClusterConnectionPool"));
const ClusterConnectionPool_1 = tslib_1.__importDefault(require("./ClusterConnectionPool"));
exports.ClusterConnectionPool = ClusterConnectionPool_1.default;
const CloudConnectionPool_1 = (0, tslib_1.__importDefault)(require("./CloudConnectionPool"));
const CloudConnectionPool_1 = tslib_1.__importDefault(require("./CloudConnectionPool"));
exports.CloudConnectionPool = CloudConnectionPool_1.default;
//# sourceMappingURL=index.js.map

@@ -23,3 +23,3 @@ "use strict";

const connection_1 = require("../connection");
const BaseConnectionPool_1 = (0, tslib_1.__importDefault)(require("./BaseConnectionPool"));
const BaseConnectionPool_1 = tslib_1.__importDefault(require("./BaseConnectionPool"));
const noFilter = () => true;

@@ -26,0 +26,0 @@ class WeightedConnectionPool extends BaseConnectionPool_1.default {

@@ -24,4 +24,4 @@ "use strict";

const querystring_1 = require("querystring");
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const secure_json_parse_1 = (0, tslib_1.__importDefault)(require("secure-json-parse"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const secure_json_parse_1 = tslib_1.__importDefault(require("secure-json-parse"));
const errors_1 = require("./errors");

@@ -28,0 +28,0 @@ const symbols_1 = require("./symbols");

@@ -27,1 +27,4 @@ export declare const kSniffEnabled: unique symbol;

export declare const kMaxCompressedResponseSize: unique symbol;
export declare const kJsonContentType: unique symbol;
export declare const kNdjsonContentType: unique symbol;
export declare const kAcceptHeader: unique symbol;

@@ -21,3 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.kMaxCompressedResponseSize = exports.kMaxResponseSize = exports.kCaFingerprint = exports.kProductCheck = exports.kEmitter = exports.kStatus = exports.kJsonOptions = exports.kNodeSelector = exports.kNodeFilter = exports.kHeaders = exports.kDiagnostic = exports.kSerializer = exports.kConnectionPool = exports.kContext = exports.kGenerateRequestId = exports.kOpaqueIdPrefix = exports.kName = exports.kMaxRetries = exports.kCompression = exports.kRequestTimeout = exports.kSniffEndpoint = exports.kSniffOnConnectionFault = exports.kSniffInterval = exports.kIsSniffing = exports.kNextSniff = exports.kSniffEnabled = void 0;
exports.kAcceptHeader = exports.kNdjsonContentType = exports.kJsonContentType = exports.kMaxCompressedResponseSize = exports.kMaxResponseSize = exports.kCaFingerprint = exports.kProductCheck = exports.kEmitter = exports.kStatus = exports.kJsonOptions = exports.kNodeSelector = exports.kNodeFilter = exports.kHeaders = exports.kDiagnostic = exports.kSerializer = exports.kConnectionPool = exports.kContext = exports.kGenerateRequestId = exports.kOpaqueIdPrefix = exports.kName = exports.kMaxRetries = exports.kCompression = exports.kRequestTimeout = exports.kSniffEndpoint = exports.kSniffOnConnectionFault = exports.kSniffInterval = exports.kIsSniffing = exports.kNextSniff = exports.kSniffEnabled = void 0;
exports.kSniffEnabled = Symbol('sniff enabled');

@@ -49,2 +49,5 @@ exports.kNextSniff = Symbol('next sniff');

exports.kMaxCompressedResponseSize = Symbol('max compressed response size');
exports.kJsonContentType = Symbol('json content type');
exports.kNdjsonContentType = Symbol('ndjson content type');
exports.kAcceptHeader = Symbol('accept header');
//# sourceMappingURL=symbols.js.map

@@ -8,3 +8,3 @@ /// <reference types="node" />

import { nodeFilterFn, nodeSelectorFn, generateRequestIdFn, RequestBody, RequestNDBody, TransportResult, Context } from './types';
import { kSniffEnabled, kNextSniff, kIsSniffing, kSniffInterval, kSniffOnConnectionFault, kSniffEndpoint, kRequestTimeout, kCompression, kMaxRetries, kName, kOpaqueIdPrefix, kGenerateRequestId, kContext, kConnectionPool, kSerializer, kDiagnostic, kHeaders, kNodeFilter, kNodeSelector, kProductCheck, kMaxResponseSize, kMaxCompressedResponseSize } from './symbols';
import { kSniffEnabled, kNextSniff, kIsSniffing, kSniffInterval, kSniffOnConnectionFault, kSniffEndpoint, kRequestTimeout, kCompression, kMaxRetries, kName, kOpaqueIdPrefix, kGenerateRequestId, kContext, kConnectionPool, kSerializer, kDiagnostic, kHeaders, kNodeFilter, kNodeSelector, kProductCheck, kMaxResponseSize, kMaxCompressedResponseSize, kJsonContentType, kNdjsonContentType, kAcceptHeader } from './symbols';
export interface TransportOptions {

@@ -31,2 +31,7 @@ diagnostic?: Diagnostic;

maxCompressedResponseSize?: number;
vendoredHeaders?: {
jsonContentType?: string;
ndjsonContentType?: string;
accept?: string;
};
}

@@ -115,2 +120,5 @@ export interface TransportRequestParams {

[kMaxCompressedResponseSize]: number;
[kJsonContentType]: string;
[kNdjsonContentType]: string;
[kAcceptHeader]: string;
static sniffReasons: {

@@ -117,0 +125,0 @@ SNIFF_ON_START: string;

@@ -20,15 +20,15 @@ "use strict";

*/
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
Object.defineProperty(exports, "__esModule", { value: true });
exports.lowerCaseHeaders = exports.generateRequestId = void 0;
const tslib_1 = require("tslib");
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const os_1 = (0, tslib_1.__importDefault)(require("os"));
const zlib_1 = (0, tslib_1.__importDefault)(require("zlib"));
const buffer_1 = (0, tslib_1.__importDefault)(require("buffer"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const os_1 = tslib_1.__importDefault(require("os"));
const zlib_1 = tslib_1.__importDefault(require("zlib"));
const buffer_1 = tslib_1.__importDefault(require("buffer"));
const util_1 = require("util");
const ms_1 = (0, tslib_1.__importDefault)(require("ms"));
const ms_1 = tslib_1.__importDefault(require("ms"));
const errors_1 = require("./errors");
const Diagnostic_1 = (0, tslib_1.__importDefault)(require("./Diagnostic"));
const Serializer_1 = (0, tslib_1.__importDefault)(require("./Serializer"));
const Diagnostic_1 = tslib_1.__importDefault(require("./Diagnostic"));
const Serializer_1 = tslib_1.__importDefault(require("./Serializer"));
const symbols_1 = require("./symbols");

@@ -43,3 +43,3 @@ const { version: clientVersion } = require('../package.json'); // eslint-disable-line

constructor(opts) {
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
Object.defineProperty(this, _a, {

@@ -177,2 +177,20 @@ enumerable: true,

});
Object.defineProperty(this, _y, {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, _z, {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, _0, {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
if (opts.connectionPool == null) {

@@ -194,24 +212,27 @@ throw new errors_1.ConfigurationError('The Connection Pool option is not defined');

}
this[symbols_1.kNodeFilter] = (_y = opts.nodeFilter) !== null && _y !== void 0 ? _y : defaultNodeFilter;
this[symbols_1.kNodeSelector] = (_z = opts.nodeSelector) !== null && _z !== void 0 ? _z : roundRobinSelector();
this[symbols_1.kNodeFilter] = (_1 = opts.nodeFilter) !== null && _1 !== void 0 ? _1 : defaultNodeFilter;
this[symbols_1.kNodeSelector] = (_2 = opts.nodeSelector) !== null && _2 !== void 0 ? _2 : roundRobinSelector();
this[symbols_1.kHeaders] = Object.assign({}, { 'user-agent': userAgent }, opts.compression === true ? { 'accept-encoding': 'gzip,deflate' } : null, lowerCaseHeaders(opts.headers));
this[symbols_1.kDiagnostic] = (_0 = opts.diagnostic) !== null && _0 !== void 0 ? _0 : new Diagnostic_1.default();
this[symbols_1.kDiagnostic] = (_3 = opts.diagnostic) !== null && _3 !== void 0 ? _3 : new Diagnostic_1.default();
this[symbols_1.kConnectionPool] = opts.connectionPool;
this[symbols_1.kSerializer] = (_1 = opts.serializer) !== null && _1 !== void 0 ? _1 : new Serializer_1.default();
this[symbols_1.kContext] = (_2 = opts.context) !== null && _2 !== void 0 ? _2 : null;
this[symbols_1.kGenerateRequestId] = (_3 = opts.generateRequestId) !== null && _3 !== void 0 ? _3 : generateRequestId();
this[symbols_1.kOpaqueIdPrefix] = (_4 = opts.opaqueIdPrefix) !== null && _4 !== void 0 ? _4 : null;
this[symbols_1.kName] = (_5 = opts.name) !== null && _5 !== void 0 ? _5 : 'elastic-transport-js';
this[symbols_1.kSerializer] = (_4 = opts.serializer) !== null && _4 !== void 0 ? _4 : new Serializer_1.default();
this[symbols_1.kContext] = (_5 = opts.context) !== null && _5 !== void 0 ? _5 : null;
this[symbols_1.kGenerateRequestId] = (_6 = opts.generateRequestId) !== null && _6 !== void 0 ? _6 : generateRequestId();
this[symbols_1.kOpaqueIdPrefix] = (_7 = opts.opaqueIdPrefix) !== null && _7 !== void 0 ? _7 : null;
this[symbols_1.kName] = (_8 = opts.name) !== null && _8 !== void 0 ? _8 : 'elastic-transport-js';
this[symbols_1.kMaxRetries] = typeof opts.maxRetries === 'number' ? opts.maxRetries : 3;
this[symbols_1.kCompression] = opts.compression === true;
this[symbols_1.kRequestTimeout] = opts.requestTimeout != null ? toMs(opts.requestTimeout) : 30000;
this[symbols_1.kSniffInterval] = (_6 = opts.sniffInterval) !== null && _6 !== void 0 ? _6 : false;
this[symbols_1.kSniffInterval] = (_9 = opts.sniffInterval) !== null && _9 !== void 0 ? _9 : false;
this[symbols_1.kSniffEnabled] = typeof this[symbols_1.kSniffInterval] === 'number';
this[symbols_1.kNextSniff] = this[symbols_1.kSniffEnabled] ? (Date.now() + this[symbols_1.kSniffInterval]) : 0;
this[symbols_1.kIsSniffing] = false;
this[symbols_1.kSniffOnConnectionFault] = (_7 = opts.sniffOnConnectionFault) !== null && _7 !== void 0 ? _7 : false;
this[symbols_1.kSniffEndpoint] = (_8 = opts.sniffEndpoint) !== null && _8 !== void 0 ? _8 : null;
this[symbols_1.kProductCheck] = (_9 = opts.productCheck) !== null && _9 !== void 0 ? _9 : null;
this[symbols_1.kMaxResponseSize] = (_10 = opts.maxResponseSize) !== null && _10 !== void 0 ? _10 : buffer_1.default.constants.MAX_STRING_LENGTH;
this[symbols_1.kMaxCompressedResponseSize] = (_11 = opts.maxCompressedResponseSize) !== null && _11 !== void 0 ? _11 : buffer_1.default.constants.MAX_LENGTH;
this[symbols_1.kSniffOnConnectionFault] = (_10 = opts.sniffOnConnectionFault) !== null && _10 !== void 0 ? _10 : false;
this[symbols_1.kSniffEndpoint] = (_11 = opts.sniffEndpoint) !== null && _11 !== void 0 ? _11 : null;
this[symbols_1.kProductCheck] = (_12 = opts.productCheck) !== null && _12 !== void 0 ? _12 : null;
this[symbols_1.kMaxResponseSize] = (_13 = opts.maxResponseSize) !== null && _13 !== void 0 ? _13 : buffer_1.default.constants.MAX_STRING_LENGTH;
this[symbols_1.kMaxCompressedResponseSize] = (_14 = opts.maxCompressedResponseSize) !== null && _14 !== void 0 ? _14 : buffer_1.default.constants.MAX_LENGTH;
this[symbols_1.kJsonContentType] = (_16 = (_15 = opts.vendoredHeaders) === null || _15 === void 0 ? void 0 : _15.jsonContentType) !== null && _16 !== void 0 ? _16 : 'application/json';
this[symbols_1.kNdjsonContentType] = (_18 = (_17 = opts.vendoredHeaders) === null || _17 === void 0 ? void 0 : _17.ndjsonContentType) !== null && _18 !== void 0 ? _18 : 'application/x-ndjson';
this[symbols_1.kAcceptHeader] = (_20 = (_19 = opts.vendoredHeaders) === null || _19 === void 0 ? void 0 : _19.accept) !== null && _20 !== void 0 ? _20 : 'application/json, text/plain';
if (opts.sniffOnStart === true) {

@@ -250,3 +271,3 @@ this.sniff({

async request(params, options = {}) {
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
const connectionParams = {

@@ -261,3 +282,3 @@ method: params.method,

options: options,
id: (_y = options.id) !== null && _y !== void 0 ? _y : this[symbols_1.kGenerateRequestId](params, options)
id: (_1 = options.id) !== null && _1 !== void 0 ? _1 : this[symbols_1.kGenerateRequestId](params, options)
},

@@ -269,3 +290,3 @@ name: this[symbols_1.kName],

};
const returnMeta = (_z = options.meta) !== null && _z !== void 0 ? _z : false;
const returnMeta = (_2 = options.meta) !== null && _2 !== void 0 ? _2 : false;
if (this[symbols_1.kContext] != null && options.context != null) {

@@ -288,4 +309,4 @@ meta.context = Object.assign({}, this[symbols_1.kContext], options.context);

get warnings() {
var _y;
return ((_y = this.headers) === null || _y === void 0 ? void 0 : _y.warning) != null
var _1;
return ((_1 = this.headers) === null || _1 === void 0 ? void 0 : _1.warning) != null
? this.headers.warning.split(/(?!\B"[^"]*),(?![^"]*"\B)/)

@@ -299,7 +320,7 @@ : null;

// Furthermore, copying everytime the stream is very a expensive operation.
const maxRetries = isStream((_0 = params.body) !== null && _0 !== void 0 ? _0 : params.bulkBody) ? 0 : (typeof options.maxRetries === 'number' ? options.maxRetries : this[symbols_1.kMaxRetries]);
const maxRetries = isStream((_3 = params.body) !== null && _3 !== void 0 ? _3 : params.bulkBody) ? 0 : (typeof options.maxRetries === 'number' ? options.maxRetries : this[symbols_1.kMaxRetries]);
const compression = typeof options.compression === 'boolean' ? options.compression : this[symbols_1.kCompression];
const signal = options.signal;
const maxResponseSize = (_1 = options.maxResponseSize) !== null && _1 !== void 0 ? _1 : this[symbols_1.kMaxResponseSize];
const maxCompressedResponseSize = (_2 = options.maxCompressedResponseSize) !== null && _2 !== void 0 ? _2 : this[symbols_1.kMaxCompressedResponseSize];
const maxResponseSize = (_4 = options.maxResponseSize) !== null && _4 !== void 0 ? _4 : this[symbols_1.kMaxResponseSize];
const maxCompressedResponseSize = (_5 = options.maxCompressedResponseSize) !== null && _5 !== void 0 ? _5 : this[symbols_1.kMaxCompressedResponseSize];
this[symbols_1.kDiagnostic].emit('serialization', null, result);

@@ -322,10 +343,12 @@ const headers = Object.assign({}, this[symbols_1.kHeaders], lowerCaseHeaders(options.headers));

}
headers['content-type'] = (_6 = headers['content-type']) !== null && _6 !== void 0 ? _6 : this[symbols_1.kJsonContentType];
headers.accept = (_7 = headers.accept) !== null && _7 !== void 0 ? _7 : this[symbols_1.kJsonContentType];
}
else {
if (params.body !== '') {
headers['content-type'] = (_8 = headers['content-type']) !== null && _8 !== void 0 ? _8 : 'text/plain';
headers.accept = (_9 = headers.accept) !== null && _9 !== void 0 ? _9 : this[symbols_1.kAcceptHeader];
}
connectionParams.body = params.body;
}
if (params.body !== '') {
headers['content-type'] = (_3 = headers['content-type']) !== null && _3 !== void 0 ? _3 : 'application/vnd.elasticsearch+json; compatible-with=8';
headers.accept = (_4 = headers.accept) !== null && _4 !== void 0 ? _4 : 'application/vnd.elasticsearch+json; compatible-with=8';
}
// handle ndjson body

@@ -347,4 +370,4 @@ }

if (connectionParams.body !== '') {
headers['content-type'] = (_5 = headers['content-type']) !== null && _5 !== void 0 ? _5 : 'application/vnd.elasticsearch+x-ndjson; compatible-with=8';
headers.accept = (_6 = headers.accept) !== null && _6 !== void 0 ? _6 : 'application/vnd.elasticsearch+json; compatible-with=8';
headers['content-type'] = (_10 = headers['content-type']) !== null && _10 !== void 0 ? _10 : this[symbols_1.kNdjsonContentType];
headers.accept = (_11 = headers.accept) !== null && _11 !== void 0 ? _11 : this[symbols_1.kJsonContentType];
}

@@ -384,3 +407,3 @@ }

}
headers.accept = (_7 = headers.accept) !== null && _7 !== void 0 ? _7 : 'application/vnd.elasticsearch+json; compatible-with=8,text/plain';
headers.accept = (_12 = headers.accept) !== null && _12 !== void 0 ? _12 : this[symbols_1.kAcceptHeader];
connectionParams.headers = headers;

@@ -421,7 +444,7 @@ while (meta.attempts <= maxRetries) {

}
const contentEncoding = ((_8 = headers['content-encoding']) !== null && _8 !== void 0 ? _8 : '').toLowerCase();
const contentEncoding = ((_13 = headers['content-encoding']) !== null && _13 !== void 0 ? _13 : '').toLowerCase();
if (contentEncoding.includes('gzip') || contentEncoding.includes('deflate')) {
body = await unzip(body);
}
const isVectorTile = ((_9 = headers['content-type']) !== null && _9 !== void 0 ? _9 : '').includes('application/vnd.mapbox-vector-tile');
const isVectorTile = ((_14 = headers['content-type']) !== null && _14 !== void 0 ? _14 : '').includes('application/vnd.mapbox-vector-tile');
if (Buffer.isBuffer(body) && !isVectorTile) {

@@ -436,4 +459,4 @@ body = body.toString();

if (headers['content-type'] !== undefined &&
(((_10 = headers['content-type']) === null || _10 === void 0 ? void 0 : _10.includes('application/json')) ||
((_11 = headers['content-type']) === null || _11 === void 0 ? void 0 : _11.includes('application/vnd.elasticsearch+json'))) &&
(((_15 = headers['content-type']) === null || _15 === void 0 ? void 0 : _15.includes('application/json')) ||
((_16 = headers['content-type']) === null || _16 === void 0 ? void 0 : _16.includes('application/vnd.elasticsearch+json'))) &&
!isHead && body !== '') { // eslint-disable-line

@@ -552,3 +575,3 @@ result.body = this[symbols_1.kSerializer].deserialize(body);

exports.default = Transport;
_a = symbols_1.kNodeFilter, _b = symbols_1.kNodeSelector, _c = symbols_1.kHeaders, _d = symbols_1.kDiagnostic, _e = symbols_1.kConnectionPool, _f = symbols_1.kSerializer, _g = symbols_1.kContext, _h = symbols_1.kGenerateRequestId, _j = symbols_1.kOpaqueIdPrefix, _k = symbols_1.kName, _l = symbols_1.kMaxRetries, _m = symbols_1.kCompression, _o = symbols_1.kRequestTimeout, _p = symbols_1.kSniffEnabled, _q = symbols_1.kNextSniff, _r = symbols_1.kIsSniffing, _s = symbols_1.kSniffInterval, _t = symbols_1.kSniffOnConnectionFault, _u = symbols_1.kSniffEndpoint, _v = symbols_1.kProductCheck, _w = symbols_1.kMaxResponseSize, _x = symbols_1.kMaxCompressedResponseSize;
_a = symbols_1.kNodeFilter, _b = symbols_1.kNodeSelector, _c = symbols_1.kHeaders, _d = symbols_1.kDiagnostic, _e = symbols_1.kConnectionPool, _f = symbols_1.kSerializer, _g = symbols_1.kContext, _h = symbols_1.kGenerateRequestId, _j = symbols_1.kOpaqueIdPrefix, _k = symbols_1.kName, _l = symbols_1.kMaxRetries, _m = symbols_1.kCompression, _o = symbols_1.kRequestTimeout, _p = symbols_1.kSniffEnabled, _q = symbols_1.kNextSniff, _r = symbols_1.kIsSniffing, _s = symbols_1.kSniffInterval, _t = symbols_1.kSniffOnConnectionFault, _u = symbols_1.kSniffEndpoint, _v = symbols_1.kProductCheck, _w = symbols_1.kMaxResponseSize, _x = symbols_1.kMaxCompressedResponseSize, _y = symbols_1.kJsonContentType, _z = symbols_1.kNdjsonContentType, _0 = symbols_1.kAcceptHeader;
Object.defineProperty(Transport, "sniffReasons", {

@@ -555,0 +578,0 @@ enumerable: true,

{
"name": "@elastic/transport",
"version": "8.1.0-beta.1",
"version": "8.2.0",
"description": "Transport classes and utilities shared among Node.js Elastic client libraries",

@@ -37,32 +37,31 @@ "main": "index.js",

"engines": {
"node": ">=12"
"node": ">=14"
},
"devDependencies": {
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
"@types/debug": "^4.1.6",
"@types/debug": "^4.1.7",
"@types/ms": "^0.7.31",
"@types/node": "^16.4.1",
"@types/sinonjs__fake-timers": "^6.0.3",
"@types/node": "^17.0.31",
"@types/sinonjs__fake-timers": "^8.1.2",
"@types/stoppable": "^1.1.1",
"@types/tap": "^15.0.5",
"@types/tap": "^15.0.7",
"into-stream": "^6.0.0",
"license-checker": "^25.0.1",
"node-abort-controller": "^2.0.0",
"node-abort-controller": "^3.0.1",
"proxy": "^1.0.2",
"rimraf": "^3.0.2",
"standard": "^16.0.3",
"stoppable": "^1.1.0",
"tap": "^15.0.9",
"ts-node": "^10.1.0",
"ts-standard": "^10.0.0",
"typescript": "^4.3.5",
"tap": "^16.1.0",
"ts-node": "^10.7.0",
"ts-standard": "^11.0.0",
"typescript": "^4.6.4",
"workq": "^3.0.0"
},
"dependencies": {
"debug": "^4.3.2",
"hpagent": "^0.1.2",
"debug": "^4.3.4",
"hpagent": "^1.0.0",
"ms": "^2.1.3",
"secure-json-parse": "^2.4.0",
"tslib": "^2.3.0",
"undici": "^4.7.0"
"tslib": "^2.4.0",
"undici": "^5.1.1"
},

@@ -69,0 +68,0 @@ "tap": {

@@ -17,3 +17,3 @@ <img align="right" width="auto" height="auto" src="https://www.elastic.co/static-res/images/elastic-logo-200.png">

NOTE: The minimum supported version of Node.js is `v12`.
NOTE: The minimum supported version of Node.js is `v14`.

@@ -40,3 +40,5 @@ The client versioning follows the Elastc Stack versioning, this means that

| `8.x` | `December 2019` | `7.11` (early 2021) |
| `10.x` | `April 2021` | `7.12` (mid 2021) |
| `10.x` | `April 2021` | `7.12` (mid 2021) |
| `12.x` | `April 2022` | `8.2` (early 2022) |
| `14.x` | `April 2023` | `8.8` (early 2023) |

@@ -43,0 +45,0 @@ ## API

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc