@aws-sdk/client-sso-oidc 3.489.0 → 3.495.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.
@@ -1,564 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_StartDeviceAuthorizationCommand = exports.de_RegisterClientCommand = exports.de_CreateTokenWithIAMCommand = exports.de_CreateTokenCommand = exports.se_StartDeviceAuthorizationCommand = exports.se_RegisterClientCommand = exports.se_CreateTokenWithIAMCommand = exports.se_CreateTokenCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const models_0_1 = require("../models/models_0");
7
- const SSOOIDCServiceException_1 = require("../models/SSOOIDCServiceException");
8
- const se_CreateTokenCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {
11
- "content-type": "application/json",
12
- };
13
- b.bp("/token");
14
- let body;
15
- body = JSON.stringify((0, smithy_client_1.take)(input, {
16
- clientId: [],
17
- clientSecret: [],
18
- code: [],
19
- deviceCode: [],
20
- grantType: [],
21
- redirectUri: [],
22
- refreshToken: [],
23
- scope: (_) => (0, smithy_client_1._json)(_),
24
- }));
25
- b.m("POST").h(headers).b(body);
26
- return b.build();
27
- };
28
- exports.se_CreateTokenCommand = se_CreateTokenCommand;
29
- const se_CreateTokenWithIAMCommand = async (input, context) => {
30
- const b = (0, core_1.requestBuilder)(input, context);
31
- const headers = {
32
- "content-type": "application/json",
33
- };
34
- b.bp("/token");
35
- const query = (0, smithy_client_1.map)({
36
- [_ai]: [, "t"],
37
- });
38
- let body;
39
- body = JSON.stringify((0, smithy_client_1.take)(input, {
40
- assertion: [],
41
- clientId: [],
42
- code: [],
43
- grantType: [],
44
- redirectUri: [],
45
- refreshToken: [],
46
- requestedTokenType: [],
47
- scope: (_) => (0, smithy_client_1._json)(_),
48
- subjectToken: [],
49
- subjectTokenType: [],
50
- }));
51
- b.m("POST").h(headers).q(query).b(body);
52
- return b.build();
53
- };
54
- exports.se_CreateTokenWithIAMCommand = se_CreateTokenWithIAMCommand;
55
- const se_RegisterClientCommand = async (input, context) => {
56
- const b = (0, core_1.requestBuilder)(input, context);
57
- const headers = {
58
- "content-type": "application/json",
59
- };
60
- b.bp("/client/register");
61
- let body;
62
- body = JSON.stringify((0, smithy_client_1.take)(input, {
63
- clientName: [],
64
- clientType: [],
65
- scopes: (_) => (0, smithy_client_1._json)(_),
66
- }));
67
- b.m("POST").h(headers).b(body);
68
- return b.build();
69
- };
70
- exports.se_RegisterClientCommand = se_RegisterClientCommand;
71
- const se_StartDeviceAuthorizationCommand = async (input, context) => {
72
- const b = (0, core_1.requestBuilder)(input, context);
73
- const headers = {
74
- "content-type": "application/json",
75
- };
76
- b.bp("/device_authorization");
77
- let body;
78
- body = JSON.stringify((0, smithy_client_1.take)(input, {
79
- clientId: [],
80
- clientSecret: [],
81
- startUrl: [],
82
- }));
83
- b.m("POST").h(headers).b(body);
84
- return b.build();
85
- };
86
- exports.se_StartDeviceAuthorizationCommand = se_StartDeviceAuthorizationCommand;
87
- const de_CreateTokenCommand = async (output, context) => {
88
- if (output.statusCode !== 200 && output.statusCode >= 300) {
89
- return de_CreateTokenCommandError(output, context);
90
- }
91
- const contents = (0, smithy_client_1.map)({
92
- $metadata: deserializeMetadata(output),
93
- });
94
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
95
- const doc = (0, smithy_client_1.take)(data, {
96
- accessToken: smithy_client_1.expectString,
97
- expiresIn: smithy_client_1.expectInt32,
98
- idToken: smithy_client_1.expectString,
99
- refreshToken: smithy_client_1.expectString,
100
- tokenType: smithy_client_1.expectString,
101
- });
102
- Object.assign(contents, doc);
103
- return contents;
104
- };
105
- exports.de_CreateTokenCommand = de_CreateTokenCommand;
106
- const de_CreateTokenCommandError = async (output, context) => {
107
- const parsedOutput = {
108
- ...output,
109
- body: await parseErrorBody(output.body, context),
110
- };
111
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
112
- switch (errorCode) {
113
- case "AccessDeniedException":
114
- case "com.amazonaws.ssooidc#AccessDeniedException":
115
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
116
- case "AuthorizationPendingException":
117
- case "com.amazonaws.ssooidc#AuthorizationPendingException":
118
- throw await de_AuthorizationPendingExceptionRes(parsedOutput, context);
119
- case "ExpiredTokenException":
120
- case "com.amazonaws.ssooidc#ExpiredTokenException":
121
- throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
122
- case "InternalServerException":
123
- case "com.amazonaws.ssooidc#InternalServerException":
124
- throw await de_InternalServerExceptionRes(parsedOutput, context);
125
- case "InvalidClientException":
126
- case "com.amazonaws.ssooidc#InvalidClientException":
127
- throw await de_InvalidClientExceptionRes(parsedOutput, context);
128
- case "InvalidGrantException":
129
- case "com.amazonaws.ssooidc#InvalidGrantException":
130
- throw await de_InvalidGrantExceptionRes(parsedOutput, context);
131
- case "InvalidRequestException":
132
- case "com.amazonaws.ssooidc#InvalidRequestException":
133
- throw await de_InvalidRequestExceptionRes(parsedOutput, context);
134
- case "InvalidScopeException":
135
- case "com.amazonaws.ssooidc#InvalidScopeException":
136
- throw await de_InvalidScopeExceptionRes(parsedOutput, context);
137
- case "SlowDownException":
138
- case "com.amazonaws.ssooidc#SlowDownException":
139
- throw await de_SlowDownExceptionRes(parsedOutput, context);
140
- case "UnauthorizedClientException":
141
- case "com.amazonaws.ssooidc#UnauthorizedClientException":
142
- throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
143
- case "UnsupportedGrantTypeException":
144
- case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
145
- throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
146
- default:
147
- const parsedBody = parsedOutput.body;
148
- return throwDefaultError({
149
- output,
150
- parsedBody,
151
- errorCode,
152
- });
153
- }
154
- };
155
- const de_CreateTokenWithIAMCommand = async (output, context) => {
156
- if (output.statusCode !== 200 && output.statusCode >= 300) {
157
- return de_CreateTokenWithIAMCommandError(output, context);
158
- }
159
- const contents = (0, smithy_client_1.map)({
160
- $metadata: deserializeMetadata(output),
161
- });
162
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
163
- const doc = (0, smithy_client_1.take)(data, {
164
- accessToken: smithy_client_1.expectString,
165
- expiresIn: smithy_client_1.expectInt32,
166
- idToken: smithy_client_1.expectString,
167
- issuedTokenType: smithy_client_1.expectString,
168
- refreshToken: smithy_client_1.expectString,
169
- scope: smithy_client_1._json,
170
- tokenType: smithy_client_1.expectString,
171
- });
172
- Object.assign(contents, doc);
173
- return contents;
174
- };
175
- exports.de_CreateTokenWithIAMCommand = de_CreateTokenWithIAMCommand;
176
- const de_CreateTokenWithIAMCommandError = async (output, context) => {
177
- const parsedOutput = {
178
- ...output,
179
- body: await parseErrorBody(output.body, context),
180
- };
181
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
182
- switch (errorCode) {
183
- case "AccessDeniedException":
184
- case "com.amazonaws.ssooidc#AccessDeniedException":
185
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
186
- case "AuthorizationPendingException":
187
- case "com.amazonaws.ssooidc#AuthorizationPendingException":
188
- throw await de_AuthorizationPendingExceptionRes(parsedOutput, context);
189
- case "ExpiredTokenException":
190
- case "com.amazonaws.ssooidc#ExpiredTokenException":
191
- throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
192
- case "InternalServerException":
193
- case "com.amazonaws.ssooidc#InternalServerException":
194
- throw await de_InternalServerExceptionRes(parsedOutput, context);
195
- case "InvalidClientException":
196
- case "com.amazonaws.ssooidc#InvalidClientException":
197
- throw await de_InvalidClientExceptionRes(parsedOutput, context);
198
- case "InvalidGrantException":
199
- case "com.amazonaws.ssooidc#InvalidGrantException":
200
- throw await de_InvalidGrantExceptionRes(parsedOutput, context);
201
- case "InvalidRequestException":
202
- case "com.amazonaws.ssooidc#InvalidRequestException":
203
- throw await de_InvalidRequestExceptionRes(parsedOutput, context);
204
- case "InvalidRequestRegionException":
205
- case "com.amazonaws.ssooidc#InvalidRequestRegionException":
206
- throw await de_InvalidRequestRegionExceptionRes(parsedOutput, context);
207
- case "InvalidScopeException":
208
- case "com.amazonaws.ssooidc#InvalidScopeException":
209
- throw await de_InvalidScopeExceptionRes(parsedOutput, context);
210
- case "SlowDownException":
211
- case "com.amazonaws.ssooidc#SlowDownException":
212
- throw await de_SlowDownExceptionRes(parsedOutput, context);
213
- case "UnauthorizedClientException":
214
- case "com.amazonaws.ssooidc#UnauthorizedClientException":
215
- throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
216
- case "UnsupportedGrantTypeException":
217
- case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
218
- throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
219
- default:
220
- const parsedBody = parsedOutput.body;
221
- return throwDefaultError({
222
- output,
223
- parsedBody,
224
- errorCode,
225
- });
226
- }
227
- };
228
- const de_RegisterClientCommand = async (output, context) => {
229
- if (output.statusCode !== 200 && output.statusCode >= 300) {
230
- return de_RegisterClientCommandError(output, context);
231
- }
232
- const contents = (0, smithy_client_1.map)({
233
- $metadata: deserializeMetadata(output),
234
- });
235
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
236
- const doc = (0, smithy_client_1.take)(data, {
237
- authorizationEndpoint: smithy_client_1.expectString,
238
- clientId: smithy_client_1.expectString,
239
- clientIdIssuedAt: smithy_client_1.expectLong,
240
- clientSecret: smithy_client_1.expectString,
241
- clientSecretExpiresAt: smithy_client_1.expectLong,
242
- tokenEndpoint: smithy_client_1.expectString,
243
- });
244
- Object.assign(contents, doc);
245
- return contents;
246
- };
247
- exports.de_RegisterClientCommand = de_RegisterClientCommand;
248
- const de_RegisterClientCommandError = async (output, context) => {
249
- const parsedOutput = {
250
- ...output,
251
- body: await parseErrorBody(output.body, context),
252
- };
253
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
254
- switch (errorCode) {
255
- case "InternalServerException":
256
- case "com.amazonaws.ssooidc#InternalServerException":
257
- throw await de_InternalServerExceptionRes(parsedOutput, context);
258
- case "InvalidClientMetadataException":
259
- case "com.amazonaws.ssooidc#InvalidClientMetadataException":
260
- throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context);
261
- case "InvalidRequestException":
262
- case "com.amazonaws.ssooidc#InvalidRequestException":
263
- throw await de_InvalidRequestExceptionRes(parsedOutput, context);
264
- case "InvalidScopeException":
265
- case "com.amazonaws.ssooidc#InvalidScopeException":
266
- throw await de_InvalidScopeExceptionRes(parsedOutput, context);
267
- default:
268
- const parsedBody = parsedOutput.body;
269
- return throwDefaultError({
270
- output,
271
- parsedBody,
272
- errorCode,
273
- });
274
- }
275
- };
276
- const de_StartDeviceAuthorizationCommand = async (output, context) => {
277
- if (output.statusCode !== 200 && output.statusCode >= 300) {
278
- return de_StartDeviceAuthorizationCommandError(output, context);
279
- }
280
- const contents = (0, smithy_client_1.map)({
281
- $metadata: deserializeMetadata(output),
282
- });
283
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
284
- const doc = (0, smithy_client_1.take)(data, {
285
- deviceCode: smithy_client_1.expectString,
286
- expiresIn: smithy_client_1.expectInt32,
287
- interval: smithy_client_1.expectInt32,
288
- userCode: smithy_client_1.expectString,
289
- verificationUri: smithy_client_1.expectString,
290
- verificationUriComplete: smithy_client_1.expectString,
291
- });
292
- Object.assign(contents, doc);
293
- return contents;
294
- };
295
- exports.de_StartDeviceAuthorizationCommand = de_StartDeviceAuthorizationCommand;
296
- const de_StartDeviceAuthorizationCommandError = async (output, context) => {
297
- const parsedOutput = {
298
- ...output,
299
- body: await parseErrorBody(output.body, context),
300
- };
301
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
302
- switch (errorCode) {
303
- case "InternalServerException":
304
- case "com.amazonaws.ssooidc#InternalServerException":
305
- throw await de_InternalServerExceptionRes(parsedOutput, context);
306
- case "InvalidClientException":
307
- case "com.amazonaws.ssooidc#InvalidClientException":
308
- throw await de_InvalidClientExceptionRes(parsedOutput, context);
309
- case "InvalidRequestException":
310
- case "com.amazonaws.ssooidc#InvalidRequestException":
311
- throw await de_InvalidRequestExceptionRes(parsedOutput, context);
312
- case "SlowDownException":
313
- case "com.amazonaws.ssooidc#SlowDownException":
314
- throw await de_SlowDownExceptionRes(parsedOutput, context);
315
- case "UnauthorizedClientException":
316
- case "com.amazonaws.ssooidc#UnauthorizedClientException":
317
- throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
318
- default:
319
- const parsedBody = parsedOutput.body;
320
- return throwDefaultError({
321
- output,
322
- parsedBody,
323
- errorCode,
324
- });
325
- }
326
- };
327
- const throwDefaultError = (0, smithy_client_1.withBaseException)(SSOOIDCServiceException_1.SSOOIDCServiceException);
328
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
329
- const contents = (0, smithy_client_1.map)({});
330
- const data = parsedOutput.body;
331
- const doc = (0, smithy_client_1.take)(data, {
332
- error: smithy_client_1.expectString,
333
- error_description: smithy_client_1.expectString,
334
- });
335
- Object.assign(contents, doc);
336
- const exception = new models_0_1.AccessDeniedException({
337
- $metadata: deserializeMetadata(parsedOutput),
338
- ...contents,
339
- });
340
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
341
- };
342
- const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
343
- const contents = (0, smithy_client_1.map)({});
344
- const data = parsedOutput.body;
345
- const doc = (0, smithy_client_1.take)(data, {
346
- error: smithy_client_1.expectString,
347
- error_description: smithy_client_1.expectString,
348
- });
349
- Object.assign(contents, doc);
350
- const exception = new models_0_1.AuthorizationPendingException({
351
- $metadata: deserializeMetadata(parsedOutput),
352
- ...contents,
353
- });
354
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
355
- };
356
- const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
357
- const contents = (0, smithy_client_1.map)({});
358
- const data = parsedOutput.body;
359
- const doc = (0, smithy_client_1.take)(data, {
360
- error: smithy_client_1.expectString,
361
- error_description: smithy_client_1.expectString,
362
- });
363
- Object.assign(contents, doc);
364
- const exception = new models_0_1.ExpiredTokenException({
365
- $metadata: deserializeMetadata(parsedOutput),
366
- ...contents,
367
- });
368
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
369
- };
370
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
371
- const contents = (0, smithy_client_1.map)({});
372
- const data = parsedOutput.body;
373
- const doc = (0, smithy_client_1.take)(data, {
374
- error: smithy_client_1.expectString,
375
- error_description: smithy_client_1.expectString,
376
- });
377
- Object.assign(contents, doc);
378
- const exception = new models_0_1.InternalServerException({
379
- $metadata: deserializeMetadata(parsedOutput),
380
- ...contents,
381
- });
382
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
383
- };
384
- const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
385
- const contents = (0, smithy_client_1.map)({});
386
- const data = parsedOutput.body;
387
- const doc = (0, smithy_client_1.take)(data, {
388
- error: smithy_client_1.expectString,
389
- error_description: smithy_client_1.expectString,
390
- });
391
- Object.assign(contents, doc);
392
- const exception = new models_0_1.InvalidClientException({
393
- $metadata: deserializeMetadata(parsedOutput),
394
- ...contents,
395
- });
396
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
397
- };
398
- const de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
399
- const contents = (0, smithy_client_1.map)({});
400
- const data = parsedOutput.body;
401
- const doc = (0, smithy_client_1.take)(data, {
402
- error: smithy_client_1.expectString,
403
- error_description: smithy_client_1.expectString,
404
- });
405
- Object.assign(contents, doc);
406
- const exception = new models_0_1.InvalidClientMetadataException({
407
- $metadata: deserializeMetadata(parsedOutput),
408
- ...contents,
409
- });
410
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
411
- };
412
- const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
413
- const contents = (0, smithy_client_1.map)({});
414
- const data = parsedOutput.body;
415
- const doc = (0, smithy_client_1.take)(data, {
416
- error: smithy_client_1.expectString,
417
- error_description: smithy_client_1.expectString,
418
- });
419
- Object.assign(contents, doc);
420
- const exception = new models_0_1.InvalidGrantException({
421
- $metadata: deserializeMetadata(parsedOutput),
422
- ...contents,
423
- });
424
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
425
- };
426
- const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
427
- const contents = (0, smithy_client_1.map)({});
428
- const data = parsedOutput.body;
429
- const doc = (0, smithy_client_1.take)(data, {
430
- error: smithy_client_1.expectString,
431
- error_description: smithy_client_1.expectString,
432
- });
433
- Object.assign(contents, doc);
434
- const exception = new models_0_1.InvalidRequestException({
435
- $metadata: deserializeMetadata(parsedOutput),
436
- ...contents,
437
- });
438
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
439
- };
440
- const de_InvalidRequestRegionExceptionRes = async (parsedOutput, context) => {
441
- const contents = (0, smithy_client_1.map)({});
442
- const data = parsedOutput.body;
443
- const doc = (0, smithy_client_1.take)(data, {
444
- endpoint: smithy_client_1.expectString,
445
- error: smithy_client_1.expectString,
446
- error_description: smithy_client_1.expectString,
447
- region: smithy_client_1.expectString,
448
- });
449
- Object.assign(contents, doc);
450
- const exception = new models_0_1.InvalidRequestRegionException({
451
- $metadata: deserializeMetadata(parsedOutput),
452
- ...contents,
453
- });
454
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
455
- };
456
- const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
457
- const contents = (0, smithy_client_1.map)({});
458
- const data = parsedOutput.body;
459
- const doc = (0, smithy_client_1.take)(data, {
460
- error: smithy_client_1.expectString,
461
- error_description: smithy_client_1.expectString,
462
- });
463
- Object.assign(contents, doc);
464
- const exception = new models_0_1.InvalidScopeException({
465
- $metadata: deserializeMetadata(parsedOutput),
466
- ...contents,
467
- });
468
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
469
- };
470
- const de_SlowDownExceptionRes = async (parsedOutput, context) => {
471
- const contents = (0, smithy_client_1.map)({});
472
- const data = parsedOutput.body;
473
- const doc = (0, smithy_client_1.take)(data, {
474
- error: smithy_client_1.expectString,
475
- error_description: smithy_client_1.expectString,
476
- });
477
- Object.assign(contents, doc);
478
- const exception = new models_0_1.SlowDownException({
479
- $metadata: deserializeMetadata(parsedOutput),
480
- ...contents,
481
- });
482
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
483
- };
484
- const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
485
- const contents = (0, smithy_client_1.map)({});
486
- const data = parsedOutput.body;
487
- const doc = (0, smithy_client_1.take)(data, {
488
- error: smithy_client_1.expectString,
489
- error_description: smithy_client_1.expectString,
490
- });
491
- Object.assign(contents, doc);
492
- const exception = new models_0_1.UnauthorizedClientException({
493
- $metadata: deserializeMetadata(parsedOutput),
494
- ...contents,
495
- });
496
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
497
- };
498
- const de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
499
- const contents = (0, smithy_client_1.map)({});
500
- const data = parsedOutput.body;
501
- const doc = (0, smithy_client_1.take)(data, {
502
- error: smithy_client_1.expectString,
503
- error_description: smithy_client_1.expectString,
504
- });
505
- Object.assign(contents, doc);
506
- const exception = new models_0_1.UnsupportedGrantTypeException({
507
- $metadata: deserializeMetadata(parsedOutput),
508
- ...contents,
509
- });
510
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
511
- };
512
- const deserializeMetadata = (output) => ({
513
- httpStatusCode: output.statusCode,
514
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
515
- extendedRequestId: output.headers["x-amz-id-2"],
516
- cfId: output.headers["x-amz-cf-id"],
517
- });
518
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
519
- const isSerializableHeaderValue = (value) => value !== undefined &&
520
- value !== null &&
521
- value !== "" &&
522
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
523
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
524
- const _ai = "aws_iam";
525
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
526
- if (encoded.length) {
527
- return JSON.parse(encoded);
528
- }
529
- return {};
530
- });
531
- const parseErrorBody = async (errorBody, context) => {
532
- const value = await parseBody(errorBody, context);
533
- value.message = value.message ?? value.Message;
534
- return value;
535
- };
536
- const loadRestJsonErrorCode = (output, data) => {
537
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
538
- const sanitizeErrorCode = (rawValue) => {
539
- let cleanValue = rawValue;
540
- if (typeof cleanValue === "number") {
541
- cleanValue = cleanValue.toString();
542
- }
543
- if (cleanValue.indexOf(",") >= 0) {
544
- cleanValue = cleanValue.split(",")[0];
545
- }
546
- if (cleanValue.indexOf(":") >= 0) {
547
- cleanValue = cleanValue.split(":")[0];
548
- }
549
- if (cleanValue.indexOf("#") >= 0) {
550
- cleanValue = cleanValue.split("#")[1];
551
- }
552
- return cleanValue;
553
- };
554
- const headerKey = findKey(output.headers, "x-amzn-errortype");
555
- if (headerKey !== undefined) {
556
- return sanitizeErrorCode(output.headers[headerKey]);
557
- }
558
- if (data.code !== undefined) {
559
- return sanitizeErrorCode(data.code);
560
- }
561
- if (data["__type"] !== undefined) {
562
- return sanitizeErrorCode(data["__type"]);
563
- }
564
- };
1
+ module.exports = require("../index.js");
@@ -1,22 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveRuntimeExtensions = void 0;
4
- const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
5
- const protocol_http_1 = require("@smithy/protocol-http");
6
- const smithy_client_1 = require("@smithy/smithy-client");
7
- const asPartial = (t) => t;
8
- const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
9
- const extensionConfiguration = {
10
- ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
11
- ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
12
- ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
13
- };
14
- extensions.forEach((extension) => extension.configure(extensionConfiguration));
15
- return {
16
- ...runtimeConfig,
17
- ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
18
- ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
19
- ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
20
- };
21
- };
22
- exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
1
+ module.exports = require("./index.js");