@smithy/core 3.24.0 → 3.24.2

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.
Files changed (70) hide show
  1. package/dist-cjs/submodules/cbor/index.js +1 -1
  2. package/dist-cjs/submodules/schema/index.js +12 -0
  3. package/dist-cjs/submodules/serde/index.browser.js +163 -210
  4. package/dist-cjs/submodules/serde/index.js +220 -122
  5. package/dist-cjs/submodules/serde/index.native.js +163 -210
  6. package/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
  7. package/dist-es/submodules/schema/TypeRegistry.js +12 -0
  8. package/dist-es/submodules/serde/index.browser.js +16 -9
  9. package/dist-es/submodules/serde/index.js +14 -7
  10. package/dist-es/submodules/serde/index.native.js +14 -5
  11. package/dist-es/submodules/serde/util-base64/toBase64.browser.js +1 -1
  12. package/dist-es/submodules/serde/util-stream/blob/Uint8ArrayBlobAdapter.js +19 -21
  13. package/dist-es/submodules/serde/util-stream/checksum/createChecksumStream.browser.js +1 -1
  14. package/dist-es/submodules/serde/util-stream/sdk-stream-mixin.browser.js +2 -2
  15. package/dist-es/submodules/serde/util-stream/stream-collector.browser.js +1 -1
  16. package/dist-es/submodules/serde/util-utf8/toUint8Array.browser.js +10 -0
  17. package/dist-es/submodules/serde/uuid/v4.js +30 -29
  18. package/dist-types/pagination/createPaginator.d.ts +2 -2
  19. package/dist-types/request-builder/requestBuilder.d.ts +2 -1
  20. package/dist-types/setFeature.d.ts +3 -3
  21. package/dist-types/submodules/cbor/cbor-decode.d.ts +4 -3
  22. package/dist-types/submodules/cbor/cbor-types.d.ts +4 -4
  23. package/dist-types/submodules/cbor/cbor.d.ts +3 -4
  24. package/dist-types/submodules/checksum/chunked-blob-reader/chunked-blob-reader.d.ts +2 -1
  25. package/dist-types/submodules/client/smithy-client/client.d.ts +2 -5
  26. package/dist-types/submodules/client/smithy-client/default-error-handler.d.ts +2 -2
  27. package/dist-types/submodules/client/smithy-client/emitWarningIfUnsupportedVersion.d.ts +1 -2
  28. package/dist-types/submodules/client/smithy-client/exceptions.d.ts +2 -2
  29. package/dist-types/submodules/client/smithy-client/extensions/defaultExtensionConfiguration.d.ts +7 -7
  30. package/dist-types/submodules/client/smithy-client/get-array-if-single-item.d.ts +2 -2
  31. package/dist-types/submodules/client/smithy-client/get-value-from-text-node.d.ts +2 -2
  32. package/dist-types/submodules/client/smithy-client/object-mapping.d.ts +22 -21
  33. package/dist-types/submodules/client/smithy-client/ser-utils.d.ts +1 -2
  34. package/dist-types/submodules/client/smithy-client/serde-json.d.ts +1 -3
  35. package/dist-types/submodules/client/util-waiter/utils/validate.d.ts +2 -2
  36. package/dist-types/submodules/config/config-resolver/endpointsConfig/resolveEndpointsConfig.d.ts +2 -2
  37. package/dist-types/submodules/config/property-provider/CredentialsProviderError.d.ts +2 -3
  38. package/dist-types/submodules/config/property-provider/ProviderError.d.ts +2 -3
  39. package/dist-types/submodules/config/property-provider/TokenProviderError.d.ts +2 -3
  40. package/dist-types/submodules/config/property-provider/chain.d.ts +2 -3
  41. package/dist-types/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.d.ts +2 -1
  42. package/dist-types/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.d.ts +6 -5
  43. package/dist-types/submodules/endpoints/util-endpoints/cache/EndpointCache.d.ts +2 -2
  44. package/dist-types/submodules/endpoints/util-endpoints/getEndpointUrlConfig.d.ts +2 -1
  45. package/dist-types/submodules/protocols/collect-stream-body.d.ts +2 -2
  46. package/dist-types/submodules/protocols/extended-encode-uri-component.d.ts +2 -2
  47. package/dist-types/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +4 -4
  48. package/dist-types/submodules/protocols/protocol-http/httpHandler.d.ts +2 -5
  49. package/dist-types/submodules/protocols/requestBuilder.d.ts +2 -1
  50. package/dist-types/submodules/retry/util-retry/constants.d.ts +4 -4
  51. package/dist-types/submodules/serde/date-utils.d.ts +7 -19
  52. package/dist-types/submodules/serde/index.browser.d.ts +15 -9
  53. package/dist-types/submodules/serde/index.d.ts +11 -7
  54. package/dist-types/submodules/serde/index.native.d.ts +9 -5
  55. package/dist-types/submodules/serde/lazy-json.d.ts +4 -6
  56. package/dist-types/submodules/serde/parse-utils.d.ts +31 -51
  57. package/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +3 -12
  58. package/dist-types/submodules/serde/split-every.d.ts +1 -2
  59. package/dist-types/submodules/serde/util-stream/blob/Uint8ArrayBlobAdapter.d.ts +8 -12
  60. package/dist-types/submodules/serde/util-stream/createBufferedReadable.browser.d.ts +2 -1
  61. package/dist-types/submodules/serde/util-stream/createBufferedReadable.d.ts +2 -1
  62. package/dist-types/submodules/serde/util-stream/stream-collector.browser.d.ts +2 -1
  63. package/dist-types/submodules/serde/util-utf8/toUint8Array.browser.d.ts +4 -0
  64. package/dist-types/submodules/serde/uuid/v4.d.ts +12 -7
  65. package/dist-types/util-identity-and-auth/memoizeIdentityProvider.d.ts +2 -1
  66. package/package.json +1 -1
  67. package/dist-es/submodules/serde/generateIdempotencyToken.js +0 -2
  68. package/dist-es/submodules/serde/uuid/randomUUID.js +0 -3
  69. package/dist-types/submodules/serde/generateIdempotencyToken.d.ts +0 -2
  70. package/dist-types/submodules/serde/uuid/randomUUID.d.ts +0 -1
@@ -1080,7 +1080,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1080
1080
  const ns = schema.NormalizedSchema.of(errorSchema);
1081
1081
  const ErrorCtor = registry.getErrorCtor(errorSchema);
1082
1082
  const message = dataObject.message ?? dataObject.Message ?? "Unknown";
1083
- const exception = new ErrorCtor(message);
1083
+ const exception = new ErrorCtor({});
1084
1084
  const output = {};
1085
1085
  for (const [name, member] of ns.structIterator()) {
1086
1086
  output[name] = this.deserializer.readValue(member, dataObject[name]);
@@ -622,6 +622,18 @@ class TypeRegistry {
622
622
  getSchema(shapeId) {
623
623
  const id = this.normalizeShapeId(shapeId);
624
624
  if (!this.schemas.has(id)) {
625
+ if (!shapeId.includes("#")) {
626
+ const suffix = "#" + shapeId;
627
+ const candidates = [];
628
+ for (const [shapeId, schema] of this.schemas.entries()) {
629
+ if (shapeId.endsWith(suffix)) {
630
+ candidates.push(schema);
631
+ }
632
+ }
633
+ if (candidates.length === 1) {
634
+ return candidates[0];
635
+ }
636
+ }
625
637
  throw new Error(`@smithy/core/schema - schema not found for ${id}`);
626
638
  }
627
639
  return this.schemas.get(id);
@@ -3,6 +3,155 @@
3
3
  var protocols = require('@smithy/core/protocols');
4
4
  var endpoints = require('@smithy/core/endpoints');
5
5
 
6
+ const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
7
+ const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
8
+ acc[c] = Number(i);
9
+ return acc;
10
+ }, {});
11
+ const alphabetByValue = chars.split("");
12
+ const bitsPerLetter = 6;
13
+ const bitsPerByte = 8;
14
+ const maxLetterValue = 0b111111;
15
+
16
+ const fromBase64 = (input) => {
17
+ let totalByteLength = (input.length / 4) * 3;
18
+ if (input.slice(-2) === "==") {
19
+ totalByteLength -= 2;
20
+ }
21
+ else if (input.slice(-1) === "=") {
22
+ totalByteLength--;
23
+ }
24
+ const out = new ArrayBuffer(totalByteLength);
25
+ const dataView = new DataView(out);
26
+ for (let i = 0; i < input.length; i += 4) {
27
+ let bits = 0;
28
+ let bitLength = 0;
29
+ for (let j = i, limit = i + 3; j <= limit; j++) {
30
+ if (input[j] !== "=") {
31
+ if (!(input[j] in alphabetByEncoding)) {
32
+ throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
33
+ }
34
+ bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);
35
+ bitLength += bitsPerLetter;
36
+ }
37
+ else {
38
+ bits >>= bitsPerLetter;
39
+ }
40
+ }
41
+ const chunkOffset = (i / 4) * 3;
42
+ bits >>= bitLength % bitsPerByte;
43
+ const byteLength = Math.floor(bitLength / bitsPerByte);
44
+ for (let k = 0; k < byteLength; k++) {
45
+ const offset = (byteLength - k - 1) * bitsPerByte;
46
+ dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);
47
+ }
48
+ }
49
+ return new Uint8Array(out);
50
+ };
51
+
52
+ const fromUtf8 = (input) => new TextEncoder().encode(input);
53
+
54
+ function toBase64(_input) {
55
+ let input;
56
+ if (typeof _input === "string") {
57
+ input = fromUtf8(_input);
58
+ }
59
+ else {
60
+ input = _input;
61
+ }
62
+ const isArrayLike = typeof input === "object" && typeof input.length === "number";
63
+ const isUint8Array = typeof input === "object" &&
64
+ typeof input.byteOffset === "number" &&
65
+ typeof input.byteLength === "number";
66
+ if (!isArrayLike && !isUint8Array) {
67
+ throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
68
+ }
69
+ let str = "";
70
+ for (let i = 0; i < input.length; i += 3) {
71
+ let bits = 0;
72
+ let bitLength = 0;
73
+ for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
74
+ bits |= input[j] << ((limit - j - 1) * bitsPerByte);
75
+ bitLength += bitsPerByte;
76
+ }
77
+ const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
78
+ bits <<= bitClusterCount * bitsPerLetter - bitLength;
79
+ for (let k = 1; k <= bitClusterCount; k++) {
80
+ const offset = (bitClusterCount - k) * bitsPerLetter;
81
+ str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];
82
+ }
83
+ str += "==".slice(0, 4 - bitClusterCount);
84
+ }
85
+ return str;
86
+ }
87
+
88
+ function bindUint8ArrayBlobAdapter(toUtf8, fromUtf8, toBase64, fromBase64) {
89
+ return class Uint8ArrayBlobAdapter extends Uint8Array {
90
+ static fromString(source, encoding = "utf-8") {
91
+ if (typeof source === "string") {
92
+ if (encoding === "base64") {
93
+ return Uint8ArrayBlobAdapter.mutate(fromBase64(source));
94
+ }
95
+ return Uint8ArrayBlobAdapter.mutate(fromUtf8(source));
96
+ }
97
+ throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
98
+ }
99
+ static mutate(source) {
100
+ Object.setPrototypeOf(source, Uint8ArrayBlobAdapter.prototype);
101
+ return source;
102
+ }
103
+ transformToString(encoding = "utf-8") {
104
+ if (encoding === "base64") {
105
+ return toBase64(this);
106
+ }
107
+ return toUtf8(this);
108
+ }
109
+ };
110
+ }
111
+
112
+ const toUtf8 = (input) => {
113
+ if (typeof input === "string") {
114
+ return input;
115
+ }
116
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
117
+ throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
118
+ }
119
+ return new TextDecoder("utf-8").decode(input);
120
+ };
121
+
122
+ const decimalToHex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
123
+ function bindV4(getRandomValues) {
124
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
125
+ return () => crypto.randomUUID();
126
+ }
127
+ return () => {
128
+ const rnds = new Uint8Array(16);
129
+ getRandomValues(rnds);
130
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
131
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
132
+ return (decimalToHex[rnds[0]] +
133
+ decimalToHex[rnds[1]] +
134
+ decimalToHex[rnds[2]] +
135
+ decimalToHex[rnds[3]] +
136
+ "-" +
137
+ decimalToHex[rnds[4]] +
138
+ decimalToHex[rnds[5]] +
139
+ "-" +
140
+ decimalToHex[rnds[6]] +
141
+ decimalToHex[rnds[7]] +
142
+ "-" +
143
+ decimalToHex[rnds[8]] +
144
+ decimalToHex[rnds[9]] +
145
+ "-" +
146
+ decimalToHex[rnds[10]] +
147
+ decimalToHex[rnds[11]] +
148
+ decimalToHex[rnds[12]] +
149
+ decimalToHex[rnds[13]] +
150
+ decimalToHex[rnds[14]] +
151
+ decimalToHex[rnds[15]]);
152
+ };
153
+ }
154
+
6
155
  const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
7
156
 
8
157
  const parseBoolean = (value) => {
@@ -429,41 +578,6 @@ const stripLeadingZeroes = (value) => {
429
578
  return value.slice(idx);
430
579
  };
431
580
 
432
- const randomUUID = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"
433
- ? crypto.randomUUID.bind(crypto)
434
- : undefined;
435
-
436
- const decimalToHex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
437
- const v4 = () => {
438
- if (randomUUID) {
439
- return randomUUID();
440
- }
441
- const rnds = new Uint8Array(16);
442
- crypto.getRandomValues(rnds);
443
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
444
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
445
- return (decimalToHex[rnds[0]] +
446
- decimalToHex[rnds[1]] +
447
- decimalToHex[rnds[2]] +
448
- decimalToHex[rnds[3]] +
449
- "-" +
450
- decimalToHex[rnds[4]] +
451
- decimalToHex[rnds[5]] +
452
- "-" +
453
- decimalToHex[rnds[6]] +
454
- decimalToHex[rnds[7]] +
455
- "-" +
456
- decimalToHex[rnds[8]] +
457
- decimalToHex[rnds[9]] +
458
- "-" +
459
- decimalToHex[rnds[10]] +
460
- decimalToHex[rnds[11]] +
461
- decimalToHex[rnds[12]] +
462
- decimalToHex[rnds[13]] +
463
- decimalToHex[rnds[14]] +
464
- decimalToHex[rnds[15]]);
465
- };
466
-
467
581
  const LazyJsonString = function LazyJsonString(val) {
468
582
  const str = Object.assign(new String(val), {
469
583
  deserializeJSON() {
@@ -723,107 +837,6 @@ function toHex(bytes) {
723
837
  return out;
724
838
  }
725
839
 
726
- const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
727
- const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
728
- acc[c] = Number(i);
729
- return acc;
730
- }, {});
731
- const alphabetByValue = chars.split("");
732
- const bitsPerLetter = 6;
733
- const bitsPerByte = 8;
734
- const maxLetterValue = 0b111111;
735
-
736
- const fromBase64$1 = (input) => {
737
- let totalByteLength = (input.length / 4) * 3;
738
- if (input.slice(-2) === "==") {
739
- totalByteLength -= 2;
740
- }
741
- else if (input.slice(-1) === "=") {
742
- totalByteLength--;
743
- }
744
- const out = new ArrayBuffer(totalByteLength);
745
- const dataView = new DataView(out);
746
- for (let i = 0; i < input.length; i += 4) {
747
- let bits = 0;
748
- let bitLength = 0;
749
- for (let j = i, limit = i + 3; j <= limit; j++) {
750
- if (input[j] !== "=") {
751
- if (!(input[j] in alphabetByEncoding)) {
752
- throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
753
- }
754
- bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);
755
- bitLength += bitsPerLetter;
756
- }
757
- else {
758
- bits >>= bitsPerLetter;
759
- }
760
- }
761
- const chunkOffset = (i / 4) * 3;
762
- bits >>= bitLength % bitsPerByte;
763
- const byteLength = Math.floor(bitLength / bitsPerByte);
764
- for (let k = 0; k < byteLength; k++) {
765
- const offset = (byteLength - k - 1) * bitsPerByte;
766
- dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);
767
- }
768
- }
769
- return new Uint8Array(out);
770
- };
771
-
772
- const isArrayBuffer = (arg) => (typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer) ||
773
- Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
774
-
775
- const fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => {
776
- if (!isArrayBuffer(input)) {
777
- throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
778
- }
779
- return Buffer.from(input, offset, length);
780
- };
781
- const fromString = (input, encoding) => {
782
- if (typeof input !== "string") {
783
- throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
784
- }
785
- return encoding ? Buffer.from(input, encoding) : Buffer.from(input);
786
- };
787
-
788
- const fromUtf8$1 = (input) => {
789
- const buf = fromString(input, "utf8");
790
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
791
- };
792
-
793
- function toBase64$1(_input) {
794
- let input;
795
- if (typeof _input === "string") {
796
- input = fromUtf8$1(_input);
797
- }
798
- else {
799
- input = _input;
800
- }
801
- const isArrayLike = typeof input === "object" && typeof input.length === "number";
802
- const isUint8Array = typeof input === "object" &&
803
- typeof input.byteOffset === "number" &&
804
- typeof input.byteLength === "number";
805
- if (!isArrayLike && !isUint8Array) {
806
- throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
807
- }
808
- let str = "";
809
- for (let i = 0; i < input.length; i += 3) {
810
- let bits = 0;
811
- let bitLength = 0;
812
- for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
813
- bits |= input[j] << ((limit - j - 1) * bitsPerByte);
814
- bitLength += bitsPerByte;
815
- }
816
- const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
817
- bits <<= bitClusterCount * bitsPerLetter - bitLength;
818
- for (let k = 1; k <= bitClusterCount; k++) {
819
- const offset = (bitClusterCount - k) * bitsPerLetter;
820
- str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];
821
- }
822
- str += "==".slice(0, 4 - bitClusterCount);
823
- }
824
- return str;
825
- }
826
-
827
840
  const TEXT_ENCODER = typeof TextEncoder == "function" ? new TextEncoder() : null;
828
841
  const calculateBodyLength = (body) => {
829
842
  if (typeof body === "string") {
@@ -851,11 +864,9 @@ const calculateBodyLength = (body) => {
851
864
  throw new Error(`Body Length computation failed for ${body}`);
852
865
  };
853
866
 
854
- const fromUtf8 = (input) => new TextEncoder().encode(input);
855
-
856
867
  const toUint8Array = (data) => {
857
868
  if (typeof data === "string") {
858
- return fromUtf8$1(data);
869
+ return fromUtf8(data);
859
870
  }
860
871
  if (ArrayBuffer.isView(data)) {
861
872
  return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
@@ -863,15 +874,8 @@ const toUint8Array = (data) => {
863
874
  return new Uint8Array(data);
864
875
  };
865
876
 
866
- const toUtf8$1 = (input) => {
867
- if (typeof input === "string") {
868
- return input;
869
- }
870
- if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
871
- throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
872
- }
873
- return new TextDecoder("utf-8").decode(input);
874
- };
877
+ const isArrayBuffer = (arg) => (typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer) ||
878
+ Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
875
879
 
876
880
  const deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
877
881
  const { response } = await next(args);
@@ -967,64 +971,6 @@ function getSerdePlugin(config, serializer, deserializer) {
967
971
  };
968
972
  }
969
973
 
970
- const BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/;
971
- const fromBase64 = (input) => {
972
- if ((input.length * 3) % 4 !== 0) {
973
- throw new TypeError(`Incorrect padding on base64 string.`);
974
- }
975
- if (!BASE64_REGEX.exec(input)) {
976
- throw new TypeError(`Invalid base64 string.`);
977
- }
978
- const buffer = fromString(input, "base64");
979
- return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
980
- };
981
-
982
- const toBase64 = (_input) => {
983
- let input;
984
- if (typeof _input === "string") {
985
- input = fromUtf8$1(_input);
986
- }
987
- else {
988
- input = _input;
989
- }
990
- if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
991
- throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
992
- }
993
- return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("base64");
994
- };
995
-
996
- const toUtf8 = (input) => {
997
- if (typeof input === "string") {
998
- return input;
999
- }
1000
- if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
1001
- throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
1002
- }
1003
- return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
1004
- };
1005
-
1006
- class Uint8ArrayBlobAdapter extends Uint8Array {
1007
- static fromString(source, encoding = "utf-8") {
1008
- if (typeof source === "string") {
1009
- if (encoding === "base64") {
1010
- return Uint8ArrayBlobAdapter.mutate(fromBase64(source));
1011
- }
1012
- return Uint8ArrayBlobAdapter.mutate(fromUtf8$1(source));
1013
- }
1014
- throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
1015
- }
1016
- static mutate(source) {
1017
- Object.setPrototypeOf(source, Uint8ArrayBlobAdapter.prototype);
1018
- return source;
1019
- }
1020
- transformToString(encoding = "utf-8") {
1021
- if (encoding === "base64") {
1022
- return toBase64(this);
1023
- }
1024
- return toUtf8(this);
1025
- }
1026
- }
1027
-
1028
974
  const ReadableStreamRef = typeof ReadableStream === "function" ? ReadableStream : function () { };
1029
975
  class ChecksumStream extends ReadableStreamRef {
1030
976
  }
@@ -1378,7 +1324,14 @@ async function splitStream(stream) {
1378
1324
  }
1379
1325
 
1380
1326
  const no = Symbol.for("node-only");
1327
+ const fromArrayBuffer = no;
1328
+ const fromString = no;
1381
1329
  const Hash = no;
1330
+ class Uint8ArrayBlobAdapter extends bindUint8ArrayBlobAdapter(toUtf8, fromUtf8, toBase64, fromBase64) {
1331
+ }
1332
+ const _getRandomValues = (array) => crypto.getRandomValues(array);
1333
+ const v4 = bindV4(_getRandomValues);
1334
+ const generateIdempotencyToken = v4;
1382
1335
 
1383
1336
  exports.ChecksumStream = ChecksumStream;
1384
1337
  exports.Hash = Hash;
@@ -1408,11 +1361,11 @@ exports.expectShort = expectShort;
1408
1361
  exports.expectString = expectString;
1409
1362
  exports.expectUnion = expectUnion;
1410
1363
  exports.fromArrayBuffer = fromArrayBuffer;
1411
- exports.fromBase64 = fromBase64$1;
1364
+ exports.fromBase64 = fromBase64;
1412
1365
  exports.fromHex = fromHex;
1413
1366
  exports.fromString = fromString;
1414
1367
  exports.fromUtf8 = fromUtf8;
1415
- exports.generateIdempotencyToken = v4;
1368
+ exports.generateIdempotencyToken = generateIdempotencyToken;
1416
1369
  exports.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream;
1417
1370
  exports.getSerdePlugin = getSerdePlugin;
1418
1371
  exports.handleFloat = handleFloat;
@@ -1445,8 +1398,8 @@ exports.strictParseInt = strictParseInt;
1445
1398
  exports.strictParseInt32 = strictParseInt32;
1446
1399
  exports.strictParseLong = strictParseLong;
1447
1400
  exports.strictParseShort = strictParseShort;
1448
- exports.toBase64 = toBase64$1;
1401
+ exports.toBase64 = toBase64;
1449
1402
  exports.toHex = toHex;
1450
1403
  exports.toUint8Array = toUint8Array;
1451
- exports.toUtf8 = toUtf8$1;
1404
+ exports.toUtf8 = toUtf8;
1452
1405
  exports.v4 = v4;