@cdk8s/awscdk-resolver 0.0.210 → 0.0.212

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 (53) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@smithy/abort-controller/package.json +2 -2
  4. package/node_modules/@smithy/config-resolver/package.json +4 -4
  5. package/node_modules/@smithy/core/package.json +6 -6
  6. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  7. package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
  8. package/node_modules/@smithy/hash-node/package.json +2 -2
  9. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  10. package/node_modules/@smithy/middleware-content-length/package.json +3 -3
  11. package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
  12. package/node_modules/@smithy/middleware-retry/package.json +8 -8
  13. package/node_modules/@smithy/middleware-serde/package.json +2 -2
  14. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  15. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  16. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -8
  17. package/node_modules/@smithy/node-http-handler/dist-es/timing.js +2 -2
  18. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +9 -6
  19. package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +2 -2
  20. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +2 -2
  21. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  22. package/node_modules/@smithy/property-provider/package.json +2 -2
  23. package/node_modules/@smithy/protocol-http/package.json +2 -2
  24. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  25. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  26. package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +2 -2
  27. package/node_modules/@smithy/service-error-classification/dist-es/index.js +3 -2
  28. package/node_modules/@smithy/service-error-classification/dist-types/index.d.ts +1 -1
  29. package/node_modules/@smithy/service-error-classification/dist-types/ts3.4/index.d.ts +1 -1
  30. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  31. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  32. package/node_modules/@smithy/signature-v4/package.json +4 -4
  33. package/node_modules/@smithy/smithy-client/dist-cjs/index.js +22 -34
  34. package/node_modules/@smithy/smithy-client/dist-es/lazy-json.js +22 -31
  35. package/node_modules/@smithy/smithy-client/dist-types/lazy-json.d.ts +34 -15
  36. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/lazy-json.d.ts +34 -15
  37. package/node_modules/@smithy/smithy-client/package.json +7 -7
  38. package/node_modules/@smithy/types/dist-types/shapes.d.ts +1 -0
  39. package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +1 -0
  40. package/node_modules/@smithy/types/package.json +1 -1
  41. package/node_modules/@smithy/url-parser/package.json +3 -3
  42. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  43. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  44. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  45. package/node_modules/@smithy/util-middleware/package.json +2 -2
  46. package/node_modules/@smithy/util-retry/package.json +3 -3
  47. package/node_modules/@smithy/util-stream/package.json +4 -4
  48. package/node_modules/@smithy/util-waiter/dist-cjs/index.js +31 -4
  49. package/node_modules/@smithy/util-waiter/dist-es/poller.js +30 -4
  50. package/node_modules/@smithy/util-waiter/dist-types/ts3.4/waiter.d.ts +5 -0
  51. package/node_modules/@smithy/util-waiter/dist-types/waiter.d.ts +5 -0
  52. package/node_modules/@smithy/util-waiter/package.json +3 -3
  53. package/package.json +6 -6
@@ -26,7 +26,6 @@ __export(src_exports, {
26
26
  NoOpLogger: () => NoOpLogger,
27
27
  SENSITIVE_STRING: () => SENSITIVE_STRING,
28
28
  ServiceException: () => ServiceException,
29
- StringWrapper: () => StringWrapper,
30
29
  _json: () => _json,
31
30
  collectBody: () => import_protocols.collectBody,
32
31
  convertMap: () => convertMap,
@@ -978,40 +977,30 @@ var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => {
978
977
  }, "isSerializableHeaderValue");
979
978
 
980
979
  // src/lazy-json.ts
981
- var StringWrapper = /* @__PURE__ */ __name(function() {
982
- const Class = Object.getPrototypeOf(this).constructor;
983
- const Constructor = Function.bind.apply(String, [null, ...arguments]);
984
- const instance = new Constructor();
985
- Object.setPrototypeOf(instance, Class.prototype);
986
- return instance;
987
- }, "StringWrapper");
988
- StringWrapper.prototype = Object.create(String.prototype, {
989
- constructor: {
990
- value: StringWrapper,
991
- enumerable: false,
992
- writable: true,
993
- configurable: true
994
- }
995
- });
996
- Object.setPrototypeOf(StringWrapper, String);
997
- var _LazyJsonString = class _LazyJsonString extends StringWrapper {
998
- deserializeJSON() {
999
- return JSON.parse(super.toString());
1000
- }
1001
- toJSON() {
1002
- return super.toString();
1003
- }
1004
- static fromObject(object) {
1005
- if (object instanceof _LazyJsonString) {
1006
- return object;
1007
- } else if (object instanceof String || typeof object === "string") {
1008
- return new _LazyJsonString(object);
980
+ function LazyJsonString(val) {
981
+ const str = Object.assign(new String(val), {
982
+ deserializeJSON() {
983
+ return JSON.parse(String(val));
984
+ },
985
+ toString() {
986
+ return String(val);
987
+ },
988
+ toJSON() {
989
+ return String(val);
1009
990
  }
1010
- return new _LazyJsonString(JSON.stringify(object));
1011
- }
991
+ });
992
+ return str;
993
+ }
994
+ __name(LazyJsonString, "LazyJsonString");
995
+ LazyJsonString.from = (object) => {
996
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || "deserializeJSON" in object)) {
997
+ return object;
998
+ } else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
999
+ return LazyJsonString(String(object));
1000
+ }
1001
+ return LazyJsonString(JSON.stringify(object));
1012
1002
  };
1013
- __name(_LazyJsonString, "LazyJsonString");
1014
- var LazyJsonString = _LazyJsonString;
1003
+ LazyJsonString.fromObject = LazyJsonString.from;
1015
1004
 
1016
1005
  // src/NoOpLogger.ts
1017
1006
  var _NoOpLogger = class _NoOpLogger {
@@ -1266,7 +1255,6 @@ var splitHeader = /* @__PURE__ */ __name((value) => {
1266
1255
  getArrayIfSingleItem,
1267
1256
  getValueFromTextNode,
1268
1257
  isSerializableHeaderValue,
1269
- StringWrapper,
1270
1258
  LazyJsonString,
1271
1259
  NoOpLogger,
1272
1260
  map,
@@ -1,33 +1,24 @@
1
- export const StringWrapper = function () {
2
- const Class = Object.getPrototypeOf(this).constructor;
3
- const Constructor = Function.bind.apply(String, [null, ...arguments]);
4
- const instance = new Constructor();
5
- Object.setPrototypeOf(instance, Class.prototype);
6
- return instance;
7
- };
8
- StringWrapper.prototype = Object.create(String.prototype, {
9
- constructor: {
10
- value: StringWrapper,
11
- enumerable: false,
12
- writable: true,
13
- configurable: true,
14
- },
15
- });
16
- Object.setPrototypeOf(StringWrapper, String);
17
- export class LazyJsonString extends StringWrapper {
18
- deserializeJSON() {
19
- return JSON.parse(super.toString());
20
- }
21
- toJSON() {
22
- return super.toString();
1
+ export function LazyJsonString(val) {
2
+ const str = Object.assign(new String(val), {
3
+ deserializeJSON() {
4
+ return JSON.parse(String(val));
5
+ },
6
+ toString() {
7
+ return String(val);
8
+ },
9
+ toJSON() {
10
+ return String(val);
11
+ },
12
+ });
13
+ return str;
14
+ }
15
+ LazyJsonString.from = (object) => {
16
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || "deserializeJSON" in object)) {
17
+ return object;
23
18
  }
24
- static fromObject(object) {
25
- if (object instanceof LazyJsonString) {
26
- return object;
27
- }
28
- else if (object instanceof String || typeof object === "string") {
29
- return new LazyJsonString(object);
30
- }
31
- return new LazyJsonString(JSON.stringify(object));
19
+ else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
20
+ return LazyJsonString(String(object));
32
21
  }
33
- }
22
+ return LazyJsonString(JSON.stringify(object));
23
+ };
24
+ LazyJsonString.fromObject = LazyJsonString.from;
@@ -1,24 +1,43 @@
1
1
  /**
2
- * Lazy String holder for JSON typed contents.
3
- */
4
- interface StringWrapper {
5
- new (arg: any): String;
6
- }
7
- /**
8
- * Because of https://github.com/microsoft/tslib/issues/95,
9
- * TS 'extends' shim doesn't support extending native types like String.
10
- * So here we create StringWrapper that duplicate everything from String
11
- * class including its prototype chain. So we can extend from here.
2
+ * @public
12
3
  *
13
- * @internal
4
+ * A model field with this type means that you may provide a JavaScript
5
+ * object in lieu of a JSON string, and it will be serialized to JSON
6
+ * automatically before being sent in a request.
7
+ *
8
+ * For responses, you will receive a "LazyJsonString", which is a boxed String object
9
+ * with additional mixin methods.
10
+ * To get the string value, call `.toString()`, or to get the JSON object value,
11
+ * call `.deserializeJSON()` or parse it yourself.
14
12
  */
15
- export declare const StringWrapper: StringWrapper;
13
+ export type AutomaticJsonStringConversion = Parameters<typeof JSON.stringify>[0] | LazyJsonString;
16
14
  /**
17
15
  * @internal
16
+ *
18
17
  */
19
- export declare class LazyJsonString extends StringWrapper {
18
+ export interface LazyJsonString extends String {
19
+ new (s: string): typeof LazyJsonString;
20
+ /**
21
+ * @returns the JSON parsing of the string value.
22
+ */
20
23
  deserializeJSON(): any;
24
+ /**
25
+ * @returns the original string value rather than a JSON.stringified value.
26
+ */
21
27
  toJSON(): string;
22
- static fromObject(object: any): LazyJsonString;
23
28
  }
24
- export {};
29
+ /**
30
+ * @internal
31
+ *
32
+ * Extension of the native String class in the previous implementation
33
+ * has negative global performance impact on method dispatch for strings,
34
+ * and is generally discouraged.
35
+ *
36
+ * This current implementation may look strange, but is necessary to preserve the interface and
37
+ * behavior of extending the String class.
38
+ */
39
+ export declare function LazyJsonString(val: string): void;
40
+ export declare namespace LazyJsonString {
41
+ var from: (object: any) => LazyJsonString;
42
+ var fromObject: (object: any) => LazyJsonString;
43
+ }
@@ -1,24 +1,43 @@
1
1
  /**
2
- * Lazy String holder for JSON typed contents.
3
- */
4
- interface StringWrapper {
5
- new (arg: any): String;
6
- }
7
- /**
8
- * Because of https://github.com/microsoft/tslib/issues/95,
9
- * TS 'extends' shim doesn't support extending native types like String.
10
- * So here we create StringWrapper that duplicate everything from String
11
- * class including its prototype chain. So we can extend from here.
2
+ * @public
12
3
  *
13
- * @internal
4
+ * A model field with this type means that you may provide a JavaScript
5
+ * object in lieu of a JSON string, and it will be serialized to JSON
6
+ * automatically before being sent in a request.
7
+ *
8
+ * For responses, you will receive a "LazyJsonString", which is a boxed String object
9
+ * with additional mixin methods.
10
+ * To get the string value, call `.toString()`, or to get the JSON object value,
11
+ * call `.deserializeJSON()` or parse it yourself.
14
12
  */
15
- export declare const StringWrapper: StringWrapper;
13
+ export type AutomaticJsonStringConversion = Parameters<typeof JSON.stringify>[0] | LazyJsonString;
16
14
  /**
17
15
  * @internal
16
+ *
18
17
  */
19
- export declare class LazyJsonString extends StringWrapper {
18
+ export interface LazyJsonString extends String {
19
+ new (s: string): typeof LazyJsonString;
20
+ /**
21
+ * @returns the JSON parsing of the string value.
22
+ */
20
23
  deserializeJSON(): any;
24
+ /**
25
+ * @returns the original string value rather than a JSON.stringified value.
26
+ */
21
27
  toJSON(): string;
22
- static fromObject(object: any): LazyJsonString;
23
28
  }
24
- export {};
29
+ /**
30
+ * @internal
31
+ *
32
+ * Extension of the native String class in the previous implementation
33
+ * has negative global performance impact on method dispatch for strings,
34
+ * and is generally discouraged.
35
+ *
36
+ * This current implementation may look strange, but is necessary to preserve the interface and
37
+ * behavior of extending the String class.
38
+ */
39
+ export declare function LazyJsonString(val: string): void;
40
+ export declare namespace LazyJsonString {
41
+ var from: (object: any) => LazyJsonString;
42
+ var fromObject: (object: any) => LazyJsonString;
43
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/smithy-client",
3
- "version": "3.4.5",
3
+ "version": "3.5.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline smithy-client",
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@smithy/core": "^2.5.4",
28
- "@smithy/middleware-endpoint": "^3.2.4",
29
- "@smithy/middleware-stack": "^3.0.10",
30
- "@smithy/protocol-http": "^4.1.7",
31
- "@smithy/types": "^3.7.1",
32
- "@smithy/util-stream": "^3.3.1",
27
+ "@smithy/core": "^2.5.5",
28
+ "@smithy/middleware-endpoint": "^3.2.5",
29
+ "@smithy/middleware-stack": "^3.0.11",
30
+ "@smithy/protocol-http": "^4.1.8",
31
+ "@smithy/types": "^3.7.2",
32
+ "@smithy/util-stream": "^3.3.2",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "engines": {
@@ -78,4 +78,5 @@ export type SdkError = Error & Partial<SmithyException> & Partial<MetadataBearer
78
78
  */
79
79
  readonly clockSkewCorrected?: true;
80
80
  };
81
+ cause?: Error;
81
82
  };
@@ -78,4 +78,5 @@ export type SdkError = Error & Partial<SmithyException> & Partial<MetadataBearer
78
78
  */
79
79
  readonly clockSkewCorrected?: true;
80
80
  };
81
+ cause?: Error;
81
82
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/types",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline types",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/url-parser",
3
- "version": "3.0.10",
3
+ "version": "3.0.11",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline url-parser",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/querystring-parser": "^3.0.10",
27
- "@smithy/types": "^3.7.1",
26
+ "@smithy/querystring-parser": "^3.0.11",
27
+ "@smithy/types": "^3.7.2",
28
28
  "tslib": "^2.6.2"
29
29
  },
30
30
  "typesVersions": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-browser",
3
- "version": "3.0.28",
3
+ "version": "3.0.30",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-defaults-mode-browser",
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/property-provider": "^3.1.10",
27
- "@smithy/smithy-client": "^3.4.5",
28
- "@smithy/types": "^3.7.1",
26
+ "@smithy/property-provider": "^3.1.11",
27
+ "@smithy/smithy-client": "^3.5.0",
28
+ "@smithy/types": "^3.7.2",
29
29
  "bowser": "^2.11.0",
30
30
  "tslib": "^2.6.2"
31
31
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-node",
3
- "version": "3.0.28",
3
+ "version": "3.0.30",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-defaults-mode-node",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/config-resolver": "^3.0.12",
27
- "@smithy/credential-provider-imds": "^3.2.7",
28
- "@smithy/node-config-provider": "^3.1.11",
29
- "@smithy/property-provider": "^3.1.10",
30
- "@smithy/smithy-client": "^3.4.5",
31
- "@smithy/types": "^3.7.1",
26
+ "@smithy/config-resolver": "^3.0.13",
27
+ "@smithy/credential-provider-imds": "^3.2.8",
28
+ "@smithy/node-config-provider": "^3.1.12",
29
+ "@smithy/property-provider": "^3.1.11",
30
+ "@smithy/smithy-client": "^3.5.0",
31
+ "@smithy/types": "^3.7.2",
32
32
  "tslib": "^2.6.2"
33
33
  },
34
34
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-endpoints",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "Utilities to help with endpoint resolution.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@smithy/node-config-provider": "^3.1.11",
32
- "@smithy/types": "^3.7.1",
31
+ "@smithy/node-config-provider": "^3.1.12",
32
+ "@smithy/types": "^3.7.2",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-middleware",
3
- "version": "3.0.10",
3
+ "version": "3.0.11",
4
4
  "description": "Shared utilities for to be used in middleware packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@smithy/types": "^3.7.1",
30
+ "@smithy/types": "^3.7.2",
31
31
  "tslib": "^2.6.2"
32
32
  },
33
33
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-retry",
3
- "version": "3.0.10",
3
+ "version": "3.0.11",
4
4
  "description": "Shared retry utilities to be used in middleware packages.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@smithy/service-error-classification": "^3.0.10",
32
- "@smithy/types": "^3.7.1",
31
+ "@smithy/service-error-classification": "^3.0.11",
32
+ "@smithy/types": "^3.7.2",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-stream",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-stream",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@smithy/fetch-http-handler": "^4.1.1",
32
- "@smithy/node-http-handler": "^3.3.1",
33
- "@smithy/types": "^3.7.1",
31
+ "@smithy/fetch-http-handler": "^4.1.2",
32
+ "@smithy/node-http-handler": "^3.3.2",
33
+ "@smithy/types": "^3.7.2",
34
34
  "@smithy/util-base64": "^3.0.0",
35
35
  "@smithy/util-buffer-from": "^3.0.0",
36
36
  "@smithy/util-hex-encoding": "^3.0.0",
@@ -80,29 +80,56 @@ var exponentialBackoffWithJitter = /* @__PURE__ */ __name((minDelay, maxDelay, a
80
80
  var randomInRange = /* @__PURE__ */ __name((min, max) => min + Math.random() * (max - min), "randomInRange");
81
81
  var runPolling = /* @__PURE__ */ __name(async ({ minDelay, maxDelay, maxWaitTime, abortController, client, abortSignal }, input, acceptorChecks) => {
82
82
  var _a;
83
+ const observedResponses = {};
83
84
  const { state, reason } = await acceptorChecks(client, input);
85
+ if (reason) {
86
+ const message = createMessageFromResponse(reason);
87
+ observedResponses[message] |= 0;
88
+ observedResponses[message] += 1;
89
+ }
84
90
  if (state !== "RETRY" /* RETRY */) {
85
- return { state, reason };
91
+ return { state, reason, observedResponses };
86
92
  }
87
93
  let currentAttempt = 1;
88
94
  const waitUntil = Date.now() + maxWaitTime * 1e3;
89
95
  const attemptCeiling = Math.log(maxDelay / minDelay) / Math.log(2) + 1;
90
96
  while (true) {
91
97
  if (((_a = abortController == null ? void 0 : abortController.signal) == null ? void 0 : _a.aborted) || (abortSignal == null ? void 0 : abortSignal.aborted)) {
92
- return { state: "ABORTED" /* ABORTED */ };
98
+ const message = "AbortController signal aborted.";
99
+ observedResponses[message] |= 0;
100
+ observedResponses[message] += 1;
101
+ return { state: "ABORTED" /* ABORTED */, observedResponses };
93
102
  }
94
103
  const delay = exponentialBackoffWithJitter(minDelay, maxDelay, attemptCeiling, currentAttempt);
95
104
  if (Date.now() + delay * 1e3 > waitUntil) {
96
- return { state: "TIMEOUT" /* TIMEOUT */ };
105
+ return { state: "TIMEOUT" /* TIMEOUT */, observedResponses };
97
106
  }
98
107
  await sleep(delay);
99
108
  const { state: state2, reason: reason2 } = await acceptorChecks(client, input);
109
+ if (reason2) {
110
+ const message = createMessageFromResponse(reason2);
111
+ observedResponses[message] |= 0;
112
+ observedResponses[message] += 1;
113
+ }
100
114
  if (state2 !== "RETRY" /* RETRY */) {
101
- return { state: state2, reason: reason2 };
115
+ return { state: state2, reason: reason2, observedResponses };
102
116
  }
103
117
  currentAttempt += 1;
104
118
  }
105
119
  }, "runPolling");
120
+ var createMessageFromResponse = /* @__PURE__ */ __name((reason) => {
121
+ var _a;
122
+ if (reason == null ? void 0 : reason.$responseBodyText) {
123
+ return `Deserialization error for body: ${reason.$responseBodyText}`;
124
+ }
125
+ if ((_a = reason == null ? void 0 : reason.$metadata) == null ? void 0 : _a.httpStatusCode) {
126
+ if (reason.$response || reason.message) {
127
+ return `${reason.$response.statusCode ?? reason.$metadata.httpStatusCode ?? "Unknown"}: ${reason.message}`;
128
+ }
129
+ return `${reason.$metadata.httpStatusCode}: OK`;
130
+ }
131
+ return String((reason == null ? void 0 : reason.message) ?? JSON.stringify(reason) ?? "Unknown");
132
+ }, "createMessageFromResponse");
106
133
 
107
134
  // src/utils/validate.ts
108
135
  var validateWaiterOptions = /* @__PURE__ */ __name((options) => {
@@ -8,26 +8,52 @@ const exponentialBackoffWithJitter = (minDelay, maxDelay, attemptCeiling, attemp
8
8
  };
9
9
  const randomInRange = (min, max) => min + Math.random() * (max - min);
10
10
  export const runPolling = async ({ minDelay, maxDelay, maxWaitTime, abortController, client, abortSignal }, input, acceptorChecks) => {
11
+ const observedResponses = {};
11
12
  const { state, reason } = await acceptorChecks(client, input);
13
+ if (reason) {
14
+ const message = createMessageFromResponse(reason);
15
+ observedResponses[message] |= 0;
16
+ observedResponses[message] += 1;
17
+ }
12
18
  if (state !== WaiterState.RETRY) {
13
- return { state, reason };
19
+ return { state, reason, observedResponses };
14
20
  }
15
21
  let currentAttempt = 1;
16
22
  const waitUntil = Date.now() + maxWaitTime * 1000;
17
23
  const attemptCeiling = Math.log(maxDelay / minDelay) / Math.log(2) + 1;
18
24
  while (true) {
19
25
  if (abortController?.signal?.aborted || abortSignal?.aborted) {
20
- return { state: WaiterState.ABORTED };
26
+ const message = "AbortController signal aborted.";
27
+ observedResponses[message] |= 0;
28
+ observedResponses[message] += 1;
29
+ return { state: WaiterState.ABORTED, observedResponses };
21
30
  }
22
31
  const delay = exponentialBackoffWithJitter(minDelay, maxDelay, attemptCeiling, currentAttempt);
23
32
  if (Date.now() + delay * 1000 > waitUntil) {
24
- return { state: WaiterState.TIMEOUT };
33
+ return { state: WaiterState.TIMEOUT, observedResponses };
25
34
  }
26
35
  await sleep(delay);
27
36
  const { state, reason } = await acceptorChecks(client, input);
37
+ if (reason) {
38
+ const message = createMessageFromResponse(reason);
39
+ observedResponses[message] |= 0;
40
+ observedResponses[message] += 1;
41
+ }
28
42
  if (state !== WaiterState.RETRY) {
29
- return { state, reason };
43
+ return { state, reason, observedResponses };
30
44
  }
31
45
  currentAttempt += 1;
32
46
  }
33
47
  };
48
+ const createMessageFromResponse = (reason) => {
49
+ if (reason?.$responseBodyText) {
50
+ return `Deserialization error for body: ${reason.$responseBodyText}`;
51
+ }
52
+ if (reason?.$metadata?.httpStatusCode) {
53
+ if (reason.$response || reason.message) {
54
+ return `${reason.$response.statusCode ?? reason.$metadata.httpStatusCode ?? "Unknown"}: ${reason.message}`;
55
+ }
56
+ return `${reason.$metadata.httpStatusCode}: OK`;
57
+ }
58
+ return String(reason?.message ?? JSON.stringify(reason) ?? "Unknown");
59
+ };
@@ -34,6 +34,11 @@ export type WaiterResult = {
34
34
  * (optional) Indicates a reason for why a waiter has reached its state.
35
35
  */
36
36
  reason?: any;
37
+ /**
38
+ * Responses observed by the waiter during its polling, where the value
39
+ * is the count.
40
+ */
41
+ observedResponses?: Record<string, number>;
37
42
  };
38
43
  /**
39
44
  * @internal
@@ -34,6 +34,11 @@ export type WaiterResult = {
34
34
  * (optional) Indicates a reason for why a waiter has reached its state.
35
35
  */
36
36
  reason?: any;
37
+ /**
38
+ * Responses observed by the waiter during its polling, where the value
39
+ * is the count.
40
+ */
41
+ observedResponses?: Record<string, number>;
37
42
  };
38
43
  /**
39
44
  * @internal
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@smithy/util-waiter",
3
- "version": "3.1.9",
3
+ "version": "3.2.0",
4
4
  "description": "Shared utilities for client waiters for the AWS SDK",
5
5
  "dependencies": {
6
- "@smithy/abort-controller": "^3.1.8",
7
- "@smithy/types": "^3.7.1",
6
+ "@smithy/abort-controller": "^3.1.9",
7
+ "@smithy/types": "^3.7.2",
8
8
  "tslib": "^2.6.2"
9
9
  },
10
10
  "scripts": {
package/package.json CHANGED
@@ -42,21 +42,21 @@
42
42
  "organization": false
43
43
  },
44
44
  "devDependencies": {
45
- "@cdk8s/projen-common": "0.0.558",
45
+ "@cdk8s/projen-common": "0.0.560",
46
46
  "@stylistic/eslint-plugin": "^2",
47
47
  "@types/fs-extra": "^11.0.4",
48
48
  "@types/jest": "^27",
49
49
  "@types/node": "16.18.78",
50
50
  "@typescript-eslint/eslint-plugin": "^8",
51
51
  "@typescript-eslint/parser": "^8",
52
- "aws-cdk": "^2.171.1",
52
+ "aws-cdk": "^2.172.0",
53
53
  "aws-cdk-lib": "2.109.0",
54
54
  "cdk8s": "2.68.91",
55
- "cdk8s-cli": "^2.198.272",
55
+ "cdk8s-cli": "^2.198.278",
56
56
  "commit-and-tag-version": "^12",
57
57
  "constructs": "10.3.0",
58
58
  "eslint": "^9",
59
- "eslint-import-resolver-typescript": "^3.6.3",
59
+ "eslint-import-resolver-typescript": "^3.7.0",
60
60
  "eslint-plugin-import": "^2.31.0",
61
61
  "fs-extra": "^11.2.0",
62
62
  "jest": "^27",
@@ -66,7 +66,7 @@
66
66
  "jsii-docgen": "^10.5.0",
67
67
  "jsii-pacmak": "^1.105.0",
68
68
  "jsii-rosetta": "^5",
69
- "projen": "^0.90.5",
69
+ "projen": "^0.90.6",
70
70
  "ts-jest": "^27",
71
71
  "ts-node": "^10.9.2",
72
72
  "typescript": "^5.7.2"
@@ -93,7 +93,7 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "version": "0.0.210",
96
+ "version": "0.0.212",
97
97
  "jest": {
98
98
  "coverageProvider": "v8",
99
99
  "testMatch": [