@aws-sdk/client-lex-runtime-v2 3.620.1 → 3.622.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.
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHttpAuthSchemeConfig = exports.defaultLexRuntimeV2HttpAuthSchemeProvider = exports.defaultLexRuntimeV2HttpAuthSchemeParametersProvider = void 0;
4
+ const core_1 = require("@aws-sdk/core");
5
+ const util_middleware_1 = require("@smithy/util-middleware");
6
+ const defaultLexRuntimeV2HttpAuthSchemeParametersProvider = async (config, context, input) => {
7
+ return {
8
+ operation: (0, util_middleware_1.getSmithyContext)(context).operation,
9
+ region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
10
+ (() => {
11
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
12
+ })(),
13
+ };
14
+ };
15
+ exports.defaultLexRuntimeV2HttpAuthSchemeParametersProvider = defaultLexRuntimeV2HttpAuthSchemeParametersProvider;
16
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
17
+ return {
18
+ schemeId: "aws.auth#sigv4",
19
+ signingProperties: {
20
+ name: "lex",
21
+ region: authParameters.region,
22
+ },
23
+ propertiesExtractor: (config, context) => ({
24
+ signingProperties: {
25
+ config,
26
+ context,
27
+ },
28
+ }),
29
+ };
30
+ }
31
+ const defaultLexRuntimeV2HttpAuthSchemeProvider = (authParameters) => {
32
+ const options = [];
33
+ switch (authParameters.operation) {
34
+ default: {
35
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
36
+ }
37
+ }
38
+ return options;
39
+ };
40
+ exports.defaultLexRuntimeV2HttpAuthSchemeProvider = defaultLexRuntimeV2HttpAuthSchemeProvider;
41
+ const resolveHttpAuthSchemeConfig = (config) => {
42
+ const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config);
43
+ return {
44
+ ...config_0,
45
+ };
46
+ };
47
+ exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
package/dist-cjs/index.js CHANGED
@@ -79,14 +79,15 @@ var import_middleware_eventstream = require("@aws-sdk/middleware-eventstream");
79
79
  var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
80
80
  var import_middleware_logger = require("@aws-sdk/middleware-logger");
81
81
  var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
82
- var import_middleware_signing = require("@aws-sdk/middleware-signing");
83
82
  var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
84
83
  var import_config_resolver = require("@smithy/config-resolver");
84
+ var import_core = require("@smithy/core");
85
85
  var import_eventstream_serde_config_resolver = require("@smithy/eventstream-serde-config-resolver");
86
86
  var import_middleware_content_length = require("@smithy/middleware-content-length");
87
87
  var import_middleware_endpoint = require("@smithy/middleware-endpoint");
88
88
  var import_middleware_retry = require("@smithy/middleware-retry");
89
89
 
90
+ var import_httpAuthSchemeProvider = require("./auth/httpAuthSchemeProvider");
90
91
 
91
92
  // src/endpoint/EndpointParameters.ts
92
93
  var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
@@ -111,19 +112,62 @@ var import_runtimeConfig = require("././runtimeConfig");
111
112
  var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
112
113
  var import_protocol_http = require("@smithy/protocol-http");
113
114
  var import_smithy_client = require("@smithy/smithy-client");
115
+
116
+ // src/auth/httpAuthExtensionConfiguration.ts
117
+ var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
118
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
119
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
120
+ let _credentials = runtimeConfig.credentials;
121
+ return {
122
+ setHttpAuthScheme(httpAuthScheme) {
123
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
124
+ if (index === -1) {
125
+ _httpAuthSchemes.push(httpAuthScheme);
126
+ } else {
127
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
128
+ }
129
+ },
130
+ httpAuthSchemes() {
131
+ return _httpAuthSchemes;
132
+ },
133
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
134
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
135
+ },
136
+ httpAuthSchemeProvider() {
137
+ return _httpAuthSchemeProvider;
138
+ },
139
+ setCredentials(credentials) {
140
+ _credentials = credentials;
141
+ },
142
+ credentials() {
143
+ return _credentials;
144
+ }
145
+ };
146
+ }, "getHttpAuthExtensionConfiguration");
147
+ var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => {
148
+ return {
149
+ httpAuthSchemes: config.httpAuthSchemes(),
150
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
151
+ credentials: config.credentials()
152
+ };
153
+ }, "resolveHttpAuthRuntimeConfig");
154
+
155
+ // src/runtimeExtensions.ts
114
156
  var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial");
115
157
  var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
116
158
  const extensionConfiguration = {
117
159
  ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)),
118
160
  ...asPartial((0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig)),
119
- ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig))
161
+ ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
162
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig))
120
163
  };
121
164
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
122
165
  return {
123
166
  ...runtimeConfig,
124
167
  ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
125
168
  ...(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
126
- ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration)
169
+ ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
170
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration)
127
171
  };
128
172
  }, "resolveRuntimeExtensions");
129
173
 
@@ -132,24 +176,32 @@ var _LexRuntimeV2Client = class _LexRuntimeV2Client extends import_smithy_client
132
176
  constructor(...[configuration]) {
133
177
  const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {});
134
178
  const _config_1 = resolveClientEndpointParameters(_config_0);
135
- const _config_2 = (0, import_config_resolver.resolveRegionConfig)(_config_1);
136
- const _config_3 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_2);
137
- const _config_4 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_3);
138
- const _config_5 = (0, import_middleware_signing.resolveAwsAuthConfig)(_config_4);
139
- const _config_6 = (0, import_middleware_eventstream.resolveEventStreamConfig)(_config_5);
140
- const _config_7 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_6);
141
- const _config_8 = (0, import_middleware_retry.resolveRetryConfig)(_config_7);
142
- const _config_9 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_8);
179
+ const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1);
180
+ const _config_3 = (0, import_middleware_retry.resolveRetryConfig)(_config_2);
181
+ const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3);
182
+ const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
183
+ const _config_6 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_5);
184
+ const _config_7 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_6);
185
+ const _config_8 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_7);
186
+ const _config_9 = (0, import_middleware_eventstream.resolveEventStreamConfig)(_config_8);
143
187
  const _config_10 = resolveRuntimeExtensions(_config_9, (configuration == null ? void 0 : configuration.extensions) || []);
144
188
  super(_config_10);
145
189
  this.config = _config_10;
146
- this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
147
- this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
148
- this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
149
- this.middlewareStack.use((0, import_middleware_signing.getAwsAuthPlugin)(this.config));
150
190
  this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
151
191
  this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
152
192
  this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
193
+ this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
194
+ this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
195
+ this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
196
+ this.middlewareStack.use(
197
+ (0, import_core.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
198
+ httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultLexRuntimeV2HttpAuthSchemeParametersProvider,
199
+ identityProviderConfigProvider: async (config) => new import_core.DefaultIdentityProviderConfig({
200
+ "aws.auth#sigv4": config.credentials
201
+ })
202
+ })
203
+ );
204
+ this.middlewareStack.use((0, import_core.getHttpSigningPlugin)(this.config));
153
205
  }
154
206
  /**
155
207
  * Destroy underlying resources, like sockets. It's usually not necessary to do this.
@@ -172,8 +224,8 @@ var import_middleware_serde = require("@smithy/middleware-serde");
172
224
 
173
225
 
174
226
  // src/protocols/Aws_restJson1.ts
175
- var import_core = require("@aws-sdk/core");
176
- var import_core2 = require("@smithy/core");
227
+ var import_core2 = require("@aws-sdk/core");
228
+
177
229
 
178
230
 
179
231
  // src/models/LexRuntimeV2ServiceException.ts
@@ -560,7 +612,7 @@ var StartConversationResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) =
560
612
 
561
613
  // src/protocols/Aws_restJson1.ts
562
614
  var se_DeleteSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
563
- const b = (0, import_core2.requestBuilder)(input, context);
615
+ const b = (0, import_core.requestBuilder)(input, context);
564
616
  const headers = {};
565
617
  b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
566
618
  b.p("botId", () => input.botId, "{botId}", false);
@@ -572,7 +624,7 @@ var se_DeleteSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
572
624
  return b.build();
573
625
  }, "se_DeleteSessionCommand");
574
626
  var se_GetSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
575
- const b = (0, import_core2.requestBuilder)(input, context);
627
+ const b = (0, import_core.requestBuilder)(input, context);
576
628
  const headers = {};
577
629
  b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
578
630
  b.p("botId", () => input.botId, "{botId}", false);
@@ -584,7 +636,7 @@ var se_GetSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
584
636
  return b.build();
585
637
  }, "se_GetSessionCommand");
586
638
  var se_PutSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
587
- const b = (0, import_core2.requestBuilder)(input, context);
639
+ const b = (0, import_core.requestBuilder)(input, context);
588
640
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
589
641
  "content-type": "application/json",
590
642
  [_r]: input[_rCT]
@@ -606,7 +658,7 @@ var se_PutSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
606
658
  return b.build();
607
659
  }, "se_PutSessionCommand");
608
660
  var se_RecognizeTextCommand = /* @__PURE__ */ __name(async (input, context) => {
609
- const b = (0, import_core2.requestBuilder)(input, context);
661
+ const b = (0, import_core.requestBuilder)(input, context);
610
662
  const headers = {
611
663
  "content-type": "application/json"
612
664
  };
@@ -627,7 +679,7 @@ var se_RecognizeTextCommand = /* @__PURE__ */ __name(async (input, context) => {
627
679
  return b.build();
628
680
  }, "se_RecognizeTextCommand");
629
681
  var se_RecognizeUtteranceCommand = /* @__PURE__ */ __name(async (input, context) => {
630
- const b = (0, import_core2.requestBuilder)(input, context);
682
+ const b = (0, import_core.requestBuilder)(input, context);
631
683
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
632
684
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
633
685
  [_ct]: input[_rCTe] || "application/octet-stream",
@@ -648,7 +700,7 @@ var se_RecognizeUtteranceCommand = /* @__PURE__ */ __name(async (input, context)
648
700
  return b.build();
649
701
  }, "se_RecognizeUtteranceCommand");
650
702
  var se_StartConversationCommand = /* @__PURE__ */ __name(async (input, context) => {
651
- const b = (0, import_core2.requestBuilder)(input, context);
703
+ const b = (0, import_core.requestBuilder)(input, context);
652
704
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
653
705
  "content-type": "application/json",
654
706
  [_xalcm]: input[_cM]
@@ -672,7 +724,7 @@ var de_DeleteSessionCommand = /* @__PURE__ */ __name(async (output, context) =>
672
724
  const contents = (0, import_smithy_client.map)({
673
725
  $metadata: deserializeMetadata(output)
674
726
  });
675
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
727
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
676
728
  const doc = (0, import_smithy_client.take)(data, {
677
729
  botAliasId: import_smithy_client.expectString,
678
730
  botId: import_smithy_client.expectString,
@@ -689,7 +741,7 @@ var de_GetSessionCommand = /* @__PURE__ */ __name(async (output, context) => {
689
741
  const contents = (0, import_smithy_client.map)({
690
742
  $metadata: deserializeMetadata(output)
691
743
  });
692
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
744
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
693
745
  const doc = (0, import_smithy_client.take)(data, {
694
746
  interpretations: (_) => de_Interpretations(_, context),
695
747
  messages: import_smithy_client._json,
@@ -723,7 +775,7 @@ var de_RecognizeTextCommand = /* @__PURE__ */ __name(async (output, context) =>
723
775
  const contents = (0, import_smithy_client.map)({
724
776
  $metadata: deserializeMetadata(output)
725
777
  });
726
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
778
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
727
779
  const doc = (0, import_smithy_client.take)(data, {
728
780
  interpretations: (_) => de_Interpretations(_, context),
729
781
  messages: import_smithy_client._json,
@@ -770,9 +822,9 @@ var de_StartConversationCommand = /* @__PURE__ */ __name(async (output, context)
770
822
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
771
823
  const parsedOutput = {
772
824
  ...output,
773
- body: await (0, import_core.parseJsonErrorBody)(output.body, context)
825
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
774
826
  };
775
- const errorCode = (0, import_core.loadRestJsonErrorCode)(output, parsedOutput.body);
827
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
776
828
  switch (errorCode) {
777
829
  case "AccessDeniedException":
778
830
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
@@ -1077,92 +1129,92 @@ var de_StartConversationResponseEventStream = /* @__PURE__ */ __name((output, co
1077
1129
  var de_AccessDeniedException_event = /* @__PURE__ */ __name(async (output, context) => {
1078
1130
  const parsedOutput = {
1079
1131
  ...output,
1080
- body: await (0, import_core.parseJsonBody)(output.body, context)
1132
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1081
1133
  };
1082
1134
  return de_AccessDeniedExceptionRes(parsedOutput, context);
1083
1135
  }, "de_AccessDeniedException_event");
1084
1136
  var de_AudioResponseEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1085
1137
  const contents = {};
1086
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1138
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1087
1139
  Object.assign(contents, de_AudioResponseEvent(data, context));
1088
1140
  return contents;
1089
1141
  }, "de_AudioResponseEvent_event");
1090
1142
  var de_BadGatewayException_event = /* @__PURE__ */ __name(async (output, context) => {
1091
1143
  const parsedOutput = {
1092
1144
  ...output,
1093
- body: await (0, import_core.parseJsonBody)(output.body, context)
1145
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1094
1146
  };
1095
1147
  return de_BadGatewayExceptionRes(parsedOutput, context);
1096
1148
  }, "de_BadGatewayException_event");
1097
1149
  var de_ConflictException_event = /* @__PURE__ */ __name(async (output, context) => {
1098
1150
  const parsedOutput = {
1099
1151
  ...output,
1100
- body: await (0, import_core.parseJsonBody)(output.body, context)
1152
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1101
1153
  };
1102
1154
  return de_ConflictExceptionRes(parsedOutput, context);
1103
1155
  }, "de_ConflictException_event");
1104
1156
  var de_DependencyFailedException_event = /* @__PURE__ */ __name(async (output, context) => {
1105
1157
  const parsedOutput = {
1106
1158
  ...output,
1107
- body: await (0, import_core.parseJsonBody)(output.body, context)
1159
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1108
1160
  };
1109
1161
  return de_DependencyFailedExceptionRes(parsedOutput, context);
1110
1162
  }, "de_DependencyFailedException_event");
1111
1163
  var de_HeartbeatEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1112
1164
  const contents = {};
1113
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1165
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1114
1166
  Object.assign(contents, (0, import_smithy_client._json)(data));
1115
1167
  return contents;
1116
1168
  }, "de_HeartbeatEvent_event");
1117
1169
  var de_IntentResultEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1118
1170
  const contents = {};
1119
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1171
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1120
1172
  Object.assign(contents, de_IntentResultEvent(data, context));
1121
1173
  return contents;
1122
1174
  }, "de_IntentResultEvent_event");
1123
1175
  var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
1124
1176
  const parsedOutput = {
1125
1177
  ...output,
1126
- body: await (0, import_core.parseJsonBody)(output.body, context)
1178
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1127
1179
  };
1128
1180
  return de_InternalServerExceptionRes(parsedOutput, context);
1129
1181
  }, "de_InternalServerException_event");
1130
1182
  var de_PlaybackInterruptionEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1131
1183
  const contents = {};
1132
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1184
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1133
1185
  Object.assign(contents, (0, import_smithy_client._json)(data));
1134
1186
  return contents;
1135
1187
  }, "de_PlaybackInterruptionEvent_event");
1136
1188
  var de_ResourceNotFoundException_event = /* @__PURE__ */ __name(async (output, context) => {
1137
1189
  const parsedOutput = {
1138
1190
  ...output,
1139
- body: await (0, import_core.parseJsonBody)(output.body, context)
1191
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1140
1192
  };
1141
1193
  return de_ResourceNotFoundExceptionRes(parsedOutput, context);
1142
1194
  }, "de_ResourceNotFoundException_event");
1143
1195
  var de_TextResponseEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1144
1196
  const contents = {};
1145
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1197
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1146
1198
  Object.assign(contents, (0, import_smithy_client._json)(data));
1147
1199
  return contents;
1148
1200
  }, "de_TextResponseEvent_event");
1149
1201
  var de_ThrottlingException_event = /* @__PURE__ */ __name(async (output, context) => {
1150
1202
  const parsedOutput = {
1151
1203
  ...output,
1152
- body: await (0, import_core.parseJsonBody)(output.body, context)
1204
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1153
1205
  };
1154
1206
  return de_ThrottlingExceptionRes(parsedOutput, context);
1155
1207
  }, "de_ThrottlingException_event");
1156
1208
  var de_TranscriptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1157
1209
  const contents = {};
1158
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1210
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1159
1211
  Object.assign(contents, (0, import_smithy_client._json)(data));
1160
1212
  return contents;
1161
1213
  }, "de_TranscriptEvent_event");
1162
1214
  var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context) => {
1163
1215
  const parsedOutput = {
1164
1216
  ...output,
1165
- body: await (0, import_core.parseJsonBody)(output.body, context)
1217
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1166
1218
  };
1167
1219
  return de_ValidationExceptionRes(parsedOutput, context);
1168
1220
  }, "de_ValidationException_event");
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
+ const core_1 = require("@aws-sdk/core");
4
5
  const smithy_client_1 = require("@smithy/smithy-client");
5
6
  const url_parser_1 = require("@smithy/url-parser");
6
7
  const util_base64_1 = require("@smithy/util-base64");
7
8
  const util_stream_1 = require("@smithy/util-stream");
8
9
  const util_utf8_1 = require("@smithy/util-utf8");
10
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
9
11
  const endpointResolver_1 = require("./endpoint/endpointResolver");
10
12
  const getRuntimeConfig = (config) => {
11
13
  return {
@@ -15,6 +17,14 @@ const getRuntimeConfig = (config) => {
15
17
  disableHostPrefix: config?.disableHostPrefix ?? false,
16
18
  endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
17
19
  extensions: config?.extensions ?? [],
20
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultLexRuntimeV2HttpAuthSchemeProvider,
21
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
22
+ {
23
+ schemeId: "aws.auth#sigv4",
24
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
25
+ signer: new core_1.AwsSdkSigV4Signer(),
26
+ },
27
+ ],
18
28
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
19
29
  sdkStreamMixin: config?.sdkStreamMixin ?? util_stream_1.sdkStreamMixin,
20
30
  serviceId: config?.serviceId ?? "Lex Runtime V2",
@@ -2,14 +2,15 @@ import { resolveEventStreamConfig, } from "@aws-sdk/middleware-eventstream";
2
2
  import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
3
3
  import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
4
4
  import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
5
- import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
6
5
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
7
6
  import { resolveRegionConfig } from "@smithy/config-resolver";
7
+ import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
8
8
  import { resolveEventStreamSerdeConfig, } from "@smithy/eventstream-serde-config-resolver";
9
9
  import { getContentLengthPlugin } from "@smithy/middleware-content-length";
10
10
  import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
11
11
  import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
12
12
  import { Client as __Client, } from "@smithy/smithy-client";
13
+ import { defaultLexRuntimeV2HttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
13
14
  import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
14
15
  import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
15
16
  import { resolveRuntimeExtensions } from "./runtimeExtensions";
@@ -18,24 +19,30 @@ export class LexRuntimeV2Client extends __Client {
18
19
  constructor(...[configuration]) {
19
20
  const _config_0 = __getRuntimeConfig(configuration || {});
20
21
  const _config_1 = resolveClientEndpointParameters(_config_0);
21
- const _config_2 = resolveRegionConfig(_config_1);
22
- const _config_3 = resolveEndpointConfig(_config_2);
23
- const _config_4 = resolveHostHeaderConfig(_config_3);
24
- const _config_5 = resolveAwsAuthConfig(_config_4);
25
- const _config_6 = resolveEventStreamConfig(_config_5);
26
- const _config_7 = resolveUserAgentConfig(_config_6);
27
- const _config_8 = resolveRetryConfig(_config_7);
28
- const _config_9 = resolveEventStreamSerdeConfig(_config_8);
22
+ const _config_2 = resolveUserAgentConfig(_config_1);
23
+ const _config_3 = resolveRetryConfig(_config_2);
24
+ const _config_4 = resolveRegionConfig(_config_3);
25
+ const _config_5 = resolveHostHeaderConfig(_config_4);
26
+ const _config_6 = resolveEndpointConfig(_config_5);
27
+ const _config_7 = resolveEventStreamSerdeConfig(_config_6);
28
+ const _config_8 = resolveHttpAuthSchemeConfig(_config_7);
29
+ const _config_9 = resolveEventStreamConfig(_config_8);
29
30
  const _config_10 = resolveRuntimeExtensions(_config_9, configuration?.extensions || []);
30
31
  super(_config_10);
31
32
  this.config = _config_10;
32
- this.middlewareStack.use(getHostHeaderPlugin(this.config));
33
- this.middlewareStack.use(getLoggerPlugin(this.config));
34
- this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
35
- this.middlewareStack.use(getAwsAuthPlugin(this.config));
36
33
  this.middlewareStack.use(getUserAgentPlugin(this.config));
37
34
  this.middlewareStack.use(getRetryPlugin(this.config));
38
35
  this.middlewareStack.use(getContentLengthPlugin(this.config));
36
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
37
+ this.middlewareStack.use(getLoggerPlugin(this.config));
38
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
39
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
40
+ httpAuthSchemeParametersProvider: defaultLexRuntimeV2HttpAuthSchemeParametersProvider,
41
+ identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
42
+ "aws.auth#sigv4": config.credentials,
43
+ }),
44
+ }));
45
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
39
46
  }
40
47
  destroy() {
41
48
  super.destroy();
@@ -0,0 +1,38 @@
1
+ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
2
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
4
+ let _credentials = runtimeConfig.credentials;
5
+ return {
6
+ setHttpAuthScheme(httpAuthScheme) {
7
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
8
+ if (index === -1) {
9
+ _httpAuthSchemes.push(httpAuthScheme);
10
+ }
11
+ else {
12
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
13
+ }
14
+ },
15
+ httpAuthSchemes() {
16
+ return _httpAuthSchemes;
17
+ },
18
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
19
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
20
+ },
21
+ httpAuthSchemeProvider() {
22
+ return _httpAuthSchemeProvider;
23
+ },
24
+ setCredentials(credentials) {
25
+ _credentials = credentials;
26
+ },
27
+ credentials() {
28
+ return _credentials;
29
+ },
30
+ };
31
+ };
32
+ export const resolveHttpAuthRuntimeConfig = (config) => {
33
+ return {
34
+ httpAuthSchemes: config.httpAuthSchemes(),
35
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
36
+ credentials: config.credentials(),
37
+ };
38
+ };
@@ -0,0 +1,41 @@
1
+ import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
2
+ import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
3
+ export const defaultLexRuntimeV2HttpAuthSchemeParametersProvider = async (config, context, input) => {
4
+ return {
5
+ operation: getSmithyContext(context).operation,
6
+ region: (await normalizeProvider(config.region)()) ||
7
+ (() => {
8
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
9
+ })(),
10
+ };
11
+ };
12
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
13
+ return {
14
+ schemeId: "aws.auth#sigv4",
15
+ signingProperties: {
16
+ name: "lex",
17
+ region: authParameters.region,
18
+ },
19
+ propertiesExtractor: (config, context) => ({
20
+ signingProperties: {
21
+ config,
22
+ context,
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ export const defaultLexRuntimeV2HttpAuthSchemeProvider = (authParameters) => {
28
+ const options = [];
29
+ switch (authParameters.operation) {
30
+ default: {
31
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
32
+ }
33
+ }
34
+ return options;
35
+ };
36
+ export const resolveHttpAuthSchemeConfig = (config) => {
37
+ const config_0 = resolveAwsSdkSigV4Config(config);
38
+ return {
39
+ ...config_0,
40
+ };
41
+ };
@@ -1,8 +1,10 @@
1
+ import { AwsSdkSigV4Signer } from "@aws-sdk/core";
1
2
  import { NoOpLogger } from "@smithy/smithy-client";
2
3
  import { parseUrl } from "@smithy/url-parser";
3
4
  import { fromBase64, toBase64 } from "@smithy/util-base64";
4
5
  import { sdkStreamMixin } from "@smithy/util-stream";
5
6
  import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
7
+ import { defaultLexRuntimeV2HttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
6
8
  import { defaultEndpointResolver } from "./endpoint/endpointResolver";
7
9
  export const getRuntimeConfig = (config) => {
8
10
  return {
@@ -12,6 +14,14 @@ export const getRuntimeConfig = (config) => {
12
14
  disableHostPrefix: config?.disableHostPrefix ?? false,
13
15
  endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
14
16
  extensions: config?.extensions ?? [],
17
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultLexRuntimeV2HttpAuthSchemeProvider,
18
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
19
+ {
20
+ schemeId: "aws.auth#sigv4",
21
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
22
+ signer: new AwsSdkSigV4Signer(),
23
+ },
24
+ ],
15
25
  logger: config?.logger ?? new NoOpLogger(),
16
26
  sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin,
17
27
  serviceId: config?.serviceId ?? "Lex Runtime V2",
@@ -1,12 +1,14 @@
1
1
  import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
2
2
  import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
3
3
  import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
4
+ import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
4
5
  const asPartial = (t) => t;
5
6
  export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
6
7
  const extensionConfiguration = {
7
8
  ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
8
9
  ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
9
10
  ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
11
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
10
12
  };
11
13
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
12
14
  return {
@@ -14,5 +16,6 @@ export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
14
16
  ...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
15
17
  ...resolveDefaultRuntimeConfig(extensionConfiguration),
16
18
  ...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
19
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration),
17
20
  };
18
21
  };