@aws-sdk/client-transcribe-streaming 3.621.0 → 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.
Files changed (28) hide show
  1. package/dist-cjs/auth/httpAuthSchemeProvider.js +47 -0
  2. package/dist-cjs/index.js +93 -35
  3. package/dist-cjs/runtimeConfig.shared.js +10 -0
  4. package/dist-es/TranscribeStreamingClient.js +21 -14
  5. package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  6. package/dist-es/auth/httpAuthSchemeProvider.js +41 -0
  7. package/dist-es/commands/StartCallAnalyticsStreamTranscriptionCommand.js +3 -1
  8. package/dist-es/commands/StartMedicalStreamTranscriptionCommand.js +3 -1
  9. package/dist-es/commands/StartStreamTranscriptionCommand.js +3 -1
  10. package/dist-es/runtimeConfig.shared.js +10 -0
  11. package/dist-es/runtimeExtensions.js +3 -0
  12. package/dist-types/TranscribeStreamingClient.d.ts +15 -14
  13. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  14. package/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  15. package/dist-types/extensionConfiguration.d.ts +2 -1
  16. package/dist-types/runtimeConfig.browser.d.ts +6 -4
  17. package/dist-types/runtimeConfig.d.ts +5 -3
  18. package/dist-types/runtimeConfig.native.d.ts +6 -4
  19. package/dist-types/runtimeConfig.shared.d.ts +2 -0
  20. package/dist-types/ts3.4/TranscribeStreamingClient.d.ts +18 -20
  21. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  22. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
  23. package/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  24. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +9 -9
  25. package/dist-types/ts3.4/runtimeConfig.d.ts +8 -8
  26. package/dist-types/ts3.4/runtimeConfig.native.d.ts +11 -11
  27. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +2 -0
  28. package/package.json +11 -11
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHttpAuthSchemeConfig = exports.defaultTranscribeStreamingHttpAuthSchemeProvider = exports.defaultTranscribeStreamingHttpAuthSchemeParametersProvider = void 0;
4
+ const core_1 = require("@aws-sdk/core");
5
+ const util_middleware_1 = require("@smithy/util-middleware");
6
+ const defaultTranscribeStreamingHttpAuthSchemeParametersProvider = 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.defaultTranscribeStreamingHttpAuthSchemeParametersProvider = defaultTranscribeStreamingHttpAuthSchemeParametersProvider;
16
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
17
+ return {
18
+ schemeId: "aws.auth#sigv4",
19
+ signingProperties: {
20
+ name: "transcribe",
21
+ region: authParameters.region,
22
+ },
23
+ propertiesExtractor: (config, context) => ({
24
+ signingProperties: {
25
+ config,
26
+ context,
27
+ },
28
+ }),
29
+ };
30
+ }
31
+ const defaultTranscribeStreamingHttpAuthSchemeProvider = (authParameters) => {
32
+ const options = [];
33
+ switch (authParameters.operation) {
34
+ default: {
35
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
36
+ }
37
+ }
38
+ return options;
39
+ };
40
+ exports.defaultTranscribeStreamingHttpAuthSchemeProvider = defaultTranscribeStreamingHttpAuthSchemeProvider;
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
@@ -70,15 +70,16 @@ var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
70
70
  var import_middleware_logger = require("@aws-sdk/middleware-logger");
71
71
  var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
72
72
  var import_middleware_sdk_transcribe_streaming = require("@aws-sdk/middleware-sdk-transcribe-streaming");
73
- var import_middleware_signing = require("@aws-sdk/middleware-signing");
74
73
  var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
75
74
  var import_middleware_websocket = require("@aws-sdk/middleware-websocket");
76
75
  var import_config_resolver = require("@smithy/config-resolver");
76
+ var import_core = require("@smithy/core");
77
77
  var import_eventstream_serde_config_resolver = require("@smithy/eventstream-serde-config-resolver");
78
78
  var import_middleware_content_length = require("@smithy/middleware-content-length");
79
79
  var import_middleware_endpoint = require("@smithy/middleware-endpoint");
80
80
  var import_middleware_retry = require("@smithy/middleware-retry");
81
81
 
82
+ var import_httpAuthSchemeProvider = require("./auth/httpAuthSchemeProvider");
82
83
 
83
84
  // src/endpoint/EndpointParameters.ts
84
85
  var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
@@ -103,19 +104,62 @@ var import_runtimeConfig = require("././runtimeConfig");
103
104
  var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
104
105
  var import_protocol_http = require("@smithy/protocol-http");
105
106
  var import_smithy_client = require("@smithy/smithy-client");
107
+
108
+ // src/auth/httpAuthExtensionConfiguration.ts
109
+ var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
110
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
111
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
112
+ let _credentials = runtimeConfig.credentials;
113
+ return {
114
+ setHttpAuthScheme(httpAuthScheme) {
115
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
116
+ if (index === -1) {
117
+ _httpAuthSchemes.push(httpAuthScheme);
118
+ } else {
119
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
120
+ }
121
+ },
122
+ httpAuthSchemes() {
123
+ return _httpAuthSchemes;
124
+ },
125
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
126
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
127
+ },
128
+ httpAuthSchemeProvider() {
129
+ return _httpAuthSchemeProvider;
130
+ },
131
+ setCredentials(credentials) {
132
+ _credentials = credentials;
133
+ },
134
+ credentials() {
135
+ return _credentials;
136
+ }
137
+ };
138
+ }, "getHttpAuthExtensionConfiguration");
139
+ var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => {
140
+ return {
141
+ httpAuthSchemes: config.httpAuthSchemes(),
142
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
143
+ credentials: config.credentials()
144
+ };
145
+ }, "resolveHttpAuthRuntimeConfig");
146
+
147
+ // src/runtimeExtensions.ts
106
148
  var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial");
107
149
  var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
108
150
  const extensionConfiguration = {
109
151
  ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)),
110
152
  ...asPartial((0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig)),
111
- ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig))
153
+ ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
154
+ ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig))
112
155
  };
113
156
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
114
157
  return {
115
158
  ...runtimeConfig,
116
159
  ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
117
160
  ...(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
118
- ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration)
161
+ ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
162
+ ...resolveHttpAuthRuntimeConfig(extensionConfiguration)
119
163
  };
120
164
  }, "resolveRuntimeExtensions");
121
165
 
@@ -124,26 +168,34 @@ var _TranscribeStreamingClient = class _TranscribeStreamingClient extends import
124
168
  constructor(...[configuration]) {
125
169
  const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {});
126
170
  const _config_1 = resolveClientEndpointParameters(_config_0);
127
- const _config_2 = (0, import_config_resolver.resolveRegionConfig)(_config_1);
128
- const _config_3 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_2);
129
- const _config_4 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_3);
130
- const _config_5 = (0, import_middleware_signing.resolveAwsAuthConfig)(_config_4);
131
- const _config_6 = (0, import_middleware_eventstream.resolveEventStreamConfig)(_config_5);
132
- const _config_7 = (0, import_middleware_websocket.resolveWebSocketConfig)(_config_6);
133
- const _config_8 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_7);
134
- const _config_9 = (0, import_middleware_retry.resolveRetryConfig)(_config_8);
135
- const _config_10 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_9);
171
+ const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1);
172
+ const _config_3 = (0, import_middleware_retry.resolveRetryConfig)(_config_2);
173
+ const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3);
174
+ const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
175
+ const _config_6 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_5);
176
+ const _config_7 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_6);
177
+ const _config_8 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_7);
178
+ const _config_9 = (0, import_middleware_eventstream.resolveEventStreamConfig)(_config_8);
179
+ const _config_10 = (0, import_middleware_websocket.resolveWebSocketConfig)(_config_9);
136
180
  const _config_11 = resolveRuntimeExtensions(_config_10, (configuration == null ? void 0 : configuration.extensions) || []);
137
181
  super(_config_11);
138
182
  this.config = _config_11;
183
+ this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
184
+ this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
185
+ this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
139
186
  this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
140
187
  this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
141
188
  this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
142
- this.middlewareStack.use((0, import_middleware_signing.getAwsAuthPlugin)(this.config));
189
+ this.middlewareStack.use(
190
+ (0, import_core.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
191
+ httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultTranscribeStreamingHttpAuthSchemeParametersProvider,
192
+ identityProviderConfigProvider: async (config) => new import_core.DefaultIdentityProviderConfig({
193
+ "aws.auth#sigv4": config.credentials
194
+ })
195
+ })
196
+ );
143
197
  this.middlewareStack.use((0, import_middleware_sdk_transcribe_streaming.getTranscribeStreamingPlugin)(this.config));
144
- this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
145
- this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
146
- this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
198
+ this.middlewareStack.use((0, import_core.getHttpSigningPlugin)(this.config));
147
199
  }
148
200
  /**
149
201
  * Destroy underlying resources, like sockets. It's usually not necessary to do this.
@@ -503,11 +555,11 @@ var StartStreamTranscriptionResponseFilterSensitiveLog = /* @__PURE__ */ __name(
503
555
  }), "StartStreamTranscriptionResponseFilterSensitiveLog");
504
556
 
505
557
  // src/protocols/Aws_restJson1.ts
506
- var import_core = require("@aws-sdk/core");
507
- var import_core2 = require("@smithy/core");
558
+ var import_core2 = require("@aws-sdk/core");
559
+
508
560
 
509
561
  var se_StartCallAnalyticsStreamTranscriptionCommand = /* @__PURE__ */ __name(async (input, context) => {
510
- const b = (0, import_core2.requestBuilder)(input, context);
562
+ const b = (0, import_core.requestBuilder)(input, context);
511
563
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
512
564
  "content-type": "application/json",
513
565
  [_xatlc]: input[_LC],
@@ -533,7 +585,7 @@ var se_StartCallAnalyticsStreamTranscriptionCommand = /* @__PURE__ */ __name(asy
533
585
  return b.build();
534
586
  }, "se_StartCallAnalyticsStreamTranscriptionCommand");
535
587
  var se_StartMedicalStreamTranscriptionCommand = /* @__PURE__ */ __name(async (input, context) => {
536
- const b = (0, import_core2.requestBuilder)(input, context);
588
+ const b = (0, import_core.requestBuilder)(input, context);
537
589
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
538
590
  "content-type": "application/json",
539
591
  [_xatlc]: input[_LC],
@@ -557,7 +609,7 @@ var se_StartMedicalStreamTranscriptionCommand = /* @__PURE__ */ __name(async (in
557
609
  return b.build();
558
610
  }, "se_StartMedicalStreamTranscriptionCommand");
559
611
  var se_StartStreamTranscriptionCommand = /* @__PURE__ */ __name(async (input, context) => {
560
- const b = (0, import_core2.requestBuilder)(input, context);
612
+ const b = (0, import_core.requestBuilder)(input, context);
561
613
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
562
614
  "content-type": "application/json",
563
615
  [_xatlc]: input[_LC],
@@ -676,9 +728,9 @@ var de_StartStreamTranscriptionCommand = /* @__PURE__ */ __name(async (output, c
676
728
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
677
729
  const parsedOutput = {
678
730
  ...output,
679
- body: await (0, import_core.parseJsonErrorBody)(output.body, context)
731
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
680
732
  };
681
- const errorCode = (0, import_core.loadRestJsonErrorCode)(output, parsedOutput.body);
733
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
682
734
  switch (errorCode) {
683
735
  case "BadRequestException":
684
736
  case "com.amazonaws.transcribestreaming#BadRequestException":
@@ -923,59 +975,59 @@ var de_TranscriptResultStream = /* @__PURE__ */ __name((output, context) => {
923
975
  var de_BadRequestException_event = /* @__PURE__ */ __name(async (output, context) => {
924
976
  const parsedOutput = {
925
977
  ...output,
926
- body: await (0, import_core.parseJsonBody)(output.body, context)
978
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
927
979
  };
928
980
  return de_BadRequestExceptionRes(parsedOutput, context);
929
981
  }, "de_BadRequestException_event");
930
982
  var de_CategoryEvent_event = /* @__PURE__ */ __name(async (output, context) => {
931
983
  const contents = {};
932
- const data = await (0, import_core.parseJsonBody)(output.body, context);
984
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
933
985
  Object.assign(contents, (0, import_smithy_client._json)(data));
934
986
  return contents;
935
987
  }, "de_CategoryEvent_event");
936
988
  var de_ConflictException_event = /* @__PURE__ */ __name(async (output, context) => {
937
989
  const parsedOutput = {
938
990
  ...output,
939
- body: await (0, import_core.parseJsonBody)(output.body, context)
991
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
940
992
  };
941
993
  return de_ConflictExceptionRes(parsedOutput, context);
942
994
  }, "de_ConflictException_event");
943
995
  var de_InternalFailureException_event = /* @__PURE__ */ __name(async (output, context) => {
944
996
  const parsedOutput = {
945
997
  ...output,
946
- body: await (0, import_core.parseJsonBody)(output.body, context)
998
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
947
999
  };
948
1000
  return de_InternalFailureExceptionRes(parsedOutput, context);
949
1001
  }, "de_InternalFailureException_event");
950
1002
  var de_LimitExceededException_event = /* @__PURE__ */ __name(async (output, context) => {
951
1003
  const parsedOutput = {
952
1004
  ...output,
953
- body: await (0, import_core.parseJsonBody)(output.body, context)
1005
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
954
1006
  };
955
1007
  return de_LimitExceededExceptionRes(parsedOutput, context);
956
1008
  }, "de_LimitExceededException_event");
957
1009
  var de_MedicalTranscriptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
958
1010
  const contents = {};
959
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1011
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
960
1012
  Object.assign(contents, de_MedicalTranscriptEvent(data, context));
961
1013
  return contents;
962
1014
  }, "de_MedicalTranscriptEvent_event");
963
1015
  var de_ServiceUnavailableException_event = /* @__PURE__ */ __name(async (output, context) => {
964
1016
  const parsedOutput = {
965
1017
  ...output,
966
- body: await (0, import_core.parseJsonBody)(output.body, context)
1018
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
967
1019
  };
968
1020
  return de_ServiceUnavailableExceptionRes(parsedOutput, context);
969
1021
  }, "de_ServiceUnavailableException_event");
970
1022
  var de_TranscriptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
971
1023
  const contents = {};
972
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1024
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
973
1025
  Object.assign(contents, de_TranscriptEvent(data, context));
974
1026
  return contents;
975
1027
  }, "de_TranscriptEvent_event");
976
1028
  var de_UtteranceEvent_event = /* @__PURE__ */ __name(async (output, context) => {
977
1029
  const contents = {};
978
- const data = await (0, import_core.parseJsonBody)(output.body, context);
1030
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
979
1031
  Object.assign(contents, de_UtteranceEvent(data, context));
980
1032
  return contents;
981
1033
  }, "de_UtteranceEvent_event");
@@ -1249,7 +1301,9 @@ var _StartCallAnalyticsStreamTranscriptionCommand = class _StartCallAnalyticsStr
1249
1301
  (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
1250
1302
  (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()),
1251
1303
  (0, import_middleware_eventstream.getEventStreamPlugin)(config),
1252
- (0, import_middleware_websocket.getWebSocketPlugin)(config, { headerPrefix: "x-amzn-transcribe-" })
1304
+ (0, import_middleware_websocket.getWebSocketPlugin)(config, {
1305
+ headerPrefix: "x-amzn-transcribe-"
1306
+ })
1253
1307
  ];
1254
1308
  }).s("Transcribe", "StartCallAnalyticsStreamTranscription", {
1255
1309
  /**
@@ -1280,7 +1334,9 @@ var _StartMedicalStreamTranscriptionCommand = class _StartMedicalStreamTranscrip
1280
1334
  (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
1281
1335
  (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()),
1282
1336
  (0, import_middleware_eventstream.getEventStreamPlugin)(config),
1283
- (0, import_middleware_websocket.getWebSocketPlugin)(config, { headerPrefix: "x-amzn-transcribe-" })
1337
+ (0, import_middleware_websocket.getWebSocketPlugin)(config, {
1338
+ headerPrefix: "x-amzn-transcribe-"
1339
+ })
1284
1340
  ];
1285
1341
  }).s("Transcribe", "StartMedicalStreamTranscription", {
1286
1342
  /**
@@ -1311,7 +1367,9 @@ var _StartStreamTranscriptionCommand = class _StartStreamTranscriptionCommand ex
1311
1367
  (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
1312
1368
  (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()),
1313
1369
  (0, import_middleware_eventstream.getEventStreamPlugin)(config),
1314
- (0, import_middleware_websocket.getWebSocketPlugin)(config, { headerPrefix: "x-amzn-transcribe-" })
1370
+ (0, import_middleware_websocket.getWebSocketPlugin)(config, {
1371
+ headerPrefix: "x-amzn-transcribe-"
1372
+ })
1315
1373
  ];
1316
1374
  }).s("Transcribe", "StartStreamTranscription", {
1317
1375
  /**
@@ -1,10 +1,12 @@
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_utf8_1 = require("@smithy/util-utf8");
9
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
8
10
  const endpointResolver_1 = require("./endpoint/endpointResolver");
9
11
  const getRuntimeConfig = (config) => {
10
12
  return {
@@ -14,6 +16,14 @@ const getRuntimeConfig = (config) => {
14
16
  disableHostPrefix: config?.disableHostPrefix ?? false,
15
17
  endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
16
18
  extensions: config?.extensions ?? [],
19
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultTranscribeStreamingHttpAuthSchemeProvider,
20
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
21
+ {
22
+ schemeId: "aws.auth#sigv4",
23
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
24
+ signer: new core_1.AwsSdkSigV4Signer(),
25
+ },
26
+ ],
17
27
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
18
28
  serviceId: config?.serviceId ?? "Transcribe Streaming",
19
29
  urlParser: config?.urlParser ?? url_parser_1.parseUrl,
@@ -3,15 +3,16 @@ import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middlewa
3
3
  import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
4
4
  import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
5
5
  import { getTranscribeStreamingPlugin } from "@aws-sdk/middleware-sdk-transcribe-streaming";
6
- import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
7
6
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
8
7
  import { resolveWebSocketConfig } from "@aws-sdk/middleware-websocket";
9
8
  import { resolveRegionConfig } from "@smithy/config-resolver";
9
+ import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
10
10
  import { resolveEventStreamSerdeConfig, } from "@smithy/eventstream-serde-config-resolver";
11
11
  import { getContentLengthPlugin } from "@smithy/middleware-content-length";
12
12
  import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
13
13
  import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
14
14
  import { Client as __Client, } from "@smithy/smithy-client";
15
+ import { defaultTranscribeStreamingHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
15
16
  import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
16
17
  import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
17
18
  import { resolveRuntimeExtensions } from "./runtimeExtensions";
@@ -20,26 +21,32 @@ export class TranscribeStreamingClient extends __Client {
20
21
  constructor(...[configuration]) {
21
22
  const _config_0 = __getRuntimeConfig(configuration || {});
22
23
  const _config_1 = resolveClientEndpointParameters(_config_0);
23
- const _config_2 = resolveRegionConfig(_config_1);
24
- const _config_3 = resolveEndpointConfig(_config_2);
25
- const _config_4 = resolveHostHeaderConfig(_config_3);
26
- const _config_5 = resolveAwsAuthConfig(_config_4);
27
- const _config_6 = resolveEventStreamConfig(_config_5);
28
- const _config_7 = resolveWebSocketConfig(_config_6);
29
- const _config_8 = resolveUserAgentConfig(_config_7);
30
- const _config_9 = resolveRetryConfig(_config_8);
31
- const _config_10 = resolveEventStreamSerdeConfig(_config_9);
24
+ const _config_2 = resolveUserAgentConfig(_config_1);
25
+ const _config_3 = resolveRetryConfig(_config_2);
26
+ const _config_4 = resolveRegionConfig(_config_3);
27
+ const _config_5 = resolveHostHeaderConfig(_config_4);
28
+ const _config_6 = resolveEndpointConfig(_config_5);
29
+ const _config_7 = resolveEventStreamSerdeConfig(_config_6);
30
+ const _config_8 = resolveHttpAuthSchemeConfig(_config_7);
31
+ const _config_9 = resolveEventStreamConfig(_config_8);
32
+ const _config_10 = resolveWebSocketConfig(_config_9);
32
33
  const _config_11 = resolveRuntimeExtensions(_config_10, configuration?.extensions || []);
33
34
  super(_config_11);
34
35
  this.config = _config_11;
36
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
37
+ this.middlewareStack.use(getRetryPlugin(this.config));
38
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
35
39
  this.middlewareStack.use(getHostHeaderPlugin(this.config));
36
40
  this.middlewareStack.use(getLoggerPlugin(this.config));
37
41
  this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
38
- this.middlewareStack.use(getAwsAuthPlugin(this.config));
42
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
43
+ httpAuthSchemeParametersProvider: defaultTranscribeStreamingHttpAuthSchemeParametersProvider,
44
+ identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
45
+ "aws.auth#sigv4": config.credentials,
46
+ }),
47
+ }));
39
48
  this.middlewareStack.use(getTranscribeStreamingPlugin(this.config));
40
- this.middlewareStack.use(getUserAgentPlugin(this.config));
41
- this.middlewareStack.use(getRetryPlugin(this.config));
42
- this.middlewareStack.use(getContentLengthPlugin(this.config));
49
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
43
50
  }
44
51
  destroy() {
45
52
  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 defaultTranscribeStreamingHttpAuthSchemeParametersProvider = 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: "transcribe",
17
+ region: authParameters.region,
18
+ },
19
+ propertiesExtractor: (config, context) => ({
20
+ signingProperties: {
21
+ config,
22
+ context,
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ export const defaultTranscribeStreamingHttpAuthSchemeProvider = (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
+ };
@@ -17,7 +17,9 @@ export class StartCallAnalyticsStreamTranscriptionCommand extends $Command
17
17
  getSerdePlugin(config, this.serialize, this.deserialize),
18
18
  getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
19
19
  getEventStreamPlugin(config),
20
- getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-" }),
20
+ getWebSocketPlugin(config, {
21
+ headerPrefix: "x-amzn-transcribe-",
22
+ }),
21
23
  ];
22
24
  })
23
25
  .s("Transcribe", "StartCallAnalyticsStreamTranscription", {
@@ -17,7 +17,9 @@ export class StartMedicalStreamTranscriptionCommand extends $Command
17
17
  getSerdePlugin(config, this.serialize, this.deserialize),
18
18
  getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
19
19
  getEventStreamPlugin(config),
20
- getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-" }),
20
+ getWebSocketPlugin(config, {
21
+ headerPrefix: "x-amzn-transcribe-",
22
+ }),
21
23
  ];
22
24
  })
23
25
  .s("Transcribe", "StartMedicalStreamTranscription", {
@@ -17,7 +17,9 @@ export class StartStreamTranscriptionCommand extends $Command
17
17
  getSerdePlugin(config, this.serialize, this.deserialize),
18
18
  getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
19
19
  getEventStreamPlugin(config),
20
- getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-" }),
20
+ getWebSocketPlugin(config, {
21
+ headerPrefix: "x-amzn-transcribe-",
22
+ }),
21
23
  ];
22
24
  })
23
25
  .s("Transcribe", "StartStreamTranscription", {
@@ -1,7 +1,9 @@
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 { fromUtf8, toUtf8 } from "@smithy/util-utf8";
6
+ import { defaultTranscribeStreamingHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
5
7
  import { defaultEndpointResolver } from "./endpoint/endpointResolver";
6
8
  export const getRuntimeConfig = (config) => {
7
9
  return {
@@ -11,6 +13,14 @@ export const getRuntimeConfig = (config) => {
11
13
  disableHostPrefix: config?.disableHostPrefix ?? false,
12
14
  endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
13
15
  extensions: config?.extensions ?? [],
16
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultTranscribeStreamingHttpAuthSchemeProvider,
17
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
18
+ {
19
+ schemeId: "aws.auth#sigv4",
20
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
21
+ signer: new AwsSdkSigV4Signer(),
22
+ },
23
+ ],
14
24
  logger: config?.logger ?? new NoOpLogger(),
15
25
  serviceId: config?.serviceId ?? "Transcribe Streaming",
16
26
  urlParser: config?.urlParser ?? parseUrl,
@@ -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
  };