@aws-sdk/client-connect-contact-lens 3.180.0 → 3.183.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/CHANGELOG.md +20 -0
- package/dist-cjs/protocols/Aws_restJson1.js +7 -1
- package/dist-es/ConnectContactLens.js +6 -13
- package/dist-es/ConnectContactLensClient.js +22 -28
- package/dist-es/commands/ListRealtimeContactAnalysisSegmentsCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/ConnectContactLensServiceException.js +5 -10
- package/dist-es/models/models_0.js +87 -70
- package/dist-es/pagination/ListRealtimeContactAnalysisSegmentsPaginator.js +25 -68
- package/dist-es/protocols/Aws_restJson1.js +182 -215
- package/dist-es/runtimeConfig.browser.js +26 -12
- package/dist-es/runtimeConfig.js +30 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +33 -33
|
@@ -1,170 +1,141 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { ConnectContactLensServiceException as __BaseException } from "../models/ConnectContactLensServiceException";
|
|
5
4
|
import { AccessDeniedException, InternalServiceException, InvalidRequestException, ResourceNotFoundException, ThrottlingException, } from "../models/models_0";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return [2, new __HttpRequest({
|
|
20
|
-
protocol: protocol,
|
|
21
|
-
hostname: hostname,
|
|
22
|
-
port: port,
|
|
23
|
-
method: "POST",
|
|
24
|
-
headers: headers,
|
|
25
|
-
path: resolvedPath,
|
|
26
|
-
body: body,
|
|
27
|
-
})];
|
|
28
|
-
}
|
|
5
|
+
export const serializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {
|
|
8
|
+
"content-type": "application/json",
|
|
9
|
+
};
|
|
10
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
11
|
+
"/realtime-contact-analysis/analysis-segments";
|
|
12
|
+
let body;
|
|
13
|
+
body = JSON.stringify({
|
|
14
|
+
...(input.ContactId != null && { ContactId: input.ContactId }),
|
|
15
|
+
...(input.InstanceId != null && { InstanceId: input.InstanceId }),
|
|
16
|
+
...(input.MaxResults != null && { MaxResults: input.MaxResults }),
|
|
17
|
+
...(input.NextToken != null && { NextToken: input.NextToken }),
|
|
29
18
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
contents = map({
|
|
40
|
-
$metadata: deserializeMetadata(output),
|
|
41
|
-
});
|
|
42
|
-
_a = __expectNonNull;
|
|
43
|
-
_b = __expectObject;
|
|
44
|
-
return [4, parseBody(output.body, context)];
|
|
45
|
-
case 1:
|
|
46
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
47
|
-
if (data.NextToken != null) {
|
|
48
|
-
contents.NextToken = __expectString(data.NextToken);
|
|
49
|
-
}
|
|
50
|
-
if (data.Segments != null) {
|
|
51
|
-
contents.Segments = deserializeAws_restJson1RealtimeContactAnalysisSegments(data.Segments, context);
|
|
52
|
-
}
|
|
53
|
-
return [2, contents];
|
|
54
|
-
}
|
|
19
|
+
return new __HttpRequest({
|
|
20
|
+
protocol,
|
|
21
|
+
hostname,
|
|
22
|
+
port,
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers,
|
|
25
|
+
path: resolvedPath,
|
|
26
|
+
body,
|
|
55
27
|
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_a = [__assign({}, output)];
|
|
64
|
-
_c = {};
|
|
65
|
-
return [4, parseBody(output.body, context)];
|
|
66
|
-
case 1:
|
|
67
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
68
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
69
|
-
_b = errorCode;
|
|
70
|
-
switch (_b) {
|
|
71
|
-
case "AccessDeniedException": return [3, 2];
|
|
72
|
-
case "com.amazonaws.connectcontactlens#AccessDeniedException": return [3, 2];
|
|
73
|
-
case "InternalServiceException": return [3, 4];
|
|
74
|
-
case "com.amazonaws.connectcontactlens#InternalServiceException": return [3, 4];
|
|
75
|
-
case "InvalidRequestException": return [3, 6];
|
|
76
|
-
case "com.amazonaws.connectcontactlens#InvalidRequestException": return [3, 6];
|
|
77
|
-
case "ResourceNotFoundException": return [3, 8];
|
|
78
|
-
case "com.amazonaws.connectcontactlens#ResourceNotFoundException": return [3, 8];
|
|
79
|
-
case "ThrottlingException": return [3, 10];
|
|
80
|
-
case "com.amazonaws.connectcontactlens#ThrottlingException": return [3, 10];
|
|
81
|
-
}
|
|
82
|
-
return [3, 12];
|
|
83
|
-
case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
84
|
-
case 3: throw _d.sent();
|
|
85
|
-
case 4: return [4, deserializeAws_restJson1InternalServiceExceptionResponse(parsedOutput, context)];
|
|
86
|
-
case 5: throw _d.sent();
|
|
87
|
-
case 6: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
|
|
88
|
-
case 7: throw _d.sent();
|
|
89
|
-
case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
90
|
-
case 9: throw _d.sent();
|
|
91
|
-
case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
|
|
92
|
-
case 11: throw _d.sent();
|
|
93
|
-
case 12:
|
|
94
|
-
parsedBody = parsedOutput.body;
|
|
95
|
-
throwDefaultError({
|
|
96
|
-
output: output,
|
|
97
|
-
parsedBody: parsedBody,
|
|
98
|
-
exceptionCtor: __BaseException,
|
|
99
|
-
errorCode: errorCode,
|
|
100
|
-
});
|
|
101
|
-
_d.label = 13;
|
|
102
|
-
case 13: return [2];
|
|
103
|
-
}
|
|
28
|
+
};
|
|
29
|
+
export const deserializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommand = async (output, context) => {
|
|
30
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
31
|
+
return deserializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommandError(output, context);
|
|
32
|
+
}
|
|
33
|
+
const contents = map({
|
|
34
|
+
$metadata: deserializeMetadata(output),
|
|
104
35
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
contents =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
36
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
37
|
+
if (data.NextToken != null) {
|
|
38
|
+
contents.NextToken = __expectString(data.NextToken);
|
|
39
|
+
}
|
|
40
|
+
if (data.Segments != null) {
|
|
41
|
+
contents.Segments = deserializeAws_restJson1RealtimeContactAnalysisSegments(data.Segments, context);
|
|
42
|
+
}
|
|
43
|
+
return contents;
|
|
44
|
+
};
|
|
45
|
+
const deserializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommandError = async (output, context) => {
|
|
46
|
+
const parsedOutput = {
|
|
47
|
+
...output,
|
|
48
|
+
body: await parseErrorBody(output.body, context),
|
|
49
|
+
};
|
|
50
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
51
|
+
switch (errorCode) {
|
|
52
|
+
case "AccessDeniedException":
|
|
53
|
+
case "com.amazonaws.connectcontactlens#AccessDeniedException":
|
|
54
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
55
|
+
case "InternalServiceException":
|
|
56
|
+
case "com.amazonaws.connectcontactlens#InternalServiceException":
|
|
57
|
+
throw await deserializeAws_restJson1InternalServiceExceptionResponse(parsedOutput, context);
|
|
58
|
+
case "InvalidRequestException":
|
|
59
|
+
case "com.amazonaws.connectcontactlens#InvalidRequestException":
|
|
60
|
+
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
|
|
61
|
+
case "ResourceNotFoundException":
|
|
62
|
+
case "com.amazonaws.connectcontactlens#ResourceNotFoundException":
|
|
63
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
64
|
+
case "ThrottlingException":
|
|
65
|
+
case "com.amazonaws.connectcontactlens#ThrottlingException":
|
|
66
|
+
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
|
|
67
|
+
default:
|
|
68
|
+
const parsedBody = parsedOutput.body;
|
|
69
|
+
throwDefaultError({
|
|
70
|
+
output,
|
|
71
|
+
parsedBody,
|
|
72
|
+
exceptionCtor: __BaseException,
|
|
73
|
+
errorCode,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const map = __map;
|
|
78
|
+
const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
|
|
79
|
+
const contents = map({});
|
|
80
|
+
const data = parsedOutput.body;
|
|
81
|
+
if (data.Message != null) {
|
|
82
|
+
contents.Message = __expectString(data.Message);
|
|
83
|
+
}
|
|
84
|
+
const exception = new AccessDeniedException({
|
|
85
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
86
|
+
...contents,
|
|
117
87
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
88
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
89
|
+
};
|
|
90
|
+
const deserializeAws_restJson1InternalServiceExceptionResponse = async (parsedOutput, context) => {
|
|
91
|
+
const contents = map({});
|
|
92
|
+
const data = parsedOutput.body;
|
|
93
|
+
if (data.Message != null) {
|
|
94
|
+
contents.Message = __expectString(data.Message);
|
|
95
|
+
}
|
|
96
|
+
const exception = new InternalServiceException({
|
|
97
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
98
|
+
...contents,
|
|
129
99
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
100
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
101
|
+
};
|
|
102
|
+
const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
|
|
103
|
+
const contents = map({});
|
|
104
|
+
const data = parsedOutput.body;
|
|
105
|
+
if (data.Message != null) {
|
|
106
|
+
contents.Message = __expectString(data.Message);
|
|
107
|
+
}
|
|
108
|
+
const exception = new InvalidRequestException({
|
|
109
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
110
|
+
...contents,
|
|
141
111
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
112
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
113
|
+
};
|
|
114
|
+
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
115
|
+
const contents = map({});
|
|
116
|
+
const data = parsedOutput.body;
|
|
117
|
+
if (data.Message != null) {
|
|
118
|
+
contents.Message = __expectString(data.Message);
|
|
119
|
+
}
|
|
120
|
+
const exception = new ResourceNotFoundException({
|
|
121
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
122
|
+
...contents,
|
|
153
123
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
124
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
125
|
+
};
|
|
126
|
+
const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
|
|
127
|
+
const contents = map({});
|
|
128
|
+
const data = parsedOutput.body;
|
|
129
|
+
if (data.Message != null) {
|
|
130
|
+
contents.Message = __expectString(data.Message);
|
|
131
|
+
}
|
|
132
|
+
const exception = new ThrottlingException({
|
|
133
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
134
|
+
...contents,
|
|
165
135
|
});
|
|
166
|
-
|
|
167
|
-
|
|
136
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
137
|
+
};
|
|
138
|
+
const deserializeAws_restJson1Categories = (output, context) => {
|
|
168
139
|
return {
|
|
169
140
|
MatchedCategories: output.MatchedCategories != null
|
|
170
141
|
? deserializeAws_restJson1MatchedCategories(output.MatchedCategories, context)
|
|
@@ -174,30 +145,30 @@ var deserializeAws_restJson1Categories = function (output, context) {
|
|
|
174
145
|
: undefined,
|
|
175
146
|
};
|
|
176
147
|
};
|
|
177
|
-
|
|
148
|
+
const deserializeAws_restJson1CategoryDetails = (output, context) => {
|
|
178
149
|
return {
|
|
179
150
|
PointsOfInterest: output.PointsOfInterest != null
|
|
180
151
|
? deserializeAws_restJson1PointsOfInterest(output.PointsOfInterest, context)
|
|
181
152
|
: undefined,
|
|
182
153
|
};
|
|
183
154
|
};
|
|
184
|
-
|
|
155
|
+
const deserializeAws_restJson1CharacterOffsets = (output, context) => {
|
|
185
156
|
return {
|
|
186
157
|
BeginOffsetChar: __expectInt32(output.BeginOffsetChar),
|
|
187
158
|
EndOffsetChar: __expectInt32(output.EndOffsetChar),
|
|
188
159
|
};
|
|
189
160
|
};
|
|
190
|
-
|
|
161
|
+
const deserializeAws_restJson1IssueDetected = (output, context) => {
|
|
191
162
|
return {
|
|
192
163
|
CharacterOffsets: output.CharacterOffsets != null
|
|
193
164
|
? deserializeAws_restJson1CharacterOffsets(output.CharacterOffsets, context)
|
|
194
165
|
: undefined,
|
|
195
166
|
};
|
|
196
167
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
.filter(
|
|
200
|
-
.map(
|
|
168
|
+
const deserializeAws_restJson1IssuesDetected = (output, context) => {
|
|
169
|
+
const retVal = (output || [])
|
|
170
|
+
.filter((e) => e != null)
|
|
171
|
+
.map((entry) => {
|
|
201
172
|
if (entry === null) {
|
|
202
173
|
return null;
|
|
203
174
|
}
|
|
@@ -205,10 +176,10 @@ var deserializeAws_restJson1IssuesDetected = function (output, context) {
|
|
|
205
176
|
});
|
|
206
177
|
return retVal;
|
|
207
178
|
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.filter(
|
|
211
|
-
.map(
|
|
179
|
+
const deserializeAws_restJson1MatchedCategories = (output, context) => {
|
|
180
|
+
const retVal = (output || [])
|
|
181
|
+
.filter((e) => e != null)
|
|
182
|
+
.map((entry) => {
|
|
212
183
|
if (entry === null) {
|
|
213
184
|
return null;
|
|
214
185
|
}
|
|
@@ -216,26 +187,27 @@ var deserializeAws_restJson1MatchedCategories = function (output, context) {
|
|
|
216
187
|
});
|
|
217
188
|
return retVal;
|
|
218
189
|
};
|
|
219
|
-
|
|
220
|
-
return Object.entries(output).reduce(
|
|
221
|
-
var _b;
|
|
222
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
190
|
+
const deserializeAws_restJson1MatchedDetails = (output, context) => {
|
|
191
|
+
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
223
192
|
if (value === null) {
|
|
224
193
|
return acc;
|
|
225
194
|
}
|
|
226
|
-
return
|
|
195
|
+
return {
|
|
196
|
+
...acc,
|
|
197
|
+
[key]: deserializeAws_restJson1CategoryDetails(value, context),
|
|
198
|
+
};
|
|
227
199
|
}, {});
|
|
228
200
|
};
|
|
229
|
-
|
|
201
|
+
const deserializeAws_restJson1PointOfInterest = (output, context) => {
|
|
230
202
|
return {
|
|
231
203
|
BeginOffsetMillis: __expectInt32(output.BeginOffsetMillis),
|
|
232
204
|
EndOffsetMillis: __expectInt32(output.EndOffsetMillis),
|
|
233
205
|
};
|
|
234
206
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
.filter(
|
|
238
|
-
.map(
|
|
207
|
+
const deserializeAws_restJson1PointsOfInterest = (output, context) => {
|
|
208
|
+
const retVal = (output || [])
|
|
209
|
+
.filter((e) => e != null)
|
|
210
|
+
.map((entry) => {
|
|
239
211
|
if (entry === null) {
|
|
240
212
|
return null;
|
|
241
213
|
}
|
|
@@ -243,16 +215,16 @@ var deserializeAws_restJson1PointsOfInterest = function (output, context) {
|
|
|
243
215
|
});
|
|
244
216
|
return retVal;
|
|
245
217
|
};
|
|
246
|
-
|
|
218
|
+
const deserializeAws_restJson1RealtimeContactAnalysisSegment = (output, context) => {
|
|
247
219
|
return {
|
|
248
220
|
Categories: output.Categories != null ? deserializeAws_restJson1Categories(output.Categories, context) : undefined,
|
|
249
221
|
Transcript: output.Transcript != null ? deserializeAws_restJson1Transcript(output.Transcript, context) : undefined,
|
|
250
222
|
};
|
|
251
223
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
.filter(
|
|
255
|
-
.map(
|
|
224
|
+
const deserializeAws_restJson1RealtimeContactAnalysisSegments = (output, context) => {
|
|
225
|
+
const retVal = (output || [])
|
|
226
|
+
.filter((e) => e != null)
|
|
227
|
+
.map((entry) => {
|
|
256
228
|
if (entry === null) {
|
|
257
229
|
return null;
|
|
258
230
|
}
|
|
@@ -260,7 +232,7 @@ var deserializeAws_restJson1RealtimeContactAnalysisSegments = function (output,
|
|
|
260
232
|
});
|
|
261
233
|
return retVal;
|
|
262
234
|
};
|
|
263
|
-
|
|
235
|
+
const deserializeAws_restJson1Transcript = (output, context) => {
|
|
264
236
|
return {
|
|
265
237
|
BeginOffsetMillis: __expectInt32(output.BeginOffsetMillis),
|
|
266
238
|
Content: __expectString(output.Content),
|
|
@@ -274,44 +246,39 @@ var deserializeAws_restJson1Transcript = function (output, context) {
|
|
|
274
246
|
Sentiment: __expectString(output.Sentiment),
|
|
275
247
|
};
|
|
276
248
|
};
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
var collectBody = function (streamBody, context) {
|
|
287
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
249
|
+
const deserializeMetadata = (output) => ({
|
|
250
|
+
httpStatusCode: output.statusCode,
|
|
251
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
252
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
253
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
254
|
+
});
|
|
255
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
288
256
|
if (streamBody instanceof Uint8Array) {
|
|
289
257
|
return Promise.resolve(streamBody);
|
|
290
258
|
}
|
|
291
259
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
292
260
|
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
261
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
262
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
263
|
+
value !== null &&
|
|
264
|
+
value !== "" &&
|
|
265
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
266
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
267
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
268
|
+
if (encoded.length) {
|
|
269
|
+
return JSON.parse(encoded);
|
|
270
|
+
}
|
|
271
|
+
return {};
|
|
272
|
+
});
|
|
273
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
274
|
+
const value = await parseBody(errorBody, context);
|
|
275
|
+
value.message = value.message ?? value.Message;
|
|
276
|
+
return value;
|
|
310
277
|
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
278
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
279
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
280
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
281
|
+
let cleanValue = rawValue;
|
|
315
282
|
if (typeof cleanValue === "number") {
|
|
316
283
|
cleanValue = cleanValue.toString();
|
|
317
284
|
}
|
|
@@ -326,7 +293,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
326
293
|
}
|
|
327
294
|
return cleanValue;
|
|
328
295
|
};
|
|
329
|
-
|
|
296
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
330
297
|
if (headerKey !== undefined) {
|
|
331
298
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
332
299
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import packageInfo from "../package.json";
|
|
3
2
|
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
4
3
|
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
|
|
@@ -12,15 +11,30 @@ import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
|
12
11
|
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
12
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
14
13
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export const getRuntimeConfig = (config) => {
|
|
15
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
16
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
17
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
18
|
+
return {
|
|
19
|
+
...clientSharedValues,
|
|
20
|
+
...config,
|
|
21
|
+
runtime: "browser",
|
|
22
|
+
defaultsMode,
|
|
23
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
24
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
25
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
26
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
27
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
28
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
29
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
30
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
31
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
32
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
33
|
+
sha256: config?.sha256 ?? Sha256,
|
|
34
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
35
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
36
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
37
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
38
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
39
|
+
};
|
|
26
40
|
};
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import packageInfo from "../package.json";
|
|
3
2
|
import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
|
|
4
3
|
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@aws-sdk/config-resolver";
|
|
@@ -15,16 +14,35 @@ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shar
|
|
|
15
14
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
16
15
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-node";
|
|
17
16
|
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
18
|
-
export
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
17
|
+
export const getRuntimeConfig = (config) => {
|
|
20
18
|
emitWarningIfUnsupportedVersion(process.version);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
20
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
21
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
22
|
+
return {
|
|
23
|
+
...clientSharedValues,
|
|
24
|
+
...config,
|
|
25
|
+
runtime: "node",
|
|
26
|
+
defaultsMode,
|
|
27
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
28
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
29
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
30
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
31
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
32
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
33
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
34
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
35
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
36
|
+
retryMode: config?.retryMode ??
|
|
37
|
+
loadNodeConfig({
|
|
38
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
39
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
40
|
+
}),
|
|
41
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
42
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
43
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
44
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
45
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
46
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
47
|
+
};
|
|
30
48
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
3
2
|
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
5
|
+
return {
|
|
6
|
+
...browserDefaults,
|
|
7
|
+
...config,
|
|
8
|
+
runtime: "react-native",
|
|
9
|
+
sha256: config?.sha256 ?? Sha256,
|
|
10
|
+
};
|
|
8
11
|
};
|