@aws-sdk/client-personalize-events 3.33.0 → 3.36.1

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 (110) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/{dist/cjs → dist-cjs}/PersonalizeEvents.js +1 -7
  3. package/{dist/cjs → dist-cjs}/PersonalizeEventsClient.js +8 -19
  4. package/{dist/cjs → dist-cjs}/commands/PutEventsCommand.js +2 -28
  5. package/{dist/cjs → dist-cjs}/commands/PutItemsCommand.js +2 -29
  6. package/{dist/cjs → dist-cjs}/commands/PutUsersCommand.js +2 -28
  7. package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
  8. package/{dist/cjs → dist-cjs}/index.js +0 -1
  9. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  10. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -28
  11. package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +3 -9
  12. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
  13. package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
  14. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
  15. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
  16. package/{dist/es → dist-es}/PersonalizeEvents.js +2 -8
  17. package/{dist/es → dist-es}/PersonalizeEventsClient.js +2 -13
  18. package/{dist/es → dist-es}/commands/PutEventsCommand.js +4 -31
  19. package/{dist/es → dist-es}/commands/PutItemsCommand.js +4 -32
  20. package/{dist/es → dist-es}/commands/PutUsersCommand.js +4 -31
  21. package/{dist/es → dist-es}/endpoints.js +1 -2
  22. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  23. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  24. package/{dist/es → dist-es}/models/models_0.js +0 -28
  25. package/{dist/es → dist-es}/protocols/Aws_restJson1.js +56 -62
  26. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
  27. package/{dist/es → dist-es}/runtimeConfig.js +1 -5
  28. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
  29. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
  30. package/{dist/types → dist-types}/PersonalizeEvents.d.ts +2 -2
  31. package/{dist/types → dist-types}/PersonalizeEventsClient.d.ts +4 -4
  32. package/{dist/types → dist-types}/commands/PutEventsCommand.d.ts +3 -3
  33. package/{dist/types → dist-types}/commands/PutItemsCommand.d.ts +3 -3
  34. package/{dist/types → dist-types}/commands/PutUsersCommand.d.ts +3 -3
  35. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  36. package/{index.ts → dist-types/index.d.ts} +0 -0
  37. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  38. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  39. package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
  40. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  41. package/{dist/types → dist-types}/runtimeConfig.d.ts +1 -1
  42. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  43. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  44. package/{dist/types → dist-types}/ts3.4/PersonalizeEvents.d.ts +6 -20
  45. package/dist-types/ts3.4/PersonalizeEventsClient.d.ts +70 -0
  46. package/dist-types/ts3.4/commands/PutEventsCommand.d.ts +17 -0
  47. package/dist-types/ts3.4/commands/PutItemsCommand.d.ts +17 -0
  48. package/dist-types/ts3.4/commands/PutUsersCommand.d.ts +17 -0
  49. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  50. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  51. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  52. package/dist-types/ts3.4/models/models_0.d.ts +111 -0
  53. package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
  54. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
  55. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +2 -4
  56. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
  57. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
  58. package/package.json +52 -49
  59. package/PersonalizeEvents.ts +0 -94
  60. package/PersonalizeEventsClient.ts +0 -240
  61. package/commands/PutEventsCommand.ts +0 -99
  62. package/commands/PutItemsCommand.ts +0 -100
  63. package/commands/PutUsersCommand.ts +0 -99
  64. package/dist/cjs/PersonalizeEvents.js.map +0 -1
  65. package/dist/cjs/PersonalizeEventsClient.js.map +0 -1
  66. package/dist/cjs/commands/PutEventsCommand.js.map +0 -1
  67. package/dist/cjs/commands/PutItemsCommand.js.map +0 -1
  68. package/dist/cjs/commands/PutUsersCommand.js.map +0 -1
  69. package/dist/cjs/endpoints.js.map +0 -1
  70. package/dist/cjs/index.js.map +0 -1
  71. package/dist/cjs/models/index.js.map +0 -1
  72. package/dist/cjs/models/models_0.js.map +0 -1
  73. package/dist/cjs/package.json +0 -91
  74. package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
  75. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  76. package/dist/cjs/runtimeConfig.js.map +0 -1
  77. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  78. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  79. package/dist/es/PersonalizeEvents.js.map +0 -1
  80. package/dist/es/PersonalizeEventsClient.js.map +0 -1
  81. package/dist/es/commands/PutEventsCommand.js.map +0 -1
  82. package/dist/es/commands/PutItemsCommand.js.map +0 -1
  83. package/dist/es/commands/PutUsersCommand.js.map +0 -1
  84. package/dist/es/endpoints.js.map +0 -1
  85. package/dist/es/index.js +0 -7
  86. package/dist/es/index.js.map +0 -1
  87. package/dist/es/models/index.js +0 -2
  88. package/dist/es/models/index.js.map +0 -1
  89. package/dist/es/models/models_0.js.map +0 -1
  90. package/dist/es/package.json +0 -91
  91. package/dist/es/protocols/Aws_restJson1.js.map +0 -1
  92. package/dist/es/runtimeConfig.browser.js.map +0 -1
  93. package/dist/es/runtimeConfig.js.map +0 -1
  94. package/dist/es/runtimeConfig.native.js.map +0 -1
  95. package/dist/es/runtimeConfig.shared.js.map +0 -1
  96. package/dist/types/ts3.4/PersonalizeEventsClient.d.ts +0 -137
  97. package/dist/types/ts3.4/commands/PutEventsCommand.d.ts +0 -36
  98. package/dist/types/ts3.4/commands/PutItemsCommand.d.ts +0 -37
  99. package/dist/types/ts3.4/commands/PutUsersCommand.d.ts +0 -36
  100. package/dist/types/ts3.4/models/models_0.d.ts +0 -216
  101. package/endpoints.ts +0 -57
  102. package/jest.config.js +0 -4
  103. package/models/models_0.ts +0 -266
  104. package/protocols/Aws_restJson1.ts +0 -484
  105. package/runtimeConfig.browser.ts +0 -40
  106. package/runtimeConfig.native.ts +0 -16
  107. package/runtimeConfig.shared.ts +0 -16
  108. package/runtimeConfig.ts +0 -45
  109. package/tsconfig.es.json +0 -12
  110. package/tsconfig.json +0 -32
@@ -1,484 +0,0 @@
1
- import { PutEventsCommandInput, PutEventsCommandOutput } from "../commands/PutEventsCommand";
2
- import { PutItemsCommandInput, PutItemsCommandOutput } from "../commands/PutItemsCommand";
3
- import { PutUsersCommandInput, PutUsersCommandOutput } from "../commands/PutUsersCommand";
4
- import {
5
- Event,
6
- InvalidInputException,
7
- Item,
8
- ResourceInUseException,
9
- ResourceNotFoundException,
10
- User,
11
- } from "../models/models_0";
12
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
13
- import {
14
- LazyJsonString as __LazyJsonString,
15
- expectString as __expectString,
16
- serializeFloat as __serializeFloat,
17
- } from "@aws-sdk/smithy-client";
18
- import {
19
- Endpoint as __Endpoint,
20
- MetadataBearer as __MetadataBearer,
21
- ResponseMetadata as __ResponseMetadata,
22
- SerdeContext as __SerdeContext,
23
- SmithyException as __SmithyException,
24
- } from "@aws-sdk/types";
25
-
26
- export const serializeAws_restJson1PutEventsCommand = async (
27
- input: PutEventsCommandInput,
28
- context: __SerdeContext
29
- ): Promise<__HttpRequest> => {
30
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
31
- const headers: any = {
32
- "content-type": "application/json",
33
- };
34
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/events";
35
- let body: any;
36
- body = JSON.stringify({
37
- ...(input.eventList !== undefined &&
38
- input.eventList !== null && { eventList: serializeAws_restJson1EventList(input.eventList, context) }),
39
- ...(input.sessionId !== undefined && input.sessionId !== null && { sessionId: input.sessionId }),
40
- ...(input.trackingId !== undefined && input.trackingId !== null && { trackingId: input.trackingId }),
41
- ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
42
- });
43
- return new __HttpRequest({
44
- protocol,
45
- hostname,
46
- port,
47
- method: "POST",
48
- headers,
49
- path: resolvedPath,
50
- body,
51
- });
52
- };
53
-
54
- export const serializeAws_restJson1PutItemsCommand = async (
55
- input: PutItemsCommandInput,
56
- context: __SerdeContext
57
- ): Promise<__HttpRequest> => {
58
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
59
- const headers: any = {
60
- "content-type": "application/json",
61
- };
62
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/items";
63
- let body: any;
64
- body = JSON.stringify({
65
- ...(input.datasetArn !== undefined && input.datasetArn !== null && { datasetArn: input.datasetArn }),
66
- ...(input.items !== undefined &&
67
- input.items !== null && { items: serializeAws_restJson1ItemList(input.items, context) }),
68
- });
69
- return new __HttpRequest({
70
- protocol,
71
- hostname,
72
- port,
73
- method: "POST",
74
- headers,
75
- path: resolvedPath,
76
- body,
77
- });
78
- };
79
-
80
- export const serializeAws_restJson1PutUsersCommand = async (
81
- input: PutUsersCommandInput,
82
- context: __SerdeContext
83
- ): Promise<__HttpRequest> => {
84
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
85
- const headers: any = {
86
- "content-type": "application/json",
87
- };
88
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users";
89
- let body: any;
90
- body = JSON.stringify({
91
- ...(input.datasetArn !== undefined && input.datasetArn !== null && { datasetArn: input.datasetArn }),
92
- ...(input.users !== undefined &&
93
- input.users !== null && { users: serializeAws_restJson1UserList(input.users, context) }),
94
- });
95
- return new __HttpRequest({
96
- protocol,
97
- hostname,
98
- port,
99
- method: "POST",
100
- headers,
101
- path: resolvedPath,
102
- body,
103
- });
104
- };
105
-
106
- export const deserializeAws_restJson1PutEventsCommand = async (
107
- output: __HttpResponse,
108
- context: __SerdeContext
109
- ): Promise<PutEventsCommandOutput> => {
110
- if (output.statusCode !== 200 && output.statusCode >= 300) {
111
- return deserializeAws_restJson1PutEventsCommandError(output, context);
112
- }
113
- const contents: PutEventsCommandOutput = {
114
- $metadata: deserializeMetadata(output),
115
- };
116
- await collectBody(output.body, context);
117
- return Promise.resolve(contents);
118
- };
119
-
120
- const deserializeAws_restJson1PutEventsCommandError = async (
121
- output: __HttpResponse,
122
- context: __SerdeContext
123
- ): Promise<PutEventsCommandOutput> => {
124
- const parsedOutput: any = {
125
- ...output,
126
- body: await parseBody(output.body, context),
127
- };
128
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
129
- let errorCode: string = "UnknownError";
130
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
131
- switch (errorCode) {
132
- case "InvalidInputException":
133
- case "com.amazonaws.personalizeevents#InvalidInputException":
134
- response = {
135
- ...(await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)),
136
- name: errorCode,
137
- $metadata: deserializeMetadata(output),
138
- };
139
- break;
140
- default:
141
- const parsedBody = parsedOutput.body;
142
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
143
- response = {
144
- ...parsedBody,
145
- name: `${errorCode}`,
146
- message: parsedBody.message || parsedBody.Message || errorCode,
147
- $fault: "client",
148
- $metadata: deserializeMetadata(output),
149
- } as any;
150
- }
151
- const message = response.message || response.Message || errorCode;
152
- response.message = message;
153
- delete response.Message;
154
- return Promise.reject(Object.assign(new Error(message), response));
155
- };
156
-
157
- export const deserializeAws_restJson1PutItemsCommand = async (
158
- output: __HttpResponse,
159
- context: __SerdeContext
160
- ): Promise<PutItemsCommandOutput> => {
161
- if (output.statusCode !== 200 && output.statusCode >= 300) {
162
- return deserializeAws_restJson1PutItemsCommandError(output, context);
163
- }
164
- const contents: PutItemsCommandOutput = {
165
- $metadata: deserializeMetadata(output),
166
- };
167
- await collectBody(output.body, context);
168
- return Promise.resolve(contents);
169
- };
170
-
171
- const deserializeAws_restJson1PutItemsCommandError = async (
172
- output: __HttpResponse,
173
- context: __SerdeContext
174
- ): Promise<PutItemsCommandOutput> => {
175
- const parsedOutput: any = {
176
- ...output,
177
- body: await parseBody(output.body, context),
178
- };
179
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
180
- let errorCode: string = "UnknownError";
181
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
182
- switch (errorCode) {
183
- case "InvalidInputException":
184
- case "com.amazonaws.personalizeevents#InvalidInputException":
185
- response = {
186
- ...(await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)),
187
- name: errorCode,
188
- $metadata: deserializeMetadata(output),
189
- };
190
- break;
191
- case "ResourceInUseException":
192
- case "com.amazonaws.personalizeevents#ResourceInUseException":
193
- response = {
194
- ...(await deserializeAws_restJson1ResourceInUseExceptionResponse(parsedOutput, context)),
195
- name: errorCode,
196
- $metadata: deserializeMetadata(output),
197
- };
198
- break;
199
- case "ResourceNotFoundException":
200
- case "com.amazonaws.personalizeevents#ResourceNotFoundException":
201
- response = {
202
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
203
- name: errorCode,
204
- $metadata: deserializeMetadata(output),
205
- };
206
- break;
207
- default:
208
- const parsedBody = parsedOutput.body;
209
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
210
- response = {
211
- ...parsedBody,
212
- name: `${errorCode}`,
213
- message: parsedBody.message || parsedBody.Message || errorCode,
214
- $fault: "client",
215
- $metadata: deserializeMetadata(output),
216
- } as any;
217
- }
218
- const message = response.message || response.Message || errorCode;
219
- response.message = message;
220
- delete response.Message;
221
- return Promise.reject(Object.assign(new Error(message), response));
222
- };
223
-
224
- export const deserializeAws_restJson1PutUsersCommand = async (
225
- output: __HttpResponse,
226
- context: __SerdeContext
227
- ): Promise<PutUsersCommandOutput> => {
228
- if (output.statusCode !== 200 && output.statusCode >= 300) {
229
- return deserializeAws_restJson1PutUsersCommandError(output, context);
230
- }
231
- const contents: PutUsersCommandOutput = {
232
- $metadata: deserializeMetadata(output),
233
- };
234
- await collectBody(output.body, context);
235
- return Promise.resolve(contents);
236
- };
237
-
238
- const deserializeAws_restJson1PutUsersCommandError = async (
239
- output: __HttpResponse,
240
- context: __SerdeContext
241
- ): Promise<PutUsersCommandOutput> => {
242
- const parsedOutput: any = {
243
- ...output,
244
- body: await parseBody(output.body, context),
245
- };
246
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
247
- let errorCode: string = "UnknownError";
248
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
249
- switch (errorCode) {
250
- case "InvalidInputException":
251
- case "com.amazonaws.personalizeevents#InvalidInputException":
252
- response = {
253
- ...(await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)),
254
- name: errorCode,
255
- $metadata: deserializeMetadata(output),
256
- };
257
- break;
258
- case "ResourceInUseException":
259
- case "com.amazonaws.personalizeevents#ResourceInUseException":
260
- response = {
261
- ...(await deserializeAws_restJson1ResourceInUseExceptionResponse(parsedOutput, context)),
262
- name: errorCode,
263
- $metadata: deserializeMetadata(output),
264
- };
265
- break;
266
- case "ResourceNotFoundException":
267
- case "com.amazonaws.personalizeevents#ResourceNotFoundException":
268
- response = {
269
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
270
- name: errorCode,
271
- $metadata: deserializeMetadata(output),
272
- };
273
- break;
274
- default:
275
- const parsedBody = parsedOutput.body;
276
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
277
- response = {
278
- ...parsedBody,
279
- name: `${errorCode}`,
280
- message: parsedBody.message || parsedBody.Message || errorCode,
281
- $fault: "client",
282
- $metadata: deserializeMetadata(output),
283
- } as any;
284
- }
285
- const message = response.message || response.Message || errorCode;
286
- response.message = message;
287
- delete response.Message;
288
- return Promise.reject(Object.assign(new Error(message), response));
289
- };
290
-
291
- const deserializeAws_restJson1InvalidInputExceptionResponse = async (
292
- parsedOutput: any,
293
- context: __SerdeContext
294
- ): Promise<InvalidInputException> => {
295
- const contents: InvalidInputException = {
296
- name: "InvalidInputException",
297
- $fault: "client",
298
- $metadata: deserializeMetadata(parsedOutput),
299
- message: undefined,
300
- };
301
- const data: any = parsedOutput.body;
302
- if (data.message !== undefined && data.message !== null) {
303
- contents.message = __expectString(data.message);
304
- }
305
- return contents;
306
- };
307
-
308
- const deserializeAws_restJson1ResourceInUseExceptionResponse = async (
309
- parsedOutput: any,
310
- context: __SerdeContext
311
- ): Promise<ResourceInUseException> => {
312
- const contents: ResourceInUseException = {
313
- name: "ResourceInUseException",
314
- $fault: "client",
315
- $metadata: deserializeMetadata(parsedOutput),
316
- message: undefined,
317
- };
318
- const data: any = parsedOutput.body;
319
- if (data.message !== undefined && data.message !== null) {
320
- contents.message = __expectString(data.message);
321
- }
322
- return contents;
323
- };
324
-
325
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
326
- parsedOutput: any,
327
- context: __SerdeContext
328
- ): Promise<ResourceNotFoundException> => {
329
- const contents: ResourceNotFoundException = {
330
- name: "ResourceNotFoundException",
331
- $fault: "client",
332
- $metadata: deserializeMetadata(parsedOutput),
333
- message: undefined,
334
- };
335
- const data: any = parsedOutput.body;
336
- if (data.message !== undefined && data.message !== null) {
337
- contents.message = __expectString(data.message);
338
- }
339
- return contents;
340
- };
341
-
342
- const serializeAws_restJson1Event = (input: Event, context: __SerdeContext): any => {
343
- return {
344
- ...(input.eventId !== undefined && input.eventId !== null && { eventId: input.eventId }),
345
- ...(input.eventType !== undefined && input.eventType !== null && { eventType: input.eventType }),
346
- ...(input.eventValue !== undefined &&
347
- input.eventValue !== null && { eventValue: __serializeFloat(input.eventValue) }),
348
- ...(input.impression !== undefined &&
349
- input.impression !== null && { impression: serializeAws_restJson1Impression(input.impression, context) }),
350
- ...(input.itemId !== undefined && input.itemId !== null && { itemId: input.itemId }),
351
- ...(input.properties !== undefined &&
352
- input.properties !== null && { properties: __LazyJsonString.fromObject(input.properties) }),
353
- ...(input.recommendationId !== undefined &&
354
- input.recommendationId !== null && { recommendationId: input.recommendationId }),
355
- ...(input.sentAt !== undefined && input.sentAt !== null && { sentAt: Math.round(input.sentAt.getTime() / 1000) }),
356
- };
357
- };
358
-
359
- const serializeAws_restJson1EventList = (input: Event[], context: __SerdeContext): any => {
360
- return input
361
- .filter((e: any) => e != null)
362
- .map((entry) => {
363
- if (entry === null) {
364
- return null as any;
365
- }
366
- return serializeAws_restJson1Event(entry, context);
367
- });
368
- };
369
-
370
- const serializeAws_restJson1Impression = (input: string[], context: __SerdeContext): any => {
371
- return input
372
- .filter((e: any) => e != null)
373
- .map((entry) => {
374
- if (entry === null) {
375
- return null as any;
376
- }
377
- return entry;
378
- });
379
- };
380
-
381
- const serializeAws_restJson1Item = (input: Item, context: __SerdeContext): any => {
382
- return {
383
- ...(input.itemId !== undefined && input.itemId !== null && { itemId: input.itemId }),
384
- ...(input.properties !== undefined &&
385
- input.properties !== null && { properties: __LazyJsonString.fromObject(input.properties) }),
386
- };
387
- };
388
-
389
- const serializeAws_restJson1ItemList = (input: Item[], context: __SerdeContext): any => {
390
- return input
391
- .filter((e: any) => e != null)
392
- .map((entry) => {
393
- if (entry === null) {
394
- return null as any;
395
- }
396
- return serializeAws_restJson1Item(entry, context);
397
- });
398
- };
399
-
400
- const serializeAws_restJson1User = (input: User, context: __SerdeContext): any => {
401
- return {
402
- ...(input.properties !== undefined &&
403
- input.properties !== null && { properties: __LazyJsonString.fromObject(input.properties) }),
404
- ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
405
- };
406
- };
407
-
408
- const serializeAws_restJson1UserList = (input: User[], context: __SerdeContext): any => {
409
- return input
410
- .filter((e: any) => e != null)
411
- .map((entry) => {
412
- if (entry === null) {
413
- return null as any;
414
- }
415
- return serializeAws_restJson1User(entry, context);
416
- });
417
- };
418
-
419
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
420
- httpStatusCode: output.statusCode,
421
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
422
- extendedRequestId: output.headers["x-amz-id-2"],
423
- cfId: output.headers["x-amz-cf-id"],
424
- });
425
-
426
- // Collect low-level response body stream to Uint8Array.
427
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
428
- if (streamBody instanceof Uint8Array) {
429
- return Promise.resolve(streamBody);
430
- }
431
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
432
- };
433
-
434
- // Encode Uint8Array data into string with utf-8.
435
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
436
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
437
-
438
- const isSerializableHeaderValue = (value: any): boolean =>
439
- value !== undefined &&
440
- value !== null &&
441
- value !== "" &&
442
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
443
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
444
-
445
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
446
- collectBodyString(streamBody, context).then((encoded) => {
447
- if (encoded.length) {
448
- return JSON.parse(encoded);
449
- }
450
- return {};
451
- });
452
-
453
- /**
454
- * Load an error code for the aws.rest-json-1.1 protocol.
455
- */
456
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
457
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
458
-
459
- const sanitizeErrorCode = (rawValue: string): string => {
460
- let cleanValue = rawValue;
461
- if (cleanValue.indexOf(":") >= 0) {
462
- cleanValue = cleanValue.split(":")[0];
463
- }
464
- if (cleanValue.indexOf("#") >= 0) {
465
- cleanValue = cleanValue.split("#")[1];
466
- }
467
- return cleanValue;
468
- };
469
-
470
- const headerKey = findKey(output.headers, "x-amzn-errortype");
471
- if (headerKey !== undefined) {
472
- return sanitizeErrorCode(output.headers[headerKey]);
473
- }
474
-
475
- if (data.code !== undefined) {
476
- return sanitizeErrorCode(data.code);
477
- }
478
-
479
- if (data["__type"] !== undefined) {
480
- return sanitizeErrorCode(data["__type"]);
481
- }
482
-
483
- return "";
484
- };
@@ -1,40 +0,0 @@
1
- import packageInfo from "./package.json";
2
-
3
- import { Sha256 } from "@aws-crypto/sha256-browser";
4
- import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
5
- import { invalidProvider } from "@aws-sdk/invalid-dependency";
6
- import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
7
- import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
8
- import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
9
- import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
10
- import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
11
- import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient";
12
- import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
13
-
14
- /**
15
- * @internal
16
- */
17
- export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => {
18
- const clientSharedValues = getSharedRuntimeConfig(config);
19
- return {
20
- ...clientSharedValues,
21
- ...config,
22
- runtime: "browser",
23
- base64Decoder: config?.base64Decoder ?? fromBase64,
24
- base64Encoder: config?.base64Encoder ?? toBase64,
25
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
26
- credentialDefaultProvider:
27
- config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
28
- defaultUserAgentProvider:
29
- config?.defaultUserAgentProvider ??
30
- defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
31
- maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
32
- region: config?.region ?? invalidProvider("Region is missing"),
33
- requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
34
- retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
35
- sha256: config?.sha256 ?? Sha256,
36
- streamCollector: config?.streamCollector ?? streamCollector,
37
- utf8Decoder: config?.utf8Decoder ?? fromUtf8,
38
- utf8Encoder: config?.utf8Encoder ?? toUtf8,
39
- };
40
- };
@@ -1,16 +0,0 @@
1
- import { Sha256 } from "@aws-crypto/sha256-js";
2
- import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient";
3
- import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
4
-
5
- /**
6
- * @internal
7
- */
8
- export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => {
9
- const browserDefaults = getBrowserRuntimeConfig(config);
10
- return {
11
- ...browserDefaults,
12
- ...config,
13
- runtime: "react-native",
14
- sha256: config?.sha256 ?? Sha256,
15
- };
16
- };
@@ -1,16 +0,0 @@
1
- import { defaultRegionInfoProvider } from "./endpoints";
2
- import { Logger as __Logger } from "@aws-sdk/types";
3
- import { parseUrl } from "@aws-sdk/url-parser";
4
- import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient";
5
-
6
- /**
7
- * @internal
8
- */
9
- export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => ({
10
- apiVersion: "2018-03-22",
11
- disableHostPrefix: config?.disableHostPrefix ?? false,
12
- logger: config?.logger ?? ({} as __Logger),
13
- regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
14
- serviceId: config?.serviceId ?? "Personalize Events",
15
- urlParser: config?.urlParser ?? parseUrl,
16
- });
package/runtimeConfig.ts DELETED
@@ -1,45 +0,0 @@
1
- import packageInfo from "./package.json";
2
-
3
- import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
4
- import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
5
- import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
6
- import { Hash } from "@aws-sdk/hash-node";
7
- import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
8
- import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
9
- import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
10
- import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
11
- import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
12
- import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
13
- import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
14
- import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient";
15
- import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
16
- import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
17
-
18
- /**
19
- * @internal
20
- */
21
- export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => {
22
- emitWarningIfUnsupportedVersion(process.version);
23
- const clientSharedValues = getSharedRuntimeConfig(config);
24
- return {
25
- ...clientSharedValues,
26
- ...config,
27
- runtime: "node",
28
- base64Decoder: config?.base64Decoder ?? fromBase64,
29
- base64Encoder: config?.base64Encoder ?? toBase64,
30
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
31
- credentialDefaultProvider:
32
- config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
33
- defaultUserAgentProvider:
34
- config?.defaultUserAgentProvider ??
35
- defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
36
- maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
37
- region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
38
- requestHandler: config?.requestHandler ?? new NodeHttpHandler(),
39
- retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),
40
- sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
41
- streamCollector: config?.streamCollector ?? streamCollector,
42
- utf8Decoder: config?.utf8Decoder ?? fromUtf8,
43
- utf8Encoder: config?.utf8Encoder ?? toUtf8,
44
- };
45
- };
package/tsconfig.es.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "module": "esnext",
6
- "moduleResolution": "node",
7
- "declaration": false,
8
- "declarationDir": null,
9
- "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
10
- "outDir": "dist/es"
11
- }
12
- }
package/tsconfig.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "alwaysStrict": true,
4
- "target": "ES2018",
5
- "module": "commonjs",
6
- "declaration": true,
7
- "strict": true,
8
- "sourceMap": true,
9
- "downlevelIteration": true,
10
- "importHelpers": true,
11
- "noEmitHelpers": true,
12
- "incremental": true,
13
- "resolveJsonModule": true,
14
- "esModuleInterop": true,
15
- "declarationDir": "./dist/types",
16
- "outDir": "dist/cjs"
17
- },
18
- "typedocOptions": {
19
- "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"],
20
- "excludeNotExported": true,
21
- "excludePrivate": true,
22
- "hideGenerator": true,
23
- "ignoreCompilerErrors": true,
24
- "includeDeclarations": true,
25
- "stripInternal": true,
26
- "readme": "./README.md",
27
- "mode": "file",
28
- "out": "./docs",
29
- "theme": "minimal",
30
- "plugin": ["@aws-sdk/client-documentation-generator"]
31
- }
32
- }