@aws-sdk/client-textract 3.39.0 → 3.43.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 (45) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist-cjs/Textract.js +15 -0
  3. package/dist-cjs/commands/AnalyzeIDCommand.js +36 -0
  4. package/dist-cjs/commands/index.js +1 -0
  5. package/dist-cjs/endpoints.js +151 -26
  6. package/dist-cjs/models/models_0.js +42 -2
  7. package/dist-cjs/protocols/Aws_json1_1.js +204 -1
  8. package/dist-cjs/runtimeConfig.browser.js +6 -3
  9. package/dist-cjs/runtimeConfig.js +5 -3
  10. package/dist-es/Textract.js +15 -0
  11. package/dist-es/commands/AnalyzeIDCommand.js +39 -0
  12. package/dist-es/commands/index.js +1 -0
  13. package/dist-es/endpoints.js +151 -26
  14. package/dist-es/models/models_0.js +28 -0
  15. package/dist-es/protocols/Aws_json1_1.js +211 -0
  16. package/dist-es/runtimeConfig.browser.js +3 -2
  17. package/dist-es/runtimeConfig.js +3 -3
  18. package/dist-types/Textract.d.ts +11 -1
  19. package/dist-types/TextractClient.d.ts +11 -2
  20. package/dist-types/commands/AnalyzeDocumentCommand.d.ts +1 -1
  21. package/dist-types/commands/AnalyzeExpenseCommand.d.ts +3 -2
  22. package/dist-types/commands/AnalyzeIDCommand.d.ts +37 -0
  23. package/dist-types/commands/DetectDocumentTextCommand.d.ts +1 -1
  24. package/dist-types/commands/GetDocumentAnalysisCommand.d.ts +1 -1
  25. package/dist-types/commands/GetDocumentTextDetectionCommand.d.ts +1 -1
  26. package/dist-types/commands/GetExpenseAnalysisCommand.d.ts +1 -1
  27. package/dist-types/commands/StartDocumentAnalysisCommand.d.ts +1 -1
  28. package/dist-types/commands/StartDocumentTextDetectionCommand.d.ts +1 -1
  29. package/dist-types/commands/StartExpenseAnalysisCommand.d.ts +1 -1
  30. package/dist-types/commands/index.d.ts +1 -0
  31. package/dist-types/models/models_0.d.ts +123 -2
  32. package/dist-types/protocols/Aws_json1_1.d.ts +3 -0
  33. package/dist-types/runtimeConfig.browser.d.ts +2 -0
  34. package/dist-types/runtimeConfig.d.ts +2 -0
  35. package/dist-types/runtimeConfig.native.d.ts +2 -0
  36. package/dist-types/ts3.4/Textract.d.ts +5 -0
  37. package/dist-types/ts3.4/TextractClient.d.ts +7 -2
  38. package/dist-types/ts3.4/commands/AnalyzeIDCommand.d.ts +17 -0
  39. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  40. package/dist-types/ts3.4/models/models_0.d.ts +69 -0
  41. package/dist-types/ts3.4/protocols/Aws_json1_1.d.ts +3 -0
  42. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -0
  43. package/dist-types/ts3.4/runtimeConfig.d.ts +2 -0
  44. package/dist-types/ts3.4/runtimeConfig.native.d.ts +2 -0
  45. package/package.json +23 -23
@@ -4,6 +4,7 @@ exports.getRuntimeConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
6
  const sha256_browser_1 = require("@aws-crypto/sha256-browser");
7
+ const config_resolver_1 = require("@aws-sdk/config-resolver");
7
8
  const fetch_http_handler_1 = require("@aws-sdk/fetch-http-handler");
8
9
  const invalid_dependency_1 = require("@aws-sdk/invalid-dependency");
9
10
  const middleware_retry_1 = require("@aws-sdk/middleware-retry");
@@ -13,7 +14,7 @@ const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
13
14
  const util_utf8_browser_1 = require("@aws-sdk/util-utf8-browser");
14
15
  const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
15
16
  const getRuntimeConfig = (config) => {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
17
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17
18
  const clientSharedValues = runtimeConfig_shared_1.getRuntimeConfig(config);
18
19
  return {
19
20
  ...clientSharedValues,
@@ -30,8 +31,10 @@ const getRuntimeConfig = (config) => {
30
31
  retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : (() => Promise.resolve(middleware_retry_1.DEFAULT_RETRY_MODE)),
31
32
  sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : sha256_browser_1.Sha256,
32
33
  streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : fetch_http_handler_1.streamCollector,
33
- utf8Decoder: (_m = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _m !== void 0 ? _m : util_utf8_browser_1.fromUtf8,
34
- utf8Encoder: (_o = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _o !== void 0 ? _o : util_utf8_browser_1.toUtf8,
34
+ useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
35
+ useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
36
+ utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : util_utf8_browser_1.fromUtf8,
37
+ utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : util_utf8_browser_1.toUtf8,
35
38
  };
36
39
  };
37
40
  exports.getRuntimeConfig = getRuntimeConfig;
@@ -17,7 +17,7 @@ const util_utf8_node_1 = require("@aws-sdk/util-utf8-node");
17
17
  const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
18
18
  const smithy_client_1 = require("@aws-sdk/smithy-client");
19
19
  const getRuntimeConfig = (config) => {
20
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
20
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
21
21
  smithy_client_1.emitWarningIfUnsupportedVersion(process.version);
22
22
  const clientSharedValues = runtimeConfig_shared_1.getRuntimeConfig(config);
23
23
  return {
@@ -35,8 +35,10 @@ const getRuntimeConfig = (config) => {
35
35
  retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : node_config_provider_1.loadConfig(middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS),
36
36
  sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : hash_node_1.Hash.bind(null, "sha256"),
37
37
  streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : node_http_handler_1.streamCollector,
38
- utf8Decoder: (_m = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _m !== void 0 ? _m : util_utf8_node_1.fromUtf8,
39
- utf8Encoder: (_o = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _o !== void 0 ? _o : util_utf8_node_1.toUtf8,
38
+ useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : node_config_provider_1.loadConfig(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
39
+ useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : node_config_provider_1.loadConfig(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
40
+ utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : util_utf8_node_1.fromUtf8,
41
+ utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : util_utf8_node_1.toUtf8,
40
42
  };
41
43
  };
42
44
  exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,6 +1,7 @@
1
1
  import { __extends } from "tslib";
2
2
  import { AnalyzeDocumentCommand, } from "./commands/AnalyzeDocumentCommand";
3
3
  import { AnalyzeExpenseCommand, } from "./commands/AnalyzeExpenseCommand";
4
+ import { AnalyzeIDCommand } from "./commands/AnalyzeIDCommand";
4
5
  import { DetectDocumentTextCommand, } from "./commands/DetectDocumentTextCommand";
5
6
  import { GetDocumentAnalysisCommand, } from "./commands/GetDocumentAnalysisCommand";
6
7
  import { GetDocumentTextDetectionCommand, } from "./commands/GetDocumentTextDetectionCommand";
@@ -42,6 +43,20 @@ var Textract = (function (_super) {
42
43
  return this.send(command, optionsOrCb);
43
44
  }
44
45
  };
46
+ Textract.prototype.analyzeID = function (args, optionsOrCb, cb) {
47
+ var command = new AnalyzeIDCommand(args);
48
+ if (typeof optionsOrCb === "function") {
49
+ this.send(command, optionsOrCb);
50
+ }
51
+ else if (typeof cb === "function") {
52
+ if (typeof optionsOrCb !== "object")
53
+ throw new Error("Expect http options but get " + typeof optionsOrCb);
54
+ this.send(command, optionsOrCb || {}, cb);
55
+ }
56
+ else {
57
+ return this.send(command, optionsOrCb);
58
+ }
59
+ };
45
60
  Textract.prototype.detectDocumentText = function (args, optionsOrCb, cb) {
46
61
  var command = new DetectDocumentTextCommand(args);
47
62
  if (typeof optionsOrCb === "function") {
@@ -0,0 +1,39 @@
1
+ import { __extends } from "tslib";
2
+ import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
+ import { Command as $Command } from "@aws-sdk/smithy-client";
4
+ import { AnalyzeIDRequest, AnalyzeIDResponse } from "../models/models_0";
5
+ import { deserializeAws_json1_1AnalyzeIDCommand, serializeAws_json1_1AnalyzeIDCommand } from "../protocols/Aws_json1_1";
6
+ var AnalyzeIDCommand = (function (_super) {
7
+ __extends(AnalyzeIDCommand, _super);
8
+ function AnalyzeIDCommand(input) {
9
+ var _this = _super.call(this) || this;
10
+ _this.input = input;
11
+ return _this;
12
+ }
13
+ AnalyzeIDCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
14
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
15
+ var stack = clientStack.concat(this.middlewareStack);
16
+ var logger = configuration.logger;
17
+ var clientName = "TextractClient";
18
+ var commandName = "AnalyzeIDCommand";
19
+ var handlerExecutionContext = {
20
+ logger: logger,
21
+ clientName: clientName,
22
+ commandName: commandName,
23
+ inputFilterSensitiveLog: AnalyzeIDRequest.filterSensitiveLog,
24
+ outputFilterSensitiveLog: AnalyzeIDResponse.filterSensitiveLog,
25
+ };
26
+ var requestHandler = configuration.requestHandler;
27
+ return stack.resolve(function (request) {
28
+ return requestHandler.handle(request.request, options || {});
29
+ }, handlerExecutionContext);
30
+ };
31
+ AnalyzeIDCommand.prototype.serialize = function (input, context) {
32
+ return serializeAws_json1_1AnalyzeIDCommand(input, context);
33
+ };
34
+ AnalyzeIDCommand.prototype.deserialize = function (output, context) {
35
+ return deserializeAws_json1_1AnalyzeIDCommand(output, context);
36
+ };
37
+ return AnalyzeIDCommand;
38
+ }($Command));
39
+ export { AnalyzeIDCommand };
@@ -1,5 +1,6 @@
1
1
  export * from "./AnalyzeDocumentCommand";
2
2
  export * from "./AnalyzeExpenseCommand";
3
+ export * from "./AnalyzeIDCommand";
3
4
  export * from "./DetectDocumentTextCommand";
4
5
  export * from "./GetDocumentAnalysisCommand";
5
6
  export * from "./GetDocumentTextDetectionCommand";
@@ -1,33 +1,89 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { getRegionInfo } from "@aws-sdk/config-resolver";
3
3
  var regionHash = {
4
- "fips-ca-central-1": {
5
- hostname: "textract-fips.ca-central-1.amazonaws.com",
6
- signingRegion: "ca-central-1",
4
+ "ca-central-1": {
5
+ variants: [
6
+ {
7
+ hostname: "textract.ca-central-1.amazonaws.com",
8
+ tags: [],
9
+ },
10
+ {
11
+ hostname: "textract-fips.ca-central-1.amazonaws.com",
12
+ tags: ["fips"],
13
+ },
14
+ ],
7
15
  },
8
- "fips-us-east-1": {
9
- hostname: "textract-fips.us-east-1.amazonaws.com",
10
- signingRegion: "us-east-1",
16
+ "us-east-1": {
17
+ variants: [
18
+ {
19
+ hostname: "textract.us-east-1.amazonaws.com",
20
+ tags: [],
21
+ },
22
+ {
23
+ hostname: "textract-fips.us-east-1.amazonaws.com",
24
+ tags: ["fips"],
25
+ },
26
+ ],
11
27
  },
12
- "fips-us-east-2": {
13
- hostname: "textract-fips.us-east-2.amazonaws.com",
14
- signingRegion: "us-east-2",
28
+ "us-east-2": {
29
+ variants: [
30
+ {
31
+ hostname: "textract.us-east-2.amazonaws.com",
32
+ tags: [],
33
+ },
34
+ {
35
+ hostname: "textract-fips.us-east-2.amazonaws.com",
36
+ tags: ["fips"],
37
+ },
38
+ ],
15
39
  },
16
- "fips-us-gov-east-1": {
17
- hostname: "textract-fips.us-gov-east-1.amazonaws.com",
18
- signingRegion: "us-gov-east-1",
40
+ "us-gov-east-1": {
41
+ variants: [
42
+ {
43
+ hostname: "textract.us-gov-east-1.amazonaws.com",
44
+ tags: [],
45
+ },
46
+ {
47
+ hostname: "textract-fips.us-gov-east-1.amazonaws.com",
48
+ tags: ["fips"],
49
+ },
50
+ ],
19
51
  },
20
- "fips-us-gov-west-1": {
21
- hostname: "textract-fips.us-gov-west-1.amazonaws.com",
22
- signingRegion: "us-gov-west-1",
52
+ "us-gov-west-1": {
53
+ variants: [
54
+ {
55
+ hostname: "textract.us-gov-west-1.amazonaws.com",
56
+ tags: [],
57
+ },
58
+ {
59
+ hostname: "textract-fips.us-gov-west-1.amazonaws.com",
60
+ tags: ["fips"],
61
+ },
62
+ ],
23
63
  },
24
- "fips-us-west-1": {
25
- hostname: "textract-fips.us-west-1.amazonaws.com",
26
- signingRegion: "us-west-1",
64
+ "us-west-1": {
65
+ variants: [
66
+ {
67
+ hostname: "textract.us-west-1.amazonaws.com",
68
+ tags: [],
69
+ },
70
+ {
71
+ hostname: "textract-fips.us-west-1.amazonaws.com",
72
+ tags: ["fips"],
73
+ },
74
+ ],
27
75
  },
28
- "fips-us-west-2": {
29
- hostname: "textract-fips.us-west-2.amazonaws.com",
30
- signingRegion: "us-west-2",
76
+ "us-west-2": {
77
+ variants: [
78
+ {
79
+ hostname: "textract.us-west-2.amazonaws.com",
80
+ tags: [],
81
+ },
82
+ {
83
+ hostname: "textract-fips.us-west-2.amazonaws.com",
84
+ tags: ["fips"],
85
+ },
86
+ ],
31
87
  },
32
88
  };
33
89
  var partitionHash = {
@@ -61,27 +117,96 @@ var partitionHash = {
61
117
  "us-west-2",
62
118
  ],
63
119
  regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",
64
- hostname: "textract.{region}.amazonaws.com",
120
+ variants: [
121
+ {
122
+ hostname: "textract.{region}.amazonaws.com",
123
+ tags: [],
124
+ },
125
+ {
126
+ hostname: "textract-fips.{region}.amazonaws.com",
127
+ tags: ["fips"],
128
+ },
129
+ {
130
+ hostname: "textract-fips.{region}.api.aws",
131
+ tags: ["dualstack", "fips"],
132
+ },
133
+ {
134
+ hostname: "textract.{region}.api.aws",
135
+ tags: ["dualstack"],
136
+ },
137
+ ],
65
138
  },
66
139
  "aws-cn": {
67
140
  regions: ["cn-north-1", "cn-northwest-1"],
68
141
  regionRegex: "^cn\\-\\w+\\-\\d+$",
69
- hostname: "textract.{region}.amazonaws.com.cn",
142
+ variants: [
143
+ {
144
+ hostname: "textract.{region}.amazonaws.com.cn",
145
+ tags: [],
146
+ },
147
+ {
148
+ hostname: "textract-fips.{region}.amazonaws.com.cn",
149
+ tags: ["fips"],
150
+ },
151
+ {
152
+ hostname: "textract-fips.{region}.api.amazonwebservices.com.cn",
153
+ tags: ["dualstack", "fips"],
154
+ },
155
+ {
156
+ hostname: "textract.{region}.api.amazonwebservices.com.cn",
157
+ tags: ["dualstack"],
158
+ },
159
+ ],
70
160
  },
71
161
  "aws-iso": {
72
162
  regions: ["us-iso-east-1", "us-iso-west-1"],
73
163
  regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
74
- hostname: "textract.{region}.c2s.ic.gov",
164
+ variants: [
165
+ {
166
+ hostname: "textract.{region}.c2s.ic.gov",
167
+ tags: [],
168
+ },
169
+ {
170
+ hostname: "textract-fips.{region}.c2s.ic.gov",
171
+ tags: ["fips"],
172
+ },
173
+ ],
75
174
  },
76
175
  "aws-iso-b": {
77
176
  regions: ["us-isob-east-1"],
78
177
  regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
79
- hostname: "textract.{region}.sc2s.sgov.gov",
178
+ variants: [
179
+ {
180
+ hostname: "textract.{region}.sc2s.sgov.gov",
181
+ tags: [],
182
+ },
183
+ {
184
+ hostname: "textract-fips.{region}.sc2s.sgov.gov",
185
+ tags: ["fips"],
186
+ },
187
+ ],
80
188
  },
81
189
  "aws-us-gov": {
82
190
  regions: ["fips-us-gov-east-1", "fips-us-gov-west-1", "us-gov-east-1", "us-gov-west-1"],
83
191
  regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
84
- hostname: "textract.{region}.amazonaws.com",
192
+ variants: [
193
+ {
194
+ hostname: "textract.{region}.amazonaws.com",
195
+ tags: [],
196
+ },
197
+ {
198
+ hostname: "textract-fips.{region}.amazonaws.com",
199
+ tags: ["fips"],
200
+ },
201
+ {
202
+ hostname: "textract-fips.{region}.api.aws",
203
+ tags: ["dualstack", "fips"],
204
+ },
205
+ {
206
+ hostname: "textract.{region}.api.aws",
207
+ tags: ["dualstack"],
208
+ },
209
+ ],
85
210
  },
86
211
  };
87
212
  export var defaultRegionInfoProvider = function (region, options) { return __awaiter(void 0, void 0, void 0, function () {
@@ -164,6 +164,34 @@ export var AnalyzeExpenseResponse;
164
164
  (function (AnalyzeExpenseResponse) {
165
165
  AnalyzeExpenseResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
166
166
  })(AnalyzeExpenseResponse || (AnalyzeExpenseResponse = {}));
167
+ export var AnalyzeIDRequest;
168
+ (function (AnalyzeIDRequest) {
169
+ AnalyzeIDRequest.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
170
+ })(AnalyzeIDRequest || (AnalyzeIDRequest = {}));
171
+ export var ValueType;
172
+ (function (ValueType) {
173
+ ValueType["DATE"] = "DATE";
174
+ })(ValueType || (ValueType = {}));
175
+ export var NormalizedValue;
176
+ (function (NormalizedValue) {
177
+ NormalizedValue.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
178
+ })(NormalizedValue || (NormalizedValue = {}));
179
+ export var AnalyzeIDDetections;
180
+ (function (AnalyzeIDDetections) {
181
+ AnalyzeIDDetections.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
182
+ })(AnalyzeIDDetections || (AnalyzeIDDetections = {}));
183
+ export var IdentityDocumentField;
184
+ (function (IdentityDocumentField) {
185
+ IdentityDocumentField.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
186
+ })(IdentityDocumentField || (IdentityDocumentField = {}));
187
+ export var IdentityDocument;
188
+ (function (IdentityDocument) {
189
+ IdentityDocument.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
190
+ })(IdentityDocument || (IdentityDocument = {}));
191
+ export var AnalyzeIDResponse;
192
+ (function (AnalyzeIDResponse) {
193
+ AnalyzeIDResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
194
+ })(AnalyzeIDResponse || (AnalyzeIDResponse = {}));
167
195
  export var DetectDocumentTextRequest;
168
196
  (function (DetectDocumentTextRequest) {
169
197
  DetectDocumentTextRequest.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
@@ -23,6 +23,17 @@ export var serializeAws_json1_1AnalyzeExpenseCommand = function (input, context)
23
23
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
24
24
  });
25
25
  }); };
26
+ export var serializeAws_json1_1AnalyzeIDCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
27
+ var headers, body;
28
+ return __generator(this, function (_a) {
29
+ headers = {
30
+ "content-type": "application/x-amz-json-1.1",
31
+ "x-amz-target": "Textract.AnalyzeID",
32
+ };
33
+ body = JSON.stringify(serializeAws_json1_1AnalyzeIDRequest(input, context));
34
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
35
+ });
36
+ }); };
26
37
  export var serializeAws_json1_1DetectDocumentTextCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
27
38
  var headers, body;
28
39
  return __generator(this, function (_a) {
@@ -348,6 +359,126 @@ var deserializeAws_json1_1AnalyzeExpenseCommandError = function (output, context
348
359
  }
349
360
  });
350
361
  }); };
362
+ export var deserializeAws_json1_1AnalyzeIDCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
363
+ var data, contents, response;
364
+ return __generator(this, function (_a) {
365
+ switch (_a.label) {
366
+ case 0:
367
+ if (output.statusCode >= 300) {
368
+ return [2, deserializeAws_json1_1AnalyzeIDCommandError(output, context)];
369
+ }
370
+ return [4, parseBody(output.body, context)];
371
+ case 1:
372
+ data = _a.sent();
373
+ contents = {};
374
+ contents = deserializeAws_json1_1AnalyzeIDResponse(data, context);
375
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
376
+ return [2, Promise.resolve(response)];
377
+ }
378
+ });
379
+ }); };
380
+ var deserializeAws_json1_1AnalyzeIDCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
381
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, parsedBody, message;
382
+ var _m;
383
+ return __generator(this, function (_o) {
384
+ switch (_o.label) {
385
+ case 0:
386
+ _a = [__assign({}, output)];
387
+ _m = {};
388
+ return [4, parseBody(output.body, context)];
389
+ case 1:
390
+ parsedOutput = __assign.apply(void 0, _a.concat([(_m.body = _o.sent(), _m)]));
391
+ errorCode = "UnknownError";
392
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
393
+ _b = errorCode;
394
+ switch (_b) {
395
+ case "AccessDeniedException": return [3, 2];
396
+ case "com.amazonaws.textract#AccessDeniedException": return [3, 2];
397
+ case "BadDocumentException": return [3, 4];
398
+ case "com.amazonaws.textract#BadDocumentException": return [3, 4];
399
+ case "DocumentTooLargeException": return [3, 6];
400
+ case "com.amazonaws.textract#DocumentTooLargeException": return [3, 6];
401
+ case "InternalServerError": return [3, 8];
402
+ case "com.amazonaws.textract#InternalServerError": return [3, 8];
403
+ case "InvalidParameterException": return [3, 10];
404
+ case "com.amazonaws.textract#InvalidParameterException": return [3, 10];
405
+ case "InvalidS3ObjectException": return [3, 12];
406
+ case "com.amazonaws.textract#InvalidS3ObjectException": return [3, 12];
407
+ case "ProvisionedThroughputExceededException": return [3, 14];
408
+ case "com.amazonaws.textract#ProvisionedThroughputExceededException": return [3, 14];
409
+ case "ThrottlingException": return [3, 16];
410
+ case "com.amazonaws.textract#ThrottlingException": return [3, 16];
411
+ case "UnsupportedDocumentException": return [3, 18];
412
+ case "com.amazonaws.textract#UnsupportedDocumentException": return [3, 18];
413
+ }
414
+ return [3, 20];
415
+ case 2:
416
+ _c = [{}];
417
+ return [4, deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)];
418
+ case 3:
419
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
420
+ return [3, 21];
421
+ case 4:
422
+ _d = [{}];
423
+ return [4, deserializeAws_json1_1BadDocumentExceptionResponse(parsedOutput, context)];
424
+ case 5:
425
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
426
+ return [3, 21];
427
+ case 6:
428
+ _e = [{}];
429
+ return [4, deserializeAws_json1_1DocumentTooLargeExceptionResponse(parsedOutput, context)];
430
+ case 7:
431
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
432
+ return [3, 21];
433
+ case 8:
434
+ _f = [{}];
435
+ return [4, deserializeAws_json1_1InternalServerErrorResponse(parsedOutput, context)];
436
+ case 9:
437
+ response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
438
+ return [3, 21];
439
+ case 10:
440
+ _g = [{}];
441
+ return [4, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
442
+ case 11:
443
+ response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
444
+ return [3, 21];
445
+ case 12:
446
+ _h = [{}];
447
+ return [4, deserializeAws_json1_1InvalidS3ObjectExceptionResponse(parsedOutput, context)];
448
+ case 13:
449
+ response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
450
+ return [3, 21];
451
+ case 14:
452
+ _j = [{}];
453
+ return [4, deserializeAws_json1_1ProvisionedThroughputExceededExceptionResponse(parsedOutput, context)];
454
+ case 15:
455
+ response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
456
+ return [3, 21];
457
+ case 16:
458
+ _k = [{}];
459
+ return [4, deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)];
460
+ case 17:
461
+ response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
462
+ return [3, 21];
463
+ case 18:
464
+ _l = [{}];
465
+ return [4, deserializeAws_json1_1UnsupportedDocumentExceptionResponse(parsedOutput, context)];
466
+ case 19:
467
+ response = __assign.apply(void 0, [__assign.apply(void 0, _l.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
468
+ return [3, 21];
469
+ case 20:
470
+ parsedBody = parsedOutput.body;
471
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
472
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
473
+ _o.label = 21;
474
+ case 21:
475
+ message = response.message || response.Message || errorCode;
476
+ response.message = message;
477
+ delete response.Message;
478
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
479
+ }
480
+ });
481
+ }); };
351
482
  export var deserializeAws_json1_1DetectDocumentTextCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
352
483
  var data, contents, response;
353
484
  return __generator(this, function (_a) {
@@ -1374,6 +1505,12 @@ var serializeAws_json1_1AnalyzeExpenseRequest = function (input, context) {
1374
1505
  return __assign({}, (input.Document !== undefined &&
1375
1506
  input.Document !== null && { Document: serializeAws_json1_1Document(input.Document, context) }));
1376
1507
  };
1508
+ var serializeAws_json1_1AnalyzeIDRequest = function (input, context) {
1509
+ return __assign({}, (input.DocumentPages !== undefined &&
1510
+ input.DocumentPages !== null && {
1511
+ DocumentPages: serializeAws_json1_1DocumentPages(input.DocumentPages, context),
1512
+ }));
1513
+ };
1377
1514
  var serializeAws_json1_1ContentClassifiers = function (input, context) {
1378
1515
  return input
1379
1516
  .filter(function (e) { return e != null; })
@@ -1396,6 +1533,16 @@ var serializeAws_json1_1DocumentLocation = function (input, context) {
1396
1533
  return __assign({}, (input.S3Object !== undefined &&
1397
1534
  input.S3Object !== null && { S3Object: serializeAws_json1_1S3Object(input.S3Object, context) }));
1398
1535
  };
1536
+ var serializeAws_json1_1DocumentPages = function (input, context) {
1537
+ return input
1538
+ .filter(function (e) { return e != null; })
1539
+ .map(function (entry) {
1540
+ if (entry === null) {
1541
+ return null;
1542
+ }
1543
+ return serializeAws_json1_1Document(entry, context);
1544
+ });
1545
+ };
1399
1546
  var serializeAws_json1_1FeatureTypes = function (input, context) {
1400
1547
  return input
1401
1548
  .filter(function (e) { return e != null; })
@@ -1501,6 +1648,26 @@ var deserializeAws_json1_1AnalyzeExpenseResponse = function (output, context) {
1501
1648
  : undefined,
1502
1649
  };
1503
1650
  };
1651
+ var deserializeAws_json1_1AnalyzeIDDetections = function (output, context) {
1652
+ return {
1653
+ Confidence: __limitedParseFloat32(output.Confidence),
1654
+ NormalizedValue: output.NormalizedValue !== undefined && output.NormalizedValue !== null
1655
+ ? deserializeAws_json1_1NormalizedValue(output.NormalizedValue, context)
1656
+ : undefined,
1657
+ Text: __expectString(output.Text),
1658
+ };
1659
+ };
1660
+ var deserializeAws_json1_1AnalyzeIDResponse = function (output, context) {
1661
+ return {
1662
+ AnalyzeIDModelVersion: __expectString(output.AnalyzeIDModelVersion),
1663
+ DocumentMetadata: output.DocumentMetadata !== undefined && output.DocumentMetadata !== null
1664
+ ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
1665
+ : undefined,
1666
+ IdentityDocuments: output.IdentityDocuments !== undefined && output.IdentityDocuments !== null
1667
+ ? deserializeAws_json1_1IdentityDocumentList(output.IdentityDocuments, context)
1668
+ : undefined,
1669
+ };
1670
+ };
1504
1671
  var deserializeAws_json1_1BadDocumentException = function (output, context) {
1505
1672
  return {
1506
1673
  Code: __expectString(output.Code),
@@ -1739,6 +1906,44 @@ var deserializeAws_json1_1IdempotentParameterMismatchException = function (outpu
1739
1906
  Message: __expectString(output.Message),
1740
1907
  };
1741
1908
  };
1909
+ var deserializeAws_json1_1IdentityDocument = function (output, context) {
1910
+ return {
1911
+ DocumentIndex: __expectInt32(output.DocumentIndex),
1912
+ IdentityDocumentFields: output.IdentityDocumentFields !== undefined && output.IdentityDocumentFields !== null
1913
+ ? deserializeAws_json1_1IdentityDocumentFieldList(output.IdentityDocumentFields, context)
1914
+ : undefined,
1915
+ };
1916
+ };
1917
+ var deserializeAws_json1_1IdentityDocumentField = function (output, context) {
1918
+ return {
1919
+ Type: output.Type !== undefined && output.Type !== null
1920
+ ? deserializeAws_json1_1AnalyzeIDDetections(output.Type, context)
1921
+ : undefined,
1922
+ ValueDetection: output.ValueDetection !== undefined && output.ValueDetection !== null
1923
+ ? deserializeAws_json1_1AnalyzeIDDetections(output.ValueDetection, context)
1924
+ : undefined,
1925
+ };
1926
+ };
1927
+ var deserializeAws_json1_1IdentityDocumentFieldList = function (output, context) {
1928
+ return (output || [])
1929
+ .filter(function (e) { return e != null; })
1930
+ .map(function (entry) {
1931
+ if (entry === null) {
1932
+ return null;
1933
+ }
1934
+ return deserializeAws_json1_1IdentityDocumentField(entry, context);
1935
+ });
1936
+ };
1937
+ var deserializeAws_json1_1IdentityDocumentList = function (output, context) {
1938
+ return (output || [])
1939
+ .filter(function (e) { return e != null; })
1940
+ .map(function (entry) {
1941
+ if (entry === null) {
1942
+ return null;
1943
+ }
1944
+ return deserializeAws_json1_1IdentityDocument(entry, context);
1945
+ });
1946
+ };
1742
1947
  var deserializeAws_json1_1IdList = function (output, context) {
1743
1948
  return (output || [])
1744
1949
  .filter(function (e) { return e != null; })
@@ -1820,6 +2025,12 @@ var deserializeAws_json1_1LineItemList = function (output, context) {
1820
2025
  return deserializeAws_json1_1LineItemFields(entry, context);
1821
2026
  });
1822
2027
  };
2028
+ var deserializeAws_json1_1NormalizedValue = function (output, context) {
2029
+ return {
2030
+ Value: __expectString(output.Value),
2031
+ ValueType: __expectString(output.ValueType),
2032
+ };
2033
+ };
1823
2034
  var deserializeAws_json1_1Pages = function (output, context) {
1824
2035
  return (output || [])
1825
2036
  .filter(function (e) { return e != null; })
@@ -1,6 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  import packageInfo from "../package.json";
3
3
  import { Sha256 } from "@aws-crypto/sha256-browser";
4
+ import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
4
5
  import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
5
6
  import { invalidProvider } from "@aws-sdk/invalid-dependency";
6
7
  import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
@@ -10,7 +11,7 @@ import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
10
11
  import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
11
12
  import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
12
13
  export var getRuntimeConfig = function (config) {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
14
15
  var clientSharedValues = getSharedRuntimeConfig(config);
15
- return __assign(__assign(__assign({}, clientSharedValues), config), { runtime: "browser", base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : fromBase64, base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : toBase64, bodyLengthChecker: (_c = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _c !== void 0 ? _c : calculateBodyLength, credentialDefaultProvider: (_d = config === null || config === void 0 ? void 0 : config.credentialDefaultProvider) !== null && _d !== void 0 ? _d : (function (_) { return function () { return Promise.reject(new Error("Credential is missing")); }; }), defaultUserAgentProvider: (_e = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _e !== void 0 ? _e : defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), maxAttempts: (_f = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _f !== void 0 ? _f : DEFAULT_MAX_ATTEMPTS, region: (_g = config === null || config === void 0 ? void 0 : config.region) !== null && _g !== void 0 ? _g : invalidProvider("Region is missing"), requestHandler: (_h = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _h !== void 0 ? _h : new FetchHttpHandler(), retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : (function () { return Promise.resolve(DEFAULT_RETRY_MODE); }), sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : Sha256, streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : streamCollector, utf8Decoder: (_m = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _m !== void 0 ? _m : fromUtf8, utf8Encoder: (_o = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _o !== void 0 ? _o : toUtf8 });
16
+ return __assign(__assign(__assign({}, clientSharedValues), config), { runtime: "browser", base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : fromBase64, base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : toBase64, bodyLengthChecker: (_c = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _c !== void 0 ? _c : calculateBodyLength, credentialDefaultProvider: (_d = config === null || config === void 0 ? void 0 : config.credentialDefaultProvider) !== null && _d !== void 0 ? _d : (function (_) { return function () { return Promise.reject(new Error("Credential is missing")); }; }), defaultUserAgentProvider: (_e = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _e !== void 0 ? _e : defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), maxAttempts: (_f = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _f !== void 0 ? _f : DEFAULT_MAX_ATTEMPTS, region: (_g = config === null || config === void 0 ? void 0 : config.region) !== null && _g !== void 0 ? _g : invalidProvider("Region is missing"), requestHandler: (_h = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _h !== void 0 ? _h : new FetchHttpHandler(), retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : (function () { return Promise.resolve(DEFAULT_RETRY_MODE); }), sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : Sha256, streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : streamCollector, useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : (function () { return Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT); }), useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : (function () { return Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT); }), utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : fromUtf8, utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : toUtf8 });
16
17
  };