@aws-sdk/client-lex-runtime-service 3.312.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.
@@ -33,7 +33,7 @@ const se_GetSessionCommand = async (input, context) => {
33
33
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
34
34
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
35
35
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
36
- const query = map({
36
+ const query = (0, smithy_client_1.map)({
37
37
  checkpointLabelFilter: [, input.checkpointLabelFilter],
38
38
  });
39
39
  let body;
@@ -51,7 +51,7 @@ const se_GetSessionCommand = async (input, context) => {
51
51
  exports.se_GetSessionCommand = se_GetSessionCommand;
52
52
  const se_PostContentCommand = async (input, context) => {
53
53
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
54
- const headers = map({}, isSerializableHeaderValue, {
54
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
55
55
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
56
56
  "content-type": input.contentType || "application/octet-stream",
57
57
  "x-amz-lex-session-attributes": [
@@ -99,12 +99,12 @@ const se_PostTextCommand = async (input, context) => {
99
99
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
100
100
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
101
101
  let body;
102
- body = JSON.stringify({
103
- ...(input.activeContexts != null && { activeContexts: se_ActiveContextsList(input.activeContexts, context) }),
104
- ...(input.inputText != null && { inputText: input.inputText }),
105
- ...(input.requestAttributes != null && { requestAttributes: se_StringMap(input.requestAttributes, context) }),
106
- ...(input.sessionAttributes != null && { sessionAttributes: se_StringMap(input.sessionAttributes, context) }),
107
- });
102
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
103
+ activeContexts: (_) => (0, smithy_client_1._json)(_),
104
+ inputText: [],
105
+ requestAttributes: (_) => (0, smithy_client_1._json)(_),
106
+ sessionAttributes: (_) => (0, smithy_client_1._json)(_),
107
+ }));
108
108
  return new protocol_http_1.HttpRequest({
109
109
  protocol,
110
110
  hostname,
@@ -118,7 +118,7 @@ const se_PostTextCommand = async (input, context) => {
118
118
  exports.se_PostTextCommand = se_PostTextCommand;
119
119
  const se_PutSessionCommand = async (input, context) => {
120
120
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
121
- const headers = map({}, isSerializableHeaderValue, {
121
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
122
122
  "content-type": "application/json",
123
123
  accept: input.accept,
124
124
  });
@@ -128,14 +128,12 @@ const se_PutSessionCommand = async (input, context) => {
128
128
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
129
129
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
130
130
  let body;
131
- body = JSON.stringify({
132
- ...(input.activeContexts != null && { activeContexts: se_ActiveContextsList(input.activeContexts, context) }),
133
- ...(input.dialogAction != null && { dialogAction: se_DialogAction(input.dialogAction, context) }),
134
- ...(input.recentIntentSummaryView != null && {
135
- recentIntentSummaryView: se_IntentSummaryList(input.recentIntentSummaryView, context),
136
- }),
137
- ...(input.sessionAttributes != null && { sessionAttributes: se_StringMap(input.sessionAttributes, context) }),
138
- });
131
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
132
+ activeContexts: (_) => (0, smithy_client_1._json)(_),
133
+ dialogAction: (_) => (0, smithy_client_1._json)(_),
134
+ recentIntentSummaryView: (_) => (0, smithy_client_1._json)(_),
135
+ sessionAttributes: (_) => (0, smithy_client_1._json)(_),
136
+ }));
139
137
  return new protocol_http_1.HttpRequest({
140
138
  protocol,
141
139
  hostname,
@@ -151,22 +149,17 @@ const de_DeleteSessionCommand = async (output, context) => {
151
149
  if (output.statusCode !== 200 && output.statusCode >= 300) {
152
150
  return de_DeleteSessionCommandError(output, context);
153
151
  }
154
- const contents = map({
152
+ const contents = (0, smithy_client_1.map)({
155
153
  $metadata: deserializeMetadata(output),
156
154
  });
157
155
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
158
- if (data.botAlias != null) {
159
- contents.botAlias = (0, smithy_client_1.expectString)(data.botAlias);
160
- }
161
- if (data.botName != null) {
162
- contents.botName = (0, smithy_client_1.expectString)(data.botName);
163
- }
164
- if (data.sessionId != null) {
165
- contents.sessionId = (0, smithy_client_1.expectString)(data.sessionId);
166
- }
167
- if (data.userId != null) {
168
- contents.userId = (0, smithy_client_1.expectString)(data.userId);
169
- }
156
+ const doc = (0, smithy_client_1.take)(data, {
157
+ botAlias: smithy_client_1.expectString,
158
+ botName: smithy_client_1.expectString,
159
+ sessionId: smithy_client_1.expectString,
160
+ userId: smithy_client_1.expectString,
161
+ });
162
+ Object.assign(contents, doc);
170
163
  return contents;
171
164
  };
172
165
  exports.de_DeleteSessionCommand = de_DeleteSessionCommand;
@@ -194,10 +187,9 @@ const de_DeleteSessionCommandError = async (output, context) => {
194
187
  throw await de_NotFoundExceptionRes(parsedOutput, context);
195
188
  default:
196
189
  const parsedBody = parsedOutput.body;
197
- (0, smithy_client_1.throwDefaultError)({
190
+ return throwDefaultError({
198
191
  output,
199
192
  parsedBody,
200
- exceptionCtor: LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException,
201
193
  errorCode,
202
194
  });
203
195
  }
@@ -206,25 +198,18 @@ const de_GetSessionCommand = async (output, context) => {
206
198
  if (output.statusCode !== 200 && output.statusCode >= 300) {
207
199
  return de_GetSessionCommandError(output, context);
208
200
  }
209
- const contents = map({
201
+ const contents = (0, smithy_client_1.map)({
210
202
  $metadata: deserializeMetadata(output),
211
203
  });
212
204
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
213
- if (data.activeContexts != null) {
214
- contents.activeContexts = de_ActiveContextsList(data.activeContexts, context);
215
- }
216
- if (data.dialogAction != null) {
217
- contents.dialogAction = de_DialogAction(data.dialogAction, context);
218
- }
219
- if (data.recentIntentSummaryView != null) {
220
- contents.recentIntentSummaryView = de_IntentSummaryList(data.recentIntentSummaryView, context);
221
- }
222
- if (data.sessionAttributes != null) {
223
- contents.sessionAttributes = de_StringMap(data.sessionAttributes, context);
224
- }
225
- if (data.sessionId != null) {
226
- contents.sessionId = (0, smithy_client_1.expectString)(data.sessionId);
227
- }
205
+ const doc = (0, smithy_client_1.take)(data, {
206
+ activeContexts: smithy_client_1._json,
207
+ dialogAction: smithy_client_1._json,
208
+ recentIntentSummaryView: smithy_client_1._json,
209
+ sessionAttributes: smithy_client_1._json,
210
+ sessionId: smithy_client_1.expectString,
211
+ });
212
+ Object.assign(contents, doc);
228
213
  return contents;
229
214
  };
230
215
  exports.de_GetSessionCommand = de_GetSessionCommand;
@@ -249,10 +234,9 @@ const de_GetSessionCommandError = async (output, context) => {
249
234
  throw await de_NotFoundExceptionRes(parsedOutput, context);
250
235
  default:
251
236
  const parsedBody = parsedOutput.body;
252
- (0, smithy_client_1.throwDefaultError)({
237
+ return throwDefaultError({
253
238
  output,
254
239
  parsedBody,
255
- exceptionCtor: LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException,
256
240
  errorCode,
257
241
  });
258
242
  }
@@ -261,7 +245,7 @@ const de_PostContentCommand = async (output, context) => {
261
245
  if (output.statusCode !== 200 && output.statusCode >= 300) {
262
246
  return de_PostContentCommandError(output, context);
263
247
  }
264
- const contents = map({
248
+ const contents = (0, smithy_client_1.map)({
265
249
  $metadata: deserializeMetadata(output),
266
250
  contentType: [, output.headers["content-type"]],
267
251
  intentName: [, output.headers["x-amz-lex-intent-name"]],
@@ -344,10 +328,9 @@ const de_PostContentCommandError = async (output, context) => {
344
328
  throw await de_UnsupportedMediaTypeExceptionRes(parsedOutput, context);
345
329
  default:
346
330
  const parsedBody = parsedOutput.body;
347
- (0, smithy_client_1.throwDefaultError)({
331
+ return throwDefaultError({
348
332
  output,
349
333
  parsedBody,
350
- exceptionCtor: LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException,
351
334
  errorCode,
352
335
  });
353
336
  }
@@ -356,52 +339,27 @@ const de_PostTextCommand = async (output, context) => {
356
339
  if (output.statusCode !== 200 && output.statusCode >= 300) {
357
340
  return de_PostTextCommandError(output, context);
358
341
  }
359
- const contents = map({
342
+ const contents = (0, smithy_client_1.map)({
360
343
  $metadata: deserializeMetadata(output),
361
344
  });
362
345
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
363
- if (data.activeContexts != null) {
364
- contents.activeContexts = de_ActiveContextsList(data.activeContexts, context);
365
- }
366
- if (data.alternativeIntents != null) {
367
- contents.alternativeIntents = de_IntentList(data.alternativeIntents, context);
368
- }
369
- if (data.botVersion != null) {
370
- contents.botVersion = (0, smithy_client_1.expectString)(data.botVersion);
371
- }
372
- if (data.dialogState != null) {
373
- contents.dialogState = (0, smithy_client_1.expectString)(data.dialogState);
374
- }
375
- if (data.intentName != null) {
376
- contents.intentName = (0, smithy_client_1.expectString)(data.intentName);
377
- }
378
- if (data.message != null) {
379
- contents.message = (0, smithy_client_1.expectString)(data.message);
380
- }
381
- if (data.messageFormat != null) {
382
- contents.messageFormat = (0, smithy_client_1.expectString)(data.messageFormat);
383
- }
384
- if (data.nluIntentConfidence != null) {
385
- contents.nluIntentConfidence = de_IntentConfidence(data.nluIntentConfidence, context);
386
- }
387
- if (data.responseCard != null) {
388
- contents.responseCard = de_ResponseCard(data.responseCard, context);
389
- }
390
- if (data.sentimentResponse != null) {
391
- contents.sentimentResponse = de_SentimentResponse(data.sentimentResponse, context);
392
- }
393
- if (data.sessionAttributes != null) {
394
- contents.sessionAttributes = de_StringMap(data.sessionAttributes, context);
395
- }
396
- if (data.sessionId != null) {
397
- contents.sessionId = (0, smithy_client_1.expectString)(data.sessionId);
398
- }
399
- if (data.slotToElicit != null) {
400
- contents.slotToElicit = (0, smithy_client_1.expectString)(data.slotToElicit);
401
- }
402
- if (data.slots != null) {
403
- contents.slots = de_StringMap(data.slots, context);
404
- }
346
+ const doc = (0, smithy_client_1.take)(data, {
347
+ activeContexts: smithy_client_1._json,
348
+ alternativeIntents: (_) => de_IntentList(_, context),
349
+ botVersion: smithy_client_1.expectString,
350
+ dialogState: smithy_client_1.expectString,
351
+ intentName: smithy_client_1.expectString,
352
+ message: smithy_client_1.expectString,
353
+ messageFormat: smithy_client_1.expectString,
354
+ nluIntentConfidence: (_) => de_IntentConfidence(_, context),
355
+ responseCard: smithy_client_1._json,
356
+ sentimentResponse: smithy_client_1._json,
357
+ sessionAttributes: smithy_client_1._json,
358
+ sessionId: smithy_client_1.expectString,
359
+ slotToElicit: smithy_client_1.expectString,
360
+ slots: smithy_client_1._json,
361
+ });
362
+ Object.assign(contents, doc);
405
363
  return contents;
406
364
  };
407
365
  exports.de_PostTextCommand = de_PostTextCommand;
@@ -438,10 +396,9 @@ const de_PostTextCommandError = async (output, context) => {
438
396
  throw await de_NotFoundExceptionRes(parsedOutput, context);
439
397
  default:
440
398
  const parsedBody = parsedOutput.body;
441
- (0, smithy_client_1.throwDefaultError)({
399
+ return throwDefaultError({
442
400
  output,
443
401
  parsedBody,
444
- exceptionCtor: LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException,
445
402
  errorCode,
446
403
  });
447
404
  }
@@ -450,7 +407,7 @@ const de_PutSessionCommand = async (output, context) => {
450
407
  if (output.statusCode !== 200 && output.statusCode >= 300) {
451
408
  return de_PutSessionCommandError(output, context);
452
409
  }
453
- const contents = map({
410
+ const contents = (0, smithy_client_1.map)({
454
411
  $metadata: deserializeMetadata(output),
455
412
  contentType: [, output.headers["content-type"]],
456
413
  intentName: [, output.headers["x-amz-lex-intent-name"]],
@@ -512,21 +469,21 @@ const de_PutSessionCommandError = async (output, context) => {
512
469
  throw await de_NotFoundExceptionRes(parsedOutput, context);
513
470
  default:
514
471
  const parsedBody = parsedOutput.body;
515
- (0, smithy_client_1.throwDefaultError)({
472
+ return throwDefaultError({
516
473
  output,
517
474
  parsedBody,
518
- exceptionCtor: LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException,
519
475
  errorCode,
520
476
  });
521
477
  }
522
478
  };
523
- const map = smithy_client_1.map;
479
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException);
524
480
  const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
525
- const contents = map({});
481
+ const contents = (0, smithy_client_1.map)({});
526
482
  const data = parsedOutput.body;
527
- if (data.Message != null) {
528
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
529
- }
483
+ const doc = (0, smithy_client_1.take)(data, {
484
+ Message: smithy_client_1.expectString,
485
+ });
486
+ Object.assign(contents, doc);
530
487
  const exception = new models_0_1.BadGatewayException({
531
488
  $metadata: deserializeMetadata(parsedOutput),
532
489
  ...contents,
@@ -534,11 +491,12 @@ const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
534
491
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
535
492
  };
536
493
  const de_BadRequestExceptionRes = async (parsedOutput, context) => {
537
- const contents = map({});
494
+ const contents = (0, smithy_client_1.map)({});
538
495
  const data = parsedOutput.body;
539
- if (data.message != null) {
540
- contents.message = (0, smithy_client_1.expectString)(data.message);
541
- }
496
+ const doc = (0, smithy_client_1.take)(data, {
497
+ message: smithy_client_1.expectString,
498
+ });
499
+ Object.assign(contents, doc);
542
500
  const exception = new models_0_1.BadRequestException({
543
501
  $metadata: deserializeMetadata(parsedOutput),
544
502
  ...contents,
@@ -546,11 +504,12 @@ const de_BadRequestExceptionRes = async (parsedOutput, context) => {
546
504
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
547
505
  };
548
506
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
549
- const contents = map({});
507
+ const contents = (0, smithy_client_1.map)({});
550
508
  const data = parsedOutput.body;
551
- if (data.message != null) {
552
- contents.message = (0, smithy_client_1.expectString)(data.message);
553
- }
509
+ const doc = (0, smithy_client_1.take)(data, {
510
+ message: smithy_client_1.expectString,
511
+ });
512
+ Object.assign(contents, doc);
554
513
  const exception = new models_0_1.ConflictException({
555
514
  $metadata: deserializeMetadata(parsedOutput),
556
515
  ...contents,
@@ -558,11 +517,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
558
517
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
559
518
  };
560
519
  const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
561
- const contents = map({});
520
+ const contents = (0, smithy_client_1.map)({});
562
521
  const data = parsedOutput.body;
563
- if (data.Message != null) {
564
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
565
- }
522
+ const doc = (0, smithy_client_1.take)(data, {
523
+ Message: smithy_client_1.expectString,
524
+ });
525
+ Object.assign(contents, doc);
566
526
  const exception = new models_0_1.DependencyFailedException({
567
527
  $metadata: deserializeMetadata(parsedOutput),
568
528
  ...contents,
@@ -570,11 +530,12 @@ const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
570
530
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
571
531
  };
572
532
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
573
- const contents = map({});
533
+ const contents = (0, smithy_client_1.map)({});
574
534
  const data = parsedOutput.body;
575
- if (data.message != null) {
576
- contents.message = (0, smithy_client_1.expectString)(data.message);
577
- }
535
+ const doc = (0, smithy_client_1.take)(data, {
536
+ message: smithy_client_1.expectString,
537
+ });
538
+ Object.assign(contents, doc);
578
539
  const exception = new models_0_1.InternalFailureException({
579
540
  $metadata: deserializeMetadata(parsedOutput),
580
541
  ...contents,
@@ -582,13 +543,14 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
582
543
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
583
544
  };
584
545
  const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
585
- const contents = map({
546
+ const contents = (0, smithy_client_1.map)({
586
547
  retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
587
548
  });
588
549
  const data = parsedOutput.body;
589
- if (data.message != null) {
590
- contents.message = (0, smithy_client_1.expectString)(data.message);
591
- }
550
+ const doc = (0, smithy_client_1.take)(data, {
551
+ message: smithy_client_1.expectString,
552
+ });
553
+ Object.assign(contents, doc);
592
554
  const exception = new models_0_1.LimitExceededException({
593
555
  $metadata: deserializeMetadata(parsedOutput),
594
556
  ...contents,
@@ -596,11 +558,12 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
596
558
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
597
559
  };
598
560
  const de_LoopDetectedExceptionRes = async (parsedOutput, context) => {
599
- const contents = map({});
561
+ const contents = (0, smithy_client_1.map)({});
600
562
  const data = parsedOutput.body;
601
- if (data.Message != null) {
602
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
603
- }
563
+ const doc = (0, smithy_client_1.take)(data, {
564
+ Message: smithy_client_1.expectString,
565
+ });
566
+ Object.assign(contents, doc);
604
567
  const exception = new models_0_1.LoopDetectedException({
605
568
  $metadata: deserializeMetadata(parsedOutput),
606
569
  ...contents,
@@ -608,11 +571,12 @@ const de_LoopDetectedExceptionRes = async (parsedOutput, context) => {
608
571
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
609
572
  };
610
573
  const de_NotAcceptableExceptionRes = async (parsedOutput, context) => {
611
- const contents = map({});
574
+ const contents = (0, smithy_client_1.map)({});
612
575
  const data = parsedOutput.body;
613
- if (data.message != null) {
614
- contents.message = (0, smithy_client_1.expectString)(data.message);
615
- }
576
+ const doc = (0, smithy_client_1.take)(data, {
577
+ message: smithy_client_1.expectString,
578
+ });
579
+ Object.assign(contents, doc);
616
580
  const exception = new models_0_1.NotAcceptableException({
617
581
  $metadata: deserializeMetadata(parsedOutput),
618
582
  ...contents,
@@ -620,11 +584,12 @@ const de_NotAcceptableExceptionRes = async (parsedOutput, context) => {
620
584
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
621
585
  };
622
586
  const de_NotFoundExceptionRes = async (parsedOutput, context) => {
623
- const contents = map({});
587
+ const contents = (0, smithy_client_1.map)({});
624
588
  const data = parsedOutput.body;
625
- if (data.message != null) {
626
- contents.message = (0, smithy_client_1.expectString)(data.message);
627
- }
589
+ const doc = (0, smithy_client_1.take)(data, {
590
+ message: smithy_client_1.expectString,
591
+ });
592
+ Object.assign(contents, doc);
628
593
  const exception = new models_0_1.NotFoundException({
629
594
  $metadata: deserializeMetadata(parsedOutput),
630
595
  ...contents,
@@ -632,11 +597,12 @@ const de_NotFoundExceptionRes = async (parsedOutput, context) => {
632
597
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
633
598
  };
634
599
  const de_RequestTimeoutExceptionRes = async (parsedOutput, context) => {
635
- const contents = map({});
600
+ const contents = (0, smithy_client_1.map)({});
636
601
  const data = parsedOutput.body;
637
- if (data.message != null) {
638
- contents.message = (0, smithy_client_1.expectString)(data.message);
639
- }
602
+ const doc = (0, smithy_client_1.take)(data, {
603
+ message: smithy_client_1.expectString,
604
+ });
605
+ Object.assign(contents, doc);
640
606
  const exception = new models_0_1.RequestTimeoutException({
641
607
  $metadata: deserializeMetadata(parsedOutput),
642
608
  ...contents,
@@ -644,231 +610,37 @@ const de_RequestTimeoutExceptionRes = async (parsedOutput, context) => {
644
610
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
645
611
  };
646
612
  const de_UnsupportedMediaTypeExceptionRes = async (parsedOutput, context) => {
647
- const contents = map({});
613
+ const contents = (0, smithy_client_1.map)({});
648
614
  const data = parsedOutput.body;
649
- if (data.message != null) {
650
- contents.message = (0, smithy_client_1.expectString)(data.message);
651
- }
615
+ const doc = (0, smithy_client_1.take)(data, {
616
+ message: smithy_client_1.expectString,
617
+ });
618
+ Object.assign(contents, doc);
652
619
  const exception = new models_0_1.UnsupportedMediaTypeException({
653
620
  $metadata: deserializeMetadata(parsedOutput),
654
621
  ...contents,
655
622
  });
656
623
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
657
624
  };
658
- const se_ActiveContext = (input, context) => {
659
- return {
660
- ...(input.name != null && { name: input.name }),
661
- ...(input.parameters != null && { parameters: se_ActiveContextParametersMap(input.parameters, context) }),
662
- ...(input.timeToLive != null && { timeToLive: se_ActiveContextTimeToLive(input.timeToLive, context) }),
663
- };
664
- };
665
- const se_ActiveContextParametersMap = (input, context) => {
666
- return Object.entries(input).reduce((acc, [key, value]) => {
667
- if (value === null) {
668
- return acc;
669
- }
670
- acc[key] = value;
671
- return acc;
672
- }, {});
673
- };
674
- const se_ActiveContextsList = (input, context) => {
675
- return input
676
- .filter((e) => e != null)
677
- .map((entry) => {
678
- return se_ActiveContext(entry, context);
679
- });
680
- };
681
- const se_ActiveContextTimeToLive = (input, context) => {
682
- return {
683
- ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
684
- ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
685
- };
686
- };
687
- const se_DialogAction = (input, context) => {
688
- return {
689
- ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
690
- ...(input.intentName != null && { intentName: input.intentName }),
691
- ...(input.message != null && { message: input.message }),
692
- ...(input.messageFormat != null && { messageFormat: input.messageFormat }),
693
- ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
694
- ...(input.slots != null && { slots: se_StringMap(input.slots, context) }),
695
- ...(input.type != null && { type: input.type }),
696
- };
697
- };
698
- const se_IntentSummary = (input, context) => {
699
- return {
700
- ...(input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel }),
701
- ...(input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus }),
702
- ...(input.dialogActionType != null && { dialogActionType: input.dialogActionType }),
703
- ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
704
- ...(input.intentName != null && { intentName: input.intentName }),
705
- ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
706
- ...(input.slots != null && { slots: se_StringMap(input.slots, context) }),
707
- };
708
- };
709
- const se_IntentSummaryList = (input, context) => {
710
- return input
711
- .filter((e) => e != null)
712
- .map((entry) => {
713
- return se_IntentSummary(entry, context);
714
- });
715
- };
716
- const se_StringMap = (input, context) => {
717
- return Object.entries(input).reduce((acc, [key, value]) => {
718
- if (value === null) {
719
- return acc;
720
- }
721
- acc[key] = value;
722
- return acc;
723
- }, {});
724
- };
725
- const de_ActiveContext = (output, context) => {
726
- return {
727
- name: (0, smithy_client_1.expectString)(output.name),
728
- parameters: output.parameters != null ? de_ActiveContextParametersMap(output.parameters, context) : undefined,
729
- timeToLive: output.timeToLive != null ? de_ActiveContextTimeToLive(output.timeToLive, context) : undefined,
730
- };
731
- };
732
- const de_ActiveContextParametersMap = (output, context) => {
733
- return Object.entries(output).reduce((acc, [key, value]) => {
734
- if (value === null) {
735
- return acc;
736
- }
737
- acc[key] = (0, smithy_client_1.expectString)(value);
738
- return acc;
739
- }, {});
740
- };
741
- const de_ActiveContextsList = (output, context) => {
742
- const retVal = (output || [])
743
- .filter((e) => e != null)
744
- .map((entry) => {
745
- if (entry === null) {
746
- return null;
747
- }
748
- return de_ActiveContext(entry, context);
749
- });
750
- return retVal;
751
- };
752
- const de_ActiveContextTimeToLive = (output, context) => {
753
- return {
754
- timeToLiveInSeconds: (0, smithy_client_1.expectInt32)(output.timeToLiveInSeconds),
755
- turnsToLive: (0, smithy_client_1.expectInt32)(output.turnsToLive),
756
- };
757
- };
758
- const de_Button = (output, context) => {
759
- return {
760
- text: (0, smithy_client_1.expectString)(output.text),
761
- value: (0, smithy_client_1.expectString)(output.value),
762
- };
763
- };
764
- const de_DialogAction = (output, context) => {
765
- return {
766
- fulfillmentState: (0, smithy_client_1.expectString)(output.fulfillmentState),
767
- intentName: (0, smithy_client_1.expectString)(output.intentName),
768
- message: (0, smithy_client_1.expectString)(output.message),
769
- messageFormat: (0, smithy_client_1.expectString)(output.messageFormat),
770
- slotToElicit: (0, smithy_client_1.expectString)(output.slotToElicit),
771
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
772
- type: (0, smithy_client_1.expectString)(output.type),
773
- };
774
- };
775
- const de_GenericAttachment = (output, context) => {
776
- return {
777
- attachmentLinkUrl: (0, smithy_client_1.expectString)(output.attachmentLinkUrl),
778
- buttons: output.buttons != null ? de_listOfButtons(output.buttons, context) : undefined,
779
- imageUrl: (0, smithy_client_1.expectString)(output.imageUrl),
780
- subTitle: (0, smithy_client_1.expectString)(output.subTitle),
781
- title: (0, smithy_client_1.expectString)(output.title),
782
- };
783
- };
784
- const de_genericAttachmentList = (output, context) => {
785
- const retVal = (output || [])
786
- .filter((e) => e != null)
787
- .map((entry) => {
788
- if (entry === null) {
789
- return null;
790
- }
791
- return de_GenericAttachment(entry, context);
792
- });
793
- return retVal;
794
- };
795
625
  const de_IntentConfidence = (output, context) => {
796
- return {
797
- score: (0, smithy_client_1.limitedParseDouble)(output.score),
798
- };
626
+ return (0, smithy_client_1.take)(output, {
627
+ score: smithy_client_1.limitedParseDouble,
628
+ });
799
629
  };
800
630
  const de_IntentList = (output, context) => {
801
631
  const retVal = (output || [])
802
632
  .filter((e) => e != null)
803
633
  .map((entry) => {
804
- if (entry === null) {
805
- return null;
806
- }
807
634
  return de_PredictedIntent(entry, context);
808
635
  });
809
636
  return retVal;
810
637
  };
811
- const de_IntentSummary = (output, context) => {
812
- return {
813
- checkpointLabel: (0, smithy_client_1.expectString)(output.checkpointLabel),
814
- confirmationStatus: (0, smithy_client_1.expectString)(output.confirmationStatus),
815
- dialogActionType: (0, smithy_client_1.expectString)(output.dialogActionType),
816
- fulfillmentState: (0, smithy_client_1.expectString)(output.fulfillmentState),
817
- intentName: (0, smithy_client_1.expectString)(output.intentName),
818
- slotToElicit: (0, smithy_client_1.expectString)(output.slotToElicit),
819
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
820
- };
821
- };
822
- const de_IntentSummaryList = (output, context) => {
823
- const retVal = (output || [])
824
- .filter((e) => e != null)
825
- .map((entry) => {
826
- if (entry === null) {
827
- return null;
828
- }
829
- return de_IntentSummary(entry, context);
830
- });
831
- return retVal;
832
- };
833
- const de_listOfButtons = (output, context) => {
834
- const retVal = (output || [])
835
- .filter((e) => e != null)
836
- .map((entry) => {
837
- if (entry === null) {
838
- return null;
839
- }
840
- return de_Button(entry, context);
841
- });
842
- return retVal;
843
- };
844
638
  const de_PredictedIntent = (output, context) => {
845
- return {
846
- intentName: (0, smithy_client_1.expectString)(output.intentName),
847
- nluIntentConfidence: output.nluIntentConfidence != null ? de_IntentConfidence(output.nluIntentConfidence, context) : undefined,
848
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
849
- };
850
- };
851
- const de_ResponseCard = (output, context) => {
852
- return {
853
- contentType: (0, smithy_client_1.expectString)(output.contentType),
854
- genericAttachments: output.genericAttachments != null ? de_genericAttachmentList(output.genericAttachments, context) : undefined,
855
- version: (0, smithy_client_1.expectString)(output.version),
856
- };
857
- };
858
- const de_SentimentResponse = (output, context) => {
859
- return {
860
- sentimentLabel: (0, smithy_client_1.expectString)(output.sentimentLabel),
861
- sentimentScore: (0, smithy_client_1.expectString)(output.sentimentScore),
862
- };
863
- };
864
- const de_StringMap = (output, context) => {
865
- return Object.entries(output).reduce((acc, [key, value]) => {
866
- if (value === null) {
867
- return acc;
868
- }
869
- acc[key] = (0, smithy_client_1.expectString)(value);
870
- return acc;
871
- }, {});
639
+ return (0, smithy_client_1.take)(output, {
640
+ intentName: smithy_client_1.expectString,
641
+ nluIntentConfidence: (_) => de_IntentConfidence(_, context),
642
+ slots: smithy_client_1._json,
643
+ });
872
644
  };
873
645
  const deserializeMetadata = (output) => ({
874
646
  httpStatusCode: output.statusCode,
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { LexRuntimeServiceServiceException as __BaseException } from "../models/LexRuntimeServiceServiceException";
4
4
  import { BadGatewayException, BadRequestException, ConflictException, DependencyFailedException, InternalFailureException, LimitExceededException, LoopDetectedException, NotAcceptableException, NotFoundException, RequestTimeoutException, UnsupportedMediaTypeException, } from "../models/models_0";
5
5
  export const se_DeleteSessionCommand = async (input, context) => {
@@ -93,12 +93,12 @@ export const se_PostTextCommand = async (input, context) => {
93
93
  resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
94
94
  resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
95
95
  let body;
96
- body = JSON.stringify({
97
- ...(input.activeContexts != null && { activeContexts: se_ActiveContextsList(input.activeContexts, context) }),
98
- ...(input.inputText != null && { inputText: input.inputText }),
99
- ...(input.requestAttributes != null && { requestAttributes: se_StringMap(input.requestAttributes, context) }),
100
- ...(input.sessionAttributes != null && { sessionAttributes: se_StringMap(input.sessionAttributes, context) }),
101
- });
96
+ body = JSON.stringify(take(input, {
97
+ activeContexts: (_) => _json(_),
98
+ inputText: [],
99
+ requestAttributes: (_) => _json(_),
100
+ sessionAttributes: (_) => _json(_),
101
+ }));
102
102
  return new __HttpRequest({
103
103
  protocol,
104
104
  hostname,
@@ -121,14 +121,12 @@ export const se_PutSessionCommand = async (input, context) => {
121
121
  resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
122
122
  resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
123
123
  let body;
124
- body = JSON.stringify({
125
- ...(input.activeContexts != null && { activeContexts: se_ActiveContextsList(input.activeContexts, context) }),
126
- ...(input.dialogAction != null && { dialogAction: se_DialogAction(input.dialogAction, context) }),
127
- ...(input.recentIntentSummaryView != null && {
128
- recentIntentSummaryView: se_IntentSummaryList(input.recentIntentSummaryView, context),
129
- }),
130
- ...(input.sessionAttributes != null && { sessionAttributes: se_StringMap(input.sessionAttributes, context) }),
131
- });
124
+ body = JSON.stringify(take(input, {
125
+ activeContexts: (_) => _json(_),
126
+ dialogAction: (_) => _json(_),
127
+ recentIntentSummaryView: (_) => _json(_),
128
+ sessionAttributes: (_) => _json(_),
129
+ }));
132
130
  return new __HttpRequest({
133
131
  protocol,
134
132
  hostname,
@@ -147,18 +145,13 @@ export const de_DeleteSessionCommand = async (output, context) => {
147
145
  $metadata: deserializeMetadata(output),
148
146
  });
149
147
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
150
- if (data.botAlias != null) {
151
- contents.botAlias = __expectString(data.botAlias);
152
- }
153
- if (data.botName != null) {
154
- contents.botName = __expectString(data.botName);
155
- }
156
- if (data.sessionId != null) {
157
- contents.sessionId = __expectString(data.sessionId);
158
- }
159
- if (data.userId != null) {
160
- contents.userId = __expectString(data.userId);
161
- }
148
+ const doc = take(data, {
149
+ botAlias: __expectString,
150
+ botName: __expectString,
151
+ sessionId: __expectString,
152
+ userId: __expectString,
153
+ });
154
+ Object.assign(contents, doc);
162
155
  return contents;
163
156
  };
164
157
  const de_DeleteSessionCommandError = async (output, context) => {
@@ -185,10 +178,9 @@ const de_DeleteSessionCommandError = async (output, context) => {
185
178
  throw await de_NotFoundExceptionRes(parsedOutput, context);
186
179
  default:
187
180
  const parsedBody = parsedOutput.body;
188
- throwDefaultError({
181
+ return throwDefaultError({
189
182
  output,
190
183
  parsedBody,
191
- exceptionCtor: __BaseException,
192
184
  errorCode,
193
185
  });
194
186
  }
@@ -201,21 +193,14 @@ export const de_GetSessionCommand = async (output, context) => {
201
193
  $metadata: deserializeMetadata(output),
202
194
  });
203
195
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
204
- if (data.activeContexts != null) {
205
- contents.activeContexts = de_ActiveContextsList(data.activeContexts, context);
206
- }
207
- if (data.dialogAction != null) {
208
- contents.dialogAction = de_DialogAction(data.dialogAction, context);
209
- }
210
- if (data.recentIntentSummaryView != null) {
211
- contents.recentIntentSummaryView = de_IntentSummaryList(data.recentIntentSummaryView, context);
212
- }
213
- if (data.sessionAttributes != null) {
214
- contents.sessionAttributes = de_StringMap(data.sessionAttributes, context);
215
- }
216
- if (data.sessionId != null) {
217
- contents.sessionId = __expectString(data.sessionId);
218
- }
196
+ const doc = take(data, {
197
+ activeContexts: _json,
198
+ dialogAction: _json,
199
+ recentIntentSummaryView: _json,
200
+ sessionAttributes: _json,
201
+ sessionId: __expectString,
202
+ });
203
+ Object.assign(contents, doc);
219
204
  return contents;
220
205
  };
221
206
  const de_GetSessionCommandError = async (output, context) => {
@@ -239,10 +224,9 @@ const de_GetSessionCommandError = async (output, context) => {
239
224
  throw await de_NotFoundExceptionRes(parsedOutput, context);
240
225
  default:
241
226
  const parsedBody = parsedOutput.body;
242
- throwDefaultError({
227
+ return throwDefaultError({
243
228
  output,
244
229
  parsedBody,
245
- exceptionCtor: __BaseException,
246
230
  errorCode,
247
231
  });
248
232
  }
@@ -333,10 +317,9 @@ const de_PostContentCommandError = async (output, context) => {
333
317
  throw await de_UnsupportedMediaTypeExceptionRes(parsedOutput, context);
334
318
  default:
335
319
  const parsedBody = parsedOutput.body;
336
- throwDefaultError({
320
+ return throwDefaultError({
337
321
  output,
338
322
  parsedBody,
339
- exceptionCtor: __BaseException,
340
323
  errorCode,
341
324
  });
342
325
  }
@@ -349,48 +332,23 @@ export const de_PostTextCommand = async (output, context) => {
349
332
  $metadata: deserializeMetadata(output),
350
333
  });
351
334
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
352
- if (data.activeContexts != null) {
353
- contents.activeContexts = de_ActiveContextsList(data.activeContexts, context);
354
- }
355
- if (data.alternativeIntents != null) {
356
- contents.alternativeIntents = de_IntentList(data.alternativeIntents, context);
357
- }
358
- if (data.botVersion != null) {
359
- contents.botVersion = __expectString(data.botVersion);
360
- }
361
- if (data.dialogState != null) {
362
- contents.dialogState = __expectString(data.dialogState);
363
- }
364
- if (data.intentName != null) {
365
- contents.intentName = __expectString(data.intentName);
366
- }
367
- if (data.message != null) {
368
- contents.message = __expectString(data.message);
369
- }
370
- if (data.messageFormat != null) {
371
- contents.messageFormat = __expectString(data.messageFormat);
372
- }
373
- if (data.nluIntentConfidence != null) {
374
- contents.nluIntentConfidence = de_IntentConfidence(data.nluIntentConfidence, context);
375
- }
376
- if (data.responseCard != null) {
377
- contents.responseCard = de_ResponseCard(data.responseCard, context);
378
- }
379
- if (data.sentimentResponse != null) {
380
- contents.sentimentResponse = de_SentimentResponse(data.sentimentResponse, context);
381
- }
382
- if (data.sessionAttributes != null) {
383
- contents.sessionAttributes = de_StringMap(data.sessionAttributes, context);
384
- }
385
- if (data.sessionId != null) {
386
- contents.sessionId = __expectString(data.sessionId);
387
- }
388
- if (data.slotToElicit != null) {
389
- contents.slotToElicit = __expectString(data.slotToElicit);
390
- }
391
- if (data.slots != null) {
392
- contents.slots = de_StringMap(data.slots, context);
393
- }
335
+ const doc = take(data, {
336
+ activeContexts: _json,
337
+ alternativeIntents: (_) => de_IntentList(_, context),
338
+ botVersion: __expectString,
339
+ dialogState: __expectString,
340
+ intentName: __expectString,
341
+ message: __expectString,
342
+ messageFormat: __expectString,
343
+ nluIntentConfidence: (_) => de_IntentConfidence(_, context),
344
+ responseCard: _json,
345
+ sentimentResponse: _json,
346
+ sessionAttributes: _json,
347
+ sessionId: __expectString,
348
+ slotToElicit: __expectString,
349
+ slots: _json,
350
+ });
351
+ Object.assign(contents, doc);
394
352
  return contents;
395
353
  };
396
354
  const de_PostTextCommandError = async (output, context) => {
@@ -426,10 +384,9 @@ const de_PostTextCommandError = async (output, context) => {
426
384
  throw await de_NotFoundExceptionRes(parsedOutput, context);
427
385
  default:
428
386
  const parsedBody = parsedOutput.body;
429
- throwDefaultError({
387
+ return throwDefaultError({
430
388
  output,
431
389
  parsedBody,
432
- exceptionCtor: __BaseException,
433
390
  errorCode,
434
391
  });
435
392
  }
@@ -499,21 +456,21 @@ const de_PutSessionCommandError = async (output, context) => {
499
456
  throw await de_NotFoundExceptionRes(parsedOutput, context);
500
457
  default:
501
458
  const parsedBody = parsedOutput.body;
502
- throwDefaultError({
459
+ return throwDefaultError({
503
460
  output,
504
461
  parsedBody,
505
- exceptionCtor: __BaseException,
506
462
  errorCode,
507
463
  });
508
464
  }
509
465
  };
510
- const map = __map;
466
+ const throwDefaultError = withBaseException(__BaseException);
511
467
  const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
512
468
  const contents = map({});
513
469
  const data = parsedOutput.body;
514
- if (data.Message != null) {
515
- contents.Message = __expectString(data.Message);
516
- }
470
+ const doc = take(data, {
471
+ Message: __expectString,
472
+ });
473
+ Object.assign(contents, doc);
517
474
  const exception = new BadGatewayException({
518
475
  $metadata: deserializeMetadata(parsedOutput),
519
476
  ...contents,
@@ -523,9 +480,10 @@ const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
523
480
  const de_BadRequestExceptionRes = async (parsedOutput, context) => {
524
481
  const contents = map({});
525
482
  const data = parsedOutput.body;
526
- if (data.message != null) {
527
- contents.message = __expectString(data.message);
528
- }
483
+ const doc = take(data, {
484
+ message: __expectString,
485
+ });
486
+ Object.assign(contents, doc);
529
487
  const exception = new BadRequestException({
530
488
  $metadata: deserializeMetadata(parsedOutput),
531
489
  ...contents,
@@ -535,9 +493,10 @@ const de_BadRequestExceptionRes = async (parsedOutput, context) => {
535
493
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
536
494
  const contents = map({});
537
495
  const data = parsedOutput.body;
538
- if (data.message != null) {
539
- contents.message = __expectString(data.message);
540
- }
496
+ const doc = take(data, {
497
+ message: __expectString,
498
+ });
499
+ Object.assign(contents, doc);
541
500
  const exception = new ConflictException({
542
501
  $metadata: deserializeMetadata(parsedOutput),
543
502
  ...contents,
@@ -547,9 +506,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
547
506
  const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
548
507
  const contents = map({});
549
508
  const data = parsedOutput.body;
550
- if (data.Message != null) {
551
- contents.Message = __expectString(data.Message);
552
- }
509
+ const doc = take(data, {
510
+ Message: __expectString,
511
+ });
512
+ Object.assign(contents, doc);
553
513
  const exception = new DependencyFailedException({
554
514
  $metadata: deserializeMetadata(parsedOutput),
555
515
  ...contents,
@@ -559,9 +519,10 @@ const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
559
519
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
560
520
  const contents = map({});
561
521
  const data = parsedOutput.body;
562
- if (data.message != null) {
563
- contents.message = __expectString(data.message);
564
- }
522
+ const doc = take(data, {
523
+ message: __expectString,
524
+ });
525
+ Object.assign(contents, doc);
565
526
  const exception = new InternalFailureException({
566
527
  $metadata: deserializeMetadata(parsedOutput),
567
528
  ...contents,
@@ -573,9 +534,10 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
573
534
  retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
574
535
  });
575
536
  const data = parsedOutput.body;
576
- if (data.message != null) {
577
- contents.message = __expectString(data.message);
578
- }
537
+ const doc = take(data, {
538
+ message: __expectString,
539
+ });
540
+ Object.assign(contents, doc);
579
541
  const exception = new LimitExceededException({
580
542
  $metadata: deserializeMetadata(parsedOutput),
581
543
  ...contents,
@@ -585,9 +547,10 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
585
547
  const de_LoopDetectedExceptionRes = async (parsedOutput, context) => {
586
548
  const contents = map({});
587
549
  const data = parsedOutput.body;
588
- if (data.Message != null) {
589
- contents.Message = __expectString(data.Message);
590
- }
550
+ const doc = take(data, {
551
+ Message: __expectString,
552
+ });
553
+ Object.assign(contents, doc);
591
554
  const exception = new LoopDetectedException({
592
555
  $metadata: deserializeMetadata(parsedOutput),
593
556
  ...contents,
@@ -597,9 +560,10 @@ const de_LoopDetectedExceptionRes = async (parsedOutput, context) => {
597
560
  const de_NotAcceptableExceptionRes = async (parsedOutput, context) => {
598
561
  const contents = map({});
599
562
  const data = parsedOutput.body;
600
- if (data.message != null) {
601
- contents.message = __expectString(data.message);
602
- }
563
+ const doc = take(data, {
564
+ message: __expectString,
565
+ });
566
+ Object.assign(contents, doc);
603
567
  const exception = new NotAcceptableException({
604
568
  $metadata: deserializeMetadata(parsedOutput),
605
569
  ...contents,
@@ -609,9 +573,10 @@ const de_NotAcceptableExceptionRes = async (parsedOutput, context) => {
609
573
  const de_NotFoundExceptionRes = async (parsedOutput, context) => {
610
574
  const contents = map({});
611
575
  const data = parsedOutput.body;
612
- if (data.message != null) {
613
- contents.message = __expectString(data.message);
614
- }
576
+ const doc = take(data, {
577
+ message: __expectString,
578
+ });
579
+ Object.assign(contents, doc);
615
580
  const exception = new NotFoundException({
616
581
  $metadata: deserializeMetadata(parsedOutput),
617
582
  ...contents,
@@ -621,9 +586,10 @@ const de_NotFoundExceptionRes = async (parsedOutput, context) => {
621
586
  const de_RequestTimeoutExceptionRes = async (parsedOutput, context) => {
622
587
  const contents = map({});
623
588
  const data = parsedOutput.body;
624
- if (data.message != null) {
625
- contents.message = __expectString(data.message);
626
- }
589
+ const doc = take(data, {
590
+ message: __expectString,
591
+ });
592
+ Object.assign(contents, doc);
627
593
  const exception = new RequestTimeoutException({
628
594
  $metadata: deserializeMetadata(parsedOutput),
629
595
  ...contents,
@@ -633,229 +599,35 @@ const de_RequestTimeoutExceptionRes = async (parsedOutput, context) => {
633
599
  const de_UnsupportedMediaTypeExceptionRes = async (parsedOutput, context) => {
634
600
  const contents = map({});
635
601
  const data = parsedOutput.body;
636
- if (data.message != null) {
637
- contents.message = __expectString(data.message);
638
- }
602
+ const doc = take(data, {
603
+ message: __expectString,
604
+ });
605
+ Object.assign(contents, doc);
639
606
  const exception = new UnsupportedMediaTypeException({
640
607
  $metadata: deserializeMetadata(parsedOutput),
641
608
  ...contents,
642
609
  });
643
610
  return __decorateServiceException(exception, parsedOutput.body);
644
611
  };
645
- const se_ActiveContext = (input, context) => {
646
- return {
647
- ...(input.name != null && { name: input.name }),
648
- ...(input.parameters != null && { parameters: se_ActiveContextParametersMap(input.parameters, context) }),
649
- ...(input.timeToLive != null && { timeToLive: se_ActiveContextTimeToLive(input.timeToLive, context) }),
650
- };
651
- };
652
- const se_ActiveContextParametersMap = (input, context) => {
653
- return Object.entries(input).reduce((acc, [key, value]) => {
654
- if (value === null) {
655
- return acc;
656
- }
657
- acc[key] = value;
658
- return acc;
659
- }, {});
660
- };
661
- const se_ActiveContextsList = (input, context) => {
662
- return input
663
- .filter((e) => e != null)
664
- .map((entry) => {
665
- return se_ActiveContext(entry, context);
666
- });
667
- };
668
- const se_ActiveContextTimeToLive = (input, context) => {
669
- return {
670
- ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
671
- ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
672
- };
673
- };
674
- const se_DialogAction = (input, context) => {
675
- return {
676
- ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
677
- ...(input.intentName != null && { intentName: input.intentName }),
678
- ...(input.message != null && { message: input.message }),
679
- ...(input.messageFormat != null && { messageFormat: input.messageFormat }),
680
- ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
681
- ...(input.slots != null && { slots: se_StringMap(input.slots, context) }),
682
- ...(input.type != null && { type: input.type }),
683
- };
684
- };
685
- const se_IntentSummary = (input, context) => {
686
- return {
687
- ...(input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel }),
688
- ...(input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus }),
689
- ...(input.dialogActionType != null && { dialogActionType: input.dialogActionType }),
690
- ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
691
- ...(input.intentName != null && { intentName: input.intentName }),
692
- ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
693
- ...(input.slots != null && { slots: se_StringMap(input.slots, context) }),
694
- };
695
- };
696
- const se_IntentSummaryList = (input, context) => {
697
- return input
698
- .filter((e) => e != null)
699
- .map((entry) => {
700
- return se_IntentSummary(entry, context);
701
- });
702
- };
703
- const se_StringMap = (input, context) => {
704
- return Object.entries(input).reduce((acc, [key, value]) => {
705
- if (value === null) {
706
- return acc;
707
- }
708
- acc[key] = value;
709
- return acc;
710
- }, {});
711
- };
712
- const de_ActiveContext = (output, context) => {
713
- return {
714
- name: __expectString(output.name),
715
- parameters: output.parameters != null ? de_ActiveContextParametersMap(output.parameters, context) : undefined,
716
- timeToLive: output.timeToLive != null ? de_ActiveContextTimeToLive(output.timeToLive, context) : undefined,
717
- };
718
- };
719
- const de_ActiveContextParametersMap = (output, context) => {
720
- return Object.entries(output).reduce((acc, [key, value]) => {
721
- if (value === null) {
722
- return acc;
723
- }
724
- acc[key] = __expectString(value);
725
- return acc;
726
- }, {});
727
- };
728
- const de_ActiveContextsList = (output, context) => {
729
- const retVal = (output || [])
730
- .filter((e) => e != null)
731
- .map((entry) => {
732
- if (entry === null) {
733
- return null;
734
- }
735
- return de_ActiveContext(entry, context);
736
- });
737
- return retVal;
738
- };
739
- const de_ActiveContextTimeToLive = (output, context) => {
740
- return {
741
- timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
742
- turnsToLive: __expectInt32(output.turnsToLive),
743
- };
744
- };
745
- const de_Button = (output, context) => {
746
- return {
747
- text: __expectString(output.text),
748
- value: __expectString(output.value),
749
- };
750
- };
751
- const de_DialogAction = (output, context) => {
752
- return {
753
- fulfillmentState: __expectString(output.fulfillmentState),
754
- intentName: __expectString(output.intentName),
755
- message: __expectString(output.message),
756
- messageFormat: __expectString(output.messageFormat),
757
- slotToElicit: __expectString(output.slotToElicit),
758
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
759
- type: __expectString(output.type),
760
- };
761
- };
762
- const de_GenericAttachment = (output, context) => {
763
- return {
764
- attachmentLinkUrl: __expectString(output.attachmentLinkUrl),
765
- buttons: output.buttons != null ? de_listOfButtons(output.buttons, context) : undefined,
766
- imageUrl: __expectString(output.imageUrl),
767
- subTitle: __expectString(output.subTitle),
768
- title: __expectString(output.title),
769
- };
770
- };
771
- const de_genericAttachmentList = (output, context) => {
772
- const retVal = (output || [])
773
- .filter((e) => e != null)
774
- .map((entry) => {
775
- if (entry === null) {
776
- return null;
777
- }
778
- return de_GenericAttachment(entry, context);
779
- });
780
- return retVal;
781
- };
782
612
  const de_IntentConfidence = (output, context) => {
783
- return {
784
- score: __limitedParseDouble(output.score),
785
- };
613
+ return take(output, {
614
+ score: __limitedParseDouble,
615
+ });
786
616
  };
787
617
  const de_IntentList = (output, context) => {
788
618
  const retVal = (output || [])
789
619
  .filter((e) => e != null)
790
620
  .map((entry) => {
791
- if (entry === null) {
792
- return null;
793
- }
794
621
  return de_PredictedIntent(entry, context);
795
622
  });
796
623
  return retVal;
797
624
  };
798
- const de_IntentSummary = (output, context) => {
799
- return {
800
- checkpointLabel: __expectString(output.checkpointLabel),
801
- confirmationStatus: __expectString(output.confirmationStatus),
802
- dialogActionType: __expectString(output.dialogActionType),
803
- fulfillmentState: __expectString(output.fulfillmentState),
804
- intentName: __expectString(output.intentName),
805
- slotToElicit: __expectString(output.slotToElicit),
806
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
807
- };
808
- };
809
- const de_IntentSummaryList = (output, context) => {
810
- const retVal = (output || [])
811
- .filter((e) => e != null)
812
- .map((entry) => {
813
- if (entry === null) {
814
- return null;
815
- }
816
- return de_IntentSummary(entry, context);
817
- });
818
- return retVal;
819
- };
820
- const de_listOfButtons = (output, context) => {
821
- const retVal = (output || [])
822
- .filter((e) => e != null)
823
- .map((entry) => {
824
- if (entry === null) {
825
- return null;
826
- }
827
- return de_Button(entry, context);
828
- });
829
- return retVal;
830
- };
831
625
  const de_PredictedIntent = (output, context) => {
832
- return {
833
- intentName: __expectString(output.intentName),
834
- nluIntentConfidence: output.nluIntentConfidence != null ? de_IntentConfidence(output.nluIntentConfidence, context) : undefined,
835
- slots: output.slots != null ? de_StringMap(output.slots, context) : undefined,
836
- };
837
- };
838
- const de_ResponseCard = (output, context) => {
839
- return {
840
- contentType: __expectString(output.contentType),
841
- genericAttachments: output.genericAttachments != null ? de_genericAttachmentList(output.genericAttachments, context) : undefined,
842
- version: __expectString(output.version),
843
- };
844
- };
845
- const de_SentimentResponse = (output, context) => {
846
- return {
847
- sentimentLabel: __expectString(output.sentimentLabel),
848
- sentimentScore: __expectString(output.sentimentScore),
849
- };
850
- };
851
- const de_StringMap = (output, context) => {
852
- return Object.entries(output).reduce((acc, [key, value]) => {
853
- if (value === null) {
854
- return acc;
855
- }
856
- acc[key] = __expectString(value);
857
- return acc;
858
- }, {});
626
+ return take(output, {
627
+ intentName: __expectString,
628
+ nluIntentConfidence: (_) => de_IntentConfidence(_, context),
629
+ slots: _json,
630
+ });
859
631
  };
860
632
  const deserializeMetadata = (output) => ({
861
633
  httpStatusCode: output.statusCode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-lex-runtime-service",
3
3
  "description": "AWS SDK for JavaScript Lex Runtime Service Client for Node.js, Browser and React Native",
4
- "version": "3.312.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",
@@ -23,9 +23,9 @@
23
23
  "dependencies": {
24
24
  "@aws-crypto/sha256-browser": "3.0.0",
25
25
  "@aws-crypto/sha256-js": "3.0.0",
26
- "@aws-sdk/client-sts": "3.312.0",
26
+ "@aws-sdk/client-sts": "3.315.0",
27
27
  "@aws-sdk/config-resolver": "3.310.0",
28
- "@aws-sdk/credential-provider-node": "3.310.0",
28
+ "@aws-sdk/credential-provider-node": "3.315.0",
29
29
  "@aws-sdk/fetch-http-handler": "3.310.0",
30
30
  "@aws-sdk/hash-node": "3.310.0",
31
31
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -42,14 +42,14 @@
42
42
  "@aws-sdk/node-config-provider": "3.310.0",
43
43
  "@aws-sdk/node-http-handler": "3.310.0",
44
44
  "@aws-sdk/protocol-http": "3.310.0",
45
- "@aws-sdk/smithy-client": "3.310.0",
45
+ "@aws-sdk/smithy-client": "3.315.0",
46
46
  "@aws-sdk/types": "3.310.0",
47
47
  "@aws-sdk/url-parser": "3.310.0",
48
48
  "@aws-sdk/util-base64": "3.310.0",
49
49
  "@aws-sdk/util-body-length-browser": "3.310.0",
50
50
  "@aws-sdk/util-body-length-node": "3.310.0",
51
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
52
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
51
+ "@aws-sdk/util-defaults-mode-browser": "3.315.0",
52
+ "@aws-sdk/util-defaults-mode-node": "3.315.0",
53
53
  "@aws-sdk/util-endpoints": "3.310.0",
54
54
  "@aws-sdk/util-retry": "3.310.0",
55
55
  "@aws-sdk/util-stream-browser": "3.310.0",