@aws-sdk/xhr-http-handler 3.714.0 → 3.723.0

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-cjs/index.js CHANGED
@@ -56,26 +56,33 @@ var EVENTS = {
56
56
  return "before.xhr.send";
57
57
  }
58
58
  };
59
- var _XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter {
60
- constructor(options) {
61
- super();
62
- if (typeof options === "function") {
63
- this.configProvider = options();
64
- } else {
65
- this.config = options ?? {};
66
- this.configProvider = Promise.resolve(this.config);
67
- }
59
+ var XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter {
60
+ static {
61
+ __name(this, "XhrHttpHandler");
68
62
  }
63
+ static EVENTS = EVENTS;
64
+ static ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR";
65
+ config;
66
+ configProvider;
69
67
  /**
70
68
  * @returns the input if it is an HttpHandler of any class,
71
69
  * or instantiates a new instance of this handler.
72
70
  */
73
71
  static create(instanceOrOptions) {
74
- if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") {
72
+ if (typeof instanceOrOptions?.handle === "function") {
75
73
  return instanceOrOptions;
76
74
  }
77
75
  return new _XhrHttpHandler(instanceOrOptions);
78
76
  }
77
+ constructor(options) {
78
+ super();
79
+ if (typeof options === "function") {
80
+ this.configProvider = options();
81
+ } else {
82
+ this.config = options ?? {};
83
+ this.configProvider = Promise.resolve(this.config);
84
+ }
85
+ }
79
86
  updateHttpClientConfig(key, value) {
80
87
  this.config = void 0;
81
88
  this.configProvider = this.configProvider.then((config) => {
@@ -93,7 +100,7 @@ var _XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter {
93
100
  this.config = await this.configProvider;
94
101
  }
95
102
  const requestTimeoutInMs = Number(this.config.requestTimeout) | 0;
96
- if (abortSignal == null ? void 0 : abortSignal.aborted) {
103
+ if (abortSignal?.aborted) {
97
104
  const abortError = new Error("Request aborted");
98
105
  abortError.name = "AbortError";
99
106
  throw abortError;
@@ -143,12 +150,11 @@ var _XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter {
143
150
  break;
144
151
  case XMLHttpRequest.DONE:
145
152
  const body2 = (() => {
146
- var _a;
147
153
  if (isArrayBuffer) {
148
154
  return new Blob([xhr.response]);
149
155
  }
150
156
  if (isText) {
151
- streamCursor !== xhr.responseText.length && ((_a = writer.write) == null ? void 0 : _a.call(writer, streamCursor > 0 ? xhr.responseText.slice(streamCursor) : xhr.responseText));
157
+ streamCursor !== xhr.responseText.length && writer.write?.(streamCursor > 0 ? xhr.responseText.slice(streamCursor) : xhr.responseText);
152
158
  writer.releaseLock();
153
159
  stream.writable.close();
154
160
  return stream.readable;
@@ -236,10 +242,6 @@ var _XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter {
236
242
  };
237
243
  }
238
244
  };
239
- __name(_XhrHttpHandler, "XhrHttpHandler");
240
- _XhrHttpHandler.EVENTS = EVENTS;
241
- _XhrHttpHandler.ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR";
242
- var XhrHttpHandler = _XhrHttpHandler;
243
245
  var isForbiddenRequestHeader = /* @__PURE__ */ __name((header) => {
244
246
  header = header.toLowerCase();
245
247
  if (header.startsWith("proxy-")) {
@@ -17,6 +17,10 @@ const EVENTS = {
17
17
  },
18
18
  };
19
19
  export class XhrHttpHandler extends EventEmitter {
20
+ static EVENTS = EVENTS;
21
+ static ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR";
22
+ config;
23
+ configProvider;
20
24
  static create(instanceOrOptions) {
21
25
  if (typeof instanceOrOptions?.handle === "function") {
22
26
  return instanceOrOptions;
@@ -182,8 +186,6 @@ export class XhrHttpHandler extends EventEmitter {
182
186
  };
183
187
  }
184
188
  }
185
- XhrHttpHandler.EVENTS = EVENTS;
186
- XhrHttpHandler.ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR";
187
189
  const isForbiddenRequestHeader = (header) => {
188
190
  header = header.toLowerCase();
189
191
  if (header.startsWith("proxy-")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/xhr-http-handler",
3
- "version": "3.714.0",
3
+ "version": "3.723.0",
4
4
  "description": "Provides a way to make requests using XMLHttpRequest",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
@@ -20,20 +20,20 @@
20
20
  "module": "./dist-es/index.js",
21
21
  "types": "./dist-types/index.d.ts",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.714.0",
24
- "@smithy/protocol-http": "^4.1.8",
25
- "@smithy/querystring-builder": "^3.0.11",
26
- "@smithy/types": "^3.7.2",
23
+ "@aws-sdk/types": "3.723.0",
24
+ "@smithy/protocol-http": "^5.0.0",
25
+ "@smithy/querystring-builder": "^4.0.0",
26
+ "@smithy/types": "^4.0.0",
27
27
  "events": "3.3.0",
28
28
  "tslib": "^2.6.2"
29
29
  },
30
30
  "devDependencies": {
31
- "@smithy/abort-controller": "^3.1.9",
31
+ "@smithy/abort-controller": "^4.0.0",
32
32
  "@tsconfig/recommended": "1.0.1",
33
33
  "concurrently": "7.0.0",
34
34
  "downlevel-dts": "0.10.1",
35
35
  "rimraf": "3.0.2",
36
- "typescript": "~4.9.5"
36
+ "typescript": "~5.2.2"
37
37
  },
38
38
  "typesVersions": {
39
39
  "<4.0": {