@aws-sdk/client-bedrock-runtime 3.476.0 → 3.477.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,55 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.de_InvokeModelWithResponseStreamCommand = exports.de_InvokeModelCommand = exports.se_InvokeModelWithResponseStreamCommand = exports.se_InvokeModelCommand = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
4
+ const core_1 = require("@smithy/core");
5
5
  const smithy_client_1 = require("@smithy/smithy-client");
6
6
  const BedrockRuntimeServiceException_1 = require("../models/BedrockRuntimeServiceException");
7
7
  const models_0_1 = require("../models/models_0");
8
8
  const se_InvokeModelCommand = async (input, context) => {
9
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
9
+ const b = (0, core_1.requestBuilder)(input, context);
10
10
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
11
- "content-type": input.contentType || "application/octet-stream",
12
- accept: input.accept,
11
+ [_ct]: input[_cT] || "application/octet-stream",
12
+ [_a]: input[_a],
13
13
  });
14
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/model/{modelId}/invoke";
15
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "modelId", () => input.modelId, "{modelId}", false);
14
+ b.bp("/model/{modelId}/invoke");
15
+ b.p("modelId", () => input.modelId, "{modelId}", false);
16
16
  let body;
17
17
  if (input.body !== undefined) {
18
18
  body = input.body;
19
19
  }
20
- return new protocol_http_1.HttpRequest({
21
- protocol,
22
- hostname,
23
- port,
24
- method: "POST",
25
- headers,
26
- path: resolvedPath,
27
- body,
28
- });
20
+ b.m("POST").h(headers).b(body);
21
+ return b.build();
29
22
  };
30
23
  exports.se_InvokeModelCommand = se_InvokeModelCommand;
31
24
  const se_InvokeModelWithResponseStreamCommand = async (input, context) => {
32
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
25
+ const b = (0, core_1.requestBuilder)(input, context);
33
26
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
34
- "content-type": input.contentType || "application/octet-stream",
35
- "x-amzn-bedrock-accept": input.accept,
27
+ [_ct]: input[_cT] || "application/octet-stream",
28
+ [_xaba]: input[_a],
36
29
  });
37
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
38
- "/model/{modelId}/invoke-with-response-stream";
39
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "modelId", () => input.modelId, "{modelId}", false);
30
+ b.bp("/model/{modelId}/invoke-with-response-stream");
31
+ b.p("modelId", () => input.modelId, "{modelId}", false);
40
32
  let body;
41
33
  if (input.body !== undefined) {
42
34
  body = input.body;
43
35
  }
44
- return new protocol_http_1.HttpRequest({
45
- protocol,
46
- hostname,
47
- port,
48
- method: "POST",
49
- headers,
50
- path: resolvedPath,
51
- body,
52
- });
36
+ b.m("POST").h(headers).b(body);
37
+ return b.build();
53
38
  };
54
39
  exports.se_InvokeModelWithResponseStreamCommand = se_InvokeModelWithResponseStreamCommand;
55
40
  const de_InvokeModelCommand = async (output, context) => {
@@ -58,7 +43,7 @@ const de_InvokeModelCommand = async (output, context) => {
58
43
  }
59
44
  const contents = (0, smithy_client_1.map)({
60
45
  $metadata: deserializeMetadata(output),
61
- contentType: [, output.headers["content-type"]],
46
+ [_cT]: [, output.headers[_ct]],
62
47
  });
63
48
  const data = await (0, smithy_client_1.collectBody)(output.body, context);
64
49
  contents.body = data;
@@ -114,7 +99,7 @@ const de_InvokeModelWithResponseStreamCommand = async (output, context) => {
114
99
  }
115
100
  const contents = (0, smithy_client_1.map)({
116
101
  $metadata: deserializeMetadata(output),
117
- contentType: [, output.headers["x-amzn-bedrock-content-type"]],
102
+ [_cT]: [, output.headers[_xabct]],
118
103
  });
119
104
  const data = output.body;
120
105
  contents.body = de_ResponseStream(data, context);
@@ -395,6 +380,11 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
395
380
  value !== "" &&
396
381
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
397
382
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
383
+ const _a = "accept";
384
+ const _cT = "contentType";
385
+ const _ct = "content-type";
386
+ const _xaba = "x-amzn-bedrock-accept";
387
+ const _xabct = "x-amzn-bedrock-content-type";
398
388
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
399
389
  if (encoded.length) {
400
390
  return JSON.parse(encoded);
@@ -1,51 +1,36 @@
1
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
- import { collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectString as __expectString, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@smithy/smithy-client";
1
+ import { requestBuilder as rb } from "@smithy/core";
2
+ import { collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
3
3
  import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException";
4
4
  import { AccessDeniedException, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
5
  export const se_InvokeModelCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
6
+ const b = rb(input, context);
7
7
  const headers = map({}, isSerializableHeaderValue, {
8
- "content-type": input.contentType || "application/octet-stream",
9
- accept: input.accept,
8
+ [_ct]: input[_cT] || "application/octet-stream",
9
+ [_a]: input[_a],
10
10
  });
11
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/model/{modelId}/invoke";
12
- resolvedPath = __resolvedPath(resolvedPath, input, "modelId", () => input.modelId, "{modelId}", false);
11
+ b.bp("/model/{modelId}/invoke");
12
+ b.p("modelId", () => input.modelId, "{modelId}", false);
13
13
  let body;
14
14
  if (input.body !== undefined) {
15
15
  body = input.body;
16
16
  }
17
- return new __HttpRequest({
18
- protocol,
19
- hostname,
20
- port,
21
- method: "POST",
22
- headers,
23
- path: resolvedPath,
24
- body,
25
- });
17
+ b.m("POST").h(headers).b(body);
18
+ return b.build();
26
19
  };
27
20
  export const se_InvokeModelWithResponseStreamCommand = async (input, context) => {
28
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
21
+ const b = rb(input, context);
29
22
  const headers = map({}, isSerializableHeaderValue, {
30
- "content-type": input.contentType || "application/octet-stream",
31
- "x-amzn-bedrock-accept": input.accept,
23
+ [_ct]: input[_cT] || "application/octet-stream",
24
+ [_xaba]: input[_a],
32
25
  });
33
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
34
- "/model/{modelId}/invoke-with-response-stream";
35
- resolvedPath = __resolvedPath(resolvedPath, input, "modelId", () => input.modelId, "{modelId}", false);
26
+ b.bp("/model/{modelId}/invoke-with-response-stream");
27
+ b.p("modelId", () => input.modelId, "{modelId}", false);
36
28
  let body;
37
29
  if (input.body !== undefined) {
38
30
  body = input.body;
39
31
  }
40
- return new __HttpRequest({
41
- protocol,
42
- hostname,
43
- port,
44
- method: "POST",
45
- headers,
46
- path: resolvedPath,
47
- body,
48
- });
32
+ b.m("POST").h(headers).b(body);
33
+ return b.build();
49
34
  };
50
35
  export const de_InvokeModelCommand = async (output, context) => {
51
36
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -53,7 +38,7 @@ export const de_InvokeModelCommand = async (output, context) => {
53
38
  }
54
39
  const contents = map({
55
40
  $metadata: deserializeMetadata(output),
56
- contentType: [, output.headers["content-type"]],
41
+ [_cT]: [, output.headers[_ct]],
57
42
  });
58
43
  const data = await collectBody(output.body, context);
59
44
  contents.body = data;
@@ -108,7 +93,7 @@ export const de_InvokeModelWithResponseStreamCommand = async (output, context) =
108
93
  }
109
94
  const contents = map({
110
95
  $metadata: deserializeMetadata(output),
111
- contentType: [, output.headers["x-amzn-bedrock-content-type"]],
96
+ [_cT]: [, output.headers[_xabct]],
112
97
  });
113
98
  const data = output.body;
114
99
  contents.body = de_ResponseStream(data, context);
@@ -388,6 +373,11 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
388
373
  value !== "" &&
389
374
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
390
375
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
376
+ const _a = "accept";
377
+ const _cT = "contentType";
378
+ const _ct = "content-type";
379
+ const _xaba = "x-amzn-bedrock-accept";
380
+ const _xabct = "x-amzn-bedrock-content-type";
391
381
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
392
382
  if (encoded.length) {
393
383
  return JSON.parse(encoded);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.476.0",
4
+ "version": "3.477.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.476.0",
24
- "@aws-sdk/core": "3.476.0",
25
- "@aws-sdk/credential-provider-node": "3.476.0",
23
+ "@aws-sdk/client-sts": "3.477.0",
24
+ "@aws-sdk/core": "3.477.0",
25
+ "@aws-sdk/credential-provider-node": "3.477.0",
26
26
  "@aws-sdk/middleware-host-header": "3.468.0",
27
27
  "@aws-sdk/middleware-logger": "3.468.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.468.0",
@@ -34,6 +34,7 @@
34
34
  "@aws-sdk/util-user-agent-browser": "3.468.0",
35
35
  "@aws-sdk/util-user-agent-node": "3.470.0",
36
36
  "@smithy/config-resolver": "^2.0.21",
37
+ "@smithy/core": "^1.2.0",
37
38
  "@smithy/eventstream-serde-browser": "^2.0.15",
38
39
  "@smithy/eventstream-serde-config-resolver": "^2.0.15",
39
40
  "@smithy/eventstream-serde-node": "^2.0.15",