@wildix/wim-cache-client 1.0.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 (61) hide show
  1. package/dist-cjs/WimCache.js +23 -0
  2. package/dist-cjs/WimCacheClient.js +35 -0
  3. package/dist-cjs/commands/DeleteEntitiesFromGeneralCacheCommand.js +41 -0
  4. package/dist-cjs/commands/GetEntitiesByIdsCommand.js +41 -0
  5. package/dist-cjs/commands/PutEntitiesToGeneralCacheCommand.js +41 -0
  6. package/dist-cjs/commands/SearchEntitiesByListParamsCommand.js +41 -0
  7. package/dist-cjs/commands/SearchEntitiesByParamsCommand.js +41 -0
  8. package/dist-cjs/commands/SyncCacheCommand.js +41 -0
  9. package/dist-cjs/commands/index.js +9 -0
  10. package/dist-cjs/extensionConfiguration.js +2 -0
  11. package/dist-cjs/index.js +10 -0
  12. package/dist-cjs/models/WimCacheServiceException.js +12 -0
  13. package/dist-cjs/models/index.js +4 -0
  14. package/dist-cjs/models/models_0.js +17 -0
  15. package/dist-cjs/protocols/Aws_restJson1.js +403 -0
  16. package/dist-cjs/runtimeConfig.browser.js +28 -0
  17. package/dist-cjs/runtimeConfig.js +32 -0
  18. package/dist-cjs/runtimeConfig.native.js +15 -0
  19. package/dist-cjs/runtimeConfig.shared.js +19 -0
  20. package/dist-cjs/runtimeExtensions.js +19 -0
  21. package/dist-es/WimCache.js +19 -0
  22. package/dist-es/WimCacheClient.js +31 -0
  23. package/dist-es/commands/DeleteEntitiesFromGeneralCacheCommand.js +37 -0
  24. package/dist-es/commands/GetEntitiesByIdsCommand.js +37 -0
  25. package/dist-es/commands/PutEntitiesToGeneralCacheCommand.js +37 -0
  26. package/dist-es/commands/SearchEntitiesByListParamsCommand.js +37 -0
  27. package/dist-es/commands/SearchEntitiesByParamsCommand.js +37 -0
  28. package/dist-es/commands/SyncCacheCommand.js +37 -0
  29. package/dist-es/commands/index.js +6 -0
  30. package/dist-es/extensionConfiguration.js +1 -0
  31. package/dist-es/index.js +5 -0
  32. package/dist-es/models/WimCacheServiceException.js +8 -0
  33. package/dist-es/models/index.js +1 -0
  34. package/dist-es/models/models_0.js +13 -0
  35. package/dist-es/protocols/Aws_restJson1.js +388 -0
  36. package/dist-es/runtimeConfig.browser.js +24 -0
  37. package/dist-es/runtimeConfig.js +28 -0
  38. package/dist-es/runtimeConfig.native.js +11 -0
  39. package/dist-es/runtimeConfig.shared.js +15 -0
  40. package/dist-es/runtimeExtensions.js +15 -0
  41. package/dist-types/WimCache.d.ts +51 -0
  42. package/dist-types/WimCacheClient.d.ts +144 -0
  43. package/dist-types/commands/DeleteEntitiesFromGeneralCacheCommand.d.ts +73 -0
  44. package/dist-types/commands/GetEntitiesByIdsCommand.d.ts +112 -0
  45. package/dist-types/commands/PutEntitiesToGeneralCacheCommand.d.ts +86 -0
  46. package/dist-types/commands/SearchEntitiesByListParamsCommand.d.ts +121 -0
  47. package/dist-types/commands/SearchEntitiesByParamsCommand.d.ts +120 -0
  48. package/dist-types/commands/SyncCacheCommand.d.ts +73 -0
  49. package/dist-types/commands/index.d.ts +6 -0
  50. package/dist-types/extensionConfiguration.d.ts +7 -0
  51. package/dist-types/index.d.ts +5 -0
  52. package/dist-types/models/WimCacheServiceException.d.ts +13 -0
  53. package/dist-types/models/index.d.ts +1 -0
  54. package/dist-types/models/models_0.d.ts +230 -0
  55. package/dist-types/protocols/Aws_restJson1.d.ts +56 -0
  56. package/dist-types/runtimeConfig.browser.d.ts +27 -0
  57. package/dist-types/runtimeConfig.d.ts +27 -0
  58. package/dist-types/runtimeConfig.native.d.ts +26 -0
  59. package/dist-types/runtimeConfig.shared.d.ts +15 -0
  60. package/dist-types/runtimeExtensions.d.ts +17 -0
  61. package/package.json +77 -0
@@ -0,0 +1,37 @@
1
+ import { de_PutEntitiesToGeneralCacheCommand, se_PutEntitiesToGeneralCacheCommand, } from "../protocols/Aws_restJson1";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
5
+ export { $Command };
6
+ export class PutEntitiesToGeneralCacheCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
10
+ }
11
+ resolveMiddleware(clientStack, configuration, options) {
12
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
+ const stack = clientStack.concat(this.middlewareStack);
14
+ const { logger } = configuration;
15
+ const clientName = "WimCacheClient";
16
+ const commandName = "PutEntitiesToGeneralCacheCommand";
17
+ const handlerExecutionContext = {
18
+ logger,
19
+ clientName,
20
+ commandName,
21
+ inputFilterSensitiveLog: (_) => _,
22
+ outputFilterSensitiveLog: (_) => _,
23
+ [SMITHY_CONTEXT_KEY]: {
24
+ service: "WimCache",
25
+ operation: "PutEntitiesToGeneralCache",
26
+ },
27
+ };
28
+ const { requestHandler } = configuration;
29
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
30
+ }
31
+ serialize(input, context) {
32
+ return se_PutEntitiesToGeneralCacheCommand(input, context);
33
+ }
34
+ deserialize(output, context) {
35
+ return de_PutEntitiesToGeneralCacheCommand(output, context);
36
+ }
37
+ }
@@ -0,0 +1,37 @@
1
+ import { de_SearchEntitiesByListParamsCommand, se_SearchEntitiesByListParamsCommand, } from "../protocols/Aws_restJson1";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
5
+ export { $Command };
6
+ export class SearchEntitiesByListParamsCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
10
+ }
11
+ resolveMiddleware(clientStack, configuration, options) {
12
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
+ const stack = clientStack.concat(this.middlewareStack);
14
+ const { logger } = configuration;
15
+ const clientName = "WimCacheClient";
16
+ const commandName = "SearchEntitiesByListParamsCommand";
17
+ const handlerExecutionContext = {
18
+ logger,
19
+ clientName,
20
+ commandName,
21
+ inputFilterSensitiveLog: (_) => _,
22
+ outputFilterSensitiveLog: (_) => _,
23
+ [SMITHY_CONTEXT_KEY]: {
24
+ service: "WimCache",
25
+ operation: "SearchEntitiesByListParams",
26
+ },
27
+ };
28
+ const { requestHandler } = configuration;
29
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
30
+ }
31
+ serialize(input, context) {
32
+ return se_SearchEntitiesByListParamsCommand(input, context);
33
+ }
34
+ deserialize(output, context) {
35
+ return de_SearchEntitiesByListParamsCommand(output, context);
36
+ }
37
+ }
@@ -0,0 +1,37 @@
1
+ import { de_SearchEntitiesByParamsCommand, se_SearchEntitiesByParamsCommand, } from "../protocols/Aws_restJson1";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
5
+ export { $Command };
6
+ export class SearchEntitiesByParamsCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
10
+ }
11
+ resolveMiddleware(clientStack, configuration, options) {
12
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
+ const stack = clientStack.concat(this.middlewareStack);
14
+ const { logger } = configuration;
15
+ const clientName = "WimCacheClient";
16
+ const commandName = "SearchEntitiesByParamsCommand";
17
+ const handlerExecutionContext = {
18
+ logger,
19
+ clientName,
20
+ commandName,
21
+ inputFilterSensitiveLog: (_) => _,
22
+ outputFilterSensitiveLog: (_) => _,
23
+ [SMITHY_CONTEXT_KEY]: {
24
+ service: "WimCache",
25
+ operation: "SearchEntitiesByParams",
26
+ },
27
+ };
28
+ const { requestHandler } = configuration;
29
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
30
+ }
31
+ serialize(input, context) {
32
+ return se_SearchEntitiesByParamsCommand(input, context);
33
+ }
34
+ deserialize(output, context) {
35
+ return de_SearchEntitiesByParamsCommand(output, context);
36
+ }
37
+ }
@@ -0,0 +1,37 @@
1
+ import { de_SyncCacheCommand, se_SyncCacheCommand, } from "../protocols/Aws_restJson1";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
5
+ export { $Command };
6
+ export class SyncCacheCommand extends $Command {
7
+ constructor(input) {
8
+ super();
9
+ this.input = input;
10
+ }
11
+ resolveMiddleware(clientStack, configuration, options) {
12
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
13
+ const stack = clientStack.concat(this.middlewareStack);
14
+ const { logger } = configuration;
15
+ const clientName = "WimCacheClient";
16
+ const commandName = "SyncCacheCommand";
17
+ const handlerExecutionContext = {
18
+ logger,
19
+ clientName,
20
+ commandName,
21
+ inputFilterSensitiveLog: (_) => _,
22
+ outputFilterSensitiveLog: (_) => _,
23
+ [SMITHY_CONTEXT_KEY]: {
24
+ service: "WimCache",
25
+ operation: "SyncCache",
26
+ },
27
+ };
28
+ const { requestHandler } = configuration;
29
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
30
+ }
31
+ serialize(input, context) {
32
+ return se_SyncCacheCommand(input, context);
33
+ }
34
+ deserialize(output, context) {
35
+ return de_SyncCacheCommand(output, context);
36
+ }
37
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./DeleteEntitiesFromGeneralCacheCommand";
2
+ export * from "./GetEntitiesByIdsCommand";
3
+ export * from "./PutEntitiesToGeneralCacheCommand";
4
+ export * from "./SearchEntitiesByListParamsCommand";
5
+ export * from "./SearchEntitiesByParamsCommand";
6
+ export * from "./SyncCacheCommand";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from "./WimCacheClient";
2
+ export * from "./WimCache";
3
+ export * from "./commands";
4
+ export * from "./models";
5
+ export { WimCacheServiceException } from "./models/WimCacheServiceException";
@@ -0,0 +1,8 @@
1
+ import { ServiceException as __ServiceException, } from "@smithy/smithy-client";
2
+ export { __ServiceException };
3
+ export class WimCacheServiceException extends __ServiceException {
4
+ constructor(options) {
5
+ super(options);
6
+ Object.setPrototypeOf(this, WimCacheServiceException.prototype);
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export * from "./models_0";
@@ -0,0 +1,13 @@
1
+ import { WimCacheServiceException as __BaseException } from "./WimCacheServiceException";
2
+ export class ValidationException extends __BaseException {
3
+ constructor(opts) {
4
+ super({
5
+ name: "ValidationException",
6
+ $fault: "client",
7
+ ...opts
8
+ });
9
+ this.name = "ValidationException";
10
+ this.$fault = "client";
11
+ Object.setPrototypeOf(this, ValidationException.prototype);
12
+ }
13
+ }
@@ -0,0 +1,388 @@
1
+ import { WimCacheServiceException as __BaseException } from "../models/WimCacheServiceException";
2
+ import { ValidationException, } from "../models/models_0";
3
+ import { HttpRequest as __HttpRequest, } from "@smithy/protocol-http";
4
+ import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
5
+ export const se_DeleteEntitiesFromGeneralCacheCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {};
8
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/general";
9
+ const query = map({
10
+ "email": [, input.email],
11
+ "phone": [, input.phone],
12
+ "clean": [() => input.clean !== void 0, () => (input.clean.toString())],
13
+ });
14
+ let body;
15
+ return new __HttpRequest({
16
+ protocol,
17
+ hostname,
18
+ port,
19
+ method: "DELETE",
20
+ headers,
21
+ path: resolvedPath,
22
+ query,
23
+ body,
24
+ });
25
+ };
26
+ export const se_GetEntitiesByIdsCommand = async (input, context) => {
27
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
28
+ const headers = {
29
+ 'content-type': 'application/json',
30
+ };
31
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/object";
32
+ let body;
33
+ body = JSON.stringify(take(input, {
34
+ 'entityIds': _ => _json(_),
35
+ 'organizationId': [],
36
+ }));
37
+ return new __HttpRequest({
38
+ protocol,
39
+ hostname,
40
+ port,
41
+ method: "POST",
42
+ headers,
43
+ path: resolvedPath,
44
+ body,
45
+ });
46
+ };
47
+ export const se_PutEntitiesToGeneralCacheCommand = async (input, context) => {
48
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
49
+ const headers = {
50
+ 'content-type': 'application/json',
51
+ };
52
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/general";
53
+ let body;
54
+ body = JSON.stringify(take(input, {
55
+ 'items': _ => _json(_),
56
+ }));
57
+ return new __HttpRequest({
58
+ protocol,
59
+ hostname,
60
+ port,
61
+ method: "PUT",
62
+ headers,
63
+ path: resolvedPath,
64
+ body,
65
+ });
66
+ };
67
+ export const se_SearchEntitiesByListParamsCommand = async (input, context) => {
68
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
69
+ const headers = {
70
+ 'content-type': 'application/json',
71
+ };
72
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/search";
73
+ let body;
74
+ body = JSON.stringify(take(input, {
75
+ 'organizationId': [],
76
+ 'params': _ => _json(_),
77
+ }));
78
+ return new __HttpRequest({
79
+ protocol,
80
+ hostname,
81
+ port,
82
+ method: "POST",
83
+ headers,
84
+ path: resolvedPath,
85
+ body,
86
+ });
87
+ };
88
+ export const se_SearchEntitiesByParamsCommand = async (input, context) => {
89
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
90
+ const headers = {};
91
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/search";
92
+ const query = map({
93
+ "organizationId": [, input.organizationId],
94
+ "phone": [, input.phone],
95
+ "email": [, input.email],
96
+ "query": [, input.query],
97
+ "from": [() => input.from !== void 0, () => (input.from.toString())],
98
+ "size": [() => input.size !== void 0, () => (input.size.toString())],
99
+ });
100
+ let body;
101
+ return new __HttpRequest({
102
+ protocol,
103
+ hostname,
104
+ port,
105
+ method: "GET",
106
+ headers,
107
+ path: resolvedPath,
108
+ query,
109
+ body,
110
+ });
111
+ };
112
+ export const se_SyncCacheCommand = async (input, context) => {
113
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
114
+ const headers = {
115
+ 'content-type': 'application/json',
116
+ };
117
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v1/cache/sync";
118
+ let body;
119
+ body = JSON.stringify(take(input, {
120
+ 'organizationId': [],
121
+ }));
122
+ return new __HttpRequest({
123
+ protocol,
124
+ hostname,
125
+ port,
126
+ method: "POST",
127
+ headers,
128
+ path: resolvedPath,
129
+ body,
130
+ });
131
+ };
132
+ export const de_DeleteEntitiesFromGeneralCacheCommand = async (output, context) => {
133
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
134
+ return de_DeleteEntitiesFromGeneralCacheCommandError(output, context);
135
+ }
136
+ const contents = map({
137
+ $metadata: deserializeMetadata(output),
138
+ });
139
+ await collectBody(output.body, context);
140
+ return contents;
141
+ };
142
+ const de_DeleteEntitiesFromGeneralCacheCommandError = async (output, context) => {
143
+ const parsedOutput = {
144
+ ...output,
145
+ body: await parseErrorBody(output.body, context)
146
+ };
147
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
148
+ switch (errorCode) {
149
+ case "ValidationException":
150
+ case "smithy.framework#ValidationException":
151
+ throw await de_ValidationExceptionRes(parsedOutput, context);
152
+ default:
153
+ const parsedBody = parsedOutput.body;
154
+ return throwDefaultError({
155
+ output,
156
+ parsedBody,
157
+ errorCode
158
+ });
159
+ }
160
+ };
161
+ export const de_GetEntitiesByIdsCommand = async (output, context) => {
162
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
163
+ return de_GetEntitiesByIdsCommandError(output, context);
164
+ }
165
+ const contents = map({
166
+ $metadata: deserializeMetadata(output),
167
+ });
168
+ const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
169
+ const doc = take(data, {
170
+ 'items': _json,
171
+ });
172
+ Object.assign(contents, doc);
173
+ return contents;
174
+ };
175
+ const de_GetEntitiesByIdsCommandError = async (output, context) => {
176
+ const parsedOutput = {
177
+ ...output,
178
+ body: await parseErrorBody(output.body, context)
179
+ };
180
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
181
+ switch (errorCode) {
182
+ case "ValidationException":
183
+ case "smithy.framework#ValidationException":
184
+ throw await de_ValidationExceptionRes(parsedOutput, context);
185
+ default:
186
+ const parsedBody = parsedOutput.body;
187
+ return throwDefaultError({
188
+ output,
189
+ parsedBody,
190
+ errorCode
191
+ });
192
+ }
193
+ };
194
+ export const de_PutEntitiesToGeneralCacheCommand = async (output, context) => {
195
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
196
+ return de_PutEntitiesToGeneralCacheCommandError(output, context);
197
+ }
198
+ const contents = map({
199
+ $metadata: deserializeMetadata(output),
200
+ });
201
+ await collectBody(output.body, context);
202
+ return contents;
203
+ };
204
+ const de_PutEntitiesToGeneralCacheCommandError = async (output, context) => {
205
+ const parsedOutput = {
206
+ ...output,
207
+ body: await parseErrorBody(output.body, context)
208
+ };
209
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
210
+ switch (errorCode) {
211
+ case "ValidationException":
212
+ case "smithy.framework#ValidationException":
213
+ throw await de_ValidationExceptionRes(parsedOutput, context);
214
+ default:
215
+ const parsedBody = parsedOutput.body;
216
+ return throwDefaultError({
217
+ output,
218
+ parsedBody,
219
+ errorCode
220
+ });
221
+ }
222
+ };
223
+ export const de_SearchEntitiesByListParamsCommand = async (output, context) => {
224
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
225
+ return de_SearchEntitiesByListParamsCommandError(output, context);
226
+ }
227
+ const contents = map({
228
+ $metadata: deserializeMetadata(output),
229
+ });
230
+ const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
231
+ const doc = take(data, {
232
+ 'items': _json,
233
+ });
234
+ Object.assign(contents, doc);
235
+ return contents;
236
+ };
237
+ const de_SearchEntitiesByListParamsCommandError = async (output, context) => {
238
+ const parsedOutput = {
239
+ ...output,
240
+ body: await parseErrorBody(output.body, context)
241
+ };
242
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
243
+ switch (errorCode) {
244
+ case "ValidationException":
245
+ case "smithy.framework#ValidationException":
246
+ throw await de_ValidationExceptionRes(parsedOutput, context);
247
+ default:
248
+ const parsedBody = parsedOutput.body;
249
+ return throwDefaultError({
250
+ output,
251
+ parsedBody,
252
+ errorCode
253
+ });
254
+ }
255
+ };
256
+ export const de_SearchEntitiesByParamsCommand = async (output, context) => {
257
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
258
+ return de_SearchEntitiesByParamsCommandError(output, context);
259
+ }
260
+ const contents = map({
261
+ $metadata: deserializeMetadata(output),
262
+ });
263
+ const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
264
+ const doc = take(data, {
265
+ 'items': _json,
266
+ });
267
+ Object.assign(contents, doc);
268
+ return contents;
269
+ };
270
+ const de_SearchEntitiesByParamsCommandError = async (output, context) => {
271
+ const parsedOutput = {
272
+ ...output,
273
+ body: await parseErrorBody(output.body, context)
274
+ };
275
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
276
+ switch (errorCode) {
277
+ case "ValidationException":
278
+ case "smithy.framework#ValidationException":
279
+ throw await de_ValidationExceptionRes(parsedOutput, context);
280
+ default:
281
+ const parsedBody = parsedOutput.body;
282
+ return throwDefaultError({
283
+ output,
284
+ parsedBody,
285
+ errorCode
286
+ });
287
+ }
288
+ };
289
+ export const de_SyncCacheCommand = async (output, context) => {
290
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
291
+ return de_SyncCacheCommandError(output, context);
292
+ }
293
+ const contents = map({
294
+ $metadata: deserializeMetadata(output),
295
+ });
296
+ const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
297
+ const doc = take(data, {
298
+ 'success': __expectBoolean,
299
+ });
300
+ Object.assign(contents, doc);
301
+ return contents;
302
+ };
303
+ const de_SyncCacheCommandError = async (output, context) => {
304
+ const parsedOutput = {
305
+ ...output,
306
+ body: await parseErrorBody(output.body, context)
307
+ };
308
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
309
+ switch (errorCode) {
310
+ case "ValidationException":
311
+ case "smithy.framework#ValidationException":
312
+ throw await de_ValidationExceptionRes(parsedOutput, context);
313
+ default:
314
+ const parsedBody = parsedOutput.body;
315
+ return throwDefaultError({
316
+ output,
317
+ parsedBody,
318
+ errorCode
319
+ });
320
+ }
321
+ };
322
+ const throwDefaultError = withBaseException(__BaseException);
323
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
324
+ const contents = map({});
325
+ const data = parsedOutput.body;
326
+ const doc = take(data, {
327
+ 'message': __expectString,
328
+ });
329
+ Object.assign(contents, doc);
330
+ const exception = new ValidationException({
331
+ $metadata: deserializeMetadata(parsedOutput),
332
+ ...contents
333
+ });
334
+ return __decorateServiceException(exception, parsedOutput.body);
335
+ };
336
+ const deserializeMetadata = (output) => ({
337
+ httpStatusCode: output.statusCode,
338
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
339
+ extendedRequestId: output.headers["x-amz-id-2"],
340
+ cfId: output.headers["x-amz-cf-id"],
341
+ });
342
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then(body => context.utf8Encoder(body));
343
+ const isSerializableHeaderValue = (value) => value !== undefined &&
344
+ value !== null &&
345
+ value !== "" &&
346
+ (!Object.getOwnPropertyNames(value).includes("length") ||
347
+ value.length != 0) &&
348
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
349
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
350
+ if (encoded.length) {
351
+ return JSON.parse(encoded);
352
+ }
353
+ return {};
354
+ });
355
+ const parseErrorBody = async (errorBody, context) => {
356
+ const value = await parseBody(errorBody, context);
357
+ value.message = value.message ?? value.Message;
358
+ return value;
359
+ };
360
+ const loadRestJsonErrorCode = (output, data) => {
361
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
362
+ const sanitizeErrorCode = (rawValue) => {
363
+ let cleanValue = rawValue;
364
+ if (typeof cleanValue === "number") {
365
+ cleanValue = cleanValue.toString();
366
+ }
367
+ if (cleanValue.indexOf(",") >= 0) {
368
+ cleanValue = cleanValue.split(",")[0];
369
+ }
370
+ if (cleanValue.indexOf(":") >= 0) {
371
+ cleanValue = cleanValue.split(":")[0];
372
+ }
373
+ if (cleanValue.indexOf("#") >= 0) {
374
+ cleanValue = cleanValue.split("#")[1];
375
+ }
376
+ return cleanValue;
377
+ };
378
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
379
+ if (headerKey !== undefined) {
380
+ return sanitizeErrorCode(output.headers[headerKey]);
381
+ }
382
+ if (data.code !== undefined) {
383
+ return sanitizeErrorCode(data.code);
384
+ }
385
+ if (data["__type"] !== undefined) {
386
+ return sanitizeErrorCode(data["__type"]);
387
+ }
388
+ };
@@ -0,0 +1,24 @@
1
+ import { Sha256 } from "@aws-crypto/sha256-browser";
2
+ import { FetchHttpHandler as RequestHandler, streamCollector, } from "@smithy/fetch-http-handler";
3
+ import { calculateBodyLength } from "@smithy/util-body-length-browser";
4
+ import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE, } from "@smithy/util-retry";
5
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
6
+ import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
7
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
8
+ export const getRuntimeConfig = (config) => {
9
+ const defaultsMode = resolveDefaultsModeConfig(config);
10
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
11
+ const clientSharedValues = getSharedRuntimeConfig(config);
12
+ return {
13
+ ...clientSharedValues,
14
+ ...config,
15
+ runtime: "browser",
16
+ defaultsMode,
17
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
18
+ maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
19
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
20
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
21
+ sha256: config?.sha256 ?? Sha256,
22
+ streamCollector: config?.streamCollector ?? streamCollector,
23
+ };
24
+ };
@@ -0,0 +1,28 @@
1
+ import { Hash } from "@smithy/hash-node";
2
+ import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS, } from "@smithy/middleware-retry";
3
+ import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
4
+ import { NodeHttpHandler as RequestHandler, streamCollector, } from "@smithy/node-http-handler";
5
+ import { calculateBodyLength } from "@smithy/util-body-length-node";
6
+ import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
7
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
8
+ import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
9
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
10
+ import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
11
+ export const getRuntimeConfig = (config) => {
12
+ emitWarningIfUnsupportedVersion(process.version);
13
+ const defaultsMode = resolveDefaultsModeConfig(config);
14
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
15
+ const clientSharedValues = getSharedRuntimeConfig(config);
16
+ return {
17
+ ...clientSharedValues,
18
+ ...config,
19
+ runtime: "node",
20
+ defaultsMode,
21
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
22
+ maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
23
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
24
+ retryMode: config?.retryMode ?? loadNodeConfig({ ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }),
25
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
26
+ streamCollector: config?.streamCollector ?? streamCollector,
27
+ };
28
+ };
@@ -0,0 +1,11 @@
1
+ import { Sha256 } from "@aws-crypto/sha256-js";
2
+ import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
3
+ export const getRuntimeConfig = (config) => {
4
+ const browserDefaults = getBrowserRuntimeConfig(config);
5
+ return {
6
+ ...browserDefaults,
7
+ ...config,
8
+ runtime: "react-native",
9
+ sha256: config?.sha256 ?? Sha256,
10
+ };
11
+ };
@@ -0,0 +1,15 @@
1
+ import { NoOpLogger } from "@smithy/smithy-client";
2
+ import { parseUrl } from "@smithy/url-parser";
3
+ import { fromBase64, toBase64, } from "@smithy/util-base64";
4
+ import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
5
+ export const getRuntimeConfig = (config) => ({
6
+ apiVersion: "v2",
7
+ base64Decoder: config?.base64Decoder ?? fromBase64,
8
+ base64Encoder: config?.base64Encoder ?? toBase64,
9
+ disableHostPrefix: config?.disableHostPrefix ?? false,
10
+ extensions: config?.extensions ?? [],
11
+ logger: config?.logger ?? new NoOpLogger(),
12
+ urlParser: config?.urlParser ?? parseUrl,
13
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
14
+ utf8Encoder: config?.utf8Encoder ?? toUtf8,
15
+ });