@dynatrace-sdk/http-client 1.2.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  @dynatrace-sdk/http-client
4
4
 
5
+ ## 1.3.0
6
+
7
+ ### Minor Changes
8
+
9
+ - Added support for native AbortSignal, existing implementation marked as deprecated. APPDEV-8680
10
+
11
+ ## 1.2.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Fix multipart/form-data deserialization in Safari. APPDEV-8496
16
+
5
17
  ## 1.2.0
6
18
 
7
19
  ### Minor Changes
package/cjs/index.js CHANGED
@@ -114,19 +114,19 @@ function getImpl(data, type) {
114
114
  }
115
115
  throw new UnsupportedOperationError(`Unsupported binary type: ${type}.`);
116
116
  }
117
- var Binary = class {
117
+ var Binary = class _Binary {
118
118
  constructor(data) {
119
119
  this.data = data;
120
120
  }
121
121
  static fromText(text) {
122
- return new Binary(new Blob([text]));
122
+ return new _Binary(new Blob([text]));
123
123
  }
124
124
  static fromJson(json) {
125
- return new Binary(new Blob([JSON.stringify(json)]));
125
+ return new _Binary(new Blob([JSON.stringify(json)]));
126
126
  }
127
127
  static from(data) {
128
128
  if (data instanceof Blob || data instanceof ArrayBuffer || data instanceof ReadableStream) {
129
- return new Binary(data);
129
+ return new _Binary(data);
130
130
  } else {
131
131
  throw new UnsupportedOperationError("Unsupported binary type.");
132
132
  }
@@ -298,6 +298,190 @@ var HttpClientRequestError = class extends BaseError {
298
298
  name = "RequestError";
299
299
  };
300
300
 
301
+ // packages/http-client/src/lib/platform/decode-form-data.ts
302
+ function byteToChar(byte) {
303
+ if (byte === void 0)
304
+ return void 0;
305
+ return String.fromCharCode(byte);
306
+ }
307
+ function isTextContentType(contentType) {
308
+ return ["application/json", "text/plain"].includes(String(contentType).toLowerCase());
309
+ }
310
+ function removeEscaping(value) {
311
+ if (!value)
312
+ return value;
313
+ return JSON.parse(`"${value}"`);
314
+ }
315
+ function parseContentDisposition(contentDisposition) {
316
+ const fileName = removeEscaping(
317
+ /form-data;.*filename="((?:[^"\\]|\\.)*)"/gm.exec(contentDisposition)?.[1]
318
+ );
319
+ const name = removeEscaping(
320
+ /form-data;.*(?<!file)name="((?:[^"\\]|\\.)*)"/gm.exec(contentDisposition)?.[1]
321
+ );
322
+ return { name, fileName };
323
+ }
324
+ function parseFormDataBoundary(contentType) {
325
+ return /multipart\/form-data;boundary=(.*)/gm.exec(contentType)?.[1];
326
+ }
327
+ var FormDataParser = class {
328
+ constructor(sourceArray, boundary) {
329
+ this.sourceArray = sourceArray;
330
+ this.boundary = boundary;
331
+ }
332
+ currentChar = null;
333
+ currentByte = null;
334
+ offset = 0;
335
+ utf8Decoder = new TextDecoder("utf-8");
336
+ get previousByte() {
337
+ return this.sourceArray[this.offset - 2];
338
+ }
339
+ get previousChar() {
340
+ return byteToChar(this.previousByte);
341
+ }
342
+ next() {
343
+ if (this.offset >= this.sourceArray.byteLength) {
344
+ this.currentChar = null;
345
+ this.currentByte = null;
346
+ return false;
347
+ }
348
+ this.currentByte = this.sourceArray[this.offset];
349
+ this.currentChar = String.fromCharCode(this.currentByte);
350
+ this.offset++;
351
+ return true;
352
+ }
353
+ charAt(offset) {
354
+ return byteToChar(this.sourceArray[offset]) ?? null;
355
+ }
356
+ nextChar() {
357
+ this.next();
358
+ return this.currentChar;
359
+ }
360
+ nextByte() {
361
+ this.next();
362
+ return this.currentByte;
363
+ }
364
+ get nextTwoChars() {
365
+ return String.fromCharCode(this.sourceArray[this.offset], this.sourceArray[this.offset + 1]);
366
+ }
367
+ findNextBoundaryOffset(startOffset = this.offset) {
368
+ let boundaryIndex = 0;
369
+ let boundaryMatch = false;
370
+ let offset = startOffset;
371
+ let currentChar = this.charAt(offset);
372
+ while (!boundaryMatch) {
373
+ if (currentChar === null) {
374
+ return null;
375
+ }
376
+ if (currentChar === this.boundary[boundaryIndex]) {
377
+ boundaryIndex++;
378
+ if (boundaryIndex === this.boundary.length) {
379
+ boundaryMatch = true;
380
+ }
381
+ } else {
382
+ boundaryIndex = 0;
383
+ }
384
+ offset++;
385
+ currentChar = this.charAt(offset);
386
+ }
387
+ return offset - this.boundary.length;
388
+ }
389
+ skipPastNextBoundary() {
390
+ const nextBoundaryOffset = this.findNextBoundaryOffset();
391
+ if (nextBoundaryOffset === null) {
392
+ return false;
393
+ }
394
+ this.offset = nextBoundaryOffset + this.boundary.length;
395
+ this.currentByte = this.sourceArray[this.offset];
396
+ this.currentChar = String.fromCharCode(this.currentByte);
397
+ const twoChars = this.nextTwoChars;
398
+ if (twoChars == "--") {
399
+ return false;
400
+ } else if (twoChars == "\r\n") {
401
+ this.offset++;
402
+ this.next();
403
+ }
404
+ return true;
405
+ }
406
+ readLine() {
407
+ const lineBuffer = [];
408
+ do {
409
+ const byte = this.nextByte();
410
+ if (byte === null) {
411
+ return null;
412
+ }
413
+ lineBuffer.push(byte);
414
+ } while (this.currentChar !== null && this.currentChar !== "\n" && this.previousChar !== "\r");
415
+ return Uint8Array.from(lineBuffer);
416
+ }
417
+ readSectionHeaders() {
418
+ const headers = {};
419
+ const headerStartOffset = this.offset;
420
+ let isEndOfHeaders = false;
421
+ while (!isEndOfHeaders) {
422
+ const line = this.readLine();
423
+ if (line === null) {
424
+ throw TypeError("Unexpected end of response while parsing headers");
425
+ }
426
+ const headerString = this.utf8Decoder.decode(line);
427
+ if (headerString === "\r\n") {
428
+ isEndOfHeaders = true;
429
+ break;
430
+ }
431
+ const [header, value] = headerString.split(":").map((part) => (part ?? "").trim());
432
+ headers[header.toLowerCase()] = value;
433
+ }
434
+ const headersLength = this.offset - headerStartOffset;
435
+ return {
436
+ headersLength,
437
+ headers
438
+ };
439
+ }
440
+ extractData() {
441
+ const nextBoundaryOffset = this.findNextBoundaryOffset() ?? this.sourceArray.length;
442
+ const lastTwoBytes = String.fromCharCode(
443
+ this.sourceArray[nextBoundaryOffset - 2],
444
+ this.sourceArray[nextBoundaryOffset - 1]
445
+ );
446
+ const endOfDataSection = lastTwoBytes === "\r\n" ? nextBoundaryOffset - 2 : nextBoundaryOffset;
447
+ const data = this.sourceArray.slice(this.offset, endOfDataSection);
448
+ return {
449
+ payloadStartOffset: this.offset,
450
+ payloadEndOffset: endOfDataSection,
451
+ data
452
+ };
453
+ }
454
+ parse() {
455
+ const sections = [];
456
+ while (this.skipPastNextBoundary()) {
457
+ const headersStartOffset = this.offset;
458
+ const { headers } = this.readSectionHeaders();
459
+ const { data, payloadStartOffset, payloadEndOffset } = this.extractData();
460
+ const isText = isTextContentType(headers["content-type"]);
461
+ const { name, fileName } = parseContentDisposition(headers["content-disposition"]);
462
+ sections.push({
463
+ name,
464
+ text: isText ? this.utf8Decoder.decode(data) : void 0,
465
+ file: !isText ? new File([data], fileName ?? "", {
466
+ type: headers["content-type"] ?? "application/octet-stream"
467
+ }) : void 0,
468
+ rawData: data,
469
+ headers,
470
+ headersStartOffset,
471
+ payloadStartOffset,
472
+ payloadEndOffset
473
+ });
474
+ }
475
+ return sections;
476
+ }
477
+ };
478
+ function isAppleBrowser() {
479
+ return /apple/i.test(navigator.vendor);
480
+ }
481
+ function parseMultipartFormDataResponse(response, boundary) {
482
+ return new FormDataParser(response, boundary).parse();
483
+ }
484
+
301
485
  // packages/http-client/src/lib/platform/decode-response-body.ts
302
486
  function emptyReadableStream() {
303
487
  return new ReadableStream({
@@ -319,25 +503,62 @@ async function decodeFormDataResponseBody(response) {
319
503
  if (response.body === null) {
320
504
  return [];
321
505
  } else {
322
- const formData = await response.formData();
323
506
  const result = [];
324
- formData.forEach((value, key) => {
325
- if (value instanceof File) {
326
- result.push({
327
- type: "binary",
328
- name: key,
329
- contentType: value.type,
330
- filename: value.name,
331
- value: Binary.from(value)
332
- });
333
- } else {
334
- result.push({
335
- type: "text",
336
- name: key,
337
- value
338
- });
339
- }
340
- });
507
+ if (isAppleBrowser()) {
508
+ const responseClone = await response.clone();
509
+ const responseBinaryData = new Uint8Array(await responseClone.arrayBuffer());
510
+ const boundary = parseFormDataBoundary(responseClone.headers.get("content-type"));
511
+ const manuallyParsedFormData = parseMultipartFormDataResponse(
512
+ responseBinaryData,
513
+ `--${boundary}`
514
+ );
515
+ const automaticallyParsedFormData = await response.formData();
516
+ automaticallyParsedFormData.forEach((value, key) => {
517
+ const manuallyParsedSection = manuallyParsedFormData.find(({ name }) => name === key);
518
+ if (typeof value === "string" && manuallyParsedSection?.file !== void 0) {
519
+ result.push({
520
+ type: "binary",
521
+ name: key,
522
+ contentType: manuallyParsedSection.headers["content-type"],
523
+ filename: manuallyParsedSection.file.name,
524
+ value: Binary.from(manuallyParsedSection.file)
525
+ });
526
+ } else if (value instanceof File) {
527
+ result.push({
528
+ type: "binary",
529
+ name: key,
530
+ contentType: value.type,
531
+ filename: value.name,
532
+ value: Binary.from(value)
533
+ });
534
+ } else {
535
+ result.push({
536
+ type: "text",
537
+ name: key,
538
+ value
539
+ });
540
+ }
541
+ });
542
+ } else {
543
+ const formData = await response.formData();
544
+ formData.forEach((value, key) => {
545
+ if (value instanceof File) {
546
+ result.push({
547
+ type: "binary",
548
+ name: key,
549
+ contentType: value.type,
550
+ filename: value.name,
551
+ value: Binary.from(value)
552
+ });
553
+ } else {
554
+ result.push({
555
+ type: "text",
556
+ name: key,
557
+ value
558
+ });
559
+ }
560
+ });
561
+ }
341
562
  return result;
342
563
  }
343
564
  }
@@ -550,9 +771,17 @@ var HttpClient = class {
550
771
  this._baseUrl = options?.baseUrl;
551
772
  this._defaultHeaders = options?.defaultHeaders;
552
773
  }
774
+ /**
775
+ * Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
776
+ * @param baseUrl Base URL used in the request path.
777
+ */
553
778
  _setBaseURL(baseUrl) {
554
779
  this._baseUrl = baseUrl;
555
780
  }
781
+ /**
782
+ * Sets HTTP Client Instance defaultHeaders param to the incoming value `defaultHeaders`.
783
+ * @param defaultHeaders HTTP Headers to be used in outgoing requests.
784
+ */
556
785
  _setDefaultHeaders(defaultHeaders) {
557
786
  this._defaultHeaders = defaultHeaders;
558
787
  }
@@ -588,7 +817,7 @@ var OAuthToken = class {
588
817
  this._scope = oauthTokenResponse.scope;
589
818
  this._tokenType = oauthTokenResponse.token_type;
590
819
  this._expirationDate = ((expiresIn) => {
591
- const date = new Date();
820
+ const date = /* @__PURE__ */ new Date();
592
821
  date.setSeconds(date.getSeconds() + expiresIn);
593
822
  return date;
594
823
  })(oauthTokenResponse.expires_in);
@@ -601,7 +830,7 @@ var OAuthToken = class {
601
830
  return this._tokenType;
602
831
  }
603
832
  isExpired() {
604
- return this._expirationDate <= new Date();
833
+ return this._expirationDate <= /* @__PURE__ */ new Date();
605
834
  }
606
835
  get accessToken() {
607
836
  return this._accessToken;
package/docs/DOCS.md CHANGED
@@ -15,7 +15,7 @@ import NpmLogo from '@site/static/img/npm-logo.png';
15
15
  <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client" target="_blank" rel="noopener noreferrer"> <span class="margin-right--xs">@dynatrace-sdk/http-client</span> <img className="no-zoom" width="20px" src={NpmLogo} /> </a>
16
16
  </div>
17
17
  <div class="col" style={{textAlign: 'right'}}>
18
- <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.2.0" target="_blank" rel="noopener noreferrer">v1.2.0</a>
18
+ <a href="https://www.npmjs.com/package/@dynatrace-sdk/http-client/v/1.3.0" target="_blank" rel="noopener noreferrer">v1.3.0</a>
19
19
  </div>
20
20
  </div>
21
21
 
@@ -27,7 +27,6 @@ npm install @dynatrace-sdk/http-client
27
27
  ## Classes
28
28
 
29
29
  ### PlatformBaseError
30
- <!-- default child "Class" -->
31
30
 
32
31
 
33
32
 
@@ -52,18 +51,17 @@ npm install @dynatrace-sdk/http-client
52
51
 
53
52
  #### Properties
54
53
 
55
- | Name | Type |
56
- | --- | --- |
57
- |cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)|
58
- |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|
59
- |name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|
60
- |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|
61
- |prepareStackTrace|Object|
62
- |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|
54
+ | Name | Type | Description |
55
+ | --- | --- | --- |
56
+ |cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| |
57
+ |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
58
+ |name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
59
+ |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
60
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
61
+ |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
63
62
 
64
63
 
65
64
  ### PlatformBinary
66
- <!-- default child "Class" -->
67
65
  Represents an environment agnostic (browser vs node) abstraction layer for binary data.
68
66
 
69
67
 
@@ -76,6 +74,7 @@ Represents an environment agnostic (browser vs node) abstraction layer for binar
76
74
  #### Methods
77
75
 
78
76
 
77
+
79
78
  ##### get
80
79
 
81
80
  <div class="padding-bottom--md">
@@ -107,6 +106,7 @@ Returns the binary data in a form that conforms to the specified type.
107
106
 
108
107
 
109
108
 
109
+
110
110
  ##### from
111
111
 
112
112
  <div class="padding-bottom--md">
@@ -138,6 +138,7 @@ Returns the binary data in a form that conforms to the specified type.
138
138
 
139
139
 
140
140
 
141
+
141
142
  ##### fromJson
142
143
 
143
144
  <div class="padding-bottom--md">
@@ -169,6 +170,7 @@ Returns the binary data in a form that conforms to the specified type.
169
170
 
170
171
 
171
172
 
173
+
172
174
  ##### fromText
173
175
 
174
176
  <div class="padding-bottom--md">
@@ -201,7 +203,6 @@ Returns the binary data in a form that conforms to the specified type.
201
203
 
202
204
 
203
205
  ### PlatformDataTypeError
204
- <!-- default child "Class" -->
205
206
 
206
207
 
207
208
 
@@ -232,12 +233,11 @@ Returns the binary data in a form that conforms to the specified type.
232
233
  |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
233
234
  |name<sup>*required</sup>|"DataTypeError"|The error name. |
234
235
  |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
235
- |prepareStackTrace|Object| |
236
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
236
237
  |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
237
238
 
238
239
 
239
240
  ### PlatformHttpClient
240
- <!-- default child "Class" -->
241
241
  The http client that serves as an environment agnostic (browser vs node) abstraction for making http calls.
242
242
  It handles the authentication of the requests made to the Platform Services and the Serverless Functions.
243
243
 
@@ -272,6 +272,7 @@ Currently, only the requests to the Platform Services and the Serverless Functio
272
272
  #### Methods
273
273
 
274
274
 
275
+
275
276
  ##### _setBaseURL
276
277
 
277
278
  <div class="padding-bottom--md">
@@ -303,6 +304,7 @@ Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
303
304
 
304
305
 
305
306
 
307
+
306
308
  ##### _setDefaultHeaders
307
309
 
308
310
  <div class="padding-bottom--md">
@@ -334,6 +336,7 @@ Sets HTTP Client Instance defaultHeaders param to the incoming value `defaultHea
334
336
 
335
337
 
336
338
 
339
+
337
340
  ##### send
338
341
 
339
342
  <div class="padding-bottom--md">
@@ -376,7 +379,6 @@ Promise&amp;lt;HttpClientResponse&amp;gt; A promise that resolves with the respo
376
379
 
377
380
 
378
381
  ### PlatformHttpClientAbortError
379
- <!-- default child "Class" -->
380
382
  Represents a situation when the request was aborted.
381
383
 
382
384
 
@@ -406,12 +408,11 @@ Represents a situation when the request was aborted.
406
408
  |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
407
409
  |name<sup>*required</sup>|"AbortError"|The error name. |
408
410
  |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
409
- |prepareStackTrace|Object| |
411
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
410
412
  |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
411
413
 
412
414
 
413
415
  ### PlatformHttpClientRequestError
414
- <!-- default child "Class" -->
415
416
  Represents a situation when the request is invalid and cannot be sent.
416
417
 
417
418
 
@@ -441,12 +442,11 @@ Represents a situation when the request is invalid and cannot be sent.
441
442
  |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
442
443
  |name<sup>*required</sup>|"RequestError"|The error name. |
443
444
  |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
444
- |prepareStackTrace|Object| |
445
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
445
446
  |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
446
447
 
447
448
 
448
449
  ### PlatformHttpClientResponse
449
- <!-- default child "Class" -->
450
450
  Represents the response to a request.
451
451
 
452
452
 
@@ -477,28 +477,25 @@ Represents the response to a request.
477
477
  #### Accessors
478
478
 
479
479
  ##### headers
480
- <!-- default child "Accessor" -->
481
480
  The response headers.
482
481
 
483
482
 
484
483
  ##### status
485
- <!-- default child "Accessor" -->
486
484
  The status code of the response.
487
485
 
488
486
 
489
487
  ##### statusText
490
- <!-- default child "Accessor" -->
491
488
  The status message corresponding to the status code.
492
489
 
493
490
 
494
491
  ##### url
495
- <!-- default child "Accessor" -->
496
492
  The URL of the response.
497
493
 
498
494
 
499
495
  #### Methods
500
496
 
501
497
 
498
+
502
499
  ##### body
503
500
 
504
501
  <div class="padding-bottom--md">
@@ -531,7 +528,6 @@ Returns the response body in a form that conforms to the specified response body
531
528
 
532
529
 
533
530
  ### PlatformHttpClientResponseError
534
- <!-- default child "Class" -->
535
531
  Represents a situation when the response status is considered invalid by the status validator.
536
532
 
537
533
 
@@ -565,12 +561,11 @@ Represents a situation when the response status is considered invalid by the sta
565
561
  |requestMethod|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
566
562
  |response<sup>*required</sup>|[HttpClientResponse](#httpclientresponse)|The response. |
567
563
  |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
568
- |prepareStackTrace|Object| |
564
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
569
565
  |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
570
566
 
571
567
 
572
568
  ### PlatformUnsupportedOperationError
573
- <!-- default child "Class" -->
574
569
 
575
570
 
576
571
 
@@ -601,12 +596,11 @@ Represents a situation when the response status is considered invalid by the sta
601
596
  |message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
602
597
  |name<sup>*required</sup>|"UnsupportedOperationError"|The error name. |
603
598
  |stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| |
604
- |prepareStackTrace|Object| |
599
+ |prepareStackTrace|Object|Optional override for formatting stack traces |
605
600
  |stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| |
606
601
 
607
602
 
608
603
  ### _OAuthHttpClient
609
- <!-- default child "Class" -->
610
604
  DO NOT USE - internal use only.
611
605
 
612
606
 
@@ -625,6 +619,7 @@ DO NOT USE - internal use only.
625
619
  #### Methods
626
620
 
627
621
 
622
+
628
623
  ##### send
629
624
 
630
625
  <div class="padding-bottom--md">
@@ -669,7 +664,6 @@ Promise&amp;lt;HttpClientResponse&amp;gt; A promise that resolves with the respo
669
664
  ## Interfaces
670
665
 
671
666
  ### AbortController
672
- <!-- default child "Interface" -->
673
667
  Represents a controller object that allows to abort one or more requests as and when desired.
674
668
 
675
669
 
@@ -677,11 +671,12 @@ Represents a controller object that allows to abort one or more requests as and
677
671
 
678
672
  | Name | Type | Description |
679
673
  | --- | --- | --- |
680
- |signal<sup>*required</sup>|[AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)|Returns an AbortSignal object instance, which can be used to communicate with a request. |
674
+ |signal<sup>*required</sup>|AbortSignal|Returns an AbortSignal object instance, which can be used to communicate with a request. |
681
675
 
682
676
  #### Methods
683
677
 
684
678
 
679
+
685
680
  ##### abort
686
681
 
687
682
  <div class="padding-bottom--md">
@@ -700,52 +695,12 @@ Aborts a request before it has completed.
700
695
 
701
696
 
702
697
 
703
- </div>
704
-
705
-
706
-
707
-
708
- ### AbortSignal
709
- <!-- default child "Interface" -->
710
- Represents a signal object that allows to communicate with the request and abort it using the `AbortController`.
711
-
712
-
713
- #### Properties
714
-
715
- | Name | Type | Description |
716
- | --- | --- | --- |
717
- |aborted<sup>*required</sup>|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|A flag indicating whether the requests the signal is communicating with are aborted. |
718
- |onabort<sup>*required</sup>|null &#124; Object|Invoked when the requests the signal is communicating with are aborted. |
719
- |reason<sup>*required</sup>|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| |
720
-
721
- #### Methods
722
-
723
-
724
- ##### throwIfAborted
725
-
726
- <div class="padding-bottom--md">
727
- <strong>throwIfAborted(): void</strong>
728
-
729
- <div class="padding-left--md">
730
-
731
-
732
-
733
-
734
-
735
- </div>
736
-
737
-
738
-
739
-
740
-
741
-
742
698
  </div>
743
699
 
744
700
 
745
701
 
746
702
 
747
703
  ### BaseError
748
- <!-- default child "Interface" -->
749
704
 
750
705
 
751
706
 
@@ -760,13 +715,13 @@ Represents a signal object that allows to communicate with the request and abort
760
715
 
761
716
 
762
717
  ### Binary
763
- <!-- default child "Interface" -->
764
718
  Represents an environment agnostic (browser vs node) abstraction layer for binary data.
765
719
 
766
720
 
767
721
  #### Methods
768
722
 
769
723
 
724
+
770
725
  ##### get
771
726
 
772
727
  <div class="padding-bottom--md">
@@ -799,7 +754,6 @@ Returns the binary data in a form that conforms to the specified type.
799
754
 
800
755
 
801
756
  ### BinaryFormDataRequestField
802
- <!-- default child "Interface" -->
803
757
  Represents an binary field.
804
758
 
805
759
 
@@ -815,7 +769,6 @@ Represents an binary field.
815
769
 
816
770
 
817
771
  ### BinaryFormDataResponseField
818
- <!-- default child "Interface" -->
819
772
 
820
773
 
821
774
 
@@ -831,7 +784,6 @@ Represents an binary field.
831
784
 
832
785
 
833
786
  ### DataTypeError
834
- <!-- default child "Interface" -->
835
787
 
836
788
 
837
789
 
@@ -846,12 +798,10 @@ Represents an binary field.
846
798
 
847
799
 
848
800
  ### Headers
849
- <!-- default child "Interface" -->
850
801
  Represents http headers.
851
802
 
852
803
 
853
804
  ### HttpClient
854
- <!-- default child "Interface" -->
855
805
  The http client that serves as an environment agnostic (browser vs node) abstraction for making http calls.
856
806
  It handles the authentication of the requests made to the Platform Services and the Serverless Functions.
857
807
 
@@ -861,6 +811,7 @@ Currently, only the requests to the Platform Services and the Serverless Functio
861
811
  #### Methods
862
812
 
863
813
 
814
+
864
815
  ##### send
865
816
 
866
817
  <div class="padding-bottom--md">
@@ -903,7 +854,6 @@ Promise&amp;lt;HttpClientResponse&amp;gt; A promise that resolves with the respo
903
854
 
904
855
 
905
856
  ### HttpClientAbortError
906
- <!-- default child "Interface" -->
907
857
  Represents a situation when the request was aborted.
908
858
 
909
859
 
@@ -918,7 +868,6 @@ Represents a situation when the request was aborted.
918
868
 
919
869
 
920
870
  ### HttpClientNetworkError
921
- <!-- default child "Interface" -->
922
871
  Represents a situation when a network error occurred.
923
872
 
924
873
 
@@ -933,7 +882,6 @@ Represents a situation when a network error occurred.
933
882
 
934
883
 
935
884
  ### HttpClientRequestError
936
- <!-- default child "Interface" -->
937
885
  Represents a situation when the request is invalid and cannot be sent.
938
886
 
939
887
 
@@ -948,7 +896,6 @@ Represents a situation when the request is invalid and cannot be sent.
948
896
 
949
897
 
950
898
  ### HttpClientRequestOptions
951
- <!-- default child "Interface" -->
952
899
  Represents the options used to configure the request.
953
900
 
954
901
 
@@ -965,7 +912,6 @@ Represents the options used to configure the request.
965
912
 
966
913
 
967
914
  ### HttpClientResponse
968
- <!-- default child "Interface" -->
969
915
  Represents the response to a request.
970
916
 
971
917
 
@@ -981,6 +927,7 @@ Represents the response to a request.
981
927
  #### Methods
982
928
 
983
929
 
930
+
984
931
  ##### body
985
932
 
986
933
  <div class="padding-bottom--md">
@@ -1013,7 +960,6 @@ Returns the response body in a form that conforms to the specified response body
1013
960
 
1014
961
 
1015
962
  ### HttpClientResponseError
1016
- <!-- default child "Interface" -->
1017
963
  Represents a situation when the response status is considered invalid by the status validator.
1018
964
 
1019
965
 
@@ -1029,7 +975,6 @@ Represents a situation when the response status is considered invalid by the sta
1029
975
 
1030
976
 
1031
977
  ### JsonFormDataRequestField
1032
- <!-- default child "Interface" -->
1033
978
  Represents a JSON field.
1034
979
 
1035
980
 
@@ -1045,12 +990,11 @@ Represents a JSON field.
1045
990
 
1046
991
 
1047
992
  ### StatusValidator
1048
- <!-- default child "Interface" -->
1049
-
993
+ Represents a function used to validate the response status code.
994
+ If `true` is returned, the status is considered valid (request succeeded), otherwise it&apos;s considered invalid (request failed).
1050
995
 
1051
996
 
1052
997
  ### TextFormDataRequestField
1053
- <!-- default child "Interface" -->
1054
998
  Represents a plain text field. No filename and content type is set.
1055
999
 
1056
1000
 
@@ -1064,7 +1008,6 @@ Represents a plain text field. No filename and content type is set.
1064
1008
 
1065
1009
 
1066
1010
  ### TextFormDataResponseField
1067
- <!-- default child "Interface" -->
1068
1011
 
1069
1012
 
1070
1013
 
@@ -1078,7 +1021,6 @@ Represents a plain text field. No filename and content type is set.
1078
1021
 
1079
1022
 
1080
1023
  ### UnsupportedOperationError
1081
- <!-- default child "Interface" -->
1082
1024
 
1083
1025
 
1084
1026
 
@@ -1093,7 +1035,6 @@ Represents a plain text field. No filename and content type is set.
1093
1035
 
1094
1036
 
1095
1037
  ### _OAuthHttpClientConfig
1096
- <!-- default child "Interface" -->
1097
1038
  DO NOT USE - internal use only.
1098
1039
 
1099
1040
 
@@ -1149,6 +1090,7 @@ DO NOT USE - internal use only.
1149
1090
  ## Functions
1150
1091
 
1151
1092
 
1093
+
1152
1094
  ### isHttpClientAbortError
1153
1095
 
1154
1096
  <div class="padding-bottom--md">
@@ -1180,6 +1122,7 @@ DO NOT USE - internal use only.
1180
1122
 
1181
1123
 
1182
1124
 
1125
+
1183
1126
  ### isHttpClientNetworkError
1184
1127
 
1185
1128
  <div class="padding-bottom--md">
@@ -1211,6 +1154,7 @@ DO NOT USE - internal use only.
1211
1154
 
1212
1155
 
1213
1156
 
1157
+
1214
1158
  ### isHttpClientRequestError
1215
1159
 
1216
1160
  <div class="padding-bottom--md">
@@ -1242,6 +1186,7 @@ DO NOT USE - internal use only.
1242
1186
 
1243
1187
 
1244
1188
 
1189
+
1245
1190
  ### isHttpClientResponseError
1246
1191
 
1247
1192
  <div class="padding-bottom--md">
package/esm/index.js CHANGED
@@ -73,19 +73,19 @@ function getImpl(data, type) {
73
73
  }
74
74
  throw new UnsupportedOperationError(`Unsupported binary type: ${type}.`);
75
75
  }
76
- var Binary = class {
76
+ var Binary = class _Binary {
77
77
  constructor(data) {
78
78
  this.data = data;
79
79
  }
80
80
  static fromText(text) {
81
- return new Binary(new Blob([text]));
81
+ return new _Binary(new Blob([text]));
82
82
  }
83
83
  static fromJson(json) {
84
- return new Binary(new Blob([JSON.stringify(json)]));
84
+ return new _Binary(new Blob([JSON.stringify(json)]));
85
85
  }
86
86
  static from(data) {
87
87
  if (data instanceof Blob || data instanceof ArrayBuffer || data instanceof ReadableStream) {
88
- return new Binary(data);
88
+ return new _Binary(data);
89
89
  } else {
90
90
  throw new UnsupportedOperationError("Unsupported binary type.");
91
91
  }
@@ -257,6 +257,190 @@ var HttpClientRequestError = class extends BaseError {
257
257
  name = "RequestError";
258
258
  };
259
259
 
260
+ // packages/http-client/src/lib/platform/decode-form-data.ts
261
+ function byteToChar(byte) {
262
+ if (byte === void 0)
263
+ return void 0;
264
+ return String.fromCharCode(byte);
265
+ }
266
+ function isTextContentType(contentType) {
267
+ return ["application/json", "text/plain"].includes(String(contentType).toLowerCase());
268
+ }
269
+ function removeEscaping(value) {
270
+ if (!value)
271
+ return value;
272
+ return JSON.parse(`"${value}"`);
273
+ }
274
+ function parseContentDisposition(contentDisposition) {
275
+ const fileName = removeEscaping(
276
+ /form-data;.*filename="((?:[^"\\]|\\.)*)"/gm.exec(contentDisposition)?.[1]
277
+ );
278
+ const name = removeEscaping(
279
+ /form-data;.*(?<!file)name="((?:[^"\\]|\\.)*)"/gm.exec(contentDisposition)?.[1]
280
+ );
281
+ return { name, fileName };
282
+ }
283
+ function parseFormDataBoundary(contentType) {
284
+ return /multipart\/form-data;boundary=(.*)/gm.exec(contentType)?.[1];
285
+ }
286
+ var FormDataParser = class {
287
+ constructor(sourceArray, boundary) {
288
+ this.sourceArray = sourceArray;
289
+ this.boundary = boundary;
290
+ }
291
+ currentChar = null;
292
+ currentByte = null;
293
+ offset = 0;
294
+ utf8Decoder = new TextDecoder("utf-8");
295
+ get previousByte() {
296
+ return this.sourceArray[this.offset - 2];
297
+ }
298
+ get previousChar() {
299
+ return byteToChar(this.previousByte);
300
+ }
301
+ next() {
302
+ if (this.offset >= this.sourceArray.byteLength) {
303
+ this.currentChar = null;
304
+ this.currentByte = null;
305
+ return false;
306
+ }
307
+ this.currentByte = this.sourceArray[this.offset];
308
+ this.currentChar = String.fromCharCode(this.currentByte);
309
+ this.offset++;
310
+ return true;
311
+ }
312
+ charAt(offset) {
313
+ return byteToChar(this.sourceArray[offset]) ?? null;
314
+ }
315
+ nextChar() {
316
+ this.next();
317
+ return this.currentChar;
318
+ }
319
+ nextByte() {
320
+ this.next();
321
+ return this.currentByte;
322
+ }
323
+ get nextTwoChars() {
324
+ return String.fromCharCode(this.sourceArray[this.offset], this.sourceArray[this.offset + 1]);
325
+ }
326
+ findNextBoundaryOffset(startOffset = this.offset) {
327
+ let boundaryIndex = 0;
328
+ let boundaryMatch = false;
329
+ let offset = startOffset;
330
+ let currentChar = this.charAt(offset);
331
+ while (!boundaryMatch) {
332
+ if (currentChar === null) {
333
+ return null;
334
+ }
335
+ if (currentChar === this.boundary[boundaryIndex]) {
336
+ boundaryIndex++;
337
+ if (boundaryIndex === this.boundary.length) {
338
+ boundaryMatch = true;
339
+ }
340
+ } else {
341
+ boundaryIndex = 0;
342
+ }
343
+ offset++;
344
+ currentChar = this.charAt(offset);
345
+ }
346
+ return offset - this.boundary.length;
347
+ }
348
+ skipPastNextBoundary() {
349
+ const nextBoundaryOffset = this.findNextBoundaryOffset();
350
+ if (nextBoundaryOffset === null) {
351
+ return false;
352
+ }
353
+ this.offset = nextBoundaryOffset + this.boundary.length;
354
+ this.currentByte = this.sourceArray[this.offset];
355
+ this.currentChar = String.fromCharCode(this.currentByte);
356
+ const twoChars = this.nextTwoChars;
357
+ if (twoChars == "--") {
358
+ return false;
359
+ } else if (twoChars == "\r\n") {
360
+ this.offset++;
361
+ this.next();
362
+ }
363
+ return true;
364
+ }
365
+ readLine() {
366
+ const lineBuffer = [];
367
+ do {
368
+ const byte = this.nextByte();
369
+ if (byte === null) {
370
+ return null;
371
+ }
372
+ lineBuffer.push(byte);
373
+ } while (this.currentChar !== null && this.currentChar !== "\n" && this.previousChar !== "\r");
374
+ return Uint8Array.from(lineBuffer);
375
+ }
376
+ readSectionHeaders() {
377
+ const headers = {};
378
+ const headerStartOffset = this.offset;
379
+ let isEndOfHeaders = false;
380
+ while (!isEndOfHeaders) {
381
+ const line = this.readLine();
382
+ if (line === null) {
383
+ throw TypeError("Unexpected end of response while parsing headers");
384
+ }
385
+ const headerString = this.utf8Decoder.decode(line);
386
+ if (headerString === "\r\n") {
387
+ isEndOfHeaders = true;
388
+ break;
389
+ }
390
+ const [header, value] = headerString.split(":").map((part) => (part ?? "").trim());
391
+ headers[header.toLowerCase()] = value;
392
+ }
393
+ const headersLength = this.offset - headerStartOffset;
394
+ return {
395
+ headersLength,
396
+ headers
397
+ };
398
+ }
399
+ extractData() {
400
+ const nextBoundaryOffset = this.findNextBoundaryOffset() ?? this.sourceArray.length;
401
+ const lastTwoBytes = String.fromCharCode(
402
+ this.sourceArray[nextBoundaryOffset - 2],
403
+ this.sourceArray[nextBoundaryOffset - 1]
404
+ );
405
+ const endOfDataSection = lastTwoBytes === "\r\n" ? nextBoundaryOffset - 2 : nextBoundaryOffset;
406
+ const data = this.sourceArray.slice(this.offset, endOfDataSection);
407
+ return {
408
+ payloadStartOffset: this.offset,
409
+ payloadEndOffset: endOfDataSection,
410
+ data
411
+ };
412
+ }
413
+ parse() {
414
+ const sections = [];
415
+ while (this.skipPastNextBoundary()) {
416
+ const headersStartOffset = this.offset;
417
+ const { headers } = this.readSectionHeaders();
418
+ const { data, payloadStartOffset, payloadEndOffset } = this.extractData();
419
+ const isText = isTextContentType(headers["content-type"]);
420
+ const { name, fileName } = parseContentDisposition(headers["content-disposition"]);
421
+ sections.push({
422
+ name,
423
+ text: isText ? this.utf8Decoder.decode(data) : void 0,
424
+ file: !isText ? new File([data], fileName ?? "", {
425
+ type: headers["content-type"] ?? "application/octet-stream"
426
+ }) : void 0,
427
+ rawData: data,
428
+ headers,
429
+ headersStartOffset,
430
+ payloadStartOffset,
431
+ payloadEndOffset
432
+ });
433
+ }
434
+ return sections;
435
+ }
436
+ };
437
+ function isAppleBrowser() {
438
+ return /apple/i.test(navigator.vendor);
439
+ }
440
+ function parseMultipartFormDataResponse(response, boundary) {
441
+ return new FormDataParser(response, boundary).parse();
442
+ }
443
+
260
444
  // packages/http-client/src/lib/platform/decode-response-body.ts
261
445
  function emptyReadableStream() {
262
446
  return new ReadableStream({
@@ -278,25 +462,62 @@ async function decodeFormDataResponseBody(response) {
278
462
  if (response.body === null) {
279
463
  return [];
280
464
  } else {
281
- const formData = await response.formData();
282
465
  const result = [];
283
- formData.forEach((value, key) => {
284
- if (value instanceof File) {
285
- result.push({
286
- type: "binary",
287
- name: key,
288
- contentType: value.type,
289
- filename: value.name,
290
- value: Binary.from(value)
291
- });
292
- } else {
293
- result.push({
294
- type: "text",
295
- name: key,
296
- value
297
- });
298
- }
299
- });
466
+ if (isAppleBrowser()) {
467
+ const responseClone = await response.clone();
468
+ const responseBinaryData = new Uint8Array(await responseClone.arrayBuffer());
469
+ const boundary = parseFormDataBoundary(responseClone.headers.get("content-type"));
470
+ const manuallyParsedFormData = parseMultipartFormDataResponse(
471
+ responseBinaryData,
472
+ `--${boundary}`
473
+ );
474
+ const automaticallyParsedFormData = await response.formData();
475
+ automaticallyParsedFormData.forEach((value, key) => {
476
+ const manuallyParsedSection = manuallyParsedFormData.find(({ name }) => name === key);
477
+ if (typeof value === "string" && manuallyParsedSection?.file !== void 0) {
478
+ result.push({
479
+ type: "binary",
480
+ name: key,
481
+ contentType: manuallyParsedSection.headers["content-type"],
482
+ filename: manuallyParsedSection.file.name,
483
+ value: Binary.from(manuallyParsedSection.file)
484
+ });
485
+ } else if (value instanceof File) {
486
+ result.push({
487
+ type: "binary",
488
+ name: key,
489
+ contentType: value.type,
490
+ filename: value.name,
491
+ value: Binary.from(value)
492
+ });
493
+ } else {
494
+ result.push({
495
+ type: "text",
496
+ name: key,
497
+ value
498
+ });
499
+ }
500
+ });
501
+ } else {
502
+ const formData = await response.formData();
503
+ formData.forEach((value, key) => {
504
+ if (value instanceof File) {
505
+ result.push({
506
+ type: "binary",
507
+ name: key,
508
+ contentType: value.type,
509
+ filename: value.name,
510
+ value: Binary.from(value)
511
+ });
512
+ } else {
513
+ result.push({
514
+ type: "text",
515
+ name: key,
516
+ value
517
+ });
518
+ }
519
+ });
520
+ }
300
521
  return result;
301
522
  }
302
523
  }
@@ -513,9 +734,17 @@ var HttpClient = class {
513
734
  this._baseUrl = options?.baseUrl;
514
735
  this._defaultHeaders = options?.defaultHeaders;
515
736
  }
737
+ /**
738
+ * Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
739
+ * @param baseUrl Base URL used in the request path.
740
+ */
516
741
  _setBaseURL(baseUrl) {
517
742
  this._baseUrl = baseUrl;
518
743
  }
744
+ /**
745
+ * Sets HTTP Client Instance defaultHeaders param to the incoming value `defaultHeaders`.
746
+ * @param defaultHeaders HTTP Headers to be used in outgoing requests.
747
+ */
519
748
  _setDefaultHeaders(defaultHeaders) {
520
749
  this._defaultHeaders = defaultHeaders;
521
750
  }
@@ -551,7 +780,7 @@ var OAuthToken = class {
551
780
  this._scope = oauthTokenResponse.scope;
552
781
  this._tokenType = oauthTokenResponse.token_type;
553
782
  this._expirationDate = ((expiresIn) => {
554
- const date = new Date();
783
+ const date = /* @__PURE__ */ new Date();
555
784
  date.setSeconds(date.getSeconds() + expiresIn);
556
785
  return date;
557
786
  })(oauthTokenResponse.expires_in);
@@ -564,7 +793,7 @@ var OAuthToken = class {
564
793
  return this._tokenType;
565
794
  }
566
795
  isExpired() {
567
- return this._expirationDate <= new Date();
796
+ return this._expirationDate <= /* @__PURE__ */ new Date();
568
797
  }
569
798
  get accessToken() {
570
799
  return this._accessToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/http-client",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "An environment agnostic (browser/deno vs nodejs) abstraction layer for making HTTP calls.",
5
5
  "license": "Apache-2.0",
6
6
  "dependencies": {
@@ -2,5 +2,5 @@ import * as types from '../types';
2
2
  declare const AbortController: {
3
3
  new (): types.AbortController;
4
4
  };
5
- declare type AbortController = InstanceType<typeof AbortController>;
5
+ type AbortController = InstanceType<typeof AbortController>;
6
6
  export { AbortController };
@@ -2,5 +2,5 @@ import * as types from '../types';
2
2
  declare const AbortSignal: {
3
3
  new (): types.AbortSignal;
4
4
  };
5
- declare type AbortSignal = InstanceType<typeof AbortSignal>;
5
+ type AbortSignal = InstanceType<typeof AbortSignal>;
6
6
  export { AbortSignal };
@@ -0,0 +1,48 @@
1
+ export declare function isTextContentType(contentType: string): boolean;
2
+ export declare function parseContentDisposition(contentDisposition: string): {
3
+ name: string;
4
+ fileName: string | undefined;
5
+ };
6
+ export declare function parseFormDataBoundary(contentType: string): string | undefined;
7
+ export interface FormDataSection {
8
+ name: string;
9
+ headers: Record<string, string>;
10
+ rawData: Uint8Array;
11
+ text?: string;
12
+ file?: File;
13
+ fileName?: string;
14
+ payloadStartOffset?: number;
15
+ payloadEndOffset?: number;
16
+ headersStartOffset?: number;
17
+ }
18
+ export declare class FormDataParser {
19
+ private sourceArray;
20
+ private boundary;
21
+ private currentChar;
22
+ private currentByte;
23
+ offset: number;
24
+ private utf8Decoder;
25
+ constructor(sourceArray: Uint8Array, boundary: string);
26
+ get previousByte(): number | undefined;
27
+ get previousChar(): string | undefined;
28
+ private next;
29
+ charAt(offset: number): string | null;
30
+ nextChar(): string | null;
31
+ nextByte(): number | null;
32
+ get nextTwoChars(): string;
33
+ findNextBoundaryOffset(startOffset?: number): number | null;
34
+ skipPastNextBoundary(): boolean;
35
+ readLine(): Uint8Array | null;
36
+ readSectionHeaders(): {
37
+ headersLength: number;
38
+ headers: Record<string, string>;
39
+ };
40
+ extractData(): {
41
+ payloadStartOffset: number;
42
+ payloadEndOffset: number;
43
+ data: Uint8Array;
44
+ };
45
+ parse(): FormDataSection[];
46
+ }
47
+ export declare function isAppleBrowser(): boolean;
48
+ export declare function parseMultipartFormDataResponse(response: Uint8Array, boundary: string): FormDataSection[];
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Represents a signal object that allows to communicate with the request and abort it using the `AbortController`.
3
+ * @deprecated Will be removed from HttpClient. We encourage using native interface for AbortSignal.
3
4
  */
4
- export interface AbortSignal extends EventTarget {
5
+ interface HttpClientAbortSignal extends EventTarget {
5
6
  readonly reason: any;
6
7
  throwIfAborted(): void;
7
8
  /**
@@ -13,3 +14,5 @@ export interface AbortSignal extends EventTarget {
13
14
  */
14
15
  onabort: ((this: AbortSignal, event: Event) => void) | null;
15
16
  }
17
+ export type AbortSignal = HttpClientAbortSignal | globalThis.AbortSignal;
18
+ export {};
@@ -4,7 +4,7 @@ import type * as stream from 'stream';
4
4
  /**
5
5
  * Mapping between the data type names and types.
6
6
  */
7
- export declare type DataTypes = {
7
+ export type DataTypes = {
8
8
  /**
9
9
  * A text type.
10
10
  */
@@ -76,8 +76,8 @@ export interface BinaryFormDataRequestField {
76
76
  /**
77
77
  * Represents a multipart/form-data field.
78
78
  */
79
- export declare type FormDataRequestField = TextFormDataRequestField | JsonFormDataRequestField | BinaryFormDataRequestField;
79
+ export type FormDataRequestField = TextFormDataRequestField | JsonFormDataRequestField | BinaryFormDataRequestField;
80
80
  /**
81
81
  * Represents a multipart/form-data body.
82
82
  */
83
- export declare type FormDataRequestBody = Array<FormDataRequestField>;
83
+ export type FormDataRequestBody = Array<FormDataRequestField>;
@@ -11,5 +11,5 @@ export interface BinaryFormDataResponseField {
11
11
  filename: string;
12
12
  value: Binary;
13
13
  }
14
- export declare type FormDataResponseField = TextFormDataResponseField | BinaryFormDataResponseField;
15
- export declare type FormDataResponseBody = Array<FormDataResponseField>;
14
+ export type FormDataResponseField = TextFormDataResponseField | BinaryFormDataResponseField;
15
+ export type FormDataResponseBody = Array<FormDataResponseField>;
@@ -6,7 +6,7 @@ import { Binary } from './binary';
6
6
  /**
7
7
  * Mapping between the request body type names and types.
8
8
  */
9
- export declare type RequestBodyTypes = {
9
+ export type RequestBodyTypes = {
10
10
  /**
11
11
  * A text request body type.
12
12
  */
@@ -6,7 +6,7 @@ import { Binary } from './binary';
6
6
  /**
7
7
  * Mapping between the response body type names and types.
8
8
  */
9
- export declare type ResponseBodyTypes = {
9
+ export type ResponseBodyTypes = {
10
10
  /**
11
11
  * A text response body type.
12
12
  */