@aws-sdk/client-bedrock-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/BedrockRuntime.js +1 -15
- package/dist-cjs/BedrockRuntimeClient.js +1 -45
- package/dist-cjs/commands/InvokeModelCommand.js +1 -29
- package/dist-cjs/commands/InvokeModelWithResponseStreamCommand.js +1 -33
- package/dist-cjs/commands/index.js +1 -5
- package/dist-cjs/endpoint/EndpointParameters.js +1 -18
- package/dist-cjs/extensionConfiguration.js +1 -2
- package/dist-cjs/index.js +886 -10
- package/dist-cjs/models/BedrockRuntimeServiceException.js +1 -12
- package/dist-cjs/models/index.js +1 -4
- package/dist-cjs/models/models_0.js +1 -199
- package/dist-cjs/protocols/Aws_restJson1.js +1 -427
- package/dist-cjs/runtimeExtensions.js +1 -22
- package/package.json +44 -44
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BedrockRuntimeServiceException = 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 BedrockRuntimeServiceException extends smithy_client_1.ServiceException {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
super(options);
|
|
9
|
-
Object.setPrototypeOf(this, BedrockRuntimeServiceException.prototype);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.BedrockRuntimeServiceException = BedrockRuntimeServiceException;
|
|
1
|
+
module.exports = require("../index.js");
|
package/dist-cjs/models/index.js
CHANGED
|
@@ -1,199 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvokeModelWithResponseStreamResponseFilterSensitiveLog = exports.ResponseStreamFilterSensitiveLog = exports.PayloadPartFilterSensitiveLog = exports.InvokeModelWithResponseStreamRequestFilterSensitiveLog = exports.InvokeModelResponseFilterSensitiveLog = exports.InvokeModelRequestFilterSensitiveLog = exports.ResponseStream = exports.ModelStreamErrorException = exports.ValidationException = exports.ThrottlingException = exports.ServiceQuotaExceededException = exports.ResourceNotFoundException = exports.ModelTimeoutException = exports.ModelNotReadyException = exports.ModelErrorException = exports.InternalServerException = exports.AccessDeniedException = void 0;
|
|
4
|
-
const smithy_client_1 = require("@smithy/smithy-client");
|
|
5
|
-
const BedrockRuntimeServiceException_1 = require("./BedrockRuntimeServiceException");
|
|
6
|
-
class AccessDeniedException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
7
|
-
constructor(opts) {
|
|
8
|
-
super({
|
|
9
|
-
name: "AccessDeniedException",
|
|
10
|
-
$fault: "client",
|
|
11
|
-
...opts,
|
|
12
|
-
});
|
|
13
|
-
this.name = "AccessDeniedException";
|
|
14
|
-
this.$fault = "client";
|
|
15
|
-
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.AccessDeniedException = AccessDeniedException;
|
|
19
|
-
class InternalServerException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
20
|
-
constructor(opts) {
|
|
21
|
-
super({
|
|
22
|
-
name: "InternalServerException",
|
|
23
|
-
$fault: "server",
|
|
24
|
-
...opts,
|
|
25
|
-
});
|
|
26
|
-
this.name = "InternalServerException";
|
|
27
|
-
this.$fault = "server";
|
|
28
|
-
Object.setPrototypeOf(this, InternalServerException.prototype);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.InternalServerException = InternalServerException;
|
|
32
|
-
class ModelErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
33
|
-
constructor(opts) {
|
|
34
|
-
super({
|
|
35
|
-
name: "ModelErrorException",
|
|
36
|
-
$fault: "client",
|
|
37
|
-
...opts,
|
|
38
|
-
});
|
|
39
|
-
this.name = "ModelErrorException";
|
|
40
|
-
this.$fault = "client";
|
|
41
|
-
Object.setPrototypeOf(this, ModelErrorException.prototype);
|
|
42
|
-
this.originalStatusCode = opts.originalStatusCode;
|
|
43
|
-
this.resourceName = opts.resourceName;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.ModelErrorException = ModelErrorException;
|
|
47
|
-
class ModelNotReadyException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
48
|
-
constructor(opts) {
|
|
49
|
-
super({
|
|
50
|
-
name: "ModelNotReadyException",
|
|
51
|
-
$fault: "client",
|
|
52
|
-
...opts,
|
|
53
|
-
});
|
|
54
|
-
this.name = "ModelNotReadyException";
|
|
55
|
-
this.$fault = "client";
|
|
56
|
-
Object.setPrototypeOf(this, ModelNotReadyException.prototype);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.ModelNotReadyException = ModelNotReadyException;
|
|
60
|
-
class ModelTimeoutException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
61
|
-
constructor(opts) {
|
|
62
|
-
super({
|
|
63
|
-
name: "ModelTimeoutException",
|
|
64
|
-
$fault: "client",
|
|
65
|
-
...opts,
|
|
66
|
-
});
|
|
67
|
-
this.name = "ModelTimeoutException";
|
|
68
|
-
this.$fault = "client";
|
|
69
|
-
Object.setPrototypeOf(this, ModelTimeoutException.prototype);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.ModelTimeoutException = ModelTimeoutException;
|
|
73
|
-
class ResourceNotFoundException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
74
|
-
constructor(opts) {
|
|
75
|
-
super({
|
|
76
|
-
name: "ResourceNotFoundException",
|
|
77
|
-
$fault: "client",
|
|
78
|
-
...opts,
|
|
79
|
-
});
|
|
80
|
-
this.name = "ResourceNotFoundException";
|
|
81
|
-
this.$fault = "client";
|
|
82
|
-
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.ResourceNotFoundException = ResourceNotFoundException;
|
|
86
|
-
class ServiceQuotaExceededException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
87
|
-
constructor(opts) {
|
|
88
|
-
super({
|
|
89
|
-
name: "ServiceQuotaExceededException",
|
|
90
|
-
$fault: "client",
|
|
91
|
-
...opts,
|
|
92
|
-
});
|
|
93
|
-
this.name = "ServiceQuotaExceededException";
|
|
94
|
-
this.$fault = "client";
|
|
95
|
-
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.ServiceQuotaExceededException = ServiceQuotaExceededException;
|
|
99
|
-
class ThrottlingException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
100
|
-
constructor(opts) {
|
|
101
|
-
super({
|
|
102
|
-
name: "ThrottlingException",
|
|
103
|
-
$fault: "client",
|
|
104
|
-
...opts,
|
|
105
|
-
});
|
|
106
|
-
this.name = "ThrottlingException";
|
|
107
|
-
this.$fault = "client";
|
|
108
|
-
Object.setPrototypeOf(this, ThrottlingException.prototype);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.ThrottlingException = ThrottlingException;
|
|
112
|
-
class ValidationException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
113
|
-
constructor(opts) {
|
|
114
|
-
super({
|
|
115
|
-
name: "ValidationException",
|
|
116
|
-
$fault: "client",
|
|
117
|
-
...opts,
|
|
118
|
-
});
|
|
119
|
-
this.name = "ValidationException";
|
|
120
|
-
this.$fault = "client";
|
|
121
|
-
Object.setPrototypeOf(this, ValidationException.prototype);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.ValidationException = ValidationException;
|
|
125
|
-
class ModelStreamErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
|
|
126
|
-
constructor(opts) {
|
|
127
|
-
super({
|
|
128
|
-
name: "ModelStreamErrorException",
|
|
129
|
-
$fault: "client",
|
|
130
|
-
...opts,
|
|
131
|
-
});
|
|
132
|
-
this.name = "ModelStreamErrorException";
|
|
133
|
-
this.$fault = "client";
|
|
134
|
-
Object.setPrototypeOf(this, ModelStreamErrorException.prototype);
|
|
135
|
-
this.originalStatusCode = opts.originalStatusCode;
|
|
136
|
-
this.originalMessage = opts.originalMessage;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.ModelStreamErrorException = ModelStreamErrorException;
|
|
140
|
-
var ResponseStream;
|
|
141
|
-
(function (ResponseStream) {
|
|
142
|
-
ResponseStream.visit = (value, visitor) => {
|
|
143
|
-
if (value.chunk !== undefined)
|
|
144
|
-
return visitor.chunk(value.chunk);
|
|
145
|
-
if (value.internalServerException !== undefined)
|
|
146
|
-
return visitor.internalServerException(value.internalServerException);
|
|
147
|
-
if (value.modelStreamErrorException !== undefined)
|
|
148
|
-
return visitor.modelStreamErrorException(value.modelStreamErrorException);
|
|
149
|
-
if (value.validationException !== undefined)
|
|
150
|
-
return visitor.validationException(value.validationException);
|
|
151
|
-
if (value.throttlingException !== undefined)
|
|
152
|
-
return visitor.throttlingException(value.throttlingException);
|
|
153
|
-
if (value.modelTimeoutException !== undefined)
|
|
154
|
-
return visitor.modelTimeoutException(value.modelTimeoutException);
|
|
155
|
-
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
156
|
-
};
|
|
157
|
-
})(ResponseStream = exports.ResponseStream || (exports.ResponseStream = {}));
|
|
158
|
-
const InvokeModelRequestFilterSensitiveLog = (obj) => ({
|
|
159
|
-
...obj,
|
|
160
|
-
...(obj.body && { body: smithy_client_1.SENSITIVE_STRING }),
|
|
161
|
-
});
|
|
162
|
-
exports.InvokeModelRequestFilterSensitiveLog = InvokeModelRequestFilterSensitiveLog;
|
|
163
|
-
const InvokeModelResponseFilterSensitiveLog = (obj) => ({
|
|
164
|
-
...obj,
|
|
165
|
-
...(obj.body && { body: smithy_client_1.SENSITIVE_STRING }),
|
|
166
|
-
});
|
|
167
|
-
exports.InvokeModelResponseFilterSensitiveLog = InvokeModelResponseFilterSensitiveLog;
|
|
168
|
-
const InvokeModelWithResponseStreamRequestFilterSensitiveLog = (obj) => ({
|
|
169
|
-
...obj,
|
|
170
|
-
...(obj.body && { body: smithy_client_1.SENSITIVE_STRING }),
|
|
171
|
-
});
|
|
172
|
-
exports.InvokeModelWithResponseStreamRequestFilterSensitiveLog = InvokeModelWithResponseStreamRequestFilterSensitiveLog;
|
|
173
|
-
const PayloadPartFilterSensitiveLog = (obj) => ({
|
|
174
|
-
...obj,
|
|
175
|
-
...(obj.bytes && { bytes: smithy_client_1.SENSITIVE_STRING }),
|
|
176
|
-
});
|
|
177
|
-
exports.PayloadPartFilterSensitiveLog = PayloadPartFilterSensitiveLog;
|
|
178
|
-
const ResponseStreamFilterSensitiveLog = (obj) => {
|
|
179
|
-
if (obj.chunk !== undefined)
|
|
180
|
-
return { chunk: smithy_client_1.SENSITIVE_STRING };
|
|
181
|
-
if (obj.internalServerException !== undefined)
|
|
182
|
-
return { internalServerException: obj.internalServerException };
|
|
183
|
-
if (obj.modelStreamErrorException !== undefined)
|
|
184
|
-
return { modelStreamErrorException: obj.modelStreamErrorException };
|
|
185
|
-
if (obj.validationException !== undefined)
|
|
186
|
-
return { validationException: obj.validationException };
|
|
187
|
-
if (obj.throttlingException !== undefined)
|
|
188
|
-
return { throttlingException: obj.throttlingException };
|
|
189
|
-
if (obj.modelTimeoutException !== undefined)
|
|
190
|
-
return { modelTimeoutException: obj.modelTimeoutException };
|
|
191
|
-
if (obj.$unknown !== undefined)
|
|
192
|
-
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
193
|
-
};
|
|
194
|
-
exports.ResponseStreamFilterSensitiveLog = ResponseStreamFilterSensitiveLog;
|
|
195
|
-
const InvokeModelWithResponseStreamResponseFilterSensitiveLog = (obj) => ({
|
|
196
|
-
...obj,
|
|
197
|
-
...(obj.body && { body: "STREAMING_CONTENT" }),
|
|
198
|
-
});
|
|
199
|
-
exports.InvokeModelWithResponseStreamResponseFilterSensitiveLog = InvokeModelWithResponseStreamResponseFilterSensitiveLog;
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,427 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.de_InvokeModelWithResponseStreamCommand = exports.de_InvokeModelCommand = exports.se_InvokeModelWithResponseStreamCommand = exports.se_InvokeModelCommand = void 0;
|
|
4
|
-
const core_1 = require("@smithy/core");
|
|
5
|
-
const smithy_client_1 = require("@smithy/smithy-client");
|
|
6
|
-
const BedrockRuntimeServiceException_1 = require("../models/BedrockRuntimeServiceException");
|
|
7
|
-
const models_0_1 = require("../models/models_0");
|
|
8
|
-
const se_InvokeModelCommand = 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
|
-
});
|
|
14
|
-
b.bp("/model/{modelId}/invoke");
|
|
15
|
-
b.p("modelId", () => input.modelId, "{modelId}", false);
|
|
16
|
-
let body;
|
|
17
|
-
if (input.body !== undefined) {
|
|
18
|
-
body = input.body;
|
|
19
|
-
}
|
|
20
|
-
b.m("POST").h(headers).b(body);
|
|
21
|
-
return b.build();
|
|
22
|
-
};
|
|
23
|
-
exports.se_InvokeModelCommand = se_InvokeModelCommand;
|
|
24
|
-
const se_InvokeModelWithResponseStreamCommand = async (input, context) => {
|
|
25
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
26
|
-
const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
|
|
27
|
-
[_ct]: input[_cT] || "application/octet-stream",
|
|
28
|
-
[_xaba]: input[_a],
|
|
29
|
-
});
|
|
30
|
-
b.bp("/model/{modelId}/invoke-with-response-stream");
|
|
31
|
-
b.p("modelId", () => input.modelId, "{modelId}", false);
|
|
32
|
-
let body;
|
|
33
|
-
if (input.body !== undefined) {
|
|
34
|
-
body = input.body;
|
|
35
|
-
}
|
|
36
|
-
b.m("POST").h(headers).b(body);
|
|
37
|
-
return b.build();
|
|
38
|
-
};
|
|
39
|
-
exports.se_InvokeModelWithResponseStreamCommand = se_InvokeModelWithResponseStreamCommand;
|
|
40
|
-
const de_InvokeModelCommand = async (output, context) => {
|
|
41
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
42
|
-
return de_InvokeModelCommandError(output, context);
|
|
43
|
-
}
|
|
44
|
-
const contents = (0, smithy_client_1.map)({
|
|
45
|
-
$metadata: deserializeMetadata(output),
|
|
46
|
-
[_cT]: [, output.headers[_ct]],
|
|
47
|
-
});
|
|
48
|
-
const data = await (0, smithy_client_1.collectBody)(output.body, context);
|
|
49
|
-
contents.body = data;
|
|
50
|
-
return contents;
|
|
51
|
-
};
|
|
52
|
-
exports.de_InvokeModelCommand = de_InvokeModelCommand;
|
|
53
|
-
const de_InvokeModelCommandError = async (output, context) => {
|
|
54
|
-
const parsedOutput = {
|
|
55
|
-
...output,
|
|
56
|
-
body: await parseErrorBody(output.body, context),
|
|
57
|
-
};
|
|
58
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
59
|
-
switch (errorCode) {
|
|
60
|
-
case "AccessDeniedException":
|
|
61
|
-
case "com.amazonaws.bedrockruntime#AccessDeniedException":
|
|
62
|
-
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
63
|
-
case "InternalServerException":
|
|
64
|
-
case "com.amazonaws.bedrockruntime#InternalServerException":
|
|
65
|
-
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
66
|
-
case "ModelErrorException":
|
|
67
|
-
case "com.amazonaws.bedrockruntime#ModelErrorException":
|
|
68
|
-
throw await de_ModelErrorExceptionRes(parsedOutput, context);
|
|
69
|
-
case "ModelNotReadyException":
|
|
70
|
-
case "com.amazonaws.bedrockruntime#ModelNotReadyException":
|
|
71
|
-
throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
|
|
72
|
-
case "ModelTimeoutException":
|
|
73
|
-
case "com.amazonaws.bedrockruntime#ModelTimeoutException":
|
|
74
|
-
throw await de_ModelTimeoutExceptionRes(parsedOutput, context);
|
|
75
|
-
case "ResourceNotFoundException":
|
|
76
|
-
case "com.amazonaws.bedrockruntime#ResourceNotFoundException":
|
|
77
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
78
|
-
case "ServiceQuotaExceededException":
|
|
79
|
-
case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
|
|
80
|
-
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
|
|
81
|
-
case "ThrottlingException":
|
|
82
|
-
case "com.amazonaws.bedrockruntime#ThrottlingException":
|
|
83
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
84
|
-
case "ValidationException":
|
|
85
|
-
case "com.amazonaws.bedrockruntime#ValidationException":
|
|
86
|
-
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
87
|
-
default:
|
|
88
|
-
const parsedBody = parsedOutput.body;
|
|
89
|
-
return throwDefaultError({
|
|
90
|
-
output,
|
|
91
|
-
parsedBody,
|
|
92
|
-
errorCode,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const de_InvokeModelWithResponseStreamCommand = async (output, context) => {
|
|
97
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
98
|
-
return de_InvokeModelWithResponseStreamCommandError(output, context);
|
|
99
|
-
}
|
|
100
|
-
const contents = (0, smithy_client_1.map)({
|
|
101
|
-
$metadata: deserializeMetadata(output),
|
|
102
|
-
[_cT]: [, output.headers[_xabct]],
|
|
103
|
-
});
|
|
104
|
-
const data = output.body;
|
|
105
|
-
contents.body = de_ResponseStream(data, context);
|
|
106
|
-
return contents;
|
|
107
|
-
};
|
|
108
|
-
exports.de_InvokeModelWithResponseStreamCommand = de_InvokeModelWithResponseStreamCommand;
|
|
109
|
-
const de_InvokeModelWithResponseStreamCommandError = async (output, context) => {
|
|
110
|
-
const parsedOutput = {
|
|
111
|
-
...output,
|
|
112
|
-
body: await parseErrorBody(output.body, context),
|
|
113
|
-
};
|
|
114
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
115
|
-
switch (errorCode) {
|
|
116
|
-
case "AccessDeniedException":
|
|
117
|
-
case "com.amazonaws.bedrockruntime#AccessDeniedException":
|
|
118
|
-
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
119
|
-
case "InternalServerException":
|
|
120
|
-
case "com.amazonaws.bedrockruntime#InternalServerException":
|
|
121
|
-
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
122
|
-
case "ModelErrorException":
|
|
123
|
-
case "com.amazonaws.bedrockruntime#ModelErrorException":
|
|
124
|
-
throw await de_ModelErrorExceptionRes(parsedOutput, context);
|
|
125
|
-
case "ModelNotReadyException":
|
|
126
|
-
case "com.amazonaws.bedrockruntime#ModelNotReadyException":
|
|
127
|
-
throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
|
|
128
|
-
case "ModelStreamErrorException":
|
|
129
|
-
case "com.amazonaws.bedrockruntime#ModelStreamErrorException":
|
|
130
|
-
throw await de_ModelStreamErrorExceptionRes(parsedOutput, context);
|
|
131
|
-
case "ModelTimeoutException":
|
|
132
|
-
case "com.amazonaws.bedrockruntime#ModelTimeoutException":
|
|
133
|
-
throw await de_ModelTimeoutExceptionRes(parsedOutput, context);
|
|
134
|
-
case "ResourceNotFoundException":
|
|
135
|
-
case "com.amazonaws.bedrockruntime#ResourceNotFoundException":
|
|
136
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
137
|
-
case "ServiceQuotaExceededException":
|
|
138
|
-
case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
|
|
139
|
-
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
|
|
140
|
-
case "ThrottlingException":
|
|
141
|
-
case "com.amazonaws.bedrockruntime#ThrottlingException":
|
|
142
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
143
|
-
case "ValidationException":
|
|
144
|
-
case "com.amazonaws.bedrockruntime#ValidationException":
|
|
145
|
-
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
146
|
-
default:
|
|
147
|
-
const parsedBody = parsedOutput.body;
|
|
148
|
-
return throwDefaultError({
|
|
149
|
-
output,
|
|
150
|
-
parsedBody,
|
|
151
|
-
errorCode,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const throwDefaultError = (0, smithy_client_1.withBaseException)(BedrockRuntimeServiceException_1.BedrockRuntimeServiceException);
|
|
156
|
-
const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
|
157
|
-
const contents = (0, smithy_client_1.map)({});
|
|
158
|
-
const data = parsedOutput.body;
|
|
159
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
160
|
-
message: smithy_client_1.expectString,
|
|
161
|
-
});
|
|
162
|
-
Object.assign(contents, doc);
|
|
163
|
-
const exception = new models_0_1.AccessDeniedException({
|
|
164
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
165
|
-
...contents,
|
|
166
|
-
});
|
|
167
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
168
|
-
};
|
|
169
|
-
const de_InternalServerExceptionRes = async (parsedOutput, context) => {
|
|
170
|
-
const contents = (0, smithy_client_1.map)({});
|
|
171
|
-
const data = parsedOutput.body;
|
|
172
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
173
|
-
message: smithy_client_1.expectString,
|
|
174
|
-
});
|
|
175
|
-
Object.assign(contents, doc);
|
|
176
|
-
const exception = new models_0_1.InternalServerException({
|
|
177
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
178
|
-
...contents,
|
|
179
|
-
});
|
|
180
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
181
|
-
};
|
|
182
|
-
const de_ModelErrorExceptionRes = async (parsedOutput, context) => {
|
|
183
|
-
const contents = (0, smithy_client_1.map)({});
|
|
184
|
-
const data = parsedOutput.body;
|
|
185
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
186
|
-
message: smithy_client_1.expectString,
|
|
187
|
-
originalStatusCode: smithy_client_1.expectInt32,
|
|
188
|
-
resourceName: smithy_client_1.expectString,
|
|
189
|
-
});
|
|
190
|
-
Object.assign(contents, doc);
|
|
191
|
-
const exception = new models_0_1.ModelErrorException({
|
|
192
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
193
|
-
...contents,
|
|
194
|
-
});
|
|
195
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
196
|
-
};
|
|
197
|
-
const de_ModelNotReadyExceptionRes = async (parsedOutput, context) => {
|
|
198
|
-
const contents = (0, smithy_client_1.map)({});
|
|
199
|
-
const data = parsedOutput.body;
|
|
200
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
201
|
-
message: smithy_client_1.expectString,
|
|
202
|
-
});
|
|
203
|
-
Object.assign(contents, doc);
|
|
204
|
-
const exception = new models_0_1.ModelNotReadyException({
|
|
205
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
206
|
-
...contents,
|
|
207
|
-
});
|
|
208
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
209
|
-
};
|
|
210
|
-
const de_ModelStreamErrorExceptionRes = async (parsedOutput, context) => {
|
|
211
|
-
const contents = (0, smithy_client_1.map)({});
|
|
212
|
-
const data = parsedOutput.body;
|
|
213
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
214
|
-
message: smithy_client_1.expectString,
|
|
215
|
-
originalMessage: smithy_client_1.expectString,
|
|
216
|
-
originalStatusCode: smithy_client_1.expectInt32,
|
|
217
|
-
});
|
|
218
|
-
Object.assign(contents, doc);
|
|
219
|
-
const exception = new models_0_1.ModelStreamErrorException({
|
|
220
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
221
|
-
...contents,
|
|
222
|
-
});
|
|
223
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
224
|
-
};
|
|
225
|
-
const de_ModelTimeoutExceptionRes = async (parsedOutput, context) => {
|
|
226
|
-
const contents = (0, smithy_client_1.map)({});
|
|
227
|
-
const data = parsedOutput.body;
|
|
228
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
229
|
-
message: smithy_client_1.expectString,
|
|
230
|
-
});
|
|
231
|
-
Object.assign(contents, doc);
|
|
232
|
-
const exception = new models_0_1.ModelTimeoutException({
|
|
233
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
234
|
-
...contents,
|
|
235
|
-
});
|
|
236
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
237
|
-
};
|
|
238
|
-
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
239
|
-
const contents = (0, smithy_client_1.map)({});
|
|
240
|
-
const data = parsedOutput.body;
|
|
241
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
242
|
-
message: smithy_client_1.expectString,
|
|
243
|
-
});
|
|
244
|
-
Object.assign(contents, doc);
|
|
245
|
-
const exception = new models_0_1.ResourceNotFoundException({
|
|
246
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
247
|
-
...contents,
|
|
248
|
-
});
|
|
249
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
250
|
-
};
|
|
251
|
-
const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
|
|
252
|
-
const contents = (0, smithy_client_1.map)({});
|
|
253
|
-
const data = parsedOutput.body;
|
|
254
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
255
|
-
message: smithy_client_1.expectString,
|
|
256
|
-
});
|
|
257
|
-
Object.assign(contents, doc);
|
|
258
|
-
const exception = new models_0_1.ServiceQuotaExceededException({
|
|
259
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
260
|
-
...contents,
|
|
261
|
-
});
|
|
262
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
263
|
-
};
|
|
264
|
-
const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
|
|
265
|
-
const contents = (0, smithy_client_1.map)({});
|
|
266
|
-
const data = parsedOutput.body;
|
|
267
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
268
|
-
message: smithy_client_1.expectString,
|
|
269
|
-
});
|
|
270
|
-
Object.assign(contents, doc);
|
|
271
|
-
const exception = new models_0_1.ThrottlingException({
|
|
272
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
273
|
-
...contents,
|
|
274
|
-
});
|
|
275
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
276
|
-
};
|
|
277
|
-
const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
278
|
-
const contents = (0, smithy_client_1.map)({});
|
|
279
|
-
const data = parsedOutput.body;
|
|
280
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
281
|
-
message: smithy_client_1.expectString,
|
|
282
|
-
});
|
|
283
|
-
Object.assign(contents, doc);
|
|
284
|
-
const exception = new models_0_1.ValidationException({
|
|
285
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
286
|
-
...contents,
|
|
287
|
-
});
|
|
288
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
289
|
-
};
|
|
290
|
-
const de_ResponseStream = (output, context) => {
|
|
291
|
-
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
292
|
-
if (event["chunk"] != null) {
|
|
293
|
-
return {
|
|
294
|
-
chunk: await de_PayloadPart_event(event["chunk"], context),
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
if (event["internalServerException"] != null) {
|
|
298
|
-
return {
|
|
299
|
-
internalServerException: await de_InternalServerException_event(event["internalServerException"], context),
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
if (event["modelStreamErrorException"] != null) {
|
|
303
|
-
return {
|
|
304
|
-
modelStreamErrorException: await de_ModelStreamErrorException_event(event["modelStreamErrorException"], context),
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
if (event["validationException"] != null) {
|
|
308
|
-
return {
|
|
309
|
-
validationException: await de_ValidationException_event(event["validationException"], context),
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
if (event["throttlingException"] != null) {
|
|
313
|
-
return {
|
|
314
|
-
throttlingException: await de_ThrottlingException_event(event["throttlingException"], context),
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
if (event["modelTimeoutException"] != null) {
|
|
318
|
-
return {
|
|
319
|
-
modelTimeoutException: await de_ModelTimeoutException_event(event["modelTimeoutException"], context),
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
return { $unknown: output };
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
|
-
const de_InternalServerException_event = async (output, context) => {
|
|
326
|
-
const parsedOutput = {
|
|
327
|
-
...output,
|
|
328
|
-
body: await parseBody(output.body, context),
|
|
329
|
-
};
|
|
330
|
-
return de_InternalServerExceptionRes(parsedOutput, context);
|
|
331
|
-
};
|
|
332
|
-
const de_ModelStreamErrorException_event = async (output, context) => {
|
|
333
|
-
const parsedOutput = {
|
|
334
|
-
...output,
|
|
335
|
-
body: await parseBody(output.body, context),
|
|
336
|
-
};
|
|
337
|
-
return de_ModelStreamErrorExceptionRes(parsedOutput, context);
|
|
338
|
-
};
|
|
339
|
-
const de_ModelTimeoutException_event = async (output, context) => {
|
|
340
|
-
const parsedOutput = {
|
|
341
|
-
...output,
|
|
342
|
-
body: await parseBody(output.body, context),
|
|
343
|
-
};
|
|
344
|
-
return de_ModelTimeoutExceptionRes(parsedOutput, context);
|
|
345
|
-
};
|
|
346
|
-
const de_PayloadPart_event = async (output, context) => {
|
|
347
|
-
const contents = {};
|
|
348
|
-
const data = await parseBody(output.body, context);
|
|
349
|
-
Object.assign(contents, de_PayloadPart(data, context));
|
|
350
|
-
return contents;
|
|
351
|
-
};
|
|
352
|
-
const de_ThrottlingException_event = async (output, context) => {
|
|
353
|
-
const parsedOutput = {
|
|
354
|
-
...output,
|
|
355
|
-
body: await parseBody(output.body, context),
|
|
356
|
-
};
|
|
357
|
-
return de_ThrottlingExceptionRes(parsedOutput, context);
|
|
358
|
-
};
|
|
359
|
-
const de_ValidationException_event = async (output, context) => {
|
|
360
|
-
const parsedOutput = {
|
|
361
|
-
...output,
|
|
362
|
-
body: await parseBody(output.body, context),
|
|
363
|
-
};
|
|
364
|
-
return de_ValidationExceptionRes(parsedOutput, context);
|
|
365
|
-
};
|
|
366
|
-
const de_PayloadPart = (output, context) => {
|
|
367
|
-
return (0, smithy_client_1.take)(output, {
|
|
368
|
-
bytes: context.base64Decoder,
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
const deserializeMetadata = (output) => ({
|
|
372
|
-
httpStatusCode: output.statusCode,
|
|
373
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
374
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
375
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
376
|
-
});
|
|
377
|
-
const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
378
|
-
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
379
|
-
value !== null &&
|
|
380
|
-
value !== "" &&
|
|
381
|
-
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
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";
|
|
388
|
-
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
389
|
-
if (encoded.length) {
|
|
390
|
-
return JSON.parse(encoded);
|
|
391
|
-
}
|
|
392
|
-
return {};
|
|
393
|
-
});
|
|
394
|
-
const parseErrorBody = async (errorBody, context) => {
|
|
395
|
-
const value = await parseBody(errorBody, context);
|
|
396
|
-
value.message = value.message ?? value.Message;
|
|
397
|
-
return value;
|
|
398
|
-
};
|
|
399
|
-
const loadRestJsonErrorCode = (output, data) => {
|
|
400
|
-
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
401
|
-
const sanitizeErrorCode = (rawValue) => {
|
|
402
|
-
let cleanValue = rawValue;
|
|
403
|
-
if (typeof cleanValue === "number") {
|
|
404
|
-
cleanValue = cleanValue.toString();
|
|
405
|
-
}
|
|
406
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
407
|
-
cleanValue = cleanValue.split(",")[0];
|
|
408
|
-
}
|
|
409
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
410
|
-
cleanValue = cleanValue.split(":")[0];
|
|
411
|
-
}
|
|
412
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
413
|
-
cleanValue = cleanValue.split("#")[1];
|
|
414
|
-
}
|
|
415
|
-
return cleanValue;
|
|
416
|
-
};
|
|
417
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
418
|
-
if (headerKey !== undefined) {
|
|
419
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
420
|
-
}
|
|
421
|
-
if (data.code !== undefined) {
|
|
422
|
-
return sanitizeErrorCode(data.code);
|
|
423
|
-
}
|
|
424
|
-
if (data["__type"] !== undefined) {
|
|
425
|
-
return sanitizeErrorCode(data["__type"]);
|
|
426
|
-
}
|
|
427
|
-
};
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
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");
|