@aws-sdk/core 3.973.26 → 3.974.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -30,6 +30,22 @@ More information can be found at: https://a.co/c895JFp`);
30
30
  }
31
31
  };
32
32
 
33
+ const longPollMiddleware = () => (next, context) => async (args) => {
34
+ context.__retryLongPoll = true;
35
+ return next(args);
36
+ };
37
+ const longPollMiddlewareOptions = {
38
+ name: "longPollMiddleware",
39
+ tags: ["RETRY"],
40
+ step: "initialize",
41
+ override: true,
42
+ };
43
+ const getLongPollPlugin = (options) => ({
44
+ applyToStack: (clientStack) => {
45
+ clientStack.add(longPollMiddleware(), longPollMiddlewareOptions);
46
+ },
47
+ });
48
+
33
49
  function setCredentialFeature(credentials, feature, value) {
34
50
  if (!credentials.$source) {
35
51
  credentials.$source = {};
@@ -890,12 +906,6 @@ class JsonShapeSerializer extends SerdeContextConfig {
890
906
  this.rootSchema = schema.NormalizedSchema.of(schema$1);
891
907
  this.buffer = this._write(this.rootSchema, value);
892
908
  }
893
- writeDiscriminatedDocument(schema$1, value) {
894
- this.write(schema$1, value);
895
- if (typeof this.buffer === "object") {
896
- this.buffer.__type = schema.NormalizedSchema.of(schema$1).getName(true);
897
- }
898
- }
899
909
  flush() {
900
910
  const { rootSchema, useReplacer } = this;
901
911
  this.rootSchema = undefined;
@@ -909,6 +919,12 @@ class JsonShapeSerializer extends SerdeContextConfig {
909
919
  }
910
920
  return this.buffer;
911
921
  }
922
+ writeDiscriminatedDocument(schema$1, value) {
923
+ this.write(schema$1, value);
924
+ if (typeof this.buffer === "object") {
925
+ this.buffer.__type = schema.NormalizedSchema.of(schema$1).getName(true);
926
+ }
927
+ }
912
928
  _write(schema$1, value, container) {
913
929
  const isObject = value !== null && typeof value === "object";
914
930
  const ns = schema.NormalizedSchema.of(schema$1);
@@ -2229,6 +2245,7 @@ exports._toStr = _toStr;
2229
2245
  exports.awsExpectUnion = awsExpectUnion;
2230
2246
  exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
2231
2247
  exports.getBearerTokenEnvKey = getBearerTokenEnvKey;
2248
+ exports.getLongPollPlugin = getLongPollPlugin;
2232
2249
  exports.loadRestJsonErrorCode = loadRestJsonErrorCode;
2233
2250
  exports.loadRestXmlErrorCode = loadRestXmlErrorCode;
2234
2251
  exports.parseJsonBody = parseJsonBody;
@@ -16,6 +16,22 @@ More information can be found at: https://a.co/c895JFp`);
16
16
  }
17
17
  };
18
18
 
19
+ const longPollMiddleware = () => (next, context) => async (args) => {
20
+ context.__retryLongPoll = true;
21
+ return next(args);
22
+ };
23
+ const longPollMiddlewareOptions = {
24
+ name: "longPollMiddleware",
25
+ tags: ["RETRY"],
26
+ step: "initialize",
27
+ override: true,
28
+ };
29
+ const getLongPollPlugin = (options) => ({
30
+ applyToStack: (clientStack) => {
31
+ clientStack.add(longPollMiddleware(), longPollMiddlewareOptions);
32
+ },
33
+ });
34
+
19
35
  function setCredentialFeature(credentials, feature, value) {
20
36
  if (!credentials.$source) {
21
37
  credentials.$source = {};
@@ -45,6 +61,7 @@ function setTokenFeature(token, feature, value) {
45
61
  }
46
62
 
47
63
  exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
64
+ exports.getLongPollPlugin = getLongPollPlugin;
48
65
  exports.setCredentialFeature = setCredentialFeature;
49
66
  exports.setFeature = setFeature;
50
67
  exports.setTokenFeature = setTokenFeature;
@@ -552,12 +552,6 @@ class JsonShapeSerializer extends SerdeContextConfig {
552
552
  this.rootSchema = schema.NormalizedSchema.of(schema$1);
553
553
  this.buffer = this._write(this.rootSchema, value);
554
554
  }
555
- writeDiscriminatedDocument(schema$1, value) {
556
- this.write(schema$1, value);
557
- if (typeof this.buffer === "object") {
558
- this.buffer.__type = schema.NormalizedSchema.of(schema$1).getName(true);
559
- }
560
- }
561
555
  flush() {
562
556
  const { rootSchema, useReplacer } = this;
563
557
  this.rootSchema = undefined;
@@ -571,6 +565,12 @@ class JsonShapeSerializer extends SerdeContextConfig {
571
565
  }
572
566
  return this.buffer;
573
567
  }
568
+ writeDiscriminatedDocument(schema$1, value) {
569
+ this.write(schema$1, value);
570
+ if (typeof this.buffer === "object") {
571
+ this.buffer.__type = schema.NormalizedSchema.of(schema$1).getName(true);
572
+ }
573
+ }
574
574
  _write(schema$1, value, container) {
575
575
  const isObject = value !== null && typeof value === "object";
576
576
  const ns = schema.NormalizedSchema.of(schema$1);
@@ -1,4 +1,5 @@
1
1
  export * from "./emitWarningIfUnsupportedVersion";
2
+ export { getLongPollPlugin } from "./longPollMiddleware";
2
3
  export * from "./setCredentialFeature";
3
4
  export * from "./setFeature";
4
5
  export * from "./setTokenFeature";
@@ -0,0 +1,15 @@
1
+ export const longPollMiddleware = () => (next, context) => async (args) => {
2
+ context.__retryLongPoll = true;
3
+ return next(args);
4
+ };
5
+ export const longPollMiddlewareOptions = {
6
+ name: "longPollMiddleware",
7
+ tags: ["RETRY"],
8
+ step: "initialize",
9
+ override: true,
10
+ };
11
+ export const getLongPollPlugin = (options) => ({
12
+ applyToStack: (clientStack) => {
13
+ clientStack.add(longPollMiddleware(), longPollMiddlewareOptions);
14
+ },
15
+ });
@@ -17,12 +17,6 @@ export class JsonShapeSerializer extends SerdeContextConfig {
17
17
  this.rootSchema = NormalizedSchema.of(schema);
18
18
  this.buffer = this._write(this.rootSchema, value);
19
19
  }
20
- writeDiscriminatedDocument(schema, value) {
21
- this.write(schema, value);
22
- if (typeof this.buffer === "object") {
23
- this.buffer.__type = NormalizedSchema.of(schema).getName(true);
24
- }
25
- }
26
20
  flush() {
27
21
  const { rootSchema, useReplacer } = this;
28
22
  this.rootSchema = undefined;
@@ -36,6 +30,12 @@ export class JsonShapeSerializer extends SerdeContextConfig {
36
30
  }
37
31
  return this.buffer;
38
32
  }
33
+ writeDiscriminatedDocument(schema, value) {
34
+ this.write(schema, value);
35
+ if (typeof this.buffer === "object") {
36
+ this.buffer.__type = NormalizedSchema.of(schema).getName(true);
37
+ }
38
+ }
39
39
  _write(schema, value, container) {
40
40
  const isObject = value !== null && typeof value === "object";
41
41
  const ns = NormalizedSchema.of(schema);
@@ -1,4 +1,5 @@
1
1
  export * from "./emitWarningIfUnsupportedVersion";
2
+ export { getLongPollPlugin } from "./longPollMiddleware";
2
3
  export * from "./setCredentialFeature";
3
4
  export * from "./setFeature";
4
5
  export * from "./setTokenFeature";
@@ -0,0 +1,14 @@
1
+ import type { HandlerExecutionContext, InitializeHandler, InitializeHandlerOptions, MetadataBearer, Pluggable } from "@smithy/types";
2
+ /**
3
+ * This middleware is attached to operations designated as long-polling.
4
+ * @internal
5
+ */
6
+ export declare const longPollMiddleware: () => <Output extends MetadataBearer = MetadataBearer>(next: InitializeHandler<any, Output>, context: HandlerExecutionContext) => InitializeHandler<any, Output>;
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare const longPollMiddlewareOptions: InitializeHandlerOptions;
11
+ /**
12
+ * @internal
13
+ */
14
+ export declare const getLongPollPlugin: (options: {}) => Pluggable<any, any>;
@@ -16,13 +16,13 @@ export declare class JsonShapeSerializer extends SerdeContextConfig implements S
16
16
  protected rootSchema: NormalizedSchema | undefined;
17
17
  constructor(settings: JsonSettings);
18
18
  write(schema: Schema, value: unknown): void;
19
+ flush(): string;
19
20
  /**
20
21
  * @internal
21
22
  */
22
23
  writeDiscriminatedDocument(schema: Schema, value: unknown): void;
23
- flush(): string;
24
24
  /**
25
- * Order if-statements by order of likelihood.
25
+ * Order if-statements by likelihood.
26
26
  */
27
27
  protected _write(schema: Schema, value: unknown, container?: NormalizedSchema): any;
28
28
  }
@@ -1,4 +1,5 @@
1
1
  export * from "./emitWarningIfUnsupportedVersion";
2
+ export { getLongPollPlugin } from "./longPollMiddleware";
2
3
  export * from "./setCredentialFeature";
3
4
  export * from "./setFeature";
4
5
  export * from "./setTokenFeature";
@@ -0,0 +1,15 @@
1
+ import {
2
+ HandlerExecutionContext,
3
+ InitializeHandler,
4
+ InitializeHandlerOptions,
5
+ MetadataBearer,
6
+ Pluggable,
7
+ } from "@smithy/types";
8
+ export declare const longPollMiddleware: () => <
9
+ Output extends MetadataBearer = MetadataBearer
10
+ >(
11
+ next: InitializeHandler<any, Output>,
12
+ context: HandlerExecutionContext
13
+ ) => InitializeHandler<any, Output>;
14
+ export declare const longPollMiddlewareOptions: InitializeHandlerOptions;
15
+ export declare const getLongPollPlugin: (options: {}) => Pluggable<any, any>;
@@ -12,8 +12,8 @@ export declare class JsonShapeSerializer
12
12
  protected rootSchema: NormalizedSchema | undefined;
13
13
  constructor(settings: JsonSettings);
14
14
  write(schema: Schema, value: unknown): void;
15
- writeDiscriminatedDocument(schema: Schema, value: unknown): void;
16
15
  flush(): string;
16
+ writeDiscriminatedDocument(schema: Schema, value: unknown): void;
17
17
  protected _write(
18
18
  schema: Schema,
19
19
  value: unknown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/core",
3
- "version": "3.973.26",
3
+ "version": "3.974.0",
4
4
  "description": "Core functions & classes shared by multiple AWS SDK clients.",
5
5
  "scripts": {
6
6
  "build": "yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
@@ -81,17 +81,17 @@
81
81
  },
82
82
  "license": "Apache-2.0",
83
83
  "dependencies": {
84
- "@aws-sdk/types": "^3.973.6",
85
- "@aws-sdk/xml-builder": "^3.972.16",
86
- "@smithy/core": "^3.23.13",
87
- "@smithy/node-config-provider": "^4.3.12",
88
- "@smithy/property-provider": "^4.2.12",
89
- "@smithy/protocol-http": "^5.3.12",
90
- "@smithy/signature-v4": "^5.3.12",
91
- "@smithy/smithy-client": "^4.12.8",
92
- "@smithy/types": "^4.13.1",
84
+ "@aws-sdk/types": "^3.973.8",
85
+ "@aws-sdk/xml-builder": "^3.972.18",
86
+ "@smithy/core": "^3.23.15",
87
+ "@smithy/node-config-provider": "^4.3.14",
88
+ "@smithy/property-provider": "^4.2.14",
89
+ "@smithy/protocol-http": "^5.3.14",
90
+ "@smithy/signature-v4": "^5.3.14",
91
+ "@smithy/smithy-client": "^4.12.11",
92
+ "@smithy/types": "^4.14.1",
93
93
  "@smithy/util-base64": "^4.3.2",
94
- "@smithy/util-middleware": "^4.2.12",
94
+ "@smithy/util-middleware": "^4.2.14",
95
95
  "@smithy/util-utf8": "^4.2.2",
96
96
  "tslib": "^2.6.2"
97
97
  },