@aws-sdk/client-lex-runtime-v2 3.489.0 → 3.495.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1104 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_StartConversationCommand = exports.de_RecognizeUtteranceCommand = exports.de_RecognizeTextCommand = exports.de_PutSessionCommand = exports.de_GetSessionCommand = exports.de_DeleteSessionCommand = exports.se_StartConversationCommand = exports.se_RecognizeUtteranceCommand = exports.se_RecognizeTextCommand = exports.se_PutSessionCommand = exports.se_GetSessionCommand = exports.se_DeleteSessionCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const LexRuntimeV2ServiceException_1 = require("../models/LexRuntimeV2ServiceException");
7
- const models_0_1 = require("../models/models_0");
8
- const se_DeleteSessionCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {};
11
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
12
- b.p("botId", () => input.botId, "{botId}", false);
13
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
14
- b.p("localeId", () => input.localeId, "{localeId}", false);
15
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
16
- let body;
17
- b.m("DELETE").h(headers).b(body);
18
- return b.build();
19
- };
20
- exports.se_DeleteSessionCommand = se_DeleteSessionCommand;
21
- const se_GetSessionCommand = async (input, context) => {
22
- const b = (0, core_1.requestBuilder)(input, context);
23
- const headers = {};
24
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
25
- b.p("botId", () => input.botId, "{botId}", false);
26
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
27
- b.p("localeId", () => input.localeId, "{localeId}", false);
28
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
29
- let body;
30
- b.m("GET").h(headers).b(body);
31
- return b.build();
32
- };
33
- exports.se_GetSessionCommand = se_GetSessionCommand;
34
- const se_PutSessionCommand = async (input, context) => {
35
- const b = (0, core_1.requestBuilder)(input, context);
36
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
37
- "content-type": "application/json",
38
- [_r]: input[_rCT],
39
- });
40
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
41
- b.p("botId", () => input.botId, "{botId}", false);
42
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
43
- b.p("localeId", () => input.localeId, "{localeId}", false);
44
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
45
- let body;
46
- body = JSON.stringify((0, smithy_client_1.take)(input, {
47
- messages: (_) => (0, smithy_client_1._json)(_),
48
- requestAttributes: (_) => (0, smithy_client_1._json)(_),
49
- sessionState: (_) => se_SessionState(_, context),
50
- }));
51
- b.m("POST").h(headers).b(body);
52
- return b.build();
53
- };
54
- exports.se_PutSessionCommand = se_PutSessionCommand;
55
- const se_RecognizeTextCommand = async (input, context) => {
56
- const b = (0, core_1.requestBuilder)(input, context);
57
- const headers = {
58
- "content-type": "application/json",
59
- };
60
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text");
61
- b.p("botId", () => input.botId, "{botId}", false);
62
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
63
- b.p("localeId", () => input.localeId, "{localeId}", false);
64
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
65
- let body;
66
- body = JSON.stringify((0, smithy_client_1.take)(input, {
67
- requestAttributes: (_) => (0, smithy_client_1._json)(_),
68
- sessionState: (_) => se_SessionState(_, context),
69
- text: [],
70
- }));
71
- b.m("POST").h(headers).b(body);
72
- return b.build();
73
- };
74
- exports.se_RecognizeTextCommand = se_RecognizeTextCommand;
75
- const se_RecognizeUtteranceCommand = async (input, context) => {
76
- const b = (0, core_1.requestBuilder)(input, context);
77
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
78
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
79
- [_ct]: input[_rCTe] || "application/octet-stream",
80
- [_xalss]: input[_sS],
81
- [_xalra]: input[_rA],
82
- [_rct]: input[_rCT],
83
- });
84
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance");
85
- b.p("botId", () => input.botId, "{botId}", false);
86
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
87
- b.p("localeId", () => input.localeId, "{localeId}", false);
88
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
89
- let body;
90
- if (input.inputStream !== undefined) {
91
- body = input.inputStream;
92
- }
93
- b.m("POST").h(headers).b(body);
94
- return b.build();
95
- };
96
- exports.se_RecognizeUtteranceCommand = se_RecognizeUtteranceCommand;
97
- const se_StartConversationCommand = async (input, context) => {
98
- const b = (0, core_1.requestBuilder)(input, context);
99
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
100
- [_xalcm]: input[_cM],
101
- });
102
- b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation");
103
- b.p("botId", () => input.botId, "{botId}", false);
104
- b.p("botAliasId", () => input.botAliasId, "{botAliasId}", false);
105
- b.p("localeId", () => input.localeId, "{localeId}", false);
106
- b.p("sessionId", () => input.sessionId, "{sessionId}", false);
107
- let body;
108
- if (input.requestEventStream !== undefined) {
109
- body = se_StartConversationRequestEventStream(input.requestEventStream, context);
110
- }
111
- b.m("POST").h(headers).b(body);
112
- return b.build();
113
- };
114
- exports.se_StartConversationCommand = se_StartConversationCommand;
115
- const de_DeleteSessionCommand = async (output, context) => {
116
- if (output.statusCode !== 200 && output.statusCode >= 300) {
117
- return de_DeleteSessionCommandError(output, context);
118
- }
119
- const contents = (0, smithy_client_1.map)({
120
- $metadata: deserializeMetadata(output),
121
- });
122
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
123
- const doc = (0, smithy_client_1.take)(data, {
124
- botAliasId: smithy_client_1.expectString,
125
- botId: smithy_client_1.expectString,
126
- localeId: smithy_client_1.expectString,
127
- sessionId: smithy_client_1.expectString,
128
- });
129
- Object.assign(contents, doc);
130
- return contents;
131
- };
132
- exports.de_DeleteSessionCommand = de_DeleteSessionCommand;
133
- const de_DeleteSessionCommandError = async (output, context) => {
134
- const parsedOutput = {
135
- ...output,
136
- body: await parseErrorBody(output.body, context),
137
- };
138
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
139
- switch (errorCode) {
140
- case "AccessDeniedException":
141
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
142
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
143
- case "ConflictException":
144
- case "com.amazonaws.lexruntimev2#ConflictException":
145
- throw await de_ConflictExceptionRes(parsedOutput, context);
146
- case "InternalServerException":
147
- case "com.amazonaws.lexruntimev2#InternalServerException":
148
- throw await de_InternalServerExceptionRes(parsedOutput, context);
149
- case "ResourceNotFoundException":
150
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
151
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
152
- case "ThrottlingException":
153
- case "com.amazonaws.lexruntimev2#ThrottlingException":
154
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
155
- case "ValidationException":
156
- case "com.amazonaws.lexruntimev2#ValidationException":
157
- throw await de_ValidationExceptionRes(parsedOutput, context);
158
- default:
159
- const parsedBody = parsedOutput.body;
160
- return throwDefaultError({
161
- output,
162
- parsedBody,
163
- errorCode,
164
- });
165
- }
166
- };
167
- const de_GetSessionCommand = async (output, context) => {
168
- if (output.statusCode !== 200 && output.statusCode >= 300) {
169
- return de_GetSessionCommandError(output, context);
170
- }
171
- const contents = (0, smithy_client_1.map)({
172
- $metadata: deserializeMetadata(output),
173
- });
174
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
175
- const doc = (0, smithy_client_1.take)(data, {
176
- interpretations: (_) => de_Interpretations(_, context),
177
- messages: smithy_client_1._json,
178
- sessionId: smithy_client_1.expectString,
179
- sessionState: (_) => de_SessionState(_, context),
180
- });
181
- Object.assign(contents, doc);
182
- return contents;
183
- };
184
- exports.de_GetSessionCommand = de_GetSessionCommand;
185
- const de_GetSessionCommandError = async (output, context) => {
186
- const parsedOutput = {
187
- ...output,
188
- body: await parseErrorBody(output.body, context),
189
- };
190
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
191
- switch (errorCode) {
192
- case "AccessDeniedException":
193
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
194
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
195
- case "InternalServerException":
196
- case "com.amazonaws.lexruntimev2#InternalServerException":
197
- throw await de_InternalServerExceptionRes(parsedOutput, context);
198
- case "ResourceNotFoundException":
199
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
200
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
201
- case "ThrottlingException":
202
- case "com.amazonaws.lexruntimev2#ThrottlingException":
203
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
204
- case "ValidationException":
205
- case "com.amazonaws.lexruntimev2#ValidationException":
206
- throw await de_ValidationExceptionRes(parsedOutput, context);
207
- default:
208
- const parsedBody = parsedOutput.body;
209
- return throwDefaultError({
210
- output,
211
- parsedBody,
212
- errorCode,
213
- });
214
- }
215
- };
216
- const de_PutSessionCommand = async (output, context) => {
217
- if (output.statusCode !== 200 && output.statusCode >= 300) {
218
- return de_PutSessionCommandError(output, context);
219
- }
220
- const contents = (0, smithy_client_1.map)({
221
- $metadata: deserializeMetadata(output),
222
- [_cT]: [, output.headers[_ct]],
223
- [_m]: [, output.headers[_xalm]],
224
- [_sS]: [, output.headers[_xalss]],
225
- [_rA]: [, output.headers[_xalra]],
226
- [_sI]: [, output.headers[_xalsi]],
227
- });
228
- const data = output.body;
229
- context.sdkStreamMixin(data);
230
- contents.audioStream = data;
231
- return contents;
232
- };
233
- exports.de_PutSessionCommand = de_PutSessionCommand;
234
- const de_PutSessionCommandError = async (output, context) => {
235
- const parsedOutput = {
236
- ...output,
237
- body: await parseErrorBody(output.body, context),
238
- };
239
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
240
- switch (errorCode) {
241
- case "AccessDeniedException":
242
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
243
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
244
- case "BadGatewayException":
245
- case "com.amazonaws.lexruntimev2#BadGatewayException":
246
- throw await de_BadGatewayExceptionRes(parsedOutput, context);
247
- case "ConflictException":
248
- case "com.amazonaws.lexruntimev2#ConflictException":
249
- throw await de_ConflictExceptionRes(parsedOutput, context);
250
- case "DependencyFailedException":
251
- case "com.amazonaws.lexruntimev2#DependencyFailedException":
252
- throw await de_DependencyFailedExceptionRes(parsedOutput, context);
253
- case "InternalServerException":
254
- case "com.amazonaws.lexruntimev2#InternalServerException":
255
- throw await de_InternalServerExceptionRes(parsedOutput, context);
256
- case "ResourceNotFoundException":
257
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
258
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
259
- case "ThrottlingException":
260
- case "com.amazonaws.lexruntimev2#ThrottlingException":
261
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
262
- case "ValidationException":
263
- case "com.amazonaws.lexruntimev2#ValidationException":
264
- throw await de_ValidationExceptionRes(parsedOutput, context);
265
- default:
266
- const parsedBody = parsedOutput.body;
267
- return throwDefaultError({
268
- output,
269
- parsedBody,
270
- errorCode,
271
- });
272
- }
273
- };
274
- const de_RecognizeTextCommand = async (output, context) => {
275
- if (output.statusCode !== 200 && output.statusCode >= 300) {
276
- return de_RecognizeTextCommandError(output, context);
277
- }
278
- const contents = (0, smithy_client_1.map)({
279
- $metadata: deserializeMetadata(output),
280
- });
281
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
282
- const doc = (0, smithy_client_1.take)(data, {
283
- interpretations: (_) => de_Interpretations(_, context),
284
- messages: smithy_client_1._json,
285
- recognizedBotMember: smithy_client_1._json,
286
- requestAttributes: smithy_client_1._json,
287
- sessionId: smithy_client_1.expectString,
288
- sessionState: (_) => de_SessionState(_, context),
289
- });
290
- Object.assign(contents, doc);
291
- return contents;
292
- };
293
- exports.de_RecognizeTextCommand = de_RecognizeTextCommand;
294
- const de_RecognizeTextCommandError = async (output, context) => {
295
- const parsedOutput = {
296
- ...output,
297
- body: await parseErrorBody(output.body, context),
298
- };
299
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
300
- switch (errorCode) {
301
- case "AccessDeniedException":
302
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
303
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
304
- case "BadGatewayException":
305
- case "com.amazonaws.lexruntimev2#BadGatewayException":
306
- throw await de_BadGatewayExceptionRes(parsedOutput, context);
307
- case "ConflictException":
308
- case "com.amazonaws.lexruntimev2#ConflictException":
309
- throw await de_ConflictExceptionRes(parsedOutput, context);
310
- case "DependencyFailedException":
311
- case "com.amazonaws.lexruntimev2#DependencyFailedException":
312
- throw await de_DependencyFailedExceptionRes(parsedOutput, context);
313
- case "InternalServerException":
314
- case "com.amazonaws.lexruntimev2#InternalServerException":
315
- throw await de_InternalServerExceptionRes(parsedOutput, context);
316
- case "ResourceNotFoundException":
317
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
318
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
319
- case "ThrottlingException":
320
- case "com.amazonaws.lexruntimev2#ThrottlingException":
321
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
322
- case "ValidationException":
323
- case "com.amazonaws.lexruntimev2#ValidationException":
324
- throw await de_ValidationExceptionRes(parsedOutput, context);
325
- default:
326
- const parsedBody = parsedOutput.body;
327
- return throwDefaultError({
328
- output,
329
- parsedBody,
330
- errorCode,
331
- });
332
- }
333
- };
334
- const de_RecognizeUtteranceCommand = async (output, context) => {
335
- if (output.statusCode !== 200 && output.statusCode >= 300) {
336
- return de_RecognizeUtteranceCommandError(output, context);
337
- }
338
- const contents = (0, smithy_client_1.map)({
339
- $metadata: deserializeMetadata(output),
340
- [_iM]: [, output.headers[_xalim]],
341
- [_cT]: [, output.headers[_ct]],
342
- [_m]: [, output.headers[_xalm]],
343
- [_i]: [, output.headers[_xali]],
344
- [_sS]: [, output.headers[_xalss]],
345
- [_rA]: [, output.headers[_xalra]],
346
- [_sI]: [, output.headers[_xalsi]],
347
- [_iT]: [, output.headers[_xalit]],
348
- [_rBM]: [, output.headers[_xalrbm]],
349
- });
350
- const data = output.body;
351
- context.sdkStreamMixin(data);
352
- contents.audioStream = data;
353
- return contents;
354
- };
355
- exports.de_RecognizeUtteranceCommand = de_RecognizeUtteranceCommand;
356
- const de_RecognizeUtteranceCommandError = async (output, context) => {
357
- const parsedOutput = {
358
- ...output,
359
- body: await parseErrorBody(output.body, context),
360
- };
361
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
362
- switch (errorCode) {
363
- case "AccessDeniedException":
364
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
365
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
366
- case "BadGatewayException":
367
- case "com.amazonaws.lexruntimev2#BadGatewayException":
368
- throw await de_BadGatewayExceptionRes(parsedOutput, context);
369
- case "ConflictException":
370
- case "com.amazonaws.lexruntimev2#ConflictException":
371
- throw await de_ConflictExceptionRes(parsedOutput, context);
372
- case "DependencyFailedException":
373
- case "com.amazonaws.lexruntimev2#DependencyFailedException":
374
- throw await de_DependencyFailedExceptionRes(parsedOutput, context);
375
- case "InternalServerException":
376
- case "com.amazonaws.lexruntimev2#InternalServerException":
377
- throw await de_InternalServerExceptionRes(parsedOutput, context);
378
- case "ResourceNotFoundException":
379
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
380
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
381
- case "ThrottlingException":
382
- case "com.amazonaws.lexruntimev2#ThrottlingException":
383
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
384
- case "ValidationException":
385
- case "com.amazonaws.lexruntimev2#ValidationException":
386
- throw await de_ValidationExceptionRes(parsedOutput, context);
387
- default:
388
- const parsedBody = parsedOutput.body;
389
- return throwDefaultError({
390
- output,
391
- parsedBody,
392
- errorCode,
393
- });
394
- }
395
- };
396
- const de_StartConversationCommand = async (output, context) => {
397
- if (output.statusCode !== 200 && output.statusCode >= 300) {
398
- return de_StartConversationCommandError(output, context);
399
- }
400
- const contents = (0, smithy_client_1.map)({
401
- $metadata: deserializeMetadata(output),
402
- });
403
- const data = output.body;
404
- contents.responseEventStream = de_StartConversationResponseEventStream(data, context);
405
- return contents;
406
- };
407
- exports.de_StartConversationCommand = de_StartConversationCommand;
408
- const de_StartConversationCommandError = async (output, context) => {
409
- const parsedOutput = {
410
- ...output,
411
- body: await parseErrorBody(output.body, context),
412
- };
413
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
414
- switch (errorCode) {
415
- case "AccessDeniedException":
416
- case "com.amazonaws.lexruntimev2#AccessDeniedException":
417
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
418
- case "InternalServerException":
419
- case "com.amazonaws.lexruntimev2#InternalServerException":
420
- throw await de_InternalServerExceptionRes(parsedOutput, context);
421
- case "ThrottlingException":
422
- case "com.amazonaws.lexruntimev2#ThrottlingException":
423
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
424
- case "ValidationException":
425
- case "com.amazonaws.lexruntimev2#ValidationException":
426
- throw await de_ValidationExceptionRes(parsedOutput, context);
427
- default:
428
- const parsedBody = parsedOutput.body;
429
- return throwDefaultError({
430
- output,
431
- parsedBody,
432
- errorCode,
433
- });
434
- }
435
- };
436
- const throwDefaultError = (0, smithy_client_1.withBaseException)(LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException);
437
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
438
- const contents = (0, smithy_client_1.map)({});
439
- const data = parsedOutput.body;
440
- const doc = (0, smithy_client_1.take)(data, {
441
- message: smithy_client_1.expectString,
442
- });
443
- Object.assign(contents, doc);
444
- const exception = new models_0_1.AccessDeniedException({
445
- $metadata: deserializeMetadata(parsedOutput),
446
- ...contents,
447
- });
448
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
449
- };
450
- const de_BadGatewayExceptionRes = async (parsedOutput, context) => {
451
- const contents = (0, smithy_client_1.map)({});
452
- const data = parsedOutput.body;
453
- const doc = (0, smithy_client_1.take)(data, {
454
- message: smithy_client_1.expectString,
455
- });
456
- Object.assign(contents, doc);
457
- const exception = new models_0_1.BadGatewayException({
458
- $metadata: deserializeMetadata(parsedOutput),
459
- ...contents,
460
- });
461
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
462
- };
463
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
464
- const contents = (0, smithy_client_1.map)({});
465
- const data = parsedOutput.body;
466
- const doc = (0, smithy_client_1.take)(data, {
467
- message: smithy_client_1.expectString,
468
- });
469
- Object.assign(contents, doc);
470
- const exception = new models_0_1.ConflictException({
471
- $metadata: deserializeMetadata(parsedOutput),
472
- ...contents,
473
- });
474
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
475
- };
476
- const de_DependencyFailedExceptionRes = async (parsedOutput, context) => {
477
- const contents = (0, smithy_client_1.map)({});
478
- const data = parsedOutput.body;
479
- const doc = (0, smithy_client_1.take)(data, {
480
- message: smithy_client_1.expectString,
481
- });
482
- Object.assign(contents, doc);
483
- const exception = new models_0_1.DependencyFailedException({
484
- $metadata: deserializeMetadata(parsedOutput),
485
- ...contents,
486
- });
487
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
488
- };
489
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
490
- const contents = (0, smithy_client_1.map)({});
491
- const data = parsedOutput.body;
492
- const doc = (0, smithy_client_1.take)(data, {
493
- message: smithy_client_1.expectString,
494
- });
495
- Object.assign(contents, doc);
496
- const exception = new models_0_1.InternalServerException({
497
- $metadata: deserializeMetadata(parsedOutput),
498
- ...contents,
499
- });
500
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
501
- };
502
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
503
- const contents = (0, smithy_client_1.map)({});
504
- const data = parsedOutput.body;
505
- const doc = (0, smithy_client_1.take)(data, {
506
- message: smithy_client_1.expectString,
507
- });
508
- Object.assign(contents, doc);
509
- const exception = new models_0_1.ResourceNotFoundException({
510
- $metadata: deserializeMetadata(parsedOutput),
511
- ...contents,
512
- });
513
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
514
- };
515
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
516
- const contents = (0, smithy_client_1.map)({});
517
- const data = parsedOutput.body;
518
- const doc = (0, smithy_client_1.take)(data, {
519
- message: smithy_client_1.expectString,
520
- });
521
- Object.assign(contents, doc);
522
- const exception = new models_0_1.ThrottlingException({
523
- $metadata: deserializeMetadata(parsedOutput),
524
- ...contents,
525
- });
526
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
527
- };
528
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
529
- const contents = (0, smithy_client_1.map)({});
530
- const data = parsedOutput.body;
531
- const doc = (0, smithy_client_1.take)(data, {
532
- message: smithy_client_1.expectString,
533
- });
534
- Object.assign(contents, doc);
535
- const exception = new models_0_1.ValidationException({
536
- $metadata: deserializeMetadata(parsedOutput),
537
- ...contents,
538
- });
539
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
540
- };
541
- const se_StartConversationRequestEventStream = (input, context) => {
542
- const eventMarshallingVisitor = (event) => models_0_1.StartConversationRequestEventStream.visit(event, {
543
- ConfigurationEvent: (value) => se_ConfigurationEvent_event(value, context),
544
- AudioInputEvent: (value) => se_AudioInputEvent_event(value, context),
545
- DTMFInputEvent: (value) => se_DTMFInputEvent_event(value, context),
546
- TextInputEvent: (value) => se_TextInputEvent_event(value, context),
547
- PlaybackCompletionEvent: (value) => se_PlaybackCompletionEvent_event(value, context),
548
- DisconnectionEvent: (value) => se_DisconnectionEvent_event(value, context),
549
- _: (value) => value,
550
- });
551
- return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
552
- };
553
- const se_AudioInputEvent_event = (input, context) => {
554
- const headers = {
555
- ":event-type": { type: "string", value: "AudioInputEvent" },
556
- ":message-type": { type: "string", value: "event" },
557
- ":content-type": { type: "string", value: "application/json" },
558
- };
559
- let body = new Uint8Array();
560
- body = se_AudioInputEvent(input, context);
561
- body = context.utf8Decoder(JSON.stringify(body));
562
- return { headers, body };
563
- };
564
- const se_ConfigurationEvent_event = (input, context) => {
565
- const headers = {
566
- ":event-type": { type: "string", value: "ConfigurationEvent" },
567
- ":message-type": { type: "string", value: "event" },
568
- ":content-type": { type: "string", value: "application/json" },
569
- };
570
- let body = new Uint8Array();
571
- body = se_ConfigurationEvent(input, context);
572
- body = context.utf8Decoder(JSON.stringify(body));
573
- return { headers, body };
574
- };
575
- const se_DisconnectionEvent_event = (input, context) => {
576
- const headers = {
577
- ":event-type": { type: "string", value: "DisconnectionEvent" },
578
- ":message-type": { type: "string", value: "event" },
579
- ":content-type": { type: "string", value: "application/json" },
580
- };
581
- let body = new Uint8Array();
582
- body = (0, smithy_client_1._json)(input);
583
- body = context.utf8Decoder(JSON.stringify(body));
584
- return { headers, body };
585
- };
586
- const se_DTMFInputEvent_event = (input, context) => {
587
- const headers = {
588
- ":event-type": { type: "string", value: "DTMFInputEvent" },
589
- ":message-type": { type: "string", value: "event" },
590
- ":content-type": { type: "string", value: "application/json" },
591
- };
592
- let body = new Uint8Array();
593
- body = (0, smithy_client_1._json)(input);
594
- body = context.utf8Decoder(JSON.stringify(body));
595
- return { headers, body };
596
- };
597
- const se_PlaybackCompletionEvent_event = (input, context) => {
598
- const headers = {
599
- ":event-type": { type: "string", value: "PlaybackCompletionEvent" },
600
- ":message-type": { type: "string", value: "event" },
601
- ":content-type": { type: "string", value: "application/json" },
602
- };
603
- let body = new Uint8Array();
604
- body = (0, smithy_client_1._json)(input);
605
- body = context.utf8Decoder(JSON.stringify(body));
606
- return { headers, body };
607
- };
608
- const se_TextInputEvent_event = (input, context) => {
609
- const headers = {
610
- ":event-type": { type: "string", value: "TextInputEvent" },
611
- ":message-type": { type: "string", value: "event" },
612
- ":content-type": { type: "string", value: "application/json" },
613
- };
614
- let body = new Uint8Array();
615
- body = (0, smithy_client_1._json)(input);
616
- body = context.utf8Decoder(JSON.stringify(body));
617
- return { headers, body };
618
- };
619
- const de_StartConversationResponseEventStream = (output, context) => {
620
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
621
- if (event["PlaybackInterruptionEvent"] != null) {
622
- return {
623
- PlaybackInterruptionEvent: await de_PlaybackInterruptionEvent_event(event["PlaybackInterruptionEvent"], context),
624
- };
625
- }
626
- if (event["TranscriptEvent"] != null) {
627
- return {
628
- TranscriptEvent: await de_TranscriptEvent_event(event["TranscriptEvent"], context),
629
- };
630
- }
631
- if (event["IntentResultEvent"] != null) {
632
- return {
633
- IntentResultEvent: await de_IntentResultEvent_event(event["IntentResultEvent"], context),
634
- };
635
- }
636
- if (event["TextResponseEvent"] != null) {
637
- return {
638
- TextResponseEvent: await de_TextResponseEvent_event(event["TextResponseEvent"], context),
639
- };
640
- }
641
- if (event["AudioResponseEvent"] != null) {
642
- return {
643
- AudioResponseEvent: await de_AudioResponseEvent_event(event["AudioResponseEvent"], context),
644
- };
645
- }
646
- if (event["HeartbeatEvent"] != null) {
647
- return {
648
- HeartbeatEvent: await de_HeartbeatEvent_event(event["HeartbeatEvent"], context),
649
- };
650
- }
651
- if (event["AccessDeniedException"] != null) {
652
- return {
653
- AccessDeniedException: await de_AccessDeniedException_event(event["AccessDeniedException"], context),
654
- };
655
- }
656
- if (event["ResourceNotFoundException"] != null) {
657
- return {
658
- ResourceNotFoundException: await de_ResourceNotFoundException_event(event["ResourceNotFoundException"], context),
659
- };
660
- }
661
- if (event["ValidationException"] != null) {
662
- return {
663
- ValidationException: await de_ValidationException_event(event["ValidationException"], context),
664
- };
665
- }
666
- if (event["ThrottlingException"] != null) {
667
- return {
668
- ThrottlingException: await de_ThrottlingException_event(event["ThrottlingException"], context),
669
- };
670
- }
671
- if (event["InternalServerException"] != null) {
672
- return {
673
- InternalServerException: await de_InternalServerException_event(event["InternalServerException"], context),
674
- };
675
- }
676
- if (event["ConflictException"] != null) {
677
- return {
678
- ConflictException: await de_ConflictException_event(event["ConflictException"], context),
679
- };
680
- }
681
- if (event["DependencyFailedException"] != null) {
682
- return {
683
- DependencyFailedException: await de_DependencyFailedException_event(event["DependencyFailedException"], context),
684
- };
685
- }
686
- if (event["BadGatewayException"] != null) {
687
- return {
688
- BadGatewayException: await de_BadGatewayException_event(event["BadGatewayException"], context),
689
- };
690
- }
691
- return { $unknown: output };
692
- });
693
- };
694
- const de_AccessDeniedException_event = async (output, context) => {
695
- const parsedOutput = {
696
- ...output,
697
- body: await parseBody(output.body, context),
698
- };
699
- return de_AccessDeniedExceptionRes(parsedOutput, context);
700
- };
701
- const de_AudioResponseEvent_event = async (output, context) => {
702
- const contents = {};
703
- const data = await parseBody(output.body, context);
704
- Object.assign(contents, de_AudioResponseEvent(data, context));
705
- return contents;
706
- };
707
- const de_BadGatewayException_event = async (output, context) => {
708
- const parsedOutput = {
709
- ...output,
710
- body: await parseBody(output.body, context),
711
- };
712
- return de_BadGatewayExceptionRes(parsedOutput, context);
713
- };
714
- const de_ConflictException_event = async (output, context) => {
715
- const parsedOutput = {
716
- ...output,
717
- body: await parseBody(output.body, context),
718
- };
719
- return de_ConflictExceptionRes(parsedOutput, context);
720
- };
721
- const de_DependencyFailedException_event = async (output, context) => {
722
- const parsedOutput = {
723
- ...output,
724
- body: await parseBody(output.body, context),
725
- };
726
- return de_DependencyFailedExceptionRes(parsedOutput, context);
727
- };
728
- const de_HeartbeatEvent_event = async (output, context) => {
729
- const contents = {};
730
- const data = await parseBody(output.body, context);
731
- Object.assign(contents, (0, smithy_client_1._json)(data));
732
- return contents;
733
- };
734
- const de_IntentResultEvent_event = async (output, context) => {
735
- const contents = {};
736
- const data = await parseBody(output.body, context);
737
- Object.assign(contents, de_IntentResultEvent(data, context));
738
- return contents;
739
- };
740
- const de_InternalServerException_event = async (output, context) => {
741
- const parsedOutput = {
742
- ...output,
743
- body: await parseBody(output.body, context),
744
- };
745
- return de_InternalServerExceptionRes(parsedOutput, context);
746
- };
747
- const de_PlaybackInterruptionEvent_event = async (output, context) => {
748
- const contents = {};
749
- const data = await parseBody(output.body, context);
750
- Object.assign(contents, (0, smithy_client_1._json)(data));
751
- return contents;
752
- };
753
- const de_ResourceNotFoundException_event = async (output, context) => {
754
- const parsedOutput = {
755
- ...output,
756
- body: await parseBody(output.body, context),
757
- };
758
- return de_ResourceNotFoundExceptionRes(parsedOutput, context);
759
- };
760
- const de_TextResponseEvent_event = async (output, context) => {
761
- const contents = {};
762
- const data = await parseBody(output.body, context);
763
- Object.assign(contents, (0, smithy_client_1._json)(data));
764
- return contents;
765
- };
766
- const de_ThrottlingException_event = async (output, context) => {
767
- const parsedOutput = {
768
- ...output,
769
- body: await parseBody(output.body, context),
770
- };
771
- return de_ThrottlingExceptionRes(parsedOutput, context);
772
- };
773
- const de_TranscriptEvent_event = async (output, context) => {
774
- const contents = {};
775
- const data = await parseBody(output.body, context);
776
- Object.assign(contents, (0, smithy_client_1._json)(data));
777
- return contents;
778
- };
779
- const de_ValidationException_event = async (output, context) => {
780
- const parsedOutput = {
781
- ...output,
782
- body: await parseBody(output.body, context),
783
- };
784
- return de_ValidationExceptionRes(parsedOutput, context);
785
- };
786
- const se_AudioInputEvent = (input, context) => {
787
- return (0, smithy_client_1.take)(input, {
788
- audioChunk: context.base64Encoder,
789
- clientTimestampMillis: [],
790
- contentType: [],
791
- eventId: [],
792
- });
793
- };
794
- const se_ConfigurationEvent = (input, context) => {
795
- return (0, smithy_client_1.take)(input, {
796
- clientTimestampMillis: [],
797
- disablePlayback: [],
798
- eventId: [],
799
- requestAttributes: smithy_client_1._json,
800
- responseContentType: [],
801
- sessionState: (_) => se_SessionState(_, context),
802
- welcomeMessages: smithy_client_1._json,
803
- });
804
- };
805
- const se_DialogAction = (input, context) => {
806
- return (0, smithy_client_1.take)(input, {
807
- slotElicitationStyle: [],
808
- slotToElicit: [],
809
- subSlotToElicit: (_) => se_ElicitSubSlot(_, context),
810
- type: [],
811
- });
812
- };
813
- const se_ElicitSubSlot = (input, context) => {
814
- return (0, smithy_client_1.take)(input, {
815
- name: [],
816
- subSlotToElicit: (_) => se_ElicitSubSlot(_, context),
817
- });
818
- };
819
- const se_Intent = (input, context) => {
820
- return (0, smithy_client_1.take)(input, {
821
- confirmationState: [],
822
- name: [],
823
- slots: (_) => se_Slots(_, context),
824
- state: [],
825
- });
826
- };
827
- const se_RuntimeHintDetails = (input, context) => {
828
- return (0, smithy_client_1.take)(input, {
829
- runtimeHintValues: smithy_client_1._json,
830
- subSlotHints: (_) => se_SlotHintsSlotMap(_, context),
831
- });
832
- };
833
- const se_RuntimeHints = (input, context) => {
834
- return (0, smithy_client_1.take)(input, {
835
- slotHints: (_) => se_SlotHintsIntentMap(_, context),
836
- });
837
- };
838
- const se_SessionState = (input, context) => {
839
- return (0, smithy_client_1.take)(input, {
840
- activeContexts: smithy_client_1._json,
841
- dialogAction: (_) => se_DialogAction(_, context),
842
- intent: (_) => se_Intent(_, context),
843
- originatingRequestId: [],
844
- runtimeHints: (_) => se_RuntimeHints(_, context),
845
- sessionAttributes: smithy_client_1._json,
846
- });
847
- };
848
- const se_Slot = (input, context) => {
849
- return (0, smithy_client_1.take)(input, {
850
- shape: [],
851
- subSlots: (_) => se_Slots(_, context),
852
- value: smithy_client_1._json,
853
- values: (_) => se_Values(_, context),
854
- });
855
- };
856
- const se_SlotHintsIntentMap = (input, context) => {
857
- return Object.entries(input).reduce((acc, [key, value]) => {
858
- if (value === null) {
859
- return acc;
860
- }
861
- acc[key] = se_SlotHintsSlotMap(value, context);
862
- return acc;
863
- }, {});
864
- };
865
- const se_SlotHintsSlotMap = (input, context) => {
866
- return Object.entries(input).reduce((acc, [key, value]) => {
867
- if (value === null) {
868
- return acc;
869
- }
870
- acc[key] = se_RuntimeHintDetails(value, context);
871
- return acc;
872
- }, {});
873
- };
874
- const se_Slots = (input, context) => {
875
- return Object.entries(input).reduce((acc, [key, value]) => {
876
- if (value === null) {
877
- return acc;
878
- }
879
- acc[key] = se_Slot(value, context);
880
- return acc;
881
- }, {});
882
- };
883
- const se_Values = (input, context) => {
884
- return input
885
- .filter((e) => e != null)
886
- .map((entry) => {
887
- return se_Slot(entry, context);
888
- });
889
- };
890
- const de_AudioResponseEvent = (output, context) => {
891
- return (0, smithy_client_1.take)(output, {
892
- audioChunk: context.base64Decoder,
893
- contentType: smithy_client_1.expectString,
894
- eventId: smithy_client_1.expectString,
895
- });
896
- };
897
- const de_ConfidenceScore = (output, context) => {
898
- return (0, smithy_client_1.take)(output, {
899
- score: smithy_client_1.limitedParseDouble,
900
- });
901
- };
902
- const de_DialogAction = (output, context) => {
903
- return (0, smithy_client_1.take)(output, {
904
- slotElicitationStyle: smithy_client_1.expectString,
905
- slotToElicit: smithy_client_1.expectString,
906
- subSlotToElicit: (_) => de_ElicitSubSlot(_, context),
907
- type: smithy_client_1.expectString,
908
- });
909
- };
910
- const de_ElicitSubSlot = (output, context) => {
911
- return (0, smithy_client_1.take)(output, {
912
- name: smithy_client_1.expectString,
913
- subSlotToElicit: (_) => de_ElicitSubSlot(_, context),
914
- });
915
- };
916
- const de_Intent = (output, context) => {
917
- return (0, smithy_client_1.take)(output, {
918
- confirmationState: smithy_client_1.expectString,
919
- name: smithy_client_1.expectString,
920
- slots: (_) => de_Slots(_, context),
921
- state: smithy_client_1.expectString,
922
- });
923
- };
924
- const de_IntentResultEvent = (output, context) => {
925
- return (0, smithy_client_1.take)(output, {
926
- eventId: smithy_client_1.expectString,
927
- inputMode: smithy_client_1.expectString,
928
- interpretations: (_) => de_Interpretations(_, context),
929
- recognizedBotMember: smithy_client_1._json,
930
- requestAttributes: smithy_client_1._json,
931
- sessionId: smithy_client_1.expectString,
932
- sessionState: (_) => de_SessionState(_, context),
933
- });
934
- };
935
- const de_Interpretation = (output, context) => {
936
- return (0, smithy_client_1.take)(output, {
937
- intent: (_) => de_Intent(_, context),
938
- interpretationSource: smithy_client_1.expectString,
939
- nluConfidence: (_) => de_ConfidenceScore(_, context),
940
- sentimentResponse: (_) => de_SentimentResponse(_, context),
941
- });
942
- };
943
- const de_Interpretations = (output, context) => {
944
- const retVal = (output || [])
945
- .filter((e) => e != null)
946
- .map((entry) => {
947
- return de_Interpretation(entry, context);
948
- });
949
- return retVal;
950
- };
951
- const de_RuntimeHintDetails = (output, context) => {
952
- return (0, smithy_client_1.take)(output, {
953
- runtimeHintValues: smithy_client_1._json,
954
- subSlotHints: (_) => de_SlotHintsSlotMap(_, context),
955
- });
956
- };
957
- const de_RuntimeHints = (output, context) => {
958
- return (0, smithy_client_1.take)(output, {
959
- slotHints: (_) => de_SlotHintsIntentMap(_, context),
960
- });
961
- };
962
- const de_SentimentResponse = (output, context) => {
963
- return (0, smithy_client_1.take)(output, {
964
- sentiment: smithy_client_1.expectString,
965
- sentimentScore: (_) => de_SentimentScore(_, context),
966
- });
967
- };
968
- const de_SentimentScore = (output, context) => {
969
- return (0, smithy_client_1.take)(output, {
970
- mixed: smithy_client_1.limitedParseDouble,
971
- negative: smithy_client_1.limitedParseDouble,
972
- neutral: smithy_client_1.limitedParseDouble,
973
- positive: smithy_client_1.limitedParseDouble,
974
- });
975
- };
976
- const de_SessionState = (output, context) => {
977
- return (0, smithy_client_1.take)(output, {
978
- activeContexts: smithy_client_1._json,
979
- dialogAction: (_) => de_DialogAction(_, context),
980
- intent: (_) => de_Intent(_, context),
981
- originatingRequestId: smithy_client_1.expectString,
982
- runtimeHints: (_) => de_RuntimeHints(_, context),
983
- sessionAttributes: smithy_client_1._json,
984
- });
985
- };
986
- const de_Slot = (output, context) => {
987
- return (0, smithy_client_1.take)(output, {
988
- shape: smithy_client_1.expectString,
989
- subSlots: (_) => de_Slots(_, context),
990
- value: smithy_client_1._json,
991
- values: (_) => de_Values(_, context),
992
- });
993
- };
994
- const de_SlotHintsIntentMap = (output, context) => {
995
- return Object.entries(output).reduce((acc, [key, value]) => {
996
- if (value === null) {
997
- return acc;
998
- }
999
- acc[key] = de_SlotHintsSlotMap(value, context);
1000
- return acc;
1001
- }, {});
1002
- };
1003
- const de_SlotHintsSlotMap = (output, context) => {
1004
- return Object.entries(output).reduce((acc, [key, value]) => {
1005
- if (value === null) {
1006
- return acc;
1007
- }
1008
- acc[key] = de_RuntimeHintDetails(value, context);
1009
- return acc;
1010
- }, {});
1011
- };
1012
- const de_Slots = (output, context) => {
1013
- return Object.entries(output).reduce((acc, [key, value]) => {
1014
- if (value === null) {
1015
- return acc;
1016
- }
1017
- acc[key] = de_Slot(value, context);
1018
- return acc;
1019
- }, {});
1020
- };
1021
- const de_Values = (output, context) => {
1022
- const retVal = (output || [])
1023
- .filter((e) => e != null)
1024
- .map((entry) => {
1025
- return de_Slot(entry, context);
1026
- });
1027
- return retVal;
1028
- };
1029
- const deserializeMetadata = (output) => ({
1030
- httpStatusCode: output.statusCode,
1031
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
1032
- extendedRequestId: output.headers["x-amz-id-2"],
1033
- cfId: output.headers["x-amz-cf-id"],
1034
- });
1035
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
1036
- const isSerializableHeaderValue = (value) => value !== undefined &&
1037
- value !== null &&
1038
- value !== "" &&
1039
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1040
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1041
- const _cM = "conversationMode";
1042
- const _cT = "contentType";
1043
- const _ct = "content-type";
1044
- const _i = "interpretations";
1045
- const _iM = "inputMode";
1046
- const _iT = "inputTranscript";
1047
- const _m = "messages";
1048
- const _r = "responsecontenttype";
1049
- const _rA = "requestAttributes";
1050
- const _rBM = "recognizedBotMember";
1051
- const _rCT = "responseContentType";
1052
- const _rCTe = "requestContentType";
1053
- const _rct = "response-content-type";
1054
- const _sI = "sessionId";
1055
- const _sS = "sessionState";
1056
- const _xalcm = "x-amz-lex-conversation-mode";
1057
- const _xali = "x-amz-lex-interpretations";
1058
- const _xalim = "x-amz-lex-input-mode";
1059
- const _xalit = "x-amz-lex-input-transcript";
1060
- const _xalm = "x-amz-lex-messages";
1061
- const _xalra = "x-amz-lex-request-attributes";
1062
- const _xalrbm = "x-amz-lex-recognized-bot-member";
1063
- const _xalsi = "x-amz-lex-session-id";
1064
- const _xalss = "x-amz-lex-session-state";
1065
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1066
- if (encoded.length) {
1067
- return JSON.parse(encoded);
1068
- }
1069
- return {};
1070
- });
1071
- const parseErrorBody = async (errorBody, context) => {
1072
- const value = await parseBody(errorBody, context);
1073
- value.message = value.message ?? value.Message;
1074
- return value;
1075
- };
1076
- const loadRestJsonErrorCode = (output, data) => {
1077
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1078
- const sanitizeErrorCode = (rawValue) => {
1079
- let cleanValue = rawValue;
1080
- if (typeof cleanValue === "number") {
1081
- cleanValue = cleanValue.toString();
1082
- }
1083
- if (cleanValue.indexOf(",") >= 0) {
1084
- cleanValue = cleanValue.split(",")[0];
1085
- }
1086
- if (cleanValue.indexOf(":") >= 0) {
1087
- cleanValue = cleanValue.split(":")[0];
1088
- }
1089
- if (cleanValue.indexOf("#") >= 0) {
1090
- cleanValue = cleanValue.split("#")[1];
1091
- }
1092
- return cleanValue;
1093
- };
1094
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1095
- if (headerKey !== undefined) {
1096
- return sanitizeErrorCode(output.headers[headerKey]);
1097
- }
1098
- if (data.code !== undefined) {
1099
- return sanitizeErrorCode(data.code);
1100
- }
1101
- if (data["__type"] !== undefined) {
1102
- return sanitizeErrorCode(data["__type"]);
1103
- }
1104
- };
1
+ module.exports = require("../index.js");