@aws-sdk/client-sagemaker-runtime 3.489.0 → 3.495.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.
@@ -1,12 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SageMakerRuntimeServiceException = exports.__ServiceException = void 0;
4
- const smithy_client_1 = require("@smithy/smithy-client");
5
- Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return smithy_client_1.ServiceException; } });
6
- class SageMakerRuntimeServiceException extends smithy_client_1.ServiceException {
7
- constructor(options) {
8
- super(options);
9
- Object.setPrototypeOf(this, SageMakerRuntimeServiceException.prototype);
10
- }
11
- }
12
- exports.SageMakerRuntimeServiceException = SageMakerRuntimeServiceException;
1
+ module.exports = require("../index.js");
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./models_0"), exports);
1
+ module.exports = require("../index.js");
@@ -1,178 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvokeEndpointWithResponseStreamOutputFilterSensitiveLog = exports.ResponseStreamFilterSensitiveLog = exports.PayloadPartFilterSensitiveLog = exports.InvokeEndpointWithResponseStreamInputFilterSensitiveLog = exports.InvokeEndpointAsyncInputFilterSensitiveLog = exports.InvokeEndpointOutputFilterSensitiveLog = exports.InvokeEndpointInputFilterSensitiveLog = exports.ResponseStream = exports.ModelStreamError = exports.InternalStreamFailure = exports.ValidationError = exports.ServiceUnavailable = exports.ModelNotReadyException = exports.ModelError = exports.InternalFailure = exports.InternalDependencyException = void 0;
4
- const smithy_client_1 = require("@smithy/smithy-client");
5
- const SageMakerRuntimeServiceException_1 = require("./SageMakerRuntimeServiceException");
6
- class InternalDependencyException extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
7
- constructor(opts) {
8
- super({
9
- name: "InternalDependencyException",
10
- $fault: "server",
11
- ...opts,
12
- });
13
- this.name = "InternalDependencyException";
14
- this.$fault = "server";
15
- Object.setPrototypeOf(this, InternalDependencyException.prototype);
16
- this.Message = opts.Message;
17
- }
18
- }
19
- exports.InternalDependencyException = InternalDependencyException;
20
- class InternalFailure extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
21
- constructor(opts) {
22
- super({
23
- name: "InternalFailure",
24
- $fault: "server",
25
- ...opts,
26
- });
27
- this.name = "InternalFailure";
28
- this.$fault = "server";
29
- Object.setPrototypeOf(this, InternalFailure.prototype);
30
- this.Message = opts.Message;
31
- }
32
- }
33
- exports.InternalFailure = InternalFailure;
34
- class ModelError extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
35
- constructor(opts) {
36
- super({
37
- name: "ModelError",
38
- $fault: "client",
39
- ...opts,
40
- });
41
- this.name = "ModelError";
42
- this.$fault = "client";
43
- Object.setPrototypeOf(this, ModelError.prototype);
44
- this.Message = opts.Message;
45
- this.OriginalStatusCode = opts.OriginalStatusCode;
46
- this.OriginalMessage = opts.OriginalMessage;
47
- this.LogStreamArn = opts.LogStreamArn;
48
- }
49
- }
50
- exports.ModelError = ModelError;
51
- class ModelNotReadyException extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
52
- constructor(opts) {
53
- super({
54
- name: "ModelNotReadyException",
55
- $fault: "client",
56
- ...opts,
57
- });
58
- this.name = "ModelNotReadyException";
59
- this.$fault = "client";
60
- Object.setPrototypeOf(this, ModelNotReadyException.prototype);
61
- this.Message = opts.Message;
62
- }
63
- }
64
- exports.ModelNotReadyException = ModelNotReadyException;
65
- class ServiceUnavailable extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
66
- constructor(opts) {
67
- super({
68
- name: "ServiceUnavailable",
69
- $fault: "server",
70
- ...opts,
71
- });
72
- this.name = "ServiceUnavailable";
73
- this.$fault = "server";
74
- Object.setPrototypeOf(this, ServiceUnavailable.prototype);
75
- this.Message = opts.Message;
76
- }
77
- }
78
- exports.ServiceUnavailable = ServiceUnavailable;
79
- class ValidationError extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
80
- constructor(opts) {
81
- super({
82
- name: "ValidationError",
83
- $fault: "client",
84
- ...opts,
85
- });
86
- this.name = "ValidationError";
87
- this.$fault = "client";
88
- Object.setPrototypeOf(this, ValidationError.prototype);
89
- this.Message = opts.Message;
90
- }
91
- }
92
- exports.ValidationError = ValidationError;
93
- class InternalStreamFailure extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
94
- constructor(opts) {
95
- super({
96
- name: "InternalStreamFailure",
97
- $fault: "server",
98
- ...opts,
99
- });
100
- this.name = "InternalStreamFailure";
101
- this.$fault = "server";
102
- Object.setPrototypeOf(this, InternalStreamFailure.prototype);
103
- this.Message = opts.Message;
104
- }
105
- }
106
- exports.InternalStreamFailure = InternalStreamFailure;
107
- class ModelStreamError extends SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException {
108
- constructor(opts) {
109
- super({
110
- name: "ModelStreamError",
111
- $fault: "client",
112
- ...opts,
113
- });
114
- this.name = "ModelStreamError";
115
- this.$fault = "client";
116
- Object.setPrototypeOf(this, ModelStreamError.prototype);
117
- this.Message = opts.Message;
118
- this.ErrorCode = opts.ErrorCode;
119
- }
120
- }
121
- exports.ModelStreamError = ModelStreamError;
122
- var ResponseStream;
123
- (function (ResponseStream) {
124
- ResponseStream.visit = (value, visitor) => {
125
- if (value.PayloadPart !== undefined)
126
- return visitor.PayloadPart(value.PayloadPart);
127
- if (value.ModelStreamError !== undefined)
128
- return visitor.ModelStreamError(value.ModelStreamError);
129
- if (value.InternalStreamFailure !== undefined)
130
- return visitor.InternalStreamFailure(value.InternalStreamFailure);
131
- return visitor._(value.$unknown[0], value.$unknown[1]);
132
- };
133
- })(ResponseStream = exports.ResponseStream || (exports.ResponseStream = {}));
134
- const InvokeEndpointInputFilterSensitiveLog = (obj) => ({
135
- ...obj,
136
- ...(obj.Body && { Body: smithy_client_1.SENSITIVE_STRING }),
137
- ...(obj.CustomAttributes && { CustomAttributes: smithy_client_1.SENSITIVE_STRING }),
138
- });
139
- exports.InvokeEndpointInputFilterSensitiveLog = InvokeEndpointInputFilterSensitiveLog;
140
- const InvokeEndpointOutputFilterSensitiveLog = (obj) => ({
141
- ...obj,
142
- ...(obj.Body && { Body: smithy_client_1.SENSITIVE_STRING }),
143
- ...(obj.CustomAttributes && { CustomAttributes: smithy_client_1.SENSITIVE_STRING }),
144
- });
145
- exports.InvokeEndpointOutputFilterSensitiveLog = InvokeEndpointOutputFilterSensitiveLog;
146
- const InvokeEndpointAsyncInputFilterSensitiveLog = (obj) => ({
147
- ...obj,
148
- ...(obj.CustomAttributes && { CustomAttributes: smithy_client_1.SENSITIVE_STRING }),
149
- });
150
- exports.InvokeEndpointAsyncInputFilterSensitiveLog = InvokeEndpointAsyncInputFilterSensitiveLog;
151
- const InvokeEndpointWithResponseStreamInputFilterSensitiveLog = (obj) => ({
152
- ...obj,
153
- ...(obj.Body && { Body: smithy_client_1.SENSITIVE_STRING }),
154
- ...(obj.CustomAttributes && { CustomAttributes: smithy_client_1.SENSITIVE_STRING }),
155
- });
156
- exports.InvokeEndpointWithResponseStreamInputFilterSensitiveLog = InvokeEndpointWithResponseStreamInputFilterSensitiveLog;
157
- const PayloadPartFilterSensitiveLog = (obj) => ({
158
- ...obj,
159
- ...(obj.Bytes && { Bytes: smithy_client_1.SENSITIVE_STRING }),
160
- });
161
- exports.PayloadPartFilterSensitiveLog = PayloadPartFilterSensitiveLog;
162
- const ResponseStreamFilterSensitiveLog = (obj) => {
163
- if (obj.PayloadPart !== undefined)
164
- return { PayloadPart: (0, exports.PayloadPartFilterSensitiveLog)(obj.PayloadPart) };
165
- if (obj.ModelStreamError !== undefined)
166
- return { ModelStreamError: obj.ModelStreamError };
167
- if (obj.InternalStreamFailure !== undefined)
168
- return { InternalStreamFailure: obj.InternalStreamFailure };
169
- if (obj.$unknown !== undefined)
170
- return { [obj.$unknown[0]]: "UNKNOWN" };
171
- };
172
- exports.ResponseStreamFilterSensitiveLog = ResponseStreamFilterSensitiveLog;
173
- const InvokeEndpointWithResponseStreamOutputFilterSensitiveLog = (obj) => ({
174
- ...obj,
175
- ...(obj.Body && { Body: "STREAMING_CONTENT" }),
176
- ...(obj.CustomAttributes && { CustomAttributes: smithy_client_1.SENSITIVE_STRING }),
177
- });
178
- exports.InvokeEndpointWithResponseStreamOutputFilterSensitiveLog = InvokeEndpointWithResponseStreamOutputFilterSensitiveLog;
1
+ module.exports = require("../index.js");
@@ -1,441 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_InvokeEndpointWithResponseStreamCommand = exports.de_InvokeEndpointAsyncCommand = exports.de_InvokeEndpointCommand = exports.se_InvokeEndpointWithResponseStreamCommand = exports.se_InvokeEndpointAsyncCommand = exports.se_InvokeEndpointCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const models_0_1 = require("../models/models_0");
7
- const SageMakerRuntimeServiceException_1 = require("../models/SageMakerRuntimeServiceException");
8
- const se_InvokeEndpointCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
11
- [_ct]: input[_CT] || "application/octet-stream",
12
- [_a]: input[_A],
13
- [_xasca]: input[_CA],
14
- [_xastm]: input[_TM],
15
- [_xastv]: input[_TV],
16
- [_xastch]: input[_TCH],
17
- [_xasii]: input[_II],
18
- [_xasee]: input[_EE],
19
- [_xasic]: input[_ICN],
20
- });
21
- b.bp("/endpoints/{EndpointName}/invocations");
22
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
23
- let body;
24
- if (input.Body !== undefined) {
25
- body = input.Body;
26
- }
27
- b.m("POST").h(headers).b(body);
28
- return b.build();
29
- };
30
- exports.se_InvokeEndpointCommand = se_InvokeEndpointCommand;
31
- const se_InvokeEndpointAsyncCommand = async (input, context) => {
32
- const b = (0, core_1.requestBuilder)(input, context);
33
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
34
- [_xasct]: input[_CT],
35
- [_xasa]: input[_A],
36
- [_xasca]: input[_CA],
37
- [_xasii]: input[_II],
38
- [_xasi]: input[_IL],
39
- [_xasr]: [() => isSerializableHeaderValue(input[_RTTLS]), () => input[_RTTLS].toString()],
40
- [_xasi_]: [() => isSerializableHeaderValue(input[_ITS]), () => input[_ITS].toString()],
41
- });
42
- b.bp("/endpoints/{EndpointName}/async-invocations");
43
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
44
- let body;
45
- b.m("POST").h(headers).b(body);
46
- return b.build();
47
- };
48
- exports.se_InvokeEndpointAsyncCommand = se_InvokeEndpointAsyncCommand;
49
- const se_InvokeEndpointWithResponseStreamCommand = async (input, context) => {
50
- const b = (0, core_1.requestBuilder)(input, context);
51
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
52
- [_ct]: input[_CT] || "application/octet-stream",
53
- [_xasa]: input[_A],
54
- [_xasca]: input[_CA],
55
- [_xastv]: input[_TV],
56
- [_xastch]: input[_TCH],
57
- [_xasii]: input[_II],
58
- [_xasic]: input[_ICN],
59
- });
60
- b.bp("/endpoints/{EndpointName}/invocations-response-stream");
61
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
62
- let body;
63
- if (input.Body !== undefined) {
64
- body = input.Body;
65
- }
66
- b.m("POST").h(headers).b(body);
67
- return b.build();
68
- };
69
- exports.se_InvokeEndpointWithResponseStreamCommand = se_InvokeEndpointWithResponseStreamCommand;
70
- const de_InvokeEndpointCommand = async (output, context) => {
71
- if (output.statusCode !== 200 && output.statusCode >= 300) {
72
- return de_InvokeEndpointCommandError(output, context);
73
- }
74
- const contents = (0, smithy_client_1.map)({
75
- $metadata: deserializeMetadata(output),
76
- [_CT]: [, output.headers[_ct]],
77
- [_IPV]: [, output.headers[_xaipv]],
78
- [_CA]: [, output.headers[_xasca]],
79
- });
80
- const data = await (0, smithy_client_1.collectBody)(output.body, context);
81
- contents.Body = data;
82
- return contents;
83
- };
84
- exports.de_InvokeEndpointCommand = de_InvokeEndpointCommand;
85
- const de_InvokeEndpointCommandError = async (output, context) => {
86
- const parsedOutput = {
87
- ...output,
88
- body: await parseErrorBody(output.body, context),
89
- };
90
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
91
- switch (errorCode) {
92
- case "InternalDependencyException":
93
- case "com.amazonaws.sagemakerruntime#InternalDependencyException":
94
- throw await de_InternalDependencyExceptionRes(parsedOutput, context);
95
- case "InternalFailure":
96
- case "com.amazonaws.sagemakerruntime#InternalFailure":
97
- throw await de_InternalFailureRes(parsedOutput, context);
98
- case "ModelError":
99
- case "com.amazonaws.sagemakerruntime#ModelError":
100
- throw await de_ModelErrorRes(parsedOutput, context);
101
- case "ModelNotReadyException":
102
- case "com.amazonaws.sagemakerruntime#ModelNotReadyException":
103
- throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
104
- case "ServiceUnavailable":
105
- case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
106
- throw await de_ServiceUnavailableRes(parsedOutput, context);
107
- case "ValidationError":
108
- case "com.amazonaws.sagemakerruntime#ValidationError":
109
- throw await de_ValidationErrorRes(parsedOutput, context);
110
- default:
111
- const parsedBody = parsedOutput.body;
112
- return throwDefaultError({
113
- output,
114
- parsedBody,
115
- errorCode,
116
- });
117
- }
118
- };
119
- const de_InvokeEndpointAsyncCommand = async (output, context) => {
120
- if (output.statusCode !== 202 && output.statusCode >= 300) {
121
- return de_InvokeEndpointAsyncCommandError(output, context);
122
- }
123
- const contents = (0, smithy_client_1.map)({
124
- $metadata: deserializeMetadata(output),
125
- [_OL]: [, output.headers[_xaso]],
126
- [_FL]: [, output.headers[_xasf]],
127
- });
128
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
129
- const doc = (0, smithy_client_1.take)(data, {
130
- InferenceId: smithy_client_1.expectString,
131
- });
132
- Object.assign(contents, doc);
133
- return contents;
134
- };
135
- exports.de_InvokeEndpointAsyncCommand = de_InvokeEndpointAsyncCommand;
136
- const de_InvokeEndpointAsyncCommandError = async (output, context) => {
137
- const parsedOutput = {
138
- ...output,
139
- body: await parseErrorBody(output.body, context),
140
- };
141
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
142
- switch (errorCode) {
143
- case "InternalFailure":
144
- case "com.amazonaws.sagemakerruntime#InternalFailure":
145
- throw await de_InternalFailureRes(parsedOutput, context);
146
- case "ServiceUnavailable":
147
- case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
148
- throw await de_ServiceUnavailableRes(parsedOutput, context);
149
- case "ValidationError":
150
- case "com.amazonaws.sagemakerruntime#ValidationError":
151
- throw await de_ValidationErrorRes(parsedOutput, context);
152
- default:
153
- const parsedBody = parsedOutput.body;
154
- return throwDefaultError({
155
- output,
156
- parsedBody,
157
- errorCode,
158
- });
159
- }
160
- };
161
- const de_InvokeEndpointWithResponseStreamCommand = async (output, context) => {
162
- if (output.statusCode !== 200 && output.statusCode >= 300) {
163
- return de_InvokeEndpointWithResponseStreamCommandError(output, context);
164
- }
165
- const contents = (0, smithy_client_1.map)({
166
- $metadata: deserializeMetadata(output),
167
- [_CT]: [, output.headers[_xasct]],
168
- [_IPV]: [, output.headers[_xaipv]],
169
- [_CA]: [, output.headers[_xasca]],
170
- });
171
- const data = output.body;
172
- contents.Body = de_ResponseStream(data, context);
173
- return contents;
174
- };
175
- exports.de_InvokeEndpointWithResponseStreamCommand = de_InvokeEndpointWithResponseStreamCommand;
176
- const de_InvokeEndpointWithResponseStreamCommandError = async (output, context) => {
177
- const parsedOutput = {
178
- ...output,
179
- body: await parseErrorBody(output.body, context),
180
- };
181
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
182
- switch (errorCode) {
183
- case "InternalFailure":
184
- case "com.amazonaws.sagemakerruntime#InternalFailure":
185
- throw await de_InternalFailureRes(parsedOutput, context);
186
- case "InternalStreamFailure":
187
- case "com.amazonaws.sagemakerruntime#InternalStreamFailure":
188
- throw await de_InternalStreamFailureRes(parsedOutput, context);
189
- case "ModelError":
190
- case "com.amazonaws.sagemakerruntime#ModelError":
191
- throw await de_ModelErrorRes(parsedOutput, context);
192
- case "ModelStreamError":
193
- case "com.amazonaws.sagemakerruntime#ModelStreamError":
194
- throw await de_ModelStreamErrorRes(parsedOutput, context);
195
- case "ServiceUnavailable":
196
- case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
197
- throw await de_ServiceUnavailableRes(parsedOutput, context);
198
- case "ValidationError":
199
- case "com.amazonaws.sagemakerruntime#ValidationError":
200
- throw await de_ValidationErrorRes(parsedOutput, context);
201
- default:
202
- const parsedBody = parsedOutput.body;
203
- return throwDefaultError({
204
- output,
205
- parsedBody,
206
- errorCode,
207
- });
208
- }
209
- };
210
- const throwDefaultError = (0, smithy_client_1.withBaseException)(SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException);
211
- const de_InternalDependencyExceptionRes = async (parsedOutput, context) => {
212
- const contents = (0, smithy_client_1.map)({});
213
- const data = parsedOutput.body;
214
- const doc = (0, smithy_client_1.take)(data, {
215
- Message: smithy_client_1.expectString,
216
- });
217
- Object.assign(contents, doc);
218
- const exception = new models_0_1.InternalDependencyException({
219
- $metadata: deserializeMetadata(parsedOutput),
220
- ...contents,
221
- });
222
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
223
- };
224
- const de_InternalFailureRes = async (parsedOutput, context) => {
225
- const contents = (0, smithy_client_1.map)({});
226
- const data = parsedOutput.body;
227
- const doc = (0, smithy_client_1.take)(data, {
228
- Message: smithy_client_1.expectString,
229
- });
230
- Object.assign(contents, doc);
231
- const exception = new models_0_1.InternalFailure({
232
- $metadata: deserializeMetadata(parsedOutput),
233
- ...contents,
234
- });
235
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
236
- };
237
- const de_InternalStreamFailureRes = async (parsedOutput, context) => {
238
- const contents = (0, smithy_client_1.map)({});
239
- const data = parsedOutput.body;
240
- const doc = (0, smithy_client_1.take)(data, {
241
- Message: smithy_client_1.expectString,
242
- });
243
- Object.assign(contents, doc);
244
- const exception = new models_0_1.InternalStreamFailure({
245
- $metadata: deserializeMetadata(parsedOutput),
246
- ...contents,
247
- });
248
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
249
- };
250
- const de_ModelErrorRes = async (parsedOutput, context) => {
251
- const contents = (0, smithy_client_1.map)({});
252
- const data = parsedOutput.body;
253
- const doc = (0, smithy_client_1.take)(data, {
254
- LogStreamArn: smithy_client_1.expectString,
255
- Message: smithy_client_1.expectString,
256
- OriginalMessage: smithy_client_1.expectString,
257
- OriginalStatusCode: smithy_client_1.expectInt32,
258
- });
259
- Object.assign(contents, doc);
260
- const exception = new models_0_1.ModelError({
261
- $metadata: deserializeMetadata(parsedOutput),
262
- ...contents,
263
- });
264
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
265
- };
266
- const de_ModelNotReadyExceptionRes = async (parsedOutput, context) => {
267
- const contents = (0, smithy_client_1.map)({});
268
- const data = parsedOutput.body;
269
- const doc = (0, smithy_client_1.take)(data, {
270
- Message: smithy_client_1.expectString,
271
- });
272
- Object.assign(contents, doc);
273
- const exception = new models_0_1.ModelNotReadyException({
274
- $metadata: deserializeMetadata(parsedOutput),
275
- ...contents,
276
- });
277
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
278
- };
279
- const de_ModelStreamErrorRes = async (parsedOutput, context) => {
280
- const contents = (0, smithy_client_1.map)({});
281
- const data = parsedOutput.body;
282
- const doc = (0, smithy_client_1.take)(data, {
283
- ErrorCode: smithy_client_1.expectString,
284
- Message: smithy_client_1.expectString,
285
- });
286
- Object.assign(contents, doc);
287
- const exception = new models_0_1.ModelStreamError({
288
- $metadata: deserializeMetadata(parsedOutput),
289
- ...contents,
290
- });
291
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
292
- };
293
- const de_ServiceUnavailableRes = async (parsedOutput, context) => {
294
- const contents = (0, smithy_client_1.map)({});
295
- const data = parsedOutput.body;
296
- const doc = (0, smithy_client_1.take)(data, {
297
- Message: smithy_client_1.expectString,
298
- });
299
- Object.assign(contents, doc);
300
- const exception = new models_0_1.ServiceUnavailable({
301
- $metadata: deserializeMetadata(parsedOutput),
302
- ...contents,
303
- });
304
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
305
- };
306
- const de_ValidationErrorRes = async (parsedOutput, context) => {
307
- const contents = (0, smithy_client_1.map)({});
308
- const data = parsedOutput.body;
309
- const doc = (0, smithy_client_1.take)(data, {
310
- Message: smithy_client_1.expectString,
311
- });
312
- Object.assign(contents, doc);
313
- const exception = new models_0_1.ValidationError({
314
- $metadata: deserializeMetadata(parsedOutput),
315
- ...contents,
316
- });
317
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
318
- };
319
- const de_ResponseStream = (output, context) => {
320
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
321
- if (event["PayloadPart"] != null) {
322
- return {
323
- PayloadPart: await de_PayloadPart_event(event["PayloadPart"], context),
324
- };
325
- }
326
- if (event["ModelStreamError"] != null) {
327
- return {
328
- ModelStreamError: await de_ModelStreamError_event(event["ModelStreamError"], context),
329
- };
330
- }
331
- if (event["InternalStreamFailure"] != null) {
332
- return {
333
- InternalStreamFailure: await de_InternalStreamFailure_event(event["InternalStreamFailure"], context),
334
- };
335
- }
336
- return { $unknown: output };
337
- });
338
- };
339
- const de_InternalStreamFailure_event = async (output, context) => {
340
- const parsedOutput = {
341
- ...output,
342
- body: await parseBody(output.body, context),
343
- };
344
- return de_InternalStreamFailureRes(parsedOutput, context);
345
- };
346
- const de_ModelStreamError_event = async (output, context) => {
347
- const parsedOutput = {
348
- ...output,
349
- body: await parseBody(output.body, context),
350
- };
351
- return de_ModelStreamErrorRes(parsedOutput, context);
352
- };
353
- const de_PayloadPart_event = async (output, context) => {
354
- const contents = {};
355
- contents.Bytes = output.body;
356
- return contents;
357
- };
358
- const deserializeMetadata = (output) => ({
359
- httpStatusCode: output.statusCode,
360
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
361
- extendedRequestId: output.headers["x-amz-id-2"],
362
- cfId: output.headers["x-amz-cf-id"],
363
- });
364
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
365
- const isSerializableHeaderValue = (value) => value !== undefined &&
366
- value !== null &&
367
- value !== "" &&
368
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
369
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
370
- const _A = "Accept";
371
- const _CA = "CustomAttributes";
372
- const _CT = "ContentType";
373
- const _EE = "EnableExplanations";
374
- const _FL = "FailureLocation";
375
- const _ICN = "InferenceComponentName";
376
- const _II = "InferenceId";
377
- const _IL = "InputLocation";
378
- const _IPV = "InvokedProductionVariant";
379
- const _ITS = "InvocationTimeoutSeconds";
380
- const _OL = "OutputLocation";
381
- const _RTTLS = "RequestTTLSeconds";
382
- const _TCH = "TargetContainerHostname";
383
- const _TM = "TargetModel";
384
- const _TV = "TargetVariant";
385
- const _a = "accept";
386
- const _ct = "content-type";
387
- const _xaipv = "x-amzn-invoked-production-variant";
388
- const _xasa = "x-amzn-sagemaker-accept";
389
- const _xasca = "x-amzn-sagemaker-custom-attributes";
390
- const _xasct = "x-amzn-sagemaker-content-type";
391
- const _xasee = "x-amzn-sagemaker-enable-explanations";
392
- const _xasf = "x-amzn-sagemaker-failurelocation";
393
- const _xasi = "x-amzn-sagemaker-inputlocation";
394
- const _xasi_ = "x-amzn-sagemaker-invocationtimeoutseconds";
395
- const _xasic = "x-amzn-sagemaker-inference-component";
396
- const _xasii = "x-amzn-sagemaker-inference-id";
397
- const _xaso = "x-amzn-sagemaker-outputlocation";
398
- const _xasr = "x-amzn-sagemaker-requestttlseconds";
399
- const _xastch = "x-amzn-sagemaker-target-container-hostname";
400
- const _xastm = "x-amzn-sagemaker-target-model";
401
- const _xastv = "x-amzn-sagemaker-target-variant";
402
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
403
- if (encoded.length) {
404
- return JSON.parse(encoded);
405
- }
406
- return {};
407
- });
408
- const parseErrorBody = async (errorBody, context) => {
409
- const value = await parseBody(errorBody, context);
410
- value.message = value.message ?? value.Message;
411
- return value;
412
- };
413
- const loadRestJsonErrorCode = (output, data) => {
414
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
415
- const sanitizeErrorCode = (rawValue) => {
416
- let cleanValue = rawValue;
417
- if (typeof cleanValue === "number") {
418
- cleanValue = cleanValue.toString();
419
- }
420
- if (cleanValue.indexOf(",") >= 0) {
421
- cleanValue = cleanValue.split(",")[0];
422
- }
423
- if (cleanValue.indexOf(":") >= 0) {
424
- cleanValue = cleanValue.split(":")[0];
425
- }
426
- if (cleanValue.indexOf("#") >= 0) {
427
- cleanValue = cleanValue.split("#")[1];
428
- }
429
- return cleanValue;
430
- };
431
- const headerKey = findKey(output.headers, "x-amzn-errortype");
432
- if (headerKey !== undefined) {
433
- return sanitizeErrorCode(output.headers[headerKey]);
434
- }
435
- if (data.code !== undefined) {
436
- return sanitizeErrorCode(data.code);
437
- }
438
- if (data["__type"] !== undefined) {
439
- return sanitizeErrorCode(data["__type"]);
440
- }
441
- };
1
+ module.exports = require("../index.js");
@@ -1,22 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveRuntimeExtensions = void 0;
4
- const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
5
- const protocol_http_1 = require("@smithy/protocol-http");
6
- const smithy_client_1 = require("@smithy/smithy-client");
7
- const asPartial = (t) => t;
8
- const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
9
- const extensionConfiguration = {
10
- ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
11
- ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
12
- ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
13
- };
14
- extensions.forEach((extension) => extension.configure(extensionConfiguration));
15
- return {
16
- ...runtimeConfig,
17
- ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
18
- ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
19
- ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
20
- };
21
- };
22
- exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
1
+ module.exports = require("./index.js");