@aws-sdk/client-sagemaker-edge 3.34.0 → 3.37.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 (102) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/{dist/cjs → dist-cjs}/SagemakerEdge.js +1 -5
  3. package/{dist/cjs → dist-cjs}/SagemakerEdgeClient.js +8 -17
  4. package/{dist/cjs → dist-cjs}/commands/GetDeviceRegistrationCommand.js +2 -27
  5. package/{dist/cjs → dist-cjs}/commands/SendHeartbeatCommand.js +2 -27
  6. package/{dist/cjs → dist-cjs}/endpoints.js +1 -2
  7. package/{dist/cjs → dist-cjs}/index.js +0 -1
  8. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  9. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -19
  10. package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +2 -8
  11. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
  12. package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
  13. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
  14. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
  15. package/{dist/es → dist-es}/SagemakerEdge.js +1 -2
  16. package/{dist/es → dist-es}/SagemakerEdgeClient.js +1 -2
  17. package/{dist/es → dist-es}/commands/GetDeviceRegistrationCommand.js +2 -3
  18. package/{dist/es → dist-es}/commands/SendHeartbeatCommand.js +2 -3
  19. package/{dist/es → dist-es}/endpoints.js +1 -2
  20. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  21. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  22. package/{dist/es → dist-es}/models/models_0.js +0 -1
  23. package/{dist/es → dist-es}/protocols/Aws_restJson1.js +0 -1
  24. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -2
  25. package/{dist/es → dist-es}/runtimeConfig.js +1 -2
  26. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -1
  27. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -2
  28. package/{dist/types → dist-types}/SagemakerEdge.d.ts +2 -2
  29. package/{dist/types → dist-types}/SagemakerEdgeClient.d.ts +3 -3
  30. package/{dist/types → dist-types}/commands/GetDeviceRegistrationCommand.d.ts +3 -3
  31. package/{dist/types → dist-types}/commands/SendHeartbeatCommand.d.ts +3 -3
  32. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  33. package/{index.ts → dist-types/index.d.ts} +0 -0
  34. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  35. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  36. package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
  37. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  38. package/{dist/types → dist-types}/runtimeConfig.d.ts +1 -1
  39. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  40. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  41. package/{dist/types → dist-types}/ts3.4/SagemakerEdge.d.ts +5 -11
  42. package/dist-types/ts3.4/SagemakerEdgeClient.d.ts +69 -0
  43. package/{dist/types → dist-types}/ts3.4/commands/GetDeviceRegistrationCommand.d.ts +5 -23
  44. package/dist-types/ts3.4/commands/SendHeartbeatCommand.d.ts +17 -0
  45. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  46. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  47. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  48. package/dist-types/ts3.4/models/models_0.d.ts +79 -0
  49. package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
  50. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
  51. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +2 -4
  52. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
  53. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
  54. package/package.json +45 -42
  55. package/SagemakerEdge.ts +0 -81
  56. package/SagemakerEdgeClient.ts +0 -240
  57. package/commands/GetDeviceRegistrationCommand.ts +0 -94
  58. package/commands/SendHeartbeatCommand.ts +0 -94
  59. package/dist/cjs/SagemakerEdge.js.map +0 -1
  60. package/dist/cjs/SagemakerEdgeClient.js.map +0 -1
  61. package/dist/cjs/commands/GetDeviceRegistrationCommand.js.map +0 -1
  62. package/dist/cjs/commands/SendHeartbeatCommand.js.map +0 -1
  63. package/dist/cjs/endpoints.js.map +0 -1
  64. package/dist/cjs/index.js.map +0 -1
  65. package/dist/cjs/models/index.js.map +0 -1
  66. package/dist/cjs/models/models_0.js.map +0 -1
  67. package/dist/cjs/package.json +0 -91
  68. package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
  69. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  70. package/dist/cjs/runtimeConfig.js.map +0 -1
  71. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  72. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  73. package/dist/es/SagemakerEdge.js.map +0 -1
  74. package/dist/es/SagemakerEdgeClient.js.map +0 -1
  75. package/dist/es/commands/GetDeviceRegistrationCommand.js.map +0 -1
  76. package/dist/es/commands/SendHeartbeatCommand.js.map +0 -1
  77. package/dist/es/endpoints.js.map +0 -1
  78. package/dist/es/index.js +0 -6
  79. package/dist/es/index.js.map +0 -1
  80. package/dist/es/models/index.js +0 -2
  81. package/dist/es/models/index.js.map +0 -1
  82. package/dist/es/models/models_0.js.map +0 -1
  83. package/dist/es/package.json +0 -91
  84. package/dist/es/protocols/Aws_restJson1.js.map +0 -1
  85. package/dist/es/runtimeConfig.browser.js.map +0 -1
  86. package/dist/es/runtimeConfig.js.map +0 -1
  87. package/dist/es/runtimeConfig.native.js.map +0 -1
  88. package/dist/es/runtimeConfig.shared.js.map +0 -1
  89. package/dist/types/ts3.4/SagemakerEdgeClient.d.ts +0 -134
  90. package/dist/types/ts3.4/commands/SendHeartbeatCommand.d.ts +0 -35
  91. package/dist/types/ts3.4/models/models_0.d.ts +0 -134
  92. package/endpoints.ts +0 -57
  93. package/jest.config.js +0 -4
  94. package/models/models_0.ts +0 -171
  95. package/protocols/Aws_restJson1.ts +0 -316
  96. package/runtimeConfig.browser.ts +0 -40
  97. package/runtimeConfig.native.ts +0 -16
  98. package/runtimeConfig.shared.ts +0 -16
  99. package/runtimeConfig.ts +0 -45
  100. package/tsconfig.es.json +0 -10
  101. package/tsconfig.json +0 -31
  102. package/tsconfig.types.json +0 -8
@@ -1,171 +0,0 @@
1
- import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types";
2
-
3
- export interface GetDeviceRegistrationRequest {
4
- /**
5
- * <p>The unique name of the device you want to get the registration status from.</p>
6
- */
7
- DeviceName: string | undefined;
8
-
9
- /**
10
- * <p>The name of the fleet that the device belongs to.</p>
11
- */
12
- DeviceFleetName: string | undefined;
13
- }
14
-
15
- export namespace GetDeviceRegistrationRequest {
16
- /**
17
- * @internal
18
- */
19
- export const filterSensitiveLog = (obj: GetDeviceRegistrationRequest): any => ({
20
- ...obj,
21
- });
22
- }
23
-
24
- export interface GetDeviceRegistrationResult {
25
- /**
26
- * <p>Describes if the device is currently registered with SageMaker Edge Manager.</p>
27
- */
28
- DeviceRegistration?: string;
29
-
30
- /**
31
- * <p>The amount of time, in seconds, that the registration status is stored on the device’s cache before it is refreshed.</p>
32
- */
33
- CacheTTL?: string;
34
- }
35
-
36
- export namespace GetDeviceRegistrationResult {
37
- /**
38
- * @internal
39
- */
40
- export const filterSensitiveLog = (obj: GetDeviceRegistrationResult): any => ({
41
- ...obj,
42
- });
43
- }
44
-
45
- /**
46
- * <p>An internal failure occurred. Try your request again. If the problem
47
- * persists, contact AWS customer support.</p>
48
- */
49
- export interface InternalServiceException extends __SmithyException, $MetadataBearer {
50
- name: "InternalServiceException";
51
- $fault: "client";
52
- Message?: string;
53
- }
54
-
55
- export namespace InternalServiceException {
56
- /**
57
- * @internal
58
- */
59
- export const filterSensitiveLog = (obj: InternalServiceException): any => ({
60
- ...obj,
61
- });
62
- }
63
-
64
- /**
65
- * <p>Information required for edge device metrics.</p>
66
- */
67
- export interface EdgeMetric {
68
- /**
69
- * <p>The dimension of metrics published.</p>
70
- */
71
- Dimension?: string;
72
-
73
- /**
74
- * <p>Returns the name of the metric.</p>
75
- */
76
- MetricName?: string;
77
-
78
- /**
79
- * <p>Returns the value of the metric.</p>
80
- */
81
- Value?: number;
82
-
83
- /**
84
- * <p>Timestamp of when the metric was requested.</p>
85
- */
86
- Timestamp?: Date;
87
- }
88
-
89
- export namespace EdgeMetric {
90
- /**
91
- * @internal
92
- */
93
- export const filterSensitiveLog = (obj: EdgeMetric): any => ({
94
- ...obj,
95
- });
96
- }
97
-
98
- /**
99
- * <p>Information about a model deployed on an edge device that is registered with SageMaker Edge Manager.</p>
100
- */
101
- export interface Model {
102
- /**
103
- * <p>The name of the model.</p>
104
- */
105
- ModelName?: string;
106
-
107
- /**
108
- * <p>The version of the model.</p>
109
- */
110
- ModelVersion?: string;
111
-
112
- /**
113
- * <p>The timestamp of the last data sample taken.</p>
114
- */
115
- LatestSampleTime?: Date;
116
-
117
- /**
118
- * <p>The timestamp of the last inference that was made.</p>
119
- */
120
- LatestInference?: Date;
121
-
122
- /**
123
- * <p>Information required for model metrics.</p>
124
- */
125
- ModelMetrics?: EdgeMetric[];
126
- }
127
-
128
- export namespace Model {
129
- /**
130
- * @internal
131
- */
132
- export const filterSensitiveLog = (obj: Model): any => ({
133
- ...obj,
134
- });
135
- }
136
-
137
- export interface SendHeartbeatRequest {
138
- /**
139
- * <p>For internal use. Returns a list of SageMaker Edge Manager agent operating metrics.</p>
140
- */
141
- AgentMetrics?: EdgeMetric[];
142
-
143
- /**
144
- * <p>Returns a list of models deployed on the the device.</p>
145
- */
146
- Models?: Model[];
147
-
148
- /**
149
- * <p>Returns the version of the agent.</p>
150
- */
151
- AgentVersion: string | undefined;
152
-
153
- /**
154
- * <p>The unique name of the device.</p>
155
- */
156
- DeviceName: string | undefined;
157
-
158
- /**
159
- * <p>The name of the fleet that the device belongs to.</p>
160
- */
161
- DeviceFleetName: string | undefined;
162
- }
163
-
164
- export namespace SendHeartbeatRequest {
165
- /**
166
- * @internal
167
- */
168
- export const filterSensitiveLog = (obj: SendHeartbeatRequest): any => ({
169
- ...obj,
170
- });
171
- }
@@ -1,316 +0,0 @@
1
- import {
2
- GetDeviceRegistrationCommandInput,
3
- GetDeviceRegistrationCommandOutput,
4
- } from "../commands/GetDeviceRegistrationCommand";
5
- import { SendHeartbeatCommandInput, SendHeartbeatCommandOutput } from "../commands/SendHeartbeatCommand";
6
- import { EdgeMetric, InternalServiceException, Model } from "../models/models_0";
7
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
8
- import {
9
- expectNonNull as __expectNonNull,
10
- expectObject as __expectObject,
11
- expectString as __expectString,
12
- serializeFloat as __serializeFloat,
13
- } from "@aws-sdk/smithy-client";
14
- import {
15
- Endpoint as __Endpoint,
16
- MetadataBearer as __MetadataBearer,
17
- ResponseMetadata as __ResponseMetadata,
18
- SerdeContext as __SerdeContext,
19
- SmithyException as __SmithyException,
20
- } from "@aws-sdk/types";
21
-
22
- export const serializeAws_restJson1GetDeviceRegistrationCommand = async (
23
- input: GetDeviceRegistrationCommandInput,
24
- context: __SerdeContext
25
- ): Promise<__HttpRequest> => {
26
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
27
- const headers: any = {
28
- "content-type": "application/json",
29
- };
30
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeviceRegistration";
31
- let body: any;
32
- body = JSON.stringify({
33
- ...(input.DeviceFleetName !== undefined &&
34
- input.DeviceFleetName !== null && { DeviceFleetName: input.DeviceFleetName }),
35
- ...(input.DeviceName !== undefined && input.DeviceName !== null && { DeviceName: input.DeviceName }),
36
- });
37
- return new __HttpRequest({
38
- protocol,
39
- hostname,
40
- port,
41
- method: "POST",
42
- headers,
43
- path: resolvedPath,
44
- body,
45
- });
46
- };
47
-
48
- export const serializeAws_restJson1SendHeartbeatCommand = async (
49
- input: SendHeartbeatCommandInput,
50
- context: __SerdeContext
51
- ): Promise<__HttpRequest> => {
52
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
53
- const headers: any = {
54
- "content-type": "application/json",
55
- };
56
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SendHeartbeat";
57
- let body: any;
58
- body = JSON.stringify({
59
- ...(input.AgentMetrics !== undefined &&
60
- input.AgentMetrics !== null && { AgentMetrics: serializeAws_restJson1EdgeMetrics(input.AgentMetrics, context) }),
61
- ...(input.AgentVersion !== undefined && input.AgentVersion !== null && { AgentVersion: input.AgentVersion }),
62
- ...(input.DeviceFleetName !== undefined &&
63
- input.DeviceFleetName !== null && { DeviceFleetName: input.DeviceFleetName }),
64
- ...(input.DeviceName !== undefined && input.DeviceName !== null && { DeviceName: input.DeviceName }),
65
- ...(input.Models !== undefined &&
66
- input.Models !== null && { Models: serializeAws_restJson1Models(input.Models, context) }),
67
- });
68
- return new __HttpRequest({
69
- protocol,
70
- hostname,
71
- port,
72
- method: "POST",
73
- headers,
74
- path: resolvedPath,
75
- body,
76
- });
77
- };
78
-
79
- export const deserializeAws_restJson1GetDeviceRegistrationCommand = async (
80
- output: __HttpResponse,
81
- context: __SerdeContext
82
- ): Promise<GetDeviceRegistrationCommandOutput> => {
83
- if (output.statusCode !== 200 && output.statusCode >= 300) {
84
- return deserializeAws_restJson1GetDeviceRegistrationCommandError(output, context);
85
- }
86
- const contents: GetDeviceRegistrationCommandOutput = {
87
- $metadata: deserializeMetadata(output),
88
- CacheTTL: undefined,
89
- DeviceRegistration: undefined,
90
- };
91
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
92
- if (data.CacheTTL !== undefined && data.CacheTTL !== null) {
93
- contents.CacheTTL = __expectString(data.CacheTTL);
94
- }
95
- if (data.DeviceRegistration !== undefined && data.DeviceRegistration !== null) {
96
- contents.DeviceRegistration = __expectString(data.DeviceRegistration);
97
- }
98
- return Promise.resolve(contents);
99
- };
100
-
101
- const deserializeAws_restJson1GetDeviceRegistrationCommandError = async (
102
- output: __HttpResponse,
103
- context: __SerdeContext
104
- ): Promise<GetDeviceRegistrationCommandOutput> => {
105
- const parsedOutput: any = {
106
- ...output,
107
- body: await parseBody(output.body, context),
108
- };
109
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
110
- let errorCode: string = "UnknownError";
111
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
112
- switch (errorCode) {
113
- case "InternalServiceException":
114
- case "com.amazonaws.sagemakeredge#InternalServiceException":
115
- response = {
116
- ...(await deserializeAws_restJson1InternalServiceExceptionResponse(parsedOutput, context)),
117
- name: errorCode,
118
- $metadata: deserializeMetadata(output),
119
- };
120
- break;
121
- default:
122
- const parsedBody = parsedOutput.body;
123
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
124
- response = {
125
- ...parsedBody,
126
- name: `${errorCode}`,
127
- message: parsedBody.message || parsedBody.Message || errorCode,
128
- $fault: "client",
129
- $metadata: deserializeMetadata(output),
130
- } as any;
131
- }
132
- const message = response.message || response.Message || errorCode;
133
- response.message = message;
134
- delete response.Message;
135
- return Promise.reject(Object.assign(new Error(message), response));
136
- };
137
-
138
- export const deserializeAws_restJson1SendHeartbeatCommand = async (
139
- output: __HttpResponse,
140
- context: __SerdeContext
141
- ): Promise<SendHeartbeatCommandOutput> => {
142
- if (output.statusCode !== 200 && output.statusCode >= 300) {
143
- return deserializeAws_restJson1SendHeartbeatCommandError(output, context);
144
- }
145
- const contents: SendHeartbeatCommandOutput = {
146
- $metadata: deserializeMetadata(output),
147
- };
148
- await collectBody(output.body, context);
149
- return Promise.resolve(contents);
150
- };
151
-
152
- const deserializeAws_restJson1SendHeartbeatCommandError = async (
153
- output: __HttpResponse,
154
- context: __SerdeContext
155
- ): Promise<SendHeartbeatCommandOutput> => {
156
- const parsedOutput: any = {
157
- ...output,
158
- body: await parseBody(output.body, context),
159
- };
160
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
161
- let errorCode: string = "UnknownError";
162
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
163
- switch (errorCode) {
164
- case "InternalServiceException":
165
- case "com.amazonaws.sagemakeredge#InternalServiceException":
166
- response = {
167
- ...(await deserializeAws_restJson1InternalServiceExceptionResponse(parsedOutput, context)),
168
- name: errorCode,
169
- $metadata: deserializeMetadata(output),
170
- };
171
- break;
172
- default:
173
- const parsedBody = parsedOutput.body;
174
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
175
- response = {
176
- ...parsedBody,
177
- name: `${errorCode}`,
178
- message: parsedBody.message || parsedBody.Message || errorCode,
179
- $fault: "client",
180
- $metadata: deserializeMetadata(output),
181
- } as any;
182
- }
183
- const message = response.message || response.Message || errorCode;
184
- response.message = message;
185
- delete response.Message;
186
- return Promise.reject(Object.assign(new Error(message), response));
187
- };
188
-
189
- const deserializeAws_restJson1InternalServiceExceptionResponse = async (
190
- parsedOutput: any,
191
- context: __SerdeContext
192
- ): Promise<InternalServiceException> => {
193
- const contents: InternalServiceException = {
194
- name: "InternalServiceException",
195
- $fault: "client",
196
- $metadata: deserializeMetadata(parsedOutput),
197
- Message: undefined,
198
- };
199
- const data: any = parsedOutput.body;
200
- if (data.Message !== undefined && data.Message !== null) {
201
- contents.Message = __expectString(data.Message);
202
- }
203
- return contents;
204
- };
205
-
206
- const serializeAws_restJson1EdgeMetric = (input: EdgeMetric, context: __SerdeContext): any => {
207
- return {
208
- ...(input.Dimension !== undefined && input.Dimension !== null && { Dimension: input.Dimension }),
209
- ...(input.MetricName !== undefined && input.MetricName !== null && { MetricName: input.MetricName }),
210
- ...(input.Timestamp !== undefined &&
211
- input.Timestamp !== null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
212
- ...(input.Value !== undefined && input.Value !== null && { Value: __serializeFloat(input.Value) }),
213
- };
214
- };
215
-
216
- const serializeAws_restJson1EdgeMetrics = (input: EdgeMetric[], context: __SerdeContext): any => {
217
- return input
218
- .filter((e: any) => e != null)
219
- .map((entry) => {
220
- if (entry === null) {
221
- return null as any;
222
- }
223
- return serializeAws_restJson1EdgeMetric(entry, context);
224
- });
225
- };
226
-
227
- const serializeAws_restJson1Model = (input: Model, context: __SerdeContext): any => {
228
- return {
229
- ...(input.LatestInference !== undefined &&
230
- input.LatestInference !== null && { LatestInference: Math.round(input.LatestInference.getTime() / 1000) }),
231
- ...(input.LatestSampleTime !== undefined &&
232
- input.LatestSampleTime !== null && { LatestSampleTime: Math.round(input.LatestSampleTime.getTime() / 1000) }),
233
- ...(input.ModelMetrics !== undefined &&
234
- input.ModelMetrics !== null && { ModelMetrics: serializeAws_restJson1EdgeMetrics(input.ModelMetrics, context) }),
235
- ...(input.ModelName !== undefined && input.ModelName !== null && { ModelName: input.ModelName }),
236
- ...(input.ModelVersion !== undefined && input.ModelVersion !== null && { ModelVersion: input.ModelVersion }),
237
- };
238
- };
239
-
240
- const serializeAws_restJson1Models = (input: Model[], context: __SerdeContext): any => {
241
- return input
242
- .filter((e: any) => e != null)
243
- .map((entry) => {
244
- if (entry === null) {
245
- return null as any;
246
- }
247
- return serializeAws_restJson1Model(entry, context);
248
- });
249
- };
250
-
251
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
252
- httpStatusCode: output.statusCode,
253
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
254
- extendedRequestId: output.headers["x-amz-id-2"],
255
- cfId: output.headers["x-amz-cf-id"],
256
- });
257
-
258
- // Collect low-level response body stream to Uint8Array.
259
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
260
- if (streamBody instanceof Uint8Array) {
261
- return Promise.resolve(streamBody);
262
- }
263
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
264
- };
265
-
266
- // Encode Uint8Array data into string with utf-8.
267
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
268
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
269
-
270
- const isSerializableHeaderValue = (value: any): boolean =>
271
- value !== undefined &&
272
- value !== null &&
273
- value !== "" &&
274
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
275
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
276
-
277
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
278
- collectBodyString(streamBody, context).then((encoded) => {
279
- if (encoded.length) {
280
- return JSON.parse(encoded);
281
- }
282
- return {};
283
- });
284
-
285
- /**
286
- * Load an error code for the aws.rest-json-1.1 protocol.
287
- */
288
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
289
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
290
-
291
- const sanitizeErrorCode = (rawValue: string): string => {
292
- let cleanValue = rawValue;
293
- if (cleanValue.indexOf(":") >= 0) {
294
- cleanValue = cleanValue.split(":")[0];
295
- }
296
- if (cleanValue.indexOf("#") >= 0) {
297
- cleanValue = cleanValue.split("#")[1];
298
- }
299
- return cleanValue;
300
- };
301
-
302
- const headerKey = findKey(output.headers, "x-amzn-errortype");
303
- if (headerKey !== undefined) {
304
- return sanitizeErrorCode(output.headers[headerKey]);
305
- }
306
-
307
- if (data.code !== undefined) {
308
- return sanitizeErrorCode(data.code);
309
- }
310
-
311
- if (data["__type"] !== undefined) {
312
- return sanitizeErrorCode(data["__type"]);
313
- }
314
-
315
- return "";
316
- };
@@ -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 { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient";
12
- import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
13
-
14
- /**
15
- * @internal
16
- */
17
- export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => {
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 { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient";
3
- import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
4
-
5
- /**
6
- * @internal
7
- */
8
- export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => {
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 { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient";
5
-
6
- /**
7
- * @internal
8
- */
9
- export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => ({
10
- apiVersion: "2020-09-23",
11
- disableHostPrefix: config?.disableHostPrefix ?? false,
12
- logger: config?.logger ?? ({} as __Logger),
13
- regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
14
- serviceId: config?.serviceId ?? "Sagemaker Edge",
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 { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient";
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: SagemakerEdgeClientConfig) => {
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,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "module": "esnext",
6
- "moduleResolution": "node",
7
- "lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
8
- "outDir": "dist/es"
9
- }
10
- }
package/tsconfig.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "alwaysStrict": true,
4
- "target": "ES2018",
5
- "module": "commonjs",
6
- "strict": true,
7
- "sourceMap": true,
8
- "downlevelIteration": true,
9
- "importHelpers": true,
10
- "noEmitHelpers": true,
11
- "incremental": true,
12
- "resolveJsonModule": true,
13
- "esModuleInterop": true,
14
- "outDir": "dist/cjs",
15
- "removeComments": true
16
- },
17
- "typedocOptions": {
18
- "exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"],
19
- "excludeNotExported": true,
20
- "excludePrivate": true,
21
- "hideGenerator": true,
22
- "ignoreCompilerErrors": true,
23
- "includeDeclarations": true,
24
- "stripInternal": true,
25
- "readme": "README.md",
26
- "mode": "file",
27
- "out": "docs",
28
- "theme": "minimal",
29
- "plugin": ["@aws-sdk/client-documentation-generator"]
30
- }
31
- }
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "compilerOptions": {
4
- "removeComments": false,
5
- "declaration": true,
6
- "declarationDir": "dist/types"
7
- }
8
- }