@cdk8s/awscdk-resolver 0.0.661 → 0.0.663

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 (68) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +1 -1
  4. package/node_modules/@aws-sdk/client-cloudformation/package.json +1 -1
  5. package/node_modules/@smithy/core/dist-cjs/index.js +3 -1
  6. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +126 -39
  7. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +14 -3
  8. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +3 -1
  9. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +3 -1
  10. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -1
  11. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -1
  12. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +16 -2
  13. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +4 -1
  14. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +4 -1
  15. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -1
  16. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +4 -1
  17. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -1
  18. package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +7 -0
  19. package/node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +3 -0
  20. package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-decode.js +29 -13
  21. package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +12 -4
  22. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +9 -0
  23. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +7 -0
  24. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +44 -15
  25. package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +22 -4
  26. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +5 -0
  27. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js +3 -0
  28. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +4 -1
  29. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/object-mapping.js +6 -1
  30. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/serde-json.js +4 -1
  31. package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +3 -0
  32. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +7 -0
  33. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +4 -1
  34. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -0
  35. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +5 -0
  36. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +3 -0
  37. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +4 -1
  38. package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +1 -0
  39. package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
  40. package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +1 -0
  41. package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +3 -0
  42. package/node_modules/@smithy/core/dist-es/submodules/transport/hasOwn.js +3 -0
  43. package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +1 -0
  44. package/node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js +3 -0
  45. package/node_modules/@smithy/core/dist-types/submodules/serde/index.browser.d.ts +1 -0
  46. package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
  47. package/node_modules/@smithy/core/dist-types/submodules/serde/index.native.d.ts +1 -0
  48. package/node_modules/@smithy/core/dist-types/submodules/transport/hasOwn.d.ts +4 -0
  49. package/node_modules/@smithy/core/dist-types/submodules/transport/index.d.ts +1 -0
  50. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.browser.d.ts +1 -0
  51. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
  52. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.native.d.ts +1 -0
  53. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/transport/hasOwn.d.ts +4 -0
  54. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/transport/index.d.ts +1 -0
  55. package/node_modules/@smithy/core/package.json +1 -1
  56. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +7 -2
  57. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +3 -0
  58. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -0
  59. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  60. package/node_modules/@smithy/signature-v4/dist-cjs/index.js +19 -7
  61. package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -1
  62. package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +4 -1
  63. package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +4 -1
  64. package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +10 -3
  65. package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +4 -1
  66. package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +4 -1
  67. package/node_modules/@smithy/signature-v4/package.json +2 -2
  68. package/package.json +5 -5
@@ -2,6 +2,7 @@ const { Readable } = require("node:stream");
2
2
  const { NoOpLogger, normalizeProvider } = require("@smithy/core/client");
3
3
  const { HttpResponse, HttpRequest } = require("@smithy/core/protocols");
4
4
  const { parseRfc7231DateTime, v4 } = require("@smithy/core/serde");
5
+ const { hasOwn } = require("@smithy/core/transport");
5
6
 
6
7
  const isStreamingPayload = (request) => request?.body instanceof Readable ||
7
8
  (typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream);
@@ -94,7 +95,9 @@ function parseRetryAfterHeader(response, logger) {
94
95
  if (!HttpResponse.isInstance(response)) {
95
96
  return;
96
97
  }
97
- for (const header of Object.keys(response.headers)) {
98
+ for (const header in response.headers) {
99
+ if (!hasOwn(response.headers, header))
100
+ continue;
98
101
  const h = header.toLowerCase();
99
102
  if (h === "retry-after") {
100
103
  const retryAfter = response.headers[header];
@@ -1,4 +1,5 @@
1
- const { HttpResponse } = require("@smithy/core/transport");
1
+ const { hasOwn, HttpResponse } = require("@smithy/core/transport");
2
+ exports.hasOwn = hasOwn;
2
3
  const { toEndpointV1 } = require("@smithy/core/endpoints");
3
4
 
4
5
  const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
@@ -291,6 +292,8 @@ const expectUnion = (value) => {
291
292
  const asObject = expectObject(value);
292
293
  const setKeys = [];
293
294
  for (const k in asObject) {
295
+ if (!hasOwn(asObject, k))
296
+ continue;
294
297
  if (asObject[k] != null) {
295
298
  setKeys.push(k);
296
299
  }
@@ -1,6 +1,7 @@
1
1
  const { createHmac, createHash, getRandomValues } = require("node:crypto");
2
+ const { hasOwn, HttpResponse } = require("@smithy/core/transport");
3
+ exports.hasOwn = hasOwn;
2
4
  const { ReadStream, lstatSync, fstatSync } = require("node:fs");
3
- const { HttpResponse } = require("@smithy/core/transport");
4
5
  const { toEndpointV1 } = require("@smithy/core/endpoints");
5
6
  const { Readable, Writable, PassThrough } = require("node:stream");
6
7
 
@@ -259,6 +260,8 @@ const expectUnion = (value) => {
259
260
  const asObject = expectObject(value);
260
261
  const setKeys = [];
261
262
  for (const k in asObject) {
263
+ if (!hasOwn(asObject, k))
264
+ continue;
262
265
  if (asObject[k] != null) {
263
266
  setKeys.push(k);
264
267
  }
@@ -1,4 +1,5 @@
1
- const { HttpResponse } = require("@smithy/core/transport");
1
+ const { hasOwn, HttpResponse } = require("@smithy/core/transport");
2
+ exports.hasOwn = hasOwn;
2
3
  const { toEndpointV1 } = require("@smithy/core/endpoints");
3
4
 
4
5
  const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
@@ -291,6 +292,8 @@ const expectUnion = (value) => {
291
292
  const asObject = expectObject(value);
292
293
  const setKeys = [];
293
294
  for (const k in asObject) {
295
+ if (!hasOwn(asObject, k))
296
+ continue;
294
297
  if (asObject[k] != null) {
295
298
  setKeys.push(k);
296
299
  }
@@ -2,6 +2,10 @@ const { SMITHY_CONTEXT_KEY } = require("@smithy/types");
2
2
 
3
3
  const getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
4
4
 
5
+ function hasOwn(o, k) {
6
+ return Object.prototype.hasOwnProperty.call(o, k);
7
+ }
8
+
5
9
  class HttpRequest {
6
10
  method;
7
11
  protocol;
@@ -161,6 +165,8 @@ const toEndpointV1 = (endpoint) => {
161
165
  if (endpoint.headers) {
162
166
  v1Endpoint.headers = {};
163
167
  for (const name in endpoint.headers) {
168
+ if (!hasOwn(endpoint.headers, name))
169
+ continue;
164
170
  v1Endpoint.headers[name.toLowerCase()] = endpoint.headers[name].join(", ");
165
171
  }
166
172
  }
@@ -174,6 +180,7 @@ const toEndpointV1 = (endpoint) => {
174
180
  exports.HttpRequest = HttpRequest;
175
181
  exports.HttpResponse = HttpResponse;
176
182
  exports.getSmithyContext = getSmithyContext;
183
+ exports.hasOwn = hasOwn;
177
184
  exports.isValidHostLabel = isValidHostLabel;
178
185
  exports.isValidHostname = isValidHostname;
179
186
  exports.normalizeProvider = normalizeProvider;
@@ -1,7 +1,10 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  export class DefaultIdentityProviderConfig {
2
3
  authSchemes = new Map();
3
4
  constructor(config) {
4
5
  for (const key in config) {
6
+ if (!hasOwn(config, key))
7
+ continue;
5
8
  const value = config[key];
6
9
  if (value !== undefined) {
7
10
  this.authSchemes.set(key, value);
@@ -271,23 +271,39 @@ function decodeTagValue(at, to, minor, unsignedInt, offset) {
271
271
  }
272
272
  else if (minor === 4) {
273
273
  const decimalFraction = decode(at + offset, to);
274
- const [exponent, mantissa] = decimalFraction;
274
+ const [rawExponent, mantissa] = decimalFraction;
275
275
  const normalizer = mantissa < 0 ? -1 : 1;
276
- const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + String(BigInt(normalizer) * BigInt(mantissa));
277
- let numericString;
276
+ const absMantissa = BigInt(normalizer) * BigInt(mantissa);
277
+ const mantissaDigits = String(absMantissa);
278
278
  const sign = mantissa < 0 ? "-" : "";
279
- numericString =
280
- exponent === 0
281
- ? mantissaStr
282
- : mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
283
- numericString = numericString.replace(/^0+/g, "");
284
- if (numericString === "") {
285
- numericString = "0";
279
+ let numericString;
280
+ const isSmallExponent = typeof rawExponent === "number" && Math.abs(rawExponent) <= 2 ** 28;
281
+ if (isSmallExponent) {
282
+ const exponent = rawExponent;
283
+ const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + mantissaDigits;
284
+ numericString =
285
+ exponent === 0
286
+ ? mantissaStr
287
+ : mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
288
+ numericString = numericString.replace(/^0+/g, "");
289
+ if (numericString === "") {
290
+ numericString = "0";
291
+ }
292
+ if (numericString[0] === ".") {
293
+ numericString = "0" + numericString;
294
+ }
295
+ numericString = sign + numericString;
286
296
  }
287
- if (numericString[0] === ".") {
288
- numericString = "0" + numericString;
297
+ else {
298
+ const bigExponent = BigInt(rawExponent);
299
+ if (mantissaDigits.length === 1) {
300
+ numericString = sign + mantissaDigits + "e" + String(bigExponent);
301
+ }
302
+ else {
303
+ const adjustedExp = bigExponent + BigInt(mantissaDigits.length - 1);
304
+ numericString = sign + mantissaDigits[0] + "." + mantissaDigits.slice(1) + "e" + String(adjustedExp);
305
+ }
289
306
  }
290
- numericString = sign + numericString;
291
307
  _offset = offset + _offset;
292
308
  return nv(numericString);
293
309
  }
@@ -155,13 +155,21 @@ export function encode(_input) {
155
155
  }
156
156
  else if (typeof input === "object") {
157
157
  if (input instanceof NumericValue) {
158
- const decimalIndex = input.string.indexOf(".");
159
- const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
160
- const mantissa = BigInt(input.string.replace(".", ""));
158
+ let str = input.string;
159
+ let expOffset = BigInt(0);
160
+ const eIndex = str.search(/[eE]/);
161
+ if (eIndex !== -1) {
162
+ expOffset = BigInt(str.slice(eIndex + 1));
163
+ str = str.slice(0, eIndex);
164
+ }
165
+ const decimalIndex = str.indexOf(".");
166
+ const fractionDigits = decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
167
+ const exponent = expOffset - BigInt(fractionDigits);
168
+ const mantissa = BigInt(str.replace(".", ""));
161
169
  data[cursor++] = 0b110_00100;
162
170
  encodeInteger(majorList, 2);
163
171
  encodeStack.push(mantissa);
164
- encodeStack.push(exponent);
172
+ encodeStack.push(exponent >= -0x20000000000000n && exponent <= 0x1fffffffffffffn ? Number(exponent) : exponent);
165
173
  continue;
166
174
  }
167
175
  if (input[tagSymbol]) {
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { SerdeContext } from "@smithy/core/protocols";
2
3
  import { NormalizedSchema } from "@smithy/core/schema";
3
4
  import { NumericValue, _parseEpochTimestamp, fromBase64 } from "@smithy/core/serde";
@@ -59,6 +60,8 @@ export class CborShapeDeserializer extends SerdeContext {
59
60
  if (ns.isMapSchema()) {
60
61
  const targetSchema = ns.getValueSchema();
61
62
  for (const key in value) {
63
+ if (!hasOwn(value, key))
64
+ continue;
62
65
  const itemValue = this.readValue(targetSchema, value[key]);
63
66
  newObject[key] = itemValue;
64
67
  }
@@ -69,6 +72,8 @@ export class CborShapeDeserializer extends SerdeContext {
69
72
  if (isUnion) {
70
73
  keys = new Set();
71
74
  for (const k in value) {
75
+ if (!hasOwn(value, k))
76
+ continue;
72
77
  if (k !== "__type") {
73
78
  keys.add(k);
74
79
  }
@@ -85,6 +90,8 @@ export class CborShapeDeserializer extends SerdeContext {
85
90
  if (isUnion && keys?.size === 1) {
86
91
  let newObjectEmpty = true;
87
92
  for (const _ in newObject) {
93
+ if (!hasOwn(newObject, _))
94
+ continue;
88
95
  newObjectEmpty = false;
89
96
  break;
90
97
  }
@@ -95,6 +102,8 @@ export class CborShapeDeserializer extends SerdeContext {
95
102
  }
96
103
  else if (typeof value.__type === "string") {
97
104
  for (const k in value) {
105
+ if (!hasOwn(value, k))
106
+ continue;
98
107
  if (!(k in newObject)) {
99
108
  newObject[k] = value[k];
100
109
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { SerdeContext } from "@smithy/core/protocols";
2
3
  import { NormalizedSchema } from "@smithy/core/schema";
3
4
  import { fromBase64, generateIdempotencyToken } from "@smithy/core/serde";
@@ -49,6 +50,8 @@ export class CborShapeSerializer extends SerdeContext {
49
50
  if (ns.isMapSchema()) {
50
51
  const sparse = !!ns.getMergedTraits().sparse;
51
52
  for (const key in sourceObject) {
53
+ if (!hasOwn(sourceObject, key))
54
+ continue;
52
55
  const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
53
56
  if (value != null || sparse) {
54
57
  newObject[key] = value;
@@ -69,6 +72,8 @@ export class CborShapeSerializer extends SerdeContext {
69
72
  }
70
73
  else if (typeof sourceObject.__type === "string") {
71
74
  for (const k in sourceObject) {
75
+ if (!hasOwn(sourceObject, k))
76
+ continue;
72
77
  if (!(k in newObject)) {
73
78
  newObject[k] = this.serialize(15, sourceObject[k]);
74
79
  }
@@ -85,6 +90,8 @@ export class CborShapeSerializer extends SerdeContext {
85
90
  return newArray;
86
91
  }
87
92
  for (const key in sourceObject) {
93
+ if (!hasOwn(sourceObject, key))
94
+ continue;
88
95
  newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
89
96
  }
90
97
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { SerdeContext } from "@smithy/core/protocols";
2
3
  import { NormalizedSchema } from "@smithy/core/schema";
3
4
  import { NumericValue, _parseEpochTimestamp, nv } from "@smithy/core/serde";
@@ -120,6 +121,8 @@ function readStruct(ns, count, startPos) {
120
121
  if (isUnion) {
121
122
  let resultEmpty = true;
122
123
  for (const _ in result) {
124
+ if (!hasOwn(result, _))
125
+ continue;
123
126
  resultEmpty = false;
124
127
  break;
125
128
  }
@@ -159,23 +162,39 @@ function readTag(ns) {
159
162
  if (tagNumber === 4) {
160
163
  const docSchema = NormalizedSchema.of(15);
161
164
  const pair = readValue(docSchema);
162
- const [exponent, mantissa] = pair;
165
+ const [rawExponent, mantissa] = pair;
163
166
  const normalizer = mantissa < 0 ? -1 : 1;
164
- const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + String(BigInt(normalizer) * BigInt(mantissa));
165
- let numericString;
167
+ const absMantissa = BigInt(normalizer) * BigInt(mantissa);
168
+ const mantissaDigits = String(absMantissa);
166
169
  const sign = mantissa < 0 ? "-" : "";
167
- numericString =
168
- exponent === 0
169
- ? mantissaStr
170
- : mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
171
- numericString = numericString.replace(/^0+/g, "");
172
- if (numericString === "") {
173
- numericString = "0";
174
- }
175
- if (numericString[0] === ".") {
176
- numericString = "0" + numericString;
177
- }
178
- numericString = sign + numericString;
170
+ let numericString;
171
+ const isSmallExponent = typeof rawExponent === "number" && Math.abs(rawExponent) <= 2 ** 28;
172
+ if (isSmallExponent) {
173
+ const exponent = rawExponent;
174
+ const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + mantissaDigits;
175
+ numericString =
176
+ exponent === 0
177
+ ? mantissaStr
178
+ : mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
179
+ numericString = numericString.replace(/^0+/g, "");
180
+ if (numericString === "") {
181
+ numericString = "0";
182
+ }
183
+ if (numericString[0] === ".") {
184
+ numericString = "0" + numericString;
185
+ }
186
+ numericString = sign + numericString;
187
+ }
188
+ else {
189
+ const bigExponent = BigInt(rawExponent);
190
+ if (mantissaDigits.length === 1) {
191
+ numericString = sign + mantissaDigits + "e" + String(bigExponent);
192
+ }
193
+ else {
194
+ const adjustedExp = bigExponent + BigInt(mantissaDigits.length - 1);
195
+ numericString = sign + mantissaDigits[0] + "." + mantissaDigits.slice(1) + "e" + String(adjustedExp);
196
+ }
197
+ }
179
198
  return nv(numericString);
180
199
  }
181
200
  const docSchema = NormalizedSchema.of(15);
@@ -272,6 +291,8 @@ function readMapIndefinite(ns) {
272
291
  if (isUnion) {
273
292
  let resultEmpty = true;
274
293
  for (const _ in result) {
294
+ if (!hasOwn(result, _))
295
+ continue;
275
296
  resultEmpty = false;
276
297
  break;
277
298
  }
@@ -576,6 +597,8 @@ function transformObject(ns, value) {
576
597
  if (ns.isMapSchema()) {
577
598
  const targetSchema = ns.getValueSchema();
578
599
  for (const key in value) {
600
+ if (!hasOwn(value, key))
601
+ continue;
579
602
  newObject[key] = transformObject(targetSchema, value[key]);
580
603
  }
581
604
  }
@@ -585,6 +608,8 @@ function transformObject(ns, value) {
585
608
  if (isUnion) {
586
609
  keys = new Set();
587
610
  for (const k in value) {
611
+ if (!hasOwn(value, k))
612
+ continue;
588
613
  if (k !== "__type") {
589
614
  keys.add(k);
590
615
  }
@@ -601,6 +626,8 @@ function transformObject(ns, value) {
601
626
  if (isUnion && keys?.size === 1) {
602
627
  let newObjectEmpty = true;
603
628
  for (const _ in newObject) {
629
+ if (!hasOwn(newObject, _))
630
+ continue;
604
631
  newObjectEmpty = false;
605
632
  break;
606
633
  }
@@ -611,6 +638,8 @@ function transformObject(ns, value) {
611
638
  }
612
639
  else if (typeof value.__type === "string") {
613
640
  for (const k in value) {
641
+ if (!hasOwn(value, k))
642
+ continue;
614
643
  if (!(k in newObject)) {
615
644
  newObject[k] = value[k];
616
645
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { SerdeContext } from "@smithy/core/protocols";
2
3
  import { NormalizedSchema } from "@smithy/core/schema";
3
4
  import { NumericValue, fromBase64, generateIdempotencyToken } from "@smithy/core/serde";
@@ -253,6 +254,8 @@ function writeStruct(ns, value, serdeContext) {
253
254
  }
254
255
  if (typeof value.__type === "string") {
255
256
  for (const k in value) {
257
+ if (!hasOwn(value, k))
258
+ continue;
256
259
  if (!memberNames.includes(k)) {
257
260
  writeString(k);
258
261
  writeUntypedValue(value[k]);
@@ -318,6 +321,8 @@ function writeMap(ns, value, isDocument, serdeContext) {
318
321
  const valueSchema = ns.getValueSchema();
319
322
  const keys = [];
320
323
  for (const k in value) {
324
+ if (!hasOwn(value, k))
325
+ continue;
321
326
  const v = value[k];
322
327
  if (isDocument ? v !== undefined : v != null || sparse) {
323
328
  keys.push(k);
@@ -579,14 +584,27 @@ function writeTag(tagValue, innerValue) {
579
584
  writeUntypedValue(innerValue);
580
585
  }
581
586
  function writeNumericValue(nv) {
582
- const decimalIndex = nv.string.indexOf(".");
583
- const exponent = decimalIndex === -1 ? 0 : decimalIndex - nv.string.length + 1;
584
- const mantissa = BigInt(nv.string.replace(".", ""));
587
+ let str = nv.string;
588
+ let expOffset = BigInt(0);
589
+ const eIndex = str.search(/[eE]/);
590
+ if (eIndex !== -1) {
591
+ expOffset = BigInt(str.slice(eIndex + 1));
592
+ str = str.slice(0, eIndex);
593
+ }
594
+ const decimalIndex = str.indexOf(".");
595
+ const fractionDigits = decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
596
+ const exponent = expOffset - BigInt(fractionDigits);
597
+ const mantissa = BigInt(str.replace(".", ""));
585
598
  ensure(9);
586
599
  buf[cursor++] = 0b110_00100;
587
600
  encodeHeader(majorList, 2);
588
601
  ensure(9);
589
- writeInteger(exponent);
602
+ if (exponent >= -0x20000000000000n && exponent <= 0x1fffffffffffffn) {
603
+ writeInteger(Number(exponent));
604
+ }
605
+ else {
606
+ writeBigInt(exponent);
607
+ }
590
608
  writeBigInt(mantissa);
591
609
  }
592
610
  function writeTimestamp(date) {
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { HttpRequest as __HttpRequest, collectBody } from "@smithy/core/protocols";
2
3
  import { calculateBodyLength } from "@smithy/core/serde";
3
4
  import { cbor } from "./cbor";
@@ -51,6 +52,8 @@ export const loadSmithyRpcV2CborErrorCode = (output, data) => {
51
52
  }
52
53
  let codeKey;
53
54
  for (const key in data) {
55
+ if (!hasOwn(data, key))
56
+ continue;
54
57
  if (key.toLowerCase() === "code") {
55
58
  codeKey = key;
56
59
  break;
@@ -83,6 +86,8 @@ export const buildHttpRpcRequest = async (context, headers, path, resolvedHostna
83
86
  }
84
87
  if (endpoint.headers) {
85
88
  for (const name in endpoint.headers) {
89
+ if (!hasOwn(endpoint.headers, name))
90
+ continue;
86
91
  contents.headers[name] = endpoint.headers[name];
87
92
  }
88
93
  }
@@ -1,9 +1,12 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { AlgorithmId, } from "@smithy/types";
2
3
  export { AlgorithmId };
3
4
  const knownAlgorithms = Object.values(AlgorithmId);
4
5
  export const getChecksumConfiguration = (runtimeConfig) => {
5
6
  const checksumAlgorithms = [];
6
7
  for (const id in AlgorithmId) {
8
+ if (!hasOwn(AlgorithmId, id))
9
+ continue;
7
10
  const algorithmId = AlgorithmId[id];
8
11
  if (runtimeConfig[algorithmId] === undefined) {
9
12
  continue;
@@ -1,7 +1,10 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  export const getValueFromTextNode = (obj) => {
2
3
  const textNodeName = "#text";
3
4
  for (const key in obj) {
4
- if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key][textNodeName] !== undefined) {
5
+ if (!hasOwn(obj, key))
6
+ continue;
7
+ if (obj[key][textNodeName] !== undefined) {
5
8
  obj[key] = obj[key][textNodeName];
6
9
  }
7
10
  else if (typeof obj[key] === "object" && obj[key] !== null) {
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  export function map(arg0, arg1, arg2) {
2
3
  let target;
3
4
  let filter;
@@ -17,7 +18,9 @@ export function map(arg0, arg1, arg2) {
17
18
  instructions = arg1;
18
19
  }
19
20
  }
20
- for (const key of Object.keys(instructions)) {
21
+ for (const key in instructions) {
22
+ if (!hasOwn(instructions, key))
23
+ continue;
21
24
  if (!Array.isArray(instructions[key])) {
22
25
  target[key] = instructions[key];
23
26
  continue;
@@ -36,6 +39,8 @@ export const convertMap = (target) => {
36
39
  export const take = (source, instructions) => {
37
40
  const out = {};
38
41
  for (const key in instructions) {
42
+ if (!hasOwn(instructions, key))
43
+ continue;
39
44
  applyInstruction(out, source, instructions, key);
40
45
  }
41
46
  return out;
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  export const _json = (obj) => {
2
3
  if (obj == null) {
3
4
  return {};
@@ -7,7 +8,9 @@ export const _json = (obj) => {
7
8
  }
8
9
  if (typeof obj === "object") {
9
10
  const target = {};
10
- for (const key of Object.keys(obj)) {
11
+ for (const key in obj) {
12
+ if (!hasOwn(obj, key))
13
+ continue;
11
14
  if (obj[key] == null) {
12
15
  continue;
13
16
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { debugId, toDebugString } from "./debug";
2
3
  import { EndpointError } from "./types";
3
4
  import { evaluateRules } from "./utils";
@@ -6,6 +7,8 @@ export const resolveEndpoint = (ruleSetObject, options) => {
6
7
  const { parameters, rules } = ruleSetObject;
7
8
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
8
9
  for (const paramKey in parameters) {
10
+ if (!hasOwn(parameters, paramKey))
11
+ continue;
9
12
  const parameter = parameters[paramKey];
10
13
  const endpointParam = endpointParams[paramKey];
11
14
  if (endpointParam == null && parameter.default != null) {
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { TypeRegistry } from "@smithy/core/schema";
2
3
  import { fromUtf8, toUtf8 } from "@smithy/core/serde";
3
4
  export class EventStreamSerde {
@@ -52,6 +53,8 @@ export class EventStreamSerde {
52
53
  }
53
54
  let unionMember = "";
54
55
  for (const key in event) {
56
+ if (!hasOwn(event, key))
57
+ continue;
55
58
  if (key !== "__type") {
56
59
  unionMember = key;
57
60
  break;
@@ -79,6 +82,8 @@ export class EventStreamSerde {
79
82
  const asyncIterable = marshaller.deserialize(response.body, async (event) => {
80
83
  let unionMember = "";
81
84
  for (const key in event) {
85
+ if (!hasOwn(event, key))
86
+ continue;
82
87
  if (key !== "__type") {
83
88
  unionMember = key;
84
89
  break;
@@ -153,6 +158,8 @@ export class EventStreamSerde {
153
158
  throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
154
159
  }
155
160
  for (const key in firstEvent.value) {
161
+ if (!hasOwn(firstEvent.value, key))
162
+ continue;
156
163
  initialResponseContainer[key] = firstEvent.value[key];
157
164
  }
158
165
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { fromHex, toHex } from "@smithy/core/serde";
2
3
  import { Int64 } from "./Int64";
3
4
  export class HeaderMarshaller {
@@ -9,7 +10,9 @@ export class HeaderMarshaller {
9
10
  }
10
11
  format(headers) {
11
12
  const chunks = [];
12
- for (const headerName of Object.keys(headers)) {
13
+ for (const headerName in headers) {
14
+ if (!hasOwn(headers, headerName))
15
+ continue;
13
16
  const bytes = this.fromUtf8(headerName);
14
17
  chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
15
18
  }
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { NormalizedSchema, translateTraits } from "@smithy/core/schema";
2
3
  import { sdkStreamMixin, splitEvery, splitHeader } from "@smithy/core/serde";
3
4
  import { HttpRequest } from "@smithy/core/transport";
@@ -93,6 +94,8 @@ export class HttpBindingProtocol extends HttpProtocol {
93
94
  }
94
95
  else if (typeof memberTraits.httpPrefixHeaders === "string") {
95
96
  for (const key in inputMemberValue) {
97
+ if (!hasOwn(inputMemberValue, key))
98
+ continue;
96
99
  const val = inputMemberValue[key];
97
100
  const amalgam = memberTraits.httpPrefixHeaders + key;
98
101
  serializer.write([memberNs.getValueSchema(), { httpHeader: amalgam }], val);
@@ -139,6 +142,8 @@ export class HttpBindingProtocol extends HttpProtocol {
139
142
  const traits = ns.getMergedTraits();
140
143
  if (traits.httpQueryParams) {
141
144
  for (const key in data) {
145
+ if (!hasOwn(data, key))
146
+ continue;
142
147
  if (!(key in query)) {
143
148
  const val = data[key];
144
149
  const valueSchema = ns.getValueSchema();
@@ -182,6 +187,8 @@ export class HttpBindingProtocol extends HttpProtocol {
182
187
  throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
183
188
  }
184
189
  for (const header in response.headers) {
190
+ if (!hasOwn(response.headers, header))
191
+ continue;
185
192
  const value = response.headers[header];
186
193
  delete response.headers[header];
187
194
  response.headers[header.toLowerCase()] = value;
@@ -269,6 +276,8 @@ export class HttpBindingProtocol extends HttpProtocol {
269
276
  else if (memberTraits.httpPrefixHeaders !== undefined) {
270
277
  dataObject[memberName] = {};
271
278
  for (const header in response.headers) {
279
+ if (!hasOwn(response.headers, header))
280
+ continue;
272
281
  if (header.startsWith(memberTraits.httpPrefixHeaders)) {
273
282
  const value = response.headers[header];
274
283
  const valueSchema = memberSchema.getValueSchema();
@@ -1,3 +1,4 @@
1
+ import { hasOwn } from "@smithy/core/transport";
1
2
  import { NormalizedSchema, TypeRegistry, translateTraits } from "@smithy/core/schema";
2
3
  import { HttpRequest, HttpResponse, isValidHostname } from "@smithy/core/transport";
3
4
  import { SerdeContext } from "./SerdeContext";
@@ -43,6 +44,8 @@ export class HttpProtocol extends SerdeContext {
43
44
  }
44
45
  if (endpoint.headers) {
45
46
  for (const name in endpoint.headers) {
47
+ if (!hasOwn(endpoint.headers, name))
48
+ continue;
46
49
  request.headers[name] = endpoint.headers[name].join(", ");
47
50
  }
48
51
  }
@@ -58,6 +61,8 @@ export class HttpProtocol extends SerdeContext {
58
61
  };
59
62
  if (endpoint.headers) {
60
63
  for (const name in endpoint.headers) {
64
+ if (!hasOwn(endpoint.headers, name))
65
+ continue;
61
66
  request.headers[name] = endpoint.headers[name];
62
67
  }
63
68
  }