@aws-sdk/client-rekognitionstreaming 3.928.0 → 3.930.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,448 +0,0 @@
1
- import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
- import { requestBuilder as rb } from "@smithy/core";
3
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectString as __expectString, isSerializableHeaderValue, limitedParseFloat32 as __limitedParseFloat32, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
4
- import { AccessDeniedException, ClientChallenge, InternalServerException, LivenessRequestStream, ServiceQuotaExceededException, ServiceUnavailableException, SessionNotFoundException, ThrottlingException, ValidationException, } from "../models/models_0";
5
- import { RekognitionStreamingServiceException as __BaseException } from "../models/RekognitionStreamingServiceException";
6
- export const se_StartFaceLivenessSessionCommand = async (input, context) => {
7
- const b = rb(input, context);
8
- const headers = map({}, isSerializableHeaderValue, {
9
- "content-type": "application/json",
10
- [_xarslsi]: input[_SI],
11
- [_xarslvw]: input[_VW],
12
- [_xarslvh]: input[_VH],
13
- [_xarslcv]: input[_CV],
14
- });
15
- b.bp("/start-face-liveness-session");
16
- let body;
17
- if (input.LivenessRequestStream !== undefined) {
18
- body = se_LivenessRequestStream(input.LivenessRequestStream, context);
19
- }
20
- b.m("POST").h(headers).b(body);
21
- return b.build();
22
- };
23
- export const de_StartFaceLivenessSessionCommand = async (output, context) => {
24
- if (output.statusCode !== 200 && output.statusCode >= 300) {
25
- return de_CommandError(output, context);
26
- }
27
- const contents = map({
28
- $metadata: deserializeMetadata(output),
29
- [_SI]: [, output.headers[_xarslsi]],
30
- });
31
- const data = output.body;
32
- contents.LivenessResponseStream = de_LivenessResponseStream(data, context);
33
- return contents;
34
- };
35
- const de_CommandError = async (output, context) => {
36
- const parsedOutput = {
37
- ...output,
38
- body: await parseErrorBody(output.body, context),
39
- };
40
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
41
- switch (errorCode) {
42
- case "AccessDeniedException":
43
- case "com.amazonaws.rekognitionstreaming#AccessDeniedException":
44
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
45
- case "InternalServerException":
46
- case "com.amazonaws.rekognitionstreaming#InternalServerException":
47
- throw await de_InternalServerExceptionRes(parsedOutput, context);
48
- case "ServiceQuotaExceededException":
49
- case "com.amazonaws.rekognitionstreaming#ServiceQuotaExceededException":
50
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
51
- case "ServiceUnavailableException":
52
- case "com.amazonaws.rekognitionstreaming#ServiceUnavailableException":
53
- throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
54
- case "SessionNotFoundException":
55
- case "com.amazonaws.rekognitionstreaming#SessionNotFoundException":
56
- throw await de_SessionNotFoundExceptionRes(parsedOutput, context);
57
- case "ThrottlingException":
58
- case "com.amazonaws.rekognitionstreaming#ThrottlingException":
59
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
60
- case "ValidationException":
61
- case "com.amazonaws.rekognitionstreaming#ValidationException":
62
- throw await de_ValidationExceptionRes(parsedOutput, context);
63
- default:
64
- const parsedBody = parsedOutput.body;
65
- return throwDefaultError({
66
- output,
67
- parsedBody,
68
- errorCode,
69
- });
70
- }
71
- };
72
- const throwDefaultError = withBaseException(__BaseException);
73
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
74
- const contents = map({});
75
- const data = parsedOutput.body;
76
- const doc = take(data, {
77
- Code: __expectString,
78
- Message: __expectString,
79
- });
80
- Object.assign(contents, doc);
81
- const exception = new AccessDeniedException({
82
- $metadata: deserializeMetadata(parsedOutput),
83
- ...contents,
84
- });
85
- return __decorateServiceException(exception, parsedOutput.body);
86
- };
87
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
88
- const contents = map({});
89
- const data = parsedOutput.body;
90
- const doc = take(data, {
91
- Code: __expectString,
92
- Message: __expectString,
93
- });
94
- Object.assign(contents, doc);
95
- const exception = new InternalServerException({
96
- $metadata: deserializeMetadata(parsedOutput),
97
- ...contents,
98
- });
99
- return __decorateServiceException(exception, parsedOutput.body);
100
- };
101
- const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
102
- const contents = map({});
103
- const data = parsedOutput.body;
104
- const doc = take(data, {
105
- Code: __expectString,
106
- Message: __expectString,
107
- });
108
- Object.assign(contents, doc);
109
- const exception = new ServiceQuotaExceededException({
110
- $metadata: deserializeMetadata(parsedOutput),
111
- ...contents,
112
- });
113
- return __decorateServiceException(exception, parsedOutput.body);
114
- };
115
- const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
116
- const contents = map({});
117
- const data = parsedOutput.body;
118
- const doc = take(data, {
119
- Code: __expectString,
120
- Message: __expectString,
121
- });
122
- Object.assign(contents, doc);
123
- const exception = new ServiceUnavailableException({
124
- $metadata: deserializeMetadata(parsedOutput),
125
- ...contents,
126
- });
127
- return __decorateServiceException(exception, parsedOutput.body);
128
- };
129
- const de_SessionNotFoundExceptionRes = async (parsedOutput, context) => {
130
- const contents = map({});
131
- const data = parsedOutput.body;
132
- const doc = take(data, {
133
- Code: __expectString,
134
- Message: __expectString,
135
- });
136
- Object.assign(contents, doc);
137
- const exception = new SessionNotFoundException({
138
- $metadata: deserializeMetadata(parsedOutput),
139
- ...contents,
140
- });
141
- return __decorateServiceException(exception, parsedOutput.body);
142
- };
143
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
144
- const contents = map({});
145
- const data = parsedOutput.body;
146
- const doc = take(data, {
147
- Code: __expectString,
148
- Message: __expectString,
149
- });
150
- Object.assign(contents, doc);
151
- const exception = new ThrottlingException({
152
- $metadata: deserializeMetadata(parsedOutput),
153
- ...contents,
154
- });
155
- return __decorateServiceException(exception, parsedOutput.body);
156
- };
157
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
158
- const contents = map({});
159
- const data = parsedOutput.body;
160
- const doc = take(data, {
161
- Code: __expectString,
162
- Message: __expectString,
163
- });
164
- Object.assign(contents, doc);
165
- const exception = new ValidationException({
166
- $metadata: deserializeMetadata(parsedOutput),
167
- ...contents,
168
- });
169
- return __decorateServiceException(exception, parsedOutput.body);
170
- };
171
- const se_LivenessRequestStream = (input, context) => {
172
- const eventMarshallingVisitor = (event) => LivenessRequestStream.visit(event, {
173
- VideoEvent: (value) => se_VideoEvent_event(value, context),
174
- ClientSessionInformationEvent: (value) => se_ClientSessionInformationEvent_event(value, context),
175
- _: (value) => value,
176
- });
177
- return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
178
- };
179
- const se_ClientSessionInformationEvent_event = (input, context) => {
180
- const headers = {
181
- ":event-type": { type: "string", value: "ClientSessionInformationEvent" },
182
- ":message-type": { type: "string", value: "event" },
183
- ":content-type": { type: "string", value: "application/json" },
184
- };
185
- let body = new Uint8Array();
186
- body = se_ClientSessionInformationEvent(input, context);
187
- body = context.utf8Decoder(JSON.stringify(body));
188
- return { headers, body };
189
- };
190
- const se_VideoEvent_event = (input, context) => {
191
- const headers = {
192
- ":event-type": { type: "string", value: "VideoEvent" },
193
- ":message-type": { type: "string", value: "event" },
194
- ":content-type": { type: "string", value: "application/json" },
195
- };
196
- let body = new Uint8Array();
197
- body = se_VideoEvent(input, context);
198
- body = context.utf8Decoder(JSON.stringify(body));
199
- return { headers, body };
200
- };
201
- const de_LivenessResponseStream = (output, context) => {
202
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
203
- if (event["ServerSessionInformationEvent"] != null) {
204
- return {
205
- ServerSessionInformationEvent: await de_ServerSessionInformationEvent_event(event["ServerSessionInformationEvent"], context),
206
- };
207
- }
208
- if (event["DisconnectionEvent"] != null) {
209
- return {
210
- DisconnectionEvent: await de_DisconnectionEvent_event(event["DisconnectionEvent"], context),
211
- };
212
- }
213
- if (event["ChallengeEvent"] != null) {
214
- return {
215
- ChallengeEvent: await de_ChallengeEvent_event(event["ChallengeEvent"], context),
216
- };
217
- }
218
- if (event["ValidationException"] != null) {
219
- return {
220
- ValidationException: await de_ValidationException_event(event["ValidationException"], context),
221
- };
222
- }
223
- if (event["InternalServerException"] != null) {
224
- return {
225
- InternalServerException: await de_InternalServerException_event(event["InternalServerException"], context),
226
- };
227
- }
228
- if (event["ThrottlingException"] != null) {
229
- return {
230
- ThrottlingException: await de_ThrottlingException_event(event["ThrottlingException"], context),
231
- };
232
- }
233
- if (event["ServiceQuotaExceededException"] != null) {
234
- return {
235
- ServiceQuotaExceededException: await de_ServiceQuotaExceededException_event(event["ServiceQuotaExceededException"], context),
236
- };
237
- }
238
- if (event["ServiceUnavailableException"] != null) {
239
- return {
240
- ServiceUnavailableException: await de_ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
241
- };
242
- }
243
- return { $unknown: event };
244
- });
245
- };
246
- const de_ChallengeEvent_event = async (output, context) => {
247
- const contents = {};
248
- const data = await parseBody(output.body, context);
249
- Object.assign(contents, _json(data));
250
- return contents;
251
- };
252
- const de_DisconnectionEvent_event = async (output, context) => {
253
- const contents = {};
254
- const data = await parseBody(output.body, context);
255
- Object.assign(contents, _json(data));
256
- return contents;
257
- };
258
- const de_InternalServerException_event = async (output, context) => {
259
- const parsedOutput = {
260
- ...output,
261
- body: await parseBody(output.body, context),
262
- };
263
- return de_InternalServerExceptionRes(parsedOutput, context);
264
- };
265
- const de_ServerSessionInformationEvent_event = async (output, context) => {
266
- const contents = {};
267
- const data = await parseBody(output.body, context);
268
- Object.assign(contents, de_ServerSessionInformationEvent(data, context));
269
- return contents;
270
- };
271
- const de_ServiceQuotaExceededException_event = async (output, context) => {
272
- const parsedOutput = {
273
- ...output,
274
- body: await parseBody(output.body, context),
275
- };
276
- return de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
277
- };
278
- const de_ServiceUnavailableException_event = async (output, context) => {
279
- const parsedOutput = {
280
- ...output,
281
- body: await parseBody(output.body, context),
282
- };
283
- return de_ServiceUnavailableExceptionRes(parsedOutput, context);
284
- };
285
- const de_ThrottlingException_event = async (output, context) => {
286
- const parsedOutput = {
287
- ...output,
288
- body: await parseBody(output.body, context),
289
- };
290
- return de_ThrottlingExceptionRes(parsedOutput, context);
291
- };
292
- const de_ValidationException_event = async (output, context) => {
293
- const parsedOutput = {
294
- ...output,
295
- body: await parseBody(output.body, context),
296
- };
297
- return de_ValidationExceptionRes(parsedOutput, context);
298
- };
299
- const se_BoundingBox = (input, context) => {
300
- return take(input, {
301
- Height: __serializeFloat,
302
- Left: __serializeFloat,
303
- Top: __serializeFloat,
304
- Width: __serializeFloat,
305
- });
306
- };
307
- const se_ClientChallenge = (input, context) => {
308
- return ClientChallenge.visit(input, {
309
- FaceMovementAndLightChallenge: (value) => ({
310
- FaceMovementAndLightChallenge: se_FaceMovementAndLightClientChallenge(value, context),
311
- }),
312
- FaceMovementChallenge: (value) => ({ FaceMovementChallenge: se_FaceMovementClientChallenge(value, context) }),
313
- _: (name, value) => ({ [name]: value }),
314
- });
315
- };
316
- const se_ClientSessionInformationEvent = (input, context) => {
317
- return take(input, {
318
- Challenge: (_) => se_ClientChallenge(_, context),
319
- });
320
- };
321
- const se_FaceMovementAndLightClientChallenge = (input, context) => {
322
- return take(input, {
323
- ChallengeId: [],
324
- ColorDisplayed: _json,
325
- InitialFace: (_) => se_InitialFace(_, context),
326
- TargetFace: (_) => se_TargetFace(_, context),
327
- VideoEndTimestamp: [],
328
- VideoStartTimestamp: [],
329
- });
330
- };
331
- const se_FaceMovementClientChallenge = (input, context) => {
332
- return take(input, {
333
- ChallengeId: [],
334
- InitialFace: (_) => se_InitialFace(_, context),
335
- TargetFace: (_) => se_TargetFace(_, context),
336
- VideoEndTimestamp: [],
337
- VideoStartTimestamp: [],
338
- });
339
- };
340
- const se_InitialFace = (input, context) => {
341
- return take(input, {
342
- BoundingBox: (_) => se_BoundingBox(_, context),
343
- InitialFaceDetectedTimestamp: [],
344
- });
345
- };
346
- const se_TargetFace = (input, context) => {
347
- return take(input, {
348
- BoundingBox: (_) => se_BoundingBox(_, context),
349
- FaceDetectedInTargetPositionEndTimestamp: [],
350
- FaceDetectedInTargetPositionStartTimestamp: [],
351
- });
352
- };
353
- const se_VideoEvent = (input, context) => {
354
- return take(input, {
355
- TimestampMillis: [],
356
- VideoChunk: context.base64Encoder,
357
- });
358
- };
359
- const de_ChallengeConfig = (output, context) => {
360
- return take(output, {
361
- BlazeFaceDetectionThreshold: __limitedParseFloat32,
362
- FaceDistanceThreshold: __limitedParseFloat32,
363
- FaceDistanceThresholdMax: __limitedParseFloat32,
364
- FaceDistanceThresholdMin: __limitedParseFloat32,
365
- FaceIouHeightThreshold: __limitedParseFloat32,
366
- FaceIouWidthThreshold: __limitedParseFloat32,
367
- OvalFitTimeout: __expectInt32,
368
- OvalHeightWidthRatio: __limitedParseFloat32,
369
- OvalIouHeightThreshold: __limitedParseFloat32,
370
- OvalIouThreshold: __limitedParseFloat32,
371
- OvalIouWidthThreshold: __limitedParseFloat32,
372
- });
373
- };
374
- const de_ColorSequence = (output, context) => {
375
- return take(output, {
376
- DownscrollDuration: __limitedParseFloat32,
377
- FlatDisplayDuration: __limitedParseFloat32,
378
- FreshnessColor: _json,
379
- });
380
- };
381
- const de_ColorSequences = (output, context) => {
382
- const retVal = (output || [])
383
- .filter((e) => e != null)
384
- .map((entry) => {
385
- return de_ColorSequence(entry, context);
386
- });
387
- return retVal;
388
- };
389
- const de_FaceMovementAndLightServerChallenge = (output, context) => {
390
- return take(output, {
391
- ChallengeConfig: (_) => de_ChallengeConfig(_, context),
392
- ColorSequences: (_) => de_ColorSequences(_, context),
393
- LightChallengeType: __expectString,
394
- OvalParameters: (_) => de_OvalParameters(_, context),
395
- });
396
- };
397
- const de_FaceMovementServerChallenge = (output, context) => {
398
- return take(output, {
399
- ChallengeConfig: (_) => de_ChallengeConfig(_, context),
400
- OvalParameters: (_) => de_OvalParameters(_, context),
401
- });
402
- };
403
- const de_OvalParameters = (output, context) => {
404
- return take(output, {
405
- CenterX: __limitedParseFloat32,
406
- CenterY: __limitedParseFloat32,
407
- Height: __limitedParseFloat32,
408
- Width: __limitedParseFloat32,
409
- });
410
- };
411
- const de_ServerChallenge = (output, context) => {
412
- if (output.FaceMovementAndLightChallenge != null) {
413
- return {
414
- FaceMovementAndLightChallenge: de_FaceMovementAndLightServerChallenge(output.FaceMovementAndLightChallenge, context),
415
- };
416
- }
417
- if (output.FaceMovementChallenge != null) {
418
- return {
419
- FaceMovementChallenge: de_FaceMovementServerChallenge(output.FaceMovementChallenge, context),
420
- };
421
- }
422
- return { $unknown: Object.entries(output)[0] };
423
- };
424
- const de_ServerSessionInformationEvent = (output, context) => {
425
- return take(output, {
426
- SessionInformation: (_) => de_SessionInformation(_, context),
427
- });
428
- };
429
- const de_SessionInformation = (output, context) => {
430
- return take(output, {
431
- Challenge: (_) => de_ServerChallenge(__expectUnion(_), context),
432
- });
433
- };
434
- const deserializeMetadata = (output) => ({
435
- httpStatusCode: output.statusCode,
436
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
437
- extendedRequestId: output.headers["x-amz-id-2"],
438
- cfId: output.headers["x-amz-cf-id"],
439
- });
440
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
441
- const _CV = "ChallengeVersions";
442
- const _SI = "SessionId";
443
- const _VH = "VideoHeight";
444
- const _VW = "VideoWidth";
445
- const _xarslcv = "x-amz-rekognition-streaming-liveness-challenge-versions";
446
- const _xarslsi = "x-amz-rekognition-streaming-liveness-session-id";
447
- const _xarslvh = "x-amz-rekognition-streaming-liveness-video-height";
448
- const _xarslvw = "x-amz-rekognition-streaming-liveness-video-width";
@@ -1,11 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
2
- import { EventStreamSerdeContext as __EventStreamSerdeContext, SerdeContext as __SerdeContext } from "@smithy/types";
3
- import { StartFaceLivenessSessionCommandInput, StartFaceLivenessSessionCommandOutput } from "../commands/StartFaceLivenessSessionCommand";
4
- /**
5
- * serializeAws_restJson1StartFaceLivenessSessionCommand
6
- */
7
- export declare const se_StartFaceLivenessSessionCommand: (input: StartFaceLivenessSessionCommandInput, context: __SerdeContext & __EventStreamSerdeContext) => Promise<__HttpRequest>;
8
- /**
9
- * deserializeAws_restJson1StartFaceLivenessSessionCommand
10
- */
11
- export declare const de_StartFaceLivenessSessionCommand: (output: __HttpResponse, context: __SerdeContext & __EventStreamSerdeContext) => Promise<StartFaceLivenessSessionCommandOutput>;
@@ -1,20 +0,0 @@
1
- import {
2
- HttpRequest as __HttpRequest,
3
- HttpResponse as __HttpResponse,
4
- } from "@smithy/protocol-http";
5
- import {
6
- EventStreamSerdeContext as __EventStreamSerdeContext,
7
- SerdeContext as __SerdeContext,
8
- } from "@smithy/types";
9
- import {
10
- StartFaceLivenessSessionCommandInput,
11
- StartFaceLivenessSessionCommandOutput,
12
- } from "../commands/StartFaceLivenessSessionCommand";
13
- export declare const se_StartFaceLivenessSessionCommand: (
14
- input: StartFaceLivenessSessionCommandInput,
15
- context: __SerdeContext & __EventStreamSerdeContext
16
- ) => Promise<__HttpRequest>;
17
- export declare const de_StartFaceLivenessSessionCommand: (
18
- output: __HttpResponse,
19
- context: __SerdeContext & __EventStreamSerdeContext
20
- ) => Promise<StartFaceLivenessSessionCommandOutput>;