@aws-sdk/client-lex-runtime-v2 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.
@@ -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, 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, limitedParseDouble as __limitedParseDouble, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
4
4
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, StartConversationRequestEventStream, ThrottlingException, ValidationException, } from "../models/models_0";
5
5
  export const se_DeleteSessionCommand = async (input, context) => {
@@ -55,11 +55,11 @@ export const se_PutSessionCommand = async (input, context) => {
55
55
  resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
56
56
  resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
57
57
  let body;
58
- body = JSON.stringify({
59
- ...(input.messages != null && { messages: se_Messages(input.messages, context) }),
60
- ...(input.requestAttributes != null && { requestAttributes: se_StringMap(input.requestAttributes, context) }),
61
- ...(input.sessionState != null && { sessionState: se_SessionState(input.sessionState, context) }),
62
- });
58
+ body = JSON.stringify(take(input, {
59
+ messages: (_) => _json(_),
60
+ requestAttributes: (_) => _json(_),
61
+ sessionState: (_) => se_SessionState(_, context),
62
+ }));
63
63
  return new __HttpRequest({
64
64
  protocol,
65
65
  hostname,
@@ -82,11 +82,11 @@ export const se_RecognizeTextCommand = async (input, context) => {
82
82
  resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
83
83
  resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
84
84
  let body;
85
- body = JSON.stringify({
86
- ...(input.requestAttributes != null && { requestAttributes: se_StringMap(input.requestAttributes, context) }),
87
- ...(input.sessionState != null && { sessionState: se_SessionState(input.sessionState, context) }),
88
- ...(input.text != null && { text: input.text }),
89
- });
85
+ body = JSON.stringify(take(input, {
86
+ requestAttributes: (_) => _json(_),
87
+ sessionState: (_) => se_SessionState(_, context),
88
+ text: [],
89
+ }));
90
90
  return new __HttpRequest({
91
91
  protocol,
92
92
  hostname,
@@ -159,18 +159,13 @@ export const de_DeleteSessionCommand = async (output, context) => {
159
159
  $metadata: deserializeMetadata(output),
160
160
  });
161
161
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
162
- if (data.botAliasId != null) {
163
- contents.botAliasId = __expectString(data.botAliasId);
164
- }
165
- if (data.botId != null) {
166
- contents.botId = __expectString(data.botId);
167
- }
168
- if (data.localeId != null) {
169
- contents.localeId = __expectString(data.localeId);
170
- }
171
- if (data.sessionId != null) {
172
- contents.sessionId = __expectString(data.sessionId);
173
- }
162
+ const doc = take(data, {
163
+ botAliasId: __expectString,
164
+ botId: __expectString,
165
+ localeId: __expectString,
166
+ sessionId: __expectString,
167
+ });
168
+ Object.assign(contents, doc);
174
169
  return contents;
175
170
  };
176
171
  const de_DeleteSessionCommandError = async (output, context) => {
@@ -200,10 +195,9 @@ const de_DeleteSessionCommandError = async (output, context) => {
200
195
  throw await de_ValidationExceptionRes(parsedOutput, context);
201
196
  default:
202
197
  const parsedBody = parsedOutput.body;
203
- throwDefaultError({
198
+ return throwDefaultError({
204
199
  output,
205
200
  parsedBody,
206
- exceptionCtor: __BaseException,
207
201
  errorCode,
208
202
  });
209
203
  }
@@ -216,18 +210,13 @@ export const de_GetSessionCommand = async (output, context) => {
216
210
  $metadata: deserializeMetadata(output),
217
211
  });
218
212
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
219
- if (data.interpretations != null) {
220
- contents.interpretations = de_Interpretations(data.interpretations, context);
221
- }
222
- if (data.messages != null) {
223
- contents.messages = de_Messages(data.messages, context);
224
- }
225
- if (data.sessionId != null) {
226
- contents.sessionId = __expectString(data.sessionId);
227
- }
228
- if (data.sessionState != null) {
229
- contents.sessionState = de_SessionState(data.sessionState, context);
230
- }
213
+ const doc = take(data, {
214
+ interpretations: (_) => de_Interpretations(_, context),
215
+ messages: _json,
216
+ sessionId: __expectString,
217
+ sessionState: (_) => de_SessionState(_, context),
218
+ });
219
+ Object.assign(contents, doc);
231
220
  return contents;
232
221
  };
233
222
  const de_GetSessionCommandError = async (output, context) => {
@@ -254,10 +243,9 @@ const de_GetSessionCommandError = async (output, context) => {
254
243
  throw await de_ValidationExceptionRes(parsedOutput, context);
255
244
  default:
256
245
  const parsedBody = parsedOutput.body;
257
- throwDefaultError({
246
+ return throwDefaultError({
258
247
  output,
259
248
  parsedBody,
260
- exceptionCtor: __BaseException,
261
249
  errorCode,
262
250
  });
263
251
  }
@@ -312,10 +300,9 @@ const de_PutSessionCommandError = async (output, context) => {
312
300
  throw await de_ValidationExceptionRes(parsedOutput, context);
313
301
  default:
314
302
  const parsedBody = parsedOutput.body;
315
- throwDefaultError({
303
+ return throwDefaultError({
316
304
  output,
317
305
  parsedBody,
318
- exceptionCtor: __BaseException,
319
306
  errorCode,
320
307
  });
321
308
  }
@@ -328,24 +315,15 @@ export const de_RecognizeTextCommand = async (output, context) => {
328
315
  $metadata: deserializeMetadata(output),
329
316
  });
330
317
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
331
- if (data.interpretations != null) {
332
- contents.interpretations = de_Interpretations(data.interpretations, context);
333
- }
334
- if (data.messages != null) {
335
- contents.messages = de_Messages(data.messages, context);
336
- }
337
- if (data.recognizedBotMember != null) {
338
- contents.recognizedBotMember = de_RecognizedBotMember(data.recognizedBotMember, context);
339
- }
340
- if (data.requestAttributes != null) {
341
- contents.requestAttributes = de_StringMap(data.requestAttributes, context);
342
- }
343
- if (data.sessionId != null) {
344
- contents.sessionId = __expectString(data.sessionId);
345
- }
346
- if (data.sessionState != null) {
347
- contents.sessionState = de_SessionState(data.sessionState, context);
348
- }
318
+ const doc = take(data, {
319
+ interpretations: (_) => de_Interpretations(_, context),
320
+ messages: _json,
321
+ recognizedBotMember: _json,
322
+ requestAttributes: _json,
323
+ sessionId: __expectString,
324
+ sessionState: (_) => de_SessionState(_, context),
325
+ });
326
+ Object.assign(contents, doc);
349
327
  return contents;
350
328
  };
351
329
  const de_RecognizeTextCommandError = async (output, context) => {
@@ -381,10 +359,9 @@ const de_RecognizeTextCommandError = async (output, context) => {
381
359
  throw await de_ValidationExceptionRes(parsedOutput, context);
382
360
  default:
383
361
  const parsedBody = parsedOutput.body;
384
- throwDefaultError({
362
+ return throwDefaultError({
385
363
  output,
386
364
  parsedBody,
387
- exceptionCtor: __BaseException,
388
365
  errorCode,
389
366
  });
390
367
  }
@@ -443,10 +420,9 @@ const de_RecognizeUtteranceCommandError = async (output, context) => {
443
420
  throw await de_ValidationExceptionRes(parsedOutput, context);
444
421
  default:
445
422
  const parsedBody = parsedOutput.body;
446
- throwDefaultError({
423
+ return throwDefaultError({
447
424
  output,
448
425
  parsedBody,
449
- exceptionCtor: __BaseException,
450
426
  errorCode,
451
427
  });
452
428
  }
@@ -483,21 +459,21 @@ const de_StartConversationCommandError = async (output, context) => {
483
459
  throw await de_ValidationExceptionRes(parsedOutput, context);
484
460
  default:
485
461
  const parsedBody = parsedOutput.body;
486
- throwDefaultError({
462
+ return throwDefaultError({
487
463
  output,
488
464
  parsedBody,
489
- exceptionCtor: __BaseException,
490
465
  errorCode,
491
466
  });
492
467
  }
493
468
  };
494
- const map = __map;
469
+ const throwDefaultError = withBaseException(__BaseException);
495
470
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
496
471
  const contents = map({});
497
472
  const data = parsedOutput.body;
498
- if (data.message != null) {
499
- contents.message = __expectString(data.message);
500
- }
473
+ const doc = take(data, {
474
+ message: __expectString,
475
+ });
476
+ Object.assign(contents, doc);
501
477
  const exception = new AccessDeniedException({
502
478
  $metadata: deserializeMetadata(parsedOutput),
503
479
  ...contents,
@@ -507,9 +483,10 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
507
483
  const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
508
484
  const contents = map({});
509
485
  const data = parsedOutput.body;
510
- if (data.message != null) {
511
- contents.message = __expectString(data.message);
512
- }
486
+ const doc = take(data, {
487
+ message: __expectString,
488
+ });
489
+ Object.assign(contents, doc);
513
490
  const exception = new BadGatewayException({
514
491
  $metadata: deserializeMetadata(parsedOutput),
515
492
  ...contents,
@@ -519,9 +496,10 @@ const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
519
496
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
520
497
  const contents = map({});
521
498
  const data = parsedOutput.body;
522
- if (data.message != null) {
523
- contents.message = __expectString(data.message);
524
- }
499
+ const doc = take(data, {
500
+ message: __expectString,
501
+ });
502
+ Object.assign(contents, doc);
525
503
  const exception = new ConflictException({
526
504
  $metadata: deserializeMetadata(parsedOutput),
527
505
  ...contents,
@@ -531,9 +509,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
531
509
  const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
532
510
  const contents = map({});
533
511
  const data = parsedOutput.body;
534
- if (data.message != null) {
535
- contents.message = __expectString(data.message);
536
- }
512
+ const doc = take(data, {
513
+ message: __expectString,
514
+ });
515
+ Object.assign(contents, doc);
537
516
  const exception = new DependencyFailedException({
538
517
  $metadata: deserializeMetadata(parsedOutput),
539
518
  ...contents,
@@ -543,9 +522,10 @@ const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
543
522
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
544
523
  const contents = map({});
545
524
  const data = parsedOutput.body;
546
- if (data.message != null) {
547
- contents.message = __expectString(data.message);
548
- }
525
+ const doc = take(data, {
526
+ message: __expectString,
527
+ });
528
+ Object.assign(contents, doc);
549
529
  const exception = new InternalServerException({
550
530
  $metadata: deserializeMetadata(parsedOutput),
551
531
  ...contents,
@@ -555,9 +535,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
555
535
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
556
536
  const contents = map({});
557
537
  const data = parsedOutput.body;
558
- if (data.message != null) {
559
- contents.message = __expectString(data.message);
560
- }
538
+ const doc = take(data, {
539
+ message: __expectString,
540
+ });
541
+ Object.assign(contents, doc);
561
542
  const exception = new ResourceNotFoundException({
562
543
  $metadata: deserializeMetadata(parsedOutput),
563
544
  ...contents,
@@ -567,9 +548,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
567
548
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
568
549
  const contents = map({});
569
550
  const data = parsedOutput.body;
570
- if (data.message != null) {
571
- contents.message = __expectString(data.message);
572
- }
551
+ const doc = take(data, {
552
+ message: __expectString,
553
+ });
554
+ Object.assign(contents, doc);
573
555
  const exception = new ThrottlingException({
574
556
  $metadata: deserializeMetadata(parsedOutput),
575
557
  ...contents,
@@ -579,9 +561,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
579
561
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
580
562
  const contents = map({});
581
563
  const data = parsedOutput.body;
582
- if (data.message != null) {
583
- contents.message = __expectString(data.message);
584
- }
564
+ const doc = take(data, {
565
+ message: __expectString,
566
+ });
567
+ Object.assign(contents, doc);
585
568
  const exception = new ValidationException({
586
569
  $metadata: deserializeMetadata(parsedOutput),
587
570
  ...contents,
@@ -629,7 +612,7 @@ const se_DisconnectionEvent_event = (input, context) => {
629
612
  ":content-type": { type: "string", value: "application/json" },
630
613
  };
631
614
  let body = new Uint8Array();
632
- body = se_DisconnectionEvent(input, context);
615
+ body = _json(input);
633
616
  body = context.utf8Decoder(JSON.stringify(body));
634
617
  return { headers, body };
635
618
  };
@@ -640,7 +623,7 @@ const se_DTMFInputEvent_event = (input, context) => {
640
623
  ":content-type": { type: "string", value: "application/json" },
641
624
  };
642
625
  let body = new Uint8Array();
643
- body = se_DTMFInputEvent(input, context);
626
+ body = _json(input);
644
627
  body = context.utf8Decoder(JSON.stringify(body));
645
628
  return { headers, body };
646
629
  };
@@ -651,7 +634,7 @@ const se_PlaybackCompletionEvent_event = (input, context) => {
651
634
  ":content-type": { type: "string", value: "application/json" },
652
635
  };
653
636
  let body = new Uint8Array();
654
- body = se_PlaybackCompletionEvent(input, context);
637
+ body = _json(input);
655
638
  body = context.utf8Decoder(JSON.stringify(body));
656
639
  return { headers, body };
657
640
  };
@@ -662,7 +645,7 @@ const se_TextInputEvent_event = (input, context) => {
662
645
  ":content-type": { type: "string", value: "application/json" },
663
646
  };
664
647
  let body = new Uint8Array();
665
- body = se_TextInputEvent(input, context);
648
+ body = _json(input);
666
649
  body = context.utf8Decoder(JSON.stringify(body));
667
650
  return { headers, body };
668
651
  };
@@ -778,7 +761,7 @@ const de_DependencyFailedException_event = async (output, context) => {
778
761
  const de_HeartbeatEvent_event = async (output, context) => {
779
762
  const contents = {};
780
763
  const data = await parseBody(output.body, context);
781
- Object.assign(contents, de_HeartbeatEvent(data, context));
764
+ Object.assign(contents, _json(data));
782
765
  return contents;
783
766
  };
784
767
  const de_IntentResultEvent_event = async (output, context) => {
@@ -797,7 +780,7 @@ const de_InternalServerException_event = async (output, context) => {
797
780
  const de_PlaybackInterruptionEvent_event = async (output, context) => {
798
781
  const contents = {};
799
782
  const data = await parseBody(output.body, context);
800
- Object.assign(contents, de_PlaybackInterruptionEvent(data, context));
783
+ Object.assign(contents, _json(data));
801
784
  return contents;
802
785
  };
803
786
  const de_ResourceNotFoundException_event = async (output, context) => {
@@ -810,7 +793,7 @@ const de_ResourceNotFoundException_event = async (output, context) => {
810
793
  const de_TextResponseEvent_event = async (output, context) => {
811
794
  const contents = {};
812
795
  const data = await parseBody(output.body, context);
813
- Object.assign(contents, de_TextResponseEvent(data, context));
796
+ Object.assign(contents, _json(data));
814
797
  return contents;
815
798
  };
816
799
  const de_ThrottlingException_event = async (output, context) => {
@@ -823,7 +806,7 @@ const de_ThrottlingException_event = async (output, context) => {
823
806
  const de_TranscriptEvent_event = async (output, context) => {
824
807
  const contents = {};
825
808
  const data = await parseBody(output.body, context);
826
- Object.assign(contents, de_TranscriptEvent(data, context));
809
+ Object.assign(contents, _json(data));
827
810
  return contents;
828
811
  };
829
812
  const de_ValidationException_event = async (output, context) => {
@@ -833,176 +816,75 @@ const de_ValidationException_event = async (output, context) => {
833
816
  };
834
817
  return de_ValidationExceptionRes(parsedOutput, context);
835
818
  };
836
- const se_ActiveContext = (input, context) => {
837
- return {
838
- ...(input.contextAttributes != null && {
839
- contextAttributes: se_ActiveContextParametersMap(input.contextAttributes, context),
840
- }),
841
- ...(input.name != null && { name: input.name }),
842
- ...(input.timeToLive != null && { timeToLive: se_ActiveContextTimeToLive(input.timeToLive, context) }),
843
- };
844
- };
845
- const se_ActiveContextParametersMap = (input, context) => {
846
- return Object.entries(input).reduce((acc, [key, value]) => {
847
- if (value === null) {
848
- return acc;
849
- }
850
- acc[key] = value;
851
- return acc;
852
- }, {});
853
- };
854
- const se_ActiveContextsList = (input, context) => {
855
- return input
856
- .filter((e) => e != null)
857
- .map((entry) => {
858
- return se_ActiveContext(entry, context);
859
- });
860
- };
861
- const se_ActiveContextTimeToLive = (input, context) => {
862
- return {
863
- ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
864
- ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
865
- };
866
- };
867
819
  const se_AudioInputEvent = (input, context) => {
868
- return {
869
- ...(input.audioChunk != null && { audioChunk: context.base64Encoder(input.audioChunk) }),
870
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
871
- ...(input.contentType != null && { contentType: input.contentType }),
872
- ...(input.eventId != null && { eventId: input.eventId }),
873
- };
874
- };
875
- const se_Button = (input, context) => {
876
- return {
877
- ...(input.text != null && { text: input.text }),
878
- ...(input.value != null && { value: input.value }),
879
- };
880
- };
881
- const se_ButtonsList = (input, context) => {
882
- return input
883
- .filter((e) => e != null)
884
- .map((entry) => {
885
- return se_Button(entry, context);
820
+ return take(input, {
821
+ audioChunk: context.base64Encoder,
822
+ clientTimestampMillis: [],
823
+ contentType: [],
824
+ eventId: [],
886
825
  });
887
826
  };
888
827
  const se_ConfigurationEvent = (input, context) => {
889
- return {
890
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
891
- ...(input.disablePlayback != null && { disablePlayback: input.disablePlayback }),
892
- ...(input.eventId != null && { eventId: input.eventId }),
893
- ...(input.requestAttributes != null && { requestAttributes: se_StringMap(input.requestAttributes, context) }),
894
- ...(input.responseContentType != null && { responseContentType: input.responseContentType }),
895
- ...(input.sessionState != null && { sessionState: se_SessionState(input.sessionState, context) }),
896
- ...(input.welcomeMessages != null && { welcomeMessages: se_Messages(input.welcomeMessages, context) }),
897
- };
828
+ return take(input, {
829
+ clientTimestampMillis: [],
830
+ disablePlayback: [],
831
+ eventId: [],
832
+ requestAttributes: _json,
833
+ responseContentType: [],
834
+ sessionState: (_) => se_SessionState(_, context),
835
+ welcomeMessages: _json,
836
+ });
898
837
  };
899
838
  const se_DialogAction = (input, context) => {
900
- return {
901
- ...(input.slotElicitationStyle != null && { slotElicitationStyle: input.slotElicitationStyle }),
902
- ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
903
- ...(input.subSlotToElicit != null && { subSlotToElicit: se_ElicitSubSlot(input.subSlotToElicit, context) }),
904
- ...(input.type != null && { type: input.type }),
905
- };
906
- };
907
- const se_DisconnectionEvent = (input, context) => {
908
- return {
909
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
910
- ...(input.eventId != null && { eventId: input.eventId }),
911
- };
912
- };
913
- const se_DTMFInputEvent = (input, context) => {
914
- return {
915
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
916
- ...(input.eventId != null && { eventId: input.eventId }),
917
- ...(input.inputCharacter != null && { inputCharacter: input.inputCharacter }),
918
- };
839
+ return take(input, {
840
+ slotElicitationStyle: [],
841
+ slotToElicit: [],
842
+ subSlotToElicit: (_) => se_ElicitSubSlot(_, context),
843
+ type: [],
844
+ });
919
845
  };
920
846
  const se_ElicitSubSlot = (input, context) => {
921
- return {
922
- ...(input.name != null && { name: input.name }),
923
- ...(input.subSlotToElicit != null && { subSlotToElicit: se_ElicitSubSlot(input.subSlotToElicit, context) }),
924
- };
925
- };
926
- const se_ImageResponseCard = (input, context) => {
927
- return {
928
- ...(input.buttons != null && { buttons: se_ButtonsList(input.buttons, context) }),
929
- ...(input.imageUrl != null && { imageUrl: input.imageUrl }),
930
- ...(input.subtitle != null && { subtitle: input.subtitle }),
931
- ...(input.title != null && { title: input.title }),
932
- };
847
+ return take(input, {
848
+ name: [],
849
+ subSlotToElicit: (_) => se_ElicitSubSlot(_, context),
850
+ });
933
851
  };
934
852
  const se_Intent = (input, context) => {
935
- return {
936
- ...(input.confirmationState != null && { confirmationState: input.confirmationState }),
937
- ...(input.name != null && { name: input.name }),
938
- ...(input.slots != null && { slots: se_Slots(input.slots, context) }),
939
- ...(input.state != null && { state: input.state }),
940
- };
941
- };
942
- const se_Message = (input, context) => {
943
- return {
944
- ...(input.content != null && { content: input.content }),
945
- ...(input.contentType != null && { contentType: input.contentType }),
946
- ...(input.imageResponseCard != null && {
947
- imageResponseCard: se_ImageResponseCard(input.imageResponseCard, context),
948
- }),
949
- };
950
- };
951
- const se_Messages = (input, context) => {
952
- return input
953
- .filter((e) => e != null)
954
- .map((entry) => {
955
- return se_Message(entry, context);
853
+ return take(input, {
854
+ confirmationState: [],
855
+ name: [],
856
+ slots: (_) => se_Slots(_, context),
857
+ state: [],
956
858
  });
957
859
  };
958
- const se_PlaybackCompletionEvent = (input, context) => {
959
- return {
960
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
961
- ...(input.eventId != null && { eventId: input.eventId }),
962
- };
963
- };
964
860
  const se_RuntimeHintDetails = (input, context) => {
965
- return {
966
- ...(input.runtimeHintValues != null && {
967
- runtimeHintValues: se_RuntimeHintValuesList(input.runtimeHintValues, context),
968
- }),
969
- ...(input.subSlotHints != null && { subSlotHints: se_SlotHintsSlotMap(input.subSlotHints, context) }),
970
- };
861
+ return take(input, {
862
+ runtimeHintValues: _json,
863
+ subSlotHints: (_) => se_SlotHintsSlotMap(_, context),
864
+ });
971
865
  };
972
866
  const se_RuntimeHints = (input, context) => {
973
- return {
974
- ...(input.slotHints != null && { slotHints: se_SlotHintsIntentMap(input.slotHints, context) }),
975
- };
976
- };
977
- const se_RuntimeHintValue = (input, context) => {
978
- return {
979
- ...(input.phrase != null && { phrase: input.phrase }),
980
- };
981
- };
982
- const se_RuntimeHintValuesList = (input, context) => {
983
- return input
984
- .filter((e) => e != null)
985
- .map((entry) => {
986
- return se_RuntimeHintValue(entry, context);
867
+ return take(input, {
868
+ slotHints: (_) => se_SlotHintsIntentMap(_, context),
987
869
  });
988
870
  };
989
871
  const se_SessionState = (input, context) => {
990
- return {
991
- ...(input.activeContexts != null && { activeContexts: se_ActiveContextsList(input.activeContexts, context) }),
992
- ...(input.dialogAction != null && { dialogAction: se_DialogAction(input.dialogAction, context) }),
993
- ...(input.intent != null && { intent: se_Intent(input.intent, context) }),
994
- ...(input.originatingRequestId != null && { originatingRequestId: input.originatingRequestId }),
995
- ...(input.runtimeHints != null && { runtimeHints: se_RuntimeHints(input.runtimeHints, context) }),
996
- ...(input.sessionAttributes != null && { sessionAttributes: se_StringMap(input.sessionAttributes, context) }),
997
- };
872
+ return take(input, {
873
+ activeContexts: _json,
874
+ dialogAction: (_) => se_DialogAction(_, context),
875
+ intent: (_) => se_Intent(_, context),
876
+ originatingRequestId: [],
877
+ runtimeHints: (_) => se_RuntimeHints(_, context),
878
+ sessionAttributes: _json,
879
+ });
998
880
  };
999
881
  const se_Slot = (input, context) => {
1000
- return {
1001
- ...(input.shape != null && { shape: input.shape }),
1002
- ...(input.subSlots != null && { subSlots: se_Slots(input.subSlots, context) }),
1003
- ...(input.value != null && { value: se_Value(input.value, context) }),
1004
- ...(input.values != null && { values: se_Values(input.values, context) }),
1005
- };
882
+ return take(input, {
883
+ shape: [],
884
+ subSlots: (_) => se_Slots(_, context),
885
+ value: _json,
886
+ values: (_) => se_Values(_, context),
887
+ });
1006
888
  };
1007
889
  const se_SlotHintsIntentMap = (input, context) => {
1008
890
  return Object.entries(input).reduce((acc, [key, value]) => {
@@ -1031,36 +913,6 @@ const se_Slots = (input, context) => {
1031
913
  return acc;
1032
914
  }, {});
1033
915
  };
1034
- const se_StringList = (input, context) => {
1035
- return input
1036
- .filter((e) => e != null)
1037
- .map((entry) => {
1038
- return entry;
1039
- });
1040
- };
1041
- const se_StringMap = (input, context) => {
1042
- return Object.entries(input).reduce((acc, [key, value]) => {
1043
- if (value === null) {
1044
- return acc;
1045
- }
1046
- acc[key] = value;
1047
- return acc;
1048
- }, {});
1049
- };
1050
- const se_TextInputEvent = (input, context) => {
1051
- return {
1052
- ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
1053
- ...(input.eventId != null && { eventId: input.eventId }),
1054
- ...(input.text != null && { text: input.text }),
1055
- };
1056
- };
1057
- const se_Value = (input, context) => {
1058
- return {
1059
- ...(input.interpretedValue != null && { interpretedValue: input.interpretedValue }),
1060
- ...(input.originalValue != null && { originalValue: input.originalValue }),
1061
- ...(input.resolvedValues != null && { resolvedValues: se_StringList(input.resolvedValues, context) }),
1062
- };
1063
- };
1064
916
  const se_Values = (input, context) => {
1065
917
  return input
1066
918
  .filter((e) => e != null)
@@ -1068,221 +920,108 @@ const se_Values = (input, context) => {
1068
920
  return se_Slot(entry, context);
1069
921
  });
1070
922
  };
1071
- const de_ActiveContext = (output, context) => {
1072
- return {
1073
- contextAttributes: output.contextAttributes != null ? de_ActiveContextParametersMap(output.contextAttributes, context) : undefined,
1074
- name: __expectString(output.name),
1075
- timeToLive: output.timeToLive != null ? de_ActiveContextTimeToLive(output.timeToLive, context) : undefined,
1076
- };
1077
- };
1078
- const de_ActiveContextParametersMap = (output, context) => {
1079
- return Object.entries(output).reduce((acc, [key, value]) => {
1080
- if (value === null) {
1081
- return acc;
1082
- }
1083
- acc[key] = __expectString(value);
1084
- return acc;
1085
- }, {});
1086
- };
1087
- const de_ActiveContextsList = (output, context) => {
1088
- const retVal = (output || [])
1089
- .filter((e) => e != null)
1090
- .map((entry) => {
1091
- if (entry === null) {
1092
- return null;
1093
- }
1094
- return de_ActiveContext(entry, context);
1095
- });
1096
- return retVal;
1097
- };
1098
- const de_ActiveContextTimeToLive = (output, context) => {
1099
- return {
1100
- timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
1101
- turnsToLive: __expectInt32(output.turnsToLive),
1102
- };
1103
- };
1104
923
  const de_AudioResponseEvent = (output, context) => {
1105
- return {
1106
- audioChunk: output.audioChunk != null ? context.base64Decoder(output.audioChunk) : undefined,
1107
- contentType: __expectString(output.contentType),
1108
- eventId: __expectString(output.eventId),
1109
- };
1110
- };
1111
- const de_Button = (output, context) => {
1112
- return {
1113
- text: __expectString(output.text),
1114
- value: __expectString(output.value),
1115
- };
1116
- };
1117
- const de_ButtonsList = (output, context) => {
1118
- const retVal = (output || [])
1119
- .filter((e) => e != null)
1120
- .map((entry) => {
1121
- if (entry === null) {
1122
- return null;
1123
- }
1124
- return de_Button(entry, context);
924
+ return take(output, {
925
+ audioChunk: context.base64Decoder,
926
+ contentType: __expectString,
927
+ eventId: __expectString,
1125
928
  });
1126
- return retVal;
1127
929
  };
1128
930
  const de_ConfidenceScore = (output, context) => {
1129
- return {
1130
- score: __limitedParseDouble(output.score),
1131
- };
931
+ return take(output, {
932
+ score: __limitedParseDouble,
933
+ });
1132
934
  };
1133
935
  const de_DialogAction = (output, context) => {
1134
- return {
1135
- slotElicitationStyle: __expectString(output.slotElicitationStyle),
1136
- slotToElicit: __expectString(output.slotToElicit),
1137
- subSlotToElicit: output.subSlotToElicit != null ? de_ElicitSubSlot(output.subSlotToElicit, context) : undefined,
1138
- type: __expectString(output.type),
1139
- };
936
+ return take(output, {
937
+ slotElicitationStyle: __expectString,
938
+ slotToElicit: __expectString,
939
+ subSlotToElicit: (_) => de_ElicitSubSlot(_, context),
940
+ type: __expectString,
941
+ });
1140
942
  };
1141
943
  const de_ElicitSubSlot = (output, context) => {
1142
- return {
1143
- name: __expectString(output.name),
1144
- subSlotToElicit: output.subSlotToElicit != null ? de_ElicitSubSlot(output.subSlotToElicit, context) : undefined,
1145
- };
1146
- };
1147
- const de_HeartbeatEvent = (output, context) => {
1148
- return {
1149
- eventId: __expectString(output.eventId),
1150
- };
1151
- };
1152
- const de_ImageResponseCard = (output, context) => {
1153
- return {
1154
- buttons: output.buttons != null ? de_ButtonsList(output.buttons, context) : undefined,
1155
- imageUrl: __expectString(output.imageUrl),
1156
- subtitle: __expectString(output.subtitle),
1157
- title: __expectString(output.title),
1158
- };
944
+ return take(output, {
945
+ name: __expectString,
946
+ subSlotToElicit: (_) => de_ElicitSubSlot(_, context),
947
+ });
1159
948
  };
1160
949
  const de_Intent = (output, context) => {
1161
- return {
1162
- confirmationState: __expectString(output.confirmationState),
1163
- name: __expectString(output.name),
1164
- slots: output.slots != null ? de_Slots(output.slots, context) : undefined,
1165
- state: __expectString(output.state),
1166
- };
950
+ return take(output, {
951
+ confirmationState: __expectString,
952
+ name: __expectString,
953
+ slots: (_) => de_Slots(_, context),
954
+ state: __expectString,
955
+ });
1167
956
  };
1168
957
  const de_IntentResultEvent = (output, context) => {
1169
- return {
1170
- eventId: __expectString(output.eventId),
1171
- inputMode: __expectString(output.inputMode),
1172
- interpretations: output.interpretations != null ? de_Interpretations(output.interpretations, context) : undefined,
1173
- recognizedBotMember: output.recognizedBotMember != null ? de_RecognizedBotMember(output.recognizedBotMember, context) : undefined,
1174
- requestAttributes: output.requestAttributes != null ? de_StringMap(output.requestAttributes, context) : undefined,
1175
- sessionId: __expectString(output.sessionId),
1176
- sessionState: output.sessionState != null ? de_SessionState(output.sessionState, context) : undefined,
1177
- };
958
+ return take(output, {
959
+ eventId: __expectString,
960
+ inputMode: __expectString,
961
+ interpretations: (_) => de_Interpretations(_, context),
962
+ recognizedBotMember: _json,
963
+ requestAttributes: _json,
964
+ sessionId: __expectString,
965
+ sessionState: (_) => de_SessionState(_, context),
966
+ });
1178
967
  };
1179
968
  const de_Interpretation = (output, context) => {
1180
- return {
1181
- intent: output.intent != null ? de_Intent(output.intent, context) : undefined,
1182
- nluConfidence: output.nluConfidence != null ? de_ConfidenceScore(output.nluConfidence, context) : undefined,
1183
- sentimentResponse: output.sentimentResponse != null ? de_SentimentResponse(output.sentimentResponse, context) : undefined,
1184
- };
969
+ return take(output, {
970
+ intent: (_) => de_Intent(_, context),
971
+ nluConfidence: (_) => de_ConfidenceScore(_, context),
972
+ sentimentResponse: (_) => de_SentimentResponse(_, context),
973
+ });
1185
974
  };
1186
975
  const de_Interpretations = (output, context) => {
1187
976
  const retVal = (output || [])
1188
977
  .filter((e) => e != null)
1189
978
  .map((entry) => {
1190
- if (entry === null) {
1191
- return null;
1192
- }
1193
979
  return de_Interpretation(entry, context);
1194
980
  });
1195
981
  return retVal;
1196
982
  };
1197
- const de_Message = (output, context) => {
1198
- return {
1199
- content: __expectString(output.content),
1200
- contentType: __expectString(output.contentType),
1201
- imageResponseCard: output.imageResponseCard != null ? de_ImageResponseCard(output.imageResponseCard, context) : undefined,
1202
- };
1203
- };
1204
- const de_Messages = (output, context) => {
1205
- const retVal = (output || [])
1206
- .filter((e) => e != null)
1207
- .map((entry) => {
1208
- if (entry === null) {
1209
- return null;
1210
- }
1211
- return de_Message(entry, context);
1212
- });
1213
- return retVal;
1214
- };
1215
- const de_PlaybackInterruptionEvent = (output, context) => {
1216
- return {
1217
- causedByEventId: __expectString(output.causedByEventId),
1218
- eventId: __expectString(output.eventId),
1219
- eventReason: __expectString(output.eventReason),
1220
- };
1221
- };
1222
- const de_RecognizedBotMember = (output, context) => {
1223
- return {
1224
- botId: __expectString(output.botId),
1225
- botName: __expectString(output.botName),
1226
- };
1227
- };
1228
983
  const de_RuntimeHintDetails = (output, context) => {
1229
- return {
1230
- runtimeHintValues: output.runtimeHintValues != null ? de_RuntimeHintValuesList(output.runtimeHintValues, context) : undefined,
1231
- subSlotHints: output.subSlotHints != null ? de_SlotHintsSlotMap(output.subSlotHints, context) : undefined,
1232
- };
984
+ return take(output, {
985
+ runtimeHintValues: _json,
986
+ subSlotHints: (_) => de_SlotHintsSlotMap(_, context),
987
+ });
1233
988
  };
1234
989
  const de_RuntimeHints = (output, context) => {
1235
- return {
1236
- slotHints: output.slotHints != null ? de_SlotHintsIntentMap(output.slotHints, context) : undefined,
1237
- };
1238
- };
1239
- const de_RuntimeHintValue = (output, context) => {
1240
- return {
1241
- phrase: __expectString(output.phrase),
1242
- };
1243
- };
1244
- const de_RuntimeHintValuesList = (output, context) => {
1245
- const retVal = (output || [])
1246
- .filter((e) => e != null)
1247
- .map((entry) => {
1248
- if (entry === null) {
1249
- return null;
1250
- }
1251
- return de_RuntimeHintValue(entry, context);
990
+ return take(output, {
991
+ slotHints: (_) => de_SlotHintsIntentMap(_, context),
1252
992
  });
1253
- return retVal;
1254
993
  };
1255
994
  const de_SentimentResponse = (output, context) => {
1256
- return {
1257
- sentiment: __expectString(output.sentiment),
1258
- sentimentScore: output.sentimentScore != null ? de_SentimentScore(output.sentimentScore, context) : undefined,
1259
- };
995
+ return take(output, {
996
+ sentiment: __expectString,
997
+ sentimentScore: (_) => de_SentimentScore(_, context),
998
+ });
1260
999
  };
1261
1000
  const de_SentimentScore = (output, context) => {
1262
- return {
1263
- mixed: __limitedParseDouble(output.mixed),
1264
- negative: __limitedParseDouble(output.negative),
1265
- neutral: __limitedParseDouble(output.neutral),
1266
- positive: __limitedParseDouble(output.positive),
1267
- };
1001
+ return take(output, {
1002
+ mixed: __limitedParseDouble,
1003
+ negative: __limitedParseDouble,
1004
+ neutral: __limitedParseDouble,
1005
+ positive: __limitedParseDouble,
1006
+ });
1268
1007
  };
1269
1008
  const de_SessionState = (output, context) => {
1270
- return {
1271
- activeContexts: output.activeContexts != null ? de_ActiveContextsList(output.activeContexts, context) : undefined,
1272
- dialogAction: output.dialogAction != null ? de_DialogAction(output.dialogAction, context) : undefined,
1273
- intent: output.intent != null ? de_Intent(output.intent, context) : undefined,
1274
- originatingRequestId: __expectString(output.originatingRequestId),
1275
- runtimeHints: output.runtimeHints != null ? de_RuntimeHints(output.runtimeHints, context) : undefined,
1276
- sessionAttributes: output.sessionAttributes != null ? de_StringMap(output.sessionAttributes, context) : undefined,
1277
- };
1009
+ return take(output, {
1010
+ activeContexts: _json,
1011
+ dialogAction: (_) => de_DialogAction(_, context),
1012
+ intent: (_) => de_Intent(_, context),
1013
+ originatingRequestId: __expectString,
1014
+ runtimeHints: (_) => de_RuntimeHints(_, context),
1015
+ sessionAttributes: _json,
1016
+ });
1278
1017
  };
1279
1018
  const de_Slot = (output, context) => {
1280
- return {
1281
- shape: __expectString(output.shape),
1282
- subSlots: output.subSlots != null ? de_Slots(output.subSlots, context) : undefined,
1283
- value: output.value != null ? de_Value(output.value, context) : undefined,
1284
- values: output.values != null ? de_Values(output.values, context) : undefined,
1285
- };
1019
+ return take(output, {
1020
+ shape: __expectString,
1021
+ subSlots: (_) => de_Slots(_, context),
1022
+ value: _json,
1023
+ values: (_) => de_Values(_, context),
1024
+ });
1286
1025
  };
1287
1026
  const de_SlotHintsIntentMap = (output, context) => {
1288
1027
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -1311,52 +1050,10 @@ const de_Slots = (output, context) => {
1311
1050
  return acc;
1312
1051
  }, {});
1313
1052
  };
1314
- const de_StringList = (output, context) => {
1315
- const retVal = (output || [])
1316
- .filter((e) => e != null)
1317
- .map((entry) => {
1318
- if (entry === null) {
1319
- return null;
1320
- }
1321
- return __expectString(entry);
1322
- });
1323
- return retVal;
1324
- };
1325
- const de_StringMap = (output, context) => {
1326
- return Object.entries(output).reduce((acc, [key, value]) => {
1327
- if (value === null) {
1328
- return acc;
1329
- }
1330
- acc[key] = __expectString(value);
1331
- return acc;
1332
- }, {});
1333
- };
1334
- const de_TextResponseEvent = (output, context) => {
1335
- return {
1336
- eventId: __expectString(output.eventId),
1337
- messages: output.messages != null ? de_Messages(output.messages, context) : undefined,
1338
- };
1339
- };
1340
- const de_TranscriptEvent = (output, context) => {
1341
- return {
1342
- eventId: __expectString(output.eventId),
1343
- transcript: __expectString(output.transcript),
1344
- };
1345
- };
1346
- const de_Value = (output, context) => {
1347
- return {
1348
- interpretedValue: __expectString(output.interpretedValue),
1349
- originalValue: __expectString(output.originalValue),
1350
- resolvedValues: output.resolvedValues != null ? de_StringList(output.resolvedValues, context) : undefined,
1351
- };
1352
- };
1353
1053
  const de_Values = (output, context) => {
1354
1054
  const retVal = (output || [])
1355
1055
  .filter((e) => e != null)
1356
1056
  .map((entry) => {
1357
- if (entry === null) {
1358
- return null;
1359
- }
1360
1057
  return de_Slot(entry, context);
1361
1058
  });
1362
1059
  return retVal;