@aws-sdk/client-appconfigdata 3.183.0 → 3.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,203 +1,261 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, map as __map, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { AppConfigDataServiceException as __BaseException } from "../models/AppConfigDataServiceException";
4
5
  import { BadRequestException, InternalServerException, ResourceNotFoundException, ThrottlingException, } from "../models/models_0";
5
- export const serializeAws_restJson1GetLatestConfigurationCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
- const headers = {};
8
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/configuration";
9
- const query = map({
10
- configuration_token: [, input.ConfigurationToken],
6
+ export var serializeAws_restJson1GetLatestConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
8
+ return __generator(this, function (_c) {
9
+ switch (_c.label) {
10
+ case 0: return [4, context.endpoint()];
11
+ case 1:
12
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
+ headers = {};
14
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/configuration";
15
+ query = map({
16
+ configuration_token: [, input.ConfigurationToken],
17
+ });
18
+ return [2, new __HttpRequest({
19
+ protocol: protocol,
20
+ hostname: hostname,
21
+ port: port,
22
+ method: "GET",
23
+ headers: headers,
24
+ path: resolvedPath,
25
+ query: query,
26
+ body: body,
27
+ })];
28
+ }
11
29
  });
12
- let body;
13
- return new __HttpRequest({
14
- protocol,
15
- hostname,
16
- port,
17
- method: "GET",
18
- headers,
19
- path: resolvedPath,
20
- query,
21
- body,
30
+ }); };
31
+ export var serializeAws_restJson1StartConfigurationSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
32
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
33
+ return __generator(this, function (_c) {
34
+ switch (_c.label) {
35
+ case 0: return [4, context.endpoint()];
36
+ case 1:
37
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
38
+ headers = {
39
+ "content-type": "application/json",
40
+ };
41
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/configurationsessions";
42
+ body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.ApplicationIdentifier != null && { ApplicationIdentifier: input.ApplicationIdentifier })), (input.ConfigurationProfileIdentifier != null && {
43
+ ConfigurationProfileIdentifier: input.ConfigurationProfileIdentifier,
44
+ })), (input.EnvironmentIdentifier != null && { EnvironmentIdentifier: input.EnvironmentIdentifier })), (input.RequiredMinimumPollIntervalInSeconds != null && {
45
+ RequiredMinimumPollIntervalInSeconds: input.RequiredMinimumPollIntervalInSeconds,
46
+ })));
47
+ return [2, new __HttpRequest({
48
+ protocol: protocol,
49
+ hostname: hostname,
50
+ port: port,
51
+ method: "POST",
52
+ headers: headers,
53
+ path: resolvedPath,
54
+ body: body,
55
+ })];
56
+ }
22
57
  });
23
- };
24
- export const serializeAws_restJson1StartConfigurationSessionCommand = async (input, context) => {
25
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
26
- const headers = {
27
- "content-type": "application/json",
28
- };
29
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/configurationsessions";
30
- let body;
31
- body = JSON.stringify({
32
- ...(input.ApplicationIdentifier != null && { ApplicationIdentifier: input.ApplicationIdentifier }),
33
- ...(input.ConfigurationProfileIdentifier != null && {
34
- ConfigurationProfileIdentifier: input.ConfigurationProfileIdentifier,
35
- }),
36
- ...(input.EnvironmentIdentifier != null && { EnvironmentIdentifier: input.EnvironmentIdentifier }),
37
- ...(input.RequiredMinimumPollIntervalInSeconds != null && {
38
- RequiredMinimumPollIntervalInSeconds: input.RequiredMinimumPollIntervalInSeconds,
39
- }),
58
+ }); };
59
+ export var deserializeAws_restJson1GetLatestConfigurationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
60
+ var contents, data;
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0:
64
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
65
+ return [2, deserializeAws_restJson1GetLatestConfigurationCommandError(output, context)];
66
+ }
67
+ contents = map({
68
+ $metadata: deserializeMetadata(output),
69
+ NextPollConfigurationToken: [, output.headers["next-poll-configuration-token"]],
70
+ NextPollIntervalInSeconds: [
71
+ function () { return void 0 !== output.headers["next-poll-interval-in-seconds"]; },
72
+ function () { return __strictParseInt32(output.headers["next-poll-interval-in-seconds"]); },
73
+ ],
74
+ ContentType: [, output.headers["content-type"]],
75
+ });
76
+ return [4, collectBody(output.body, context)];
77
+ case 1:
78
+ data = _a.sent();
79
+ contents.Configuration = data;
80
+ return [2, contents];
81
+ }
40
82
  });
41
- return new __HttpRequest({
42
- protocol,
43
- hostname,
44
- port,
45
- method: "POST",
46
- headers,
47
- path: resolvedPath,
48
- body,
83
+ }); };
84
+ var deserializeAws_restJson1GetLatestConfigurationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
85
+ var parsedOutput, _a, errorCode, _b, parsedBody;
86
+ var _c;
87
+ return __generator(this, function (_d) {
88
+ switch (_d.label) {
89
+ case 0:
90
+ _a = [__assign({}, output)];
91
+ _c = {};
92
+ return [4, parseErrorBody(output.body, context)];
93
+ case 1:
94
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
95
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
96
+ _b = errorCode;
97
+ switch (_b) {
98
+ case "BadRequestException": return [3, 2];
99
+ case "com.amazonaws.appconfigdata#BadRequestException": return [3, 2];
100
+ case "InternalServerException": return [3, 4];
101
+ case "com.amazonaws.appconfigdata#InternalServerException": return [3, 4];
102
+ case "ResourceNotFoundException": return [3, 6];
103
+ case "com.amazonaws.appconfigdata#ResourceNotFoundException": return [3, 6];
104
+ case "ThrottlingException": return [3, 8];
105
+ case "com.amazonaws.appconfigdata#ThrottlingException": return [3, 8];
106
+ }
107
+ return [3, 10];
108
+ case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
109
+ case 3: throw _d.sent();
110
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
111
+ case 5: throw _d.sent();
112
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
113
+ case 7: throw _d.sent();
114
+ case 8: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
115
+ case 9: throw _d.sent();
116
+ case 10:
117
+ parsedBody = parsedOutput.body;
118
+ throwDefaultError({
119
+ output: output,
120
+ parsedBody: parsedBody,
121
+ exceptionCtor: __BaseException,
122
+ errorCode: errorCode,
123
+ });
124
+ _d.label = 11;
125
+ case 11: return [2];
126
+ }
49
127
  });
50
- };
51
- export const deserializeAws_restJson1GetLatestConfigurationCommand = async (output, context) => {
52
- if (output.statusCode !== 200 && output.statusCode >= 300) {
53
- return deserializeAws_restJson1GetLatestConfigurationCommandError(output, context);
54
- }
55
- const contents = map({
56
- $metadata: deserializeMetadata(output),
57
- NextPollConfigurationToken: [, output.headers["next-poll-configuration-token"]],
58
- NextPollIntervalInSeconds: [
59
- () => void 0 !== output.headers["next-poll-interval-in-seconds"],
60
- () => __strictParseInt32(output.headers["next-poll-interval-in-seconds"]),
61
- ],
62
- ContentType: [, output.headers["content-type"]],
128
+ }); };
129
+ export var deserializeAws_restJson1StartConfigurationSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
130
+ var contents, data, _a, _b;
131
+ return __generator(this, function (_c) {
132
+ switch (_c.label) {
133
+ case 0:
134
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
135
+ return [2, deserializeAws_restJson1StartConfigurationSessionCommandError(output, context)];
136
+ }
137
+ contents = map({
138
+ $metadata: deserializeMetadata(output),
139
+ });
140
+ _a = __expectNonNull;
141
+ _b = __expectObject;
142
+ return [4, parseBody(output.body, context)];
143
+ case 1:
144
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
145
+ if (data.InitialConfigurationToken != null) {
146
+ contents.InitialConfigurationToken = __expectString(data.InitialConfigurationToken);
147
+ }
148
+ return [2, contents];
149
+ }
63
150
  });
64
- const data = await collectBody(output.body, context);
65
- contents.Configuration = data;
66
- return contents;
67
- };
68
- const deserializeAws_restJson1GetLatestConfigurationCommandError = async (output, context) => {
69
- const parsedOutput = {
70
- ...output,
71
- body: await parseErrorBody(output.body, context),
72
- };
73
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
74
- switch (errorCode) {
75
- case "BadRequestException":
76
- case "com.amazonaws.appconfigdata#BadRequestException":
77
- throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
78
- case "InternalServerException":
79
- case "com.amazonaws.appconfigdata#InternalServerException":
80
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
81
- case "ResourceNotFoundException":
82
- case "com.amazonaws.appconfigdata#ResourceNotFoundException":
83
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
84
- case "ThrottlingException":
85
- case "com.amazonaws.appconfigdata#ThrottlingException":
86
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
87
- default:
88
- const parsedBody = parsedOutput.body;
89
- throwDefaultError({
90
- output,
91
- parsedBody,
92
- exceptionCtor: __BaseException,
93
- errorCode,
94
- });
95
- }
96
- };
97
- export const deserializeAws_restJson1StartConfigurationSessionCommand = async (output, context) => {
98
- if (output.statusCode !== 201 && output.statusCode >= 300) {
99
- return deserializeAws_restJson1StartConfigurationSessionCommandError(output, context);
100
- }
101
- const contents = map({
102
- $metadata: deserializeMetadata(output),
151
+ }); };
152
+ var deserializeAws_restJson1StartConfigurationSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
153
+ var parsedOutput, _a, errorCode, _b, parsedBody;
154
+ var _c;
155
+ return __generator(this, function (_d) {
156
+ switch (_d.label) {
157
+ case 0:
158
+ _a = [__assign({}, output)];
159
+ _c = {};
160
+ return [4, parseErrorBody(output.body, context)];
161
+ case 1:
162
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
163
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
164
+ _b = errorCode;
165
+ switch (_b) {
166
+ case "BadRequestException": return [3, 2];
167
+ case "com.amazonaws.appconfigdata#BadRequestException": return [3, 2];
168
+ case "InternalServerException": return [3, 4];
169
+ case "com.amazonaws.appconfigdata#InternalServerException": return [3, 4];
170
+ case "ResourceNotFoundException": return [3, 6];
171
+ case "com.amazonaws.appconfigdata#ResourceNotFoundException": return [3, 6];
172
+ case "ThrottlingException": return [3, 8];
173
+ case "com.amazonaws.appconfigdata#ThrottlingException": return [3, 8];
174
+ }
175
+ return [3, 10];
176
+ case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
177
+ case 3: throw _d.sent();
178
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
179
+ case 5: throw _d.sent();
180
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
181
+ case 7: throw _d.sent();
182
+ case 8: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
183
+ case 9: throw _d.sent();
184
+ case 10:
185
+ parsedBody = parsedOutput.body;
186
+ throwDefaultError({
187
+ output: output,
188
+ parsedBody: parsedBody,
189
+ exceptionCtor: __BaseException,
190
+ errorCode: errorCode,
191
+ });
192
+ _d.label = 11;
193
+ case 11: return [2];
194
+ }
103
195
  });
104
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
105
- if (data.InitialConfigurationToken != null) {
106
- contents.InitialConfigurationToken = __expectString(data.InitialConfigurationToken);
107
- }
108
- return contents;
109
- };
110
- const deserializeAws_restJson1StartConfigurationSessionCommandError = async (output, context) => {
111
- const parsedOutput = {
112
- ...output,
113
- body: await parseErrorBody(output.body, context),
114
- };
115
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
116
- switch (errorCode) {
117
- case "BadRequestException":
118
- case "com.amazonaws.appconfigdata#BadRequestException":
119
- throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
120
- case "InternalServerException":
121
- case "com.amazonaws.appconfigdata#InternalServerException":
122
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
123
- case "ResourceNotFoundException":
124
- case "com.amazonaws.appconfigdata#ResourceNotFoundException":
125
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
126
- case "ThrottlingException":
127
- case "com.amazonaws.appconfigdata#ThrottlingException":
128
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
129
- default:
130
- const parsedBody = parsedOutput.body;
131
- throwDefaultError({
132
- output,
133
- parsedBody,
134
- exceptionCtor: __BaseException,
135
- errorCode,
136
- });
137
- }
138
- };
139
- const map = __map;
140
- const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
141
- const contents = map({});
142
- const data = parsedOutput.body;
143
- if (data.Details != null) {
144
- contents.Details = deserializeAws_restJson1BadRequestDetails(__expectUnion(data.Details), context);
145
- }
146
- if (data.Message != null) {
147
- contents.Message = __expectString(data.Message);
148
- }
149
- if (data.Reason != null) {
150
- contents.Reason = __expectString(data.Reason);
151
- }
152
- const exception = new BadRequestException({
153
- $metadata: deserializeMetadata(parsedOutput),
154
- ...contents,
196
+ }); };
197
+ var map = __map;
198
+ var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
199
+ var contents, data, exception;
200
+ return __generator(this, function (_a) {
201
+ contents = map({});
202
+ data = parsedOutput.body;
203
+ if (data.Details != null) {
204
+ contents.Details = deserializeAws_restJson1BadRequestDetails(__expectUnion(data.Details), context);
205
+ }
206
+ if (data.Message != null) {
207
+ contents.Message = __expectString(data.Message);
208
+ }
209
+ if (data.Reason != null) {
210
+ contents.Reason = __expectString(data.Reason);
211
+ }
212
+ exception = new BadRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
213
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
155
214
  });
156
- return __decorateServiceException(exception, parsedOutput.body);
157
- };
158
- const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
159
- const contents = map({});
160
- const data = parsedOutput.body;
161
- if (data.Message != null) {
162
- contents.Message = __expectString(data.Message);
163
- }
164
- const exception = new InternalServerException({
165
- $metadata: deserializeMetadata(parsedOutput),
166
- ...contents,
215
+ }); };
216
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
217
+ var contents, data, exception;
218
+ return __generator(this, function (_a) {
219
+ contents = map({});
220
+ data = parsedOutput.body;
221
+ if (data.Message != null) {
222
+ contents.Message = __expectString(data.Message);
223
+ }
224
+ exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
225
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
167
226
  });
168
- return __decorateServiceException(exception, parsedOutput.body);
169
- };
170
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
171
- const contents = map({});
172
- const data = parsedOutput.body;
173
- if (data.Message != null) {
174
- contents.Message = __expectString(data.Message);
175
- }
176
- if (data.ReferencedBy != null) {
177
- contents.ReferencedBy = deserializeAws_restJson1StringMap(data.ReferencedBy, context);
178
- }
179
- if (data.ResourceType != null) {
180
- contents.ResourceType = __expectString(data.ResourceType);
181
- }
182
- const exception = new ResourceNotFoundException({
183
- $metadata: deserializeMetadata(parsedOutput),
184
- ...contents,
227
+ }); };
228
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
229
+ var contents, data, exception;
230
+ return __generator(this, function (_a) {
231
+ contents = map({});
232
+ data = parsedOutput.body;
233
+ if (data.Message != null) {
234
+ contents.Message = __expectString(data.Message);
235
+ }
236
+ if (data.ReferencedBy != null) {
237
+ contents.ReferencedBy = deserializeAws_restJson1StringMap(data.ReferencedBy, context);
238
+ }
239
+ if (data.ResourceType != null) {
240
+ contents.ResourceType = __expectString(data.ResourceType);
241
+ }
242
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
243
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
185
244
  });
186
- return __decorateServiceException(exception, parsedOutput.body);
187
- };
188
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
189
- const contents = map({});
190
- const data = parsedOutput.body;
191
- if (data.Message != null) {
192
- contents.Message = __expectString(data.Message);
193
- }
194
- const exception = new ThrottlingException({
195
- $metadata: deserializeMetadata(parsedOutput),
196
- ...contents,
245
+ }); };
246
+ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
247
+ var contents, data, exception;
248
+ return __generator(this, function (_a) {
249
+ contents = map({});
250
+ data = parsedOutput.body;
251
+ if (data.Message != null) {
252
+ contents.Message = __expectString(data.Message);
253
+ }
254
+ exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
255
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
197
256
  });
198
- return __decorateServiceException(exception, parsedOutput.body);
199
- };
200
- const deserializeAws_restJson1BadRequestDetails = (output, context) => {
257
+ }); };
258
+ var deserializeAws_restJson1BadRequestDetails = function (output, context) {
201
259
  if (output.InvalidParameters != null) {
202
260
  return {
203
261
  InvalidParameters: deserializeAws_restJson1InvalidParameterMap(output.InvalidParameters, context),
@@ -205,66 +263,82 @@ const deserializeAws_restJson1BadRequestDetails = (output, context) => {
205
263
  }
206
264
  return { $unknown: Object.entries(output)[0] };
207
265
  };
208
- const deserializeAws_restJson1InvalidParameterDetail = (output, context) => {
266
+ var deserializeAws_restJson1InvalidParameterDetail = function (output, context) {
209
267
  return {
210
268
  Problem: __expectString(output.Problem),
211
269
  };
212
270
  };
213
- const deserializeAws_restJson1InvalidParameterMap = (output, context) => {
214
- return Object.entries(output).reduce((acc, [key, value]) => {
271
+ var deserializeAws_restJson1InvalidParameterMap = function (output, context) {
272
+ return Object.entries(output).reduce(function (acc, _a) {
273
+ var _b;
274
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
215
275
  if (value === null) {
216
276
  return acc;
217
277
  }
218
- return {
219
- ...acc,
220
- [key]: deserializeAws_restJson1InvalidParameterDetail(value, context),
221
- };
278
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1InvalidParameterDetail(value, context), _b));
222
279
  }, {});
223
280
  };
224
- const deserializeAws_restJson1StringMap = (output, context) => {
225
- return Object.entries(output).reduce((acc, [key, value]) => {
281
+ var deserializeAws_restJson1StringMap = function (output, context) {
282
+ return Object.entries(output).reduce(function (acc, _a) {
283
+ var _b;
284
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
226
285
  if (value === null) {
227
286
  return acc;
228
287
  }
229
- return {
230
- ...acc,
231
- [key]: __expectString(value),
232
- };
288
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
233
289
  }, {});
234
290
  };
235
- const deserializeMetadata = (output) => ({
236
- httpStatusCode: output.statusCode,
237
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
238
- extendedRequestId: output.headers["x-amz-id-2"],
239
- cfId: output.headers["x-amz-cf-id"],
240
- });
241
- const collectBody = (streamBody = new Uint8Array(), context) => {
291
+ var deserializeMetadata = function (output) {
292
+ var _a, _b;
293
+ return ({
294
+ httpStatusCode: output.statusCode,
295
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
296
+ extendedRequestId: output.headers["x-amz-id-2"],
297
+ cfId: output.headers["x-amz-cf-id"],
298
+ });
299
+ };
300
+ var collectBody = function (streamBody, context) {
301
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
242
302
  if (streamBody instanceof Uint8Array) {
243
303
  return Promise.resolve(streamBody);
244
304
  }
245
305
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
246
306
  };
247
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
248
- const isSerializableHeaderValue = (value) => value !== undefined &&
249
- value !== null &&
250
- value !== "" &&
251
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
252
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
253
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
254
- if (encoded.length) {
255
- return JSON.parse(encoded);
256
- }
257
- return {};
258
- });
259
- const parseErrorBody = async (errorBody, context) => {
260
- const value = await parseBody(errorBody, context);
261
- value.message = value.message ?? value.Message;
262
- return value;
307
+ var collectBodyString = function (streamBody, context) {
308
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
263
309
  };
264
- const loadRestJsonErrorCode = (output, data) => {
265
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
266
- const sanitizeErrorCode = (rawValue) => {
267
- let cleanValue = rawValue;
310
+ var isSerializableHeaderValue = function (value) {
311
+ return value !== undefined &&
312
+ value !== null &&
313
+ value !== "" &&
314
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
315
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
316
+ };
317
+ var parseBody = function (streamBody, context) {
318
+ return collectBodyString(streamBody, context).then(function (encoded) {
319
+ if (encoded.length) {
320
+ return JSON.parse(encoded);
321
+ }
322
+ return {};
323
+ });
324
+ };
325
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
326
+ var value;
327
+ var _a;
328
+ return __generator(this, function (_b) {
329
+ switch (_b.label) {
330
+ case 0: return [4, parseBody(errorBody, context)];
331
+ case 1:
332
+ value = _b.sent();
333
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
334
+ return [2, value];
335
+ }
336
+ });
337
+ }); };
338
+ var loadRestJsonErrorCode = function (output, data) {
339
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
340
+ var sanitizeErrorCode = function (rawValue) {
341
+ var cleanValue = rawValue;
268
342
  if (typeof cleanValue === "number") {
269
343
  cleanValue = cleanValue.toString();
270
344
  }
@@ -279,7 +353,7 @@ const loadRestJsonErrorCode = (output, data) => {
279
353
  }
280
354
  return cleanValue;
281
355
  };
282
- const headerKey = findKey(output.headers, "x-amzn-errortype");
356
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
283
357
  if (headerKey !== undefined) {
284
358
  return sanitizeErrorCode(output.headers[headerKey]);
285
359
  }
@@ -1,3 +1,4 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import packageInfo from "../package.json";
2
3
  import { Sha256 } from "@aws-crypto/sha256-browser";
3
4
  import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
@@ -11,30 +12,15 @@ import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
11
12
  import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
12
13
  import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
13
14
  import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
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
- };
15
+ export var getRuntimeConfig = function (config) {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17
+ var defaultsMode = resolveDefaultsModeConfig(config);
18
+ var defaultConfigProvider = function () { return defaultsMode().then(loadConfigsForDefaultMode); };
19
+ var clientSharedValues = getSharedRuntimeConfig(config);
20
+ return __assign(__assign(__assign({}, clientSharedValues), config), { runtime: "browser", defaultsMode: defaultsMode, base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : fromBase64, base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : toBase64, bodyLengthChecker: (_c = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _c !== void 0 ? _c : calculateBodyLength, credentialDefaultProvider: (_d = config === null || config === void 0 ? void 0 : config.credentialDefaultProvider) !== null && _d !== void 0 ? _d : (function (_) { return function () { return Promise.reject(new Error("Credential is missing")); }; }), defaultUserAgentProvider: (_e = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _e !== void 0 ? _e : defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), maxAttempts: (_f = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _f !== void 0 ? _f : DEFAULT_MAX_ATTEMPTS, region: (_g = config === null || config === void 0 ? void 0 : config.region) !== null && _g !== void 0 ? _g : invalidProvider("Region is missing"), requestHandler: (_h = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _h !== void 0 ? _h : new RequestHandler(defaultConfigProvider), retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : (function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
21
+ switch (_a.label) {
22
+ case 0: return [4, defaultConfigProvider()];
23
+ case 1: return [2, (_a.sent()).retryMode || DEFAULT_RETRY_MODE];
24
+ }
25
+ }); }); }), sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : Sha256, streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : streamCollector, useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : (function () { return Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT); }), useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : (function () { return Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT); }), utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : fromUtf8, utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : toUtf8 });
40
26
  };