@aws-sdk/client-sso-oidc 3.310.0 → 3.315.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.
@@ -12,16 +12,16 @@ const se_CreateTokenCommand = async (input, context) => {
12
12
  };
13
13
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/token";
14
14
  let body;
15
- body = JSON.stringify({
16
- ...(input.clientId != null && { clientId: input.clientId }),
17
- ...(input.clientSecret != null && { clientSecret: input.clientSecret }),
18
- ...(input.code != null && { code: input.code }),
19
- ...(input.deviceCode != null && { deviceCode: input.deviceCode }),
20
- ...(input.grantType != null && { grantType: input.grantType }),
21
- ...(input.redirectUri != null && { redirectUri: input.redirectUri }),
22
- ...(input.refreshToken != null && { refreshToken: input.refreshToken }),
23
- ...(input.scope != null && { scope: se_Scopes(input.scope, context) }),
24
- });
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
25
  return new protocol_http_1.HttpRequest({
26
26
  protocol,
27
27
  hostname,
@@ -40,11 +40,11 @@ const se_RegisterClientCommand = async (input, context) => {
40
40
  };
41
41
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/client/register";
42
42
  let body;
43
- body = JSON.stringify({
44
- ...(input.clientName != null && { clientName: input.clientName }),
45
- ...(input.clientType != null && { clientType: input.clientType }),
46
- ...(input.scopes != null && { scopes: se_Scopes(input.scopes, context) }),
47
- });
43
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
44
+ clientName: [],
45
+ clientType: [],
46
+ scopes: (_) => (0, smithy_client_1._json)(_),
47
+ }));
48
48
  return new protocol_http_1.HttpRequest({
49
49
  protocol,
50
50
  hostname,
@@ -63,11 +63,11 @@ const se_StartDeviceAuthorizationCommand = async (input, context) => {
63
63
  };
64
64
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device_authorization";
65
65
  let body;
66
- body = JSON.stringify({
67
- ...(input.clientId != null && { clientId: input.clientId }),
68
- ...(input.clientSecret != null && { clientSecret: input.clientSecret }),
69
- ...(input.startUrl != null && { startUrl: input.startUrl }),
70
- });
66
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
67
+ clientId: [],
68
+ clientSecret: [],
69
+ startUrl: [],
70
+ }));
71
71
  return new protocol_http_1.HttpRequest({
72
72
  protocol,
73
73
  hostname,
@@ -83,25 +83,18 @@ const de_CreateTokenCommand = async (output, context) => {
83
83
  if (output.statusCode !== 200 && output.statusCode >= 300) {
84
84
  return de_CreateTokenCommandError(output, context);
85
85
  }
86
- const contents = map({
86
+ const contents = (0, smithy_client_1.map)({
87
87
  $metadata: deserializeMetadata(output),
88
88
  });
89
89
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
90
- if (data.accessToken != null) {
91
- contents.accessToken = (0, smithy_client_1.expectString)(data.accessToken);
92
- }
93
- if (data.expiresIn != null) {
94
- contents.expiresIn = (0, smithy_client_1.expectInt32)(data.expiresIn);
95
- }
96
- if (data.idToken != null) {
97
- contents.idToken = (0, smithy_client_1.expectString)(data.idToken);
98
- }
99
- if (data.refreshToken != null) {
100
- contents.refreshToken = (0, smithy_client_1.expectString)(data.refreshToken);
101
- }
102
- if (data.tokenType != null) {
103
- contents.tokenType = (0, smithy_client_1.expectString)(data.tokenType);
104
- }
90
+ const doc = (0, smithy_client_1.take)(data, {
91
+ accessToken: smithy_client_1.expectString,
92
+ expiresIn: smithy_client_1.expectInt32,
93
+ idToken: smithy_client_1.expectString,
94
+ refreshToken: smithy_client_1.expectString,
95
+ tokenType: smithy_client_1.expectString,
96
+ });
97
+ Object.assign(contents, doc);
105
98
  return contents;
106
99
  };
107
100
  exports.de_CreateTokenCommand = de_CreateTokenCommand;
@@ -147,10 +140,9 @@ const de_CreateTokenCommandError = async (output, context) => {
147
140
  throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
148
141
  default:
149
142
  const parsedBody = parsedOutput.body;
150
- (0, smithy_client_1.throwDefaultError)({
143
+ return throwDefaultError({
151
144
  output,
152
145
  parsedBody,
153
- exceptionCtor: SSOOIDCServiceException_1.SSOOIDCServiceException,
154
146
  errorCode,
155
147
  });
156
148
  }
@@ -159,28 +151,19 @@ const de_RegisterClientCommand = async (output, context) => {
159
151
  if (output.statusCode !== 200 && output.statusCode >= 300) {
160
152
  return de_RegisterClientCommandError(output, context);
161
153
  }
162
- const contents = map({
154
+ const contents = (0, smithy_client_1.map)({
163
155
  $metadata: deserializeMetadata(output),
164
156
  });
165
157
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
166
- if (data.authorizationEndpoint != null) {
167
- contents.authorizationEndpoint = (0, smithy_client_1.expectString)(data.authorizationEndpoint);
168
- }
169
- if (data.clientId != null) {
170
- contents.clientId = (0, smithy_client_1.expectString)(data.clientId);
171
- }
172
- if (data.clientIdIssuedAt != null) {
173
- contents.clientIdIssuedAt = (0, smithy_client_1.expectLong)(data.clientIdIssuedAt);
174
- }
175
- if (data.clientSecret != null) {
176
- contents.clientSecret = (0, smithy_client_1.expectString)(data.clientSecret);
177
- }
178
- if (data.clientSecretExpiresAt != null) {
179
- contents.clientSecretExpiresAt = (0, smithy_client_1.expectLong)(data.clientSecretExpiresAt);
180
- }
181
- if (data.tokenEndpoint != null) {
182
- contents.tokenEndpoint = (0, smithy_client_1.expectString)(data.tokenEndpoint);
183
- }
158
+ const doc = (0, smithy_client_1.take)(data, {
159
+ authorizationEndpoint: smithy_client_1.expectString,
160
+ clientId: smithy_client_1.expectString,
161
+ clientIdIssuedAt: smithy_client_1.expectLong,
162
+ clientSecret: smithy_client_1.expectString,
163
+ clientSecretExpiresAt: smithy_client_1.expectLong,
164
+ tokenEndpoint: smithy_client_1.expectString,
165
+ });
166
+ Object.assign(contents, doc);
184
167
  return contents;
185
168
  };
186
169
  exports.de_RegisterClientCommand = de_RegisterClientCommand;
@@ -205,10 +188,9 @@ const de_RegisterClientCommandError = async (output, context) => {
205
188
  throw await de_InvalidScopeExceptionRes(parsedOutput, context);
206
189
  default:
207
190
  const parsedBody = parsedOutput.body;
208
- (0, smithy_client_1.throwDefaultError)({
191
+ return throwDefaultError({
209
192
  output,
210
193
  parsedBody,
211
- exceptionCtor: SSOOIDCServiceException_1.SSOOIDCServiceException,
212
194
  errorCode,
213
195
  });
214
196
  }
@@ -217,28 +199,19 @@ const de_StartDeviceAuthorizationCommand = async (output, context) => {
217
199
  if (output.statusCode !== 200 && output.statusCode >= 300) {
218
200
  return de_StartDeviceAuthorizationCommandError(output, context);
219
201
  }
220
- const contents = map({
202
+ const contents = (0, smithy_client_1.map)({
221
203
  $metadata: deserializeMetadata(output),
222
204
  });
223
205
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
224
- if (data.deviceCode != null) {
225
- contents.deviceCode = (0, smithy_client_1.expectString)(data.deviceCode);
226
- }
227
- if (data.expiresIn != null) {
228
- contents.expiresIn = (0, smithy_client_1.expectInt32)(data.expiresIn);
229
- }
230
- if (data.interval != null) {
231
- contents.interval = (0, smithy_client_1.expectInt32)(data.interval);
232
- }
233
- if (data.userCode != null) {
234
- contents.userCode = (0, smithy_client_1.expectString)(data.userCode);
235
- }
236
- if (data.verificationUri != null) {
237
- contents.verificationUri = (0, smithy_client_1.expectString)(data.verificationUri);
238
- }
239
- if (data.verificationUriComplete != null) {
240
- contents.verificationUriComplete = (0, smithy_client_1.expectString)(data.verificationUriComplete);
241
- }
206
+ const doc = (0, smithy_client_1.take)(data, {
207
+ deviceCode: smithy_client_1.expectString,
208
+ expiresIn: smithy_client_1.expectInt32,
209
+ interval: smithy_client_1.expectInt32,
210
+ userCode: smithy_client_1.expectString,
211
+ verificationUri: smithy_client_1.expectString,
212
+ verificationUriComplete: smithy_client_1.expectString,
213
+ });
214
+ Object.assign(contents, doc);
242
215
  return contents;
243
216
  };
244
217
  exports.de_StartDeviceAuthorizationCommand = de_StartDeviceAuthorizationCommand;
@@ -266,24 +239,22 @@ const de_StartDeviceAuthorizationCommandError = async (output, context) => {
266
239
  throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
267
240
  default:
268
241
  const parsedBody = parsedOutput.body;
269
- (0, smithy_client_1.throwDefaultError)({
242
+ return throwDefaultError({
270
243
  output,
271
244
  parsedBody,
272
- exceptionCtor: SSOOIDCServiceException_1.SSOOIDCServiceException,
273
245
  errorCode,
274
246
  });
275
247
  }
276
248
  };
277
- const map = smithy_client_1.map;
249
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(SSOOIDCServiceException_1.SSOOIDCServiceException);
278
250
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
279
- const contents = map({});
251
+ const contents = (0, smithy_client_1.map)({});
280
252
  const data = parsedOutput.body;
281
- if (data.error != null) {
282
- contents.error = (0, smithy_client_1.expectString)(data.error);
283
- }
284
- if (data.error_description != null) {
285
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
286
- }
253
+ const doc = (0, smithy_client_1.take)(data, {
254
+ error: smithy_client_1.expectString,
255
+ error_description: smithy_client_1.expectString,
256
+ });
257
+ Object.assign(contents, doc);
287
258
  const exception = new models_0_1.AccessDeniedException({
288
259
  $metadata: deserializeMetadata(parsedOutput),
289
260
  ...contents,
@@ -291,14 +262,13 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
291
262
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
292
263
  };
293
264
  const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
294
- const contents = map({});
265
+ const contents = (0, smithy_client_1.map)({});
295
266
  const data = parsedOutput.body;
296
- if (data.error != null) {
297
- contents.error = (0, smithy_client_1.expectString)(data.error);
298
- }
299
- if (data.error_description != null) {
300
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
301
- }
267
+ const doc = (0, smithy_client_1.take)(data, {
268
+ error: smithy_client_1.expectString,
269
+ error_description: smithy_client_1.expectString,
270
+ });
271
+ Object.assign(contents, doc);
302
272
  const exception = new models_0_1.AuthorizationPendingException({
303
273
  $metadata: deserializeMetadata(parsedOutput),
304
274
  ...contents,
@@ -306,14 +276,13 @@ const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
306
276
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
307
277
  };
308
278
  const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
309
- const contents = map({});
279
+ const contents = (0, smithy_client_1.map)({});
310
280
  const data = parsedOutput.body;
311
- if (data.error != null) {
312
- contents.error = (0, smithy_client_1.expectString)(data.error);
313
- }
314
- if (data.error_description != null) {
315
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
316
- }
281
+ const doc = (0, smithy_client_1.take)(data, {
282
+ error: smithy_client_1.expectString,
283
+ error_description: smithy_client_1.expectString,
284
+ });
285
+ Object.assign(contents, doc);
317
286
  const exception = new models_0_1.ExpiredTokenException({
318
287
  $metadata: deserializeMetadata(parsedOutput),
319
288
  ...contents,
@@ -321,14 +290,13 @@ const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
321
290
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
322
291
  };
323
292
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
324
- const contents = map({});
293
+ const contents = (0, smithy_client_1.map)({});
325
294
  const data = parsedOutput.body;
326
- if (data.error != null) {
327
- contents.error = (0, smithy_client_1.expectString)(data.error);
328
- }
329
- if (data.error_description != null) {
330
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
331
- }
295
+ const doc = (0, smithy_client_1.take)(data, {
296
+ error: smithy_client_1.expectString,
297
+ error_description: smithy_client_1.expectString,
298
+ });
299
+ Object.assign(contents, doc);
332
300
  const exception = new models_0_1.InternalServerException({
333
301
  $metadata: deserializeMetadata(parsedOutput),
334
302
  ...contents,
@@ -336,14 +304,13 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
336
304
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
337
305
  };
338
306
  const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
339
- const contents = map({});
307
+ const contents = (0, smithy_client_1.map)({});
340
308
  const data = parsedOutput.body;
341
- if (data.error != null) {
342
- contents.error = (0, smithy_client_1.expectString)(data.error);
343
- }
344
- if (data.error_description != null) {
345
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
346
- }
309
+ const doc = (0, smithy_client_1.take)(data, {
310
+ error: smithy_client_1.expectString,
311
+ error_description: smithy_client_1.expectString,
312
+ });
313
+ Object.assign(contents, doc);
347
314
  const exception = new models_0_1.InvalidClientException({
348
315
  $metadata: deserializeMetadata(parsedOutput),
349
316
  ...contents,
@@ -351,14 +318,13 @@ const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
351
318
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
352
319
  };
353
320
  const de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
354
- const contents = map({});
321
+ const contents = (0, smithy_client_1.map)({});
355
322
  const data = parsedOutput.body;
356
- if (data.error != null) {
357
- contents.error = (0, smithy_client_1.expectString)(data.error);
358
- }
359
- if (data.error_description != null) {
360
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
361
- }
323
+ const doc = (0, smithy_client_1.take)(data, {
324
+ error: smithy_client_1.expectString,
325
+ error_description: smithy_client_1.expectString,
326
+ });
327
+ Object.assign(contents, doc);
362
328
  const exception = new models_0_1.InvalidClientMetadataException({
363
329
  $metadata: deserializeMetadata(parsedOutput),
364
330
  ...contents,
@@ -366,14 +332,13 @@ const de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
366
332
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
367
333
  };
368
334
  const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
369
- const contents = map({});
335
+ const contents = (0, smithy_client_1.map)({});
370
336
  const data = parsedOutput.body;
371
- if (data.error != null) {
372
- contents.error = (0, smithy_client_1.expectString)(data.error);
373
- }
374
- if (data.error_description != null) {
375
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
376
- }
337
+ const doc = (0, smithy_client_1.take)(data, {
338
+ error: smithy_client_1.expectString,
339
+ error_description: smithy_client_1.expectString,
340
+ });
341
+ Object.assign(contents, doc);
377
342
  const exception = new models_0_1.InvalidGrantException({
378
343
  $metadata: deserializeMetadata(parsedOutput),
379
344
  ...contents,
@@ -381,14 +346,13 @@ const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
381
346
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
382
347
  };
383
348
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
384
- const contents = map({});
349
+ const contents = (0, smithy_client_1.map)({});
385
350
  const data = parsedOutput.body;
386
- if (data.error != null) {
387
- contents.error = (0, smithy_client_1.expectString)(data.error);
388
- }
389
- if (data.error_description != null) {
390
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
391
- }
351
+ const doc = (0, smithy_client_1.take)(data, {
352
+ error: smithy_client_1.expectString,
353
+ error_description: smithy_client_1.expectString,
354
+ });
355
+ Object.assign(contents, doc);
392
356
  const exception = new models_0_1.InvalidRequestException({
393
357
  $metadata: deserializeMetadata(parsedOutput),
394
358
  ...contents,
@@ -396,14 +360,13 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
396
360
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
397
361
  };
398
362
  const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
399
- const contents = map({});
363
+ const contents = (0, smithy_client_1.map)({});
400
364
  const data = parsedOutput.body;
401
- if (data.error != null) {
402
- contents.error = (0, smithy_client_1.expectString)(data.error);
403
- }
404
- if (data.error_description != null) {
405
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
406
- }
365
+ const doc = (0, smithy_client_1.take)(data, {
366
+ error: smithy_client_1.expectString,
367
+ error_description: smithy_client_1.expectString,
368
+ });
369
+ Object.assign(contents, doc);
407
370
  const exception = new models_0_1.InvalidScopeException({
408
371
  $metadata: deserializeMetadata(parsedOutput),
409
372
  ...contents,
@@ -411,14 +374,13 @@ const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
411
374
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
412
375
  };
413
376
  const de_SlowDownExceptionRes = async (parsedOutput, context) => {
414
- const contents = map({});
377
+ const contents = (0, smithy_client_1.map)({});
415
378
  const data = parsedOutput.body;
416
- if (data.error != null) {
417
- contents.error = (0, smithy_client_1.expectString)(data.error);
418
- }
419
- if (data.error_description != null) {
420
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
421
- }
379
+ const doc = (0, smithy_client_1.take)(data, {
380
+ error: smithy_client_1.expectString,
381
+ error_description: smithy_client_1.expectString,
382
+ });
383
+ Object.assign(contents, doc);
422
384
  const exception = new models_0_1.SlowDownException({
423
385
  $metadata: deserializeMetadata(parsedOutput),
424
386
  ...contents,
@@ -426,14 +388,13 @@ const de_SlowDownExceptionRes = async (parsedOutput, context) => {
426
388
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
427
389
  };
428
390
  const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
429
- const contents = map({});
391
+ const contents = (0, smithy_client_1.map)({});
430
392
  const data = parsedOutput.body;
431
- if (data.error != null) {
432
- contents.error = (0, smithy_client_1.expectString)(data.error);
433
- }
434
- if (data.error_description != null) {
435
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
436
- }
393
+ const doc = (0, smithy_client_1.take)(data, {
394
+ error: smithy_client_1.expectString,
395
+ error_description: smithy_client_1.expectString,
396
+ });
397
+ Object.assign(contents, doc);
437
398
  const exception = new models_0_1.UnauthorizedClientException({
438
399
  $metadata: deserializeMetadata(parsedOutput),
439
400
  ...contents,
@@ -441,27 +402,19 @@ const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
441
402
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
442
403
  };
443
404
  const de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
444
- const contents = map({});
405
+ const contents = (0, smithy_client_1.map)({});
445
406
  const data = parsedOutput.body;
446
- if (data.error != null) {
447
- contents.error = (0, smithy_client_1.expectString)(data.error);
448
- }
449
- if (data.error_description != null) {
450
- contents.error_description = (0, smithy_client_1.expectString)(data.error_description);
451
- }
407
+ const doc = (0, smithy_client_1.take)(data, {
408
+ error: smithy_client_1.expectString,
409
+ error_description: smithy_client_1.expectString,
410
+ });
411
+ Object.assign(contents, doc);
452
412
  const exception = new models_0_1.UnsupportedGrantTypeException({
453
413
  $metadata: deserializeMetadata(parsedOutput),
454
414
  ...contents,
455
415
  });
456
416
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
457
417
  };
458
- const se_Scopes = (input, context) => {
459
- return input
460
- .filter((e) => e != null)
461
- .map((entry) => {
462
- return entry;
463
- });
464
- };
465
418
  const deserializeMetadata = (output) => ({
466
419
  httpStatusCode: output.statusCode,
467
420
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { AccessDeniedException, AuthorizationPendingException, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidClientMetadataException, InvalidGrantException, InvalidRequestException, InvalidScopeException, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException, } from "../models/models_0";
4
4
  import { SSOOIDCServiceException as __BaseException } from "../models/SSOOIDCServiceException";
5
5
  export const se_CreateTokenCommand = async (input, context) => {
@@ -9,16 +9,16 @@ export const se_CreateTokenCommand = async (input, context) => {
9
9
  };
10
10
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/token";
11
11
  let body;
12
- body = JSON.stringify({
13
- ...(input.clientId != null && { clientId: input.clientId }),
14
- ...(input.clientSecret != null && { clientSecret: input.clientSecret }),
15
- ...(input.code != null && { code: input.code }),
16
- ...(input.deviceCode != null && { deviceCode: input.deviceCode }),
17
- ...(input.grantType != null && { grantType: input.grantType }),
18
- ...(input.redirectUri != null && { redirectUri: input.redirectUri }),
19
- ...(input.refreshToken != null && { refreshToken: input.refreshToken }),
20
- ...(input.scope != null && { scope: se_Scopes(input.scope, context) }),
21
- });
12
+ body = JSON.stringify(take(input, {
13
+ clientId: [],
14
+ clientSecret: [],
15
+ code: [],
16
+ deviceCode: [],
17
+ grantType: [],
18
+ redirectUri: [],
19
+ refreshToken: [],
20
+ scope: (_) => _json(_),
21
+ }));
22
22
  return new __HttpRequest({
23
23
  protocol,
24
24
  hostname,
@@ -36,11 +36,11 @@ export const se_RegisterClientCommand = async (input, context) => {
36
36
  };
37
37
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/client/register";
38
38
  let body;
39
- body = JSON.stringify({
40
- ...(input.clientName != null && { clientName: input.clientName }),
41
- ...(input.clientType != null && { clientType: input.clientType }),
42
- ...(input.scopes != null && { scopes: se_Scopes(input.scopes, context) }),
43
- });
39
+ body = JSON.stringify(take(input, {
40
+ clientName: [],
41
+ clientType: [],
42
+ scopes: (_) => _json(_),
43
+ }));
44
44
  return new __HttpRequest({
45
45
  protocol,
46
46
  hostname,
@@ -58,11 +58,11 @@ export const se_StartDeviceAuthorizationCommand = async (input, context) => {
58
58
  };
59
59
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device_authorization";
60
60
  let body;
61
- body = JSON.stringify({
62
- ...(input.clientId != null && { clientId: input.clientId }),
63
- ...(input.clientSecret != null && { clientSecret: input.clientSecret }),
64
- ...(input.startUrl != null && { startUrl: input.startUrl }),
65
- });
61
+ body = JSON.stringify(take(input, {
62
+ clientId: [],
63
+ clientSecret: [],
64
+ startUrl: [],
65
+ }));
66
66
  return new __HttpRequest({
67
67
  protocol,
68
68
  hostname,
@@ -81,21 +81,14 @@ export const de_CreateTokenCommand = async (output, context) => {
81
81
  $metadata: deserializeMetadata(output),
82
82
  });
83
83
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
84
- if (data.accessToken != null) {
85
- contents.accessToken = __expectString(data.accessToken);
86
- }
87
- if (data.expiresIn != null) {
88
- contents.expiresIn = __expectInt32(data.expiresIn);
89
- }
90
- if (data.idToken != null) {
91
- contents.idToken = __expectString(data.idToken);
92
- }
93
- if (data.refreshToken != null) {
94
- contents.refreshToken = __expectString(data.refreshToken);
95
- }
96
- if (data.tokenType != null) {
97
- contents.tokenType = __expectString(data.tokenType);
98
- }
84
+ const doc = take(data, {
85
+ accessToken: __expectString,
86
+ expiresIn: __expectInt32,
87
+ idToken: __expectString,
88
+ refreshToken: __expectString,
89
+ tokenType: __expectString,
90
+ });
91
+ Object.assign(contents, doc);
99
92
  return contents;
100
93
  };
101
94
  const de_CreateTokenCommandError = async (output, context) => {
@@ -140,10 +133,9 @@ const de_CreateTokenCommandError = async (output, context) => {
140
133
  throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
141
134
  default:
142
135
  const parsedBody = parsedOutput.body;
143
- throwDefaultError({
136
+ return throwDefaultError({
144
137
  output,
145
138
  parsedBody,
146
- exceptionCtor: __BaseException,
147
139
  errorCode,
148
140
  });
149
141
  }
@@ -156,24 +148,15 @@ export const de_RegisterClientCommand = async (output, context) => {
156
148
  $metadata: deserializeMetadata(output),
157
149
  });
158
150
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
159
- if (data.authorizationEndpoint != null) {
160
- contents.authorizationEndpoint = __expectString(data.authorizationEndpoint);
161
- }
162
- if (data.clientId != null) {
163
- contents.clientId = __expectString(data.clientId);
164
- }
165
- if (data.clientIdIssuedAt != null) {
166
- contents.clientIdIssuedAt = __expectLong(data.clientIdIssuedAt);
167
- }
168
- if (data.clientSecret != null) {
169
- contents.clientSecret = __expectString(data.clientSecret);
170
- }
171
- if (data.clientSecretExpiresAt != null) {
172
- contents.clientSecretExpiresAt = __expectLong(data.clientSecretExpiresAt);
173
- }
174
- if (data.tokenEndpoint != null) {
175
- contents.tokenEndpoint = __expectString(data.tokenEndpoint);
176
- }
151
+ const doc = take(data, {
152
+ authorizationEndpoint: __expectString,
153
+ clientId: __expectString,
154
+ clientIdIssuedAt: __expectLong,
155
+ clientSecret: __expectString,
156
+ clientSecretExpiresAt: __expectLong,
157
+ tokenEndpoint: __expectString,
158
+ });
159
+ Object.assign(contents, doc);
177
160
  return contents;
178
161
  };
179
162
  const de_RegisterClientCommandError = async (output, context) => {
@@ -197,10 +180,9 @@ const de_RegisterClientCommandError = async (output, context) => {
197
180
  throw await de_InvalidScopeExceptionRes(parsedOutput, context);
198
181
  default:
199
182
  const parsedBody = parsedOutput.body;
200
- throwDefaultError({
183
+ return throwDefaultError({
201
184
  output,
202
185
  parsedBody,
203
- exceptionCtor: __BaseException,
204
186
  errorCode,
205
187
  });
206
188
  }
@@ -213,24 +195,15 @@ export const de_StartDeviceAuthorizationCommand = async (output, context) => {
213
195
  $metadata: deserializeMetadata(output),
214
196
  });
215
197
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
216
- if (data.deviceCode != null) {
217
- contents.deviceCode = __expectString(data.deviceCode);
218
- }
219
- if (data.expiresIn != null) {
220
- contents.expiresIn = __expectInt32(data.expiresIn);
221
- }
222
- if (data.interval != null) {
223
- contents.interval = __expectInt32(data.interval);
224
- }
225
- if (data.userCode != null) {
226
- contents.userCode = __expectString(data.userCode);
227
- }
228
- if (data.verificationUri != null) {
229
- contents.verificationUri = __expectString(data.verificationUri);
230
- }
231
- if (data.verificationUriComplete != null) {
232
- contents.verificationUriComplete = __expectString(data.verificationUriComplete);
233
- }
198
+ const doc = take(data, {
199
+ deviceCode: __expectString,
200
+ expiresIn: __expectInt32,
201
+ interval: __expectInt32,
202
+ userCode: __expectString,
203
+ verificationUri: __expectString,
204
+ verificationUriComplete: __expectString,
205
+ });
206
+ Object.assign(contents, doc);
234
207
  return contents;
235
208
  };
236
209
  const de_StartDeviceAuthorizationCommandError = async (output, context) => {
@@ -257,24 +230,22 @@ const de_StartDeviceAuthorizationCommandError = async (output, context) => {
257
230
  throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
258
231
  default:
259
232
  const parsedBody = parsedOutput.body;
260
- throwDefaultError({
233
+ return throwDefaultError({
261
234
  output,
262
235
  parsedBody,
263
- exceptionCtor: __BaseException,
264
236
  errorCode,
265
237
  });
266
238
  }
267
239
  };
268
- const map = __map;
240
+ const throwDefaultError = withBaseException(__BaseException);
269
241
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
270
242
  const contents = map({});
271
243
  const data = parsedOutput.body;
272
- if (data.error != null) {
273
- contents.error = __expectString(data.error);
274
- }
275
- if (data.error_description != null) {
276
- contents.error_description = __expectString(data.error_description);
277
- }
244
+ const doc = take(data, {
245
+ error: __expectString,
246
+ error_description: __expectString,
247
+ });
248
+ Object.assign(contents, doc);
278
249
  const exception = new AccessDeniedException({
279
250
  $metadata: deserializeMetadata(parsedOutput),
280
251
  ...contents,
@@ -284,12 +255,11 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
284
255
  const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
285
256
  const contents = map({});
286
257
  const data = parsedOutput.body;
287
- if (data.error != null) {
288
- contents.error = __expectString(data.error);
289
- }
290
- if (data.error_description != null) {
291
- contents.error_description = __expectString(data.error_description);
292
- }
258
+ const doc = take(data, {
259
+ error: __expectString,
260
+ error_description: __expectString,
261
+ });
262
+ Object.assign(contents, doc);
293
263
  const exception = new AuthorizationPendingException({
294
264
  $metadata: deserializeMetadata(parsedOutput),
295
265
  ...contents,
@@ -299,12 +269,11 @@ const de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
299
269
  const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
300
270
  const contents = map({});
301
271
  const data = parsedOutput.body;
302
- if (data.error != null) {
303
- contents.error = __expectString(data.error);
304
- }
305
- if (data.error_description != null) {
306
- contents.error_description = __expectString(data.error_description);
307
- }
272
+ const doc = take(data, {
273
+ error: __expectString,
274
+ error_description: __expectString,
275
+ });
276
+ Object.assign(contents, doc);
308
277
  const exception = new ExpiredTokenException({
309
278
  $metadata: deserializeMetadata(parsedOutput),
310
279
  ...contents,
@@ -314,12 +283,11 @@ const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
314
283
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
315
284
  const contents = map({});
316
285
  const data = parsedOutput.body;
317
- if (data.error != null) {
318
- contents.error = __expectString(data.error);
319
- }
320
- if (data.error_description != null) {
321
- contents.error_description = __expectString(data.error_description);
322
- }
286
+ const doc = take(data, {
287
+ error: __expectString,
288
+ error_description: __expectString,
289
+ });
290
+ Object.assign(contents, doc);
323
291
  const exception = new InternalServerException({
324
292
  $metadata: deserializeMetadata(parsedOutput),
325
293
  ...contents,
@@ -329,12 +297,11 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
329
297
  const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
330
298
  const contents = map({});
331
299
  const data = parsedOutput.body;
332
- if (data.error != null) {
333
- contents.error = __expectString(data.error);
334
- }
335
- if (data.error_description != null) {
336
- contents.error_description = __expectString(data.error_description);
337
- }
300
+ const doc = take(data, {
301
+ error: __expectString,
302
+ error_description: __expectString,
303
+ });
304
+ Object.assign(contents, doc);
338
305
  const exception = new InvalidClientException({
339
306
  $metadata: deserializeMetadata(parsedOutput),
340
307
  ...contents,
@@ -344,12 +311,11 @@ const de_InvalidClientExceptionRes = async (parsedOutput, context) => {
344
311
  const de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
345
312
  const contents = map({});
346
313
  const data = parsedOutput.body;
347
- if (data.error != null) {
348
- contents.error = __expectString(data.error);
349
- }
350
- if (data.error_description != null) {
351
- contents.error_description = __expectString(data.error_description);
352
- }
314
+ const doc = take(data, {
315
+ error: __expectString,
316
+ error_description: __expectString,
317
+ });
318
+ Object.assign(contents, doc);
353
319
  const exception = new InvalidClientMetadataException({
354
320
  $metadata: deserializeMetadata(parsedOutput),
355
321
  ...contents,
@@ -359,12 +325,11 @@ const de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
359
325
  const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
360
326
  const contents = map({});
361
327
  const data = parsedOutput.body;
362
- if (data.error != null) {
363
- contents.error = __expectString(data.error);
364
- }
365
- if (data.error_description != null) {
366
- contents.error_description = __expectString(data.error_description);
367
- }
328
+ const doc = take(data, {
329
+ error: __expectString,
330
+ error_description: __expectString,
331
+ });
332
+ Object.assign(contents, doc);
368
333
  const exception = new InvalidGrantException({
369
334
  $metadata: deserializeMetadata(parsedOutput),
370
335
  ...contents,
@@ -374,12 +339,11 @@ const de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
374
339
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
375
340
  const contents = map({});
376
341
  const data = parsedOutput.body;
377
- if (data.error != null) {
378
- contents.error = __expectString(data.error);
379
- }
380
- if (data.error_description != null) {
381
- contents.error_description = __expectString(data.error_description);
382
- }
342
+ const doc = take(data, {
343
+ error: __expectString,
344
+ error_description: __expectString,
345
+ });
346
+ Object.assign(contents, doc);
383
347
  const exception = new InvalidRequestException({
384
348
  $metadata: deserializeMetadata(parsedOutput),
385
349
  ...contents,
@@ -389,12 +353,11 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
389
353
  const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
390
354
  const contents = map({});
391
355
  const data = parsedOutput.body;
392
- if (data.error != null) {
393
- contents.error = __expectString(data.error);
394
- }
395
- if (data.error_description != null) {
396
- contents.error_description = __expectString(data.error_description);
397
- }
356
+ const doc = take(data, {
357
+ error: __expectString,
358
+ error_description: __expectString,
359
+ });
360
+ Object.assign(contents, doc);
398
361
  const exception = new InvalidScopeException({
399
362
  $metadata: deserializeMetadata(parsedOutput),
400
363
  ...contents,
@@ -404,12 +367,11 @@ const de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
404
367
  const de_SlowDownExceptionRes = async (parsedOutput, context) => {
405
368
  const contents = map({});
406
369
  const data = parsedOutput.body;
407
- if (data.error != null) {
408
- contents.error = __expectString(data.error);
409
- }
410
- if (data.error_description != null) {
411
- contents.error_description = __expectString(data.error_description);
412
- }
370
+ const doc = take(data, {
371
+ error: __expectString,
372
+ error_description: __expectString,
373
+ });
374
+ Object.assign(contents, doc);
413
375
  const exception = new SlowDownException({
414
376
  $metadata: deserializeMetadata(parsedOutput),
415
377
  ...contents,
@@ -419,12 +381,11 @@ const de_SlowDownExceptionRes = async (parsedOutput, context) => {
419
381
  const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
420
382
  const contents = map({});
421
383
  const data = parsedOutput.body;
422
- if (data.error != null) {
423
- contents.error = __expectString(data.error);
424
- }
425
- if (data.error_description != null) {
426
- contents.error_description = __expectString(data.error_description);
427
- }
384
+ const doc = take(data, {
385
+ error: __expectString,
386
+ error_description: __expectString,
387
+ });
388
+ Object.assign(contents, doc);
428
389
  const exception = new UnauthorizedClientException({
429
390
  $metadata: deserializeMetadata(parsedOutput),
430
391
  ...contents,
@@ -434,25 +395,17 @@ const de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
434
395
  const de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
435
396
  const contents = map({});
436
397
  const data = parsedOutput.body;
437
- if (data.error != null) {
438
- contents.error = __expectString(data.error);
439
- }
440
- if (data.error_description != null) {
441
- contents.error_description = __expectString(data.error_description);
442
- }
398
+ const doc = take(data, {
399
+ error: __expectString,
400
+ error_description: __expectString,
401
+ });
402
+ Object.assign(contents, doc);
443
403
  const exception = new UnsupportedGrantTypeException({
444
404
  $metadata: deserializeMetadata(parsedOutput),
445
405
  ...contents,
446
406
  });
447
407
  return __decorateServiceException(exception, parsedOutput.body);
448
408
  };
449
- const se_Scopes = (input, context) => {
450
- return input
451
- .filter((e) => e != null)
452
- .map((entry) => {
453
- return entry;
454
- });
455
- };
456
409
  const deserializeMetadata = (output) => ({
457
410
  httpStatusCode: output.statusCode,
458
411
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sso-oidc",
3
3
  "description": "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
4
- "version": "3.310.0",
4
+ "version": "3.315.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -37,14 +37,14 @@
37
37
  "@aws-sdk/node-config-provider": "3.310.0",
38
38
  "@aws-sdk/node-http-handler": "3.310.0",
39
39
  "@aws-sdk/protocol-http": "3.310.0",
40
- "@aws-sdk/smithy-client": "3.310.0",
40
+ "@aws-sdk/smithy-client": "3.315.0",
41
41
  "@aws-sdk/types": "3.310.0",
42
42
  "@aws-sdk/url-parser": "3.310.0",
43
43
  "@aws-sdk/util-base64": "3.310.0",
44
44
  "@aws-sdk/util-body-length-browser": "3.310.0",
45
45
  "@aws-sdk/util-body-length-node": "3.310.0",
46
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
47
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
46
+ "@aws-sdk/util-defaults-mode-browser": "3.315.0",
47
+ "@aws-sdk/util-defaults-mode-node": "3.315.0",
48
48
  "@aws-sdk/util-endpoints": "3.310.0",
49
49
  "@aws-sdk/util-retry": "3.310.0",
50
50
  "@aws-sdk/util-user-agent-browser": "3.310.0",