@aws-sdk/client-textract 3.35.0 → 3.36.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist-cjs/Textract.js +0 -1
  3. package/dist-cjs/TextractClient.js +0 -1
  4. package/dist-cjs/commands/AnalyzeDocumentCommand.js +0 -1
  5. package/dist-cjs/commands/AnalyzeExpenseCommand.js +0 -1
  6. package/dist-cjs/commands/DetectDocumentTextCommand.js +0 -1
  7. package/dist-cjs/commands/GetDocumentAnalysisCommand.js +0 -1
  8. package/dist-cjs/commands/GetDocumentTextDetectionCommand.js +0 -1
  9. package/dist-cjs/commands/StartDocumentAnalysisCommand.js +0 -1
  10. package/dist-cjs/commands/StartDocumentTextDetectionCommand.js +0 -1
  11. package/dist-cjs/endpoints.js +0 -1
  12. package/dist-cjs/index.js +0 -1
  13. package/dist-cjs/models/index.js +0 -1
  14. package/dist-cjs/models/models_0.js +0 -1
  15. package/dist-cjs/protocols/Aws_json1_1.js +0 -1
  16. package/dist-cjs/runtimeConfig.browser.js +2 -3
  17. package/dist-cjs/runtimeConfig.js +3 -4
  18. package/dist-cjs/runtimeConfig.native.js +0 -1
  19. package/dist-cjs/runtimeConfig.shared.js +0 -1
  20. package/dist-es/Textract.js +0 -1
  21. package/dist-es/TextractClient.js +0 -1
  22. package/dist-es/commands/AnalyzeDocumentCommand.js +0 -1
  23. package/dist-es/commands/AnalyzeExpenseCommand.js +0 -1
  24. package/dist-es/commands/DetectDocumentTextCommand.js +0 -1
  25. package/dist-es/commands/GetDocumentAnalysisCommand.js +0 -1
  26. package/dist-es/commands/GetDocumentTextDetectionCommand.js +0 -1
  27. package/dist-es/commands/StartDocumentAnalysisCommand.js +0 -1
  28. package/dist-es/commands/StartDocumentTextDetectionCommand.js +0 -1
  29. package/dist-es/endpoints.js +0 -1
  30. package/dist-es/index.js +0 -1
  31. package/dist-es/models/index.js +0 -1
  32. package/dist-es/models/models_0.js +0 -1
  33. package/dist-es/protocols/Aws_json1_1.js +0 -1
  34. package/dist-es/runtimeConfig.browser.js +1 -2
  35. package/dist-es/runtimeConfig.js +2 -3
  36. package/dist-es/runtimeConfig.native.js +0 -1
  37. package/dist-es/runtimeConfig.shared.js +0 -1
  38. package/package.json +33 -30
  39. package/dist-cjs/Textract.js.map +0 -1
  40. package/dist-cjs/TextractClient.js.map +0 -1
  41. package/dist-cjs/commands/AnalyzeDocumentCommand.js.map +0 -1
  42. package/dist-cjs/commands/AnalyzeExpenseCommand.js.map +0 -1
  43. package/dist-cjs/commands/DetectDocumentTextCommand.js.map +0 -1
  44. package/dist-cjs/commands/GetDocumentAnalysisCommand.js.map +0 -1
  45. package/dist-cjs/commands/GetDocumentTextDetectionCommand.js.map +0 -1
  46. package/dist-cjs/commands/StartDocumentAnalysisCommand.js.map +0 -1
  47. package/dist-cjs/commands/StartDocumentTextDetectionCommand.js.map +0 -1
  48. package/dist-cjs/endpoints.js.map +0 -1
  49. package/dist-cjs/index.js.map +0 -1
  50. package/dist-cjs/models/index.js.map +0 -1
  51. package/dist-cjs/models/models_0.js.map +0 -1
  52. package/dist-cjs/protocols/Aws_json1_1.js.map +0 -1
  53. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  54. package/dist-cjs/runtimeConfig.js.map +0 -1
  55. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  56. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  57. package/dist-es/Textract.js.map +0 -1
  58. package/dist-es/TextractClient.js.map +0 -1
  59. package/dist-es/commands/AnalyzeDocumentCommand.js.map +0 -1
  60. package/dist-es/commands/AnalyzeExpenseCommand.js.map +0 -1
  61. package/dist-es/commands/DetectDocumentTextCommand.js.map +0 -1
  62. package/dist-es/commands/GetDocumentAnalysisCommand.js.map +0 -1
  63. package/dist-es/commands/GetDocumentTextDetectionCommand.js.map +0 -1
  64. package/dist-es/commands/StartDocumentAnalysisCommand.js.map +0 -1
  65. package/dist-es/commands/StartDocumentTextDetectionCommand.js.map +0 -1
  66. package/dist-es/endpoints.js.map +0 -1
  67. package/dist-es/index.js.map +0 -1
  68. package/dist-es/models/index.js.map +0 -1
  69. package/dist-es/models/models_0.js.map +0 -1
  70. package/dist-es/protocols/Aws_json1_1.js.map +0 -1
  71. package/dist-es/runtimeConfig.browser.js.map +0 -1
  72. package/dist-es/runtimeConfig.js.map +0 -1
  73. package/dist-es/runtimeConfig.native.js.map +0 -1
  74. package/dist-es/runtimeConfig.shared.js.map +0 -1
  75. package/jest.config.js +0 -4
  76. package/src/Textract.ts +0 -423
  77. package/src/TextractClient.ts +0 -271
  78. package/src/commands/AnalyzeDocumentCommand.ts +0 -125
  79. package/src/commands/AnalyzeExpenseCommand.ts +0 -108
  80. package/src/commands/DetectDocumentTextCommand.ts +0 -105
  81. package/src/commands/GetDocumentAnalysisCommand.ts +0 -139
  82. package/src/commands/GetDocumentTextDetectionCommand.ts +0 -119
  83. package/src/commands/StartDocumentAnalysisCommand.ts +0 -112
  84. package/src/commands/StartDocumentTextDetectionCommand.ts +0 -114
  85. package/src/endpoints.ts +0 -57
  86. package/src/index.ts +0 -10
  87. package/src/models/index.ts +0 -1
  88. package/src/models/models_0.ts +0 -1627
  89. package/src/protocols/Aws_json1_1.ts +0 -2061
  90. package/src/runtimeConfig.browser.ts +0 -41
  91. package/src/runtimeConfig.native.ts +0 -17
  92. package/src/runtimeConfig.shared.ts +0 -17
  93. package/src/runtimeConfig.ts +0 -46
  94. package/tsconfig.es.json +0 -10
  95. package/tsconfig.json +0 -33
  96. package/tsconfig.types.json +0 -9
@@ -1,2061 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectInt32 as __expectInt32,
4
- expectString as __expectString,
5
- LazyJsonString as __LazyJsonString,
6
- limitedParseFloat32 as __limitedParseFloat32,
7
- } from "@aws-sdk/smithy-client";
8
- import {
9
- Endpoint as __Endpoint,
10
- HeaderBag as __HeaderBag,
11
- MetadataBearer as __MetadataBearer,
12
- ResponseMetadata as __ResponseMetadata,
13
- SerdeContext as __SerdeContext,
14
- SmithyException as __SmithyException,
15
- } from "@aws-sdk/types";
16
-
17
- import { AnalyzeDocumentCommandInput, AnalyzeDocumentCommandOutput } from "../commands/AnalyzeDocumentCommand";
18
- import { AnalyzeExpenseCommandInput, AnalyzeExpenseCommandOutput } from "../commands/AnalyzeExpenseCommand";
19
- import { DetectDocumentTextCommandInput, DetectDocumentTextCommandOutput } from "../commands/DetectDocumentTextCommand";
20
- import {
21
- GetDocumentAnalysisCommandInput,
22
- GetDocumentAnalysisCommandOutput,
23
- } from "../commands/GetDocumentAnalysisCommand";
24
- import {
25
- GetDocumentTextDetectionCommandInput,
26
- GetDocumentTextDetectionCommandOutput,
27
- } from "../commands/GetDocumentTextDetectionCommand";
28
- import {
29
- StartDocumentAnalysisCommandInput,
30
- StartDocumentAnalysisCommandOutput,
31
- } from "../commands/StartDocumentAnalysisCommand";
32
- import {
33
- StartDocumentTextDetectionCommandInput,
34
- StartDocumentTextDetectionCommandOutput,
35
- } from "../commands/StartDocumentTextDetectionCommand";
36
- import {
37
- AccessDeniedException,
38
- AnalyzeDocumentRequest,
39
- AnalyzeDocumentResponse,
40
- AnalyzeExpenseRequest,
41
- AnalyzeExpenseResponse,
42
- BadDocumentException,
43
- Block,
44
- BoundingBox,
45
- ContentClassifier,
46
- DetectDocumentTextRequest,
47
- DetectDocumentTextResponse,
48
- Document,
49
- DocumentLocation,
50
- DocumentMetadata,
51
- DocumentTooLargeException,
52
- EntityType,
53
- ExpenseDetection,
54
- ExpenseDocument,
55
- ExpenseField,
56
- ExpenseType,
57
- FeatureType,
58
- Geometry,
59
- GetDocumentAnalysisRequest,
60
- GetDocumentAnalysisResponse,
61
- GetDocumentTextDetectionRequest,
62
- GetDocumentTextDetectionResponse,
63
- HumanLoopActivationOutput,
64
- HumanLoopConfig,
65
- HumanLoopDataAttributes,
66
- HumanLoopQuotaExceededException,
67
- IdempotentParameterMismatchException,
68
- InternalServerError,
69
- InvalidJobIdException,
70
- InvalidKMSKeyException,
71
- InvalidParameterException,
72
- InvalidS3ObjectException,
73
- LimitExceededException,
74
- LineItemFields,
75
- LineItemGroup,
76
- NotificationChannel,
77
- OutputConfig,
78
- Point,
79
- ProvisionedThroughputExceededException,
80
- Relationship,
81
- S3Object,
82
- StartDocumentAnalysisRequest,
83
- StartDocumentAnalysisResponse,
84
- StartDocumentTextDetectionRequest,
85
- StartDocumentTextDetectionResponse,
86
- ThrottlingException,
87
- UnsupportedDocumentException,
88
- Warning,
89
- } from "../models/models_0";
90
-
91
- export const serializeAws_json1_1AnalyzeDocumentCommand = async (
92
- input: AnalyzeDocumentCommandInput,
93
- context: __SerdeContext
94
- ): Promise<__HttpRequest> => {
95
- const headers: __HeaderBag = {
96
- "content-type": "application/x-amz-json-1.1",
97
- "x-amz-target": "Textract.AnalyzeDocument",
98
- };
99
- let body: any;
100
- body = JSON.stringify(serializeAws_json1_1AnalyzeDocumentRequest(input, context));
101
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
102
- };
103
-
104
- export const serializeAws_json1_1AnalyzeExpenseCommand = async (
105
- input: AnalyzeExpenseCommandInput,
106
- context: __SerdeContext
107
- ): Promise<__HttpRequest> => {
108
- const headers: __HeaderBag = {
109
- "content-type": "application/x-amz-json-1.1",
110
- "x-amz-target": "Textract.AnalyzeExpense",
111
- };
112
- let body: any;
113
- body = JSON.stringify(serializeAws_json1_1AnalyzeExpenseRequest(input, context));
114
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
115
- };
116
-
117
- export const serializeAws_json1_1DetectDocumentTextCommand = async (
118
- input: DetectDocumentTextCommandInput,
119
- context: __SerdeContext
120
- ): Promise<__HttpRequest> => {
121
- const headers: __HeaderBag = {
122
- "content-type": "application/x-amz-json-1.1",
123
- "x-amz-target": "Textract.DetectDocumentText",
124
- };
125
- let body: any;
126
- body = JSON.stringify(serializeAws_json1_1DetectDocumentTextRequest(input, context));
127
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
128
- };
129
-
130
- export const serializeAws_json1_1GetDocumentAnalysisCommand = async (
131
- input: GetDocumentAnalysisCommandInput,
132
- context: __SerdeContext
133
- ): Promise<__HttpRequest> => {
134
- const headers: __HeaderBag = {
135
- "content-type": "application/x-amz-json-1.1",
136
- "x-amz-target": "Textract.GetDocumentAnalysis",
137
- };
138
- let body: any;
139
- body = JSON.stringify(serializeAws_json1_1GetDocumentAnalysisRequest(input, context));
140
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
141
- };
142
-
143
- export const serializeAws_json1_1GetDocumentTextDetectionCommand = async (
144
- input: GetDocumentTextDetectionCommandInput,
145
- context: __SerdeContext
146
- ): Promise<__HttpRequest> => {
147
- const headers: __HeaderBag = {
148
- "content-type": "application/x-amz-json-1.1",
149
- "x-amz-target": "Textract.GetDocumentTextDetection",
150
- };
151
- let body: any;
152
- body = JSON.stringify(serializeAws_json1_1GetDocumentTextDetectionRequest(input, context));
153
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
154
- };
155
-
156
- export const serializeAws_json1_1StartDocumentAnalysisCommand = async (
157
- input: StartDocumentAnalysisCommandInput,
158
- context: __SerdeContext
159
- ): Promise<__HttpRequest> => {
160
- const headers: __HeaderBag = {
161
- "content-type": "application/x-amz-json-1.1",
162
- "x-amz-target": "Textract.StartDocumentAnalysis",
163
- };
164
- let body: any;
165
- body = JSON.stringify(serializeAws_json1_1StartDocumentAnalysisRequest(input, context));
166
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
167
- };
168
-
169
- export const serializeAws_json1_1StartDocumentTextDetectionCommand = async (
170
- input: StartDocumentTextDetectionCommandInput,
171
- context: __SerdeContext
172
- ): Promise<__HttpRequest> => {
173
- const headers: __HeaderBag = {
174
- "content-type": "application/x-amz-json-1.1",
175
- "x-amz-target": "Textract.StartDocumentTextDetection",
176
- };
177
- let body: any;
178
- body = JSON.stringify(serializeAws_json1_1StartDocumentTextDetectionRequest(input, context));
179
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
180
- };
181
-
182
- export const deserializeAws_json1_1AnalyzeDocumentCommand = async (
183
- output: __HttpResponse,
184
- context: __SerdeContext
185
- ): Promise<AnalyzeDocumentCommandOutput> => {
186
- if (output.statusCode >= 300) {
187
- return deserializeAws_json1_1AnalyzeDocumentCommandError(output, context);
188
- }
189
- const data: any = await parseBody(output.body, context);
190
- let contents: any = {};
191
- contents = deserializeAws_json1_1AnalyzeDocumentResponse(data, context);
192
- const response: AnalyzeDocumentCommandOutput = {
193
- $metadata: deserializeMetadata(output),
194
- ...contents,
195
- };
196
- return Promise.resolve(response);
197
- };
198
-
199
- const deserializeAws_json1_1AnalyzeDocumentCommandError = async (
200
- output: __HttpResponse,
201
- context: __SerdeContext
202
- ): Promise<AnalyzeDocumentCommandOutput> => {
203
- const parsedOutput: any = {
204
- ...output,
205
- body: await parseBody(output.body, context),
206
- };
207
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
208
- let errorCode = "UnknownError";
209
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
210
- switch (errorCode) {
211
- case "AccessDeniedException":
212
- case "com.amazonaws.textract#AccessDeniedException":
213
- response = {
214
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
215
- name: errorCode,
216
- $metadata: deserializeMetadata(output),
217
- };
218
- break;
219
- case "BadDocumentException":
220
- case "com.amazonaws.textract#BadDocumentException":
221
- response = {
222
- ...(await deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)),
223
- name: errorCode,
224
- $metadata: deserializeMetadata(output),
225
- };
226
- break;
227
- case "DocumentTooLargeException":
228
- case "com.amazonaws.textract#DocumentTooLargeException":
229
- response = {
230
- ...(await deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)),
231
- name: errorCode,
232
- $metadata: deserializeMetadata(output),
233
- };
234
- break;
235
- case "HumanLoopQuotaExceededException":
236
- case "com.amazonaws.textract#HumanLoopQuotaExceededException":
237
- response = {
238
- ...(await deserializeAws_json1_1HumanLoopQuotaExceededExceptionResponse(parsedOutput, context)),
239
- name: errorCode,
240
- $metadata: deserializeMetadata(output),
241
- };
242
- break;
243
- case "InternalServerError":
244
- case "com.amazonaws.textract#InternalServerError":
245
- response = {
246
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
247
- name: errorCode,
248
- $metadata: deserializeMetadata(output),
249
- };
250
- break;
251
- case "InvalidParameterException":
252
- case "com.amazonaws.textract#InvalidParameterException":
253
- response = {
254
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
255
- name: errorCode,
256
- $metadata: deserializeMetadata(output),
257
- };
258
- break;
259
- case "InvalidS3ObjectException":
260
- case "com.amazonaws.textract#InvalidS3ObjectException":
261
- response = {
262
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
263
- name: errorCode,
264
- $metadata: deserializeMetadata(output),
265
- };
266
- break;
267
- case "ProvisionedThroughputExceededException":
268
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
269
- response = {
270
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
271
- name: errorCode,
272
- $metadata: deserializeMetadata(output),
273
- };
274
- break;
275
- case "ThrottlingException":
276
- case "com.amazonaws.textract#ThrottlingException":
277
- response = {
278
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
279
- name: errorCode,
280
- $metadata: deserializeMetadata(output),
281
- };
282
- break;
283
- case "UnsupportedDocumentException":
284
- case "com.amazonaws.textract#UnsupportedDocumentException":
285
- response = {
286
- ...(await deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)),
287
- name: errorCode,
288
- $metadata: deserializeMetadata(output),
289
- };
290
- break;
291
- default:
292
- const parsedBody = parsedOutput.body;
293
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
294
- response = {
295
- ...parsedBody,
296
- name: `${errorCode}`,
297
- message: parsedBody.message || parsedBody.Message || errorCode,
298
- $fault: "client",
299
- $metadata: deserializeMetadata(output),
300
- } as any;
301
- }
302
- const message = response.message || response.Message || errorCode;
303
- response.message = message;
304
- delete response.Message;
305
- return Promise.reject(Object.assign(new Error(message), response));
306
- };
307
-
308
- export const deserializeAws_json1_1AnalyzeExpenseCommand = async (
309
- output: __HttpResponse,
310
- context: __SerdeContext
311
- ): Promise<AnalyzeExpenseCommandOutput> => {
312
- if (output.statusCode >= 300) {
313
- return deserializeAws_json1_1AnalyzeExpenseCommandError(output, context);
314
- }
315
- const data: any = await parseBody(output.body, context);
316
- let contents: any = {};
317
- contents = deserializeAws_json1_1AnalyzeExpenseResponse(data, context);
318
- const response: AnalyzeExpenseCommandOutput = {
319
- $metadata: deserializeMetadata(output),
320
- ...contents,
321
- };
322
- return Promise.resolve(response);
323
- };
324
-
325
- const deserializeAws_json1_1AnalyzeExpenseCommandError = async (
326
- output: __HttpResponse,
327
- context: __SerdeContext
328
- ): Promise<AnalyzeExpenseCommandOutput> => {
329
- const parsedOutput: any = {
330
- ...output,
331
- body: await parseBody(output.body, context),
332
- };
333
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
334
- let errorCode = "UnknownError";
335
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
336
- switch (errorCode) {
337
- case "AccessDeniedException":
338
- case "com.amazonaws.textract#AccessDeniedException":
339
- response = {
340
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
341
- name: errorCode,
342
- $metadata: deserializeMetadata(output),
343
- };
344
- break;
345
- case "BadDocumentException":
346
- case "com.amazonaws.textract#BadDocumentException":
347
- response = {
348
- ...(await deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)),
349
- name: errorCode,
350
- $metadata: deserializeMetadata(output),
351
- };
352
- break;
353
- case "DocumentTooLargeException":
354
- case "com.amazonaws.textract#DocumentTooLargeException":
355
- response = {
356
- ...(await deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)),
357
- name: errorCode,
358
- $metadata: deserializeMetadata(output),
359
- };
360
- break;
361
- case "InternalServerError":
362
- case "com.amazonaws.textract#InternalServerError":
363
- response = {
364
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
365
- name: errorCode,
366
- $metadata: deserializeMetadata(output),
367
- };
368
- break;
369
- case "InvalidParameterException":
370
- case "com.amazonaws.textract#InvalidParameterException":
371
- response = {
372
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
373
- name: errorCode,
374
- $metadata: deserializeMetadata(output),
375
- };
376
- break;
377
- case "InvalidS3ObjectException":
378
- case "com.amazonaws.textract#InvalidS3ObjectException":
379
- response = {
380
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
381
- name: errorCode,
382
- $metadata: deserializeMetadata(output),
383
- };
384
- break;
385
- case "ProvisionedThroughputExceededException":
386
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
387
- response = {
388
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
389
- name: errorCode,
390
- $metadata: deserializeMetadata(output),
391
- };
392
- break;
393
- case "ThrottlingException":
394
- case "com.amazonaws.textract#ThrottlingException":
395
- response = {
396
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
397
- name: errorCode,
398
- $metadata: deserializeMetadata(output),
399
- };
400
- break;
401
- case "UnsupportedDocumentException":
402
- case "com.amazonaws.textract#UnsupportedDocumentException":
403
- response = {
404
- ...(await deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)),
405
- name: errorCode,
406
- $metadata: deserializeMetadata(output),
407
- };
408
- break;
409
- default:
410
- const parsedBody = parsedOutput.body;
411
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
412
- response = {
413
- ...parsedBody,
414
- name: `${errorCode}`,
415
- message: parsedBody.message || parsedBody.Message || errorCode,
416
- $fault: "client",
417
- $metadata: deserializeMetadata(output),
418
- } as any;
419
- }
420
- const message = response.message || response.Message || errorCode;
421
- response.message = message;
422
- delete response.Message;
423
- return Promise.reject(Object.assign(new Error(message), response));
424
- };
425
-
426
- export const deserializeAws_json1_1DetectDocumentTextCommand = async (
427
- output: __HttpResponse,
428
- context: __SerdeContext
429
- ): Promise<DetectDocumentTextCommandOutput> => {
430
- if (output.statusCode >= 300) {
431
- return deserializeAws_json1_1DetectDocumentTextCommandError(output, context);
432
- }
433
- const data: any = await parseBody(output.body, context);
434
- let contents: any = {};
435
- contents = deserializeAws_json1_1DetectDocumentTextResponse(data, context);
436
- const response: DetectDocumentTextCommandOutput = {
437
- $metadata: deserializeMetadata(output),
438
- ...contents,
439
- };
440
- return Promise.resolve(response);
441
- };
442
-
443
- const deserializeAws_json1_1DetectDocumentTextCommandError = async (
444
- output: __HttpResponse,
445
- context: __SerdeContext
446
- ): Promise<DetectDocumentTextCommandOutput> => {
447
- const parsedOutput: any = {
448
- ...output,
449
- body: await parseBody(output.body, context),
450
- };
451
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
452
- let errorCode = "UnknownError";
453
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
454
- switch (errorCode) {
455
- case "AccessDeniedException":
456
- case "com.amazonaws.textract#AccessDeniedException":
457
- response = {
458
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
459
- name: errorCode,
460
- $metadata: deserializeMetadata(output),
461
- };
462
- break;
463
- case "BadDocumentException":
464
- case "com.amazonaws.textract#BadDocumentException":
465
- response = {
466
- ...(await deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)),
467
- name: errorCode,
468
- $metadata: deserializeMetadata(output),
469
- };
470
- break;
471
- case "DocumentTooLargeException":
472
- case "com.amazonaws.textract#DocumentTooLargeException":
473
- response = {
474
- ...(await deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)),
475
- name: errorCode,
476
- $metadata: deserializeMetadata(output),
477
- };
478
- break;
479
- case "InternalServerError":
480
- case "com.amazonaws.textract#InternalServerError":
481
- response = {
482
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
483
- name: errorCode,
484
- $metadata: deserializeMetadata(output),
485
- };
486
- break;
487
- case "InvalidParameterException":
488
- case "com.amazonaws.textract#InvalidParameterException":
489
- response = {
490
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
491
- name: errorCode,
492
- $metadata: deserializeMetadata(output),
493
- };
494
- break;
495
- case "InvalidS3ObjectException":
496
- case "com.amazonaws.textract#InvalidS3ObjectException":
497
- response = {
498
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
499
- name: errorCode,
500
- $metadata: deserializeMetadata(output),
501
- };
502
- break;
503
- case "ProvisionedThroughputExceededException":
504
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
505
- response = {
506
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
507
- name: errorCode,
508
- $metadata: deserializeMetadata(output),
509
- };
510
- break;
511
- case "ThrottlingException":
512
- case "com.amazonaws.textract#ThrottlingException":
513
- response = {
514
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
515
- name: errorCode,
516
- $metadata: deserializeMetadata(output),
517
- };
518
- break;
519
- case "UnsupportedDocumentException":
520
- case "com.amazonaws.textract#UnsupportedDocumentException":
521
- response = {
522
- ...(await deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)),
523
- name: errorCode,
524
- $metadata: deserializeMetadata(output),
525
- };
526
- break;
527
- default:
528
- const parsedBody = parsedOutput.body;
529
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
530
- response = {
531
- ...parsedBody,
532
- name: `${errorCode}`,
533
- message: parsedBody.message || parsedBody.Message || errorCode,
534
- $fault: "client",
535
- $metadata: deserializeMetadata(output),
536
- } as any;
537
- }
538
- const message = response.message || response.Message || errorCode;
539
- response.message = message;
540
- delete response.Message;
541
- return Promise.reject(Object.assign(new Error(message), response));
542
- };
543
-
544
- export const deserializeAws_json1_1GetDocumentAnalysisCommand = async (
545
- output: __HttpResponse,
546
- context: __SerdeContext
547
- ): Promise<GetDocumentAnalysisCommandOutput> => {
548
- if (output.statusCode >= 300) {
549
- return deserializeAws_json1_1GetDocumentAnalysisCommandError(output, context);
550
- }
551
- const data: any = await parseBody(output.body, context);
552
- let contents: any = {};
553
- contents = deserializeAws_json1_1GetDocumentAnalysisResponse(data, context);
554
- const response: GetDocumentAnalysisCommandOutput = {
555
- $metadata: deserializeMetadata(output),
556
- ...contents,
557
- };
558
- return Promise.resolve(response);
559
- };
560
-
561
- const deserializeAws_json1_1GetDocumentAnalysisCommandError = async (
562
- output: __HttpResponse,
563
- context: __SerdeContext
564
- ): Promise<GetDocumentAnalysisCommandOutput> => {
565
- const parsedOutput: any = {
566
- ...output,
567
- body: await parseBody(output.body, context),
568
- };
569
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
570
- let errorCode = "UnknownError";
571
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
572
- switch (errorCode) {
573
- case "AccessDeniedException":
574
- case "com.amazonaws.textract#AccessDeniedException":
575
- response = {
576
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
577
- name: errorCode,
578
- $metadata: deserializeMetadata(output),
579
- };
580
- break;
581
- case "InternalServerError":
582
- case "com.amazonaws.textract#InternalServerError":
583
- response = {
584
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
585
- name: errorCode,
586
- $metadata: deserializeMetadata(output),
587
- };
588
- break;
589
- case "InvalidJobIdException":
590
- case "com.amazonaws.textract#InvalidJobIdException":
591
- response = {
592
- ...(await deserializeAws_json1_1InvalidJobIdExceptionResponse(parsedOutput, context)),
593
- name: errorCode,
594
- $metadata: deserializeMetadata(output),
595
- };
596
- break;
597
- case "InvalidKMSKeyException":
598
- case "com.amazonaws.textract#InvalidKMSKeyException":
599
- response = {
600
- ...(await deserializeAws_json1_1InvalidKMSKeyExceptionResponse(parsedOutput, context)),
601
- name: errorCode,
602
- $metadata: deserializeMetadata(output),
603
- };
604
- break;
605
- case "InvalidParameterException":
606
- case "com.amazonaws.textract#InvalidParameterException":
607
- response = {
608
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
609
- name: errorCode,
610
- $metadata: deserializeMetadata(output),
611
- };
612
- break;
613
- case "InvalidS3ObjectException":
614
- case "com.amazonaws.textract#InvalidS3ObjectException":
615
- response = {
616
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
617
- name: errorCode,
618
- $metadata: deserializeMetadata(output),
619
- };
620
- break;
621
- case "ProvisionedThroughputExceededException":
622
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
623
- response = {
624
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
625
- name: errorCode,
626
- $metadata: deserializeMetadata(output),
627
- };
628
- break;
629
- case "ThrottlingException":
630
- case "com.amazonaws.textract#ThrottlingException":
631
- response = {
632
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
633
- name: errorCode,
634
- $metadata: deserializeMetadata(output),
635
- };
636
- break;
637
- default:
638
- const parsedBody = parsedOutput.body;
639
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
640
- response = {
641
- ...parsedBody,
642
- name: `${errorCode}`,
643
- message: parsedBody.message || parsedBody.Message || errorCode,
644
- $fault: "client",
645
- $metadata: deserializeMetadata(output),
646
- } as any;
647
- }
648
- const message = response.message || response.Message || errorCode;
649
- response.message = message;
650
- delete response.Message;
651
- return Promise.reject(Object.assign(new Error(message), response));
652
- };
653
-
654
- export const deserializeAws_json1_1GetDocumentTextDetectionCommand = async (
655
- output: __HttpResponse,
656
- context: __SerdeContext
657
- ): Promise<GetDocumentTextDetectionCommandOutput> => {
658
- if (output.statusCode >= 300) {
659
- return deserializeAws_json1_1GetDocumentTextDetectionCommandError(output, context);
660
- }
661
- const data: any = await parseBody(output.body, context);
662
- let contents: any = {};
663
- contents = deserializeAws_json1_1GetDocumentTextDetectionResponse(data, context);
664
- const response: GetDocumentTextDetectionCommandOutput = {
665
- $metadata: deserializeMetadata(output),
666
- ...contents,
667
- };
668
- return Promise.resolve(response);
669
- };
670
-
671
- const deserializeAws_json1_1GetDocumentTextDetectionCommandError = async (
672
- output: __HttpResponse,
673
- context: __SerdeContext
674
- ): Promise<GetDocumentTextDetectionCommandOutput> => {
675
- const parsedOutput: any = {
676
- ...output,
677
- body: await parseBody(output.body, context),
678
- };
679
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
680
- let errorCode = "UnknownError";
681
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
682
- switch (errorCode) {
683
- case "AccessDeniedException":
684
- case "com.amazonaws.textract#AccessDeniedException":
685
- response = {
686
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
687
- name: errorCode,
688
- $metadata: deserializeMetadata(output),
689
- };
690
- break;
691
- case "InternalServerError":
692
- case "com.amazonaws.textract#InternalServerError":
693
- response = {
694
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
695
- name: errorCode,
696
- $metadata: deserializeMetadata(output),
697
- };
698
- break;
699
- case "InvalidJobIdException":
700
- case "com.amazonaws.textract#InvalidJobIdException":
701
- response = {
702
- ...(await deserializeAws_json1_1InvalidJobIdExceptionResponse(parsedOutput, context)),
703
- name: errorCode,
704
- $metadata: deserializeMetadata(output),
705
- };
706
- break;
707
- case "InvalidKMSKeyException":
708
- case "com.amazonaws.textract#InvalidKMSKeyException":
709
- response = {
710
- ...(await deserializeAws_json1_1InvalidKMSKeyExceptionResponse(parsedOutput, context)),
711
- name: errorCode,
712
- $metadata: deserializeMetadata(output),
713
- };
714
- break;
715
- case "InvalidParameterException":
716
- case "com.amazonaws.textract#InvalidParameterException":
717
- response = {
718
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
719
- name: errorCode,
720
- $metadata: deserializeMetadata(output),
721
- };
722
- break;
723
- case "InvalidS3ObjectException":
724
- case "com.amazonaws.textract#InvalidS3ObjectException":
725
- response = {
726
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
727
- name: errorCode,
728
- $metadata: deserializeMetadata(output),
729
- };
730
- break;
731
- case "ProvisionedThroughputExceededException":
732
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
733
- response = {
734
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
735
- name: errorCode,
736
- $metadata: deserializeMetadata(output),
737
- };
738
- break;
739
- case "ThrottlingException":
740
- case "com.amazonaws.textract#ThrottlingException":
741
- response = {
742
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
743
- name: errorCode,
744
- $metadata: deserializeMetadata(output),
745
- };
746
- break;
747
- default:
748
- const parsedBody = parsedOutput.body;
749
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
750
- response = {
751
- ...parsedBody,
752
- name: `${errorCode}`,
753
- message: parsedBody.message || parsedBody.Message || errorCode,
754
- $fault: "client",
755
- $metadata: deserializeMetadata(output),
756
- } as any;
757
- }
758
- const message = response.message || response.Message || errorCode;
759
- response.message = message;
760
- delete response.Message;
761
- return Promise.reject(Object.assign(new Error(message), response));
762
- };
763
-
764
- export const deserializeAws_json1_1StartDocumentAnalysisCommand = async (
765
- output: __HttpResponse,
766
- context: __SerdeContext
767
- ): Promise<StartDocumentAnalysisCommandOutput> => {
768
- if (output.statusCode >= 300) {
769
- return deserializeAws_json1_1StartDocumentAnalysisCommandError(output, context);
770
- }
771
- const data: any = await parseBody(output.body, context);
772
- let contents: any = {};
773
- contents = deserializeAws_json1_1StartDocumentAnalysisResponse(data, context);
774
- const response: StartDocumentAnalysisCommandOutput = {
775
- $metadata: deserializeMetadata(output),
776
- ...contents,
777
- };
778
- return Promise.resolve(response);
779
- };
780
-
781
- const deserializeAws_json1_1StartDocumentAnalysisCommandError = async (
782
- output: __HttpResponse,
783
- context: __SerdeContext
784
- ): Promise<StartDocumentAnalysisCommandOutput> => {
785
- const parsedOutput: any = {
786
- ...output,
787
- body: await parseBody(output.body, context),
788
- };
789
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
790
- let errorCode = "UnknownError";
791
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
792
- switch (errorCode) {
793
- case "AccessDeniedException":
794
- case "com.amazonaws.textract#AccessDeniedException":
795
- response = {
796
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
797
- name: errorCode,
798
- $metadata: deserializeMetadata(output),
799
- };
800
- break;
801
- case "BadDocumentException":
802
- case "com.amazonaws.textract#BadDocumentException":
803
- response = {
804
- ...(await deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)),
805
- name: errorCode,
806
- $metadata: deserializeMetadata(output),
807
- };
808
- break;
809
- case "DocumentTooLargeException":
810
- case "com.amazonaws.textract#DocumentTooLargeException":
811
- response = {
812
- ...(await deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)),
813
- name: errorCode,
814
- $metadata: deserializeMetadata(output),
815
- };
816
- break;
817
- case "IdempotentParameterMismatchException":
818
- case "com.amazonaws.textract#IdempotentParameterMismatchException":
819
- response = {
820
- ...(await deserializeAws_json1_1IdempotentParameterMismatchExceptionResponse(parsedOutput, context)),
821
- name: errorCode,
822
- $metadata: deserializeMetadata(output),
823
- };
824
- break;
825
- case "InternalServerError":
826
- case "com.amazonaws.textract#InternalServerError":
827
- response = {
828
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
829
- name: errorCode,
830
- $metadata: deserializeMetadata(output),
831
- };
832
- break;
833
- case "InvalidKMSKeyException":
834
- case "com.amazonaws.textract#InvalidKMSKeyException":
835
- response = {
836
- ...(await deserializeAws_json1_1InvalidKMSKeyExceptionResponse(parsedOutput, context)),
837
- name: errorCode,
838
- $metadata: deserializeMetadata(output),
839
- };
840
- break;
841
- case "InvalidParameterException":
842
- case "com.amazonaws.textract#InvalidParameterException":
843
- response = {
844
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
845
- name: errorCode,
846
- $metadata: deserializeMetadata(output),
847
- };
848
- break;
849
- case "InvalidS3ObjectException":
850
- case "com.amazonaws.textract#InvalidS3ObjectException":
851
- response = {
852
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
853
- name: errorCode,
854
- $metadata: deserializeMetadata(output),
855
- };
856
- break;
857
- case "LimitExceededException":
858
- case "com.amazonaws.textract#LimitExceededException":
859
- response = {
860
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
861
- name: errorCode,
862
- $metadata: deserializeMetadata(output),
863
- };
864
- break;
865
- case "ProvisionedThroughputExceededException":
866
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
867
- response = {
868
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
869
- name: errorCode,
870
- $metadata: deserializeMetadata(output),
871
- };
872
- break;
873
- case "ThrottlingException":
874
- case "com.amazonaws.textract#ThrottlingException":
875
- response = {
876
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
877
- name: errorCode,
878
- $metadata: deserializeMetadata(output),
879
- };
880
- break;
881
- case "UnsupportedDocumentException":
882
- case "com.amazonaws.textract#UnsupportedDocumentException":
883
- response = {
884
- ...(await deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)),
885
- name: errorCode,
886
- $metadata: deserializeMetadata(output),
887
- };
888
- break;
889
- default:
890
- const parsedBody = parsedOutput.body;
891
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
892
- response = {
893
- ...parsedBody,
894
- name: `${errorCode}`,
895
- message: parsedBody.message || parsedBody.Message || errorCode,
896
- $fault: "client",
897
- $metadata: deserializeMetadata(output),
898
- } as any;
899
- }
900
- const message = response.message || response.Message || errorCode;
901
- response.message = message;
902
- delete response.Message;
903
- return Promise.reject(Object.assign(new Error(message), response));
904
- };
905
-
906
- export const deserializeAws_json1_1StartDocumentTextDetectionCommand = async (
907
- output: __HttpResponse,
908
- context: __SerdeContext
909
- ): Promise<StartDocumentTextDetectionCommandOutput> => {
910
- if (output.statusCode >= 300) {
911
- return deserializeAws_json1_1StartDocumentTextDetectionCommandError(output, context);
912
- }
913
- const data: any = await parseBody(output.body, context);
914
- let contents: any = {};
915
- contents = deserializeAws_json1_1StartDocumentTextDetectionResponse(data, context);
916
- const response: StartDocumentTextDetectionCommandOutput = {
917
- $metadata: deserializeMetadata(output),
918
- ...contents,
919
- };
920
- return Promise.resolve(response);
921
- };
922
-
923
- const deserializeAws_json1_1StartDocumentTextDetectionCommandError = async (
924
- output: __HttpResponse,
925
- context: __SerdeContext
926
- ): Promise<StartDocumentTextDetectionCommandOutput> => {
927
- const parsedOutput: any = {
928
- ...output,
929
- body: await parseBody(output.body, context),
930
- };
931
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
932
- let errorCode = "UnknownError";
933
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
934
- switch (errorCode) {
935
- case "AccessDeniedException":
936
- case "com.amazonaws.textract#AccessDeniedException":
937
- response = {
938
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
939
- name: errorCode,
940
- $metadata: deserializeMetadata(output),
941
- };
942
- break;
943
- case "BadDocumentException":
944
- case "com.amazonaws.textract#BadDocumentException":
945
- response = {
946
- ...(await deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)),
947
- name: errorCode,
948
- $metadata: deserializeMetadata(output),
949
- };
950
- break;
951
- case "DocumentTooLargeException":
952
- case "com.amazonaws.textract#DocumentTooLargeException":
953
- response = {
954
- ...(await deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)),
955
- name: errorCode,
956
- $metadata: deserializeMetadata(output),
957
- };
958
- break;
959
- case "IdempotentParameterMismatchException":
960
- case "com.amazonaws.textract#IdempotentParameterMismatchException":
961
- response = {
962
- ...(await deserializeAws_json1_1IdempotentParameterMismatchExceptionResponse(parsedOutput, context)),
963
- name: errorCode,
964
- $metadata: deserializeMetadata(output),
965
- };
966
- break;
967
- case "InternalServerError":
968
- case "com.amazonaws.textract#InternalServerError":
969
- response = {
970
- ...(await deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)),
971
- name: errorCode,
972
- $metadata: deserializeMetadata(output),
973
- };
974
- break;
975
- case "InvalidKMSKeyException":
976
- case "com.amazonaws.textract#InvalidKMSKeyException":
977
- response = {
978
- ...(await deserializeAws_json1_1InvalidKMSKeyExceptionResponse(parsedOutput, context)),
979
- name: errorCode,
980
- $metadata: deserializeMetadata(output),
981
- };
982
- break;
983
- case "InvalidParameterException":
984
- case "com.amazonaws.textract#InvalidParameterException":
985
- response = {
986
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
987
- name: errorCode,
988
- $metadata: deserializeMetadata(output),
989
- };
990
- break;
991
- case "InvalidS3ObjectException":
992
- case "com.amazonaws.textract#InvalidS3ObjectException":
993
- response = {
994
- ...(await deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)),
995
- name: errorCode,
996
- $metadata: deserializeMetadata(output),
997
- };
998
- break;
999
- case "LimitExceededException":
1000
- case "com.amazonaws.textract#LimitExceededException":
1001
- response = {
1002
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
1003
- name: errorCode,
1004
- $metadata: deserializeMetadata(output),
1005
- };
1006
- break;
1007
- case "ProvisionedThroughputExceededException":
1008
- case "com.amazonaws.textract#ProvisionedThroughputExceededException":
1009
- response = {
1010
- ...(await deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)),
1011
- name: errorCode,
1012
- $metadata: deserializeMetadata(output),
1013
- };
1014
- break;
1015
- case "ThrottlingException":
1016
- case "com.amazonaws.textract#ThrottlingException":
1017
- response = {
1018
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1019
- name: errorCode,
1020
- $metadata: deserializeMetadata(output),
1021
- };
1022
- break;
1023
- case "UnsupportedDocumentException":
1024
- case "com.amazonaws.textract#UnsupportedDocumentException":
1025
- response = {
1026
- ...(await deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)),
1027
- name: errorCode,
1028
- $metadata: deserializeMetadata(output),
1029
- };
1030
- break;
1031
- default:
1032
- const parsedBody = parsedOutput.body;
1033
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1034
- response = {
1035
- ...parsedBody,
1036
- name: `${errorCode}`,
1037
- message: parsedBody.message || parsedBody.Message || errorCode,
1038
- $fault: "client",
1039
- $metadata: deserializeMetadata(output),
1040
- } as any;
1041
- }
1042
- const message = response.message || response.Message || errorCode;
1043
- response.message = message;
1044
- delete response.Message;
1045
- return Promise.reject(Object.assign(new Error(message), response));
1046
- };
1047
-
1048
- const deserializeAws_json1_1AccessDeniedExceptionResponse = async (
1049
- parsedOutput: any,
1050
- context: __SerdeContext
1051
- ): Promise<AccessDeniedException> => {
1052
- const body = parsedOutput.body;
1053
- const deserialized: any = deserializeAws_json1_1AccessDeniedException(body, context);
1054
- const contents: AccessDeniedException = {
1055
- name: "AccessDeniedException",
1056
- $fault: "client",
1057
- $metadata: deserializeMetadata(parsedOutput),
1058
- ...deserialized,
1059
- };
1060
- return contents;
1061
- };
1062
-
1063
- const deserializeAws_json1_1BadDocumentExceptionResponse = async (
1064
- parsedOutput: any,
1065
- context: __SerdeContext
1066
- ): Promise<BadDocumentException> => {
1067
- const body = parsedOutput.body;
1068
- const deserialized: any = deserializeAws_json1_1BadDocumentException(body, context);
1069
- const contents: BadDocumentException = {
1070
- name: "BadDocumentException",
1071
- $fault: "client",
1072
- $metadata: deserializeMetadata(parsedOutput),
1073
- ...deserialized,
1074
- };
1075
- return contents;
1076
- };
1077
-
1078
- const deserializeAws_json1_1DocumentTooLargeExceptionResponse = async (
1079
- parsedOutput: any,
1080
- context: __SerdeContext
1081
- ): Promise<DocumentTooLargeException> => {
1082
- const body = parsedOutput.body;
1083
- const deserialized: any = deserializeAws_json1_1DocumentTooLargeException(body, context);
1084
- const contents: DocumentTooLargeException = {
1085
- name: "DocumentTooLargeException",
1086
- $fault: "client",
1087
- $metadata: deserializeMetadata(parsedOutput),
1088
- ...deserialized,
1089
- };
1090
- return contents;
1091
- };
1092
-
1093
- const deserializeAws_json1_1HumanLoopQuotaExceededExceptionResponse = async (
1094
- parsedOutput: any,
1095
- context: __SerdeContext
1096
- ): Promise<HumanLoopQuotaExceededException> => {
1097
- const body = parsedOutput.body;
1098
- const deserialized: any = deserializeAws_json1_1HumanLoopQuotaExceededException(body, context);
1099
- const contents: HumanLoopQuotaExceededException = {
1100
- name: "HumanLoopQuotaExceededException",
1101
- $fault: "client",
1102
- $metadata: deserializeMetadata(parsedOutput),
1103
- ...deserialized,
1104
- };
1105
- return contents;
1106
- };
1107
-
1108
- const deserializeAws_json1_1IdempotentParameterMismatchExceptionResponse = async (
1109
- parsedOutput: any,
1110
- context: __SerdeContext
1111
- ): Promise<IdempotentParameterMismatchException> => {
1112
- const body = parsedOutput.body;
1113
- const deserialized: any = deserializeAws_json1_1IdempotentParameterMismatchException(body, context);
1114
- const contents: IdempotentParameterMismatchException = {
1115
- name: "IdempotentParameterMismatchException",
1116
- $fault: "client",
1117
- $metadata: deserializeMetadata(parsedOutput),
1118
- ...deserialized,
1119
- };
1120
- return contents;
1121
- };
1122
-
1123
- const deserializeAws_json1_1InternalServerErrorResponse = async (
1124
- parsedOutput: any,
1125
- context: __SerdeContext
1126
- ): Promise<InternalServerError> => {
1127
- const body = parsedOutput.body;
1128
- const deserialized: any = deserializeAws_json1_1InternalServerError(body, context);
1129
- const contents: InternalServerError = {
1130
- name: "InternalServerError",
1131
- $fault: "server",
1132
- $metadata: deserializeMetadata(parsedOutput),
1133
- ...deserialized,
1134
- };
1135
- return contents;
1136
- };
1137
-
1138
- const deserializeAws_json1_1InvalidJobIdExceptionResponse = async (
1139
- parsedOutput: any,
1140
- context: __SerdeContext
1141
- ): Promise<InvalidJobIdException> => {
1142
- const body = parsedOutput.body;
1143
- const deserialized: any = deserializeAws_json1_1InvalidJobIdException(body, context);
1144
- const contents: InvalidJobIdException = {
1145
- name: "InvalidJobIdException",
1146
- $fault: "client",
1147
- $metadata: deserializeMetadata(parsedOutput),
1148
- ...deserialized,
1149
- };
1150
- return contents;
1151
- };
1152
-
1153
- const deserializeAws_json1_1InvalidKMSKeyExceptionResponse = async (
1154
- parsedOutput: any,
1155
- context: __SerdeContext
1156
- ): Promise<InvalidKMSKeyException> => {
1157
- const body = parsedOutput.body;
1158
- const deserialized: any = deserializeAws_json1_1InvalidKMSKeyException(body, context);
1159
- const contents: InvalidKMSKeyException = {
1160
- name: "InvalidKMSKeyException",
1161
- $fault: "client",
1162
- $metadata: deserializeMetadata(parsedOutput),
1163
- ...deserialized,
1164
- };
1165
- return contents;
1166
- };
1167
-
1168
- const deserializeAws_json1_1InvalidParameterExceptionResponse = async (
1169
- parsedOutput: any,
1170
- context: __SerdeContext
1171
- ): Promise<InvalidParameterException> => {
1172
- const body = parsedOutput.body;
1173
- const deserialized: any = deserializeAws_json1_1InvalidParameterException(body, context);
1174
- const contents: InvalidParameterException = {
1175
- name: "InvalidParameterException",
1176
- $fault: "client",
1177
- $metadata: deserializeMetadata(parsedOutput),
1178
- ...deserialized,
1179
- };
1180
- return contents;
1181
- };
1182
-
1183
- const deserializeAws_json1_1InvalidS3ObjectExceptionResponse = async (
1184
- parsedOutput: any,
1185
- context: __SerdeContext
1186
- ): Promise<InvalidS3ObjectException> => {
1187
- const body = parsedOutput.body;
1188
- const deserialized: any = deserializeAws_json1_1InvalidS3ObjectException(body, context);
1189
- const contents: InvalidS3ObjectException = {
1190
- name: "InvalidS3ObjectException",
1191
- $fault: "client",
1192
- $metadata: deserializeMetadata(parsedOutput),
1193
- ...deserialized,
1194
- };
1195
- return contents;
1196
- };
1197
-
1198
- const deserializeAws_json1_1LimitExceededExceptionResponse = async (
1199
- parsedOutput: any,
1200
- context: __SerdeContext
1201
- ): Promise<LimitExceededException> => {
1202
- const body = parsedOutput.body;
1203
- const deserialized: any = deserializeAws_json1_1LimitExceededException(body, context);
1204
- const contents: LimitExceededException = {
1205
- name: "LimitExceededException",
1206
- $fault: "client",
1207
- $metadata: deserializeMetadata(parsedOutput),
1208
- ...deserialized,
1209
- };
1210
- return contents;
1211
- };
1212
-
1213
- const deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse = async (
1214
- parsedOutput: any,
1215
- context: __SerdeContext
1216
- ): Promise<ProvisionedThroughputExceededException> => {
1217
- const body = parsedOutput.body;
1218
- const deserialized: any = deserializeAws_json1_1ProvisionedThroughputExceededException(body, context);
1219
- const contents: ProvisionedThroughputExceededException = {
1220
- name: "ProvisionedThroughputExceededException",
1221
- $fault: "client",
1222
- $metadata: deserializeMetadata(parsedOutput),
1223
- ...deserialized,
1224
- };
1225
- return contents;
1226
- };
1227
-
1228
- const deserializeAws_json1_1ThrottlingExceptionResponse = async (
1229
- parsedOutput: any,
1230
- context: __SerdeContext
1231
- ): Promise<ThrottlingException> => {
1232
- const body = parsedOutput.body;
1233
- const deserialized: any = deserializeAws_json1_1ThrottlingException(body, context);
1234
- const contents: ThrottlingException = {
1235
- name: "ThrottlingException",
1236
- $fault: "server",
1237
- $metadata: deserializeMetadata(parsedOutput),
1238
- ...deserialized,
1239
- };
1240
- return contents;
1241
- };
1242
-
1243
- const deserializeAws_json1_1UnsupportedDocumentExceptionResponse = async (
1244
- parsedOutput: any,
1245
- context: __SerdeContext
1246
- ): Promise<UnsupportedDocumentException> => {
1247
- const body = parsedOutput.body;
1248
- const deserialized: any = deserializeAws_json1_1UnsupportedDocumentException(body, context);
1249
- const contents: UnsupportedDocumentException = {
1250
- name: "UnsupportedDocumentException",
1251
- $fault: "client",
1252
- $metadata: deserializeMetadata(parsedOutput),
1253
- ...deserialized,
1254
- };
1255
- return contents;
1256
- };
1257
-
1258
- const serializeAws_json1_1AnalyzeDocumentRequest = (input: AnalyzeDocumentRequest, context: __SerdeContext): any => {
1259
- return {
1260
- ...(input.Document !== undefined &&
1261
- input.Document !== null && { Document: serializeAws_json1_1Document(input.Document, context) }),
1262
- ...(input.FeatureTypes !== undefined &&
1263
- input.FeatureTypes !== null && { FeatureTypes: serializeAws_json1_1FeatureTypes(input.FeatureTypes, context) }),
1264
- ...(input.HumanLoopConfig !== undefined &&
1265
- input.HumanLoopConfig !== null && {
1266
- HumanLoopConfig: serializeAws_json1_1HumanLoopConfig(input.HumanLoopConfig, context),
1267
- }),
1268
- };
1269
- };
1270
-
1271
- const serializeAws_json1_1AnalyzeExpenseRequest = (input: AnalyzeExpenseRequest, context: __SerdeContext): any => {
1272
- return {
1273
- ...(input.Document !== undefined &&
1274
- input.Document !== null && { Document: serializeAws_json1_1Document(input.Document, context) }),
1275
- };
1276
- };
1277
-
1278
- const serializeAws_json1_1ContentClassifiers = (
1279
- input: (ContentClassifier | string)[],
1280
- context: __SerdeContext
1281
- ): any => {
1282
- return input
1283
- .filter((e: any) => e != null)
1284
- .map((entry) => {
1285
- if (entry === null) {
1286
- return null as any;
1287
- }
1288
- return entry;
1289
- });
1290
- };
1291
-
1292
- const serializeAws_json1_1DetectDocumentTextRequest = (
1293
- input: DetectDocumentTextRequest,
1294
- context: __SerdeContext
1295
- ): any => {
1296
- return {
1297
- ...(input.Document !== undefined &&
1298
- input.Document !== null && { Document: serializeAws_json1_1Document(input.Document, context) }),
1299
- };
1300
- };
1301
-
1302
- const serializeAws_json1_1Document = (input: Document, context: __SerdeContext): any => {
1303
- return {
1304
- ...(input.Bytes !== undefined && input.Bytes !== null && { Bytes: context.base64Encoder(input.Bytes) }),
1305
- ...(input.S3Object !== undefined &&
1306
- input.S3Object !== null && { S3Object: serializeAws_json1_1S3Object(input.S3Object, context) }),
1307
- };
1308
- };
1309
-
1310
- const serializeAws_json1_1DocumentLocation = (input: DocumentLocation, context: __SerdeContext): any => {
1311
- return {
1312
- ...(input.S3Object !== undefined &&
1313
- input.S3Object !== null && { S3Object: serializeAws_json1_1S3Object(input.S3Object, context) }),
1314
- };
1315
- };
1316
-
1317
- const serializeAws_json1_1FeatureTypes = (input: (FeatureType | string)[], context: __SerdeContext): any => {
1318
- return input
1319
- .filter((e: any) => e != null)
1320
- .map((entry) => {
1321
- if (entry === null) {
1322
- return null as any;
1323
- }
1324
- return entry;
1325
- });
1326
- };
1327
-
1328
- const serializeAws_json1_1GetDocumentAnalysisRequest = (
1329
- input: GetDocumentAnalysisRequest,
1330
- context: __SerdeContext
1331
- ): any => {
1332
- return {
1333
- ...(input.JobId !== undefined && input.JobId !== null && { JobId: input.JobId }),
1334
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
1335
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
1336
- };
1337
- };
1338
-
1339
- const serializeAws_json1_1GetDocumentTextDetectionRequest = (
1340
- input: GetDocumentTextDetectionRequest,
1341
- context: __SerdeContext
1342
- ): any => {
1343
- return {
1344
- ...(input.JobId !== undefined && input.JobId !== null && { JobId: input.JobId }),
1345
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
1346
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
1347
- };
1348
- };
1349
-
1350
- const serializeAws_json1_1HumanLoopConfig = (input: HumanLoopConfig, context: __SerdeContext): any => {
1351
- return {
1352
- ...(input.DataAttributes !== undefined &&
1353
- input.DataAttributes !== null && {
1354
- DataAttributes: serializeAws_json1_1HumanLoopDataAttributes(input.DataAttributes, context),
1355
- }),
1356
- ...(input.FlowDefinitionArn !== undefined &&
1357
- input.FlowDefinitionArn !== null && { FlowDefinitionArn: input.FlowDefinitionArn }),
1358
- ...(input.HumanLoopName !== undefined && input.HumanLoopName !== null && { HumanLoopName: input.HumanLoopName }),
1359
- };
1360
- };
1361
-
1362
- const serializeAws_json1_1HumanLoopDataAttributes = (input: HumanLoopDataAttributes, context: __SerdeContext): any => {
1363
- return {
1364
- ...(input.ContentClassifiers !== undefined &&
1365
- input.ContentClassifiers !== null && {
1366
- ContentClassifiers: serializeAws_json1_1ContentClassifiers(input.ContentClassifiers, context),
1367
- }),
1368
- };
1369
- };
1370
-
1371
- const serializeAws_json1_1NotificationChannel = (input: NotificationChannel, context: __SerdeContext): any => {
1372
- return {
1373
- ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }),
1374
- ...(input.SNSTopicArn !== undefined && input.SNSTopicArn !== null && { SNSTopicArn: input.SNSTopicArn }),
1375
- };
1376
- };
1377
-
1378
- const serializeAws_json1_1OutputConfig = (input: OutputConfig, context: __SerdeContext): any => {
1379
- return {
1380
- ...(input.S3Bucket !== undefined && input.S3Bucket !== null && { S3Bucket: input.S3Bucket }),
1381
- ...(input.S3Prefix !== undefined && input.S3Prefix !== null && { S3Prefix: input.S3Prefix }),
1382
- };
1383
- };
1384
-
1385
- const serializeAws_json1_1S3Object = (input: S3Object, context: __SerdeContext): any => {
1386
- return {
1387
- ...(input.Bucket !== undefined && input.Bucket !== null && { Bucket: input.Bucket }),
1388
- ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
1389
- ...(input.Version !== undefined && input.Version !== null && { Version: input.Version }),
1390
- };
1391
- };
1392
-
1393
- const serializeAws_json1_1StartDocumentAnalysisRequest = (
1394
- input: StartDocumentAnalysisRequest,
1395
- context: __SerdeContext
1396
- ): any => {
1397
- return {
1398
- ...(input.ClientRequestToken !== undefined &&
1399
- input.ClientRequestToken !== null && { ClientRequestToken: input.ClientRequestToken }),
1400
- ...(input.DocumentLocation !== undefined &&
1401
- input.DocumentLocation !== null && {
1402
- DocumentLocation: serializeAws_json1_1DocumentLocation(input.DocumentLocation, context),
1403
- }),
1404
- ...(input.FeatureTypes !== undefined &&
1405
- input.FeatureTypes !== null && { FeatureTypes: serializeAws_json1_1FeatureTypes(input.FeatureTypes, context) }),
1406
- ...(input.JobTag !== undefined && input.JobTag !== null && { JobTag: input.JobTag }),
1407
- ...(input.KMSKeyId !== undefined && input.KMSKeyId !== null && { KMSKeyId: input.KMSKeyId }),
1408
- ...(input.NotificationChannel !== undefined &&
1409
- input.NotificationChannel !== null && {
1410
- NotificationChannel: serializeAws_json1_1NotificationChannel(input.NotificationChannel, context),
1411
- }),
1412
- ...(input.OutputConfig !== undefined &&
1413
- input.OutputConfig !== null && { OutputConfig: serializeAws_json1_1OutputConfig(input.OutputConfig, context) }),
1414
- };
1415
- };
1416
-
1417
- const serializeAws_json1_1StartDocumentTextDetectionRequest = (
1418
- input: StartDocumentTextDetectionRequest,
1419
- context: __SerdeContext
1420
- ): any => {
1421
- return {
1422
- ...(input.ClientRequestToken !== undefined &&
1423
- input.ClientRequestToken !== null && { ClientRequestToken: input.ClientRequestToken }),
1424
- ...(input.DocumentLocation !== undefined &&
1425
- input.DocumentLocation !== null && {
1426
- DocumentLocation: serializeAws_json1_1DocumentLocation(input.DocumentLocation, context),
1427
- }),
1428
- ...(input.JobTag !== undefined && input.JobTag !== null && { JobTag: input.JobTag }),
1429
- ...(input.KMSKeyId !== undefined && input.KMSKeyId !== null && { KMSKeyId: input.KMSKeyId }),
1430
- ...(input.NotificationChannel !== undefined &&
1431
- input.NotificationChannel !== null && {
1432
- NotificationChannel: serializeAws_json1_1NotificationChannel(input.NotificationChannel, context),
1433
- }),
1434
- ...(input.OutputConfig !== undefined &&
1435
- input.OutputConfig !== null && { OutputConfig: serializeAws_json1_1OutputConfig(input.OutputConfig, context) }),
1436
- };
1437
- };
1438
-
1439
- const deserializeAws_json1_1AccessDeniedException = (output: any, context: __SerdeContext): AccessDeniedException => {
1440
- return {
1441
- Code: __expectString(output.Code),
1442
- Message: __expectString(output.Message),
1443
- } as any;
1444
- };
1445
-
1446
- const deserializeAws_json1_1AnalyzeDocumentResponse = (
1447
- output: any,
1448
- context: __SerdeContext
1449
- ): AnalyzeDocumentResponse => {
1450
- return {
1451
- AnalyzeDocumentModelVersion: __expectString(output.AnalyzeDocumentModelVersion),
1452
- Blocks:
1453
- output.Blocks !== undefined && output.Blocks !== null
1454
- ? deserializeAws_json1_1BlockList(output.Blocks, context)
1455
- : undefined,
1456
- DocumentMetadata:
1457
- output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1458
- ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1459
- : undefined,
1460
- HumanLoopActivationOutput:
1461
- output.HumanLoopActivationOutput !== undefined && output.HumanLoopActivationOutput !== null
1462
- ? deserializeAws_json1_1HumanLoopActivationOutput(output.HumanLoopActivationOutput, context)
1463
- : undefined,
1464
- } as any;
1465
- };
1466
-
1467
- const deserializeAws_json1_1AnalyzeExpenseResponse = (output: any, context: __SerdeContext): AnalyzeExpenseResponse => {
1468
- return {
1469
- DocumentMetadata:
1470
- output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1471
- ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1472
- : undefined,
1473
- ExpenseDocuments:
1474
- output.ExpenseDocuments !== undefined && output.ExpenseDocuments !== null
1475
- ? deserializeAws_json1_1ExpenseDocumentList(output.ExpenseDocuments, context)
1476
- : undefined,
1477
- } as any;
1478
- };
1479
-
1480
- const deserializeAws_json1_1BadDocumentException = (output: any, context: __SerdeContext): BadDocumentException => {
1481
- return {
1482
- Code: __expectString(output.Code),
1483
- Message: __expectString(output.Message),
1484
- } as any;
1485
- };
1486
-
1487
- const deserializeAws_json1_1Block = (output: any, context: __SerdeContext): Block => {
1488
- return {
1489
- BlockType: __expectString(output.BlockType),
1490
- ColumnIndex: __expectInt32(output.ColumnIndex),
1491
- ColumnSpan: __expectInt32(output.ColumnSpan),
1492
- Confidence: __limitedParseFloat32(output.Confidence),
1493
- EntityTypes:
1494
- output.EntityTypes !== undefined && output.EntityTypes !== null
1495
- ? deserializeAws_json1_1EntityTypes(output.EntityTypes, context)
1496
- : undefined,
1497
- Geometry:
1498
- output.Geometry !== undefined && output.Geometry !== null
1499
- ? deserializeAws_json1_1Geometry(output.Geometry, context)
1500
- : undefined,
1501
- Id: __expectString(output.Id),
1502
- Page: __expectInt32(output.Page),
1503
- Relationships:
1504
- output.Relationships !== undefined && output.Relationships !== null
1505
- ? deserializeAws_json1_1RelationshipList(output.Relationships, context)
1506
- : undefined,
1507
- RowIndex: __expectInt32(output.RowIndex),
1508
- RowSpan: __expectInt32(output.RowSpan),
1509
- SelectionStatus: __expectString(output.SelectionStatus),
1510
- Text: __expectString(output.Text),
1511
- TextType: __expectString(output.TextType),
1512
- } as any;
1513
- };
1514
-
1515
- const deserializeAws_json1_1BlockList = (output: any, context: __SerdeContext): Block[] => {
1516
- return (output || [])
1517
- .filter((e: any) => e != null)
1518
- .map((entry: any) => {
1519
- if (entry === null) {
1520
- return null as any;
1521
- }
1522
- return deserializeAws_json1_1Block(entry, context);
1523
- });
1524
- };
1525
-
1526
- const deserializeAws_json1_1BoundingBox = (output: any, context: __SerdeContext): BoundingBox => {
1527
- return {
1528
- Height: __limitedParseFloat32(output.Height),
1529
- Left: __limitedParseFloat32(output.Left),
1530
- Top: __limitedParseFloat32(output.Top),
1531
- Width: __limitedParseFloat32(output.Width),
1532
- } as any;
1533
- };
1534
-
1535
- const deserializeAws_json1_1DetectDocumentTextResponse = (
1536
- output: any,
1537
- context: __SerdeContext
1538
- ): DetectDocumentTextResponse => {
1539
- return {
1540
- Blocks:
1541
- output.Blocks !== undefined && output.Blocks !== null
1542
- ? deserializeAws_json1_1BlockList(output.Blocks, context)
1543
- : undefined,
1544
- DetectDocumentTextModelVersion: __expectString(output.DetectDocumentTextModelVersion),
1545
- DocumentMetadata:
1546
- output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1547
- ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1548
- : undefined,
1549
- } as any;
1550
- };
1551
-
1552
- const deserializeAws_json1_1DocumentMetadata = (output: any, context: __SerdeContext): DocumentMetadata => {
1553
- return {
1554
- Pages: __expectInt32(output.Pages),
1555
- } as any;
1556
- };
1557
-
1558
- const deserializeAws_json1_1DocumentTooLargeException = (
1559
- output: any,
1560
- context: __SerdeContext
1561
- ): DocumentTooLargeException => {
1562
- return {
1563
- Code: __expectString(output.Code),
1564
- Message: __expectString(output.Message),
1565
- } as any;
1566
- };
1567
-
1568
- const deserializeAws_json1_1EntityTypes = (output: any, context: __SerdeContext): (EntityType | string)[] => {
1569
- return (output || [])
1570
- .filter((e: any) => e != null)
1571
- .map((entry: any) => {
1572
- if (entry === null) {
1573
- return null as any;
1574
- }
1575
- return __expectString(entry) as any;
1576
- });
1577
- };
1578
-
1579
- const deserializeAws_json1_1ExpenseDetection = (output: any, context: __SerdeContext): ExpenseDetection => {
1580
- return {
1581
- Confidence: __limitedParseFloat32(output.Confidence),
1582
- Geometry:
1583
- output.Geometry !== undefined && output.Geometry !== null
1584
- ? deserializeAws_json1_1Geometry(output.Geometry, context)
1585
- : undefined,
1586
- Text: __expectString(output.Text),
1587
- } as any;
1588
- };
1589
-
1590
- const deserializeAws_json1_1ExpenseDocument = (output: any, context: __SerdeContext): ExpenseDocument => {
1591
- return {
1592
- ExpenseIndex: __expectInt32(output.ExpenseIndex),
1593
- LineItemGroups:
1594
- output.LineItemGroups !== undefined && output.LineItemGroups !== null
1595
- ? deserializeAws_json1_1LineItemGroupList(output.LineItemGroups, context)
1596
- : undefined,
1597
- SummaryFields:
1598
- output.SummaryFields !== undefined && output.SummaryFields !== null
1599
- ? deserializeAws_json1_1ExpenseFieldList(output.SummaryFields, context)
1600
- : undefined,
1601
- } as any;
1602
- };
1603
-
1604
- const deserializeAws_json1_1ExpenseDocumentList = (output: any, context: __SerdeContext): ExpenseDocument[] => {
1605
- return (output || [])
1606
- .filter((e: any) => e != null)
1607
- .map((entry: any) => {
1608
- if (entry === null) {
1609
- return null as any;
1610
- }
1611
- return deserializeAws_json1_1ExpenseDocument(entry, context);
1612
- });
1613
- };
1614
-
1615
- const deserializeAws_json1_1ExpenseField = (output: any, context: __SerdeContext): ExpenseField => {
1616
- return {
1617
- LabelDetection:
1618
- output.LabelDetection !== undefined && output.LabelDetection !== null
1619
- ? deserializeAws_json1_1ExpenseDetection(output.LabelDetection, context)
1620
- : undefined,
1621
- PageNumber: __expectInt32(output.PageNumber),
1622
- Type:
1623
- output.Type !== undefined && output.Type !== null
1624
- ? deserializeAws_json1_1ExpenseType(output.Type, context)
1625
- : undefined,
1626
- ValueDetection:
1627
- output.ValueDetection !== undefined && output.ValueDetection !== null
1628
- ? deserializeAws_json1_1ExpenseDetection(output.ValueDetection, context)
1629
- : undefined,
1630
- } as any;
1631
- };
1632
-
1633
- const deserializeAws_json1_1ExpenseFieldList = (output: any, context: __SerdeContext): ExpenseField[] => {
1634
- return (output || [])
1635
- .filter((e: any) => e != null)
1636
- .map((entry: any) => {
1637
- if (entry === null) {
1638
- return null as any;
1639
- }
1640
- return deserializeAws_json1_1ExpenseField(entry, context);
1641
- });
1642
- };
1643
-
1644
- const deserializeAws_json1_1ExpenseType = (output: any, context: __SerdeContext): ExpenseType => {
1645
- return {
1646
- Confidence: __limitedParseFloat32(output.Confidence),
1647
- Text: __expectString(output.Text),
1648
- } as any;
1649
- };
1650
-
1651
- const deserializeAws_json1_1Geometry = (output: any, context: __SerdeContext): Geometry => {
1652
- return {
1653
- BoundingBox:
1654
- output.BoundingBox !== undefined && output.BoundingBox !== null
1655
- ? deserializeAws_json1_1BoundingBox(output.BoundingBox, context)
1656
- : undefined,
1657
- Polygon:
1658
- output.Polygon !== undefined && output.Polygon !== null
1659
- ? deserializeAws_json1_1Polygon(output.Polygon, context)
1660
- : undefined,
1661
- } as any;
1662
- };
1663
-
1664
- const deserializeAws_json1_1GetDocumentAnalysisResponse = (
1665
- output: any,
1666
- context: __SerdeContext
1667
- ): GetDocumentAnalysisResponse => {
1668
- return {
1669
- AnalyzeDocumentModelVersion: __expectString(output.AnalyzeDocumentModelVersion),
1670
- Blocks:
1671
- output.Blocks !== undefined && output.Blocks !== null
1672
- ? deserializeAws_json1_1BlockList(output.Blocks, context)
1673
- : undefined,
1674
- DocumentMetadata:
1675
- output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1676
- ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1677
- : undefined,
1678
- JobStatus: __expectString(output.JobStatus),
1679
- NextToken: __expectString(output.NextToken),
1680
- StatusMessage: __expectString(output.StatusMessage),
1681
- Warnings:
1682
- output.Warnings !== undefined && output.Warnings !== null
1683
- ? deserializeAws_json1_1Warnings(output.Warnings, context)
1684
- : undefined,
1685
- } as any;
1686
- };
1687
-
1688
- const deserializeAws_json1_1GetDocumentTextDetectionResponse = (
1689
- output: any,
1690
- context: __SerdeContext
1691
- ): GetDocumentTextDetectionResponse => {
1692
- return {
1693
- Blocks:
1694
- output.Blocks !== undefined && output.Blocks !== null
1695
- ? deserializeAws_json1_1BlockList(output.Blocks, context)
1696
- : undefined,
1697
- DetectDocumentTextModelVersion: __expectString(output.DetectDocumentTextModelVersion),
1698
- DocumentMetadata:
1699
- output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1700
- ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1701
- : undefined,
1702
- JobStatus: __expectString(output.JobStatus),
1703
- NextToken: __expectString(output.NextToken),
1704
- StatusMessage: __expectString(output.StatusMessage),
1705
- Warnings:
1706
- output.Warnings !== undefined && output.Warnings !== null
1707
- ? deserializeAws_json1_1Warnings(output.Warnings, context)
1708
- : undefined,
1709
- } as any;
1710
- };
1711
-
1712
- const deserializeAws_json1_1HumanLoopActivationOutput = (
1713
- output: any,
1714
- context: __SerdeContext
1715
- ): HumanLoopActivationOutput => {
1716
- return {
1717
- HumanLoopActivationConditionsEvaluationResults:
1718
- output.HumanLoopActivationConditionsEvaluationResults !== undefined &&
1719
- output.HumanLoopActivationConditionsEvaluationResults !== null
1720
- ? new __LazyJsonString(output.HumanLoopActivationConditionsEvaluationResults)
1721
- : undefined,
1722
- HumanLoopActivationReasons:
1723
- output.HumanLoopActivationReasons !== undefined && output.HumanLoopActivationReasons !== null
1724
- ? deserializeAws_json1_1HumanLoopActivationReasons(output.HumanLoopActivationReasons, context)
1725
- : undefined,
1726
- HumanLoopArn: __expectString(output.HumanLoopArn),
1727
- } as any;
1728
- };
1729
-
1730
- const deserializeAws_json1_1HumanLoopActivationReasons = (output: any, context: __SerdeContext): string[] => {
1731
- return (output || [])
1732
- .filter((e: any) => e != null)
1733
- .map((entry: any) => {
1734
- if (entry === null) {
1735
- return null as any;
1736
- }
1737
- return __expectString(entry) as any;
1738
- });
1739
- };
1740
-
1741
- const deserializeAws_json1_1HumanLoopQuotaExceededException = (
1742
- output: any,
1743
- context: __SerdeContext
1744
- ): HumanLoopQuotaExceededException => {
1745
- return {
1746
- Code: __expectString(output.Code),
1747
- Message: __expectString(output.Message),
1748
- QuotaCode: __expectString(output.QuotaCode),
1749
- ResourceType: __expectString(output.ResourceType),
1750
- ServiceCode: __expectString(output.ServiceCode),
1751
- } as any;
1752
- };
1753
-
1754
- const deserializeAws_json1_1IdempotentParameterMismatchException = (
1755
- output: any,
1756
- context: __SerdeContext
1757
- ): IdempotentParameterMismatchException => {
1758
- return {
1759
- Code: __expectString(output.Code),
1760
- Message: __expectString(output.Message),
1761
- } as any;
1762
- };
1763
-
1764
- const deserializeAws_json1_1IdList = (output: any, context: __SerdeContext): string[] => {
1765
- return (output || [])
1766
- .filter((e: any) => e != null)
1767
- .map((entry: any) => {
1768
- if (entry === null) {
1769
- return null as any;
1770
- }
1771
- return __expectString(entry) as any;
1772
- });
1773
- };
1774
-
1775
- const deserializeAws_json1_1InternalServerError = (output: any, context: __SerdeContext): InternalServerError => {
1776
- return {
1777
- Code: __expectString(output.Code),
1778
- Message: __expectString(output.Message),
1779
- } as any;
1780
- };
1781
-
1782
- const deserializeAws_json1_1InvalidJobIdException = (output: any, context: __SerdeContext): InvalidJobIdException => {
1783
- return {
1784
- Code: __expectString(output.Code),
1785
- Message: __expectString(output.Message),
1786
- } as any;
1787
- };
1788
-
1789
- const deserializeAws_json1_1InvalidKMSKeyException = (output: any, context: __SerdeContext): InvalidKMSKeyException => {
1790
- return {
1791
- Code: __expectString(output.Code),
1792
- Message: __expectString(output.Message),
1793
- } as any;
1794
- };
1795
-
1796
- const deserializeAws_json1_1InvalidParameterException = (
1797
- output: any,
1798
- context: __SerdeContext
1799
- ): InvalidParameterException => {
1800
- return {
1801
- Code: __expectString(output.Code),
1802
- Message: __expectString(output.Message),
1803
- } as any;
1804
- };
1805
-
1806
- const deserializeAws_json1_1InvalidS3ObjectException = (
1807
- output: any,
1808
- context: __SerdeContext
1809
- ): InvalidS3ObjectException => {
1810
- return {
1811
- Code: __expectString(output.Code),
1812
- Message: __expectString(output.Message),
1813
- } as any;
1814
- };
1815
-
1816
- const deserializeAws_json1_1LimitExceededException = (output: any, context: __SerdeContext): LimitExceededException => {
1817
- return {
1818
- Code: __expectString(output.Code),
1819
- Message: __expectString(output.Message),
1820
- } as any;
1821
- };
1822
-
1823
- const deserializeAws_json1_1LineItemFields = (output: any, context: __SerdeContext): LineItemFields => {
1824
- return {
1825
- LineItemExpenseFields:
1826
- output.LineItemExpenseFields !== undefined && output.LineItemExpenseFields !== null
1827
- ? deserializeAws_json1_1ExpenseFieldList(output.LineItemExpenseFields, context)
1828
- : undefined,
1829
- } as any;
1830
- };
1831
-
1832
- const deserializeAws_json1_1LineItemGroup = (output: any, context: __SerdeContext): LineItemGroup => {
1833
- return {
1834
- LineItemGroupIndex: __expectInt32(output.LineItemGroupIndex),
1835
- LineItems:
1836
- output.LineItems !== undefined && output.LineItems !== null
1837
- ? deserializeAws_json1_1LineItemList(output.LineItems, context)
1838
- : undefined,
1839
- } as any;
1840
- };
1841
-
1842
- const deserializeAws_json1_1LineItemGroupList = (output: any, context: __SerdeContext): LineItemGroup[] => {
1843
- return (output || [])
1844
- .filter((e: any) => e != null)
1845
- .map((entry: any) => {
1846
- if (entry === null) {
1847
- return null as any;
1848
- }
1849
- return deserializeAws_json1_1LineItemGroup(entry, context);
1850
- });
1851
- };
1852
-
1853
- const deserializeAws_json1_1LineItemList = (output: any, context: __SerdeContext): LineItemFields[] => {
1854
- return (output || [])
1855
- .filter((e: any) => e != null)
1856
- .map((entry: any) => {
1857
- if (entry === null) {
1858
- return null as any;
1859
- }
1860
- return deserializeAws_json1_1LineItemFields(entry, context);
1861
- });
1862
- };
1863
-
1864
- const deserializeAws_json1_1Pages = (output: any, context: __SerdeContext): number[] => {
1865
- return (output || [])
1866
- .filter((e: any) => e != null)
1867
- .map((entry: any) => {
1868
- if (entry === null) {
1869
- return null as any;
1870
- }
1871
- return __expectInt32(entry) as any;
1872
- });
1873
- };
1874
-
1875
- const deserializeAws_json1_1Point = (output: any, context: __SerdeContext): Point => {
1876
- return {
1877
- X: __limitedParseFloat32(output.X),
1878
- Y: __limitedParseFloat32(output.Y),
1879
- } as any;
1880
- };
1881
-
1882
- const deserializeAws_json1_1Polygon = (output: any, context: __SerdeContext): Point[] => {
1883
- return (output || [])
1884
- .filter((e: any) => e != null)
1885
- .map((entry: any) => {
1886
- if (entry === null) {
1887
- return null as any;
1888
- }
1889
- return deserializeAws_json1_1Point(entry, context);
1890
- });
1891
- };
1892
-
1893
- const deserializeAws_json1_1ProvisionedThroughputExceededException = (
1894
- output: any,
1895
- context: __SerdeContext
1896
- ): ProvisionedThroughputExceededException => {
1897
- return {
1898
- Code: __expectString(output.Code),
1899
- Message: __expectString(output.Message),
1900
- } as any;
1901
- };
1902
-
1903
- const deserializeAws_json1_1Relationship = (output: any, context: __SerdeContext): Relationship => {
1904
- return {
1905
- Ids:
1906
- output.Ids !== undefined && output.Ids !== null ? deserializeAws_json1_1IdList(output.Ids, context) : undefined,
1907
- Type: __expectString(output.Type),
1908
- } as any;
1909
- };
1910
-
1911
- const deserializeAws_json1_1RelationshipList = (output: any, context: __SerdeContext): Relationship[] => {
1912
- return (output || [])
1913
- .filter((e: any) => e != null)
1914
- .map((entry: any) => {
1915
- if (entry === null) {
1916
- return null as any;
1917
- }
1918
- return deserializeAws_json1_1Relationship(entry, context);
1919
- });
1920
- };
1921
-
1922
- const deserializeAws_json1_1StartDocumentAnalysisResponse = (
1923
- output: any,
1924
- context: __SerdeContext
1925
- ): StartDocumentAnalysisResponse => {
1926
- return {
1927
- JobId: __expectString(output.JobId),
1928
- } as any;
1929
- };
1930
-
1931
- const deserializeAws_json1_1StartDocumentTextDetectionResponse = (
1932
- output: any,
1933
- context: __SerdeContext
1934
- ): StartDocumentTextDetectionResponse => {
1935
- return {
1936
- JobId: __expectString(output.JobId),
1937
- } as any;
1938
- };
1939
-
1940
- const deserializeAws_json1_1ThrottlingException = (output: any, context: __SerdeContext): ThrottlingException => {
1941
- return {
1942
- Code: __expectString(output.Code),
1943
- Message: __expectString(output.Message),
1944
- } as any;
1945
- };
1946
-
1947
- const deserializeAws_json1_1UnsupportedDocumentException = (
1948
- output: any,
1949
- context: __SerdeContext
1950
- ): UnsupportedDocumentException => {
1951
- return {
1952
- Code: __expectString(output.Code),
1953
- Message: __expectString(output.Message),
1954
- } as any;
1955
- };
1956
-
1957
- const deserializeAws_json1_1Warning = (output: any, context: __SerdeContext): Warning => {
1958
- return {
1959
- ErrorCode: __expectString(output.ErrorCode),
1960
- Pages:
1961
- output.Pages !== undefined && output.Pages !== null
1962
- ? deserializeAws_json1_1Pages(output.Pages, context)
1963
- : undefined,
1964
- } as any;
1965
- };
1966
-
1967
- const deserializeAws_json1_1Warnings = (output: any, context: __SerdeContext): Warning[] => {
1968
- return (output || [])
1969
- .filter((e: any) => e != null)
1970
- .map((entry: any) => {
1971
- if (entry === null) {
1972
- return null as any;
1973
- }
1974
- return deserializeAws_json1_1Warning(entry, context);
1975
- });
1976
- };
1977
-
1978
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
1979
- httpStatusCode: output.statusCode,
1980
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1981
- extendedRequestId: output.headers["x-amz-id-2"],
1982
- cfId: output.headers["x-amz-cf-id"],
1983
- });
1984
-
1985
- // Collect low-level response body stream to Uint8Array.
1986
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
1987
- if (streamBody instanceof Uint8Array) {
1988
- return Promise.resolve(streamBody);
1989
- }
1990
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1991
- };
1992
-
1993
- // Encode Uint8Array data into string with utf-8.
1994
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
1995
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1996
-
1997
- const buildHttpRpcRequest = async (
1998
- context: __SerdeContext,
1999
- headers: __HeaderBag,
2000
- path: string,
2001
- resolvedHostname: string | undefined,
2002
- body: any
2003
- ): Promise<__HttpRequest> => {
2004
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
2005
- const contents: any = {
2006
- protocol,
2007
- hostname,
2008
- port,
2009
- method: "POST",
2010
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
2011
- headers,
2012
- };
2013
- if (resolvedHostname !== undefined) {
2014
- contents.hostname = resolvedHostname;
2015
- }
2016
- if (body !== undefined) {
2017
- contents.body = body;
2018
- }
2019
- return new __HttpRequest(contents);
2020
- };
2021
-
2022
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
2023
- collectBodyString(streamBody, context).then((encoded) => {
2024
- if (encoded.length) {
2025
- return JSON.parse(encoded);
2026
- }
2027
- return {};
2028
- });
2029
-
2030
- /**
2031
- * Load an error code for the aws.rest-json-1.1 protocol.
2032
- */
2033
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
2034
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
2035
-
2036
- const sanitizeErrorCode = (rawValue: string): string => {
2037
- let cleanValue = rawValue;
2038
- if (cleanValue.indexOf(":") >= 0) {
2039
- cleanValue = cleanValue.split(":")[0];
2040
- }
2041
- if (cleanValue.indexOf("#") >= 0) {
2042
- cleanValue = cleanValue.split("#")[1];
2043
- }
2044
- return cleanValue;
2045
- };
2046
-
2047
- const headerKey = findKey(output.headers, "x-amzn-errortype");
2048
- if (headerKey !== undefined) {
2049
- return sanitizeErrorCode(output.headers[headerKey]);
2050
- }
2051
-
2052
- if (data.code !== undefined) {
2053
- return sanitizeErrorCode(data.code);
2054
- }
2055
-
2056
- if (data["__type"] !== undefined) {
2057
- return sanitizeErrorCode(data["__type"]);
2058
- }
2059
-
2060
- return "";
2061
- };