@aws-sdk/client-amplifyuibuilder 3.131.0 → 3.142.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/CreateComponentCommand.js +2 -2
  4. package/dist-cjs/commands/CreateThemeCommand.js +2 -2
  5. package/dist-cjs/commands/DeleteComponentCommand.js +1 -1
  6. package/dist-cjs/commands/DeleteThemeCommand.js +1 -1
  7. package/dist-cjs/commands/ExchangeCodeForTokenCommand.js +2 -2
  8. package/dist-cjs/commands/ExportComponentsCommand.js +2 -2
  9. package/dist-cjs/commands/ExportThemesCommand.js +2 -2
  10. package/dist-cjs/commands/GetComponentCommand.js +2 -2
  11. package/dist-cjs/commands/GetThemeCommand.js +2 -2
  12. package/dist-cjs/commands/ListComponentsCommand.js +2 -2
  13. package/dist-cjs/commands/ListThemesCommand.js +2 -2
  14. package/dist-cjs/commands/RefreshTokenCommand.js +2 -2
  15. package/dist-cjs/commands/UpdateComponentCommand.js +2 -2
  16. package/dist-cjs/commands/UpdateThemeCommand.js +2 -2
  17. package/dist-cjs/models/models_0.js +217 -321
  18. package/dist-cjs/protocols/Aws_restJson1.js +194 -563
  19. package/dist-es/commands/CreateComponentCommand.js +3 -3
  20. package/dist-es/commands/CreateThemeCommand.js +3 -3
  21. package/dist-es/commands/DeleteComponentCommand.js +2 -2
  22. package/dist-es/commands/DeleteThemeCommand.js +2 -2
  23. package/dist-es/commands/ExchangeCodeForTokenCommand.js +3 -3
  24. package/dist-es/commands/ExportComponentsCommand.js +3 -3
  25. package/dist-es/commands/ExportThemesCommand.js +3 -3
  26. package/dist-es/commands/GetComponentCommand.js +3 -3
  27. package/dist-es/commands/GetThemeCommand.js +3 -3
  28. package/dist-es/commands/ListComponentsCommand.js +3 -3
  29. package/dist-es/commands/ListThemesCommand.js +3 -3
  30. package/dist-es/commands/RefreshTokenCommand.js +3 -3
  31. package/dist-es/commands/UpdateComponentCommand.js +3 -3
  32. package/dist-es/commands/UpdateThemeCommand.js +3 -3
  33. package/dist-es/models/models_0.js +52 -208
  34. package/dist-es/protocols/Aws_restJson1.js +251 -560
  35. package/dist-types/models/models_0.d.ts +208 -312
  36. package/dist-types/ts3.4/models/models_0.d.ts +104 -208
  37. package/package.json +6 -6
@@ -12,29 +12,11 @@ const serializeAws_restJson1CreateComponentCommand = async (input, context) => {
12
12
  };
13
13
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
14
14
  "/app/{appId}/environment/{environmentName}/components";
15
- if (input.appId !== undefined) {
16
- const labelValue = input.appId;
17
- if (labelValue.length <= 0) {
18
- throw new Error("Empty value provided for input HTTP label: appId.");
19
- }
20
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
21
- }
22
- else {
23
- throw new Error("No value provided for input HTTP label: appId.");
24
- }
25
- if (input.environmentName !== undefined) {
26
- const labelValue = input.environmentName;
27
- if (labelValue.length <= 0) {
28
- throw new Error("Empty value provided for input HTTP label: environmentName.");
29
- }
30
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
31
- }
32
- else {
33
- throw new Error("No value provided for input HTTP label: environmentName.");
34
- }
35
- const query = {
36
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
37
- };
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
16
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
17
+ const query = map({
18
+ clientToken: [, input.clientToken],
19
+ });
38
20
  let body;
39
21
  if (input.componentToCreate !== undefined) {
40
22
  body = serializeAws_restJson1CreateComponentData(input.componentToCreate, context);
@@ -62,29 +44,11 @@ const serializeAws_restJson1CreateThemeCommand = async (input, context) => {
62
44
  };
63
45
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
64
46
  "/app/{appId}/environment/{environmentName}/themes";
65
- if (input.appId !== undefined) {
66
- const labelValue = input.appId;
67
- if (labelValue.length <= 0) {
68
- throw new Error("Empty value provided for input HTTP label: appId.");
69
- }
70
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
71
- }
72
- else {
73
- throw new Error("No value provided for input HTTP label: appId.");
74
- }
75
- if (input.environmentName !== undefined) {
76
- const labelValue = input.environmentName;
77
- if (labelValue.length <= 0) {
78
- throw new Error("Empty value provided for input HTTP label: environmentName.");
79
- }
80
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
81
- }
82
- else {
83
- throw new Error("No value provided for input HTTP label: environmentName.");
84
- }
85
- const query = {
86
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
87
- };
47
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
48
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
49
+ const query = map({
50
+ clientToken: [, input.clientToken],
51
+ });
88
52
  let body;
89
53
  if (input.themeToCreate !== undefined) {
90
54
  body = serializeAws_restJson1CreateThemeData(input.themeToCreate, context);
@@ -110,36 +74,9 @@ const serializeAws_restJson1DeleteComponentCommand = async (input, context) => {
110
74
  const headers = {};
111
75
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
112
76
  "/app/{appId}/environment/{environmentName}/components/{id}";
113
- if (input.appId !== undefined) {
114
- const labelValue = input.appId;
115
- if (labelValue.length <= 0) {
116
- throw new Error("Empty value provided for input HTTP label: appId.");
117
- }
118
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
119
- }
120
- else {
121
- throw new Error("No value provided for input HTTP label: appId.");
122
- }
123
- if (input.environmentName !== undefined) {
124
- const labelValue = input.environmentName;
125
- if (labelValue.length <= 0) {
126
- throw new Error("Empty value provided for input HTTP label: environmentName.");
127
- }
128
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
129
- }
130
- else {
131
- throw new Error("No value provided for input HTTP label: environmentName.");
132
- }
133
- if (input.id !== undefined) {
134
- const labelValue = input.id;
135
- if (labelValue.length <= 0) {
136
- throw new Error("Empty value provided for input HTTP label: id.");
137
- }
138
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
139
- }
140
- else {
141
- throw new Error("No value provided for input HTTP label: id.");
142
- }
77
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
78
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
79
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
143
80
  let body;
144
81
  return new protocol_http_1.HttpRequest({
145
82
  protocol,
@@ -157,36 +94,9 @@ const serializeAws_restJson1DeleteThemeCommand = async (input, context) => {
157
94
  const headers = {};
158
95
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
159
96
  "/app/{appId}/environment/{environmentName}/themes/{id}";
160
- if (input.appId !== undefined) {
161
- const labelValue = input.appId;
162
- if (labelValue.length <= 0) {
163
- throw new Error("Empty value provided for input HTTP label: appId.");
164
- }
165
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
166
- }
167
- else {
168
- throw new Error("No value provided for input HTTP label: appId.");
169
- }
170
- if (input.environmentName !== undefined) {
171
- const labelValue = input.environmentName;
172
- if (labelValue.length <= 0) {
173
- throw new Error("Empty value provided for input HTTP label: environmentName.");
174
- }
175
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
176
- }
177
- else {
178
- throw new Error("No value provided for input HTTP label: environmentName.");
179
- }
180
- if (input.id !== undefined) {
181
- const labelValue = input.id;
182
- if (labelValue.length <= 0) {
183
- throw new Error("Empty value provided for input HTTP label: id.");
184
- }
185
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
186
- }
187
- else {
188
- throw new Error("No value provided for input HTTP label: id.");
189
- }
97
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
98
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
99
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
190
100
  let body;
191
101
  return new protocol_http_1.HttpRequest({
192
102
  protocol,
@@ -205,16 +115,7 @@ const serializeAws_restJson1ExchangeCodeForTokenCommand = async (input, context)
205
115
  "content-type": "application/json",
206
116
  };
207
117
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tokens/{provider}";
208
- if (input.provider !== undefined) {
209
- const labelValue = input.provider;
210
- if (labelValue.length <= 0) {
211
- throw new Error("Empty value provided for input HTTP label: provider.");
212
- }
213
- resolvedPath = resolvedPath.replace("{provider}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
214
- }
215
- else {
216
- throw new Error("No value provided for input HTTP label: provider.");
217
- }
118
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "provider", () => input.provider, "{provider}", false);
218
119
  let body;
219
120
  if (input.request !== undefined) {
220
121
  body = serializeAws_restJson1ExchangeCodeForTokenRequestBody(input.request, context);
@@ -239,29 +140,11 @@ const serializeAws_restJson1ExportComponentsCommand = async (input, context) =>
239
140
  const headers = {};
240
141
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
241
142
  "/export/app/{appId}/environment/{environmentName}/components";
242
- if (input.appId !== undefined) {
243
- const labelValue = input.appId;
244
- if (labelValue.length <= 0) {
245
- throw new Error("Empty value provided for input HTTP label: appId.");
246
- }
247
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
248
- }
249
- else {
250
- throw new Error("No value provided for input HTTP label: appId.");
251
- }
252
- if (input.environmentName !== undefined) {
253
- const labelValue = input.environmentName;
254
- if (labelValue.length <= 0) {
255
- throw new Error("Empty value provided for input HTTP label: environmentName.");
256
- }
257
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
258
- }
259
- else {
260
- throw new Error("No value provided for input HTTP label: environmentName.");
261
- }
262
- const query = {
263
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
264
- };
143
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
144
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
145
+ const query = map({
146
+ nextToken: [, input.nextToken],
147
+ });
265
148
  let body;
266
149
  return new protocol_http_1.HttpRequest({
267
150
  protocol,
@@ -280,29 +163,11 @@ const serializeAws_restJson1ExportThemesCommand = async (input, context) => {
280
163
  const headers = {};
281
164
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
282
165
  "/export/app/{appId}/environment/{environmentName}/themes";
283
- if (input.appId !== undefined) {
284
- const labelValue = input.appId;
285
- if (labelValue.length <= 0) {
286
- throw new Error("Empty value provided for input HTTP label: appId.");
287
- }
288
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
289
- }
290
- else {
291
- throw new Error("No value provided for input HTTP label: appId.");
292
- }
293
- if (input.environmentName !== undefined) {
294
- const labelValue = input.environmentName;
295
- if (labelValue.length <= 0) {
296
- throw new Error("Empty value provided for input HTTP label: environmentName.");
297
- }
298
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
299
- }
300
- else {
301
- throw new Error("No value provided for input HTTP label: environmentName.");
302
- }
303
- const query = {
304
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
305
- };
166
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
167
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
168
+ const query = map({
169
+ nextToken: [, input.nextToken],
170
+ });
306
171
  let body;
307
172
  return new protocol_http_1.HttpRequest({
308
173
  protocol,
@@ -321,36 +186,9 @@ const serializeAws_restJson1GetComponentCommand = async (input, context) => {
321
186
  const headers = {};
322
187
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
323
188
  "/app/{appId}/environment/{environmentName}/components/{id}";
324
- if (input.appId !== undefined) {
325
- const labelValue = input.appId;
326
- if (labelValue.length <= 0) {
327
- throw new Error("Empty value provided for input HTTP label: appId.");
328
- }
329
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
330
- }
331
- else {
332
- throw new Error("No value provided for input HTTP label: appId.");
333
- }
334
- if (input.environmentName !== undefined) {
335
- const labelValue = input.environmentName;
336
- if (labelValue.length <= 0) {
337
- throw new Error("Empty value provided for input HTTP label: environmentName.");
338
- }
339
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
340
- }
341
- else {
342
- throw new Error("No value provided for input HTTP label: environmentName.");
343
- }
344
- if (input.id !== undefined) {
345
- const labelValue = input.id;
346
- if (labelValue.length <= 0) {
347
- throw new Error("Empty value provided for input HTTP label: id.");
348
- }
349
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
350
- }
351
- else {
352
- throw new Error("No value provided for input HTTP label: id.");
353
- }
189
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
190
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
191
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
354
192
  let body;
355
193
  return new protocol_http_1.HttpRequest({
356
194
  protocol,
@@ -368,36 +206,9 @@ const serializeAws_restJson1GetThemeCommand = async (input, context) => {
368
206
  const headers = {};
369
207
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
370
208
  "/app/{appId}/environment/{environmentName}/themes/{id}";
371
- if (input.appId !== undefined) {
372
- const labelValue = input.appId;
373
- if (labelValue.length <= 0) {
374
- throw new Error("Empty value provided for input HTTP label: appId.");
375
- }
376
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
377
- }
378
- else {
379
- throw new Error("No value provided for input HTTP label: appId.");
380
- }
381
- if (input.environmentName !== undefined) {
382
- const labelValue = input.environmentName;
383
- if (labelValue.length <= 0) {
384
- throw new Error("Empty value provided for input HTTP label: environmentName.");
385
- }
386
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
387
- }
388
- else {
389
- throw new Error("No value provided for input HTTP label: environmentName.");
390
- }
391
- if (input.id !== undefined) {
392
- const labelValue = input.id;
393
- if (labelValue.length <= 0) {
394
- throw new Error("Empty value provided for input HTTP label: id.");
395
- }
396
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
397
- }
398
- else {
399
- throw new Error("No value provided for input HTTP label: id.");
400
- }
209
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
210
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
211
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
401
212
  let body;
402
213
  return new protocol_http_1.HttpRequest({
403
214
  protocol,
@@ -415,30 +226,12 @@ const serializeAws_restJson1ListComponentsCommand = async (input, context) => {
415
226
  const headers = {};
416
227
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
417
228
  "/app/{appId}/environment/{environmentName}/components";
418
- if (input.appId !== undefined) {
419
- const labelValue = input.appId;
420
- if (labelValue.length <= 0) {
421
- throw new Error("Empty value provided for input HTTP label: appId.");
422
- }
423
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
424
- }
425
- else {
426
- throw new Error("No value provided for input HTTP label: appId.");
427
- }
428
- if (input.environmentName !== undefined) {
429
- const labelValue = input.environmentName;
430
- if (labelValue.length <= 0) {
431
- throw new Error("Empty value provided for input HTTP label: environmentName.");
432
- }
433
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
434
- }
435
- else {
436
- throw new Error("No value provided for input HTTP label: environmentName.");
437
- }
438
- const query = {
439
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
440
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
441
- };
229
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
230
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
231
+ const query = map({
232
+ nextToken: [, input.nextToken],
233
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
234
+ });
442
235
  let body;
443
236
  return new protocol_http_1.HttpRequest({
444
237
  protocol,
@@ -457,30 +250,12 @@ const serializeAws_restJson1ListThemesCommand = async (input, context) => {
457
250
  const headers = {};
458
251
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
459
252
  "/app/{appId}/environment/{environmentName}/themes";
460
- if (input.appId !== undefined) {
461
- const labelValue = input.appId;
462
- if (labelValue.length <= 0) {
463
- throw new Error("Empty value provided for input HTTP label: appId.");
464
- }
465
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
466
- }
467
- else {
468
- throw new Error("No value provided for input HTTP label: appId.");
469
- }
470
- if (input.environmentName !== undefined) {
471
- const labelValue = input.environmentName;
472
- if (labelValue.length <= 0) {
473
- throw new Error("Empty value provided for input HTTP label: environmentName.");
474
- }
475
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
476
- }
477
- else {
478
- throw new Error("No value provided for input HTTP label: environmentName.");
479
- }
480
- const query = {
481
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
482
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
483
- };
253
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
254
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
255
+ const query = map({
256
+ nextToken: [, input.nextToken],
257
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
258
+ });
484
259
  let body;
485
260
  return new protocol_http_1.HttpRequest({
486
261
  protocol,
@@ -500,16 +275,7 @@ const serializeAws_restJson1RefreshTokenCommand = async (input, context) => {
500
275
  "content-type": "application/json",
501
276
  };
502
277
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tokens/{provider}/refresh";
503
- if (input.provider !== undefined) {
504
- const labelValue = input.provider;
505
- if (labelValue.length <= 0) {
506
- throw new Error("Empty value provided for input HTTP label: provider.");
507
- }
508
- resolvedPath = resolvedPath.replace("{provider}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
509
- }
510
- else {
511
- throw new Error("No value provided for input HTTP label: provider.");
512
- }
278
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "provider", () => input.provider, "{provider}", false);
513
279
  let body;
514
280
  if (input.refreshTokenBody !== undefined) {
515
281
  body = serializeAws_restJson1RefreshTokenRequestBody(input.refreshTokenBody, context);
@@ -536,39 +302,12 @@ const serializeAws_restJson1UpdateComponentCommand = async (input, context) => {
536
302
  };
537
303
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
538
304
  "/app/{appId}/environment/{environmentName}/components/{id}";
539
- if (input.appId !== undefined) {
540
- const labelValue = input.appId;
541
- if (labelValue.length <= 0) {
542
- throw new Error("Empty value provided for input HTTP label: appId.");
543
- }
544
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
545
- }
546
- else {
547
- throw new Error("No value provided for input HTTP label: appId.");
548
- }
549
- if (input.environmentName !== undefined) {
550
- const labelValue = input.environmentName;
551
- if (labelValue.length <= 0) {
552
- throw new Error("Empty value provided for input HTTP label: environmentName.");
553
- }
554
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
555
- }
556
- else {
557
- throw new Error("No value provided for input HTTP label: environmentName.");
558
- }
559
- if (input.id !== undefined) {
560
- const labelValue = input.id;
561
- if (labelValue.length <= 0) {
562
- throw new Error("Empty value provided for input HTTP label: id.");
563
- }
564
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
565
- }
566
- else {
567
- throw new Error("No value provided for input HTTP label: id.");
568
- }
569
- const query = {
570
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
571
- };
305
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
306
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
307
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
308
+ const query = map({
309
+ clientToken: [, input.clientToken],
310
+ });
572
311
  let body;
573
312
  if (input.updatedComponent !== undefined) {
574
313
  body = serializeAws_restJson1UpdateComponentData(input.updatedComponent, context);
@@ -596,39 +335,12 @@ const serializeAws_restJson1UpdateThemeCommand = async (input, context) => {
596
335
  };
597
336
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
598
337
  "/app/{appId}/environment/{environmentName}/themes/{id}";
599
- if (input.appId !== undefined) {
600
- const labelValue = input.appId;
601
- if (labelValue.length <= 0) {
602
- throw new Error("Empty value provided for input HTTP label: appId.");
603
- }
604
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
605
- }
606
- else {
607
- throw new Error("No value provided for input HTTP label: appId.");
608
- }
609
- if (input.environmentName !== undefined) {
610
- const labelValue = input.environmentName;
611
- if (labelValue.length <= 0) {
612
- throw new Error("Empty value provided for input HTTP label: environmentName.");
613
- }
614
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
615
- }
616
- else {
617
- throw new Error("No value provided for input HTTP label: environmentName.");
618
- }
619
- if (input.id !== undefined) {
620
- const labelValue = input.id;
621
- if (labelValue.length <= 0) {
622
- throw new Error("Empty value provided for input HTTP label: id.");
623
- }
624
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
625
- }
626
- else {
627
- throw new Error("No value provided for input HTTP label: id.");
628
- }
629
- const query = {
630
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
631
- };
338
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
339
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
340
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
341
+ const query = map({
342
+ clientToken: [, input.clientToken],
343
+ });
632
344
  let body;
633
345
  if (input.updatedTheme !== undefined) {
634
346
  body = serializeAws_restJson1UpdateThemeData(input.updatedTheme, context);
@@ -653,13 +365,12 @@ const deserializeAws_restJson1CreateComponentCommand = async (output, context) =
653
365
  if (output.statusCode !== 200 && output.statusCode >= 300) {
654
366
  return deserializeAws_restJson1CreateComponentCommandError(output, context);
655
367
  }
656
- const contents = {
368
+ const contents = map({
657
369
  $metadata: deserializeMetadata(output),
658
- entity: undefined,
659
- };
370
+ });
660
371
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
661
372
  contents.entity = deserializeAws_restJson1Component(data, context);
662
- return Promise.resolve(contents);
373
+ return contents;
663
374
  };
664
375
  exports.deserializeAws_restJson1CreateComponentCommand = deserializeAws_restJson1CreateComponentCommand;
665
376
  const deserializeAws_restJson1CreateComponentCommandError = async (output, context) => {
@@ -667,7 +378,6 @@ const deserializeAws_restJson1CreateComponentCommandError = async (output, conte
667
378
  ...output,
668
379
  body: await parseBody(output.body, context),
669
380
  };
670
- let response;
671
381
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
672
382
  switch (errorCode) {
673
383
  case "InternalServerException":
@@ -684,27 +394,24 @@ const deserializeAws_restJson1CreateComponentCommandError = async (output, conte
684
394
  throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
685
395
  default:
686
396
  const parsedBody = parsedOutput.body;
687
- const $metadata = deserializeMetadata(output);
688
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
689
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
690
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
691
- $fault: "client",
692
- $metadata,
397
+ (0, smithy_client_1.throwDefaultError)({
398
+ output,
399
+ parsedBody,
400
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
401
+ errorCode,
693
402
  });
694
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
695
403
  }
696
404
  };
697
405
  const deserializeAws_restJson1CreateThemeCommand = async (output, context) => {
698
406
  if (output.statusCode !== 200 && output.statusCode >= 300) {
699
407
  return deserializeAws_restJson1CreateThemeCommandError(output, context);
700
408
  }
701
- const contents = {
409
+ const contents = map({
702
410
  $metadata: deserializeMetadata(output),
703
- entity: undefined,
704
- };
411
+ });
705
412
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
706
413
  contents.entity = deserializeAws_restJson1Theme(data, context);
707
- return Promise.resolve(contents);
414
+ return contents;
708
415
  };
709
416
  exports.deserializeAws_restJson1CreateThemeCommand = deserializeAws_restJson1CreateThemeCommand;
710
417
  const deserializeAws_restJson1CreateThemeCommandError = async (output, context) => {
@@ -712,7 +419,6 @@ const deserializeAws_restJson1CreateThemeCommandError = async (output, context)
712
419
  ...output,
713
420
  body: await parseBody(output.body, context),
714
421
  };
715
- let response;
716
422
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
717
423
  switch (errorCode) {
718
424
  case "InternalServerException":
@@ -729,25 +435,23 @@ const deserializeAws_restJson1CreateThemeCommandError = async (output, context)
729
435
  throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
730
436
  default:
731
437
  const parsedBody = parsedOutput.body;
732
- const $metadata = deserializeMetadata(output);
733
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
734
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
735
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
736
- $fault: "client",
737
- $metadata,
438
+ (0, smithy_client_1.throwDefaultError)({
439
+ output,
440
+ parsedBody,
441
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
442
+ errorCode,
738
443
  });
739
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
740
444
  }
741
445
  };
742
446
  const deserializeAws_restJson1DeleteComponentCommand = async (output, context) => {
743
447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
744
448
  return deserializeAws_restJson1DeleteComponentCommandError(output, context);
745
449
  }
746
- const contents = {
450
+ const contents = map({
747
451
  $metadata: deserializeMetadata(output),
748
- };
452
+ });
749
453
  await collectBody(output.body, context);
750
- return Promise.resolve(contents);
454
+ return contents;
751
455
  };
752
456
  exports.deserializeAws_restJson1DeleteComponentCommand = deserializeAws_restJson1DeleteComponentCommand;
753
457
  const deserializeAws_restJson1DeleteComponentCommandError = async (output, context) => {
@@ -755,7 +459,6 @@ const deserializeAws_restJson1DeleteComponentCommandError = async (output, conte
755
459
  ...output,
756
460
  body: await parseBody(output.body, context),
757
461
  };
758
- let response;
759
462
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
760
463
  switch (errorCode) {
761
464
  case "InternalServerException":
@@ -769,25 +472,23 @@ const deserializeAws_restJson1DeleteComponentCommandError = async (output, conte
769
472
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
770
473
  default:
771
474
  const parsedBody = parsedOutput.body;
772
- const $metadata = deserializeMetadata(output);
773
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
774
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
775
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
776
- $fault: "client",
777
- $metadata,
475
+ (0, smithy_client_1.throwDefaultError)({
476
+ output,
477
+ parsedBody,
478
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
479
+ errorCode,
778
480
  });
779
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
780
481
  }
781
482
  };
782
483
  const deserializeAws_restJson1DeleteThemeCommand = async (output, context) => {
783
484
  if (output.statusCode !== 200 && output.statusCode >= 300) {
784
485
  return deserializeAws_restJson1DeleteThemeCommandError(output, context);
785
486
  }
786
- const contents = {
487
+ const contents = map({
787
488
  $metadata: deserializeMetadata(output),
788
- };
489
+ });
789
490
  await collectBody(output.body, context);
790
- return Promise.resolve(contents);
491
+ return contents;
791
492
  };
792
493
  exports.deserializeAws_restJson1DeleteThemeCommand = deserializeAws_restJson1DeleteThemeCommand;
793
494
  const deserializeAws_restJson1DeleteThemeCommandError = async (output, context) => {
@@ -795,7 +496,6 @@ const deserializeAws_restJson1DeleteThemeCommandError = async (output, context)
795
496
  ...output,
796
497
  body: await parseBody(output.body, context),
797
498
  };
798
- let response;
799
499
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
800
500
  switch (errorCode) {
801
501
  case "InternalServerException":
@@ -809,37 +509,32 @@ const deserializeAws_restJson1DeleteThemeCommandError = async (output, context)
809
509
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
810
510
  default:
811
511
  const parsedBody = parsedOutput.body;
812
- const $metadata = deserializeMetadata(output);
813
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
814
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
815
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
816
- $fault: "client",
817
- $metadata,
512
+ (0, smithy_client_1.throwDefaultError)({
513
+ output,
514
+ parsedBody,
515
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
516
+ errorCode,
818
517
  });
819
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
820
518
  }
821
519
  };
822
520
  const deserializeAws_restJson1ExchangeCodeForTokenCommand = async (output, context) => {
823
521
  if (output.statusCode !== 200 && output.statusCode >= 300) {
824
522
  return deserializeAws_restJson1ExchangeCodeForTokenCommandError(output, context);
825
523
  }
826
- const contents = {
524
+ const contents = map({
827
525
  $metadata: deserializeMetadata(output),
828
- accessToken: undefined,
829
- expiresIn: undefined,
830
- refreshToken: undefined,
831
- };
526
+ });
832
527
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
833
- if (data.accessToken !== undefined && data.accessToken !== null) {
528
+ if (data.accessToken != null) {
834
529
  contents.accessToken = (0, smithy_client_1.expectString)(data.accessToken);
835
530
  }
836
- if (data.expiresIn !== undefined && data.expiresIn !== null) {
531
+ if (data.expiresIn != null) {
837
532
  contents.expiresIn = (0, smithy_client_1.expectInt32)(data.expiresIn);
838
533
  }
839
- if (data.refreshToken !== undefined && data.refreshToken !== null) {
534
+ if (data.refreshToken != null) {
840
535
  contents.refreshToken = (0, smithy_client_1.expectString)(data.refreshToken);
841
536
  }
842
- return Promise.resolve(contents);
537
+ return contents;
843
538
  };
844
539
  exports.deserializeAws_restJson1ExchangeCodeForTokenCommand = deserializeAws_restJson1ExchangeCodeForTokenCommand;
845
540
  const deserializeAws_restJson1ExchangeCodeForTokenCommandError = async (output, context) => {
@@ -847,7 +542,6 @@ const deserializeAws_restJson1ExchangeCodeForTokenCommandError = async (output,
847
542
  ...output,
848
543
  body: await parseBody(output.body, context),
849
544
  };
850
- let response;
851
545
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
852
546
  switch (errorCode) {
853
547
  case "InvalidParameterException":
@@ -855,33 +549,29 @@ const deserializeAws_restJson1ExchangeCodeForTokenCommandError = async (output,
855
549
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
856
550
  default:
857
551
  const parsedBody = parsedOutput.body;
858
- const $metadata = deserializeMetadata(output);
859
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
860
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
861
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
862
- $fault: "client",
863
- $metadata,
552
+ (0, smithy_client_1.throwDefaultError)({
553
+ output,
554
+ parsedBody,
555
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
556
+ errorCode,
864
557
  });
865
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
866
558
  }
867
559
  };
868
560
  const deserializeAws_restJson1ExportComponentsCommand = async (output, context) => {
869
561
  if (output.statusCode !== 200 && output.statusCode >= 300) {
870
562
  return deserializeAws_restJson1ExportComponentsCommandError(output, context);
871
563
  }
872
- const contents = {
564
+ const contents = map({
873
565
  $metadata: deserializeMetadata(output),
874
- entities: undefined,
875
- nextToken: undefined,
876
- };
566
+ });
877
567
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
878
- if (data.entities !== undefined && data.entities !== null) {
568
+ if (data.entities != null) {
879
569
  contents.entities = deserializeAws_restJson1ComponentList(data.entities, context);
880
570
  }
881
- if (data.nextToken !== undefined && data.nextToken !== null) {
571
+ if (data.nextToken != null) {
882
572
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
883
573
  }
884
- return Promise.resolve(contents);
574
+ return contents;
885
575
  };
886
576
  exports.deserializeAws_restJson1ExportComponentsCommand = deserializeAws_restJson1ExportComponentsCommand;
887
577
  const deserializeAws_restJson1ExportComponentsCommandError = async (output, context) => {
@@ -889,7 +579,6 @@ const deserializeAws_restJson1ExportComponentsCommandError = async (output, cont
889
579
  ...output,
890
580
  body: await parseBody(output.body, context),
891
581
  };
892
- let response;
893
582
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
894
583
  switch (errorCode) {
895
584
  case "InternalServerException":
@@ -900,33 +589,29 @@ const deserializeAws_restJson1ExportComponentsCommandError = async (output, cont
900
589
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
901
590
  default:
902
591
  const parsedBody = parsedOutput.body;
903
- const $metadata = deserializeMetadata(output);
904
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
905
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
906
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
907
- $fault: "client",
908
- $metadata,
592
+ (0, smithy_client_1.throwDefaultError)({
593
+ output,
594
+ parsedBody,
595
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
596
+ errorCode,
909
597
  });
910
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
911
598
  }
912
599
  };
913
600
  const deserializeAws_restJson1ExportThemesCommand = async (output, context) => {
914
601
  if (output.statusCode !== 200 && output.statusCode >= 300) {
915
602
  return deserializeAws_restJson1ExportThemesCommandError(output, context);
916
603
  }
917
- const contents = {
604
+ const contents = map({
918
605
  $metadata: deserializeMetadata(output),
919
- entities: undefined,
920
- nextToken: undefined,
921
- };
606
+ });
922
607
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
923
- if (data.entities !== undefined && data.entities !== null) {
608
+ if (data.entities != null) {
924
609
  contents.entities = deserializeAws_restJson1ThemeList(data.entities, context);
925
610
  }
926
- if (data.nextToken !== undefined && data.nextToken !== null) {
611
+ if (data.nextToken != null) {
927
612
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
928
613
  }
929
- return Promise.resolve(contents);
614
+ return contents;
930
615
  };
931
616
  exports.deserializeAws_restJson1ExportThemesCommand = deserializeAws_restJson1ExportThemesCommand;
932
617
  const deserializeAws_restJson1ExportThemesCommandError = async (output, context) => {
@@ -934,7 +619,6 @@ const deserializeAws_restJson1ExportThemesCommandError = async (output, context)
934
619
  ...output,
935
620
  body: await parseBody(output.body, context),
936
621
  };
937
- let response;
938
622
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
939
623
  switch (errorCode) {
940
624
  case "InternalServerException":
@@ -945,27 +629,24 @@ const deserializeAws_restJson1ExportThemesCommandError = async (output, context)
945
629
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
946
630
  default:
947
631
  const parsedBody = parsedOutput.body;
948
- const $metadata = deserializeMetadata(output);
949
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
950
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
951
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
952
- $fault: "client",
953
- $metadata,
632
+ (0, smithy_client_1.throwDefaultError)({
633
+ output,
634
+ parsedBody,
635
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
636
+ errorCode,
954
637
  });
955
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
956
638
  }
957
639
  };
958
640
  const deserializeAws_restJson1GetComponentCommand = async (output, context) => {
959
641
  if (output.statusCode !== 200 && output.statusCode >= 300) {
960
642
  return deserializeAws_restJson1GetComponentCommandError(output, context);
961
643
  }
962
- const contents = {
644
+ const contents = map({
963
645
  $metadata: deserializeMetadata(output),
964
- component: undefined,
965
- };
646
+ });
966
647
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
967
648
  contents.component = deserializeAws_restJson1Component(data, context);
968
- return Promise.resolve(contents);
649
+ return contents;
969
650
  };
970
651
  exports.deserializeAws_restJson1GetComponentCommand = deserializeAws_restJson1GetComponentCommand;
971
652
  const deserializeAws_restJson1GetComponentCommandError = async (output, context) => {
@@ -973,7 +654,6 @@ const deserializeAws_restJson1GetComponentCommandError = async (output, context)
973
654
  ...output,
974
655
  body: await parseBody(output.body, context),
975
656
  };
976
- let response;
977
657
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
978
658
  switch (errorCode) {
979
659
  case "InternalServerException":
@@ -987,27 +667,24 @@ const deserializeAws_restJson1GetComponentCommandError = async (output, context)
987
667
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
988
668
  default:
989
669
  const parsedBody = parsedOutput.body;
990
- const $metadata = deserializeMetadata(output);
991
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
992
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
993
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
994
- $fault: "client",
995
- $metadata,
670
+ (0, smithy_client_1.throwDefaultError)({
671
+ output,
672
+ parsedBody,
673
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
674
+ errorCode,
996
675
  });
997
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
998
676
  }
999
677
  };
1000
678
  const deserializeAws_restJson1GetThemeCommand = async (output, context) => {
1001
679
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1002
680
  return deserializeAws_restJson1GetThemeCommandError(output, context);
1003
681
  }
1004
- const contents = {
682
+ const contents = map({
1005
683
  $metadata: deserializeMetadata(output),
1006
- theme: undefined,
1007
- };
684
+ });
1008
685
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
1009
686
  contents.theme = deserializeAws_restJson1Theme(data, context);
1010
- return Promise.resolve(contents);
687
+ return contents;
1011
688
  };
1012
689
  exports.deserializeAws_restJson1GetThemeCommand = deserializeAws_restJson1GetThemeCommand;
1013
690
  const deserializeAws_restJson1GetThemeCommandError = async (output, context) => {
@@ -1015,7 +692,6 @@ const deserializeAws_restJson1GetThemeCommandError = async (output, context) =>
1015
692
  ...output,
1016
693
  body: await parseBody(output.body, context),
1017
694
  };
1018
- let response;
1019
695
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1020
696
  switch (errorCode) {
1021
697
  case "InternalServerException":
@@ -1029,33 +705,29 @@ const deserializeAws_restJson1GetThemeCommandError = async (output, context) =>
1029
705
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1030
706
  default:
1031
707
  const parsedBody = parsedOutput.body;
1032
- const $metadata = deserializeMetadata(output);
1033
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1034
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1035
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1036
- $fault: "client",
1037
- $metadata,
708
+ (0, smithy_client_1.throwDefaultError)({
709
+ output,
710
+ parsedBody,
711
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
712
+ errorCode,
1038
713
  });
1039
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1040
714
  }
1041
715
  };
1042
716
  const deserializeAws_restJson1ListComponentsCommand = async (output, context) => {
1043
717
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1044
718
  return deserializeAws_restJson1ListComponentsCommandError(output, context);
1045
719
  }
1046
- const contents = {
720
+ const contents = map({
1047
721
  $metadata: deserializeMetadata(output),
1048
- entities: undefined,
1049
- nextToken: undefined,
1050
- };
722
+ });
1051
723
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1052
- if (data.entities !== undefined && data.entities !== null) {
724
+ if (data.entities != null) {
1053
725
  contents.entities = deserializeAws_restJson1ComponentSummaryList(data.entities, context);
1054
726
  }
1055
- if (data.nextToken !== undefined && data.nextToken !== null) {
727
+ if (data.nextToken != null) {
1056
728
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1057
729
  }
1058
- return Promise.resolve(contents);
730
+ return contents;
1059
731
  };
1060
732
  exports.deserializeAws_restJson1ListComponentsCommand = deserializeAws_restJson1ListComponentsCommand;
1061
733
  const deserializeAws_restJson1ListComponentsCommandError = async (output, context) => {
@@ -1063,7 +735,6 @@ const deserializeAws_restJson1ListComponentsCommandError = async (output, contex
1063
735
  ...output,
1064
736
  body: await parseBody(output.body, context),
1065
737
  };
1066
- let response;
1067
738
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1068
739
  switch (errorCode) {
1069
740
  case "InternalServerException":
@@ -1074,33 +745,29 @@ const deserializeAws_restJson1ListComponentsCommandError = async (output, contex
1074
745
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1075
746
  default:
1076
747
  const parsedBody = parsedOutput.body;
1077
- const $metadata = deserializeMetadata(output);
1078
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1079
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1080
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1081
- $fault: "client",
1082
- $metadata,
748
+ (0, smithy_client_1.throwDefaultError)({
749
+ output,
750
+ parsedBody,
751
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
752
+ errorCode,
1083
753
  });
1084
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1085
754
  }
1086
755
  };
1087
756
  const deserializeAws_restJson1ListThemesCommand = async (output, context) => {
1088
757
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1089
758
  return deserializeAws_restJson1ListThemesCommandError(output, context);
1090
759
  }
1091
- const contents = {
760
+ const contents = map({
1092
761
  $metadata: deserializeMetadata(output),
1093
- entities: undefined,
1094
- nextToken: undefined,
1095
- };
762
+ });
1096
763
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1097
- if (data.entities !== undefined && data.entities !== null) {
764
+ if (data.entities != null) {
1098
765
  contents.entities = deserializeAws_restJson1ThemeSummaryList(data.entities, context);
1099
766
  }
1100
- if (data.nextToken !== undefined && data.nextToken !== null) {
767
+ if (data.nextToken != null) {
1101
768
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1102
769
  }
1103
- return Promise.resolve(contents);
770
+ return contents;
1104
771
  };
1105
772
  exports.deserializeAws_restJson1ListThemesCommand = deserializeAws_restJson1ListThemesCommand;
1106
773
  const deserializeAws_restJson1ListThemesCommandError = async (output, context) => {
@@ -1108,7 +775,6 @@ const deserializeAws_restJson1ListThemesCommandError = async (output, context) =
1108
775
  ...output,
1109
776
  body: await parseBody(output.body, context),
1110
777
  };
1111
- let response;
1112
778
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1113
779
  switch (errorCode) {
1114
780
  case "InternalServerException":
@@ -1119,33 +785,29 @@ const deserializeAws_restJson1ListThemesCommandError = async (output, context) =
1119
785
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1120
786
  default:
1121
787
  const parsedBody = parsedOutput.body;
1122
- const $metadata = deserializeMetadata(output);
1123
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1124
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1125
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1126
- $fault: "client",
1127
- $metadata,
788
+ (0, smithy_client_1.throwDefaultError)({
789
+ output,
790
+ parsedBody,
791
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
792
+ errorCode,
1128
793
  });
1129
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1130
794
  }
1131
795
  };
1132
796
  const deserializeAws_restJson1RefreshTokenCommand = async (output, context) => {
1133
797
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1134
798
  return deserializeAws_restJson1RefreshTokenCommandError(output, context);
1135
799
  }
1136
- const contents = {
800
+ const contents = map({
1137
801
  $metadata: deserializeMetadata(output),
1138
- accessToken: undefined,
1139
- expiresIn: undefined,
1140
- };
802
+ });
1141
803
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1142
- if (data.accessToken !== undefined && data.accessToken !== null) {
804
+ if (data.accessToken != null) {
1143
805
  contents.accessToken = (0, smithy_client_1.expectString)(data.accessToken);
1144
806
  }
1145
- if (data.expiresIn !== undefined && data.expiresIn !== null) {
807
+ if (data.expiresIn != null) {
1146
808
  contents.expiresIn = (0, smithy_client_1.expectInt32)(data.expiresIn);
1147
809
  }
1148
- return Promise.resolve(contents);
810
+ return contents;
1149
811
  };
1150
812
  exports.deserializeAws_restJson1RefreshTokenCommand = deserializeAws_restJson1RefreshTokenCommand;
1151
813
  const deserializeAws_restJson1RefreshTokenCommandError = async (output, context) => {
@@ -1153,7 +815,6 @@ const deserializeAws_restJson1RefreshTokenCommandError = async (output, context)
1153
815
  ...output,
1154
816
  body: await parseBody(output.body, context),
1155
817
  };
1156
- let response;
1157
818
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1158
819
  switch (errorCode) {
1159
820
  case "InvalidParameterException":
@@ -1161,27 +822,24 @@ const deserializeAws_restJson1RefreshTokenCommandError = async (output, context)
1161
822
  throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1162
823
  default:
1163
824
  const parsedBody = parsedOutput.body;
1164
- const $metadata = deserializeMetadata(output);
1165
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1166
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1167
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1168
- $fault: "client",
1169
- $metadata,
825
+ (0, smithy_client_1.throwDefaultError)({
826
+ output,
827
+ parsedBody,
828
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
829
+ errorCode,
1170
830
  });
1171
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1172
831
  }
1173
832
  };
1174
833
  const deserializeAws_restJson1UpdateComponentCommand = async (output, context) => {
1175
834
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1176
835
  return deserializeAws_restJson1UpdateComponentCommandError(output, context);
1177
836
  }
1178
- const contents = {
837
+ const contents = map({
1179
838
  $metadata: deserializeMetadata(output),
1180
- entity: undefined,
1181
- };
839
+ });
1182
840
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
1183
841
  contents.entity = deserializeAws_restJson1Component(data, context);
1184
- return Promise.resolve(contents);
842
+ return contents;
1185
843
  };
1186
844
  exports.deserializeAws_restJson1UpdateComponentCommand = deserializeAws_restJson1UpdateComponentCommand;
1187
845
  const deserializeAws_restJson1UpdateComponentCommandError = async (output, context) => {
@@ -1189,7 +847,6 @@ const deserializeAws_restJson1UpdateComponentCommandError = async (output, conte
1189
847
  ...output,
1190
848
  body: await parseBody(output.body, context),
1191
849
  };
1192
- let response;
1193
850
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1194
851
  switch (errorCode) {
1195
852
  case "InternalServerException":
@@ -1203,27 +860,24 @@ const deserializeAws_restJson1UpdateComponentCommandError = async (output, conte
1203
860
  throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
1204
861
  default:
1205
862
  const parsedBody = parsedOutput.body;
1206
- const $metadata = deserializeMetadata(output);
1207
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1208
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1209
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1210
- $fault: "client",
1211
- $metadata,
863
+ (0, smithy_client_1.throwDefaultError)({
864
+ output,
865
+ parsedBody,
866
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
867
+ errorCode,
1212
868
  });
1213
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1214
869
  }
1215
870
  };
1216
871
  const deserializeAws_restJson1UpdateThemeCommand = async (output, context) => {
1217
872
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1218
873
  return deserializeAws_restJson1UpdateThemeCommandError(output, context);
1219
874
  }
1220
- const contents = {
875
+ const contents = map({
1221
876
  $metadata: deserializeMetadata(output),
1222
- entity: undefined,
1223
- };
877
+ });
1224
878
  const data = (0, smithy_client_1.expectObject)(await parseBody(output.body, context));
1225
879
  contents.entity = deserializeAws_restJson1Theme(data, context);
1226
- return Promise.resolve(contents);
880
+ return contents;
1227
881
  };
1228
882
  exports.deserializeAws_restJson1UpdateThemeCommand = deserializeAws_restJson1UpdateThemeCommand;
1229
883
  const deserializeAws_restJson1UpdateThemeCommandError = async (output, context) => {
@@ -1231,7 +885,6 @@ const deserializeAws_restJson1UpdateThemeCommandError = async (output, context)
1231
885
  ...output,
1232
886
  body: await parseBody(output.body, context),
1233
887
  };
1234
- let response;
1235
888
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1236
889
  switch (errorCode) {
1237
890
  case "InternalServerException":
@@ -1245,20 +898,19 @@ const deserializeAws_restJson1UpdateThemeCommandError = async (output, context)
1245
898
  throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
1246
899
  default:
1247
900
  const parsedBody = parsedOutput.body;
1248
- const $metadata = deserializeMetadata(output);
1249
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1250
- response = new AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException({
1251
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1252
- $fault: "client",
1253
- $metadata,
901
+ (0, smithy_client_1.throwDefaultError)({
902
+ output,
903
+ parsedBody,
904
+ exceptionCtor: AmplifyUIBuilderServiceException_1.AmplifyUIBuilderServiceException,
905
+ errorCode,
1254
906
  });
1255
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1256
907
  }
1257
908
  };
909
+ const map = smithy_client_1.map;
1258
910
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1259
- const contents = {};
911
+ const contents = map({});
1260
912
  const data = parsedOutput.body;
1261
- if (data.message !== undefined && data.message !== null) {
913
+ if (data.message != null) {
1262
914
  contents.message = (0, smithy_client_1.expectString)(data.message);
1263
915
  }
1264
916
  const exception = new models_0_1.InternalServerException({
@@ -1268,9 +920,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1268
920
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1269
921
  };
1270
922
  const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
1271
- const contents = {};
923
+ const contents = map({});
1272
924
  const data = parsedOutput.body;
1273
- if (data.message !== undefined && data.message !== null) {
925
+ if (data.message != null) {
1274
926
  contents.message = (0, smithy_client_1.expectString)(data.message);
1275
927
  }
1276
928
  const exception = new models_0_1.InvalidParameterException({
@@ -1280,9 +932,9 @@ const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedO
1280
932
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1281
933
  };
1282
934
  const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
1283
- const contents = {};
935
+ const contents = map({});
1284
936
  const data = parsedOutput.body;
1285
- if (data.message !== undefined && data.message !== null) {
937
+ if (data.message != null) {
1286
938
  contents.message = (0, smithy_client_1.expectString)(data.message);
1287
939
  }
1288
940
  const exception = new models_0_1.ResourceConflictException({
@@ -1292,9 +944,9 @@ const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedO
1292
944
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1293
945
  };
1294
946
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1295
- const contents = {};
947
+ const contents = map({});
1296
948
  const data = parsedOutput.body;
1297
- if (data.message !== undefined && data.message !== null) {
949
+ if (data.message != null) {
1298
950
  contents.message = (0, smithy_client_1.expectString)(data.message);
1299
951
  }
1300
952
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1304,9 +956,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1304
956
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1305
957
  };
1306
958
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1307
- const contents = {};
959
+ const contents = map({});
1308
960
  const data = parsedOutput.body;
1309
- if (data.message !== undefined && data.message !== null) {
961
+ if (data.message != null) {
1310
962
  contents.message = (0, smithy_client_1.expectString)(data.message);
1311
963
  }
1312
964
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1375,9 +1027,6 @@ const serializeAws_restJson1ComponentChildList = (input, context) => {
1375
1027
  return input
1376
1028
  .filter((e) => e != null)
1377
1029
  .map((entry) => {
1378
- if (entry === null) {
1379
- return null;
1380
- }
1381
1030
  return serializeAws_restJson1ComponentChild(entry, context);
1382
1031
  });
1383
1032
  };
@@ -1497,9 +1146,6 @@ const serializeAws_restJson1ComponentPropertyList = (input, context) => {
1497
1146
  return input
1498
1147
  .filter((e) => e != null)
1499
1148
  .map((entry) => {
1500
- if (entry === null) {
1501
- return null;
1502
- }
1503
1149
  return serializeAws_restJson1ComponentProperty(entry, context);
1504
1150
  });
1505
1151
  };
@@ -1515,9 +1161,6 @@ const serializeAws_restJson1ComponentVariants = (input, context) => {
1515
1161
  return input
1516
1162
  .filter((e) => e != null)
1517
1163
  .map((entry) => {
1518
- if (entry === null) {
1519
- return null;
1520
- }
1521
1164
  return serializeAws_restJson1ComponentVariant(entry, context);
1522
1165
  });
1523
1166
  };
@@ -1589,9 +1232,6 @@ const serializeAws_restJson1IdentifierList = (input, context) => {
1589
1232
  return input
1590
1233
  .filter((e) => e != null)
1591
1234
  .map((entry) => {
1592
- if (entry === null) {
1593
- return null;
1594
- }
1595
1235
  return entry;
1596
1236
  });
1597
1237
  };
@@ -1615,9 +1255,6 @@ const serializeAws_restJson1PredicateList = (input, context) => {
1615
1255
  return input
1616
1256
  .filter((e) => e != null)
1617
1257
  .map((entry) => {
1618
- if (entry === null) {
1619
- return null;
1620
- }
1621
1258
  return serializeAws_restJson1Predicate(entry, context);
1622
1259
  });
1623
1260
  };
@@ -1636,9 +1273,6 @@ const serializeAws_restJson1SortPropertyList = (input, context) => {
1636
1273
  return input
1637
1274
  .filter((e) => e != null)
1638
1275
  .map((entry) => {
1639
- if (entry === null) {
1640
- return null;
1641
- }
1642
1276
  return serializeAws_restJson1SortProperty(entry, context);
1643
1277
  });
1644
1278
  };
@@ -1669,9 +1303,6 @@ const serializeAws_restJson1ThemeValuesList = (input, context) => {
1669
1303
  return input
1670
1304
  .filter((e) => e != null)
1671
1305
  .map((entry) => {
1672
- if (entry === null) {
1673
- return null;
1674
- }
1675
1306
  return serializeAws_restJson1ThemeValues(entry, context);
1676
1307
  });
1677
1308
  };