@aws-sdk/client-workmailmessageflow 3.185.0 → 3.188.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 +19 -0
- package/dist-cjs/protocols/Aws_restJson1.js +1 -0
- package/dist-cjs/runtimeConfig.browser.js +9 -7
- package/dist-cjs/runtimeConfig.js +9 -7
- package/dist-es/WorkMailMessageFlow.js +10 -17
- package/dist-es/WorkMailMessageFlowClient.js +22 -28
- package/dist-es/commands/GetRawMessageContentCommand.js +21 -28
- package/dist-es/commands/PutRawMessageContentCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/WorkMailMessageFlowServiceException.js +5 -10
- package/dist-es/models/models_0.js +62 -51
- package/dist-es/protocols/Aws_restJson1.js +185 -247
- package/dist-es/runtimeConfig.browser.js +28 -12
- package/dist-es/runtimeConfig.js +32 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/dist-types/WorkMailMessageFlowClient.d.ts +6 -1
- package/dist-types/commands/GetRawMessageContentCommand.d.ts +2 -2
- package/dist-types/protocols/Aws_restJson1.d.ts +2 -2
- package/dist-types/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/runtimeConfig.d.ts +1 -0
- package/dist-types/runtimeConfig.native.d.ts +1 -0
- package/dist-types/ts3.4/WorkMailMessageFlowClient.d.ts +2 -0
- package/dist-types/ts3.4/commands/GetRawMessageContentCommand.d.ts +2 -1
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +5 -2
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
- package/package.json +35 -33
|
@@ -1,271 +1,209 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { InvalidContentLocation, MessageFrozen, MessageRejected, ResourceNotFoundException, } from "../models/models_0";
|
|
5
4
|
import { WorkMailMessageFlowServiceException as __BaseException } from "../models/WorkMailMessageFlowServiceException";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
method: "GET",
|
|
21
|
-
headers: headers,
|
|
22
|
-
path: resolvedPath,
|
|
23
|
-
body: body,
|
|
24
|
-
})];
|
|
25
|
-
}
|
|
5
|
+
export const serializeAws_restJson1GetRawMessageContentCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {};
|
|
8
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/messages/{messageId}";
|
|
9
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "messageId", () => input.messageId, "{messageId}", false);
|
|
10
|
+
let body;
|
|
11
|
+
return new __HttpRequest({
|
|
12
|
+
protocol,
|
|
13
|
+
hostname,
|
|
14
|
+
port,
|
|
15
|
+
method: "GET",
|
|
16
|
+
headers,
|
|
17
|
+
path: resolvedPath,
|
|
18
|
+
body,
|
|
26
19
|
});
|
|
27
|
-
}
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/messages/{messageId}";
|
|
39
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "messageId", function () { return input.messageId; }, "{messageId}", false);
|
|
40
|
-
body = JSON.stringify(__assign({}, (input.content != null && { content: serializeAws_restJson1RawMessageContent(input.content, context) })));
|
|
41
|
-
return [2, new __HttpRequest({
|
|
42
|
-
protocol: protocol,
|
|
43
|
-
hostname: hostname,
|
|
44
|
-
port: port,
|
|
45
|
-
method: "POST",
|
|
46
|
-
headers: headers,
|
|
47
|
-
path: resolvedPath,
|
|
48
|
-
body: body,
|
|
49
|
-
})];
|
|
50
|
-
}
|
|
20
|
+
};
|
|
21
|
+
export const serializeAws_restJson1PutRawMessageContentCommand = async (input, context) => {
|
|
22
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
23
|
+
const headers = {
|
|
24
|
+
"content-type": "application/json",
|
|
25
|
+
};
|
|
26
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/messages/{messageId}";
|
|
27
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "messageId", () => input.messageId, "{messageId}", false);
|
|
28
|
+
let body;
|
|
29
|
+
body = JSON.stringify({
|
|
30
|
+
...(input.content != null && { content: serializeAws_restJson1RawMessageContent(input.content, context) }),
|
|
51
31
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$metadata: deserializeMetadata(output),
|
|
61
|
-
});
|
|
62
|
-
data = output.body;
|
|
63
|
-
contents.messageContent = data;
|
|
64
|
-
return [2, contents];
|
|
32
|
+
return new __HttpRequest({
|
|
33
|
+
protocol,
|
|
34
|
+
hostname,
|
|
35
|
+
port,
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers,
|
|
38
|
+
path: resolvedPath,
|
|
39
|
+
body,
|
|
65
40
|
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_a = [__assign({}, output)];
|
|
74
|
-
_c = {};
|
|
75
|
-
return [4, parseErrorBody(output.body, context)];
|
|
76
|
-
case 1:
|
|
77
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
78
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
79
|
-
_b = errorCode;
|
|
80
|
-
switch (_b) {
|
|
81
|
-
case "ResourceNotFoundException": return [3, 2];
|
|
82
|
-
case "com.amazonaws.workmailmessageflow#ResourceNotFoundException": return [3, 2];
|
|
83
|
-
}
|
|
84
|
-
return [3, 4];
|
|
85
|
-
case 2: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
86
|
-
case 3: throw _d.sent();
|
|
87
|
-
case 4:
|
|
88
|
-
parsedBody = parsedOutput.body;
|
|
89
|
-
throwDefaultError({
|
|
90
|
-
output: output,
|
|
91
|
-
parsedBody: parsedBody,
|
|
92
|
-
exceptionCtor: __BaseException,
|
|
93
|
-
errorCode: errorCode,
|
|
94
|
-
});
|
|
95
|
-
_d.label = 5;
|
|
96
|
-
case 5: return [2];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}); };
|
|
100
|
-
export var deserializeAws_restJson1PutRawMessageContentCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
-
var contents;
|
|
102
|
-
return __generator(this, function (_a) {
|
|
103
|
-
switch (_a.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
106
|
-
return [2, deserializeAws_restJson1PutRawMessageContentCommandError(output, context)];
|
|
107
|
-
}
|
|
108
|
-
contents = map({
|
|
109
|
-
$metadata: deserializeMetadata(output),
|
|
110
|
-
});
|
|
111
|
-
return [4, collectBody(output.body, context)];
|
|
112
|
-
case 1:
|
|
113
|
-
_a.sent();
|
|
114
|
-
return [2, contents];
|
|
115
|
-
}
|
|
41
|
+
};
|
|
42
|
+
export const deserializeAws_restJson1GetRawMessageContentCommand = async (output, context) => {
|
|
43
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
44
|
+
return deserializeAws_restJson1GetRawMessageContentCommandError(output, context);
|
|
45
|
+
}
|
|
46
|
+
const contents = map({
|
|
47
|
+
$metadata: deserializeMetadata(output),
|
|
116
48
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
149
|
-
case 9: throw _d.sent();
|
|
150
|
-
case 10:
|
|
151
|
-
parsedBody = parsedOutput.body;
|
|
152
|
-
throwDefaultError({
|
|
153
|
-
output: output,
|
|
154
|
-
parsedBody: parsedBody,
|
|
155
|
-
exceptionCtor: __BaseException,
|
|
156
|
-
errorCode: errorCode,
|
|
157
|
-
});
|
|
158
|
-
_d.label = 11;
|
|
159
|
-
case 11: return [2];
|
|
160
|
-
}
|
|
49
|
+
const data = output.body;
|
|
50
|
+
context.sdkStreamMixin(data);
|
|
51
|
+
contents.messageContent = data;
|
|
52
|
+
return contents;
|
|
53
|
+
};
|
|
54
|
+
const deserializeAws_restJson1GetRawMessageContentCommandError = async (output, context) => {
|
|
55
|
+
const parsedOutput = {
|
|
56
|
+
...output,
|
|
57
|
+
body: await parseErrorBody(output.body, context),
|
|
58
|
+
};
|
|
59
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
60
|
+
switch (errorCode) {
|
|
61
|
+
case "ResourceNotFoundException":
|
|
62
|
+
case "com.amazonaws.workmailmessageflow#ResourceNotFoundException":
|
|
63
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
64
|
+
default:
|
|
65
|
+
const parsedBody = parsedOutput.body;
|
|
66
|
+
throwDefaultError({
|
|
67
|
+
output,
|
|
68
|
+
parsedBody,
|
|
69
|
+
exceptionCtor: __BaseException,
|
|
70
|
+
errorCode,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export const deserializeAws_restJson1PutRawMessageContentCommand = async (output, context) => {
|
|
75
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
76
|
+
return deserializeAws_restJson1PutRawMessageContentCommandError(output, context);
|
|
77
|
+
}
|
|
78
|
+
const contents = map({
|
|
79
|
+
$metadata: deserializeMetadata(output),
|
|
161
80
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
81
|
+
await collectBody(output.body, context);
|
|
82
|
+
return contents;
|
|
83
|
+
};
|
|
84
|
+
const deserializeAws_restJson1PutRawMessageContentCommandError = async (output, context) => {
|
|
85
|
+
const parsedOutput = {
|
|
86
|
+
...output,
|
|
87
|
+
body: await parseErrorBody(output.body, context),
|
|
88
|
+
};
|
|
89
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
90
|
+
switch (errorCode) {
|
|
91
|
+
case "InvalidContentLocation":
|
|
92
|
+
case "com.amazonaws.workmailmessageflow#InvalidContentLocation":
|
|
93
|
+
throw await deserializeAws_restJson1InvalidContentLocationResponse(parsedOutput, context);
|
|
94
|
+
case "MessageFrozen":
|
|
95
|
+
case "com.amazonaws.workmailmessageflow#MessageFrozen":
|
|
96
|
+
throw await deserializeAws_restJson1MessageFrozenResponse(parsedOutput, context);
|
|
97
|
+
case "MessageRejected":
|
|
98
|
+
case "com.amazonaws.workmailmessageflow#MessageRejected":
|
|
99
|
+
throw await deserializeAws_restJson1MessageRejectedResponse(parsedOutput, context);
|
|
100
|
+
case "ResourceNotFoundException":
|
|
101
|
+
case "com.amazonaws.workmailmessageflow#ResourceNotFoundException":
|
|
102
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
103
|
+
default:
|
|
104
|
+
const parsedBody = parsedOutput.body;
|
|
105
|
+
throwDefaultError({
|
|
106
|
+
output,
|
|
107
|
+
parsedBody,
|
|
108
|
+
exceptionCtor: __BaseException,
|
|
109
|
+
errorCode,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const map = __map;
|
|
114
|
+
const deserializeAws_restJson1InvalidContentLocationResponse = 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 InvalidContentLocation({
|
|
121
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
122
|
+
...contents,
|
|
174
123
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
124
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
125
|
+
};
|
|
126
|
+
const deserializeAws_restJson1MessageFrozenResponse = 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 MessageFrozen({
|
|
133
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
134
|
+
...contents,
|
|
186
135
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
136
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
137
|
+
};
|
|
138
|
+
const deserializeAws_restJson1MessageRejectedResponse = async (parsedOutput, context) => {
|
|
139
|
+
const contents = map({});
|
|
140
|
+
const data = parsedOutput.body;
|
|
141
|
+
if (data.message != null) {
|
|
142
|
+
contents.message = __expectString(data.message);
|
|
143
|
+
}
|
|
144
|
+
const exception = new MessageRejected({
|
|
145
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
146
|
+
...contents,
|
|
198
147
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
148
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
149
|
+
};
|
|
150
|
+
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
151
|
+
const contents = map({});
|
|
152
|
+
const data = parsedOutput.body;
|
|
153
|
+
if (data.message != null) {
|
|
154
|
+
contents.message = __expectString(data.message);
|
|
155
|
+
}
|
|
156
|
+
const exception = new ResourceNotFoundException({
|
|
157
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
158
|
+
...contents,
|
|
210
159
|
});
|
|
211
|
-
|
|
212
|
-
var serializeAws_restJson1RawMessageContent = function (input, context) {
|
|
213
|
-
return __assign({}, (input.s3Reference != null && { s3Reference: serializeAws_restJson1S3Reference(input.s3Reference, context) }));
|
|
160
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
214
161
|
};
|
|
215
|
-
|
|
216
|
-
return
|
|
162
|
+
const serializeAws_restJson1RawMessageContent = (input, context) => {
|
|
163
|
+
return {
|
|
164
|
+
...(input.s3Reference != null && { s3Reference: serializeAws_restJson1S3Reference(input.s3Reference, context) }),
|
|
165
|
+
};
|
|
217
166
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
225
|
-
});
|
|
167
|
+
const serializeAws_restJson1S3Reference = (input, context) => {
|
|
168
|
+
return {
|
|
169
|
+
...(input.bucket != null && { bucket: input.bucket }),
|
|
170
|
+
...(input.key != null && { key: input.key }),
|
|
171
|
+
...(input.objectVersion != null && { objectVersion: input.objectVersion }),
|
|
172
|
+
};
|
|
226
173
|
};
|
|
227
|
-
|
|
228
|
-
|
|
174
|
+
const deserializeMetadata = (output) => ({
|
|
175
|
+
httpStatusCode: output.statusCode,
|
|
176
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
177
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
178
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
179
|
+
});
|
|
180
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
229
181
|
if (streamBody instanceof Uint8Array) {
|
|
230
182
|
return Promise.resolve(streamBody);
|
|
231
183
|
}
|
|
232
184
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
233
185
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
});
|
|
186
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
187
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
188
|
+
value !== null &&
|
|
189
|
+
value !== "" &&
|
|
190
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
191
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
192
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
193
|
+
if (encoded.length) {
|
|
194
|
+
return JSON.parse(encoded);
|
|
195
|
+
}
|
|
196
|
+
return {};
|
|
197
|
+
});
|
|
198
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
199
|
+
const value = await parseBody(errorBody, context);
|
|
200
|
+
value.message = value.message ?? value.Message;
|
|
201
|
+
return value;
|
|
251
202
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
switch (_b.label) {
|
|
257
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
258
|
-
case 1:
|
|
259
|
-
value = _b.sent();
|
|
260
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
261
|
-
return [2, value];
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}); };
|
|
265
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
266
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
267
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
268
|
-
var cleanValue = rawValue;
|
|
203
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
204
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
205
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
206
|
+
let cleanValue = rawValue;
|
|
269
207
|
if (typeof cleanValue === "number") {
|
|
270
208
|
cleanValue = cleanValue.toString();
|
|
271
209
|
}
|
|
@@ -280,7 +218,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
280
218
|
}
|
|
281
219
|
return cleanValue;
|
|
282
220
|
};
|
|
283
|
-
|
|
221
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
284
222
|
if (headerKey !== undefined) {
|
|
285
223
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
286
224
|
}
|
|
@@ -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";
|
|
@@ -7,20 +6,37 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
|
7
6
|
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
|
|
8
7
|
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
|
|
9
8
|
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
|
|
9
|
+
import { sdkStreamMixin } from "@aws-sdk/util-stream-browser";
|
|
10
10
|
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
11
11
|
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
12
12
|
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
13
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
14
14
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
export const getRuntimeConfig = (config) => {
|
|
16
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
17
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
18
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
19
|
+
return {
|
|
20
|
+
...clientSharedValues,
|
|
21
|
+
...config,
|
|
22
|
+
runtime: "browser",
|
|
23
|
+
defaultsMode,
|
|
24
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
25
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
26
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
27
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
28
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
29
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
30
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
31
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
32
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
33
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
34
|
+
sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin,
|
|
35
|
+
sha256: config?.sha256 ?? Sha256,
|
|
36
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
37
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
38
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
39
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
40
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
41
|
+
};
|
|
26
42
|
};
|
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";
|
|
@@ -9,22 +8,43 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
|
|
|
9
8
|
import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
10
9
|
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
|
|
11
10
|
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
|
|
11
|
+
import { sdkStreamMixin } from "@aws-sdk/util-stream-node";
|
|
12
12
|
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
13
13
|
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
|
|
14
14
|
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
15
15
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
16
16
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-node";
|
|
17
17
|
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;
|
|
18
|
+
export const getRuntimeConfig = (config) => {
|
|
20
19
|
emitWarningIfUnsupportedVersion(process.version);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
21
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
22
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
23
|
+
return {
|
|
24
|
+
...clientSharedValues,
|
|
25
|
+
...config,
|
|
26
|
+
runtime: "node",
|
|
27
|
+
defaultsMode,
|
|
28
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
29
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
30
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
31
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
32
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
33
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
34
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
35
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
36
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
37
|
+
retryMode: config?.retryMode ??
|
|
38
|
+
loadNodeConfig({
|
|
39
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
40
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
41
|
+
}),
|
|
42
|
+
sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin,
|
|
43
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
44
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
45
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
46
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
47
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
48
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
49
|
+
};
|
|
30
50
|
};
|
|
@@ -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
|
};
|