@aws-sdk/client-bedrock-runtime 3.1074.0 → 3.1076.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.
@@ -16,7 +16,7 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
16
16
  requestHandler: WebSocketRequestHandler;
17
17
  retryMode: string | import("@smithy/types").Provider<string>;
18
18
  sha256: import("@smithy/types").HashConstructor;
19
- streamCollector: import("@smithy/types").StreamCollector;
19
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
20
20
  useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
21
21
  useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) & (boolean | import("@smithy/types").Provider<boolean | undefined>);
22
22
  cacheMiddleware?: boolean | undefined;
@@ -29,7 +29,7 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
29
29
  requestHandler: RequestHandler | import("@smithy/core/protocols").HttpHandler<any>;
30
30
  retryMode: string | import("@smithy/types").Provider<string>;
31
31
  sha256: import("@smithy/types").HashConstructor;
32
- streamCollector: import("@smithy/types").StreamCollector;
32
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
33
33
  useDualstackEndpoint: boolean | import("@smithy/types").Provider<boolean>;
34
34
  useFipsEndpoint: boolean | import("@smithy/types").Provider<boolean>;
35
35
  userAgentAppId: string | import("@smithy/types").Provider<string | undefined>;
@@ -19,7 +19,7 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
19
19
  apiVersion: string;
20
20
  urlParser: import("@smithy/types").UrlParser;
21
21
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
22
- streamCollector: import("@smithy/types").StreamCollector;
22
+ streamCollector: (stream: import("stream").Readable | import("stream/web").ReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
23
23
  base64Decoder: import("@smithy/types").Decoder;
24
24
  base64Encoder: (_input: Uint8Array | string) => string;
25
25
  utf8Decoder: import("@smithy/types").Decoder;
@@ -21,7 +21,13 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
21
21
  requestHandler: WebSocketRequestHandler;
22
22
  retryMode: string | import("@smithy/types").Provider<string>;
23
23
  sha256: import("@smithy/types").HashConstructor;
24
- streamCollector: import("@smithy/types").StreamCollector;
24
+ streamCollector: (
25
+ stream:
26
+ | import("stream").Readable
27
+ | import("stream/web").ReadableStream
28
+ | ReadableStream
29
+ | Blob
30
+ ) => Promise<Uint8Array>;
25
31
  useDualstackEndpoint: (boolean | import("@smithy/types").Provider<boolean>) &
26
32
  (boolean | import("@smithy/types").Provider<boolean | undefined>);
27
33
  useFipsEndpoint: (boolean | import("@smithy/types").Provider<boolean>) &
@@ -51,7 +51,13 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
51
51
  | import("@smithy/core/protocols").HttpHandler<any>;
52
52
  retryMode: string | import("@smithy/types").Provider<string>;
53
53
  sha256: import("@smithy/types").HashConstructor;
54
- streamCollector: import("@smithy/types").StreamCollector;
54
+ streamCollector: (
55
+ stream:
56
+ | import("stream").Readable
57
+ | import("stream/web").ReadableStream
58
+ | ReadableStream
59
+ | Blob
60
+ ) => Promise<Uint8Array>;
55
61
  useDualstackEndpoint: boolean | import("@smithy/types").Provider<boolean>;
56
62
  useFipsEndpoint: boolean | import("@smithy/types").Provider<boolean>;
57
63
  userAgentAppId: string | import("@smithy/types").Provider<string | undefined>;
@@ -33,7 +33,13 @@ export declare const getRuntimeConfig: (config: BedrockRuntimeClientConfig) => {
33
33
  apiVersion: string;
34
34
  urlParser: import("@smithy/types").UrlParser;
35
35
  bodyLengthChecker: import("@smithy/types").BodyLengthCalculator;
36
- streamCollector: import("@smithy/types").StreamCollector;
36
+ streamCollector: (
37
+ stream:
38
+ | import("stream").Readable
39
+ | import("stream/web").ReadableStream
40
+ | ReadableStream
41
+ | Blob
42
+ ) => Promise<Uint8Array>;
37
43
  base64Decoder: import("@smithy/types").Decoder;
38
44
  base64Encoder: (_input: Uint8Array | string) => string;
39
45
  utf8Decoder: import("@smithy/types").Decoder;
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.1074.0",
4
+ "version": "3.1076.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
7
7
  "build:cjs": "node ../../scripts/compilation/inline",
@@ -29,21 +29,21 @@
29
29
  "dependencies": {
30
30
  "@aws-crypto/sha256-browser": "5.2.0",
31
31
  "@aws-crypto/sha256-js": "5.2.0",
32
- "@aws-sdk/core": "^3.974.23",
33
- "@aws-sdk/credential-provider-node": "^3.972.58",
34
- "@aws-sdk/eventstream-handler-node": "^3.972.22",
35
- "@aws-sdk/middleware-eventstream": "^3.972.18",
36
- "@aws-sdk/middleware-websocket": "^3.972.31",
37
- "@aws-sdk/token-providers": "3.1074.0",
38
- "@aws-sdk/types": "^3.973.13",
39
- "@smithy/core": "^3.24.6",
40
- "@smithy/fetch-http-handler": "^5.4.6",
41
- "@smithy/node-http-handler": "^4.7.6",
42
- "@smithy/types": "^4.14.3",
32
+ "@aws-sdk/core": "^3.974.24",
33
+ "@aws-sdk/credential-provider-node": "^3.972.59",
34
+ "@aws-sdk/eventstream-handler-node": "^3.972.23",
35
+ "@aws-sdk/middleware-eventstream": "^3.972.19",
36
+ "@aws-sdk/middleware-websocket": "^3.972.32",
37
+ "@aws-sdk/token-providers": "3.1076.0",
38
+ "@aws-sdk/types": "^3.973.14",
39
+ "@smithy/core": "^3.27.0",
40
+ "@smithy/fetch-http-handler": "^5.6.0",
41
+ "@smithy/node-http-handler": "^4.9.0",
42
+ "@smithy/types": "^4.15.0",
43
43
  "tslib": "^2.6.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@smithy/snapshot-testing": "^2.1.7",
46
+ "@smithy/snapshot-testing": "^2.2.3",
47
47
  "@tsconfig/node20": "20.1.8",
48
48
  "@types/node": "^20.14.8",
49
49
  "concurrently": "7.0.0",
@@ -1,57 +0,0 @@
1
- const { resolveAwsSdkSigV4Config } = require("@aws-sdk/core/httpAuthSchemes");
2
- const { doesIdentityRequireRefresh, isIdentityExpired, memoizeIdentityProvider } = require("@smithy/core");
3
- const { getSmithyContext, normalizeProvider } = require("@smithy/core/client");
4
- exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
5
- return {
6
- operation: getSmithyContext(context).operation,
7
- region: await normalizeProvider(config.region)() || (() => {
8
- throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
9
- })(),
10
- };
11
- };
12
- function createAwsAuthSigv4HttpAuthOption(authParameters) {
13
- return {
14
- schemeId: "aws.auth#sigv4",
15
- signingProperties: {
16
- name: "bedrock",
17
- region: authParameters.region,
18
- },
19
- propertiesExtractor: (config, context) => ({
20
- signingProperties: {
21
- config,
22
- context,
23
- },
24
- }),
25
- };
26
- }
27
- function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
28
- return {
29
- schemeId: "smithy.api#httpBearerAuth",
30
- propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache, }, context) => ({
31
- identityProperties: {
32
- profile,
33
- filepath,
34
- configFilepath,
35
- ignoreCache,
36
- },
37
- }),
38
- };
39
- }
40
- exports.defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
41
- const options = [];
42
- switch (authParameters.operation) {
43
- default: {
44
- options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
45
- options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
46
- }
47
- }
48
- return options;
49
- };
50
- exports.resolveHttpAuthSchemeConfig = (config) => {
51
- const token = memoizeIdentityProvider(config.token, isIdentityExpired, doesIdentityRequireRefresh);
52
- const config_0 = resolveAwsSdkSigV4Config(config);
53
- return Object.assign(config_0, {
54
- authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
55
- token,
56
- });
57
- };
@@ -1,46 +0,0 @@
1
- const { BinaryDecisionDiagram } = require("@smithy/core/endpoints");
2
- const k = "ref";
3
- const a = -1, b = true, c = "isSet", d = "PartitionResult", e = "booleanEquals", f = "getAttr", g = { [k]: "Endpoint" }, h = { [k]: d }, i = {}, j = [{ [k]: "Region" }];
4
- const _data = {
5
- conditions: [
6
- [c, [g]],
7
- [c, j],
8
- ["aws.partition", j, d],
9
- [e, [{ [k]: "UseFIPS" }, b]],
10
- [e, [{ [k]: "UseDualStack" }, b]],
11
- [e, [{ fn: f, argv: [h, "supportsDualStack"] }, b]],
12
- [e, [{ fn: f, argv: [h, "supportsFIPS"] }, b]]
13
- ],
14
- results: [
15
- [a],
16
- [a, "Invalid Configuration: FIPS and custom endpoint are not supported"],
17
- [a, "Invalid Configuration: Dualstack and custom endpoint are not supported"],
18
- [g, i],
19
- ["https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", i],
20
- [a, "FIPS and DualStack are enabled, but this partition does not support one or both"],
21
- ["https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}", i],
22
- [a, "FIPS is enabled but this partition does not support FIPS"],
23
- ["https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}", i],
24
- [a, "DualStack is enabled but this partition does not support DualStack"],
25
- ["https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}", i],
26
- [a, "Invalid Configuration: Missing Region"]
27
- ]
28
- };
29
- const root = 2;
30
- const r = 100_000_000;
31
- const nodes = new Int32Array([
32
- -1, 1, -1,
33
- 0, 12, 3,
34
- 1, 4, r + 11,
35
- 2, 5, r + 11,
36
- 3, 8, 6,
37
- 4, 7, r + 10,
38
- 5, r + 8, r + 9,
39
- 4, 10, 9,
40
- 6, r + 6, r + 7,
41
- 5, 11, r + 5,
42
- 6, r + 4, r + 5,
43
- 3, r + 1, 13,
44
- 4, r + 2, r + 3,
45
- ]);
46
- exports.bdd = BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
@@ -1,14 +0,0 @@
1
- const { awsEndpointFunctions } = require("@aws-sdk/core/client");
2
- const { customEndpointFunctions, decideEndpoint, EndpointCache } = require("@smithy/core/endpoints");
3
- const { bdd } = require("./bdd");
4
- const cache = new EndpointCache({
5
- size: 50,
6
- params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
7
- });
8
- exports.defaultEndpointResolver = (endpointParams, context = {}) => {
9
- return cache.get(endpointParams, () => decideEndpoint(bdd, {
10
- endpointParams: endpointParams,
11
- logger: context.logger,
12
- }));
13
- };
14
- customEndpointFunctions.aws = awsEndpointFunctions;
@@ -1,8 +0,0 @@
1
- const { ServiceException: __ServiceException } = require("@smithy/core/client");
2
- exports.__ServiceException = __ServiceException;
3
- exports.BedrockRuntimeServiceException = class BedrockRuntimeServiceException extends __ServiceException {
4
- constructor(options) {
5
- super(options);
6
- Object.setPrototypeOf(this, BedrockRuntimeServiceException.prototype);
7
- }
8
- };
@@ -1,154 +0,0 @@
1
- const { BedrockRuntimeServiceException: __BaseException } = require("./BedrockRuntimeServiceException");
2
- exports.AccessDeniedException = class AccessDeniedException extends __BaseException {
3
- name = "AccessDeniedException";
4
- $fault = "client";
5
- constructor(opts) {
6
- super({
7
- name: "AccessDeniedException",
8
- $fault: "client",
9
- ...opts,
10
- });
11
- Object.setPrototypeOf(this, AccessDeniedException.prototype);
12
- }
13
- };
14
- exports.InternalServerException = class InternalServerException extends __BaseException {
15
- name = "InternalServerException";
16
- $fault = "server";
17
- constructor(opts) {
18
- super({
19
- name: "InternalServerException",
20
- $fault: "server",
21
- ...opts,
22
- });
23
- Object.setPrototypeOf(this, InternalServerException.prototype);
24
- }
25
- };
26
- exports.ThrottlingException = class ThrottlingException extends __BaseException {
27
- name = "ThrottlingException";
28
- $fault = "client";
29
- constructor(opts) {
30
- super({
31
- name: "ThrottlingException",
32
- $fault: "client",
33
- ...opts,
34
- });
35
- Object.setPrototypeOf(this, ThrottlingException.prototype);
36
- }
37
- };
38
- exports.ValidationException = class ValidationException extends __BaseException {
39
- name = "ValidationException";
40
- $fault = "client";
41
- constructor(opts) {
42
- super({
43
- name: "ValidationException",
44
- $fault: "client",
45
- ...opts,
46
- });
47
- Object.setPrototypeOf(this, ValidationException.prototype);
48
- }
49
- };
50
- exports.ConflictException = class ConflictException extends __BaseException {
51
- name = "ConflictException";
52
- $fault = "client";
53
- constructor(opts) {
54
- super({
55
- name: "ConflictException",
56
- $fault: "client",
57
- ...opts,
58
- });
59
- Object.setPrototypeOf(this, ConflictException.prototype);
60
- }
61
- };
62
- exports.ResourceNotFoundException = class ResourceNotFoundException extends __BaseException {
63
- name = "ResourceNotFoundException";
64
- $fault = "client";
65
- constructor(opts) {
66
- super({
67
- name: "ResourceNotFoundException",
68
- $fault: "client",
69
- ...opts,
70
- });
71
- Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
72
- }
73
- };
74
- exports.ServiceQuotaExceededException = class ServiceQuotaExceededException extends __BaseException {
75
- name = "ServiceQuotaExceededException";
76
- $fault = "client";
77
- constructor(opts) {
78
- super({
79
- name: "ServiceQuotaExceededException",
80
- $fault: "client",
81
- ...opts,
82
- });
83
- Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
84
- }
85
- };
86
- exports.ServiceUnavailableException = class ServiceUnavailableException extends __BaseException {
87
- name = "ServiceUnavailableException";
88
- $fault = "server";
89
- constructor(opts) {
90
- super({
91
- name: "ServiceUnavailableException",
92
- $fault: "server",
93
- ...opts,
94
- });
95
- Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
96
- }
97
- };
98
- exports.ModelErrorException = class ModelErrorException extends __BaseException {
99
- name = "ModelErrorException";
100
- $fault = "client";
101
- originalStatusCode;
102
- resourceName;
103
- constructor(opts) {
104
- super({
105
- name: "ModelErrorException",
106
- $fault: "client",
107
- ...opts,
108
- });
109
- Object.setPrototypeOf(this, ModelErrorException.prototype);
110
- this.originalStatusCode = opts.originalStatusCode;
111
- this.resourceName = opts.resourceName;
112
- }
113
- };
114
- exports.ModelNotReadyException = class ModelNotReadyException extends __BaseException {
115
- name = "ModelNotReadyException";
116
- $fault = "client";
117
- $retryable = {};
118
- constructor(opts) {
119
- super({
120
- name: "ModelNotReadyException",
121
- $fault: "client",
122
- ...opts,
123
- });
124
- Object.setPrototypeOf(this, ModelNotReadyException.prototype);
125
- }
126
- };
127
- exports.ModelTimeoutException = class ModelTimeoutException extends __BaseException {
128
- name = "ModelTimeoutException";
129
- $fault = "client";
130
- constructor(opts) {
131
- super({
132
- name: "ModelTimeoutException",
133
- $fault: "client",
134
- ...opts,
135
- });
136
- Object.setPrototypeOf(this, ModelTimeoutException.prototype);
137
- }
138
- };
139
- exports.ModelStreamErrorException = class ModelStreamErrorException extends __BaseException {
140
- name = "ModelStreamErrorException";
141
- $fault = "client";
142
- originalStatusCode;
143
- originalMessage;
144
- constructor(opts) {
145
- super({
146
- name: "ModelStreamErrorException",
147
- $fault: "client",
148
- ...opts,
149
- });
150
- Object.setPrototypeOf(this, ModelStreamErrorException.prototype);
151
- this.originalStatusCode = opts.originalStatusCode;
152
- this.originalMessage = opts.originalMessage;
153
- }
154
- };
@@ -1,37 +0,0 @@
1
- const packageInfo = require("../package.json");
2
- const { Sha256 } = require("@aws-crypto/sha256-browser");
3
- const { createDefaultUserAgentProvider } = require("@aws-sdk/core/client");
4
- const { eventStreamPayloadHandlerProvider, WebSocketFetchHandler: WebSocketRequestHandler } = require("@aws-sdk/middleware-websocket");
5
- const { invalidProvider, loadConfigsForDefaultMode } = require("@smithy/core/client");
6
- const { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT, resolveDefaultsModeConfig } = require("@smithy/core/config");
7
- const { eventStreamSerdeProvider } = require("@smithy/core/event-streams");
8
- const { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } = require("@smithy/core/retry");
9
- const { calculateBodyLength } = require("@smithy/core/serde");
10
- const { FetchHttpHandler: HttpRequestHandler, streamCollector } = require("@smithy/fetch-http-handler");
11
- const { getRuntimeConfig: getSharedRuntimeConfig } = require("./runtimeConfig.shared");
12
- const getRuntimeConfig = (config) => {
13
- const defaultsMode = resolveDefaultsModeConfig(config);
14
- const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
15
- const clientSharedValues = getSharedRuntimeConfig(config);
16
- return {
17
- ...clientSharedValues,
18
- ...config,
19
- runtime: "browser",
20
- defaultsMode,
21
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
22
- credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
23
- defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
24
- eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
25
- eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
26
- maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
27
- region: config?.region ?? invalidProvider("Region is missing"),
28
- requestHandler: WebSocketRequestHandler.create(config?.requestHandler
29
- ?? defaultConfigProvider, HttpRequestHandler.create(defaultConfigProvider)),
30
- retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
31
- sha256: config?.sha256 ?? Sha256,
32
- streamCollector: config?.streamCollector ?? streamCollector,
33
- useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
34
- useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
35
- };
36
- };
37
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,74 +0,0 @@
1
- const packageInfo = require("../package.json");
2
- const { createDefaultUserAgentProvider, emitWarningIfUnsupportedVersion: awsCheckVersion, NODE_APP_ID_CONFIG_OPTIONS } = require("@aws-sdk/core/client");
3
- const { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } = require("@aws-sdk/core/httpAuthSchemes");
4
- const { defaultProvider: credentialDefaultProvider } = require("@aws-sdk/credential-provider-node");
5
- const { eventStreamPayloadHandlerProvider } = require("@aws-sdk/eventstream-handler-node");
6
- const { fromEnvSigningName, nodeProvider } = require("@aws-sdk/token-providers");
7
- const { HttpBearerAuthSigner } = require("@smithy/core");
8
- const { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } = require("@smithy/core/client");
9
- const { loadConfig: loadNodeConfig, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, resolveDefaultsModeConfig } = require("@smithy/core/config");
10
- const { eventStreamSerdeProvider } = require("@smithy/core/event-streams");
11
- const { DEFAULT_RETRY_MODE, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } = require("@smithy/core/retry");
12
- const { calculateBodyLength, Hash } = require("@smithy/core/serde");
13
- const { NodeHttp2Handler: RequestHandler, streamCollector } = require("@smithy/node-http-handler");
14
- const { getRuntimeConfig: getSharedRuntimeConfig } = require("./runtimeConfig.shared");
15
- const getRuntimeConfig = (config) => {
16
- emitWarningIfUnsupportedVersion(process.version);
17
- const defaultsMode = resolveDefaultsModeConfig(config);
18
- const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
19
- const clientSharedValues = getSharedRuntimeConfig(config);
20
- awsCheckVersion(process.version);
21
- const loaderConfig = {
22
- profile: config?.profile,
23
- logger: clientSharedValues.logger,
24
- signingName: "bedrock",
25
- };
26
- return {
27
- ...clientSharedValues,
28
- ...config,
29
- runtime: "node",
30
- defaultsMode,
31
- authSchemePreference: config?.authSchemePreference ?? loadNodeConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
32
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
33
- credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
34
- defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
35
- eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
36
- eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
37
- httpAuthSchemes: config?.httpAuthSchemes ?? [
38
- {
39
- schemeId: "aws.auth#sigv4",
40
- identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
41
- signer: new AwsSdkSigV4Signer(),
42
- },
43
- {
44
- schemeId: "smithy.api#httpBearerAuth",
45
- identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") || (async (idProps) => {
46
- try {
47
- return await fromEnvSigningName({ signingName: "bedrock" })();
48
- }
49
- catch (error) {
50
- return await nodeProvider(idProps)(idProps);
51
- }
52
- }),
53
- signer: new HttpBearerAuthSigner(),
54
- },
55
- ],
56
- maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
57
- region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
58
- requestHandler: RequestHandler.create(config?.requestHandler ?? (async () => ({
59
- ...await defaultConfigProvider(),
60
- disableConcurrentStreams: true
61
- }))),
62
- retryMode: config?.retryMode ??
63
- loadNodeConfig({
64
- ...NODE_RETRY_MODE_CONFIG_OPTIONS,
65
- default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
66
- }, config),
67
- sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
68
- streamCollector: config?.streamCollector ?? streamCollector,
69
- useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
70
- useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
71
- userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
72
- };
73
- };
74
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,16 +0,0 @@
1
- const { Sha256 } = require("@aws-crypto/sha256-js");
2
- const { invalidFunction } = require("@smithy/core/client");
3
- const { getRuntimeConfig: getBrowserRuntimeConfig } = require("./runtimeConfig.browser");
4
- const getRuntimeConfig = (config) => {
5
- const browserDefaults = getBrowserRuntimeConfig(config);
6
- return {
7
- ...browserDefaults,
8
- ...config,
9
- runtime: "react-native",
10
- eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? (() => ({
11
- handle: invalidFunction("event stream request is not supported in ReactNative."),
12
- })),
13
- sha256: config?.sha256 ?? Sha256,
14
- };
15
- };
16
- exports.getRuntimeConfig = getRuntimeConfig;
@@ -1,44 +0,0 @@
1
- const { AwsSdkSigV4Signer } = require("@aws-sdk/core/httpAuthSchemes");
2
- const { AwsRestJsonProtocol } = require("@aws-sdk/core/protocols");
3
- const { HttpBearerAuthSigner } = require("@smithy/core");
4
- const { NoOpLogger } = require("@smithy/core/client");
5
- const { parseUrl } = require("@smithy/core/protocols");
6
- const { fromBase64, fromUtf8, toBase64, toUtf8 } = require("@smithy/core/serde");
7
- const { defaultBedrockRuntimeHttpAuthSchemeProvider } = require("./auth/httpAuthSchemeProvider");
8
- const { defaultEndpointResolver } = require("./endpoint/endpointResolver");
9
- const { errorTypeRegistries } = require("./schemas/schemas_0");
10
- exports.getRuntimeConfig = (config) => {
11
- return {
12
- apiVersion: "2023-09-30",
13
- base64Decoder: config?.base64Decoder ?? fromBase64,
14
- base64Encoder: config?.base64Encoder ?? toBase64,
15
- disableHostPrefix: config?.disableHostPrefix ?? false,
16
- endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
17
- extensions: config?.extensions ?? [],
18
- httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultBedrockRuntimeHttpAuthSchemeProvider,
19
- httpAuthSchemes: config?.httpAuthSchemes ?? [
20
- {
21
- schemeId: "aws.auth#sigv4",
22
- identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
23
- signer: new AwsSdkSigV4Signer(),
24
- },
25
- {
26
- schemeId: "smithy.api#httpBearerAuth",
27
- identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
28
- signer: new HttpBearerAuthSigner(),
29
- },
30
- ],
31
- logger: config?.logger ?? new NoOpLogger(),
32
- protocol: config?.protocol ?? AwsRestJsonProtocol,
33
- protocolSettings: config?.protocolSettings ?? {
34
- defaultNamespace: "com.amazonaws.bedrockruntime",
35
- errorTypeRegistries,
36
- version: "2023-09-30",
37
- serviceTarget: "AmazonBedrockFrontendService",
38
- },
39
- serviceId: config?.serviceId ?? "Bedrock Runtime",
40
- urlParser: config?.urlParser ?? parseUrl,
41
- utf8Decoder: config?.utf8Decoder ?? fromUtf8,
42
- utf8Encoder: config?.utf8Encoder ?? toUtf8,
43
- };
44
- };