elasticio-sailor-nodejs 3.0.0-sailor-proxy-dev2 → 3.0.0-sailor-proxy-dev3

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.
@@ -512,7 +512,10 @@ class ProxyClient {
512
512
  log.debug({ incomingMessageId, type, headers }, 'Sending message to proxy');
513
513
  log.trace({ data }, 'Message data to send to proxy');
514
514
  const proxyHeaders = this._createProxyHeaders(headers);
515
- const encryptedData = this.encryptMessageContent(data, headers.protocolVersion);
515
+ // For error messages we send object with encrypted error details, so we don't want to encrypt the whole
516
+ // payload again (see `sendError` method) - we just stringify it. For other message types, we encrypt
517
+ // the content before sending.
518
+ const encryptedData = type === 'error' ? data : this.encryptMessageContent(data, headers.protocolVersion);
516
519
  if (encryptedData.length > this.settings.OUTGOING_MESSAGE_SIZE_LIMIT) {
517
520
  const error = new Error(`Outgoing message size ${encryptedData.length}`
518
521
  + ` exceeds limit of ${this.settings.OUTGOING_MESSAGE_SIZE_LIMIT}.`);
package/lib/sailor.js CHANGED
@@ -35,8 +35,6 @@ class Sailor {
35
35
  //eslint-disable-next-line new-cap
36
36
  this.apiClient = RestApiClient(
37
37
  settings.API_USERNAME,
38
- // TODO find a way to make username and key consistent (without running api tests and looking up
39
- // correct values in MongoDB)
40
38
  settings.API_KEY,
41
39
  {
42
40
  retryCount: settings.API_REQUEST_RETRY_ATTEMPTS,
package/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ node = "18.16.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elasticio-sailor-nodejs",
3
3
  "description": "The official elastic.io library for bootstrapping and executing for Node.js connectors",
4
- "version": "3.0.0-sailor-proxy-dev2",
4
+ "version": "3.0.0-sailor-proxy-dev3",
5
5
  "main": "run.js",
6
6
  "scripts": {
7
7
  "build": "tsc",