@aws-sdk/client-sagemaker-edge 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.
- package/CHANGELOG.md +47 -0
- package/{dist/cjs → dist-cjs}/SagemakerEdge.js +1 -5
- package/{dist/cjs → dist-cjs}/SagemakerEdgeClient.js +8 -17
- package/{dist/cjs → dist-cjs}/commands/GetDeviceRegistrationCommand.js +2 -27
- package/{dist/cjs → dist-cjs}/commands/SendHeartbeatCommand.js +2 -27
- package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
- package/{dist/cjs → dist-cjs}/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/models_0.js +0 -19
- package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +2 -8
- package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
- package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
- package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
- package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
- package/{dist/es → dist-es}/SagemakerEdge.js +2 -6
- package/{dist/es → dist-es}/SagemakerEdgeClient.js +2 -11
- package/{dist/es → dist-es}/commands/GetDeviceRegistrationCommand.js +4 -30
- package/{dist/es → dist-es}/commands/SendHeartbeatCommand.js +4 -30
- package/{dist/es → dist-es}/endpoints.js +1 -2
- package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
- package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
- package/{dist/es → dist-es}/models/models_0.js +0 -19
- package/{dist/es → dist-es}/protocols/Aws_restJson1.js +25 -31
- package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
- package/{dist/es → dist-es}/runtimeConfig.js +1 -5
- package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
- package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
- package/{dist/types → dist-types}/SagemakerEdge.d.ts +2 -2
- package/{dist/types → dist-types}/SagemakerEdgeClient.d.ts +3 -3
- package/{dist/types → dist-types}/commands/GetDeviceRegistrationCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/SendHeartbeatCommand.d.ts +3 -3
- package/{dist/types → dist-types}/endpoints.d.ts +0 -0
- package/{index.ts → dist-types/index.d.ts} +0 -0
- package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
- package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
- package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
- package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
- package/{dist/types → dist-types}/runtimeConfig.d.ts +1 -1
- package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
- package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/SagemakerEdge.d.ts +5 -11
- package/dist-types/ts3.4/SagemakerEdgeClient.d.ts +69 -0
- package/{dist/types → dist-types}/ts3.4/commands/GetDeviceRegistrationCommand.d.ts +5 -23
- package/dist-types/ts3.4/commands/SendHeartbeatCommand.d.ts +17 -0
- package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
- package/dist-types/ts3.4/models/models_0.d.ts +79 -0
- package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +2 -4
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
- package/package.json +52 -49
- package/SagemakerEdge.ts +0 -81
- package/SagemakerEdgeClient.ts +0 -240
- package/commands/GetDeviceRegistrationCommand.ts +0 -94
- package/commands/SendHeartbeatCommand.ts +0 -94
- package/dist/cjs/SagemakerEdge.js.map +0 -1
- package/dist/cjs/SagemakerEdgeClient.js.map +0 -1
- package/dist/cjs/commands/GetDeviceRegistrationCommand.js.map +0 -1
- package/dist/cjs/commands/SendHeartbeatCommand.js.map +0 -1
- package/dist/cjs/endpoints.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/models/index.js.map +0 -1
- package/dist/cjs/models/models_0.js.map +0 -1
- package/dist/cjs/package.json +0 -91
- package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
- package/dist/cjs/runtimeConfig.browser.js.map +0 -1
- package/dist/cjs/runtimeConfig.js.map +0 -1
- package/dist/cjs/runtimeConfig.native.js.map +0 -1
- package/dist/cjs/runtimeConfig.shared.js.map +0 -1
- package/dist/es/SagemakerEdge.js.map +0 -1
- package/dist/es/SagemakerEdgeClient.js.map +0 -1
- package/dist/es/commands/GetDeviceRegistrationCommand.js.map +0 -1
- package/dist/es/commands/SendHeartbeatCommand.js.map +0 -1
- package/dist/es/endpoints.js.map +0 -1
- package/dist/es/index.js +0 -6
- package/dist/es/index.js.map +0 -1
- package/dist/es/models/index.js +0 -2
- package/dist/es/models/index.js.map +0 -1
- package/dist/es/models/models_0.js.map +0 -1
- package/dist/es/package.json +0 -91
- package/dist/es/protocols/Aws_restJson1.js.map +0 -1
- package/dist/es/runtimeConfig.browser.js.map +0 -1
- package/dist/es/runtimeConfig.js.map +0 -1
- package/dist/es/runtimeConfig.native.js.map +0 -1
- package/dist/es/runtimeConfig.shared.js.map +0 -1
- package/dist/types/ts3.4/SagemakerEdgeClient.d.ts +0 -134
- package/dist/types/ts3.4/commands/SendHeartbeatCommand.d.ts +0 -35
- package/dist/types/ts3.4/models/models_0.d.ts +0 -134
- package/endpoints.ts +0 -57
- package/jest.config.js +0 -4
- package/models/models_0.ts +0 -171
- package/protocols/Aws_restJson1.ts +0 -316
- package/runtimeConfig.browser.ts +0 -40
- package/runtimeConfig.native.ts +0 -16
- package/runtimeConfig.shared.ts +0 -16
- package/runtimeConfig.ts +0 -45
- package/tsconfig.es.json +0 -12
- package/tsconfig.json +0 -32
|
@@ -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
|
-
};
|
package/runtimeConfig.browser.ts
DELETED
|
@@ -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
|
-
};
|
package/runtimeConfig.native.ts
DELETED
|
@@ -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
|
-
};
|
package/runtimeConfig.shared.ts
DELETED
|
@@ -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,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
|
-
}
|