@azure/synapse-monitoring 1.0.0-alpha.20221129.1 → 1.0.0-alpha.20230104.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.js CHANGED
@@ -585,8 +585,9 @@ function serializeBasicTypes(typeName, objectName, value) {
585
585
  !(value instanceof ArrayBuffer) &&
586
586
  !ArrayBuffer.isView(value) &&
587
587
  // File objects count as a type of Blob, so we want to use instanceof explicitly
588
- !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) {
589
- throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or NodeJS.ReadableStream.`);
588
+ !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob) &&
589
+ objectType !== "function") {
590
+ throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, NodeJS.ReadableStream, or () => NodeJS.ReadableStream.`);
590
591
  }
591
592
  }
592
593
  }
@@ -17381,7 +17382,9 @@ class NodeHttpClient {
17381
17382
  // Responses to HEAD must not have a body.
17382
17383
  // If they do return a body, that body must be ignored.
17383
17384
  if (request.method === "HEAD") {
17384
- res.destroy();
17385
+ // call resume() and not destroy() to avoid closing the socket
17386
+ // and losing keep alive
17387
+ res.resume();
17385
17388
  return response;
17386
17389
  }
17387
17390
  responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res;
@@ -18462,7 +18465,14 @@ function getPropertyFromParameterPath(parent, parameterPath) {
18462
18465
  return result;
18463
18466
  }
18464
18467
  const operationRequestMap = new WeakMap();
18468
+ const originalRequestSymbol = Symbol.for("@azure/core-client original request");
18469
+ function hasOriginalRequest(request) {
18470
+ return originalRequestSymbol in request;
18471
+ }
18465
18472
  function getOperationRequestInfo(request) {
18473
+ if (hasOriginalRequest(request)) {
18474
+ return getOperationRequestInfo(request[originalRequestSymbol]);
18475
+ }
18466
18476
  let info = operationRequestMap.get(request);
18467
18477
  if (!info) {
18468
18478
  info = {};
@@ -18544,7 +18554,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
18544
18554
  return parsedResponse;
18545
18555
  }
18546
18556
  const responseSpec = getOperationResponseMap(parsedResponse);
18547
- const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec);
18557
+ const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec, options);
18548
18558
  if (error) {
18549
18559
  throw error;
18550
18560
  }
@@ -18563,7 +18573,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
18563
18573
  : [];
18564
18574
  }
18565
18575
  try {
18566
- parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody");
18576
+ parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
18567
18577
  }
18568
18578
  catch (deserializeError) {
18569
18579
  const restError = new RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
@@ -18589,7 +18599,7 @@ function isOperationSpecEmpty(operationSpec) {
18589
18599
  return (expectedStatusCodes.length === 0 ||
18590
18600
  (expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
18591
18601
  }
18592
- function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
18602
+ function handleErrorResponse(parsedResponse, operationSpec, responseSpec, options) {
18593
18603
  var _a;
18594
18604
  const isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
18595
18605
  const isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
@@ -18636,7 +18646,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
18636
18646
  valueToDeserialize = parsedBody[elementName];
18637
18647
  }
18638
18648
  }
18639
- deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
18649
+ deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody", options);
18640
18650
  }
18641
18651
  const internalError = parsedBody.error || deserializedError || parsedBody;
18642
18652
  error.code = internalError.code;