@aws-sdk/client-sagemaker-runtime 3.490.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.
package/dist-cjs/index.js CHANGED
@@ -1,11 +1,884 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SageMakerRuntimeServiceException = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./SageMakerRuntimeClient"), exports);
6
- tslib_1.__exportStar(require("./SageMakerRuntime"), exports);
7
- tslib_1.__exportStar(require("./commands"), exports);
8
- tslib_1.__exportStar(require("./models"), exports);
9
- require("@aws-sdk/util-endpoints");
10
- var SageMakerRuntimeServiceException_1 = require("./models/SageMakerRuntimeServiceException");
11
- Object.defineProperty(exports, "SageMakerRuntimeServiceException", { enumerable: true, get: function () { return SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException; } });
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ InternalDependencyException: () => InternalDependencyException,
25
+ InternalFailure: () => InternalFailure,
26
+ InternalStreamFailure: () => InternalStreamFailure,
27
+ InvokeEndpointAsyncCommand: () => InvokeEndpointAsyncCommand,
28
+ InvokeEndpointAsyncInputFilterSensitiveLog: () => InvokeEndpointAsyncInputFilterSensitiveLog,
29
+ InvokeEndpointCommand: () => InvokeEndpointCommand,
30
+ InvokeEndpointInputFilterSensitiveLog: () => InvokeEndpointInputFilterSensitiveLog,
31
+ InvokeEndpointOutputFilterSensitiveLog: () => InvokeEndpointOutputFilterSensitiveLog,
32
+ InvokeEndpointWithResponseStreamCommand: () => InvokeEndpointWithResponseStreamCommand,
33
+ InvokeEndpointWithResponseStreamInputFilterSensitiveLog: () => InvokeEndpointWithResponseStreamInputFilterSensitiveLog,
34
+ InvokeEndpointWithResponseStreamOutputFilterSensitiveLog: () => InvokeEndpointWithResponseStreamOutputFilterSensitiveLog,
35
+ ModelError: () => ModelError,
36
+ ModelNotReadyException: () => ModelNotReadyException,
37
+ ModelStreamError: () => ModelStreamError,
38
+ PayloadPartFilterSensitiveLog: () => PayloadPartFilterSensitiveLog,
39
+ ResponseStream: () => ResponseStream,
40
+ ResponseStreamFilterSensitiveLog: () => ResponseStreamFilterSensitiveLog,
41
+ SageMakerRuntime: () => SageMakerRuntime,
42
+ SageMakerRuntimeClient: () => SageMakerRuntimeClient,
43
+ SageMakerRuntimeServiceException: () => SageMakerRuntimeServiceException,
44
+ ServiceUnavailable: () => ServiceUnavailable,
45
+ ValidationError: () => ValidationError,
46
+ __Client: () => import_smithy_client.Client
47
+ });
48
+ module.exports = __toCommonJS(src_exports);
49
+
50
+ // src/SageMakerRuntimeClient.ts
51
+ var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
52
+ var import_middleware_logger = require("@aws-sdk/middleware-logger");
53
+ var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
54
+ var import_middleware_signing = require("@aws-sdk/middleware-signing");
55
+ var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
56
+ var import_config_resolver = require("@smithy/config-resolver");
57
+ var import_eventstream_serde_config_resolver = require("@smithy/eventstream-serde-config-resolver");
58
+ var import_middleware_content_length = require("@smithy/middleware-content-length");
59
+ var import_middleware_endpoint = require("@smithy/middleware-endpoint");
60
+ var import_middleware_retry = require("@smithy/middleware-retry");
61
+
62
+
63
+ // src/endpoint/EndpointParameters.ts
64
+ var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
65
+ return {
66
+ ...options,
67
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
68
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
69
+ defaultSigningName: "sagemaker"
70
+ };
71
+ }, "resolveClientEndpointParameters");
72
+ var commonParams = {
73
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
74
+ Endpoint: { type: "builtInParams", name: "endpoint" },
75
+ Region: { type: "builtInParams", name: "region" },
76
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
77
+ };
78
+
79
+ // src/SageMakerRuntimeClient.ts
80
+ var import_runtimeConfig = require("././runtimeConfig");
81
+
82
+ // src/runtimeExtensions.ts
83
+ var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
84
+ var import_protocol_http = require("@smithy/protocol-http");
85
+ var import_smithy_client = require("@smithy/smithy-client");
86
+ var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial");
87
+ var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
88
+ const extensionConfiguration = {
89
+ ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)),
90
+ ...asPartial((0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig)),
91
+ ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig))
92
+ };
93
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
94
+ return {
95
+ ...runtimeConfig,
96
+ ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
97
+ ...(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
98
+ ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration)
99
+ };
100
+ }, "resolveRuntimeExtensions");
101
+
102
+ // src/SageMakerRuntimeClient.ts
103
+ var _SageMakerRuntimeClient = class _SageMakerRuntimeClient extends import_smithy_client.Client {
104
+ constructor(...[configuration]) {
105
+ const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {});
106
+ const _config_1 = resolveClientEndpointParameters(_config_0);
107
+ const _config_2 = (0, import_config_resolver.resolveRegionConfig)(_config_1);
108
+ const _config_3 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_2);
109
+ const _config_4 = (0, import_middleware_retry.resolveRetryConfig)(_config_3);
110
+ const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
111
+ const _config_6 = (0, import_middleware_signing.resolveAwsAuthConfig)(_config_5);
112
+ const _config_7 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_6);
113
+ const _config_8 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_7);
114
+ const _config_9 = resolveRuntimeExtensions(_config_8, (configuration == null ? void 0 : configuration.extensions) || []);
115
+ super(_config_9);
116
+ this.config = _config_9;
117
+ this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
118
+ this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
119
+ this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
120
+ this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
121
+ this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
122
+ this.middlewareStack.use((0, import_middleware_signing.getAwsAuthPlugin)(this.config));
123
+ this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
124
+ }
125
+ /**
126
+ * Destroy underlying resources, like sockets. It's usually not necessary to do this.
127
+ * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
128
+ * Otherwise, sockets might stay open for quite a long time before the server terminates them.
129
+ */
130
+ destroy() {
131
+ super.destroy();
132
+ }
133
+ };
134
+ __name(_SageMakerRuntimeClient, "SageMakerRuntimeClient");
135
+ var SageMakerRuntimeClient = _SageMakerRuntimeClient;
136
+
137
+ // src/SageMakerRuntime.ts
138
+
139
+
140
+ // src/commands/InvokeEndpointAsyncCommand.ts
141
+
142
+ var import_middleware_serde = require("@smithy/middleware-serde");
143
+
144
+ var import_types = require("@smithy/types");
145
+
146
+ // src/models/models_0.ts
147
+
148
+
149
+ // src/models/SageMakerRuntimeServiceException.ts
150
+
151
+ var _SageMakerRuntimeServiceException = class _SageMakerRuntimeServiceException extends import_smithy_client.ServiceException {
152
+ /**
153
+ * @internal
154
+ */
155
+ constructor(options) {
156
+ super(options);
157
+ Object.setPrototypeOf(this, _SageMakerRuntimeServiceException.prototype);
158
+ }
159
+ };
160
+ __name(_SageMakerRuntimeServiceException, "SageMakerRuntimeServiceException");
161
+ var SageMakerRuntimeServiceException = _SageMakerRuntimeServiceException;
162
+
163
+ // src/models/models_0.ts
164
+ var _InternalDependencyException = class _InternalDependencyException extends SageMakerRuntimeServiceException {
165
+ /**
166
+ * @internal
167
+ */
168
+ constructor(opts) {
169
+ super({
170
+ name: "InternalDependencyException",
171
+ $fault: "server",
172
+ ...opts
173
+ });
174
+ this.name = "InternalDependencyException";
175
+ this.$fault = "server";
176
+ Object.setPrototypeOf(this, _InternalDependencyException.prototype);
177
+ this.Message = opts.Message;
178
+ }
179
+ };
180
+ __name(_InternalDependencyException, "InternalDependencyException");
181
+ var InternalDependencyException = _InternalDependencyException;
182
+ var _InternalFailure = class _InternalFailure extends SageMakerRuntimeServiceException {
183
+ /**
184
+ * @internal
185
+ */
186
+ constructor(opts) {
187
+ super({
188
+ name: "InternalFailure",
189
+ $fault: "server",
190
+ ...opts
191
+ });
192
+ this.name = "InternalFailure";
193
+ this.$fault = "server";
194
+ Object.setPrototypeOf(this, _InternalFailure.prototype);
195
+ this.Message = opts.Message;
196
+ }
197
+ };
198
+ __name(_InternalFailure, "InternalFailure");
199
+ var InternalFailure = _InternalFailure;
200
+ var _ModelError = class _ModelError extends SageMakerRuntimeServiceException {
201
+ /**
202
+ * @internal
203
+ */
204
+ constructor(opts) {
205
+ super({
206
+ name: "ModelError",
207
+ $fault: "client",
208
+ ...opts
209
+ });
210
+ this.name = "ModelError";
211
+ this.$fault = "client";
212
+ Object.setPrototypeOf(this, _ModelError.prototype);
213
+ this.Message = opts.Message;
214
+ this.OriginalStatusCode = opts.OriginalStatusCode;
215
+ this.OriginalMessage = opts.OriginalMessage;
216
+ this.LogStreamArn = opts.LogStreamArn;
217
+ }
218
+ };
219
+ __name(_ModelError, "ModelError");
220
+ var ModelError = _ModelError;
221
+ var _ModelNotReadyException = class _ModelNotReadyException extends SageMakerRuntimeServiceException {
222
+ /**
223
+ * @internal
224
+ */
225
+ constructor(opts) {
226
+ super({
227
+ name: "ModelNotReadyException",
228
+ $fault: "client",
229
+ ...opts
230
+ });
231
+ this.name = "ModelNotReadyException";
232
+ this.$fault = "client";
233
+ Object.setPrototypeOf(this, _ModelNotReadyException.prototype);
234
+ this.Message = opts.Message;
235
+ }
236
+ };
237
+ __name(_ModelNotReadyException, "ModelNotReadyException");
238
+ var ModelNotReadyException = _ModelNotReadyException;
239
+ var _ServiceUnavailable = class _ServiceUnavailable extends SageMakerRuntimeServiceException {
240
+ /**
241
+ * @internal
242
+ */
243
+ constructor(opts) {
244
+ super({
245
+ name: "ServiceUnavailable",
246
+ $fault: "server",
247
+ ...opts
248
+ });
249
+ this.name = "ServiceUnavailable";
250
+ this.$fault = "server";
251
+ Object.setPrototypeOf(this, _ServiceUnavailable.prototype);
252
+ this.Message = opts.Message;
253
+ }
254
+ };
255
+ __name(_ServiceUnavailable, "ServiceUnavailable");
256
+ var ServiceUnavailable = _ServiceUnavailable;
257
+ var _ValidationError = class _ValidationError extends SageMakerRuntimeServiceException {
258
+ /**
259
+ * @internal
260
+ */
261
+ constructor(opts) {
262
+ super({
263
+ name: "ValidationError",
264
+ $fault: "client",
265
+ ...opts
266
+ });
267
+ this.name = "ValidationError";
268
+ this.$fault = "client";
269
+ Object.setPrototypeOf(this, _ValidationError.prototype);
270
+ this.Message = opts.Message;
271
+ }
272
+ };
273
+ __name(_ValidationError, "ValidationError");
274
+ var ValidationError = _ValidationError;
275
+ var _InternalStreamFailure = class _InternalStreamFailure extends SageMakerRuntimeServiceException {
276
+ /**
277
+ * @internal
278
+ */
279
+ constructor(opts) {
280
+ super({
281
+ name: "InternalStreamFailure",
282
+ $fault: "server",
283
+ ...opts
284
+ });
285
+ this.name = "InternalStreamFailure";
286
+ this.$fault = "server";
287
+ Object.setPrototypeOf(this, _InternalStreamFailure.prototype);
288
+ this.Message = opts.Message;
289
+ }
290
+ };
291
+ __name(_InternalStreamFailure, "InternalStreamFailure");
292
+ var InternalStreamFailure = _InternalStreamFailure;
293
+ var _ModelStreamError = class _ModelStreamError extends SageMakerRuntimeServiceException {
294
+ /**
295
+ * @internal
296
+ */
297
+ constructor(opts) {
298
+ super({
299
+ name: "ModelStreamError",
300
+ $fault: "client",
301
+ ...opts
302
+ });
303
+ this.name = "ModelStreamError";
304
+ this.$fault = "client";
305
+ Object.setPrototypeOf(this, _ModelStreamError.prototype);
306
+ this.Message = opts.Message;
307
+ this.ErrorCode = opts.ErrorCode;
308
+ }
309
+ };
310
+ __name(_ModelStreamError, "ModelStreamError");
311
+ var ModelStreamError = _ModelStreamError;
312
+ var ResponseStream;
313
+ ((ResponseStream3) => {
314
+ ResponseStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
315
+ if (value.PayloadPart !== void 0)
316
+ return visitor.PayloadPart(value.PayloadPart);
317
+ if (value.ModelStreamError !== void 0)
318
+ return visitor.ModelStreamError(value.ModelStreamError);
319
+ if (value.InternalStreamFailure !== void 0)
320
+ return visitor.InternalStreamFailure(value.InternalStreamFailure);
321
+ return visitor._(value.$unknown[0], value.$unknown[1]);
322
+ }, "visit");
323
+ })(ResponseStream || (ResponseStream = {}));
324
+ var InvokeEndpointInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
325
+ ...obj,
326
+ ...obj.Body && { Body: import_smithy_client.SENSITIVE_STRING },
327
+ ...obj.CustomAttributes && { CustomAttributes: import_smithy_client.SENSITIVE_STRING }
328
+ }), "InvokeEndpointInputFilterSensitiveLog");
329
+ var InvokeEndpointOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
330
+ ...obj,
331
+ ...obj.Body && { Body: import_smithy_client.SENSITIVE_STRING },
332
+ ...obj.CustomAttributes && { CustomAttributes: import_smithy_client.SENSITIVE_STRING }
333
+ }), "InvokeEndpointOutputFilterSensitiveLog");
334
+ var InvokeEndpointAsyncInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
335
+ ...obj,
336
+ ...obj.CustomAttributes && { CustomAttributes: import_smithy_client.SENSITIVE_STRING }
337
+ }), "InvokeEndpointAsyncInputFilterSensitiveLog");
338
+ var InvokeEndpointWithResponseStreamInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
339
+ ...obj,
340
+ ...obj.Body && { Body: import_smithy_client.SENSITIVE_STRING },
341
+ ...obj.CustomAttributes && { CustomAttributes: import_smithy_client.SENSITIVE_STRING }
342
+ }), "InvokeEndpointWithResponseStreamInputFilterSensitiveLog");
343
+ var PayloadPartFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
344
+ ...obj,
345
+ ...obj.Bytes && { Bytes: import_smithy_client.SENSITIVE_STRING }
346
+ }), "PayloadPartFilterSensitiveLog");
347
+ var ResponseStreamFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
348
+ if (obj.PayloadPart !== void 0)
349
+ return { PayloadPart: PayloadPartFilterSensitiveLog(obj.PayloadPart) };
350
+ if (obj.ModelStreamError !== void 0)
351
+ return { ModelStreamError: obj.ModelStreamError };
352
+ if (obj.InternalStreamFailure !== void 0)
353
+ return { InternalStreamFailure: obj.InternalStreamFailure };
354
+ if (obj.$unknown !== void 0)
355
+ return { [obj.$unknown[0]]: "UNKNOWN" };
356
+ }, "ResponseStreamFilterSensitiveLog");
357
+ var InvokeEndpointWithResponseStreamOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
358
+ ...obj,
359
+ ...obj.Body && { Body: "STREAMING_CONTENT" },
360
+ ...obj.CustomAttributes && { CustomAttributes: import_smithy_client.SENSITIVE_STRING }
361
+ }), "InvokeEndpointWithResponseStreamOutputFilterSensitiveLog");
362
+
363
+ // src/protocols/Aws_restJson1.ts
364
+ var import_core = require("@smithy/core");
365
+
366
+ var se_InvokeEndpointCommand = /* @__PURE__ */ __name(async (input, context) => {
367
+ const b = (0, import_core.requestBuilder)(input, context);
368
+ const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
369
+ [_ct]: input[_CT] || "application/octet-stream",
370
+ [_a]: input[_A],
371
+ [_xasca]: input[_CA],
372
+ [_xastm]: input[_TM],
373
+ [_xastv]: input[_TV],
374
+ [_xastch]: input[_TCH],
375
+ [_xasii]: input[_II],
376
+ [_xasee]: input[_EE],
377
+ [_xasic]: input[_ICN]
378
+ });
379
+ b.bp("/endpoints/{EndpointName}/invocations");
380
+ b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
381
+ let body;
382
+ if (input.Body !== void 0) {
383
+ body = input.Body;
384
+ }
385
+ b.m("POST").h(headers).b(body);
386
+ return b.build();
387
+ }, "se_InvokeEndpointCommand");
388
+ var se_InvokeEndpointAsyncCommand = /* @__PURE__ */ __name(async (input, context) => {
389
+ const b = (0, import_core.requestBuilder)(input, context);
390
+ const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
391
+ [_xasct]: input[_CT],
392
+ [_xasa]: input[_A],
393
+ [_xasca]: input[_CA],
394
+ [_xasii]: input[_II],
395
+ [_xasi]: input[_IL],
396
+ [_xasr]: [() => isSerializableHeaderValue(input[_RTTLS]), () => input[_RTTLS].toString()],
397
+ [_xasi_]: [() => isSerializableHeaderValue(input[_ITS]), () => input[_ITS].toString()]
398
+ });
399
+ b.bp("/endpoints/{EndpointName}/async-invocations");
400
+ b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
401
+ let body;
402
+ b.m("POST").h(headers).b(body);
403
+ return b.build();
404
+ }, "se_InvokeEndpointAsyncCommand");
405
+ var se_InvokeEndpointWithResponseStreamCommand = /* @__PURE__ */ __name(async (input, context) => {
406
+ const b = (0, import_core.requestBuilder)(input, context);
407
+ const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
408
+ [_ct]: input[_CT] || "application/octet-stream",
409
+ [_xasa]: input[_A],
410
+ [_xasca]: input[_CA],
411
+ [_xastv]: input[_TV],
412
+ [_xastch]: input[_TCH],
413
+ [_xasii]: input[_II],
414
+ [_xasic]: input[_ICN]
415
+ });
416
+ b.bp("/endpoints/{EndpointName}/invocations-response-stream");
417
+ b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
418
+ let body;
419
+ if (input.Body !== void 0) {
420
+ body = input.Body;
421
+ }
422
+ b.m("POST").h(headers).b(body);
423
+ return b.build();
424
+ }, "se_InvokeEndpointWithResponseStreamCommand");
425
+ var de_InvokeEndpointCommand = /* @__PURE__ */ __name(async (output, context) => {
426
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
427
+ return de_InvokeEndpointCommandError(output, context);
428
+ }
429
+ const contents = (0, import_smithy_client.map)({
430
+ $metadata: deserializeMetadata(output),
431
+ [_CT]: [, output.headers[_ct]],
432
+ [_IPV]: [, output.headers[_xaipv]],
433
+ [_CA]: [, output.headers[_xasca]]
434
+ });
435
+ const data = await (0, import_smithy_client.collectBody)(output.body, context);
436
+ contents.Body = data;
437
+ return contents;
438
+ }, "de_InvokeEndpointCommand");
439
+ var de_InvokeEndpointCommandError = /* @__PURE__ */ __name(async (output, context) => {
440
+ const parsedOutput = {
441
+ ...output,
442
+ body: await parseErrorBody(output.body, context)
443
+ };
444
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
445
+ switch (errorCode) {
446
+ case "InternalDependencyException":
447
+ case "com.amazonaws.sagemakerruntime#InternalDependencyException":
448
+ throw await de_InternalDependencyExceptionRes(parsedOutput, context);
449
+ case "InternalFailure":
450
+ case "com.amazonaws.sagemakerruntime#InternalFailure":
451
+ throw await de_InternalFailureRes(parsedOutput, context);
452
+ case "ModelError":
453
+ case "com.amazonaws.sagemakerruntime#ModelError":
454
+ throw await de_ModelErrorRes(parsedOutput, context);
455
+ case "ModelNotReadyException":
456
+ case "com.amazonaws.sagemakerruntime#ModelNotReadyException":
457
+ throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
458
+ case "ServiceUnavailable":
459
+ case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
460
+ throw await de_ServiceUnavailableRes(parsedOutput, context);
461
+ case "ValidationError":
462
+ case "com.amazonaws.sagemakerruntime#ValidationError":
463
+ throw await de_ValidationErrorRes(parsedOutput, context);
464
+ default:
465
+ const parsedBody = parsedOutput.body;
466
+ return throwDefaultError({
467
+ output,
468
+ parsedBody,
469
+ errorCode
470
+ });
471
+ }
472
+ }, "de_InvokeEndpointCommandError");
473
+ var de_InvokeEndpointAsyncCommand = /* @__PURE__ */ __name(async (output, context) => {
474
+ if (output.statusCode !== 202 && output.statusCode >= 300) {
475
+ return de_InvokeEndpointAsyncCommandError(output, context);
476
+ }
477
+ const contents = (0, import_smithy_client.map)({
478
+ $metadata: deserializeMetadata(output),
479
+ [_OL]: [, output.headers[_xaso]],
480
+ [_FL]: [, output.headers[_xasf]]
481
+ });
482
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
483
+ const doc = (0, import_smithy_client.take)(data, {
484
+ InferenceId: import_smithy_client.expectString
485
+ });
486
+ Object.assign(contents, doc);
487
+ return contents;
488
+ }, "de_InvokeEndpointAsyncCommand");
489
+ var de_InvokeEndpointAsyncCommandError = /* @__PURE__ */ __name(async (output, context) => {
490
+ const parsedOutput = {
491
+ ...output,
492
+ body: await parseErrorBody(output.body, context)
493
+ };
494
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
495
+ switch (errorCode) {
496
+ case "InternalFailure":
497
+ case "com.amazonaws.sagemakerruntime#InternalFailure":
498
+ throw await de_InternalFailureRes(parsedOutput, context);
499
+ case "ServiceUnavailable":
500
+ case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
501
+ throw await de_ServiceUnavailableRes(parsedOutput, context);
502
+ case "ValidationError":
503
+ case "com.amazonaws.sagemakerruntime#ValidationError":
504
+ throw await de_ValidationErrorRes(parsedOutput, context);
505
+ default:
506
+ const parsedBody = parsedOutput.body;
507
+ return throwDefaultError({
508
+ output,
509
+ parsedBody,
510
+ errorCode
511
+ });
512
+ }
513
+ }, "de_InvokeEndpointAsyncCommandError");
514
+ var de_InvokeEndpointWithResponseStreamCommand = /* @__PURE__ */ __name(async (output, context) => {
515
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
516
+ return de_InvokeEndpointWithResponseStreamCommandError(output, context);
517
+ }
518
+ const contents = (0, import_smithy_client.map)({
519
+ $metadata: deserializeMetadata(output),
520
+ [_CT]: [, output.headers[_xasct]],
521
+ [_IPV]: [, output.headers[_xaipv]],
522
+ [_CA]: [, output.headers[_xasca]]
523
+ });
524
+ const data = output.body;
525
+ contents.Body = de_ResponseStream(data, context);
526
+ return contents;
527
+ }, "de_InvokeEndpointWithResponseStreamCommand");
528
+ var de_InvokeEndpointWithResponseStreamCommandError = /* @__PURE__ */ __name(async (output, context) => {
529
+ const parsedOutput = {
530
+ ...output,
531
+ body: await parseErrorBody(output.body, context)
532
+ };
533
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
534
+ switch (errorCode) {
535
+ case "InternalFailure":
536
+ case "com.amazonaws.sagemakerruntime#InternalFailure":
537
+ throw await de_InternalFailureRes(parsedOutput, context);
538
+ case "InternalStreamFailure":
539
+ case "com.amazonaws.sagemakerruntime#InternalStreamFailure":
540
+ throw await de_InternalStreamFailureRes(parsedOutput, context);
541
+ case "ModelError":
542
+ case "com.amazonaws.sagemakerruntime#ModelError":
543
+ throw await de_ModelErrorRes(parsedOutput, context);
544
+ case "ModelStreamError":
545
+ case "com.amazonaws.sagemakerruntime#ModelStreamError":
546
+ throw await de_ModelStreamErrorRes(parsedOutput, context);
547
+ case "ServiceUnavailable":
548
+ case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
549
+ throw await de_ServiceUnavailableRes(parsedOutput, context);
550
+ case "ValidationError":
551
+ case "com.amazonaws.sagemakerruntime#ValidationError":
552
+ throw await de_ValidationErrorRes(parsedOutput, context);
553
+ default:
554
+ const parsedBody = parsedOutput.body;
555
+ return throwDefaultError({
556
+ output,
557
+ parsedBody,
558
+ errorCode
559
+ });
560
+ }
561
+ }, "de_InvokeEndpointWithResponseStreamCommandError");
562
+ var throwDefaultError = (0, import_smithy_client.withBaseException)(SageMakerRuntimeServiceException);
563
+ var de_InternalDependencyExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
564
+ const contents = (0, import_smithy_client.map)({});
565
+ const data = parsedOutput.body;
566
+ const doc = (0, import_smithy_client.take)(data, {
567
+ Message: import_smithy_client.expectString
568
+ });
569
+ Object.assign(contents, doc);
570
+ const exception = new InternalDependencyException({
571
+ $metadata: deserializeMetadata(parsedOutput),
572
+ ...contents
573
+ });
574
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
575
+ }, "de_InternalDependencyExceptionRes");
576
+ var de_InternalFailureRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
577
+ const contents = (0, import_smithy_client.map)({});
578
+ const data = parsedOutput.body;
579
+ const doc = (0, import_smithy_client.take)(data, {
580
+ Message: import_smithy_client.expectString
581
+ });
582
+ Object.assign(contents, doc);
583
+ const exception = new InternalFailure({
584
+ $metadata: deserializeMetadata(parsedOutput),
585
+ ...contents
586
+ });
587
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
588
+ }, "de_InternalFailureRes");
589
+ var de_InternalStreamFailureRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
590
+ const contents = (0, import_smithy_client.map)({});
591
+ const data = parsedOutput.body;
592
+ const doc = (0, import_smithy_client.take)(data, {
593
+ Message: import_smithy_client.expectString
594
+ });
595
+ Object.assign(contents, doc);
596
+ const exception = new InternalStreamFailure({
597
+ $metadata: deserializeMetadata(parsedOutput),
598
+ ...contents
599
+ });
600
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
601
+ }, "de_InternalStreamFailureRes");
602
+ var de_ModelErrorRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
603
+ const contents = (0, import_smithy_client.map)({});
604
+ const data = parsedOutput.body;
605
+ const doc = (0, import_smithy_client.take)(data, {
606
+ LogStreamArn: import_smithy_client.expectString,
607
+ Message: import_smithy_client.expectString,
608
+ OriginalMessage: import_smithy_client.expectString,
609
+ OriginalStatusCode: import_smithy_client.expectInt32
610
+ });
611
+ Object.assign(contents, doc);
612
+ const exception = new ModelError({
613
+ $metadata: deserializeMetadata(parsedOutput),
614
+ ...contents
615
+ });
616
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
617
+ }, "de_ModelErrorRes");
618
+ var de_ModelNotReadyExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
619
+ const contents = (0, import_smithy_client.map)({});
620
+ const data = parsedOutput.body;
621
+ const doc = (0, import_smithy_client.take)(data, {
622
+ Message: import_smithy_client.expectString
623
+ });
624
+ Object.assign(contents, doc);
625
+ const exception = new ModelNotReadyException({
626
+ $metadata: deserializeMetadata(parsedOutput),
627
+ ...contents
628
+ });
629
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
630
+ }, "de_ModelNotReadyExceptionRes");
631
+ var de_ModelStreamErrorRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
632
+ const contents = (0, import_smithy_client.map)({});
633
+ const data = parsedOutput.body;
634
+ const doc = (0, import_smithy_client.take)(data, {
635
+ ErrorCode: import_smithy_client.expectString,
636
+ Message: import_smithy_client.expectString
637
+ });
638
+ Object.assign(contents, doc);
639
+ const exception = new ModelStreamError({
640
+ $metadata: deserializeMetadata(parsedOutput),
641
+ ...contents
642
+ });
643
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
644
+ }, "de_ModelStreamErrorRes");
645
+ var de_ServiceUnavailableRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
646
+ const contents = (0, import_smithy_client.map)({});
647
+ const data = parsedOutput.body;
648
+ const doc = (0, import_smithy_client.take)(data, {
649
+ Message: import_smithy_client.expectString
650
+ });
651
+ Object.assign(contents, doc);
652
+ const exception = new ServiceUnavailable({
653
+ $metadata: deserializeMetadata(parsedOutput),
654
+ ...contents
655
+ });
656
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
657
+ }, "de_ServiceUnavailableRes");
658
+ var de_ValidationErrorRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
659
+ const contents = (0, import_smithy_client.map)({});
660
+ const data = parsedOutput.body;
661
+ const doc = (0, import_smithy_client.take)(data, {
662
+ Message: import_smithy_client.expectString
663
+ });
664
+ Object.assign(contents, doc);
665
+ const exception = new ValidationError({
666
+ $metadata: deserializeMetadata(parsedOutput),
667
+ ...contents
668
+ });
669
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
670
+ }, "de_ValidationErrorRes");
671
+ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
672
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
673
+ if (event["PayloadPart"] != null) {
674
+ return {
675
+ PayloadPart: await de_PayloadPart_event(event["PayloadPart"], context)
676
+ };
677
+ }
678
+ if (event["ModelStreamError"] != null) {
679
+ return {
680
+ ModelStreamError: await de_ModelStreamError_event(event["ModelStreamError"], context)
681
+ };
682
+ }
683
+ if (event["InternalStreamFailure"] != null) {
684
+ return {
685
+ InternalStreamFailure: await de_InternalStreamFailure_event(event["InternalStreamFailure"], context)
686
+ };
687
+ }
688
+ return { $unknown: output };
689
+ });
690
+ }, "de_ResponseStream");
691
+ var de_InternalStreamFailure_event = /* @__PURE__ */ __name(async (output, context) => {
692
+ const parsedOutput = {
693
+ ...output,
694
+ body: await parseBody(output.body, context)
695
+ };
696
+ return de_InternalStreamFailureRes(parsedOutput, context);
697
+ }, "de_InternalStreamFailure_event");
698
+ var de_ModelStreamError_event = /* @__PURE__ */ __name(async (output, context) => {
699
+ const parsedOutput = {
700
+ ...output,
701
+ body: await parseBody(output.body, context)
702
+ };
703
+ return de_ModelStreamErrorRes(parsedOutput, context);
704
+ }, "de_ModelStreamError_event");
705
+ var de_PayloadPart_event = /* @__PURE__ */ __name(async (output, context) => {
706
+ const contents = {};
707
+ contents.Bytes = output.body;
708
+ return contents;
709
+ }, "de_PayloadPart_event");
710
+ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
711
+ httpStatusCode: output.statusCode,
712
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
713
+ extendedRequestId: output.headers["x-amz-id-2"],
714
+ cfId: output.headers["x-amz-cf-id"]
715
+ }), "deserializeMetadata");
716
+ var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
717
+ var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue");
718
+ var _A = "Accept";
719
+ var _CA = "CustomAttributes";
720
+ var _CT = "ContentType";
721
+ var _EE = "EnableExplanations";
722
+ var _FL = "FailureLocation";
723
+ var _ICN = "InferenceComponentName";
724
+ var _II = "InferenceId";
725
+ var _IL = "InputLocation";
726
+ var _IPV = "InvokedProductionVariant";
727
+ var _ITS = "InvocationTimeoutSeconds";
728
+ var _OL = "OutputLocation";
729
+ var _RTTLS = "RequestTTLSeconds";
730
+ var _TCH = "TargetContainerHostname";
731
+ var _TM = "TargetModel";
732
+ var _TV = "TargetVariant";
733
+ var _a = "accept";
734
+ var _ct = "content-type";
735
+ var _xaipv = "x-amzn-invoked-production-variant";
736
+ var _xasa = "x-amzn-sagemaker-accept";
737
+ var _xasca = "x-amzn-sagemaker-custom-attributes";
738
+ var _xasct = "x-amzn-sagemaker-content-type";
739
+ var _xasee = "x-amzn-sagemaker-enable-explanations";
740
+ var _xasf = "x-amzn-sagemaker-failurelocation";
741
+ var _xasi = "x-amzn-sagemaker-inputlocation";
742
+ var _xasi_ = "x-amzn-sagemaker-invocationtimeoutseconds";
743
+ var _xasic = "x-amzn-sagemaker-inference-component";
744
+ var _xasii = "x-amzn-sagemaker-inference-id";
745
+ var _xaso = "x-amzn-sagemaker-outputlocation";
746
+ var _xasr = "x-amzn-sagemaker-requestttlseconds";
747
+ var _xastch = "x-amzn-sagemaker-target-container-hostname";
748
+ var _xastm = "x-amzn-sagemaker-target-model";
749
+ var _xastv = "x-amzn-sagemaker-target-variant";
750
+ var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
751
+ if (encoded.length) {
752
+ return JSON.parse(encoded);
753
+ }
754
+ return {};
755
+ }), "parseBody");
756
+ var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
757
+ const value = await parseBody(errorBody, context);
758
+ value.message = value.message ?? value.Message;
759
+ return value;
760
+ }, "parseErrorBody");
761
+ var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
762
+ const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
763
+ const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
764
+ let cleanValue = rawValue;
765
+ if (typeof cleanValue === "number") {
766
+ cleanValue = cleanValue.toString();
767
+ }
768
+ if (cleanValue.indexOf(",") >= 0) {
769
+ cleanValue = cleanValue.split(",")[0];
770
+ }
771
+ if (cleanValue.indexOf(":") >= 0) {
772
+ cleanValue = cleanValue.split(":")[0];
773
+ }
774
+ if (cleanValue.indexOf("#") >= 0) {
775
+ cleanValue = cleanValue.split("#")[1];
776
+ }
777
+ return cleanValue;
778
+ }, "sanitizeErrorCode");
779
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
780
+ if (headerKey !== void 0) {
781
+ return sanitizeErrorCode(output.headers[headerKey]);
782
+ }
783
+ if (data.code !== void 0) {
784
+ return sanitizeErrorCode(data.code);
785
+ }
786
+ if (data["__type"] !== void 0) {
787
+ return sanitizeErrorCode(data["__type"]);
788
+ }
789
+ }, "loadRestJsonErrorCode");
790
+
791
+ // src/commands/InvokeEndpointAsyncCommand.ts
792
+ var _InvokeEndpointAsyncCommand = class _InvokeEndpointAsyncCommand extends import_smithy_client.Command.classBuilder().ep({
793
+ ...commonParams
794
+ }).m(function(Command, cs, config, o) {
795
+ return [
796
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
797
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
798
+ ];
799
+ }).s("AmazonSageMakerRuntime", "InvokeEndpointAsync", {}).n("SageMakerRuntimeClient", "InvokeEndpointAsyncCommand").f(InvokeEndpointAsyncInputFilterSensitiveLog, void 0).ser(se_InvokeEndpointAsyncCommand).de(de_InvokeEndpointAsyncCommand).build() {
800
+ };
801
+ __name(_InvokeEndpointAsyncCommand, "InvokeEndpointAsyncCommand");
802
+ var InvokeEndpointAsyncCommand = _InvokeEndpointAsyncCommand;
803
+
804
+ // src/commands/InvokeEndpointCommand.ts
805
+
806
+
807
+
808
+
809
+ var _InvokeEndpointCommand = class _InvokeEndpointCommand extends import_smithy_client.Command.classBuilder().ep({
810
+ ...commonParams
811
+ }).m(function(Command, cs, config, o) {
812
+ return [
813
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
814
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
815
+ ];
816
+ }).s("AmazonSageMakerRuntime", "InvokeEndpoint", {}).n("SageMakerRuntimeClient", "InvokeEndpointCommand").f(InvokeEndpointInputFilterSensitiveLog, InvokeEndpointOutputFilterSensitiveLog).ser(se_InvokeEndpointCommand).de(de_InvokeEndpointCommand).build() {
817
+ };
818
+ __name(_InvokeEndpointCommand, "InvokeEndpointCommand");
819
+ var InvokeEndpointCommand = _InvokeEndpointCommand;
820
+
821
+ // src/commands/InvokeEndpointWithResponseStreamCommand.ts
822
+
823
+
824
+
825
+
826
+ var _InvokeEndpointWithResponseStreamCommand = class _InvokeEndpointWithResponseStreamCommand extends import_smithy_client.Command.classBuilder().ep({
827
+ ...commonParams
828
+ }).m(function(Command, cs, config, o) {
829
+ return [
830
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
831
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
832
+ ];
833
+ }).s("AmazonSageMakerRuntime", "InvokeEndpointWithResponseStream", {
834
+ /**
835
+ * @internal
836
+ */
837
+ eventStream: {
838
+ output: true
839
+ }
840
+ }).n("SageMakerRuntimeClient", "InvokeEndpointWithResponseStreamCommand").f(InvokeEndpointWithResponseStreamInputFilterSensitiveLog, InvokeEndpointWithResponseStreamOutputFilterSensitiveLog).ser(se_InvokeEndpointWithResponseStreamCommand).de(de_InvokeEndpointWithResponseStreamCommand).build() {
841
+ };
842
+ __name(_InvokeEndpointWithResponseStreamCommand, "InvokeEndpointWithResponseStreamCommand");
843
+ var InvokeEndpointWithResponseStreamCommand = _InvokeEndpointWithResponseStreamCommand;
844
+
845
+ // src/SageMakerRuntime.ts
846
+ var commands = {
847
+ InvokeEndpointCommand,
848
+ InvokeEndpointAsyncCommand,
849
+ InvokeEndpointWithResponseStreamCommand
850
+ };
851
+ var _SageMakerRuntime = class _SageMakerRuntime extends SageMakerRuntimeClient {
852
+ };
853
+ __name(_SageMakerRuntime, "SageMakerRuntime");
854
+ var SageMakerRuntime = _SageMakerRuntime;
855
+ (0, import_smithy_client.createAggregatedClient)(commands, SageMakerRuntime);
856
+
857
+ // src/index.ts
858
+ var import_util_endpoints = require("@aws-sdk/util-endpoints");
859
+ // Annotate the CommonJS export names for ESM import in node:
860
+ 0 && (module.exports = {
861
+ InternalDependencyException,
862
+ InternalFailure,
863
+ InternalStreamFailure,
864
+ InvokeEndpointAsyncCommand,
865
+ InvokeEndpointAsyncInputFilterSensitiveLog,
866
+ InvokeEndpointCommand,
867
+ InvokeEndpointInputFilterSensitiveLog,
868
+ InvokeEndpointOutputFilterSensitiveLog,
869
+ InvokeEndpointWithResponseStreamCommand,
870
+ InvokeEndpointWithResponseStreamInputFilterSensitiveLog,
871
+ InvokeEndpointWithResponseStreamOutputFilterSensitiveLog,
872
+ ModelError,
873
+ ModelNotReadyException,
874
+ ModelStreamError,
875
+ PayloadPartFilterSensitiveLog,
876
+ ResponseStream,
877
+ ResponseStreamFilterSensitiveLog,
878
+ SageMakerRuntime,
879
+ SageMakerRuntimeClient,
880
+ SageMakerRuntimeServiceException,
881
+ ServiceUnavailable,
882
+ ValidationError,
883
+ __Client
884
+ });