@aws-sdk/client-lex-runtime-service 3.312.0 → 3.316.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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,