@aws-sdk/client-rekognitionstreaming 3.305.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.
- package/LICENSE +201 -0
- package/README.md +222 -0
- package/dist-cjs/RekognitionStreaming.js +37 -0
- package/dist-cjs/RekognitionStreamingClient.js +46 -0
- package/dist-cjs/commands/StartFaceLivenessSessionCommand.js +50 -0
- package/dist-cjs/commands/StartStreamingLivenessSessionCommand.js +50 -0
- package/dist-cjs/commands/index.js +5 -0
- package/dist-cjs/endpoint/EndpointParameters.js +12 -0
- package/dist-cjs/endpoint/endpointResolver.js +12 -0
- package/dist-cjs/endpoint/ruleset.js +7 -0
- package/dist-cjs/index.js +10 -0
- package/dist-cjs/models/RekognitionStreamingServiceException.js +11 -0
- package/dist-cjs/models/index.js +4 -0
- package/dist-cjs/models/models_0.js +188 -0
- package/dist-cjs/protocols/Aws_restJson1.js +573 -0
- package/dist-cjs/runtimeConfig.browser.js +44 -0
- package/dist-cjs/runtimeConfig.js +52 -0
- package/dist-cjs/runtimeConfig.native.js +18 -0
- package/dist-cjs/runtimeConfig.shared.js +21 -0
- package/dist-es/RekognitionStreaming.js +33 -0
- package/dist-es/RekognitionStreamingClient.js +42 -0
- package/dist-es/commands/StartFaceLivenessSessionCommand.js +46 -0
- package/dist-es/commands/StartStreamingLivenessSessionCommand.js +46 -0
- package/dist-es/commands/index.js +2 -0
- package/dist-es/endpoint/EndpointParameters.js +8 -0
- package/dist-es/endpoint/endpointResolver.js +8 -0
- package/dist-es/endpoint/ruleset.js +4 -0
- package/dist-es/index.js +5 -0
- package/dist-es/models/RekognitionStreamingServiceException.js +7 -0
- package/dist-es/models/index.js +1 -0
- package/dist-es/models/models_0.js +173 -0
- package/dist-es/protocols/Aws_restJson1.js +566 -0
- package/dist-es/runtimeConfig.browser.js +39 -0
- package/dist-es/runtimeConfig.js +47 -0
- package/dist-es/runtimeConfig.native.js +14 -0
- package/dist-es/runtimeConfig.shared.js +17 -0
- package/dist-types/RekognitionStreaming.d.ts +21 -0
- package/dist-types/RekognitionStreamingClient.d.ts +174 -0
- package/dist-types/commands/StartFaceLivenessSessionCommand.d.ts +39 -0
- package/dist-types/commands/StartStreamingLivenessSessionCommand.d.ts +39 -0
- package/dist-types/commands/index.d.ts +2 -0
- package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
- package/dist-types/endpoint/endpointResolver.d.ts +5 -0
- package/dist-types/endpoint/ruleset.d.ts +2 -0
- package/dist-types/index.d.ts +5 -0
- package/dist-types/models/RekognitionStreamingServiceException.d.ts +12 -0
- package/dist-types/models/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +415 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +8 -0
- package/dist-types/runtimeConfig.browser.d.ts +44 -0
- package/dist-types/runtimeConfig.d.ts +44 -0
- package/dist-types/runtimeConfig.native.d.ts +43 -0
- package/dist-types/runtimeConfig.shared.d.ts +18 -0
- package/dist-types/ts3.4/RekognitionStreaming.d.ts +38 -0
- package/dist-types/ts3.4/RekognitionStreamingClient.d.ts +147 -0
- package/dist-types/ts3.4/commands/StartFaceLivenessSessionCommand.d.ts +41 -0
- package/dist-types/ts3.4/commands/StartStreamingLivenessSessionCommand.d.ts +41 -0
- package/dist-types/ts3.4/commands/index.d.ts +2 -0
- package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +33 -0
- package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
- package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
- package/dist-types/ts3.4/index.d.ts +5 -0
- package/dist-types/ts3.4/models/RekognitionStreamingServiceException.d.ts +7 -0
- package/dist-types/ts3.4/models/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +316 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +32 -0
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +95 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +95 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +84 -0
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +20 -0
- package/package.json +104 -0
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeAws_restJson1StartStreamingLivenessSessionCommand = exports.deserializeAws_restJson1StartFaceLivenessSessionCommand = exports.serializeAws_restJson1StartStreamingLivenessSessionCommand = exports.serializeAws_restJson1StartFaceLivenessSessionCommand = void 0;
|
|
4
|
+
const protocol_http_1 = require("@aws-sdk/protocol-http");
|
|
5
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
|
+
const models_0_1 = require("../models/models_0");
|
|
7
|
+
const RekognitionStreamingServiceException_1 = require("../models/RekognitionStreamingServiceException");
|
|
8
|
+
const serializeAws_restJson1StartFaceLivenessSessionCommand = async (input, context) => {
|
|
9
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
10
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
11
|
+
"x-amz-rekognition-streaming-liveness-session-id": input.SessionId,
|
|
12
|
+
"x-amz-rekognition-streaming-liveness-client-sdk-version": input.ClientSDKVersion,
|
|
13
|
+
});
|
|
14
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/start-face-liveness-session";
|
|
15
|
+
let body;
|
|
16
|
+
if (input.LivenessRequestStream !== undefined) {
|
|
17
|
+
body = serializeAws_restJson1LivenessRequestStream(input.LivenessRequestStream, context);
|
|
18
|
+
}
|
|
19
|
+
return new protocol_http_1.HttpRequest({
|
|
20
|
+
protocol,
|
|
21
|
+
hostname,
|
|
22
|
+
port,
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers,
|
|
25
|
+
path: resolvedPath,
|
|
26
|
+
body,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.serializeAws_restJson1StartFaceLivenessSessionCommand = serializeAws_restJson1StartFaceLivenessSessionCommand;
|
|
30
|
+
const serializeAws_restJson1StartStreamingLivenessSessionCommand = async (input, context) => {
|
|
31
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
32
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
33
|
+
"x-amz-rekognition-streaming-liveness-session-id": input.SessionId,
|
|
34
|
+
"x-amz-rekognition-streaming-liveness-client-sdk-version": input.ClientSDKVersion,
|
|
35
|
+
});
|
|
36
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/start-streaming-liveness-session";
|
|
37
|
+
let body;
|
|
38
|
+
if (input.LivenessRequestStream !== undefined) {
|
|
39
|
+
body = serializeAws_restJson1LivenessRequestStream(input.LivenessRequestStream, context);
|
|
40
|
+
}
|
|
41
|
+
return new protocol_http_1.HttpRequest({
|
|
42
|
+
protocol,
|
|
43
|
+
hostname,
|
|
44
|
+
port,
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers,
|
|
47
|
+
path: resolvedPath,
|
|
48
|
+
body,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
exports.serializeAws_restJson1StartStreamingLivenessSessionCommand = serializeAws_restJson1StartStreamingLivenessSessionCommand;
|
|
52
|
+
const deserializeAws_restJson1StartFaceLivenessSessionCommand = async (output, context) => {
|
|
53
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
54
|
+
return deserializeAws_restJson1StartFaceLivenessSessionCommandError(output, context);
|
|
55
|
+
}
|
|
56
|
+
const contents = map({
|
|
57
|
+
$metadata: deserializeMetadata(output),
|
|
58
|
+
SessionId: [, output.headers["x-amz-rekognition-streaming-liveness-session-id"]],
|
|
59
|
+
});
|
|
60
|
+
const data = output.body;
|
|
61
|
+
contents.LivenessResponseStream = deserializeAws_restJson1LivenessResponseStream(data, context);
|
|
62
|
+
return contents;
|
|
63
|
+
};
|
|
64
|
+
exports.deserializeAws_restJson1StartFaceLivenessSessionCommand = deserializeAws_restJson1StartFaceLivenessSessionCommand;
|
|
65
|
+
const deserializeAws_restJson1StartFaceLivenessSessionCommandError = async (output, context) => {
|
|
66
|
+
const parsedOutput = {
|
|
67
|
+
...output,
|
|
68
|
+
body: await parseErrorBody(output.body, context),
|
|
69
|
+
};
|
|
70
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
71
|
+
switch (errorCode) {
|
|
72
|
+
case "AccessDeniedException":
|
|
73
|
+
case "com.amazonaws.rekognitionstreaming#AccessDeniedException":
|
|
74
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
75
|
+
case "InternalServerException":
|
|
76
|
+
case "com.amazonaws.rekognitionstreaming#InternalServerException":
|
|
77
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
78
|
+
case "ServiceQuotaExceededException":
|
|
79
|
+
case "com.amazonaws.rekognitionstreaming#ServiceQuotaExceededException":
|
|
80
|
+
throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
|
|
81
|
+
case "SessionNotFoundException":
|
|
82
|
+
case "com.amazonaws.rekognitionstreaming#SessionNotFoundException":
|
|
83
|
+
throw await deserializeAws_restJson1SessionNotFoundExceptionResponse(parsedOutput, context);
|
|
84
|
+
case "ThrottlingException":
|
|
85
|
+
case "com.amazonaws.rekognitionstreaming#ThrottlingException":
|
|
86
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
87
|
+
case "ValidationException":
|
|
88
|
+
case "com.amazonaws.rekognitionstreaming#ValidationException":
|
|
89
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
90
|
+
default:
|
|
91
|
+
const parsedBody = parsedOutput.body;
|
|
92
|
+
(0, smithy_client_1.throwDefaultError)({
|
|
93
|
+
output,
|
|
94
|
+
parsedBody,
|
|
95
|
+
exceptionCtor: RekognitionStreamingServiceException_1.RekognitionStreamingServiceException,
|
|
96
|
+
errorCode,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const deserializeAws_restJson1StartStreamingLivenessSessionCommand = async (output, context) => {
|
|
101
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
102
|
+
return deserializeAws_restJson1StartStreamingLivenessSessionCommandError(output, context);
|
|
103
|
+
}
|
|
104
|
+
const contents = map({
|
|
105
|
+
$metadata: deserializeMetadata(output),
|
|
106
|
+
SessionId: [, output.headers["x-amz-rekognition-streaming-liveness-session-id"]],
|
|
107
|
+
});
|
|
108
|
+
const data = output.body;
|
|
109
|
+
contents.LivenessResponseStream = deserializeAws_restJson1LivenessResponseStream(data, context);
|
|
110
|
+
return contents;
|
|
111
|
+
};
|
|
112
|
+
exports.deserializeAws_restJson1StartStreamingLivenessSessionCommand = deserializeAws_restJson1StartStreamingLivenessSessionCommand;
|
|
113
|
+
const deserializeAws_restJson1StartStreamingLivenessSessionCommandError = async (output, context) => {
|
|
114
|
+
const parsedOutput = {
|
|
115
|
+
...output,
|
|
116
|
+
body: await parseErrorBody(output.body, context),
|
|
117
|
+
};
|
|
118
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
119
|
+
switch (errorCode) {
|
|
120
|
+
case "AccessDeniedException":
|
|
121
|
+
case "com.amazonaws.rekognitionstreaming#AccessDeniedException":
|
|
122
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
123
|
+
case "InternalServerException":
|
|
124
|
+
case "com.amazonaws.rekognitionstreaming#InternalServerException":
|
|
125
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
126
|
+
case "ServiceQuotaExceededException":
|
|
127
|
+
case "com.amazonaws.rekognitionstreaming#ServiceQuotaExceededException":
|
|
128
|
+
throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
|
|
129
|
+
case "SessionNotFoundException":
|
|
130
|
+
case "com.amazonaws.rekognitionstreaming#SessionNotFoundException":
|
|
131
|
+
throw await deserializeAws_restJson1SessionNotFoundExceptionResponse(parsedOutput, context);
|
|
132
|
+
case "ThrottlingException":
|
|
133
|
+
case "com.amazonaws.rekognitionstreaming#ThrottlingException":
|
|
134
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
135
|
+
case "ValidationException":
|
|
136
|
+
case "com.amazonaws.rekognitionstreaming#ValidationException":
|
|
137
|
+
throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
138
|
+
default:
|
|
139
|
+
const parsedBody = parsedOutput.body;
|
|
140
|
+
(0, smithy_client_1.throwDefaultError)({
|
|
141
|
+
output,
|
|
142
|
+
parsedBody,
|
|
143
|
+
exceptionCtor: RekognitionStreamingServiceException_1.RekognitionStreamingServiceException,
|
|
144
|
+
errorCode,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const map = smithy_client_1.map;
|
|
149
|
+
const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
|
|
150
|
+
const contents = map({});
|
|
151
|
+
const data = parsedOutput.body;
|
|
152
|
+
if (data.Code != null) {
|
|
153
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
154
|
+
}
|
|
155
|
+
if (data.Message != null) {
|
|
156
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
157
|
+
}
|
|
158
|
+
const exception = new models_0_1.AccessDeniedException({
|
|
159
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
160
|
+
...contents,
|
|
161
|
+
});
|
|
162
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
163
|
+
};
|
|
164
|
+
const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
|
|
165
|
+
const contents = map({});
|
|
166
|
+
const data = parsedOutput.body;
|
|
167
|
+
if (data.Code != null) {
|
|
168
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
169
|
+
}
|
|
170
|
+
if (data.Message != null) {
|
|
171
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
172
|
+
}
|
|
173
|
+
const exception = new models_0_1.InternalServerException({
|
|
174
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
175
|
+
...contents,
|
|
176
|
+
});
|
|
177
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
178
|
+
};
|
|
179
|
+
const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
|
|
180
|
+
const contents = map({});
|
|
181
|
+
const data = parsedOutput.body;
|
|
182
|
+
if (data.Code != null) {
|
|
183
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
184
|
+
}
|
|
185
|
+
if (data.Message != null) {
|
|
186
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
187
|
+
}
|
|
188
|
+
const exception = new models_0_1.ServiceQuotaExceededException({
|
|
189
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
190
|
+
...contents,
|
|
191
|
+
});
|
|
192
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
193
|
+
};
|
|
194
|
+
const deserializeAws_restJson1SessionNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
195
|
+
const contents = map({});
|
|
196
|
+
const data = parsedOutput.body;
|
|
197
|
+
if (data.Code != null) {
|
|
198
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
199
|
+
}
|
|
200
|
+
if (data.Message != null) {
|
|
201
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
202
|
+
}
|
|
203
|
+
const exception = new models_0_1.SessionNotFoundException({
|
|
204
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
205
|
+
...contents,
|
|
206
|
+
});
|
|
207
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
208
|
+
};
|
|
209
|
+
const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
|
|
210
|
+
const contents = map({});
|
|
211
|
+
const data = parsedOutput.body;
|
|
212
|
+
if (data.Code != null) {
|
|
213
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
214
|
+
}
|
|
215
|
+
if (data.Message != null) {
|
|
216
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
217
|
+
}
|
|
218
|
+
const exception = new models_0_1.ThrottlingException({
|
|
219
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
220
|
+
...contents,
|
|
221
|
+
});
|
|
222
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
223
|
+
};
|
|
224
|
+
const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
|
|
225
|
+
const contents = map({});
|
|
226
|
+
const data = parsedOutput.body;
|
|
227
|
+
if (data.Code != null) {
|
|
228
|
+
contents.Code = (0, smithy_client_1.expectString)(data.Code);
|
|
229
|
+
}
|
|
230
|
+
if (data.Message != null) {
|
|
231
|
+
contents.Message = (0, smithy_client_1.expectString)(data.Message);
|
|
232
|
+
}
|
|
233
|
+
const exception = new models_0_1.ValidationException({
|
|
234
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
235
|
+
...contents,
|
|
236
|
+
});
|
|
237
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
238
|
+
};
|
|
239
|
+
const serializeAws_restJson1LivenessRequestStream = (input, context) => {
|
|
240
|
+
const eventMarshallingVisitor = (event) => models_0_1.LivenessRequestStream.visit(event, {
|
|
241
|
+
VideoEvent: (value) => serializeAws_restJson1VideoEvent_event(value, context),
|
|
242
|
+
ClientSessionInformationEvent: (value) => serializeAws_restJson1ClientSessionInformationEvent_event(value, context),
|
|
243
|
+
_: (value) => value,
|
|
244
|
+
});
|
|
245
|
+
return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
|
|
246
|
+
};
|
|
247
|
+
const serializeAws_restJson1ClientSessionInformationEvent_event = (input, context) => {
|
|
248
|
+
const headers = {
|
|
249
|
+
":event-type": { type: "string", value: "ClientSessionInformationEvent" },
|
|
250
|
+
":message-type": { type: "string", value: "event" },
|
|
251
|
+
":content-type": { type: "string", value: "application/json" },
|
|
252
|
+
};
|
|
253
|
+
let body = new Uint8Array();
|
|
254
|
+
body = serializeAws_restJson1ClientSessionInformationEvent(input, context);
|
|
255
|
+
body = context.utf8Decoder(JSON.stringify(body));
|
|
256
|
+
return { headers, body };
|
|
257
|
+
};
|
|
258
|
+
const serializeAws_restJson1VideoEvent_event = (input, context) => {
|
|
259
|
+
const headers = {
|
|
260
|
+
":event-type": { type: "string", value: "VideoEvent" },
|
|
261
|
+
":message-type": { type: "string", value: "event" },
|
|
262
|
+
":content-type": { type: "string", value: "application/json" },
|
|
263
|
+
};
|
|
264
|
+
let body = new Uint8Array();
|
|
265
|
+
body = serializeAws_restJson1VideoEvent(input, context);
|
|
266
|
+
body = context.utf8Decoder(JSON.stringify(body));
|
|
267
|
+
return { headers, body };
|
|
268
|
+
};
|
|
269
|
+
const deserializeAws_restJson1LivenessResponseStream = (output, context) => {
|
|
270
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
271
|
+
if (event["ServerSessionInformationEvent"] != null) {
|
|
272
|
+
return {
|
|
273
|
+
ServerSessionInformationEvent: await deserializeAws_restJson1ServerSessionInformationEvent_event(event["ServerSessionInformationEvent"], context),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
if (event["DisconnectionEvent"] != null) {
|
|
277
|
+
return {
|
|
278
|
+
DisconnectionEvent: await deserializeAws_restJson1DisconnectionEvent_event(event["DisconnectionEvent"], context),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
if (event["ValidationException"] != null) {
|
|
282
|
+
return {
|
|
283
|
+
ValidationException: await deserializeAws_restJson1ValidationException_event(event["ValidationException"], context),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
if (event["InternalServerException"] != null) {
|
|
287
|
+
return {
|
|
288
|
+
InternalServerException: await deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
if (event["ThrottlingException"] != null) {
|
|
292
|
+
return {
|
|
293
|
+
ThrottlingException: await deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
if (event["ServiceQuotaExceededException"] != null) {
|
|
297
|
+
return {
|
|
298
|
+
ServiceQuotaExceededException: await deserializeAws_restJson1ServiceQuotaExceededException_event(event["ServiceQuotaExceededException"], context),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return { $unknown: output };
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
const deserializeAws_restJson1DisconnectionEvent_event = async (output, context) => {
|
|
305
|
+
const contents = {};
|
|
306
|
+
const data = await parseBody(output.body, context);
|
|
307
|
+
Object.assign(contents, deserializeAws_restJson1DisconnectionEvent(data, context));
|
|
308
|
+
return contents;
|
|
309
|
+
};
|
|
310
|
+
const deserializeAws_restJson1InternalServerException_event = async (output, context) => {
|
|
311
|
+
const parsedOutput = {
|
|
312
|
+
...output,
|
|
313
|
+
body: await parseBody(output.body, context),
|
|
314
|
+
};
|
|
315
|
+
return deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
316
|
+
};
|
|
317
|
+
const deserializeAws_restJson1ServerSessionInformationEvent_event = async (output, context) => {
|
|
318
|
+
const contents = {};
|
|
319
|
+
const data = await parseBody(output.body, context);
|
|
320
|
+
Object.assign(contents, deserializeAws_restJson1ServerSessionInformationEvent(data, context));
|
|
321
|
+
return contents;
|
|
322
|
+
};
|
|
323
|
+
const deserializeAws_restJson1ServiceQuotaExceededException_event = async (output, context) => {
|
|
324
|
+
const parsedOutput = {
|
|
325
|
+
...output,
|
|
326
|
+
body: await parseBody(output.body, context),
|
|
327
|
+
};
|
|
328
|
+
return deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
|
|
329
|
+
};
|
|
330
|
+
const deserializeAws_restJson1ThrottlingException_event = async (output, context) => {
|
|
331
|
+
const parsedOutput = {
|
|
332
|
+
...output,
|
|
333
|
+
body: await parseBody(output.body, context),
|
|
334
|
+
};
|
|
335
|
+
return deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
336
|
+
};
|
|
337
|
+
const deserializeAws_restJson1ValidationException_event = async (output, context) => {
|
|
338
|
+
const parsedOutput = {
|
|
339
|
+
...output,
|
|
340
|
+
body: await parseBody(output.body, context),
|
|
341
|
+
};
|
|
342
|
+
return deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
|
|
343
|
+
};
|
|
344
|
+
const serializeAws_restJson1BoundingBox = (input, context) => {
|
|
345
|
+
return {
|
|
346
|
+
...(input.Height != null && { Height: (0, smithy_client_1.serializeFloat)(input.Height) }),
|
|
347
|
+
...(input.Left != null && { Left: (0, smithy_client_1.serializeFloat)(input.Left) }),
|
|
348
|
+
...(input.Top != null && { Top: (0, smithy_client_1.serializeFloat)(input.Top) }),
|
|
349
|
+
...(input.Width != null && { Width: (0, smithy_client_1.serializeFloat)(input.Width) }),
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
const serializeAws_restJson1ClientChallenge = (input, context) => {
|
|
353
|
+
return models_0_1.ClientChallenge.visit(input, {
|
|
354
|
+
FaceMovementAndLightChallenge: (value) => ({
|
|
355
|
+
FaceMovementAndLightChallenge: serializeAws_restJson1FaceMovementAndLightClientChallenge(value, context),
|
|
356
|
+
}),
|
|
357
|
+
_: (name, value) => ({ name: value }),
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
const serializeAws_restJson1ClientSessionInformationEvent = (input, context) => {
|
|
361
|
+
return {
|
|
362
|
+
...(input.Challenge != null && { Challenge: serializeAws_restJson1ClientChallenge(input.Challenge, context) }),
|
|
363
|
+
...(input.DeviceInformation != null && {
|
|
364
|
+
DeviceInformation: serializeAws_restJson1DeviceInformation(input.DeviceInformation, context),
|
|
365
|
+
}),
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
const serializeAws_restJson1ColorComponentList = (input, context) => {
|
|
369
|
+
return input
|
|
370
|
+
.filter((e) => e != null)
|
|
371
|
+
.map((entry) => {
|
|
372
|
+
return entry;
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
const serializeAws_restJson1ColorDisplayed = (input, context) => {
|
|
376
|
+
return {
|
|
377
|
+
...(input.CurrentColor != null && {
|
|
378
|
+
CurrentColor: serializeAws_restJson1FreshnessColor(input.CurrentColor, context),
|
|
379
|
+
}),
|
|
380
|
+
...(input.CurrentColorStartTimestamp != null && { CurrentColorStartTimestamp: input.CurrentColorStartTimestamp }),
|
|
381
|
+
...(input.PreviousColor != null && {
|
|
382
|
+
PreviousColor: serializeAws_restJson1FreshnessColor(input.PreviousColor, context),
|
|
383
|
+
}),
|
|
384
|
+
...(input.SequenceNumber != null && { SequenceNumber: input.SequenceNumber }),
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
const serializeAws_restJson1DeviceInformation = (input, context) => {
|
|
388
|
+
return {
|
|
389
|
+
...(input.ClientSDKVersion != null && { ClientSDKVersion: input.ClientSDKVersion }),
|
|
390
|
+
...(input.VideoHeight != null && { VideoHeight: (0, smithy_client_1.serializeFloat)(input.VideoHeight) }),
|
|
391
|
+
...(input.VideoWidth != null && { VideoWidth: (0, smithy_client_1.serializeFloat)(input.VideoWidth) }),
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
const serializeAws_restJson1FaceMovementAndLightClientChallenge = (input, context) => {
|
|
395
|
+
return {
|
|
396
|
+
...(input.ChallengeId != null && { ChallengeId: input.ChallengeId }),
|
|
397
|
+
...(input.ColorDisplayed != null && {
|
|
398
|
+
ColorDisplayed: serializeAws_restJson1ColorDisplayed(input.ColorDisplayed, context),
|
|
399
|
+
}),
|
|
400
|
+
...(input.InitialFace != null && { InitialFace: serializeAws_restJson1InitialFace(input.InitialFace, context) }),
|
|
401
|
+
...(input.TargetFace != null && { TargetFace: serializeAws_restJson1TargetFace(input.TargetFace, context) }),
|
|
402
|
+
...(input.VideoStartTimestamp != null && { VideoStartTimestamp: input.VideoStartTimestamp }),
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
const serializeAws_restJson1FreshnessColor = (input, context) => {
|
|
406
|
+
return {
|
|
407
|
+
...(input.RGB != null && { RGB: serializeAws_restJson1ColorComponentList(input.RGB, context) }),
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
const serializeAws_restJson1InitialFace = (input, context) => {
|
|
411
|
+
return {
|
|
412
|
+
...(input.BoundingBox != null && { BoundingBox: serializeAws_restJson1BoundingBox(input.BoundingBox, context) }),
|
|
413
|
+
...(input.InitialFaceDetectedTimestamp != null && {
|
|
414
|
+
InitialFaceDetectedTimestamp: input.InitialFaceDetectedTimestamp,
|
|
415
|
+
}),
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
const serializeAws_restJson1TargetFace = (input, context) => {
|
|
419
|
+
return {
|
|
420
|
+
...(input.BoundingBox != null && { BoundingBox: serializeAws_restJson1BoundingBox(input.BoundingBox, context) }),
|
|
421
|
+
...(input.FaceDetectedInTargetPositionEndTimestamp != null && {
|
|
422
|
+
FaceDetectedInTargetPositionEndTimestamp: input.FaceDetectedInTargetPositionEndTimestamp,
|
|
423
|
+
}),
|
|
424
|
+
...(input.FaceDetectedInTargetPositionStartTimestamp != null && {
|
|
425
|
+
FaceDetectedInTargetPositionStartTimestamp: input.FaceDetectedInTargetPositionStartTimestamp,
|
|
426
|
+
}),
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
const serializeAws_restJson1VideoEvent = (input, context) => {
|
|
430
|
+
return {
|
|
431
|
+
...(input.TimestampMillis != null && { TimestampMillis: input.TimestampMillis }),
|
|
432
|
+
...(input.VideoChunk != null && { VideoChunk: context.base64Encoder(input.VideoChunk) }),
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
const deserializeAws_restJson1ColorComponentList = (output, context) => {
|
|
436
|
+
const retVal = (output || [])
|
|
437
|
+
.filter((e) => e != null)
|
|
438
|
+
.map((entry) => {
|
|
439
|
+
if (entry === null) {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
return (0, smithy_client_1.expectInt32)(entry);
|
|
443
|
+
});
|
|
444
|
+
return retVal;
|
|
445
|
+
};
|
|
446
|
+
const deserializeAws_restJson1ColorSequence = (output, context) => {
|
|
447
|
+
return {
|
|
448
|
+
DownscrollDuration: (0, smithy_client_1.limitedParseFloat32)(output.DownscrollDuration),
|
|
449
|
+
FlatDisplayDuration: (0, smithy_client_1.limitedParseFloat32)(output.FlatDisplayDuration),
|
|
450
|
+
FreshnessColor: output.FreshnessColor != null
|
|
451
|
+
? deserializeAws_restJson1FreshnessColor(output.FreshnessColor, context)
|
|
452
|
+
: undefined,
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
const deserializeAws_restJson1ColorSequences = (output, context) => {
|
|
456
|
+
const retVal = (output || [])
|
|
457
|
+
.filter((e) => e != null)
|
|
458
|
+
.map((entry) => {
|
|
459
|
+
if (entry === null) {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
return deserializeAws_restJson1ColorSequence(entry, context);
|
|
463
|
+
});
|
|
464
|
+
return retVal;
|
|
465
|
+
};
|
|
466
|
+
const deserializeAws_restJson1DisconnectionEvent = (output, context) => {
|
|
467
|
+
return {
|
|
468
|
+
TimestampMillis: (0, smithy_client_1.expectLong)(output.TimestampMillis),
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
const deserializeAws_restJson1FaceMovementAndLightServerChallenge = (output, context) => {
|
|
472
|
+
return {
|
|
473
|
+
ColorSequences: output.ColorSequences != null
|
|
474
|
+
? deserializeAws_restJson1ColorSequences(output.ColorSequences, context)
|
|
475
|
+
: undefined,
|
|
476
|
+
LightChallengeType: (0, smithy_client_1.expectString)(output.LightChallengeType),
|
|
477
|
+
OvalScaleFactors: output.OvalScaleFactors != null
|
|
478
|
+
? deserializeAws_restJson1OvalScaleFactors(output.OvalScaleFactors, context)
|
|
479
|
+
: undefined,
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
const deserializeAws_restJson1FreshnessColor = (output, context) => {
|
|
483
|
+
return {
|
|
484
|
+
RGB: output.RGB != null ? deserializeAws_restJson1ColorComponentList(output.RGB, context) : undefined,
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
const deserializeAws_restJson1OvalScaleFactors = (output, context) => {
|
|
488
|
+
return {
|
|
489
|
+
CenterX: (0, smithy_client_1.limitedParseFloat32)(output.CenterX),
|
|
490
|
+
CenterY: (0, smithy_client_1.limitedParseFloat32)(output.CenterY),
|
|
491
|
+
Width: (0, smithy_client_1.limitedParseFloat32)(output.Width),
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
const deserializeAws_restJson1ServerChallenge = (output, context) => {
|
|
495
|
+
if (output.FaceMovementAndLightChallenge != null) {
|
|
496
|
+
return {
|
|
497
|
+
FaceMovementAndLightChallenge: deserializeAws_restJson1FaceMovementAndLightServerChallenge(output.FaceMovementAndLightChallenge, context),
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
return { $unknown: Object.entries(output)[0] };
|
|
501
|
+
};
|
|
502
|
+
const deserializeAws_restJson1ServerSessionInformationEvent = (output, context) => {
|
|
503
|
+
return {
|
|
504
|
+
SessionInformation: output.SessionInformation != null
|
|
505
|
+
? deserializeAws_restJson1SessionInformation(output.SessionInformation, context)
|
|
506
|
+
: undefined,
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
const deserializeAws_restJson1SessionInformation = (output, context) => {
|
|
510
|
+
return {
|
|
511
|
+
Challenge: output.Challenge != null
|
|
512
|
+
? deserializeAws_restJson1ServerChallenge((0, smithy_client_1.expectUnion)(output.Challenge), context)
|
|
513
|
+
: undefined,
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
const deserializeMetadata = (output) => ({
|
|
517
|
+
httpStatusCode: output.statusCode,
|
|
518
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
519
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
520
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
521
|
+
});
|
|
522
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
523
|
+
if (streamBody instanceof Uint8Array) {
|
|
524
|
+
return Promise.resolve(streamBody);
|
|
525
|
+
}
|
|
526
|
+
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
527
|
+
};
|
|
528
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
529
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
530
|
+
value !== null &&
|
|
531
|
+
value !== "" &&
|
|
532
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
533
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
534
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
535
|
+
if (encoded.length) {
|
|
536
|
+
return JSON.parse(encoded);
|
|
537
|
+
}
|
|
538
|
+
return {};
|
|
539
|
+
});
|
|
540
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
541
|
+
const value = await parseBody(errorBody, context);
|
|
542
|
+
value.message = value.message ?? value.Message;
|
|
543
|
+
return value;
|
|
544
|
+
};
|
|
545
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
546
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
547
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
548
|
+
let cleanValue = rawValue;
|
|
549
|
+
if (typeof cleanValue === "number") {
|
|
550
|
+
cleanValue = cleanValue.toString();
|
|
551
|
+
}
|
|
552
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
553
|
+
cleanValue = cleanValue.split(",")[0];
|
|
554
|
+
}
|
|
555
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
556
|
+
cleanValue = cleanValue.split(":")[0];
|
|
557
|
+
}
|
|
558
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
559
|
+
cleanValue = cleanValue.split("#")[1];
|
|
560
|
+
}
|
|
561
|
+
return cleanValue;
|
|
562
|
+
};
|
|
563
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
564
|
+
if (headerKey !== undefined) {
|
|
565
|
+
return sanitizeErrorCode(output.headers[headerKey]);
|
|
566
|
+
}
|
|
567
|
+
if (data.code !== undefined) {
|
|
568
|
+
return sanitizeErrorCode(data.code);
|
|
569
|
+
}
|
|
570
|
+
if (data["__type"] !== undefined) {
|
|
571
|
+
return sanitizeErrorCode(data["__type"]);
|
|
572
|
+
}
|
|
573
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
|
|
7
|
+
const config_resolver_1 = require("@aws-sdk/config-resolver");
|
|
8
|
+
const eventstream_serde_browser_1 = require("@aws-sdk/eventstream-serde-browser");
|
|
9
|
+
const fetch_http_handler_1 = require("@aws-sdk/fetch-http-handler");
|
|
10
|
+
const invalid_dependency_1 = require("@aws-sdk/invalid-dependency");
|
|
11
|
+
const middleware_websocket_1 = require("@aws-sdk/middleware-websocket");
|
|
12
|
+
const util_body_length_browser_1 = require("@aws-sdk/util-body-length-browser");
|
|
13
|
+
const util_retry_1 = require("@aws-sdk/util-retry");
|
|
14
|
+
const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
|
|
15
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
16
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
17
|
+
const util_defaults_mode_browser_1 = require("@aws-sdk/util-defaults-mode-browser");
|
|
18
|
+
const getRuntimeConfig = (config) => {
|
|
19
|
+
const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
|
|
20
|
+
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
|
21
|
+
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
|
22
|
+
return {
|
|
23
|
+
...clientSharedValues,
|
|
24
|
+
...config,
|
|
25
|
+
runtime: "browser",
|
|
26
|
+
defaultsMode,
|
|
27
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
|
|
28
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
29
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
30
|
+
(0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
|
31
|
+
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? middleware_websocket_1.eventStreamPayloadHandlerProvider,
|
|
32
|
+
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_browser_1.eventStreamSerdeProvider,
|
|
33
|
+
maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
|
|
34
|
+
region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
|
|
35
|
+
requestHandler: config?.requestHandler ??
|
|
36
|
+
new middleware_websocket_1.WebSocketFetchHandler(defaultConfigProvider, new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider)),
|
|
37
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
|
|
38
|
+
sha256: config?.sha256 ?? sha256_browser_1.Sha256,
|
|
39
|
+
streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
|
|
40
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
41
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
7
|
+
const config_resolver_1 = require("@aws-sdk/config-resolver");
|
|
8
|
+
const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
|
|
9
|
+
const eventstream_handler_node_1 = require("@aws-sdk/eventstream-handler-node");
|
|
10
|
+
const eventstream_serde_node_1 = require("@aws-sdk/eventstream-serde-node");
|
|
11
|
+
const hash_node_1 = require("@aws-sdk/hash-node");
|
|
12
|
+
const middleware_retry_1 = require("@aws-sdk/middleware-retry");
|
|
13
|
+
const node_config_provider_1 = require("@aws-sdk/node-config-provider");
|
|
14
|
+
const node_http_handler_1 = require("@aws-sdk/node-http-handler");
|
|
15
|
+
const util_body_length_node_1 = require("@aws-sdk/util-body-length-node");
|
|
16
|
+
const util_retry_1 = require("@aws-sdk/util-retry");
|
|
17
|
+
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
|
|
18
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
19
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
20
|
+
const util_defaults_mode_node_1 = require("@aws-sdk/util-defaults-mode-node");
|
|
21
|
+
const smithy_client_2 = require("@aws-sdk/smithy-client");
|
|
22
|
+
const getRuntimeConfig = (config) => {
|
|
23
|
+
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
|
24
|
+
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
|
25
|
+
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
|
26
|
+
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
|
27
|
+
return {
|
|
28
|
+
...clientSharedValues,
|
|
29
|
+
...config,
|
|
30
|
+
runtime: "node",
|
|
31
|
+
defaultsMode,
|
|
32
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
|
33
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, client_sts_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider),
|
|
34
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
35
|
+
(0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
|
36
|
+
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventstream_handler_node_1.eventStreamPayloadHandlerProvider,
|
|
37
|
+
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
|
|
38
|
+
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
39
|
+
region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
40
|
+
requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider),
|
|
41
|
+
retryMode: config?.retryMode ??
|
|
42
|
+
(0, node_config_provider_1.loadConfig)({
|
|
43
|
+
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
44
|
+
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
|
45
|
+
}),
|
|
46
|
+
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
|
|
47
|
+
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
|
48
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
49
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|