@aws-sdk/client-payment-cryptography-data 3.349.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 (107) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +294 -0
  3. package/dist-cjs/PaymentCryptographyData.js +33 -0
  4. package/dist-cjs/PaymentCryptographyDataClient.js +41 -0
  5. package/dist-cjs/commands/DecryptDataCommand.js +47 -0
  6. package/dist-cjs/commands/EncryptDataCommand.js +47 -0
  7. package/dist-cjs/commands/GenerateCardValidationDataCommand.js +47 -0
  8. package/dist-cjs/commands/GenerateMacCommand.js +47 -0
  9. package/dist-cjs/commands/GeneratePinDataCommand.js +47 -0
  10. package/dist-cjs/commands/ReEncryptDataCommand.js +47 -0
  11. package/dist-cjs/commands/TranslatePinDataCommand.js +47 -0
  12. package/dist-cjs/commands/VerifyAuthRequestCryptogramCommand.js +47 -0
  13. package/dist-cjs/commands/VerifyCardValidationDataCommand.js +47 -0
  14. package/dist-cjs/commands/VerifyMacCommand.js +47 -0
  15. package/dist-cjs/commands/VerifyPinDataCommand.js +47 -0
  16. package/dist-cjs/commands/index.js +14 -0
  17. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  18. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  19. package/dist-cjs/endpoint/ruleset.js +7 -0
  20. package/dist-cjs/index.js +10 -0
  21. package/dist-cjs/models/PaymentCryptographyDataServiceException.js +12 -0
  22. package/dist-cjs/models/index.js +4 -0
  23. package/dist-cjs/models/models_0.js +526 -0
  24. package/dist-cjs/protocols/Aws_restJson1.js +963 -0
  25. package/dist-cjs/runtimeConfig.browser.js +39 -0
  26. package/dist-cjs/runtimeConfig.js +48 -0
  27. package/dist-cjs/runtimeConfig.native.js +15 -0
  28. package/dist-cjs/runtimeConfig.shared.js +21 -0
  29. package/dist-es/PaymentCryptographyData.js +29 -0
  30. package/dist-es/PaymentCryptographyDataClient.js +37 -0
  31. package/dist-es/commands/DecryptDataCommand.js +43 -0
  32. package/dist-es/commands/EncryptDataCommand.js +43 -0
  33. package/dist-es/commands/GenerateCardValidationDataCommand.js +43 -0
  34. package/dist-es/commands/GenerateMacCommand.js +43 -0
  35. package/dist-es/commands/GeneratePinDataCommand.js +43 -0
  36. package/dist-es/commands/ReEncryptDataCommand.js +43 -0
  37. package/dist-es/commands/TranslatePinDataCommand.js +43 -0
  38. package/dist-es/commands/VerifyAuthRequestCryptogramCommand.js +43 -0
  39. package/dist-es/commands/VerifyCardValidationDataCommand.js +43 -0
  40. package/dist-es/commands/VerifyMacCommand.js +43 -0
  41. package/dist-es/commands/VerifyPinDataCommand.js +43 -0
  42. package/dist-es/commands/index.js +11 -0
  43. package/dist-es/endpoint/EndpointParameters.js +8 -0
  44. package/dist-es/endpoint/endpointResolver.js +8 -0
  45. package/dist-es/endpoint/ruleset.js +4 -0
  46. package/dist-es/index.js +5 -0
  47. package/dist-es/models/PaymentCryptographyDataServiceException.js +8 -0
  48. package/dist-es/models/index.js +1 -0
  49. package/dist-es/models/models_0.js +488 -0
  50. package/dist-es/protocols/Aws_restJson1.js +938 -0
  51. package/dist-es/runtimeConfig.browser.js +34 -0
  52. package/dist-es/runtimeConfig.js +43 -0
  53. package/dist-es/runtimeConfig.native.js +11 -0
  54. package/dist-es/runtimeConfig.shared.js +17 -0
  55. package/dist-types/PaymentCryptographyData.d.ts +88 -0
  56. package/dist-types/PaymentCryptographyDataClient.d.ts +174 -0
  57. package/dist-types/commands/DecryptDataCommand.d.ts +133 -0
  58. package/dist-types/commands/EncryptDataCommand.d.ts +138 -0
  59. package/dist-types/commands/GenerateCardValidationDataCommand.d.ts +144 -0
  60. package/dist-types/commands/GenerateMacCommand.d.ts +134 -0
  61. package/dist-types/commands/GeneratePinDataCommand.d.ts +155 -0
  62. package/dist-types/commands/ReEncryptDataCommand.d.ts +150 -0
  63. package/dist-types/commands/TranslatePinDataCommand.d.ts +147 -0
  64. package/dist-types/commands/VerifyAuthRequestCryptogramCommand.d.ts +150 -0
  65. package/dist-types/commands/VerifyCardValidationDataCommand.d.ts +156 -0
  66. package/dist-types/commands/VerifyMacCommand.d.ts +137 -0
  67. package/dist-types/commands/VerifyPinDataCommand.d.ts +134 -0
  68. package/dist-types/commands/index.d.ts +11 -0
  69. package/dist-types/endpoint/EndpointParameters.d.ts +20 -0
  70. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  71. package/dist-types/endpoint/ruleset.d.ts +2 -0
  72. package/dist-types/index.d.ts +11 -0
  73. package/dist-types/models/PaymentCryptographyDataServiceException.d.ts +13 -0
  74. package/dist-types/models/index.d.ts +1 -0
  75. package/dist-types/models/models_0.d.ts +2191 -0
  76. package/dist-types/protocols/Aws_restJson1.d.ts +101 -0
  77. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  78. package/dist-types/runtimeConfig.d.ts +42 -0
  79. package/dist-types/runtimeConfig.native.d.ts +41 -0
  80. package/dist-types/runtimeConfig.shared.d.ts +18 -0
  81. package/dist-types/ts3.4/PaymentCryptographyData.d.ts +194 -0
  82. package/dist-types/ts3.4/PaymentCryptographyDataClient.d.ts +181 -0
  83. package/dist-types/ts3.4/commands/DecryptDataCommand.d.ts +35 -0
  84. package/dist-types/ts3.4/commands/EncryptDataCommand.d.ts +35 -0
  85. package/dist-types/ts3.4/commands/GenerateCardValidationDataCommand.d.ts +42 -0
  86. package/dist-types/ts3.4/commands/GenerateMacCommand.d.ts +35 -0
  87. package/dist-types/ts3.4/commands/GeneratePinDataCommand.d.ts +38 -0
  88. package/dist-types/ts3.4/commands/ReEncryptDataCommand.d.ts +35 -0
  89. package/dist-types/ts3.4/commands/TranslatePinDataCommand.d.ts +38 -0
  90. package/dist-types/ts3.4/commands/VerifyAuthRequestCryptogramCommand.d.ts +42 -0
  91. package/dist-types/ts3.4/commands/VerifyCardValidationDataCommand.d.ts +42 -0
  92. package/dist-types/ts3.4/commands/VerifyMacCommand.d.ts +35 -0
  93. package/dist-types/ts3.4/commands/VerifyPinDataCommand.d.ts +35 -0
  94. package/dist-types/ts3.4/commands/index.d.ts +11 -0
  95. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +32 -0
  96. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  97. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  98. package/dist-types/ts3.4/index.d.ts +5 -0
  99. package/dist-types/ts3.4/models/PaymentCryptographyDataServiceException.d.ts +8 -0
  100. package/dist-types/ts3.4/models/index.d.ts +1 -0
  101. package/dist-types/ts3.4/models/models_0.d.ts +1168 -0
  102. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +137 -0
  103. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +96 -0
  104. package/dist-types/ts3.4/runtimeConfig.d.ts +93 -0
  105. package/dist-types/ts3.4/runtimeConfig.native.d.ts +87 -0
  106. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +20 -0
  107. package/package.json +99 -0
@@ -0,0 +1,938 @@
1
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
2
+ import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
3
+ import { AccessDeniedException, InternalServerException, ResourceNotFoundException, ThrottlingException, ValidationException, VerificationFailedException, } from "../models/models_0";
4
+ import { PaymentCryptographyDataServiceException as __BaseException } from "../models/PaymentCryptographyDataServiceException";
5
+ export const se_DecryptDataCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {
8
+ "content-type": "application/json",
9
+ };
10
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/keys/{KeyIdentifier}/decrypt";
11
+ resolvedPath = __resolvedPath(resolvedPath, input, "KeyIdentifier", () => input.KeyIdentifier, "{KeyIdentifier}", false);
12
+ let body;
13
+ body = JSON.stringify(take(input, {
14
+ CipherText: [],
15
+ DecryptionAttributes: (_) => _json(_),
16
+ }));
17
+ return new __HttpRequest({
18
+ protocol,
19
+ hostname,
20
+ port,
21
+ method: "POST",
22
+ headers,
23
+ path: resolvedPath,
24
+ body,
25
+ });
26
+ };
27
+ export const se_EncryptDataCommand = async (input, context) => {
28
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
29
+ const headers = {
30
+ "content-type": "application/json",
31
+ };
32
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/keys/{KeyIdentifier}/encrypt";
33
+ resolvedPath = __resolvedPath(resolvedPath, input, "KeyIdentifier", () => input.KeyIdentifier, "{KeyIdentifier}", false);
34
+ let body;
35
+ body = JSON.stringify(take(input, {
36
+ EncryptionAttributes: (_) => _json(_),
37
+ PlainText: [],
38
+ }));
39
+ return new __HttpRequest({
40
+ protocol,
41
+ hostname,
42
+ port,
43
+ method: "POST",
44
+ headers,
45
+ path: resolvedPath,
46
+ body,
47
+ });
48
+ };
49
+ export const se_GenerateCardValidationDataCommand = async (input, context) => {
50
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
51
+ const headers = {
52
+ "content-type": "application/json",
53
+ };
54
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cardvalidationdata/generate";
55
+ let body;
56
+ body = JSON.stringify(take(input, {
57
+ GenerationAttributes: (_) => _json(_),
58
+ KeyIdentifier: [],
59
+ PrimaryAccountNumber: [],
60
+ ValidationDataLength: [],
61
+ }));
62
+ return new __HttpRequest({
63
+ protocol,
64
+ hostname,
65
+ port,
66
+ method: "POST",
67
+ headers,
68
+ path: resolvedPath,
69
+ body,
70
+ });
71
+ };
72
+ export const se_GenerateMacCommand = async (input, context) => {
73
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
74
+ const headers = {
75
+ "content-type": "application/json",
76
+ };
77
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mac/generate";
78
+ let body;
79
+ body = JSON.stringify(take(input, {
80
+ GenerationAttributes: (_) => _json(_),
81
+ KeyIdentifier: [],
82
+ MacLength: [],
83
+ MessageData: [],
84
+ }));
85
+ return new __HttpRequest({
86
+ protocol,
87
+ hostname,
88
+ port,
89
+ method: "POST",
90
+ headers,
91
+ path: resolvedPath,
92
+ body,
93
+ });
94
+ };
95
+ export const se_GeneratePinDataCommand = async (input, context) => {
96
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
97
+ const headers = {
98
+ "content-type": "application/json",
99
+ };
100
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pindata/generate";
101
+ let body;
102
+ body = JSON.stringify(take(input, {
103
+ EncryptionKeyIdentifier: [],
104
+ GenerationAttributes: (_) => _json(_),
105
+ GenerationKeyIdentifier: [],
106
+ PinBlockFormat: [],
107
+ PinDataLength: [],
108
+ PrimaryAccountNumber: [],
109
+ }));
110
+ return new __HttpRequest({
111
+ protocol,
112
+ hostname,
113
+ port,
114
+ method: "POST",
115
+ headers,
116
+ path: resolvedPath,
117
+ body,
118
+ });
119
+ };
120
+ export const se_ReEncryptDataCommand = async (input, context) => {
121
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
122
+ const headers = {
123
+ "content-type": "application/json",
124
+ };
125
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/keys/{IncomingKeyIdentifier}/reencrypt";
126
+ resolvedPath = __resolvedPath(resolvedPath, input, "IncomingKeyIdentifier", () => input.IncomingKeyIdentifier, "{IncomingKeyIdentifier}", false);
127
+ let body;
128
+ body = JSON.stringify(take(input, {
129
+ CipherText: [],
130
+ IncomingEncryptionAttributes: (_) => _json(_),
131
+ OutgoingEncryptionAttributes: (_) => _json(_),
132
+ OutgoingKeyIdentifier: [],
133
+ }));
134
+ return new __HttpRequest({
135
+ protocol,
136
+ hostname,
137
+ port,
138
+ method: "POST",
139
+ headers,
140
+ path: resolvedPath,
141
+ body,
142
+ });
143
+ };
144
+ export const se_TranslatePinDataCommand = async (input, context) => {
145
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
146
+ const headers = {
147
+ "content-type": "application/json",
148
+ };
149
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pindata/translate";
150
+ let body;
151
+ body = JSON.stringify(take(input, {
152
+ EncryptedPinBlock: [],
153
+ IncomingDukptAttributes: (_) => _json(_),
154
+ IncomingKeyIdentifier: [],
155
+ IncomingTranslationAttributes: (_) => _json(_),
156
+ OutgoingDukptAttributes: (_) => _json(_),
157
+ OutgoingKeyIdentifier: [],
158
+ OutgoingTranslationAttributes: (_) => _json(_),
159
+ }));
160
+ return new __HttpRequest({
161
+ protocol,
162
+ hostname,
163
+ port,
164
+ method: "POST",
165
+ headers,
166
+ path: resolvedPath,
167
+ body,
168
+ });
169
+ };
170
+ export const se_VerifyAuthRequestCryptogramCommand = async (input, context) => {
171
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
172
+ const headers = {
173
+ "content-type": "application/json",
174
+ };
175
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cryptogram/verify";
176
+ let body;
177
+ body = JSON.stringify(take(input, {
178
+ AuthRequestCryptogram: [],
179
+ AuthResponseAttributes: (_) => _json(_),
180
+ KeyIdentifier: [],
181
+ MajorKeyDerivationMode: [],
182
+ SessionKeyDerivationAttributes: (_) => _json(_),
183
+ TransactionData: [],
184
+ }));
185
+ return new __HttpRequest({
186
+ protocol,
187
+ hostname,
188
+ port,
189
+ method: "POST",
190
+ headers,
191
+ path: resolvedPath,
192
+ body,
193
+ });
194
+ };
195
+ export const se_VerifyCardValidationDataCommand = async (input, context) => {
196
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
197
+ const headers = {
198
+ "content-type": "application/json",
199
+ };
200
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cardvalidationdata/verify";
201
+ let body;
202
+ body = JSON.stringify(take(input, {
203
+ KeyIdentifier: [],
204
+ PrimaryAccountNumber: [],
205
+ ValidationData: [],
206
+ VerificationAttributes: (_) => _json(_),
207
+ }));
208
+ return new __HttpRequest({
209
+ protocol,
210
+ hostname,
211
+ port,
212
+ method: "POST",
213
+ headers,
214
+ path: resolvedPath,
215
+ body,
216
+ });
217
+ };
218
+ export const se_VerifyMacCommand = async (input, context) => {
219
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
220
+ const headers = {
221
+ "content-type": "application/json",
222
+ };
223
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mac/verify";
224
+ let body;
225
+ body = JSON.stringify(take(input, {
226
+ KeyIdentifier: [],
227
+ Mac: [],
228
+ MacLength: [],
229
+ MessageData: [],
230
+ VerificationAttributes: (_) => _json(_),
231
+ }));
232
+ return new __HttpRequest({
233
+ protocol,
234
+ hostname,
235
+ port,
236
+ method: "POST",
237
+ headers,
238
+ path: resolvedPath,
239
+ body,
240
+ });
241
+ };
242
+ export const se_VerifyPinDataCommand = async (input, context) => {
243
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
244
+ const headers = {
245
+ "content-type": "application/json",
246
+ };
247
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pindata/verify";
248
+ let body;
249
+ body = JSON.stringify(take(input, {
250
+ DukptAttributes: (_) => _json(_),
251
+ EncryptedPinBlock: [],
252
+ EncryptionKeyIdentifier: [],
253
+ PinBlockFormat: [],
254
+ PinDataLength: [],
255
+ PrimaryAccountNumber: [],
256
+ VerificationAttributes: (_) => _json(_),
257
+ VerificationKeyIdentifier: [],
258
+ }));
259
+ return new __HttpRequest({
260
+ protocol,
261
+ hostname,
262
+ port,
263
+ method: "POST",
264
+ headers,
265
+ path: resolvedPath,
266
+ body,
267
+ });
268
+ };
269
+ export const de_DecryptDataCommand = async (output, context) => {
270
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
271
+ return de_DecryptDataCommandError(output, context);
272
+ }
273
+ const contents = map({
274
+ $metadata: deserializeMetadata(output),
275
+ });
276
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
277
+ const doc = take(data, {
278
+ KeyArn: __expectString,
279
+ KeyCheckValue: __expectString,
280
+ PlainText: __expectString,
281
+ });
282
+ Object.assign(contents, doc);
283
+ return contents;
284
+ };
285
+ const de_DecryptDataCommandError = async (output, context) => {
286
+ const parsedOutput = {
287
+ ...output,
288
+ body: await parseErrorBody(output.body, context),
289
+ };
290
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
291
+ switch (errorCode) {
292
+ case "AccessDeniedException":
293
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
294
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
295
+ case "InternalServerException":
296
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
297
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
298
+ case "ResourceNotFoundException":
299
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
300
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
301
+ case "ThrottlingException":
302
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
303
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
304
+ case "ValidationException":
305
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
306
+ throw await de_ValidationExceptionRes(parsedOutput, context);
307
+ default:
308
+ const parsedBody = parsedOutput.body;
309
+ return throwDefaultError({
310
+ output,
311
+ parsedBody,
312
+ errorCode,
313
+ });
314
+ }
315
+ };
316
+ export const de_EncryptDataCommand = async (output, context) => {
317
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
318
+ return de_EncryptDataCommandError(output, context);
319
+ }
320
+ const contents = map({
321
+ $metadata: deserializeMetadata(output),
322
+ });
323
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
324
+ const doc = take(data, {
325
+ CipherText: __expectString,
326
+ KeyArn: __expectString,
327
+ KeyCheckValue: __expectString,
328
+ });
329
+ Object.assign(contents, doc);
330
+ return contents;
331
+ };
332
+ const de_EncryptDataCommandError = async (output, context) => {
333
+ const parsedOutput = {
334
+ ...output,
335
+ body: await parseErrorBody(output.body, context),
336
+ };
337
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
338
+ switch (errorCode) {
339
+ case "AccessDeniedException":
340
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
341
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
342
+ case "InternalServerException":
343
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
344
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
345
+ case "ResourceNotFoundException":
346
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
347
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
348
+ case "ThrottlingException":
349
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
350
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
351
+ case "ValidationException":
352
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
353
+ throw await de_ValidationExceptionRes(parsedOutput, context);
354
+ default:
355
+ const parsedBody = parsedOutput.body;
356
+ return throwDefaultError({
357
+ output,
358
+ parsedBody,
359
+ errorCode,
360
+ });
361
+ }
362
+ };
363
+ export const de_GenerateCardValidationDataCommand = async (output, context) => {
364
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
365
+ return de_GenerateCardValidationDataCommandError(output, context);
366
+ }
367
+ const contents = map({
368
+ $metadata: deserializeMetadata(output),
369
+ });
370
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
371
+ const doc = take(data, {
372
+ KeyArn: __expectString,
373
+ KeyCheckValue: __expectString,
374
+ ValidationData: __expectString,
375
+ });
376
+ Object.assign(contents, doc);
377
+ return contents;
378
+ };
379
+ const de_GenerateCardValidationDataCommandError = async (output, context) => {
380
+ const parsedOutput = {
381
+ ...output,
382
+ body: await parseErrorBody(output.body, context),
383
+ };
384
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
385
+ switch (errorCode) {
386
+ case "AccessDeniedException":
387
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
388
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
389
+ case "InternalServerException":
390
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
391
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
392
+ case "ResourceNotFoundException":
393
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
394
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
395
+ case "ThrottlingException":
396
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
397
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
398
+ case "ValidationException":
399
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
400
+ throw await de_ValidationExceptionRes(parsedOutput, context);
401
+ default:
402
+ const parsedBody = parsedOutput.body;
403
+ return throwDefaultError({
404
+ output,
405
+ parsedBody,
406
+ errorCode,
407
+ });
408
+ }
409
+ };
410
+ export const de_GenerateMacCommand = async (output, context) => {
411
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
412
+ return de_GenerateMacCommandError(output, context);
413
+ }
414
+ const contents = map({
415
+ $metadata: deserializeMetadata(output),
416
+ });
417
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
418
+ const doc = take(data, {
419
+ KeyArn: __expectString,
420
+ KeyCheckValue: __expectString,
421
+ Mac: __expectString,
422
+ });
423
+ Object.assign(contents, doc);
424
+ return contents;
425
+ };
426
+ const de_GenerateMacCommandError = async (output, context) => {
427
+ const parsedOutput = {
428
+ ...output,
429
+ body: await parseErrorBody(output.body, context),
430
+ };
431
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
432
+ switch (errorCode) {
433
+ case "AccessDeniedException":
434
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
435
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
436
+ case "InternalServerException":
437
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
438
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
439
+ case "ResourceNotFoundException":
440
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
441
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
442
+ case "ThrottlingException":
443
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
444
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
445
+ case "ValidationException":
446
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
447
+ throw await de_ValidationExceptionRes(parsedOutput, context);
448
+ default:
449
+ const parsedBody = parsedOutput.body;
450
+ return throwDefaultError({
451
+ output,
452
+ parsedBody,
453
+ errorCode,
454
+ });
455
+ }
456
+ };
457
+ export const de_GeneratePinDataCommand = async (output, context) => {
458
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
459
+ return de_GeneratePinDataCommandError(output, context);
460
+ }
461
+ const contents = map({
462
+ $metadata: deserializeMetadata(output),
463
+ });
464
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
465
+ const doc = take(data, {
466
+ EncryptedPinBlock: __expectString,
467
+ EncryptionKeyArn: __expectString,
468
+ EncryptionKeyCheckValue: __expectString,
469
+ GenerationKeyArn: __expectString,
470
+ GenerationKeyCheckValue: __expectString,
471
+ PinData: (_) => _json(__expectUnion(_)),
472
+ });
473
+ Object.assign(contents, doc);
474
+ return contents;
475
+ };
476
+ const de_GeneratePinDataCommandError = async (output, context) => {
477
+ const parsedOutput = {
478
+ ...output,
479
+ body: await parseErrorBody(output.body, context),
480
+ };
481
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
482
+ switch (errorCode) {
483
+ case "AccessDeniedException":
484
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
485
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
486
+ case "InternalServerException":
487
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
488
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
489
+ case "ResourceNotFoundException":
490
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
491
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
492
+ case "ThrottlingException":
493
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
494
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
495
+ case "ValidationException":
496
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
497
+ throw await de_ValidationExceptionRes(parsedOutput, context);
498
+ default:
499
+ const parsedBody = parsedOutput.body;
500
+ return throwDefaultError({
501
+ output,
502
+ parsedBody,
503
+ errorCode,
504
+ });
505
+ }
506
+ };
507
+ export const de_ReEncryptDataCommand = async (output, context) => {
508
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
509
+ return de_ReEncryptDataCommandError(output, context);
510
+ }
511
+ const contents = map({
512
+ $metadata: deserializeMetadata(output),
513
+ });
514
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
515
+ const doc = take(data, {
516
+ CipherText: __expectString,
517
+ KeyArn: __expectString,
518
+ KeyCheckValue: __expectString,
519
+ });
520
+ Object.assign(contents, doc);
521
+ return contents;
522
+ };
523
+ const de_ReEncryptDataCommandError = async (output, context) => {
524
+ const parsedOutput = {
525
+ ...output,
526
+ body: await parseErrorBody(output.body, context),
527
+ };
528
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
529
+ switch (errorCode) {
530
+ case "AccessDeniedException":
531
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
532
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
533
+ case "InternalServerException":
534
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
535
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
536
+ case "ResourceNotFoundException":
537
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
538
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
539
+ case "ThrottlingException":
540
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
541
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
542
+ case "ValidationException":
543
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
544
+ throw await de_ValidationExceptionRes(parsedOutput, context);
545
+ default:
546
+ const parsedBody = parsedOutput.body;
547
+ return throwDefaultError({
548
+ output,
549
+ parsedBody,
550
+ errorCode,
551
+ });
552
+ }
553
+ };
554
+ export const de_TranslatePinDataCommand = async (output, context) => {
555
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
556
+ return de_TranslatePinDataCommandError(output, context);
557
+ }
558
+ const contents = map({
559
+ $metadata: deserializeMetadata(output),
560
+ });
561
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
562
+ const doc = take(data, {
563
+ KeyArn: __expectString,
564
+ KeyCheckValue: __expectString,
565
+ PinBlock: __expectString,
566
+ });
567
+ Object.assign(contents, doc);
568
+ return contents;
569
+ };
570
+ const de_TranslatePinDataCommandError = async (output, context) => {
571
+ const parsedOutput = {
572
+ ...output,
573
+ body: await parseErrorBody(output.body, context),
574
+ };
575
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
576
+ switch (errorCode) {
577
+ case "AccessDeniedException":
578
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
579
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
580
+ case "InternalServerException":
581
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
582
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
583
+ case "ResourceNotFoundException":
584
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
585
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
586
+ case "ThrottlingException":
587
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
588
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
589
+ case "ValidationException":
590
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
591
+ throw await de_ValidationExceptionRes(parsedOutput, context);
592
+ default:
593
+ const parsedBody = parsedOutput.body;
594
+ return throwDefaultError({
595
+ output,
596
+ parsedBody,
597
+ errorCode,
598
+ });
599
+ }
600
+ };
601
+ export const de_VerifyAuthRequestCryptogramCommand = async (output, context) => {
602
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
603
+ return de_VerifyAuthRequestCryptogramCommandError(output, context);
604
+ }
605
+ const contents = map({
606
+ $metadata: deserializeMetadata(output),
607
+ });
608
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
609
+ const doc = take(data, {
610
+ AuthResponseValue: __expectString,
611
+ KeyArn: __expectString,
612
+ KeyCheckValue: __expectString,
613
+ });
614
+ Object.assign(contents, doc);
615
+ return contents;
616
+ };
617
+ const de_VerifyAuthRequestCryptogramCommandError = async (output, context) => {
618
+ const parsedOutput = {
619
+ ...output,
620
+ body: await parseErrorBody(output.body, context),
621
+ };
622
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
623
+ switch (errorCode) {
624
+ case "AccessDeniedException":
625
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
626
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
627
+ case "InternalServerException":
628
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
629
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
630
+ case "ResourceNotFoundException":
631
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
632
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
633
+ case "ThrottlingException":
634
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
635
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
636
+ case "ValidationException":
637
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
638
+ throw await de_ValidationExceptionRes(parsedOutput, context);
639
+ case "VerificationFailedException":
640
+ case "com.amazonaws.paymentcryptographydata#VerificationFailedException":
641
+ throw await de_VerificationFailedExceptionRes(parsedOutput, context);
642
+ default:
643
+ const parsedBody = parsedOutput.body;
644
+ return throwDefaultError({
645
+ output,
646
+ parsedBody,
647
+ errorCode,
648
+ });
649
+ }
650
+ };
651
+ export const de_VerifyCardValidationDataCommand = async (output, context) => {
652
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
653
+ return de_VerifyCardValidationDataCommandError(output, context);
654
+ }
655
+ const contents = map({
656
+ $metadata: deserializeMetadata(output),
657
+ });
658
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
659
+ const doc = take(data, {
660
+ KeyArn: __expectString,
661
+ KeyCheckValue: __expectString,
662
+ });
663
+ Object.assign(contents, doc);
664
+ return contents;
665
+ };
666
+ const de_VerifyCardValidationDataCommandError = async (output, context) => {
667
+ const parsedOutput = {
668
+ ...output,
669
+ body: await parseErrorBody(output.body, context),
670
+ };
671
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
672
+ switch (errorCode) {
673
+ case "AccessDeniedException":
674
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
675
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
676
+ case "InternalServerException":
677
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
678
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
679
+ case "ResourceNotFoundException":
680
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
681
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
682
+ case "ThrottlingException":
683
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
684
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
685
+ case "ValidationException":
686
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
687
+ throw await de_ValidationExceptionRes(parsedOutput, context);
688
+ case "VerificationFailedException":
689
+ case "com.amazonaws.paymentcryptographydata#VerificationFailedException":
690
+ throw await de_VerificationFailedExceptionRes(parsedOutput, context);
691
+ default:
692
+ const parsedBody = parsedOutput.body;
693
+ return throwDefaultError({
694
+ output,
695
+ parsedBody,
696
+ errorCode,
697
+ });
698
+ }
699
+ };
700
+ export const de_VerifyMacCommand = async (output, context) => {
701
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
702
+ return de_VerifyMacCommandError(output, context);
703
+ }
704
+ const contents = map({
705
+ $metadata: deserializeMetadata(output),
706
+ });
707
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
708
+ const doc = take(data, {
709
+ KeyArn: __expectString,
710
+ KeyCheckValue: __expectString,
711
+ });
712
+ Object.assign(contents, doc);
713
+ return contents;
714
+ };
715
+ const de_VerifyMacCommandError = async (output, context) => {
716
+ const parsedOutput = {
717
+ ...output,
718
+ body: await parseErrorBody(output.body, context),
719
+ };
720
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
721
+ switch (errorCode) {
722
+ case "AccessDeniedException":
723
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
724
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
725
+ case "InternalServerException":
726
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
727
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
728
+ case "ResourceNotFoundException":
729
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
730
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
731
+ case "ThrottlingException":
732
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
733
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
734
+ case "ValidationException":
735
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
736
+ throw await de_ValidationExceptionRes(parsedOutput, context);
737
+ case "VerificationFailedException":
738
+ case "com.amazonaws.paymentcryptographydata#VerificationFailedException":
739
+ throw await de_VerificationFailedExceptionRes(parsedOutput, context);
740
+ default:
741
+ const parsedBody = parsedOutput.body;
742
+ return throwDefaultError({
743
+ output,
744
+ parsedBody,
745
+ errorCode,
746
+ });
747
+ }
748
+ };
749
+ export const de_VerifyPinDataCommand = async (output, context) => {
750
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
751
+ return de_VerifyPinDataCommandError(output, context);
752
+ }
753
+ const contents = map({
754
+ $metadata: deserializeMetadata(output),
755
+ });
756
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
757
+ const doc = take(data, {
758
+ EncryptionKeyArn: __expectString,
759
+ EncryptionKeyCheckValue: __expectString,
760
+ VerificationKeyArn: __expectString,
761
+ VerificationKeyCheckValue: __expectString,
762
+ });
763
+ Object.assign(contents, doc);
764
+ return contents;
765
+ };
766
+ const de_VerifyPinDataCommandError = async (output, context) => {
767
+ const parsedOutput = {
768
+ ...output,
769
+ body: await parseErrorBody(output.body, context),
770
+ };
771
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
772
+ switch (errorCode) {
773
+ case "AccessDeniedException":
774
+ case "com.amazonaws.paymentcryptographydata#AccessDeniedException":
775
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
776
+ case "InternalServerException":
777
+ case "com.amazonaws.paymentcryptographydata#InternalServerException":
778
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
779
+ case "ResourceNotFoundException":
780
+ case "com.amazonaws.paymentcryptographydata#ResourceNotFoundException":
781
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
782
+ case "ThrottlingException":
783
+ case "com.amazonaws.paymentcryptographydata#ThrottlingException":
784
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
785
+ case "ValidationException":
786
+ case "com.amazonaws.paymentcryptographydata#ValidationException":
787
+ throw await de_ValidationExceptionRes(parsedOutput, context);
788
+ case "VerificationFailedException":
789
+ case "com.amazonaws.paymentcryptographydata#VerificationFailedException":
790
+ throw await de_VerificationFailedExceptionRes(parsedOutput, context);
791
+ default:
792
+ const parsedBody = parsedOutput.body;
793
+ return throwDefaultError({
794
+ output,
795
+ parsedBody,
796
+ errorCode,
797
+ });
798
+ }
799
+ };
800
+ const throwDefaultError = withBaseException(__BaseException);
801
+ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
802
+ const contents = map({});
803
+ const data = parsedOutput.body;
804
+ const doc = take(data, {
805
+ Message: __expectString,
806
+ });
807
+ Object.assign(contents, doc);
808
+ const exception = new AccessDeniedException({
809
+ $metadata: deserializeMetadata(parsedOutput),
810
+ ...contents,
811
+ });
812
+ return __decorateServiceException(exception, parsedOutput.body);
813
+ };
814
+ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
815
+ const contents = map({});
816
+ const data = parsedOutput.body;
817
+ const doc = take(data, {
818
+ Message: __expectString,
819
+ });
820
+ Object.assign(contents, doc);
821
+ const exception = new InternalServerException({
822
+ $metadata: deserializeMetadata(parsedOutput),
823
+ ...contents,
824
+ });
825
+ return __decorateServiceException(exception, parsedOutput.body);
826
+ };
827
+ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
828
+ const contents = map({});
829
+ const data = parsedOutput.body;
830
+ const doc = take(data, {
831
+ ResourceId: __expectString,
832
+ });
833
+ Object.assign(contents, doc);
834
+ const exception = new ResourceNotFoundException({
835
+ $metadata: deserializeMetadata(parsedOutput),
836
+ ...contents,
837
+ });
838
+ return __decorateServiceException(exception, parsedOutput.body);
839
+ };
840
+ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
841
+ const contents = map({});
842
+ const data = parsedOutput.body;
843
+ const doc = take(data, {
844
+ Message: __expectString,
845
+ });
846
+ Object.assign(contents, doc);
847
+ const exception = new ThrottlingException({
848
+ $metadata: deserializeMetadata(parsedOutput),
849
+ ...contents,
850
+ });
851
+ return __decorateServiceException(exception, parsedOutput.body);
852
+ };
853
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
854
+ const contents = map({});
855
+ const data = parsedOutput.body;
856
+ const doc = take(data, {
857
+ fieldList: _json,
858
+ message: __expectString,
859
+ });
860
+ Object.assign(contents, doc);
861
+ const exception = new ValidationException({
862
+ $metadata: deserializeMetadata(parsedOutput),
863
+ ...contents,
864
+ });
865
+ return __decorateServiceException(exception, parsedOutput.body);
866
+ };
867
+ const de_VerificationFailedExceptionRes = async (parsedOutput, context) => {
868
+ const contents = map({});
869
+ const data = parsedOutput.body;
870
+ const doc = take(data, {
871
+ Message: __expectString,
872
+ Reason: __expectString,
873
+ });
874
+ Object.assign(contents, doc);
875
+ const exception = new VerificationFailedException({
876
+ $metadata: deserializeMetadata(parsedOutput),
877
+ ...contents,
878
+ });
879
+ return __decorateServiceException(exception, parsedOutput.body);
880
+ };
881
+ const deserializeMetadata = (output) => ({
882
+ httpStatusCode: output.statusCode,
883
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
884
+ extendedRequestId: output.headers["x-amz-id-2"],
885
+ cfId: output.headers["x-amz-cf-id"],
886
+ });
887
+ const collectBody = (streamBody = new Uint8Array(), context) => {
888
+ if (streamBody instanceof Uint8Array) {
889
+ return Promise.resolve(streamBody);
890
+ }
891
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
892
+ };
893
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
894
+ const isSerializableHeaderValue = (value) => value !== undefined &&
895
+ value !== null &&
896
+ value !== "" &&
897
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
898
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
899
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
900
+ if (encoded.length) {
901
+ return JSON.parse(encoded);
902
+ }
903
+ return {};
904
+ });
905
+ const parseErrorBody = async (errorBody, context) => {
906
+ const value = await parseBody(errorBody, context);
907
+ value.message = value.message ?? value.Message;
908
+ return value;
909
+ };
910
+ const loadRestJsonErrorCode = (output, data) => {
911
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
912
+ const sanitizeErrorCode = (rawValue) => {
913
+ let cleanValue = rawValue;
914
+ if (typeof cleanValue === "number") {
915
+ cleanValue = cleanValue.toString();
916
+ }
917
+ if (cleanValue.indexOf(",") >= 0) {
918
+ cleanValue = cleanValue.split(",")[0];
919
+ }
920
+ if (cleanValue.indexOf(":") >= 0) {
921
+ cleanValue = cleanValue.split(":")[0];
922
+ }
923
+ if (cleanValue.indexOf("#") >= 0) {
924
+ cleanValue = cleanValue.split("#")[1];
925
+ }
926
+ return cleanValue;
927
+ };
928
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
929
+ if (headerKey !== undefined) {
930
+ return sanitizeErrorCode(output.headers[headerKey]);
931
+ }
932
+ if (data.code !== undefined) {
933
+ return sanitizeErrorCode(data.code);
934
+ }
935
+ if (data["__type"] !== undefined) {
936
+ return sanitizeErrorCode(data["__type"]);
937
+ }
938
+ };