@aws-sdk/client-amplifyuibuilder 3.45.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 (124) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +212 -0
  4. package/dist-cjs/AmplifyUIBuilder.js +217 -0
  5. package/dist-cjs/AmplifyUIBuilderClient.js +35 -0
  6. package/dist-cjs/commands/CreateComponentCommand.js +36 -0
  7. package/dist-cjs/commands/CreateThemeCommand.js +36 -0
  8. package/dist-cjs/commands/DeleteComponentCommand.js +36 -0
  9. package/dist-cjs/commands/DeleteThemeCommand.js +36 -0
  10. package/dist-cjs/commands/ExchangeCodeForTokenCommand.js +36 -0
  11. package/dist-cjs/commands/ExportComponentsCommand.js +36 -0
  12. package/dist-cjs/commands/ExportThemesCommand.js +36 -0
  13. package/dist-cjs/commands/GetComponentCommand.js +36 -0
  14. package/dist-cjs/commands/GetThemeCommand.js +36 -0
  15. package/dist-cjs/commands/ListComponentsCommand.js +36 -0
  16. package/dist-cjs/commands/ListThemesCommand.js +36 -0
  17. package/dist-cjs/commands/RefreshTokenCommand.js +36 -0
  18. package/dist-cjs/commands/UpdateComponentCommand.js +36 -0
  19. package/dist-cjs/commands/UpdateThemeCommand.js +36 -0
  20. package/dist-cjs/commands/index.js +17 -0
  21. package/dist-cjs/endpoints.js +131 -0
  22. package/dist-cjs/index.js +8 -0
  23. package/dist-cjs/models/index.js +4 -0
  24. package/dist-cjs/models/models_0.js +340 -0
  25. package/dist-cjs/pagination/Interfaces.js +2 -0
  26. package/dist-cjs/pagination/ListComponentsPaginator.js +35 -0
  27. package/dist-cjs/pagination/ListThemesPaginator.js +35 -0
  28. package/dist-cjs/pagination/index.js +6 -0
  29. package/dist-cjs/protocols/Aws_restJson1.js +2404 -0
  30. package/dist-cjs/runtimeConfig.browser.js +40 -0
  31. package/dist-cjs/runtimeConfig.js +44 -0
  32. package/dist-cjs/runtimeConfig.native.js +16 -0
  33. package/dist-cjs/runtimeConfig.shared.js +17 -0
  34. package/dist-es/AmplifyUIBuilder.js +220 -0
  35. package/dist-es/AmplifyUIBuilderClient.js +37 -0
  36. package/dist-es/commands/CreateComponentCommand.js +39 -0
  37. package/dist-es/commands/CreateThemeCommand.js +39 -0
  38. package/dist-es/commands/DeleteComponentCommand.js +39 -0
  39. package/dist-es/commands/DeleteThemeCommand.js +39 -0
  40. package/dist-es/commands/ExchangeCodeForTokenCommand.js +39 -0
  41. package/dist-es/commands/ExportComponentsCommand.js +39 -0
  42. package/dist-es/commands/ExportThemesCommand.js +39 -0
  43. package/dist-es/commands/GetComponentCommand.js +39 -0
  44. package/dist-es/commands/GetThemeCommand.js +39 -0
  45. package/dist-es/commands/ListComponentsCommand.js +39 -0
  46. package/dist-es/commands/ListThemesCommand.js +39 -0
  47. package/dist-es/commands/RefreshTokenCommand.js +39 -0
  48. package/dist-es/commands/UpdateComponentCommand.js +39 -0
  49. package/dist-es/commands/UpdateThemeCommand.js +39 -0
  50. package/dist-es/commands/index.js +14 -0
  51. package/dist-es/endpoints.js +127 -0
  52. package/dist-es/index.js +5 -0
  53. package/dist-es/models/index.js +1 -0
  54. package/dist-es/models/models_0.js +222 -0
  55. package/dist-es/pagination/Interfaces.js +1 -0
  56. package/dist-es/pagination/ListComponentsPaginator.js +74 -0
  57. package/dist-es/pagination/ListThemesPaginator.js +74 -0
  58. package/dist-es/pagination/index.js +3 -0
  59. package/dist-es/protocols/Aws_restJson1.js +2546 -0
  60. package/dist-es/runtimeConfig.browser.js +17 -0
  61. package/dist-es/runtimeConfig.js +21 -0
  62. package/dist-es/runtimeConfig.native.js +8 -0
  63. package/dist-es/runtimeConfig.shared.js +13 -0
  64. package/dist-types/AmplifyUIBuilder.d.ts +116 -0
  65. package/dist-types/AmplifyUIBuilderClient.d.ts +163 -0
  66. package/dist-types/commands/CreateComponentCommand.d.ts +35 -0
  67. package/dist-types/commands/CreateThemeCommand.d.ts +35 -0
  68. package/dist-types/commands/DeleteComponentCommand.d.ts +35 -0
  69. package/dist-types/commands/DeleteThemeCommand.d.ts +35 -0
  70. package/dist-types/commands/ExchangeCodeForTokenCommand.d.ts +35 -0
  71. package/dist-types/commands/ExportComponentsCommand.d.ts +36 -0
  72. package/dist-types/commands/ExportThemesCommand.d.ts +36 -0
  73. package/dist-types/commands/GetComponentCommand.d.ts +35 -0
  74. package/dist-types/commands/GetThemeCommand.d.ts +35 -0
  75. package/dist-types/commands/ListComponentsCommand.d.ts +35 -0
  76. package/dist-types/commands/ListThemesCommand.d.ts +35 -0
  77. package/dist-types/commands/RefreshTokenCommand.d.ts +35 -0
  78. package/dist-types/commands/UpdateComponentCommand.d.ts +35 -0
  79. package/dist-types/commands/UpdateThemeCommand.d.ts +35 -0
  80. package/dist-types/commands/index.d.ts +14 -0
  81. package/dist-types/endpoints.d.ts +2 -0
  82. package/dist-types/index.d.ts +5 -0
  83. package/dist-types/models/index.d.ts +1 -0
  84. package/dist-types/models/models_0.d.ts +1342 -0
  85. package/dist-types/pagination/Interfaces.d.ts +6 -0
  86. package/dist-types/pagination/ListComponentsPaginator.d.ts +4 -0
  87. package/dist-types/pagination/ListThemesPaginator.d.ts +4 -0
  88. package/dist-types/pagination/index.d.ts +3 -0
  89. package/dist-types/protocols/Aws_restJson1.d.ts +44 -0
  90. package/dist-types/runtimeConfig.browser.d.ts +39 -0
  91. package/dist-types/runtimeConfig.d.ts +39 -0
  92. package/dist-types/runtimeConfig.native.d.ts +38 -0
  93. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  94. package/dist-types/ts3.4/AmplifyUIBuilder.d.ts +75 -0
  95. package/dist-types/ts3.4/AmplifyUIBuilderClient.d.ts +85 -0
  96. package/dist-types/ts3.4/commands/CreateComponentCommand.d.ts +17 -0
  97. package/dist-types/ts3.4/commands/CreateThemeCommand.d.ts +17 -0
  98. package/dist-types/ts3.4/commands/DeleteComponentCommand.d.ts +17 -0
  99. package/dist-types/ts3.4/commands/DeleteThemeCommand.d.ts +17 -0
  100. package/dist-types/ts3.4/commands/ExchangeCodeForTokenCommand.d.ts +17 -0
  101. package/dist-types/ts3.4/commands/ExportComponentsCommand.d.ts +17 -0
  102. package/dist-types/ts3.4/commands/ExportThemesCommand.d.ts +17 -0
  103. package/dist-types/ts3.4/commands/GetComponentCommand.d.ts +17 -0
  104. package/dist-types/ts3.4/commands/GetThemeCommand.d.ts +17 -0
  105. package/dist-types/ts3.4/commands/ListComponentsCommand.d.ts +17 -0
  106. package/dist-types/ts3.4/commands/ListThemesCommand.d.ts +17 -0
  107. package/dist-types/ts3.4/commands/RefreshTokenCommand.d.ts +17 -0
  108. package/dist-types/ts3.4/commands/UpdateComponentCommand.d.ts +17 -0
  109. package/dist-types/ts3.4/commands/UpdateThemeCommand.d.ts +17 -0
  110. package/dist-types/ts3.4/commands/index.d.ts +14 -0
  111. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  112. package/dist-types/ts3.4/index.d.ts +5 -0
  113. package/dist-types/ts3.4/models/index.d.ts +1 -0
  114. package/dist-types/ts3.4/models/models_0.d.ts +783 -0
  115. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  116. package/dist-types/ts3.4/pagination/ListComponentsPaginator.d.ts +4 -0
  117. package/dist-types/ts3.4/pagination/ListThemesPaginator.d.ts +4 -0
  118. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  119. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +44 -0
  120. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +37 -0
  121. package/dist-types/ts3.4/runtimeConfig.d.ts +37 -0
  122. package/dist-types/ts3.4/runtimeConfig.native.d.ts +36 -0
  123. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  124. package/package.json +96 -0
@@ -0,0 +1,2404 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1UpdateThemeCommand = exports.deserializeAws_restJson1UpdateComponentCommand = exports.deserializeAws_restJson1RefreshTokenCommand = exports.deserializeAws_restJson1ListThemesCommand = exports.deserializeAws_restJson1ListComponentsCommand = exports.deserializeAws_restJson1GetThemeCommand = exports.deserializeAws_restJson1GetComponentCommand = exports.deserializeAws_restJson1ExportThemesCommand = exports.deserializeAws_restJson1ExportComponentsCommand = exports.deserializeAws_restJson1ExchangeCodeForTokenCommand = exports.deserializeAws_restJson1DeleteThemeCommand = exports.deserializeAws_restJson1DeleteComponentCommand = exports.deserializeAws_restJson1CreateThemeCommand = exports.deserializeAws_restJson1CreateComponentCommand = exports.serializeAws_restJson1UpdateThemeCommand = exports.serializeAws_restJson1UpdateComponentCommand = exports.serializeAws_restJson1RefreshTokenCommand = exports.serializeAws_restJson1ListThemesCommand = exports.serializeAws_restJson1ListComponentsCommand = exports.serializeAws_restJson1GetThemeCommand = exports.serializeAws_restJson1GetComponentCommand = exports.serializeAws_restJson1ExportThemesCommand = exports.serializeAws_restJson1ExportComponentsCommand = exports.serializeAws_restJson1ExchangeCodeForTokenCommand = exports.serializeAws_restJson1DeleteThemeCommand = exports.serializeAws_restJson1DeleteComponentCommand = exports.serializeAws_restJson1CreateThemeCommand = exports.serializeAws_restJson1CreateComponentCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const serializeAws_restJson1CreateComponentCommand = async (input, context) => {
7
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
+ const headers = {
9
+ "content-type": "application/json",
10
+ };
11
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
12
+ "/app/{appId}/environment/{environmentName}/components";
13
+ if (input.appId !== undefined) {
14
+ const labelValue = input.appId;
15
+ if (labelValue.length <= 0) {
16
+ throw new Error("Empty value provided for input HTTP label: appId.");
17
+ }
18
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
19
+ }
20
+ else {
21
+ throw new Error("No value provided for input HTTP label: appId.");
22
+ }
23
+ if (input.environmentName !== undefined) {
24
+ const labelValue = input.environmentName;
25
+ if (labelValue.length <= 0) {
26
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
27
+ }
28
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
29
+ }
30
+ else {
31
+ throw new Error("No value provided for input HTTP label: environmentName.");
32
+ }
33
+ const query = {
34
+ ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
35
+ };
36
+ let body;
37
+ if (input.componentToCreate !== undefined) {
38
+ body = serializeAws_restJson1CreateComponentData(input.componentToCreate, context);
39
+ }
40
+ if (body === undefined) {
41
+ body = {};
42
+ }
43
+ body = JSON.stringify(body);
44
+ return new protocol_http_1.HttpRequest({
45
+ protocol,
46
+ hostname,
47
+ port,
48
+ method: "POST",
49
+ headers,
50
+ path: resolvedPath,
51
+ query,
52
+ body,
53
+ });
54
+ };
55
+ exports.serializeAws_restJson1CreateComponentCommand = serializeAws_restJson1CreateComponentCommand;
56
+ const serializeAws_restJson1CreateThemeCommand = async (input, context) => {
57
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
58
+ const headers = {
59
+ "content-type": "application/json",
60
+ };
61
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
62
+ "/app/{appId}/environment/{environmentName}/themes";
63
+ if (input.appId !== undefined) {
64
+ const labelValue = input.appId;
65
+ if (labelValue.length <= 0) {
66
+ throw new Error("Empty value provided for input HTTP label: appId.");
67
+ }
68
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
69
+ }
70
+ else {
71
+ throw new Error("No value provided for input HTTP label: appId.");
72
+ }
73
+ if (input.environmentName !== undefined) {
74
+ const labelValue = input.environmentName;
75
+ if (labelValue.length <= 0) {
76
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
77
+ }
78
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
79
+ }
80
+ else {
81
+ throw new Error("No value provided for input HTTP label: environmentName.");
82
+ }
83
+ const query = {
84
+ ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
85
+ };
86
+ let body;
87
+ if (input.themeToCreate !== undefined) {
88
+ body = serializeAws_restJson1CreateThemeData(input.themeToCreate, context);
89
+ }
90
+ if (body === undefined) {
91
+ body = {};
92
+ }
93
+ body = JSON.stringify(body);
94
+ return new protocol_http_1.HttpRequest({
95
+ protocol,
96
+ hostname,
97
+ port,
98
+ method: "POST",
99
+ headers,
100
+ path: resolvedPath,
101
+ query,
102
+ body,
103
+ });
104
+ };
105
+ exports.serializeAws_restJson1CreateThemeCommand = serializeAws_restJson1CreateThemeCommand;
106
+ const serializeAws_restJson1DeleteComponentCommand = async (input, context) => {
107
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
108
+ const headers = {};
109
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
110
+ "/app/{appId}/environment/{environmentName}/components/{id}";
111
+ if (input.appId !== undefined) {
112
+ const labelValue = input.appId;
113
+ if (labelValue.length <= 0) {
114
+ throw new Error("Empty value provided for input HTTP label: appId.");
115
+ }
116
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
117
+ }
118
+ else {
119
+ throw new Error("No value provided for input HTTP label: appId.");
120
+ }
121
+ if (input.environmentName !== undefined) {
122
+ const labelValue = input.environmentName;
123
+ if (labelValue.length <= 0) {
124
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
125
+ }
126
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
127
+ }
128
+ else {
129
+ throw new Error("No value provided for input HTTP label: environmentName.");
130
+ }
131
+ if (input.id !== undefined) {
132
+ const labelValue = input.id;
133
+ if (labelValue.length <= 0) {
134
+ throw new Error("Empty value provided for input HTTP label: id.");
135
+ }
136
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
137
+ }
138
+ else {
139
+ throw new Error("No value provided for input HTTP label: id.");
140
+ }
141
+ let body;
142
+ return new protocol_http_1.HttpRequest({
143
+ protocol,
144
+ hostname,
145
+ port,
146
+ method: "DELETE",
147
+ headers,
148
+ path: resolvedPath,
149
+ body,
150
+ });
151
+ };
152
+ exports.serializeAws_restJson1DeleteComponentCommand = serializeAws_restJson1DeleteComponentCommand;
153
+ const serializeAws_restJson1DeleteThemeCommand = async (input, context) => {
154
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
155
+ const headers = {};
156
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
157
+ "/app/{appId}/environment/{environmentName}/themes/{id}";
158
+ if (input.appId !== undefined) {
159
+ const labelValue = input.appId;
160
+ if (labelValue.length <= 0) {
161
+ throw new Error("Empty value provided for input HTTP label: appId.");
162
+ }
163
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
164
+ }
165
+ else {
166
+ throw new Error("No value provided for input HTTP label: appId.");
167
+ }
168
+ if (input.environmentName !== undefined) {
169
+ const labelValue = input.environmentName;
170
+ if (labelValue.length <= 0) {
171
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
172
+ }
173
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
174
+ }
175
+ else {
176
+ throw new Error("No value provided for input HTTP label: environmentName.");
177
+ }
178
+ if (input.id !== undefined) {
179
+ const labelValue = input.id;
180
+ if (labelValue.length <= 0) {
181
+ throw new Error("Empty value provided for input HTTP label: id.");
182
+ }
183
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
184
+ }
185
+ else {
186
+ throw new Error("No value provided for input HTTP label: id.");
187
+ }
188
+ let body;
189
+ return new protocol_http_1.HttpRequest({
190
+ protocol,
191
+ hostname,
192
+ port,
193
+ method: "DELETE",
194
+ headers,
195
+ path: resolvedPath,
196
+ body,
197
+ });
198
+ };
199
+ exports.serializeAws_restJson1DeleteThemeCommand = serializeAws_restJson1DeleteThemeCommand;
200
+ const serializeAws_restJson1ExchangeCodeForTokenCommand = async (input, context) => {
201
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
202
+ const headers = {
203
+ "content-type": "application/json",
204
+ };
205
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tokens/{provider}";
206
+ if (input.provider !== undefined) {
207
+ const labelValue = input.provider;
208
+ if (labelValue.length <= 0) {
209
+ throw new Error("Empty value provided for input HTTP label: provider.");
210
+ }
211
+ resolvedPath = resolvedPath.replace("{provider}", smithy_client_1.extendedEncodeURIComponent(labelValue));
212
+ }
213
+ else {
214
+ throw new Error("No value provided for input HTTP label: provider.");
215
+ }
216
+ let body;
217
+ if (input.request !== undefined) {
218
+ body = serializeAws_restJson1ExchangeCodeForTokenRequestBody(input.request, context);
219
+ }
220
+ if (body === undefined) {
221
+ body = {};
222
+ }
223
+ body = JSON.stringify(body);
224
+ return new protocol_http_1.HttpRequest({
225
+ protocol,
226
+ hostname,
227
+ port,
228
+ method: "POST",
229
+ headers,
230
+ path: resolvedPath,
231
+ body,
232
+ });
233
+ };
234
+ exports.serializeAws_restJson1ExchangeCodeForTokenCommand = serializeAws_restJson1ExchangeCodeForTokenCommand;
235
+ const serializeAws_restJson1ExportComponentsCommand = async (input, context) => {
236
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
237
+ const headers = {};
238
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
239
+ "/export/app/{appId}/environment/{environmentName}/components";
240
+ if (input.appId !== undefined) {
241
+ const labelValue = input.appId;
242
+ if (labelValue.length <= 0) {
243
+ throw new Error("Empty value provided for input HTTP label: appId.");
244
+ }
245
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
246
+ }
247
+ else {
248
+ throw new Error("No value provided for input HTTP label: appId.");
249
+ }
250
+ if (input.environmentName !== undefined) {
251
+ const labelValue = input.environmentName;
252
+ if (labelValue.length <= 0) {
253
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
254
+ }
255
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
256
+ }
257
+ else {
258
+ throw new Error("No value provided for input HTTP label: environmentName.");
259
+ }
260
+ let body;
261
+ return new protocol_http_1.HttpRequest({
262
+ protocol,
263
+ hostname,
264
+ port,
265
+ method: "GET",
266
+ headers,
267
+ path: resolvedPath,
268
+ body,
269
+ });
270
+ };
271
+ exports.serializeAws_restJson1ExportComponentsCommand = serializeAws_restJson1ExportComponentsCommand;
272
+ const serializeAws_restJson1ExportThemesCommand = async (input, context) => {
273
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
274
+ const headers = {};
275
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
276
+ "/export/app/{appId}/environment/{environmentName}/themes";
277
+ if (input.appId !== undefined) {
278
+ const labelValue = input.appId;
279
+ if (labelValue.length <= 0) {
280
+ throw new Error("Empty value provided for input HTTP label: appId.");
281
+ }
282
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
283
+ }
284
+ else {
285
+ throw new Error("No value provided for input HTTP label: appId.");
286
+ }
287
+ if (input.environmentName !== undefined) {
288
+ const labelValue = input.environmentName;
289
+ if (labelValue.length <= 0) {
290
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
291
+ }
292
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
293
+ }
294
+ else {
295
+ throw new Error("No value provided for input HTTP label: environmentName.");
296
+ }
297
+ let body;
298
+ return new protocol_http_1.HttpRequest({
299
+ protocol,
300
+ hostname,
301
+ port,
302
+ method: "GET",
303
+ headers,
304
+ path: resolvedPath,
305
+ body,
306
+ });
307
+ };
308
+ exports.serializeAws_restJson1ExportThemesCommand = serializeAws_restJson1ExportThemesCommand;
309
+ const serializeAws_restJson1GetComponentCommand = async (input, context) => {
310
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
311
+ const headers = {};
312
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
313
+ "/app/{appId}/environment/{environmentName}/components/{id}";
314
+ if (input.appId !== undefined) {
315
+ const labelValue = input.appId;
316
+ if (labelValue.length <= 0) {
317
+ throw new Error("Empty value provided for input HTTP label: appId.");
318
+ }
319
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
320
+ }
321
+ else {
322
+ throw new Error("No value provided for input HTTP label: appId.");
323
+ }
324
+ if (input.environmentName !== undefined) {
325
+ const labelValue = input.environmentName;
326
+ if (labelValue.length <= 0) {
327
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
328
+ }
329
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
330
+ }
331
+ else {
332
+ throw new Error("No value provided for input HTTP label: environmentName.");
333
+ }
334
+ if (input.id !== undefined) {
335
+ const labelValue = input.id;
336
+ if (labelValue.length <= 0) {
337
+ throw new Error("Empty value provided for input HTTP label: id.");
338
+ }
339
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
340
+ }
341
+ else {
342
+ throw new Error("No value provided for input HTTP label: id.");
343
+ }
344
+ let body;
345
+ return new protocol_http_1.HttpRequest({
346
+ protocol,
347
+ hostname,
348
+ port,
349
+ method: "GET",
350
+ headers,
351
+ path: resolvedPath,
352
+ body,
353
+ });
354
+ };
355
+ exports.serializeAws_restJson1GetComponentCommand = serializeAws_restJson1GetComponentCommand;
356
+ const serializeAws_restJson1GetThemeCommand = async (input, context) => {
357
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
358
+ const headers = {};
359
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
360
+ "/app/{appId}/environment/{environmentName}/themes/{id}";
361
+ if (input.appId !== undefined) {
362
+ const labelValue = input.appId;
363
+ if (labelValue.length <= 0) {
364
+ throw new Error("Empty value provided for input HTTP label: appId.");
365
+ }
366
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
367
+ }
368
+ else {
369
+ throw new Error("No value provided for input HTTP label: appId.");
370
+ }
371
+ if (input.environmentName !== undefined) {
372
+ const labelValue = input.environmentName;
373
+ if (labelValue.length <= 0) {
374
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
375
+ }
376
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
377
+ }
378
+ else {
379
+ throw new Error("No value provided for input HTTP label: environmentName.");
380
+ }
381
+ if (input.id !== undefined) {
382
+ const labelValue = input.id;
383
+ if (labelValue.length <= 0) {
384
+ throw new Error("Empty value provided for input HTTP label: id.");
385
+ }
386
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
387
+ }
388
+ else {
389
+ throw new Error("No value provided for input HTTP label: id.");
390
+ }
391
+ let body;
392
+ return new protocol_http_1.HttpRequest({
393
+ protocol,
394
+ hostname,
395
+ port,
396
+ method: "GET",
397
+ headers,
398
+ path: resolvedPath,
399
+ body,
400
+ });
401
+ };
402
+ exports.serializeAws_restJson1GetThemeCommand = serializeAws_restJson1GetThemeCommand;
403
+ const serializeAws_restJson1ListComponentsCommand = async (input, context) => {
404
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
405
+ const headers = {};
406
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
407
+ "/app/{appId}/environment/{environmentName}/components";
408
+ if (input.appId !== undefined) {
409
+ const labelValue = input.appId;
410
+ if (labelValue.length <= 0) {
411
+ throw new Error("Empty value provided for input HTTP label: appId.");
412
+ }
413
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
414
+ }
415
+ else {
416
+ throw new Error("No value provided for input HTTP label: appId.");
417
+ }
418
+ if (input.environmentName !== undefined) {
419
+ const labelValue = input.environmentName;
420
+ if (labelValue.length <= 0) {
421
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
422
+ }
423
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
424
+ }
425
+ else {
426
+ throw new Error("No value provided for input HTTP label: environmentName.");
427
+ }
428
+ const query = {
429
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
430
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
431
+ };
432
+ let body;
433
+ return new protocol_http_1.HttpRequest({
434
+ protocol,
435
+ hostname,
436
+ port,
437
+ method: "GET",
438
+ headers,
439
+ path: resolvedPath,
440
+ query,
441
+ body,
442
+ });
443
+ };
444
+ exports.serializeAws_restJson1ListComponentsCommand = serializeAws_restJson1ListComponentsCommand;
445
+ const serializeAws_restJson1ListThemesCommand = async (input, context) => {
446
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
447
+ const headers = {};
448
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
449
+ "/app/{appId}/environment/{environmentName}/themes";
450
+ if (input.appId !== undefined) {
451
+ const labelValue = input.appId;
452
+ if (labelValue.length <= 0) {
453
+ throw new Error("Empty value provided for input HTTP label: appId.");
454
+ }
455
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
456
+ }
457
+ else {
458
+ throw new Error("No value provided for input HTTP label: appId.");
459
+ }
460
+ if (input.environmentName !== undefined) {
461
+ const labelValue = input.environmentName;
462
+ if (labelValue.length <= 0) {
463
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
464
+ }
465
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
466
+ }
467
+ else {
468
+ throw new Error("No value provided for input HTTP label: environmentName.");
469
+ }
470
+ const query = {
471
+ ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
472
+ ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
473
+ };
474
+ let body;
475
+ return new protocol_http_1.HttpRequest({
476
+ protocol,
477
+ hostname,
478
+ port,
479
+ method: "GET",
480
+ headers,
481
+ path: resolvedPath,
482
+ query,
483
+ body,
484
+ });
485
+ };
486
+ exports.serializeAws_restJson1ListThemesCommand = serializeAws_restJson1ListThemesCommand;
487
+ const serializeAws_restJson1RefreshTokenCommand = async (input, context) => {
488
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
489
+ const headers = {
490
+ "content-type": "application/json",
491
+ };
492
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tokens/{provider}/refresh";
493
+ if (input.provider !== undefined) {
494
+ const labelValue = input.provider;
495
+ if (labelValue.length <= 0) {
496
+ throw new Error("Empty value provided for input HTTP label: provider.");
497
+ }
498
+ resolvedPath = resolvedPath.replace("{provider}", smithy_client_1.extendedEncodeURIComponent(labelValue));
499
+ }
500
+ else {
501
+ throw new Error("No value provided for input HTTP label: provider.");
502
+ }
503
+ let body;
504
+ if (input.refreshTokenBody !== undefined) {
505
+ body = serializeAws_restJson1RefreshTokenRequestBody(input.refreshTokenBody, context);
506
+ }
507
+ if (body === undefined) {
508
+ body = {};
509
+ }
510
+ body = JSON.stringify(body);
511
+ return new protocol_http_1.HttpRequest({
512
+ protocol,
513
+ hostname,
514
+ port,
515
+ method: "POST",
516
+ headers,
517
+ path: resolvedPath,
518
+ body,
519
+ });
520
+ };
521
+ exports.serializeAws_restJson1RefreshTokenCommand = serializeAws_restJson1RefreshTokenCommand;
522
+ const serializeAws_restJson1UpdateComponentCommand = async (input, context) => {
523
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
524
+ const headers = {
525
+ "content-type": "application/json",
526
+ };
527
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
528
+ "/app/{appId}/environment/{environmentName}/components/{id}";
529
+ if (input.appId !== undefined) {
530
+ const labelValue = input.appId;
531
+ if (labelValue.length <= 0) {
532
+ throw new Error("Empty value provided for input HTTP label: appId.");
533
+ }
534
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
535
+ }
536
+ else {
537
+ throw new Error("No value provided for input HTTP label: appId.");
538
+ }
539
+ if (input.environmentName !== undefined) {
540
+ const labelValue = input.environmentName;
541
+ if (labelValue.length <= 0) {
542
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
543
+ }
544
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
545
+ }
546
+ else {
547
+ throw new Error("No value provided for input HTTP label: environmentName.");
548
+ }
549
+ if (input.id !== undefined) {
550
+ const labelValue = input.id;
551
+ if (labelValue.length <= 0) {
552
+ throw new Error("Empty value provided for input HTTP label: id.");
553
+ }
554
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
555
+ }
556
+ else {
557
+ throw new Error("No value provided for input HTTP label: id.");
558
+ }
559
+ const query = {
560
+ ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
561
+ };
562
+ let body;
563
+ if (input.updatedComponent !== undefined) {
564
+ body = serializeAws_restJson1UpdateComponentData(input.updatedComponent, context);
565
+ }
566
+ if (body === undefined) {
567
+ body = {};
568
+ }
569
+ body = JSON.stringify(body);
570
+ return new protocol_http_1.HttpRequest({
571
+ protocol,
572
+ hostname,
573
+ port,
574
+ method: "PATCH",
575
+ headers,
576
+ path: resolvedPath,
577
+ query,
578
+ body,
579
+ });
580
+ };
581
+ exports.serializeAws_restJson1UpdateComponentCommand = serializeAws_restJson1UpdateComponentCommand;
582
+ const serializeAws_restJson1UpdateThemeCommand = async (input, context) => {
583
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
584
+ const headers = {
585
+ "content-type": "application/json",
586
+ };
587
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
588
+ "/app/{appId}/environment/{environmentName}/themes/{id}";
589
+ if (input.appId !== undefined) {
590
+ const labelValue = input.appId;
591
+ if (labelValue.length <= 0) {
592
+ throw new Error("Empty value provided for input HTTP label: appId.");
593
+ }
594
+ resolvedPath = resolvedPath.replace("{appId}", smithy_client_1.extendedEncodeURIComponent(labelValue));
595
+ }
596
+ else {
597
+ throw new Error("No value provided for input HTTP label: appId.");
598
+ }
599
+ if (input.environmentName !== undefined) {
600
+ const labelValue = input.environmentName;
601
+ if (labelValue.length <= 0) {
602
+ throw new Error("Empty value provided for input HTTP label: environmentName.");
603
+ }
604
+ resolvedPath = resolvedPath.replace("{environmentName}", smithy_client_1.extendedEncodeURIComponent(labelValue));
605
+ }
606
+ else {
607
+ throw new Error("No value provided for input HTTP label: environmentName.");
608
+ }
609
+ if (input.id !== undefined) {
610
+ const labelValue = input.id;
611
+ if (labelValue.length <= 0) {
612
+ throw new Error("Empty value provided for input HTTP label: id.");
613
+ }
614
+ resolvedPath = resolvedPath.replace("{id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
615
+ }
616
+ else {
617
+ throw new Error("No value provided for input HTTP label: id.");
618
+ }
619
+ const query = {
620
+ ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
621
+ };
622
+ let body;
623
+ if (input.updatedTheme !== undefined) {
624
+ body = serializeAws_restJson1UpdateThemeData(input.updatedTheme, context);
625
+ }
626
+ if (body === undefined) {
627
+ body = {};
628
+ }
629
+ body = JSON.stringify(body);
630
+ return new protocol_http_1.HttpRequest({
631
+ protocol,
632
+ hostname,
633
+ port,
634
+ method: "PATCH",
635
+ headers,
636
+ path: resolvedPath,
637
+ query,
638
+ body,
639
+ });
640
+ };
641
+ exports.serializeAws_restJson1UpdateThemeCommand = serializeAws_restJson1UpdateThemeCommand;
642
+ const deserializeAws_restJson1CreateComponentCommand = async (output, context) => {
643
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
644
+ return deserializeAws_restJson1CreateComponentCommandError(output, context);
645
+ }
646
+ const contents = {
647
+ $metadata: deserializeMetadata(output),
648
+ entity: undefined,
649
+ };
650
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
651
+ contents.entity = deserializeAws_restJson1Component(data, context);
652
+ return Promise.resolve(contents);
653
+ };
654
+ exports.deserializeAws_restJson1CreateComponentCommand = deserializeAws_restJson1CreateComponentCommand;
655
+ const deserializeAws_restJson1CreateComponentCommandError = async (output, context) => {
656
+ const parsedOutput = {
657
+ ...output,
658
+ body: await parseBody(output.body, context),
659
+ };
660
+ let response;
661
+ let errorCode = "UnknownError";
662
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
663
+ switch (errorCode) {
664
+ case "InternalServerException":
665
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
666
+ response = {
667
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
668
+ name: errorCode,
669
+ $metadata: deserializeMetadata(output),
670
+ };
671
+ break;
672
+ case "InvalidParameterException":
673
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
674
+ response = {
675
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
676
+ name: errorCode,
677
+ $metadata: deserializeMetadata(output),
678
+ };
679
+ break;
680
+ case "ResourceConflictException":
681
+ case "com.amazonaws.amplifyuibuilder#ResourceConflictException":
682
+ response = {
683
+ ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
684
+ name: errorCode,
685
+ $metadata: deserializeMetadata(output),
686
+ };
687
+ break;
688
+ case "ServiceQuotaExceededException":
689
+ case "com.amazonaws.amplifyuibuilder#ServiceQuotaExceededException":
690
+ response = {
691
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
692
+ name: errorCode,
693
+ $metadata: deserializeMetadata(output),
694
+ };
695
+ break;
696
+ default:
697
+ const parsedBody = parsedOutput.body;
698
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
699
+ response = {
700
+ ...parsedBody,
701
+ name: `${errorCode}`,
702
+ message: parsedBody.message || parsedBody.Message || errorCode,
703
+ $fault: "client",
704
+ $metadata: deserializeMetadata(output),
705
+ };
706
+ }
707
+ const message = response.message || response.Message || errorCode;
708
+ response.message = message;
709
+ delete response.Message;
710
+ return Promise.reject(Object.assign(new Error(message), response));
711
+ };
712
+ const deserializeAws_restJson1CreateThemeCommand = async (output, context) => {
713
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
714
+ return deserializeAws_restJson1CreateThemeCommandError(output, context);
715
+ }
716
+ const contents = {
717
+ $metadata: deserializeMetadata(output),
718
+ entity: undefined,
719
+ };
720
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
721
+ contents.entity = deserializeAws_restJson1Theme(data, context);
722
+ return Promise.resolve(contents);
723
+ };
724
+ exports.deserializeAws_restJson1CreateThemeCommand = deserializeAws_restJson1CreateThemeCommand;
725
+ const deserializeAws_restJson1CreateThemeCommandError = async (output, context) => {
726
+ const parsedOutput = {
727
+ ...output,
728
+ body: await parseBody(output.body, context),
729
+ };
730
+ let response;
731
+ let errorCode = "UnknownError";
732
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
733
+ switch (errorCode) {
734
+ case "InternalServerException":
735
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
736
+ response = {
737
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
738
+ name: errorCode,
739
+ $metadata: deserializeMetadata(output),
740
+ };
741
+ break;
742
+ case "InvalidParameterException":
743
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
744
+ response = {
745
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
746
+ name: errorCode,
747
+ $metadata: deserializeMetadata(output),
748
+ };
749
+ break;
750
+ case "ResourceConflictException":
751
+ case "com.amazonaws.amplifyuibuilder#ResourceConflictException":
752
+ response = {
753
+ ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
754
+ name: errorCode,
755
+ $metadata: deserializeMetadata(output),
756
+ };
757
+ break;
758
+ case "ServiceQuotaExceededException":
759
+ case "com.amazonaws.amplifyuibuilder#ServiceQuotaExceededException":
760
+ response = {
761
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
762
+ name: errorCode,
763
+ $metadata: deserializeMetadata(output),
764
+ };
765
+ break;
766
+ default:
767
+ const parsedBody = parsedOutput.body;
768
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
769
+ response = {
770
+ ...parsedBody,
771
+ name: `${errorCode}`,
772
+ message: parsedBody.message || parsedBody.Message || errorCode,
773
+ $fault: "client",
774
+ $metadata: deserializeMetadata(output),
775
+ };
776
+ }
777
+ const message = response.message || response.Message || errorCode;
778
+ response.message = message;
779
+ delete response.Message;
780
+ return Promise.reject(Object.assign(new Error(message), response));
781
+ };
782
+ const deserializeAws_restJson1DeleteComponentCommand = async (output, context) => {
783
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
784
+ return deserializeAws_restJson1DeleteComponentCommandError(output, context);
785
+ }
786
+ const contents = {
787
+ $metadata: deserializeMetadata(output),
788
+ };
789
+ await collectBody(output.body, context);
790
+ return Promise.resolve(contents);
791
+ };
792
+ exports.deserializeAws_restJson1DeleteComponentCommand = deserializeAws_restJson1DeleteComponentCommand;
793
+ const deserializeAws_restJson1DeleteComponentCommandError = async (output, context) => {
794
+ const parsedOutput = {
795
+ ...output,
796
+ body: await parseBody(output.body, context),
797
+ };
798
+ let response;
799
+ let errorCode = "UnknownError";
800
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
801
+ switch (errorCode) {
802
+ case "InternalServerException":
803
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
804
+ response = {
805
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
806
+ name: errorCode,
807
+ $metadata: deserializeMetadata(output),
808
+ };
809
+ break;
810
+ case "InvalidParameterException":
811
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
812
+ response = {
813
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
814
+ name: errorCode,
815
+ $metadata: deserializeMetadata(output),
816
+ };
817
+ break;
818
+ case "ResourceNotFoundException":
819
+ case "com.amazonaws.amplifyuibuilder#ResourceNotFoundException":
820
+ response = {
821
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
822
+ name: errorCode,
823
+ $metadata: deserializeMetadata(output),
824
+ };
825
+ break;
826
+ default:
827
+ const parsedBody = parsedOutput.body;
828
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
829
+ response = {
830
+ ...parsedBody,
831
+ name: `${errorCode}`,
832
+ message: parsedBody.message || parsedBody.Message || errorCode,
833
+ $fault: "client",
834
+ $metadata: deserializeMetadata(output),
835
+ };
836
+ }
837
+ const message = response.message || response.Message || errorCode;
838
+ response.message = message;
839
+ delete response.Message;
840
+ return Promise.reject(Object.assign(new Error(message), response));
841
+ };
842
+ const deserializeAws_restJson1DeleteThemeCommand = async (output, context) => {
843
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
844
+ return deserializeAws_restJson1DeleteThemeCommandError(output, context);
845
+ }
846
+ const contents = {
847
+ $metadata: deserializeMetadata(output),
848
+ };
849
+ await collectBody(output.body, context);
850
+ return Promise.resolve(contents);
851
+ };
852
+ exports.deserializeAws_restJson1DeleteThemeCommand = deserializeAws_restJson1DeleteThemeCommand;
853
+ const deserializeAws_restJson1DeleteThemeCommandError = async (output, context) => {
854
+ const parsedOutput = {
855
+ ...output,
856
+ body: await parseBody(output.body, context),
857
+ };
858
+ let response;
859
+ let errorCode = "UnknownError";
860
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
861
+ switch (errorCode) {
862
+ case "InternalServerException":
863
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
864
+ response = {
865
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
866
+ name: errorCode,
867
+ $metadata: deserializeMetadata(output),
868
+ };
869
+ break;
870
+ case "InvalidParameterException":
871
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
872
+ response = {
873
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
874
+ name: errorCode,
875
+ $metadata: deserializeMetadata(output),
876
+ };
877
+ break;
878
+ case "ResourceNotFoundException":
879
+ case "com.amazonaws.amplifyuibuilder#ResourceNotFoundException":
880
+ response = {
881
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
882
+ name: errorCode,
883
+ $metadata: deserializeMetadata(output),
884
+ };
885
+ break;
886
+ default:
887
+ const parsedBody = parsedOutput.body;
888
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
889
+ response = {
890
+ ...parsedBody,
891
+ name: `${errorCode}`,
892
+ message: parsedBody.message || parsedBody.Message || errorCode,
893
+ $fault: "client",
894
+ $metadata: deserializeMetadata(output),
895
+ };
896
+ }
897
+ const message = response.message || response.Message || errorCode;
898
+ response.message = message;
899
+ delete response.Message;
900
+ return Promise.reject(Object.assign(new Error(message), response));
901
+ };
902
+ const deserializeAws_restJson1ExchangeCodeForTokenCommand = async (output, context) => {
903
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
904
+ return deserializeAws_restJson1ExchangeCodeForTokenCommandError(output, context);
905
+ }
906
+ const contents = {
907
+ $metadata: deserializeMetadata(output),
908
+ accessToken: undefined,
909
+ expiresIn: undefined,
910
+ refreshToken: undefined,
911
+ };
912
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
913
+ if (data.accessToken !== undefined && data.accessToken !== null) {
914
+ contents.accessToken = smithy_client_1.expectString(data.accessToken);
915
+ }
916
+ if (data.expiresIn !== undefined && data.expiresIn !== null) {
917
+ contents.expiresIn = smithy_client_1.expectInt32(data.expiresIn);
918
+ }
919
+ if (data.refreshToken !== undefined && data.refreshToken !== null) {
920
+ contents.refreshToken = smithy_client_1.expectString(data.refreshToken);
921
+ }
922
+ return Promise.resolve(contents);
923
+ };
924
+ exports.deserializeAws_restJson1ExchangeCodeForTokenCommand = deserializeAws_restJson1ExchangeCodeForTokenCommand;
925
+ const deserializeAws_restJson1ExchangeCodeForTokenCommandError = async (output, context) => {
926
+ const parsedOutput = {
927
+ ...output,
928
+ body: await parseBody(output.body, context),
929
+ };
930
+ let response;
931
+ let errorCode = "UnknownError";
932
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
933
+ switch (errorCode) {
934
+ case "InvalidParameterException":
935
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
936
+ response = {
937
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
938
+ name: errorCode,
939
+ $metadata: deserializeMetadata(output),
940
+ };
941
+ break;
942
+ default:
943
+ const parsedBody = parsedOutput.body;
944
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
945
+ response = {
946
+ ...parsedBody,
947
+ name: `${errorCode}`,
948
+ message: parsedBody.message || parsedBody.Message || errorCode,
949
+ $fault: "client",
950
+ $metadata: deserializeMetadata(output),
951
+ };
952
+ }
953
+ const message = response.message || response.Message || errorCode;
954
+ response.message = message;
955
+ delete response.Message;
956
+ return Promise.reject(Object.assign(new Error(message), response));
957
+ };
958
+ const deserializeAws_restJson1ExportComponentsCommand = async (output, context) => {
959
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
960
+ return deserializeAws_restJson1ExportComponentsCommandError(output, context);
961
+ }
962
+ const contents = {
963
+ $metadata: deserializeMetadata(output),
964
+ entities: undefined,
965
+ };
966
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
967
+ if (data.entities !== undefined && data.entities !== null) {
968
+ contents.entities = deserializeAws_restJson1ComponentList(data.entities, context);
969
+ }
970
+ return Promise.resolve(contents);
971
+ };
972
+ exports.deserializeAws_restJson1ExportComponentsCommand = deserializeAws_restJson1ExportComponentsCommand;
973
+ const deserializeAws_restJson1ExportComponentsCommandError = async (output, context) => {
974
+ const parsedOutput = {
975
+ ...output,
976
+ body: await parseBody(output.body, context),
977
+ };
978
+ let response;
979
+ let errorCode = "UnknownError";
980
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
981
+ switch (errorCode) {
982
+ case "InternalServerException":
983
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
984
+ response = {
985
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
986
+ name: errorCode,
987
+ $metadata: deserializeMetadata(output),
988
+ };
989
+ break;
990
+ case "InvalidParameterException":
991
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
992
+ response = {
993
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
994
+ name: errorCode,
995
+ $metadata: deserializeMetadata(output),
996
+ };
997
+ break;
998
+ default:
999
+ const parsedBody = parsedOutput.body;
1000
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1001
+ response = {
1002
+ ...parsedBody,
1003
+ name: `${errorCode}`,
1004
+ message: parsedBody.message || parsedBody.Message || errorCode,
1005
+ $fault: "client",
1006
+ $metadata: deserializeMetadata(output),
1007
+ };
1008
+ }
1009
+ const message = response.message || response.Message || errorCode;
1010
+ response.message = message;
1011
+ delete response.Message;
1012
+ return Promise.reject(Object.assign(new Error(message), response));
1013
+ };
1014
+ const deserializeAws_restJson1ExportThemesCommand = async (output, context) => {
1015
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1016
+ return deserializeAws_restJson1ExportThemesCommandError(output, context);
1017
+ }
1018
+ const contents = {
1019
+ $metadata: deserializeMetadata(output),
1020
+ entities: undefined,
1021
+ };
1022
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
1023
+ if (data.entities !== undefined && data.entities !== null) {
1024
+ contents.entities = deserializeAws_restJson1ThemeList(data.entities, context);
1025
+ }
1026
+ return Promise.resolve(contents);
1027
+ };
1028
+ exports.deserializeAws_restJson1ExportThemesCommand = deserializeAws_restJson1ExportThemesCommand;
1029
+ const deserializeAws_restJson1ExportThemesCommandError = async (output, context) => {
1030
+ const parsedOutput = {
1031
+ ...output,
1032
+ body: await parseBody(output.body, context),
1033
+ };
1034
+ let response;
1035
+ let errorCode = "UnknownError";
1036
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1037
+ switch (errorCode) {
1038
+ case "InternalServerException":
1039
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1040
+ response = {
1041
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1042
+ name: errorCode,
1043
+ $metadata: deserializeMetadata(output),
1044
+ };
1045
+ break;
1046
+ case "InvalidParameterException":
1047
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1048
+ response = {
1049
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1050
+ name: errorCode,
1051
+ $metadata: deserializeMetadata(output),
1052
+ };
1053
+ break;
1054
+ default:
1055
+ const parsedBody = parsedOutput.body;
1056
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1057
+ response = {
1058
+ ...parsedBody,
1059
+ name: `${errorCode}`,
1060
+ message: parsedBody.message || parsedBody.Message || errorCode,
1061
+ $fault: "client",
1062
+ $metadata: deserializeMetadata(output),
1063
+ };
1064
+ }
1065
+ const message = response.message || response.Message || errorCode;
1066
+ response.message = message;
1067
+ delete response.Message;
1068
+ return Promise.reject(Object.assign(new Error(message), response));
1069
+ };
1070
+ const deserializeAws_restJson1GetComponentCommand = async (output, context) => {
1071
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1072
+ return deserializeAws_restJson1GetComponentCommandError(output, context);
1073
+ }
1074
+ const contents = {
1075
+ $metadata: deserializeMetadata(output),
1076
+ component: undefined,
1077
+ };
1078
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
1079
+ contents.component = deserializeAws_restJson1Component(data, context);
1080
+ return Promise.resolve(contents);
1081
+ };
1082
+ exports.deserializeAws_restJson1GetComponentCommand = deserializeAws_restJson1GetComponentCommand;
1083
+ const deserializeAws_restJson1GetComponentCommandError = async (output, context) => {
1084
+ const parsedOutput = {
1085
+ ...output,
1086
+ body: await parseBody(output.body, context),
1087
+ };
1088
+ let response;
1089
+ let errorCode = "UnknownError";
1090
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1091
+ switch (errorCode) {
1092
+ case "InternalServerException":
1093
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1094
+ response = {
1095
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1096
+ name: errorCode,
1097
+ $metadata: deserializeMetadata(output),
1098
+ };
1099
+ break;
1100
+ case "InvalidParameterException":
1101
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1102
+ response = {
1103
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1104
+ name: errorCode,
1105
+ $metadata: deserializeMetadata(output),
1106
+ };
1107
+ break;
1108
+ case "ResourceNotFoundException":
1109
+ case "com.amazonaws.amplifyuibuilder#ResourceNotFoundException":
1110
+ response = {
1111
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1112
+ name: errorCode,
1113
+ $metadata: deserializeMetadata(output),
1114
+ };
1115
+ break;
1116
+ default:
1117
+ const parsedBody = parsedOutput.body;
1118
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1119
+ response = {
1120
+ ...parsedBody,
1121
+ name: `${errorCode}`,
1122
+ message: parsedBody.message || parsedBody.Message || errorCode,
1123
+ $fault: "client",
1124
+ $metadata: deserializeMetadata(output),
1125
+ };
1126
+ }
1127
+ const message = response.message || response.Message || errorCode;
1128
+ response.message = message;
1129
+ delete response.Message;
1130
+ return Promise.reject(Object.assign(new Error(message), response));
1131
+ };
1132
+ const deserializeAws_restJson1GetThemeCommand = async (output, context) => {
1133
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1134
+ return deserializeAws_restJson1GetThemeCommandError(output, context);
1135
+ }
1136
+ const contents = {
1137
+ $metadata: deserializeMetadata(output),
1138
+ theme: undefined,
1139
+ };
1140
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
1141
+ contents.theme = deserializeAws_restJson1Theme(data, context);
1142
+ return Promise.resolve(contents);
1143
+ };
1144
+ exports.deserializeAws_restJson1GetThemeCommand = deserializeAws_restJson1GetThemeCommand;
1145
+ const deserializeAws_restJson1GetThemeCommandError = async (output, context) => {
1146
+ const parsedOutput = {
1147
+ ...output,
1148
+ body: await parseBody(output.body, context),
1149
+ };
1150
+ let response;
1151
+ let errorCode = "UnknownError";
1152
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1153
+ switch (errorCode) {
1154
+ case "InternalServerException":
1155
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1156
+ response = {
1157
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1158
+ name: errorCode,
1159
+ $metadata: deserializeMetadata(output),
1160
+ };
1161
+ break;
1162
+ case "InvalidParameterException":
1163
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1164
+ response = {
1165
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1166
+ name: errorCode,
1167
+ $metadata: deserializeMetadata(output),
1168
+ };
1169
+ break;
1170
+ case "ResourceNotFoundException":
1171
+ case "com.amazonaws.amplifyuibuilder#ResourceNotFoundException":
1172
+ response = {
1173
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1174
+ name: errorCode,
1175
+ $metadata: deserializeMetadata(output),
1176
+ };
1177
+ break;
1178
+ default:
1179
+ const parsedBody = parsedOutput.body;
1180
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1181
+ response = {
1182
+ ...parsedBody,
1183
+ name: `${errorCode}`,
1184
+ message: parsedBody.message || parsedBody.Message || errorCode,
1185
+ $fault: "client",
1186
+ $metadata: deserializeMetadata(output),
1187
+ };
1188
+ }
1189
+ const message = response.message || response.Message || errorCode;
1190
+ response.message = message;
1191
+ delete response.Message;
1192
+ return Promise.reject(Object.assign(new Error(message), response));
1193
+ };
1194
+ const deserializeAws_restJson1ListComponentsCommand = async (output, context) => {
1195
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1196
+ return deserializeAws_restJson1ListComponentsCommandError(output, context);
1197
+ }
1198
+ const contents = {
1199
+ $metadata: deserializeMetadata(output),
1200
+ entities: undefined,
1201
+ nextToken: undefined,
1202
+ };
1203
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
1204
+ if (data.entities !== undefined && data.entities !== null) {
1205
+ contents.entities = deserializeAws_restJson1ComponentSummaryList(data.entities, context);
1206
+ }
1207
+ if (data.nextToken !== undefined && data.nextToken !== null) {
1208
+ contents.nextToken = smithy_client_1.expectString(data.nextToken);
1209
+ }
1210
+ return Promise.resolve(contents);
1211
+ };
1212
+ exports.deserializeAws_restJson1ListComponentsCommand = deserializeAws_restJson1ListComponentsCommand;
1213
+ const deserializeAws_restJson1ListComponentsCommandError = async (output, context) => {
1214
+ const parsedOutput = {
1215
+ ...output,
1216
+ body: await parseBody(output.body, context),
1217
+ };
1218
+ let response;
1219
+ let errorCode = "UnknownError";
1220
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1221
+ switch (errorCode) {
1222
+ case "InternalServerException":
1223
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1224
+ response = {
1225
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1226
+ name: errorCode,
1227
+ $metadata: deserializeMetadata(output),
1228
+ };
1229
+ break;
1230
+ case "InvalidParameterException":
1231
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1232
+ response = {
1233
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1234
+ name: errorCode,
1235
+ $metadata: deserializeMetadata(output),
1236
+ };
1237
+ break;
1238
+ default:
1239
+ const parsedBody = parsedOutput.body;
1240
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1241
+ response = {
1242
+ ...parsedBody,
1243
+ name: `${errorCode}`,
1244
+ message: parsedBody.message || parsedBody.Message || errorCode,
1245
+ $fault: "client",
1246
+ $metadata: deserializeMetadata(output),
1247
+ };
1248
+ }
1249
+ const message = response.message || response.Message || errorCode;
1250
+ response.message = message;
1251
+ delete response.Message;
1252
+ return Promise.reject(Object.assign(new Error(message), response));
1253
+ };
1254
+ const deserializeAws_restJson1ListThemesCommand = async (output, context) => {
1255
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1256
+ return deserializeAws_restJson1ListThemesCommandError(output, context);
1257
+ }
1258
+ const contents = {
1259
+ $metadata: deserializeMetadata(output),
1260
+ entities: undefined,
1261
+ nextToken: undefined,
1262
+ };
1263
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
1264
+ if (data.entities !== undefined && data.entities !== null) {
1265
+ contents.entities = deserializeAws_restJson1ThemeSummaryList(data.entities, context);
1266
+ }
1267
+ if (data.nextToken !== undefined && data.nextToken !== null) {
1268
+ contents.nextToken = smithy_client_1.expectString(data.nextToken);
1269
+ }
1270
+ return Promise.resolve(contents);
1271
+ };
1272
+ exports.deserializeAws_restJson1ListThemesCommand = deserializeAws_restJson1ListThemesCommand;
1273
+ const deserializeAws_restJson1ListThemesCommandError = async (output, context) => {
1274
+ const parsedOutput = {
1275
+ ...output,
1276
+ body: await parseBody(output.body, context),
1277
+ };
1278
+ let response;
1279
+ let errorCode = "UnknownError";
1280
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1281
+ switch (errorCode) {
1282
+ case "InternalServerException":
1283
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1284
+ response = {
1285
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1286
+ name: errorCode,
1287
+ $metadata: deserializeMetadata(output),
1288
+ };
1289
+ break;
1290
+ case "InvalidParameterException":
1291
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1292
+ response = {
1293
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1294
+ name: errorCode,
1295
+ $metadata: deserializeMetadata(output),
1296
+ };
1297
+ break;
1298
+ default:
1299
+ const parsedBody = parsedOutput.body;
1300
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1301
+ response = {
1302
+ ...parsedBody,
1303
+ name: `${errorCode}`,
1304
+ message: parsedBody.message || parsedBody.Message || errorCode,
1305
+ $fault: "client",
1306
+ $metadata: deserializeMetadata(output),
1307
+ };
1308
+ }
1309
+ const message = response.message || response.Message || errorCode;
1310
+ response.message = message;
1311
+ delete response.Message;
1312
+ return Promise.reject(Object.assign(new Error(message), response));
1313
+ };
1314
+ const deserializeAws_restJson1RefreshTokenCommand = async (output, context) => {
1315
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1316
+ return deserializeAws_restJson1RefreshTokenCommandError(output, context);
1317
+ }
1318
+ const contents = {
1319
+ $metadata: deserializeMetadata(output),
1320
+ accessToken: undefined,
1321
+ expiresIn: undefined,
1322
+ };
1323
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
1324
+ if (data.accessToken !== undefined && data.accessToken !== null) {
1325
+ contents.accessToken = smithy_client_1.expectString(data.accessToken);
1326
+ }
1327
+ if (data.expiresIn !== undefined && data.expiresIn !== null) {
1328
+ contents.expiresIn = smithy_client_1.expectInt32(data.expiresIn);
1329
+ }
1330
+ return Promise.resolve(contents);
1331
+ };
1332
+ exports.deserializeAws_restJson1RefreshTokenCommand = deserializeAws_restJson1RefreshTokenCommand;
1333
+ const deserializeAws_restJson1RefreshTokenCommandError = async (output, context) => {
1334
+ const parsedOutput = {
1335
+ ...output,
1336
+ body: await parseBody(output.body, context),
1337
+ };
1338
+ let response;
1339
+ let errorCode = "UnknownError";
1340
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1341
+ switch (errorCode) {
1342
+ case "InvalidParameterException":
1343
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1344
+ response = {
1345
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1346
+ name: errorCode,
1347
+ $metadata: deserializeMetadata(output),
1348
+ };
1349
+ break;
1350
+ default:
1351
+ const parsedBody = parsedOutput.body;
1352
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1353
+ response = {
1354
+ ...parsedBody,
1355
+ name: `${errorCode}`,
1356
+ message: parsedBody.message || parsedBody.Message || errorCode,
1357
+ $fault: "client",
1358
+ $metadata: deserializeMetadata(output),
1359
+ };
1360
+ }
1361
+ const message = response.message || response.Message || errorCode;
1362
+ response.message = message;
1363
+ delete response.Message;
1364
+ return Promise.reject(Object.assign(new Error(message), response));
1365
+ };
1366
+ const deserializeAws_restJson1UpdateComponentCommand = async (output, context) => {
1367
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1368
+ return deserializeAws_restJson1UpdateComponentCommandError(output, context);
1369
+ }
1370
+ const contents = {
1371
+ $metadata: deserializeMetadata(output),
1372
+ entity: undefined,
1373
+ };
1374
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
1375
+ contents.entity = deserializeAws_restJson1Component(data, context);
1376
+ return Promise.resolve(contents);
1377
+ };
1378
+ exports.deserializeAws_restJson1UpdateComponentCommand = deserializeAws_restJson1UpdateComponentCommand;
1379
+ const deserializeAws_restJson1UpdateComponentCommandError = async (output, context) => {
1380
+ const parsedOutput = {
1381
+ ...output,
1382
+ body: await parseBody(output.body, context),
1383
+ };
1384
+ let response;
1385
+ let errorCode = "UnknownError";
1386
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1387
+ switch (errorCode) {
1388
+ case "InternalServerException":
1389
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1390
+ response = {
1391
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1392
+ name: errorCode,
1393
+ $metadata: deserializeMetadata(output),
1394
+ };
1395
+ break;
1396
+ case "InvalidParameterException":
1397
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1398
+ response = {
1399
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1400
+ name: errorCode,
1401
+ $metadata: deserializeMetadata(output),
1402
+ };
1403
+ break;
1404
+ case "ResourceConflictException":
1405
+ case "com.amazonaws.amplifyuibuilder#ResourceConflictException":
1406
+ response = {
1407
+ ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
1408
+ name: errorCode,
1409
+ $metadata: deserializeMetadata(output),
1410
+ };
1411
+ break;
1412
+ default:
1413
+ const parsedBody = parsedOutput.body;
1414
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1415
+ response = {
1416
+ ...parsedBody,
1417
+ name: `${errorCode}`,
1418
+ message: parsedBody.message || parsedBody.Message || errorCode,
1419
+ $fault: "client",
1420
+ $metadata: deserializeMetadata(output),
1421
+ };
1422
+ }
1423
+ const message = response.message || response.Message || errorCode;
1424
+ response.message = message;
1425
+ delete response.Message;
1426
+ return Promise.reject(Object.assign(new Error(message), response));
1427
+ };
1428
+ const deserializeAws_restJson1UpdateThemeCommand = async (output, context) => {
1429
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1430
+ return deserializeAws_restJson1UpdateThemeCommandError(output, context);
1431
+ }
1432
+ const contents = {
1433
+ $metadata: deserializeMetadata(output),
1434
+ entity: undefined,
1435
+ };
1436
+ const data = smithy_client_1.expectObject(await parseBody(output.body, context));
1437
+ contents.entity = deserializeAws_restJson1Theme(data, context);
1438
+ return Promise.resolve(contents);
1439
+ };
1440
+ exports.deserializeAws_restJson1UpdateThemeCommand = deserializeAws_restJson1UpdateThemeCommand;
1441
+ const deserializeAws_restJson1UpdateThemeCommandError = async (output, context) => {
1442
+ const parsedOutput = {
1443
+ ...output,
1444
+ body: await parseBody(output.body, context),
1445
+ };
1446
+ let response;
1447
+ let errorCode = "UnknownError";
1448
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1449
+ switch (errorCode) {
1450
+ case "InternalServerException":
1451
+ case "com.amazonaws.amplifyuibuilder#InternalServerException":
1452
+ response = {
1453
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1454
+ name: errorCode,
1455
+ $metadata: deserializeMetadata(output),
1456
+ };
1457
+ break;
1458
+ case "InvalidParameterException":
1459
+ case "com.amazonaws.amplifyuibuilder#InvalidParameterException":
1460
+ response = {
1461
+ ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1462
+ name: errorCode,
1463
+ $metadata: deserializeMetadata(output),
1464
+ };
1465
+ break;
1466
+ case "ResourceConflictException":
1467
+ case "com.amazonaws.amplifyuibuilder#ResourceConflictException":
1468
+ response = {
1469
+ ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
1470
+ name: errorCode,
1471
+ $metadata: deserializeMetadata(output),
1472
+ };
1473
+ break;
1474
+ default:
1475
+ const parsedBody = parsedOutput.body;
1476
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1477
+ response = {
1478
+ ...parsedBody,
1479
+ name: `${errorCode}`,
1480
+ message: parsedBody.message || parsedBody.Message || errorCode,
1481
+ $fault: "client",
1482
+ $metadata: deserializeMetadata(output),
1483
+ };
1484
+ }
1485
+ const message = response.message || response.Message || errorCode;
1486
+ response.message = message;
1487
+ delete response.Message;
1488
+ return Promise.reject(Object.assign(new Error(message), response));
1489
+ };
1490
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1491
+ const contents = {
1492
+ name: "InternalServerException",
1493
+ $fault: "server",
1494
+ $metadata: deserializeMetadata(parsedOutput),
1495
+ message: undefined,
1496
+ };
1497
+ const data = parsedOutput.body;
1498
+ if (data.message !== undefined && data.message !== null) {
1499
+ contents.message = smithy_client_1.expectString(data.message);
1500
+ }
1501
+ return contents;
1502
+ };
1503
+ const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
1504
+ const contents = {
1505
+ name: "InvalidParameterException",
1506
+ $fault: "client",
1507
+ $metadata: deserializeMetadata(parsedOutput),
1508
+ message: undefined,
1509
+ };
1510
+ const data = parsedOutput.body;
1511
+ if (data.message !== undefined && data.message !== null) {
1512
+ contents.message = smithy_client_1.expectString(data.message);
1513
+ }
1514
+ return contents;
1515
+ };
1516
+ const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
1517
+ const contents = {
1518
+ name: "ResourceConflictException",
1519
+ $fault: "client",
1520
+ $metadata: deserializeMetadata(parsedOutput),
1521
+ message: undefined,
1522
+ };
1523
+ const data = parsedOutput.body;
1524
+ if (data.message !== undefined && data.message !== null) {
1525
+ contents.message = smithy_client_1.expectString(data.message);
1526
+ }
1527
+ return contents;
1528
+ };
1529
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1530
+ const contents = {
1531
+ name: "ResourceNotFoundException",
1532
+ $fault: "client",
1533
+ $metadata: deserializeMetadata(parsedOutput),
1534
+ message: undefined,
1535
+ };
1536
+ const data = parsedOutput.body;
1537
+ if (data.message !== undefined && data.message !== null) {
1538
+ contents.message = smithy_client_1.expectString(data.message);
1539
+ }
1540
+ return contents;
1541
+ };
1542
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1543
+ const contents = {
1544
+ name: "ServiceQuotaExceededException",
1545
+ $fault: "client",
1546
+ $metadata: deserializeMetadata(parsedOutput),
1547
+ message: undefined,
1548
+ };
1549
+ const data = parsedOutput.body;
1550
+ if (data.message !== undefined && data.message !== null) {
1551
+ contents.message = smithy_client_1.expectString(data.message);
1552
+ }
1553
+ return contents;
1554
+ };
1555
+ const serializeAws_restJson1ComponentBindingProperties = (input, context) => {
1556
+ return Object.entries(input).reduce((acc, [key, value]) => {
1557
+ if (value === null) {
1558
+ return acc;
1559
+ }
1560
+ return {
1561
+ ...acc,
1562
+ [key]: serializeAws_restJson1ComponentBindingPropertiesValue(value, context),
1563
+ };
1564
+ }, {});
1565
+ };
1566
+ const serializeAws_restJson1ComponentBindingPropertiesValue = (input, context) => {
1567
+ return {
1568
+ ...(input.bindingProperties !== undefined &&
1569
+ input.bindingProperties !== null && {
1570
+ bindingProperties: serializeAws_restJson1ComponentBindingPropertiesValueProperties(input.bindingProperties, context),
1571
+ }),
1572
+ ...(input.defaultValue !== undefined && input.defaultValue !== null && { defaultValue: input.defaultValue }),
1573
+ ...(input.type !== undefined && input.type !== null && { type: input.type }),
1574
+ };
1575
+ };
1576
+ const serializeAws_restJson1ComponentBindingPropertiesValueProperties = (input, context) => {
1577
+ return {
1578
+ ...(input.bucket !== undefined && input.bucket !== null && { bucket: input.bucket }),
1579
+ ...(input.defaultValue !== undefined && input.defaultValue !== null && { defaultValue: input.defaultValue }),
1580
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
1581
+ ...(input.key !== undefined && input.key !== null && { key: input.key }),
1582
+ ...(input.model !== undefined && input.model !== null && { model: input.model }),
1583
+ ...(input.predicates !== undefined &&
1584
+ input.predicates !== null && { predicates: serializeAws_restJson1PredicateList(input.predicates, context) }),
1585
+ ...(input.userAttribute !== undefined && input.userAttribute !== null && { userAttribute: input.userAttribute }),
1586
+ };
1587
+ };
1588
+ const serializeAws_restJson1ComponentChild = (input, context) => {
1589
+ return {
1590
+ ...(input.children !== undefined &&
1591
+ input.children !== null && { children: serializeAws_restJson1ComponentChildList(input.children, context) }),
1592
+ ...(input.componentType !== undefined && input.componentType !== null && { componentType: input.componentType }),
1593
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1594
+ ...(input.properties !== undefined &&
1595
+ input.properties !== null && {
1596
+ properties: serializeAws_restJson1ComponentProperties(input.properties, context),
1597
+ }),
1598
+ };
1599
+ };
1600
+ const serializeAws_restJson1ComponentChildList = (input, context) => {
1601
+ return input
1602
+ .filter((e) => e != null)
1603
+ .map((entry) => {
1604
+ if (entry === null) {
1605
+ return null;
1606
+ }
1607
+ return serializeAws_restJson1ComponentChild(entry, context);
1608
+ });
1609
+ };
1610
+ const serializeAws_restJson1ComponentCollectionProperties = (input, context) => {
1611
+ return Object.entries(input).reduce((acc, [key, value]) => {
1612
+ if (value === null) {
1613
+ return acc;
1614
+ }
1615
+ return {
1616
+ ...acc,
1617
+ [key]: serializeAws_restJson1ComponentDataConfiguration(value, context),
1618
+ };
1619
+ }, {});
1620
+ };
1621
+ const serializeAws_restJson1ComponentConditionProperty = (input, context) => {
1622
+ return {
1623
+ ...(input.else !== undefined &&
1624
+ input.else !== null && { else: serializeAws_restJson1ComponentProperty(input.else, context) }),
1625
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
1626
+ ...(input.operand !== undefined && input.operand !== null && { operand: input.operand }),
1627
+ ...(input.operator !== undefined && input.operator !== null && { operator: input.operator }),
1628
+ ...(input.property !== undefined && input.property !== null && { property: input.property }),
1629
+ ...(input.then !== undefined &&
1630
+ input.then !== null && { then: serializeAws_restJson1ComponentProperty(input.then, context) }),
1631
+ };
1632
+ };
1633
+ const serializeAws_restJson1ComponentDataConfiguration = (input, context) => {
1634
+ return {
1635
+ ...(input.identifiers !== undefined &&
1636
+ input.identifiers !== null && { identifiers: serializeAws_restJson1IdentifierList(input.identifiers, context) }),
1637
+ ...(input.model !== undefined && input.model !== null && { model: input.model }),
1638
+ ...(input.predicate !== undefined &&
1639
+ input.predicate !== null && { predicate: serializeAws_restJson1Predicate(input.predicate, context) }),
1640
+ ...(input.sort !== undefined &&
1641
+ input.sort !== null && { sort: serializeAws_restJson1SortPropertyList(input.sort, context) }),
1642
+ };
1643
+ };
1644
+ const serializeAws_restJson1ComponentOverrides = (input, context) => {
1645
+ return Object.entries(input).reduce((acc, [key, value]) => {
1646
+ if (value === null) {
1647
+ return acc;
1648
+ }
1649
+ return {
1650
+ ...acc,
1651
+ [key]: serializeAws_restJson1ComponentOverridesValue(value, context),
1652
+ };
1653
+ }, {});
1654
+ };
1655
+ const serializeAws_restJson1ComponentOverridesValue = (input, context) => {
1656
+ return Object.entries(input).reduce((acc, [key, value]) => {
1657
+ if (value === null) {
1658
+ return acc;
1659
+ }
1660
+ return {
1661
+ ...acc,
1662
+ [key]: value,
1663
+ };
1664
+ }, {});
1665
+ };
1666
+ const serializeAws_restJson1ComponentProperties = (input, context) => {
1667
+ return Object.entries(input).reduce((acc, [key, value]) => {
1668
+ if (value === null) {
1669
+ return acc;
1670
+ }
1671
+ return {
1672
+ ...acc,
1673
+ [key]: serializeAws_restJson1ComponentProperty(value, context),
1674
+ };
1675
+ }, {});
1676
+ };
1677
+ const serializeAws_restJson1ComponentProperty = (input, context) => {
1678
+ return {
1679
+ ...(input.bindingProperties !== undefined &&
1680
+ input.bindingProperties !== null && {
1681
+ bindingProperties: serializeAws_restJson1ComponentPropertyBindingProperties(input.bindingProperties, context),
1682
+ }),
1683
+ ...(input.bindings !== undefined &&
1684
+ input.bindings !== null && { bindings: serializeAws_restJson1FormBindings(input.bindings, context) }),
1685
+ ...(input.collectionBindingProperties !== undefined &&
1686
+ input.collectionBindingProperties !== null && {
1687
+ collectionBindingProperties: serializeAws_restJson1ComponentPropertyBindingProperties(input.collectionBindingProperties, context),
1688
+ }),
1689
+ ...(input.concat !== undefined &&
1690
+ input.concat !== null && { concat: serializeAws_restJson1ComponentPropertyList(input.concat, context) }),
1691
+ ...(input.condition !== undefined &&
1692
+ input.condition !== null && {
1693
+ condition: serializeAws_restJson1ComponentConditionProperty(input.condition, context),
1694
+ }),
1695
+ ...(input.configured !== undefined && input.configured !== null && { configured: input.configured }),
1696
+ ...(input.defaultValue !== undefined && input.defaultValue !== null && { defaultValue: input.defaultValue }),
1697
+ ...(input.event !== undefined && input.event !== null && { event: input.event }),
1698
+ ...(input.importedValue !== undefined && input.importedValue !== null && { importedValue: input.importedValue }),
1699
+ ...(input.model !== undefined && input.model !== null && { model: input.model }),
1700
+ ...(input.type !== undefined && input.type !== null && { type: input.type }),
1701
+ ...(input.userAttribute !== undefined && input.userAttribute !== null && { userAttribute: input.userAttribute }),
1702
+ ...(input.value !== undefined && input.value !== null && { value: input.value }),
1703
+ };
1704
+ };
1705
+ const serializeAws_restJson1ComponentPropertyBindingProperties = (input, context) => {
1706
+ return {
1707
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
1708
+ ...(input.property !== undefined && input.property !== null && { property: input.property }),
1709
+ };
1710
+ };
1711
+ const serializeAws_restJson1ComponentPropertyList = (input, context) => {
1712
+ return input
1713
+ .filter((e) => e != null)
1714
+ .map((entry) => {
1715
+ if (entry === null) {
1716
+ return null;
1717
+ }
1718
+ return serializeAws_restJson1ComponentProperty(entry, context);
1719
+ });
1720
+ };
1721
+ const serializeAws_restJson1ComponentVariant = (input, context) => {
1722
+ return {
1723
+ ...(input.overrides !== undefined &&
1724
+ input.overrides !== null && { overrides: serializeAws_restJson1ComponentOverrides(input.overrides, context) }),
1725
+ ...(input.variantValues !== undefined &&
1726
+ input.variantValues !== null && {
1727
+ variantValues: serializeAws_restJson1ComponentVariantValues(input.variantValues, context),
1728
+ }),
1729
+ };
1730
+ };
1731
+ const serializeAws_restJson1ComponentVariants = (input, context) => {
1732
+ return input
1733
+ .filter((e) => e != null)
1734
+ .map((entry) => {
1735
+ if (entry === null) {
1736
+ return null;
1737
+ }
1738
+ return serializeAws_restJson1ComponentVariant(entry, context);
1739
+ });
1740
+ };
1741
+ const serializeAws_restJson1ComponentVariantValues = (input, context) => {
1742
+ return Object.entries(input).reduce((acc, [key, value]) => {
1743
+ if (value === null) {
1744
+ return acc;
1745
+ }
1746
+ return {
1747
+ ...acc,
1748
+ [key]: value,
1749
+ };
1750
+ }, {});
1751
+ };
1752
+ const serializeAws_restJson1CreateComponentData = (input, context) => {
1753
+ return {
1754
+ ...(input.bindingProperties !== undefined &&
1755
+ input.bindingProperties !== null && {
1756
+ bindingProperties: serializeAws_restJson1ComponentBindingProperties(input.bindingProperties, context),
1757
+ }),
1758
+ ...(input.children !== undefined &&
1759
+ input.children !== null && { children: serializeAws_restJson1ComponentChildList(input.children, context) }),
1760
+ ...(input.collectionProperties !== undefined &&
1761
+ input.collectionProperties !== null && {
1762
+ collectionProperties: serializeAws_restJson1ComponentCollectionProperties(input.collectionProperties, context),
1763
+ }),
1764
+ ...(input.componentType !== undefined && input.componentType !== null && { componentType: input.componentType }),
1765
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1766
+ ...(input.overrides !== undefined &&
1767
+ input.overrides !== null && { overrides: serializeAws_restJson1ComponentOverrides(input.overrides, context) }),
1768
+ ...(input.properties !== undefined &&
1769
+ input.properties !== null && {
1770
+ properties: serializeAws_restJson1ComponentProperties(input.properties, context),
1771
+ }),
1772
+ ...(input.sourceId !== undefined && input.sourceId !== null && { sourceId: input.sourceId }),
1773
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
1774
+ ...(input.variants !== undefined &&
1775
+ input.variants !== null && { variants: serializeAws_restJson1ComponentVariants(input.variants, context) }),
1776
+ };
1777
+ };
1778
+ const serializeAws_restJson1CreateThemeData = (input, context) => {
1779
+ return {
1780
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1781
+ ...(input.overrides !== undefined &&
1782
+ input.overrides !== null && { overrides: serializeAws_restJson1ThemeValuesList(input.overrides, context) }),
1783
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
1784
+ ...(input.values !== undefined &&
1785
+ input.values !== null && { values: serializeAws_restJson1ThemeValuesList(input.values, context) }),
1786
+ };
1787
+ };
1788
+ const serializeAws_restJson1ExchangeCodeForTokenRequestBody = (input, context) => {
1789
+ return {
1790
+ ...(input.code !== undefined && input.code !== null && { code: input.code }),
1791
+ ...(input.redirectUri !== undefined && input.redirectUri !== null && { redirectUri: input.redirectUri }),
1792
+ };
1793
+ };
1794
+ const serializeAws_restJson1FormBindingElement = (input, context) => {
1795
+ return {
1796
+ ...(input.element !== undefined && input.element !== null && { element: input.element }),
1797
+ ...(input.property !== undefined && input.property !== null && { property: input.property }),
1798
+ };
1799
+ };
1800
+ const serializeAws_restJson1FormBindings = (input, context) => {
1801
+ return Object.entries(input).reduce((acc, [key, value]) => {
1802
+ if (value === null) {
1803
+ return acc;
1804
+ }
1805
+ return {
1806
+ ...acc,
1807
+ [key]: serializeAws_restJson1FormBindingElement(value, context),
1808
+ };
1809
+ }, {});
1810
+ };
1811
+ const serializeAws_restJson1IdentifierList = (input, context) => {
1812
+ return input
1813
+ .filter((e) => e != null)
1814
+ .map((entry) => {
1815
+ if (entry === null) {
1816
+ return null;
1817
+ }
1818
+ return entry;
1819
+ });
1820
+ };
1821
+ const serializeAws_restJson1Predicate = (input, context) => {
1822
+ return {
1823
+ ...(input.and !== undefined &&
1824
+ input.and !== null && { and: serializeAws_restJson1PredicateList(input.and, context) }),
1825
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
1826
+ ...(input.operand !== undefined && input.operand !== null && { operand: input.operand }),
1827
+ ...(input.operator !== undefined && input.operator !== null && { operator: input.operator }),
1828
+ ...(input.or !== undefined && input.or !== null && { or: serializeAws_restJson1PredicateList(input.or, context) }),
1829
+ };
1830
+ };
1831
+ const serializeAws_restJson1PredicateList = (input, context) => {
1832
+ return input
1833
+ .filter((e) => e != null)
1834
+ .map((entry) => {
1835
+ if (entry === null) {
1836
+ return null;
1837
+ }
1838
+ return serializeAws_restJson1Predicate(entry, context);
1839
+ });
1840
+ };
1841
+ const serializeAws_restJson1RefreshTokenRequestBody = (input, context) => {
1842
+ return {
1843
+ ...(input.token !== undefined && input.token !== null && { token: input.token }),
1844
+ };
1845
+ };
1846
+ const serializeAws_restJson1SortProperty = (input, context) => {
1847
+ return {
1848
+ ...(input.direction !== undefined && input.direction !== null && { direction: input.direction }),
1849
+ ...(input.field !== undefined && input.field !== null && { field: input.field }),
1850
+ };
1851
+ };
1852
+ const serializeAws_restJson1SortPropertyList = (input, context) => {
1853
+ return input
1854
+ .filter((e) => e != null)
1855
+ .map((entry) => {
1856
+ if (entry === null) {
1857
+ return null;
1858
+ }
1859
+ return serializeAws_restJson1SortProperty(entry, context);
1860
+ });
1861
+ };
1862
+ const serializeAws_restJson1Tags = (input, context) => {
1863
+ return Object.entries(input).reduce((acc, [key, value]) => {
1864
+ if (value === null) {
1865
+ return acc;
1866
+ }
1867
+ return {
1868
+ ...acc,
1869
+ [key]: value,
1870
+ };
1871
+ }, {});
1872
+ };
1873
+ const serializeAws_restJson1ThemeValue = (input, context) => {
1874
+ return {
1875
+ ...(input.children !== undefined &&
1876
+ input.children !== null && { children: serializeAws_restJson1ThemeValuesList(input.children, context) }),
1877
+ ...(input.value !== undefined && input.value !== null && { value: input.value }),
1878
+ };
1879
+ };
1880
+ const serializeAws_restJson1ThemeValues = (input, context) => {
1881
+ return {
1882
+ ...(input.key !== undefined && input.key !== null && { key: input.key }),
1883
+ ...(input.value !== undefined &&
1884
+ input.value !== null && { value: serializeAws_restJson1ThemeValue(input.value, context) }),
1885
+ };
1886
+ };
1887
+ const serializeAws_restJson1ThemeValuesList = (input, context) => {
1888
+ return input
1889
+ .filter((e) => e != null)
1890
+ .map((entry) => {
1891
+ if (entry === null) {
1892
+ return null;
1893
+ }
1894
+ return serializeAws_restJson1ThemeValues(entry, context);
1895
+ });
1896
+ };
1897
+ const serializeAws_restJson1UpdateComponentData = (input, context) => {
1898
+ return {
1899
+ ...(input.bindingProperties !== undefined &&
1900
+ input.bindingProperties !== null && {
1901
+ bindingProperties: serializeAws_restJson1ComponentBindingProperties(input.bindingProperties, context),
1902
+ }),
1903
+ ...(input.children !== undefined &&
1904
+ input.children !== null && { children: serializeAws_restJson1ComponentChildList(input.children, context) }),
1905
+ ...(input.collectionProperties !== undefined &&
1906
+ input.collectionProperties !== null && {
1907
+ collectionProperties: serializeAws_restJson1ComponentCollectionProperties(input.collectionProperties, context),
1908
+ }),
1909
+ ...(input.componentType !== undefined && input.componentType !== null && { componentType: input.componentType }),
1910
+ ...(input.id !== undefined && input.id !== null && { id: input.id }),
1911
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1912
+ ...(input.overrides !== undefined &&
1913
+ input.overrides !== null && { overrides: serializeAws_restJson1ComponentOverrides(input.overrides, context) }),
1914
+ ...(input.properties !== undefined &&
1915
+ input.properties !== null && {
1916
+ properties: serializeAws_restJson1ComponentProperties(input.properties, context),
1917
+ }),
1918
+ ...(input.sourceId !== undefined && input.sourceId !== null && { sourceId: input.sourceId }),
1919
+ ...(input.variants !== undefined &&
1920
+ input.variants !== null && { variants: serializeAws_restJson1ComponentVariants(input.variants, context) }),
1921
+ };
1922
+ };
1923
+ const serializeAws_restJson1UpdateThemeData = (input, context) => {
1924
+ return {
1925
+ ...(input.id !== undefined && input.id !== null && { id: input.id }),
1926
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1927
+ ...(input.overrides !== undefined &&
1928
+ input.overrides !== null && { overrides: serializeAws_restJson1ThemeValuesList(input.overrides, context) }),
1929
+ ...(input.values !== undefined &&
1930
+ input.values !== null && { values: serializeAws_restJson1ThemeValuesList(input.values, context) }),
1931
+ };
1932
+ };
1933
+ const deserializeAws_restJson1Component = (output, context) => {
1934
+ return {
1935
+ appId: smithy_client_1.expectString(output.appId),
1936
+ bindingProperties: output.bindingProperties !== undefined && output.bindingProperties !== null
1937
+ ? deserializeAws_restJson1ComponentBindingProperties(output.bindingProperties, context)
1938
+ : undefined,
1939
+ children: output.children !== undefined && output.children !== null
1940
+ ? deserializeAws_restJson1ComponentChildList(output.children, context)
1941
+ : undefined,
1942
+ collectionProperties: output.collectionProperties !== undefined && output.collectionProperties !== null
1943
+ ? deserializeAws_restJson1ComponentCollectionProperties(output.collectionProperties, context)
1944
+ : undefined,
1945
+ componentType: smithy_client_1.expectString(output.componentType),
1946
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
1947
+ ? smithy_client_1.expectNonNull(smithy_client_1.parseRfc3339DateTime(output.createdAt))
1948
+ : undefined,
1949
+ environmentName: smithy_client_1.expectString(output.environmentName),
1950
+ id: smithy_client_1.expectString(output.id),
1951
+ modifiedAt: output.modifiedAt !== undefined && output.modifiedAt !== null
1952
+ ? smithy_client_1.expectNonNull(smithy_client_1.parseRfc3339DateTime(output.modifiedAt))
1953
+ : undefined,
1954
+ name: smithy_client_1.expectString(output.name),
1955
+ overrides: output.overrides !== undefined && output.overrides !== null
1956
+ ? deserializeAws_restJson1ComponentOverrides(output.overrides, context)
1957
+ : undefined,
1958
+ properties: output.properties !== undefined && output.properties !== null
1959
+ ? deserializeAws_restJson1ComponentProperties(output.properties, context)
1960
+ : undefined,
1961
+ sourceId: smithy_client_1.expectString(output.sourceId),
1962
+ tags: output.tags !== undefined && output.tags !== null
1963
+ ? deserializeAws_restJson1Tags(output.tags, context)
1964
+ : undefined,
1965
+ variants: output.variants !== undefined && output.variants !== null
1966
+ ? deserializeAws_restJson1ComponentVariants(output.variants, context)
1967
+ : undefined,
1968
+ };
1969
+ };
1970
+ const deserializeAws_restJson1ComponentBindingProperties = (output, context) => {
1971
+ return Object.entries(output).reduce((acc, [key, value]) => {
1972
+ if (value === null) {
1973
+ return acc;
1974
+ }
1975
+ return {
1976
+ ...acc,
1977
+ [key]: deserializeAws_restJson1ComponentBindingPropertiesValue(value, context),
1978
+ };
1979
+ }, {});
1980
+ };
1981
+ const deserializeAws_restJson1ComponentBindingPropertiesValue = (output, context) => {
1982
+ return {
1983
+ bindingProperties: output.bindingProperties !== undefined && output.bindingProperties !== null
1984
+ ? deserializeAws_restJson1ComponentBindingPropertiesValueProperties(output.bindingProperties, context)
1985
+ : undefined,
1986
+ defaultValue: smithy_client_1.expectString(output.defaultValue),
1987
+ type: smithy_client_1.expectString(output.type),
1988
+ };
1989
+ };
1990
+ const deserializeAws_restJson1ComponentBindingPropertiesValueProperties = (output, context) => {
1991
+ return {
1992
+ bucket: smithy_client_1.expectString(output.bucket),
1993
+ defaultValue: smithy_client_1.expectString(output.defaultValue),
1994
+ field: smithy_client_1.expectString(output.field),
1995
+ key: smithy_client_1.expectString(output.key),
1996
+ model: smithy_client_1.expectString(output.model),
1997
+ predicates: output.predicates !== undefined && output.predicates !== null
1998
+ ? deserializeAws_restJson1PredicateList(output.predicates, context)
1999
+ : undefined,
2000
+ userAttribute: smithy_client_1.expectString(output.userAttribute),
2001
+ };
2002
+ };
2003
+ const deserializeAws_restJson1ComponentChild = (output, context) => {
2004
+ return {
2005
+ children: output.children !== undefined && output.children !== null
2006
+ ? deserializeAws_restJson1ComponentChildList(output.children, context)
2007
+ : undefined,
2008
+ componentType: smithy_client_1.expectString(output.componentType),
2009
+ name: smithy_client_1.expectString(output.name),
2010
+ properties: output.properties !== undefined && output.properties !== null
2011
+ ? deserializeAws_restJson1ComponentProperties(output.properties, context)
2012
+ : undefined,
2013
+ };
2014
+ };
2015
+ const deserializeAws_restJson1ComponentChildList = (output, context) => {
2016
+ return (output || [])
2017
+ .filter((e) => e != null)
2018
+ .map((entry) => {
2019
+ if (entry === null) {
2020
+ return null;
2021
+ }
2022
+ return deserializeAws_restJson1ComponentChild(entry, context);
2023
+ });
2024
+ };
2025
+ const deserializeAws_restJson1ComponentCollectionProperties = (output, context) => {
2026
+ return Object.entries(output).reduce((acc, [key, value]) => {
2027
+ if (value === null) {
2028
+ return acc;
2029
+ }
2030
+ return {
2031
+ ...acc,
2032
+ [key]: deserializeAws_restJson1ComponentDataConfiguration(value, context),
2033
+ };
2034
+ }, {});
2035
+ };
2036
+ const deserializeAws_restJson1ComponentConditionProperty = (output, context) => {
2037
+ return {
2038
+ else: output.else !== undefined && output.else !== null
2039
+ ? deserializeAws_restJson1ComponentProperty(output.else, context)
2040
+ : undefined,
2041
+ field: smithy_client_1.expectString(output.field),
2042
+ operand: smithy_client_1.expectString(output.operand),
2043
+ operator: smithy_client_1.expectString(output.operator),
2044
+ property: smithy_client_1.expectString(output.property),
2045
+ then: output.then !== undefined && output.then !== null
2046
+ ? deserializeAws_restJson1ComponentProperty(output.then, context)
2047
+ : undefined,
2048
+ };
2049
+ };
2050
+ const deserializeAws_restJson1ComponentDataConfiguration = (output, context) => {
2051
+ return {
2052
+ identifiers: output.identifiers !== undefined && output.identifiers !== null
2053
+ ? deserializeAws_restJson1IdentifierList(output.identifiers, context)
2054
+ : undefined,
2055
+ model: smithy_client_1.expectString(output.model),
2056
+ predicate: output.predicate !== undefined && output.predicate !== null
2057
+ ? deserializeAws_restJson1Predicate(output.predicate, context)
2058
+ : undefined,
2059
+ sort: output.sort !== undefined && output.sort !== null
2060
+ ? deserializeAws_restJson1SortPropertyList(output.sort, context)
2061
+ : undefined,
2062
+ };
2063
+ };
2064
+ const deserializeAws_restJson1ComponentList = (output, context) => {
2065
+ return (output || [])
2066
+ .filter((e) => e != null)
2067
+ .map((entry) => {
2068
+ if (entry === null) {
2069
+ return null;
2070
+ }
2071
+ return deserializeAws_restJson1Component(entry, context);
2072
+ });
2073
+ };
2074
+ const deserializeAws_restJson1ComponentOverrides = (output, context) => {
2075
+ return Object.entries(output).reduce((acc, [key, value]) => {
2076
+ if (value === null) {
2077
+ return acc;
2078
+ }
2079
+ return {
2080
+ ...acc,
2081
+ [key]: deserializeAws_restJson1ComponentOverridesValue(value, context),
2082
+ };
2083
+ }, {});
2084
+ };
2085
+ const deserializeAws_restJson1ComponentOverridesValue = (output, context) => {
2086
+ return Object.entries(output).reduce((acc, [key, value]) => {
2087
+ if (value === null) {
2088
+ return acc;
2089
+ }
2090
+ return {
2091
+ ...acc,
2092
+ [key]: smithy_client_1.expectString(value),
2093
+ };
2094
+ }, {});
2095
+ };
2096
+ const deserializeAws_restJson1ComponentProperties = (output, context) => {
2097
+ return Object.entries(output).reduce((acc, [key, value]) => {
2098
+ if (value === null) {
2099
+ return acc;
2100
+ }
2101
+ return {
2102
+ ...acc,
2103
+ [key]: deserializeAws_restJson1ComponentProperty(value, context),
2104
+ };
2105
+ }, {});
2106
+ };
2107
+ const deserializeAws_restJson1ComponentProperty = (output, context) => {
2108
+ return {
2109
+ bindingProperties: output.bindingProperties !== undefined && output.bindingProperties !== null
2110
+ ? deserializeAws_restJson1ComponentPropertyBindingProperties(output.bindingProperties, context)
2111
+ : undefined,
2112
+ bindings: output.bindings !== undefined && output.bindings !== null
2113
+ ? deserializeAws_restJson1FormBindings(output.bindings, context)
2114
+ : undefined,
2115
+ collectionBindingProperties: output.collectionBindingProperties !== undefined && output.collectionBindingProperties !== null
2116
+ ? deserializeAws_restJson1ComponentPropertyBindingProperties(output.collectionBindingProperties, context)
2117
+ : undefined,
2118
+ concat: output.concat !== undefined && output.concat !== null
2119
+ ? deserializeAws_restJson1ComponentPropertyList(output.concat, context)
2120
+ : undefined,
2121
+ condition: output.condition !== undefined && output.condition !== null
2122
+ ? deserializeAws_restJson1ComponentConditionProperty(output.condition, context)
2123
+ : undefined,
2124
+ configured: smithy_client_1.expectBoolean(output.configured),
2125
+ defaultValue: smithy_client_1.expectString(output.defaultValue),
2126
+ event: smithy_client_1.expectString(output.event),
2127
+ importedValue: smithy_client_1.expectString(output.importedValue),
2128
+ model: smithy_client_1.expectString(output.model),
2129
+ type: smithy_client_1.expectString(output.type),
2130
+ userAttribute: smithy_client_1.expectString(output.userAttribute),
2131
+ value: smithy_client_1.expectString(output.value),
2132
+ };
2133
+ };
2134
+ const deserializeAws_restJson1ComponentPropertyBindingProperties = (output, context) => {
2135
+ return {
2136
+ field: smithy_client_1.expectString(output.field),
2137
+ property: smithy_client_1.expectString(output.property),
2138
+ };
2139
+ };
2140
+ const deserializeAws_restJson1ComponentPropertyList = (output, context) => {
2141
+ return (output || [])
2142
+ .filter((e) => e != null)
2143
+ .map((entry) => {
2144
+ if (entry === null) {
2145
+ return null;
2146
+ }
2147
+ return deserializeAws_restJson1ComponentProperty(entry, context);
2148
+ });
2149
+ };
2150
+ const deserializeAws_restJson1ComponentSummary = (output, context) => {
2151
+ return {
2152
+ appId: smithy_client_1.expectString(output.appId),
2153
+ componentType: smithy_client_1.expectString(output.componentType),
2154
+ environmentName: smithy_client_1.expectString(output.environmentName),
2155
+ id: smithy_client_1.expectString(output.id),
2156
+ name: smithy_client_1.expectString(output.name),
2157
+ };
2158
+ };
2159
+ const deserializeAws_restJson1ComponentSummaryList = (output, context) => {
2160
+ return (output || [])
2161
+ .filter((e) => e != null)
2162
+ .map((entry) => {
2163
+ if (entry === null) {
2164
+ return null;
2165
+ }
2166
+ return deserializeAws_restJson1ComponentSummary(entry, context);
2167
+ });
2168
+ };
2169
+ const deserializeAws_restJson1ComponentVariant = (output, context) => {
2170
+ return {
2171
+ overrides: output.overrides !== undefined && output.overrides !== null
2172
+ ? deserializeAws_restJson1ComponentOverrides(output.overrides, context)
2173
+ : undefined,
2174
+ variantValues: output.variantValues !== undefined && output.variantValues !== null
2175
+ ? deserializeAws_restJson1ComponentVariantValues(output.variantValues, context)
2176
+ : undefined,
2177
+ };
2178
+ };
2179
+ const deserializeAws_restJson1ComponentVariants = (output, context) => {
2180
+ return (output || [])
2181
+ .filter((e) => e != null)
2182
+ .map((entry) => {
2183
+ if (entry === null) {
2184
+ return null;
2185
+ }
2186
+ return deserializeAws_restJson1ComponentVariant(entry, context);
2187
+ });
2188
+ };
2189
+ const deserializeAws_restJson1ComponentVariantValues = (output, context) => {
2190
+ return Object.entries(output).reduce((acc, [key, value]) => {
2191
+ if (value === null) {
2192
+ return acc;
2193
+ }
2194
+ return {
2195
+ ...acc,
2196
+ [key]: smithy_client_1.expectString(value),
2197
+ };
2198
+ }, {});
2199
+ };
2200
+ const deserializeAws_restJson1FormBindingElement = (output, context) => {
2201
+ return {
2202
+ element: smithy_client_1.expectString(output.element),
2203
+ property: smithy_client_1.expectString(output.property),
2204
+ };
2205
+ };
2206
+ const deserializeAws_restJson1FormBindings = (output, context) => {
2207
+ return Object.entries(output).reduce((acc, [key, value]) => {
2208
+ if (value === null) {
2209
+ return acc;
2210
+ }
2211
+ return {
2212
+ ...acc,
2213
+ [key]: deserializeAws_restJson1FormBindingElement(value, context),
2214
+ };
2215
+ }, {});
2216
+ };
2217
+ const deserializeAws_restJson1IdentifierList = (output, context) => {
2218
+ return (output || [])
2219
+ .filter((e) => e != null)
2220
+ .map((entry) => {
2221
+ if (entry === null) {
2222
+ return null;
2223
+ }
2224
+ return smithy_client_1.expectString(entry);
2225
+ });
2226
+ };
2227
+ const deserializeAws_restJson1Predicate = (output, context) => {
2228
+ return {
2229
+ and: output.and !== undefined && output.and !== null
2230
+ ? deserializeAws_restJson1PredicateList(output.and, context)
2231
+ : undefined,
2232
+ field: smithy_client_1.expectString(output.field),
2233
+ operand: smithy_client_1.expectString(output.operand),
2234
+ operator: smithy_client_1.expectString(output.operator),
2235
+ or: output.or !== undefined && output.or !== null
2236
+ ? deserializeAws_restJson1PredicateList(output.or, context)
2237
+ : undefined,
2238
+ };
2239
+ };
2240
+ const deserializeAws_restJson1PredicateList = (output, context) => {
2241
+ return (output || [])
2242
+ .filter((e) => e != null)
2243
+ .map((entry) => {
2244
+ if (entry === null) {
2245
+ return null;
2246
+ }
2247
+ return deserializeAws_restJson1Predicate(entry, context);
2248
+ });
2249
+ };
2250
+ const deserializeAws_restJson1SortProperty = (output, context) => {
2251
+ return {
2252
+ direction: smithy_client_1.expectString(output.direction),
2253
+ field: smithy_client_1.expectString(output.field),
2254
+ };
2255
+ };
2256
+ const deserializeAws_restJson1SortPropertyList = (output, context) => {
2257
+ return (output || [])
2258
+ .filter((e) => e != null)
2259
+ .map((entry) => {
2260
+ if (entry === null) {
2261
+ return null;
2262
+ }
2263
+ return deserializeAws_restJson1SortProperty(entry, context);
2264
+ });
2265
+ };
2266
+ const deserializeAws_restJson1Tags = (output, context) => {
2267
+ return Object.entries(output).reduce((acc, [key, value]) => {
2268
+ if (value === null) {
2269
+ return acc;
2270
+ }
2271
+ return {
2272
+ ...acc,
2273
+ [key]: smithy_client_1.expectString(value),
2274
+ };
2275
+ }, {});
2276
+ };
2277
+ const deserializeAws_restJson1Theme = (output, context) => {
2278
+ return {
2279
+ appId: smithy_client_1.expectString(output.appId),
2280
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
2281
+ ? smithy_client_1.expectNonNull(smithy_client_1.parseRfc3339DateTime(output.createdAt))
2282
+ : undefined,
2283
+ environmentName: smithy_client_1.expectString(output.environmentName),
2284
+ id: smithy_client_1.expectString(output.id),
2285
+ modifiedAt: output.modifiedAt !== undefined && output.modifiedAt !== null
2286
+ ? smithy_client_1.expectNonNull(smithy_client_1.parseRfc3339DateTime(output.modifiedAt))
2287
+ : undefined,
2288
+ name: smithy_client_1.expectString(output.name),
2289
+ overrides: output.overrides !== undefined && output.overrides !== null
2290
+ ? deserializeAws_restJson1ThemeValuesList(output.overrides, context)
2291
+ : undefined,
2292
+ tags: output.tags !== undefined && output.tags !== null
2293
+ ? deserializeAws_restJson1Tags(output.tags, context)
2294
+ : undefined,
2295
+ values: output.values !== undefined && output.values !== null
2296
+ ? deserializeAws_restJson1ThemeValuesList(output.values, context)
2297
+ : undefined,
2298
+ };
2299
+ };
2300
+ const deserializeAws_restJson1ThemeList = (output, context) => {
2301
+ return (output || [])
2302
+ .filter((e) => e != null)
2303
+ .map((entry) => {
2304
+ if (entry === null) {
2305
+ return null;
2306
+ }
2307
+ return deserializeAws_restJson1Theme(entry, context);
2308
+ });
2309
+ };
2310
+ const deserializeAws_restJson1ThemeSummary = (output, context) => {
2311
+ return {
2312
+ appId: smithy_client_1.expectString(output.appId),
2313
+ environmentName: smithy_client_1.expectString(output.environmentName),
2314
+ id: smithy_client_1.expectString(output.id),
2315
+ name: smithy_client_1.expectString(output.name),
2316
+ };
2317
+ };
2318
+ const deserializeAws_restJson1ThemeSummaryList = (output, context) => {
2319
+ return (output || [])
2320
+ .filter((e) => e != null)
2321
+ .map((entry) => {
2322
+ if (entry === null) {
2323
+ return null;
2324
+ }
2325
+ return deserializeAws_restJson1ThemeSummary(entry, context);
2326
+ });
2327
+ };
2328
+ const deserializeAws_restJson1ThemeValue = (output, context) => {
2329
+ return {
2330
+ children: output.children !== undefined && output.children !== null
2331
+ ? deserializeAws_restJson1ThemeValuesList(output.children, context)
2332
+ : undefined,
2333
+ value: smithy_client_1.expectString(output.value),
2334
+ };
2335
+ };
2336
+ const deserializeAws_restJson1ThemeValues = (output, context) => {
2337
+ return {
2338
+ key: smithy_client_1.expectString(output.key),
2339
+ value: output.value !== undefined && output.value !== null
2340
+ ? deserializeAws_restJson1ThemeValue(output.value, context)
2341
+ : undefined,
2342
+ };
2343
+ };
2344
+ const deserializeAws_restJson1ThemeValuesList = (output, context) => {
2345
+ return (output || [])
2346
+ .filter((e) => e != null)
2347
+ .map((entry) => {
2348
+ if (entry === null) {
2349
+ return null;
2350
+ }
2351
+ return deserializeAws_restJson1ThemeValues(entry, context);
2352
+ });
2353
+ };
2354
+ const deserializeMetadata = (output) => {
2355
+ var _a;
2356
+ return ({
2357
+ httpStatusCode: output.statusCode,
2358
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
2359
+ extendedRequestId: output.headers["x-amz-id-2"],
2360
+ cfId: output.headers["x-amz-cf-id"],
2361
+ });
2362
+ };
2363
+ const collectBody = (streamBody = new Uint8Array(), context) => {
2364
+ if (streamBody instanceof Uint8Array) {
2365
+ return Promise.resolve(streamBody);
2366
+ }
2367
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2368
+ };
2369
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
2370
+ const isSerializableHeaderValue = (value) => value !== undefined &&
2371
+ value !== null &&
2372
+ value !== "" &&
2373
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
2374
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
2375
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
2376
+ if (encoded.length) {
2377
+ return JSON.parse(encoded);
2378
+ }
2379
+ return {};
2380
+ });
2381
+ const loadRestJsonErrorCode = (output, data) => {
2382
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
2383
+ const sanitizeErrorCode = (rawValue) => {
2384
+ let cleanValue = rawValue;
2385
+ if (cleanValue.indexOf(":") >= 0) {
2386
+ cleanValue = cleanValue.split(":")[0];
2387
+ }
2388
+ if (cleanValue.indexOf("#") >= 0) {
2389
+ cleanValue = cleanValue.split("#")[1];
2390
+ }
2391
+ return cleanValue;
2392
+ };
2393
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
2394
+ if (headerKey !== undefined) {
2395
+ return sanitizeErrorCode(output.headers[headerKey]);
2396
+ }
2397
+ if (data.code !== undefined) {
2398
+ return sanitizeErrorCode(data.code);
2399
+ }
2400
+ if (data["__type"] !== undefined) {
2401
+ return sanitizeErrorCode(data["__type"]);
2402
+ }
2403
+ return "";
2404
+ };