@aws/lsp-codewhisperer 0.0.4 → 0.0.5
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/CHANGELOG.md +7 -0
- package/out/client/sigv4/service.json +1 -1
- package/out/client/token/bearer-token-service.json +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/language-server/chat/chatController.d.ts +25 -0
- package/out/language-server/chat/chatController.js +117 -0
- package/out/language-server/chat/chatController.js.map +1 -0
- package/out/language-server/chat/chatController.test.d.ts +1 -0
- package/out/language-server/chat/chatController.test.js +240 -0
- package/out/language-server/chat/chatController.test.js.map +1 -0
- package/out/language-server/chat/chatEventParser.d.ts +24 -0
- package/out/language-server/chat/chatEventParser.js +84 -0
- package/out/language-server/chat/chatEventParser.js.map +1 -0
- package/out/language-server/chat/chatEventParser.test.d.ts +1 -0
- package/out/language-server/chat/chatEventParser.test.js +189 -0
- package/out/language-server/chat/chatEventParser.test.js.map +1 -0
- package/out/language-server/chat/chatSessionManagementService.d.ts +16 -0
- package/out/language-server/chat/chatSessionManagementService.js +92 -0
- package/out/language-server/chat/chatSessionManagementService.js.map +1 -0
- package/out/language-server/chat/chatSessionManagementService.test.d.ts +1 -0
- package/out/language-server/chat/chatSessionManagementService.test.js +73 -0
- package/out/language-server/chat/chatSessionManagementService.test.js.map +1 -0
- package/out/language-server/chat/chatSessionService.d.ts +13 -0
- package/out/language-server/chat/chatSessionService.js +63 -0
- package/out/language-server/chat/chatSessionService.js.map +1 -0
- package/out/language-server/chat/chatSessionService.test.d.ts +1 -0
- package/out/language-server/chat/chatSessionService.test.js +80 -0
- package/out/language-server/chat/chatSessionService.test.js.map +1 -0
- package/out/language-server/chat/contexts/documentContext.d.ts +17 -0
- package/out/language-server/chat/contexts/documentContext.js +59 -0
- package/out/language-server/chat/contexts/documentContext.js.map +1 -0
- package/out/language-server/chat/contexts/documentContext.test.d.ts +1 -0
- package/out/language-server/chat/contexts/documentContext.test.js +147 -0
- package/out/language-server/chat/contexts/documentContext.test.js.map +1 -0
- package/out/language-server/chat/contexts/utils.d.ts +10 -0
- package/out/language-server/chat/contexts/utils.js +71 -0
- package/out/language-server/chat/contexts/utils.js.map +1 -0
- package/out/language-server/chat/contexts/utils.test.d.ts +1 -0
- package/out/language-server/chat/contexts/utils.test.js +72 -0
- package/out/language-server/chat/contexts/utils.test.js.map +1 -0
- package/out/language-server/chat/utils.d.ts +4 -0
- package/out/language-server/chat/utils.js +34 -0
- package/out/language-server/chat/utils.js.map +1 -0
- package/out/language-server/codeWhispererSecurityScanServer.d.ts +1 -1
- package/out/language-server/codeWhispererSecurityScanServer.js +41 -26
- package/out/language-server/codeWhispererSecurityScanServer.js.map +1 -1
- package/out/language-server/codeWhispererServer.js +1 -1
- package/out/language-server/codeWhispererServer.js.map +1 -1
- package/out/language-server/languageDetection.d.ts +9 -2
- package/out/language-server/languageDetection.js +84 -20
- package/out/language-server/languageDetection.js.map +1 -1
- package/out/language-server/languageDetection.test.d.ts +1 -0
- package/out/language-server/languageDetection.test.js +31 -0
- package/out/language-server/languageDetection.test.js.map +1 -0
- package/out/language-server/proxy-server.d.ts +1 -0
- package/out/language-server/proxy-server.js +35 -1
- package/out/language-server/proxy-server.js.map +1 -1
- package/out/language-server/qChatServer.d.ts +3 -0
- package/out/language-server/qChatServer.js +31 -0
- package/out/language-server/qChatServer.js.map +1 -0
- package/out/language-server/qChatServer.test.d.ts +1 -0
- package/out/language-server/qChatServer.test.js +51 -0
- package/out/language-server/qChatServer.test.js.map +1 -0
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.d.ts +2 -3
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js +5 -23
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js.map +1 -1
- package/out/language-server/securityScan/types.d.ts +8 -6
- package/out/language-server/testUtils.d.ts +1 -0
- package/out/language-server/testUtils.js +17 -1
- package/out/language-server/testUtils.js.map +1 -1
- package/out/language-server/types.d.ts +13 -0
- package/out/language-server/types.js +3 -0
- package/out/language-server/types.js.map +1 -0
- package/out/language-server/utils.d.ts +3 -0
- package/out/language-server/utils.js +19 -1
- package/out/language-server/utils.js.map +1 -1
- package/out/language-server/utils.test.d.ts +1 -0
- package/out/language-server/utils.test.js +33 -0
- package/out/language-server/utils.test.js.map +1 -0
- package/package.json +13 -4
- package/src.gen/@amzn/codewhisperer-streaming/LICENSE +201 -0
- package/src.gen/@amzn/codewhisperer-streaming/README.md +464 -0
- package/src.gen/@amzn/codewhisperer-streaming/api-extractor.json +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/CodeWhispererStreaming.js +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/CodeWhispererStreamingClient.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/ExportResultArchiveCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/GenerateAssistantResponseCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/GenerateTaskAssistPlanCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/index.js +6 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/endpoints.js +165 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/extensionConfiguration.js +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/index.js +10 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/CodeWhispererStreamingServiceException.js +12 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/index.js +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/models_0.js +361 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/protocols/Aws_restJson1.js +458 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.browser.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.js +46 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.native.js +15 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.shared.js +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeExtensions.js +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/CodeWhispererStreaming.js +13 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/CodeWhispererStreamingClient.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/ExportResultArchiveCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/GenerateAssistantResponseCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/GenerateTaskAssistPlanCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/index.js +3 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/endpoints.js +161 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/extensionConfiguration.js +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/index.js +5 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/CodeWhispererStreamingServiceException.js +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/index.js +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/models_0.js +328 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/protocols/Aws_restJson1.js +449 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.browser.js +33 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.js +41 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.native.js +11 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.shared.js +18 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeExtensions.js +18 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/CodeWhispererStreaming.d.ts +30 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/CodeWhispererStreamingClient.d.ts +169 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/ExportResultArchiveCommand.d.ts +103 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/GenerateAssistantResponseCommand.d.ts +294 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/GenerateTaskAssistPlanCommand.d.ts +304 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/index.d.ts +3 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/endpoints.d.ts +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/extensionConfiguration.d.ts +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/index.d.ts +5 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/CodeWhispererStreamingServiceException.d.ts +13 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/index.d.ts +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/models_0.d.ts +1173 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/protocols/Aws_restJson1.d.ts +29 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.browser.d.ts +39 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.d.ts +39 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.native.d.ts +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.shared.d.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeExtensions.d.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/package.json +87 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/CodeWhispererStreaming.ts +84 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/CodeWhispererStreamingClient.ts +304 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts +177 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts +369 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts +379 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/index.ts +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/endpoints.ts +170 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/extensionConfiguration.ts +12 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/index.ts +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/CodeWhispererStreamingServiceException.ts +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/index.ts +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts +1518 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts +740 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.browser.ts +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.native.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.shared.ts +24 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.ts +55 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeExtensions.ts +44 -0
- package/src.gen/@amzn/codewhisperer-streaming/typedoc.json +5 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.de_GenerateTaskAssistPlanCommand = exports.de_GenerateAssistantResponseCommand = exports.de_ExportResultArchiveCommand = exports.se_GenerateTaskAssistPlanCommand = exports.se_GenerateAssistantResponseCommand = exports.se_ExportResultArchiveCommand = void 0;
|
|
4
|
+
const CodeWhispererStreamingServiceException_1 = require("../models/CodeWhispererStreamingServiceException");
|
|
5
|
+
const models_0_1 = require("../models/models_0");
|
|
6
|
+
const protocol_http_1 = require("@smithy/protocol-http");
|
|
7
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
8
|
+
const se_ExportResultArchiveCommand = async (input, context) => {
|
|
9
|
+
const { hostname, protocol = 'https', port, path: basePath } = await context.endpoint();
|
|
10
|
+
const headers = {
|
|
11
|
+
'content-type': 'application/json',
|
|
12
|
+
};
|
|
13
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : basePath || ''}` + '/exportResultArchive';
|
|
14
|
+
let body;
|
|
15
|
+
body = JSON.stringify((0, smithy_client_1.take)(input, {
|
|
16
|
+
exportId: [],
|
|
17
|
+
exportIntent: [],
|
|
18
|
+
}));
|
|
19
|
+
return new protocol_http_1.HttpRequest({
|
|
20
|
+
protocol,
|
|
21
|
+
hostname,
|
|
22
|
+
port,
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers,
|
|
25
|
+
path: resolvedPath,
|
|
26
|
+
body,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.se_ExportResultArchiveCommand = se_ExportResultArchiveCommand;
|
|
30
|
+
const se_GenerateAssistantResponseCommand = async (input, context) => {
|
|
31
|
+
const { hostname, protocol = 'https', port, path: basePath } = await context.endpoint();
|
|
32
|
+
const headers = {
|
|
33
|
+
'content-type': 'application/json',
|
|
34
|
+
};
|
|
35
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : basePath || ''}` + '/generateAssistantResponse';
|
|
36
|
+
let body;
|
|
37
|
+
body = JSON.stringify((0, smithy_client_1.take)(input, {
|
|
38
|
+
conversationState: _ => (0, smithy_client_1._json)(_),
|
|
39
|
+
}));
|
|
40
|
+
return new protocol_http_1.HttpRequest({
|
|
41
|
+
protocol,
|
|
42
|
+
hostname,
|
|
43
|
+
port,
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers,
|
|
46
|
+
path: resolvedPath,
|
|
47
|
+
body,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
exports.se_GenerateAssistantResponseCommand = se_GenerateAssistantResponseCommand;
|
|
51
|
+
const se_GenerateTaskAssistPlanCommand = async (input, context) => {
|
|
52
|
+
const { hostname, protocol = 'https', port, path: basePath } = await context.endpoint();
|
|
53
|
+
const headers = {
|
|
54
|
+
'content-type': 'application/json',
|
|
55
|
+
};
|
|
56
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : basePath || ''}` + '/generateTaskAssistPlan';
|
|
57
|
+
let body;
|
|
58
|
+
body = JSON.stringify((0, smithy_client_1.take)(input, {
|
|
59
|
+
conversationState: _ => (0, smithy_client_1._json)(_),
|
|
60
|
+
workspaceState: _ => (0, smithy_client_1._json)(_),
|
|
61
|
+
}));
|
|
62
|
+
return new protocol_http_1.HttpRequest({
|
|
63
|
+
protocol,
|
|
64
|
+
hostname,
|
|
65
|
+
port,
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers,
|
|
68
|
+
path: resolvedPath,
|
|
69
|
+
body,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
exports.se_GenerateTaskAssistPlanCommand = se_GenerateTaskAssistPlanCommand;
|
|
73
|
+
const de_ExportResultArchiveCommand = async (output, context) => {
|
|
74
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
75
|
+
return de_ExportResultArchiveCommandError(output, context);
|
|
76
|
+
}
|
|
77
|
+
const contents = (0, smithy_client_1.map)({
|
|
78
|
+
$metadata: deserializeMetadata(output),
|
|
79
|
+
});
|
|
80
|
+
const data = output.body;
|
|
81
|
+
contents.body = de_ResultArchiveStream(data, context);
|
|
82
|
+
return contents;
|
|
83
|
+
};
|
|
84
|
+
exports.de_ExportResultArchiveCommand = de_ExportResultArchiveCommand;
|
|
85
|
+
const de_ExportResultArchiveCommandError = async (output, context) => {
|
|
86
|
+
const parsedOutput = {
|
|
87
|
+
...output,
|
|
88
|
+
body: await parseErrorBody(output.body, context),
|
|
89
|
+
};
|
|
90
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
91
|
+
switch (errorCode) {
|
|
92
|
+
case 'AccessDeniedException':
|
|
93
|
+
case 'com.amazon.aws.codewhisperer#AccessDeniedException':
|
|
94
|
+
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
95
|
+
case 'ConflictException':
|
|
96
|
+
case 'com.amazon.aws.codewhisperer#ConflictException':
|
|
97
|
+
throw await de_ConflictExceptionRes(parsedOutput, context);
|
|
98
|
+
case 'InternalServerException':
|
|
99
|
+
case 'com.amazon.aws.codewhisperer#InternalServerException':
|
|
100
|
+
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
101
|
+
case 'ResourceNotFoundException':
|
|
102
|
+
case 'com.amazon.aws.codewhisperer#ResourceNotFoundException':
|
|
103
|
+
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
104
|
+
case 'ThrottlingException':
|
|
105
|
+
case 'com.amazon.aws.codewhisperer#ThrottlingException':
|
|
106
|
+
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
107
|
+
case 'ValidationException':
|
|
108
|
+
case 'com.amazon.aws.codewhisperer#ValidationException':
|
|
109
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
110
|
+
default:
|
|
111
|
+
const parsedBody = parsedOutput.body;
|
|
112
|
+
return throwDefaultError({
|
|
113
|
+
output,
|
|
114
|
+
parsedBody,
|
|
115
|
+
errorCode,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const de_GenerateAssistantResponseCommand = async (output, context) => {
|
|
120
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
121
|
+
return de_GenerateAssistantResponseCommandError(output, context);
|
|
122
|
+
}
|
|
123
|
+
const contents = (0, smithy_client_1.map)({
|
|
124
|
+
$metadata: deserializeMetadata(output),
|
|
125
|
+
conversationId: [, output.headers['x-amzn-codewhisperer-conversation-id']],
|
|
126
|
+
});
|
|
127
|
+
const data = output.body;
|
|
128
|
+
contents.generateAssistantResponseResponse = de_ChatResponseStream(data, context);
|
|
129
|
+
return contents;
|
|
130
|
+
};
|
|
131
|
+
exports.de_GenerateAssistantResponseCommand = de_GenerateAssistantResponseCommand;
|
|
132
|
+
const de_GenerateAssistantResponseCommandError = async (output, context) => {
|
|
133
|
+
const parsedOutput = {
|
|
134
|
+
...output,
|
|
135
|
+
body: await parseErrorBody(output.body, context),
|
|
136
|
+
};
|
|
137
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
138
|
+
switch (errorCode) {
|
|
139
|
+
case 'AccessDeniedException':
|
|
140
|
+
case 'com.amazon.aws.codewhisperer#AccessDeniedException':
|
|
141
|
+
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
142
|
+
case 'InternalServerException':
|
|
143
|
+
case 'com.amazon.aws.codewhisperer#InternalServerException':
|
|
144
|
+
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
145
|
+
case 'ThrottlingException':
|
|
146
|
+
case 'com.amazon.aws.codewhisperer#ThrottlingException':
|
|
147
|
+
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
148
|
+
case 'ValidationException':
|
|
149
|
+
case 'com.amazon.aws.codewhisperer#ValidationException':
|
|
150
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
151
|
+
default:
|
|
152
|
+
const parsedBody = parsedOutput.body;
|
|
153
|
+
return throwDefaultError({
|
|
154
|
+
output,
|
|
155
|
+
parsedBody,
|
|
156
|
+
errorCode,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const de_GenerateTaskAssistPlanCommand = async (output, context) => {
|
|
161
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
162
|
+
return de_GenerateTaskAssistPlanCommandError(output, context);
|
|
163
|
+
}
|
|
164
|
+
const contents = (0, smithy_client_1.map)({
|
|
165
|
+
$metadata: deserializeMetadata(output),
|
|
166
|
+
});
|
|
167
|
+
const data = output.body;
|
|
168
|
+
contents.planningResponseStream = de_ChatResponseStream(data, context);
|
|
169
|
+
return contents;
|
|
170
|
+
};
|
|
171
|
+
exports.de_GenerateTaskAssistPlanCommand = de_GenerateTaskAssistPlanCommand;
|
|
172
|
+
const de_GenerateTaskAssistPlanCommandError = async (output, context) => {
|
|
173
|
+
const parsedOutput = {
|
|
174
|
+
...output,
|
|
175
|
+
body: await parseErrorBody(output.body, context),
|
|
176
|
+
};
|
|
177
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
178
|
+
switch (errorCode) {
|
|
179
|
+
case 'AccessDeniedException':
|
|
180
|
+
case 'com.amazon.aws.codewhisperer#AccessDeniedException':
|
|
181
|
+
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
182
|
+
case 'ConflictException':
|
|
183
|
+
case 'com.amazon.aws.codewhisperer#ConflictException':
|
|
184
|
+
throw await de_ConflictExceptionRes(parsedOutput, context);
|
|
185
|
+
case 'InternalServerException':
|
|
186
|
+
case 'com.amazon.aws.codewhisperer#InternalServerException':
|
|
187
|
+
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
188
|
+
case 'ResourceNotFoundException':
|
|
189
|
+
case 'com.amazon.aws.codewhisperer#ResourceNotFoundException':
|
|
190
|
+
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
191
|
+
case 'ThrottlingException':
|
|
192
|
+
case 'com.amazon.aws.codewhisperer#ThrottlingException':
|
|
193
|
+
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
194
|
+
case 'ValidationException':
|
|
195
|
+
case 'com.amazon.aws.codewhisperer#ValidationException':
|
|
196
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
197
|
+
default:
|
|
198
|
+
const parsedBody = parsedOutput.body;
|
|
199
|
+
return throwDefaultError({
|
|
200
|
+
output,
|
|
201
|
+
parsedBody,
|
|
202
|
+
errorCode,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const throwDefaultError = (0, smithy_client_1.withBaseException)(CodeWhispererStreamingServiceException_1.CodeWhispererStreamingServiceException);
|
|
207
|
+
const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
|
208
|
+
const contents = (0, smithy_client_1.map)({});
|
|
209
|
+
const data = parsedOutput.body;
|
|
210
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
211
|
+
message: smithy_client_1.expectString,
|
|
212
|
+
reason: smithy_client_1.expectString,
|
|
213
|
+
});
|
|
214
|
+
Object.assign(contents, doc);
|
|
215
|
+
const exception = new models_0_1.AccessDeniedException({
|
|
216
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
217
|
+
...contents,
|
|
218
|
+
});
|
|
219
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
220
|
+
};
|
|
221
|
+
const de_ConflictExceptionRes = async (parsedOutput, context) => {
|
|
222
|
+
const contents = (0, smithy_client_1.map)({});
|
|
223
|
+
const data = parsedOutput.body;
|
|
224
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
225
|
+
message: smithy_client_1.expectString,
|
|
226
|
+
});
|
|
227
|
+
Object.assign(contents, doc);
|
|
228
|
+
const exception = new models_0_1.ConflictException({
|
|
229
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
230
|
+
...contents,
|
|
231
|
+
});
|
|
232
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
233
|
+
};
|
|
234
|
+
const de_InternalServerExceptionRes = async (parsedOutput, context) => {
|
|
235
|
+
const contents = (0, smithy_client_1.map)({});
|
|
236
|
+
const data = parsedOutput.body;
|
|
237
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
238
|
+
message: smithy_client_1.expectString,
|
|
239
|
+
});
|
|
240
|
+
Object.assign(contents, doc);
|
|
241
|
+
const exception = new models_0_1.InternalServerException({
|
|
242
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
243
|
+
...contents,
|
|
244
|
+
});
|
|
245
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
246
|
+
};
|
|
247
|
+
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
248
|
+
const contents = (0, smithy_client_1.map)({});
|
|
249
|
+
const data = parsedOutput.body;
|
|
250
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
251
|
+
message: smithy_client_1.expectString,
|
|
252
|
+
});
|
|
253
|
+
Object.assign(contents, doc);
|
|
254
|
+
const exception = new models_0_1.ResourceNotFoundException({
|
|
255
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
256
|
+
...contents,
|
|
257
|
+
});
|
|
258
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
259
|
+
};
|
|
260
|
+
const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
|
|
261
|
+
const contents = (0, smithy_client_1.map)({});
|
|
262
|
+
const data = parsedOutput.body;
|
|
263
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
264
|
+
message: smithy_client_1.expectString,
|
|
265
|
+
});
|
|
266
|
+
Object.assign(contents, doc);
|
|
267
|
+
const exception = new models_0_1.ThrottlingException({
|
|
268
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
269
|
+
...contents,
|
|
270
|
+
});
|
|
271
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
272
|
+
};
|
|
273
|
+
const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
274
|
+
const contents = (0, smithy_client_1.map)({});
|
|
275
|
+
const data = parsedOutput.body;
|
|
276
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
277
|
+
message: smithy_client_1.expectString,
|
|
278
|
+
reason: smithy_client_1.expectString,
|
|
279
|
+
});
|
|
280
|
+
Object.assign(contents, doc);
|
|
281
|
+
const exception = new models_0_1.ValidationException({
|
|
282
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
283
|
+
...contents,
|
|
284
|
+
});
|
|
285
|
+
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
286
|
+
};
|
|
287
|
+
const de_ChatResponseStream = (output, context) => {
|
|
288
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
289
|
+
if (event['messageMetadataEvent'] != null) {
|
|
290
|
+
return {
|
|
291
|
+
messageMetadataEvent: await de_MessageMetadataEvent_event(event['messageMetadataEvent'], context),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (event['assistantResponseEvent'] != null) {
|
|
295
|
+
return {
|
|
296
|
+
assistantResponseEvent: await de_AssistantResponseEvent_event(event['assistantResponseEvent'], context),
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
if (event['codeReferenceEvent'] != null) {
|
|
300
|
+
return {
|
|
301
|
+
codeReferenceEvent: await de_CodeReferenceEvent_event(event['codeReferenceEvent'], context),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (event['supplementaryWebLinksEvent'] != null) {
|
|
305
|
+
return {
|
|
306
|
+
supplementaryWebLinksEvent: await de_SupplementaryWebLinksEvent_event(event['supplementaryWebLinksEvent'], context),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (event['followupPromptEvent'] != null) {
|
|
310
|
+
return {
|
|
311
|
+
followupPromptEvent: await de_FollowupPromptEvent_event(event['followupPromptEvent'], context),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (event['invalidStateEvent'] != null) {
|
|
315
|
+
return {
|
|
316
|
+
invalidStateEvent: await de_InvalidStateEvent_event(event['invalidStateEvent'], context),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (event['error'] != null) {
|
|
320
|
+
return {
|
|
321
|
+
error: await de_InternalServerException_event(event['error'], context),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return { $unknown: output };
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
const de_ResultArchiveStream = (output, context) => {
|
|
328
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
329
|
+
if (event['binaryMetadataEvent'] != null) {
|
|
330
|
+
return {
|
|
331
|
+
binaryMetadataEvent: await de_BinaryMetadataEvent_event(event['binaryMetadataEvent'], context),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
if (event['binaryPayloadEvent'] != null) {
|
|
335
|
+
return {
|
|
336
|
+
binaryPayloadEvent: await de_BinaryPayloadEvent_event(event['binaryPayloadEvent'], context),
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
if (event['internalServerException'] != null) {
|
|
340
|
+
return {
|
|
341
|
+
internalServerException: await de_InternalServerException_event(event['internalServerException'], context),
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
return { $unknown: output };
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
const de_AssistantResponseEvent_event = async (output, context) => {
|
|
348
|
+
const contents = {};
|
|
349
|
+
const data = await parseBody(output.body, context);
|
|
350
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
351
|
+
return contents;
|
|
352
|
+
};
|
|
353
|
+
const de_BinaryMetadataEvent_event = async (output, context) => {
|
|
354
|
+
const contents = {};
|
|
355
|
+
const data = await parseBody(output.body, context);
|
|
356
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
357
|
+
return contents;
|
|
358
|
+
};
|
|
359
|
+
const de_BinaryPayloadEvent_event = async (output, context) => {
|
|
360
|
+
const contents = {};
|
|
361
|
+
const data = await parseBody(output.body, context);
|
|
362
|
+
Object.assign(contents, de_BinaryPayloadEvent(data, context));
|
|
363
|
+
return contents;
|
|
364
|
+
};
|
|
365
|
+
const de_CodeReferenceEvent_event = async (output, context) => {
|
|
366
|
+
const contents = {};
|
|
367
|
+
const data = await parseBody(output.body, context);
|
|
368
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
369
|
+
return contents;
|
|
370
|
+
};
|
|
371
|
+
const de_FollowupPromptEvent_event = async (output, context) => {
|
|
372
|
+
const contents = {};
|
|
373
|
+
const data = await parseBody(output.body, context);
|
|
374
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
375
|
+
return contents;
|
|
376
|
+
};
|
|
377
|
+
const de_InternalServerException_event = async (output, context) => {
|
|
378
|
+
const parsedOutput = {
|
|
379
|
+
...output,
|
|
380
|
+
body: await parseBody(output.body, context),
|
|
381
|
+
};
|
|
382
|
+
return de_InternalServerExceptionRes(parsedOutput, context);
|
|
383
|
+
};
|
|
384
|
+
const de_InvalidStateEvent_event = async (output, context) => {
|
|
385
|
+
const contents = {};
|
|
386
|
+
const data = await parseBody(output.body, context);
|
|
387
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
388
|
+
return contents;
|
|
389
|
+
};
|
|
390
|
+
const de_MessageMetadataEvent_event = async (output, context) => {
|
|
391
|
+
const contents = {};
|
|
392
|
+
const data = await parseBody(output.body, context);
|
|
393
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
394
|
+
return contents;
|
|
395
|
+
};
|
|
396
|
+
const de_SupplementaryWebLinksEvent_event = async (output, context) => {
|
|
397
|
+
const contents = {};
|
|
398
|
+
const data = await parseBody(output.body, context);
|
|
399
|
+
Object.assign(contents, (0, smithy_client_1._json)(data));
|
|
400
|
+
return contents;
|
|
401
|
+
};
|
|
402
|
+
const de_BinaryPayloadEvent = (output, context) => {
|
|
403
|
+
return (0, smithy_client_1.take)(output, {
|
|
404
|
+
bytes: context.base64Decoder,
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
const deserializeMetadata = (output) => ({
|
|
408
|
+
httpStatusCode: output.statusCode,
|
|
409
|
+
requestId: output.headers['x-amzn-requestid'] ?? output.headers['x-amzn-request-id'] ?? output.headers['x-amz-request-id'],
|
|
410
|
+
extendedRequestId: output.headers['x-amz-id-2'],
|
|
411
|
+
cfId: output.headers['x-amz-cf-id'],
|
|
412
|
+
});
|
|
413
|
+
const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
|
|
414
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
415
|
+
value !== null &&
|
|
416
|
+
value !== '' &&
|
|
417
|
+
(!Object.getOwnPropertyNames(value).includes('length') || value.length != 0) &&
|
|
418
|
+
(!Object.getOwnPropertyNames(value).includes('size') || value.size != 0);
|
|
419
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
|
|
420
|
+
if (encoded.length) {
|
|
421
|
+
return JSON.parse(encoded);
|
|
422
|
+
}
|
|
423
|
+
return {};
|
|
424
|
+
});
|
|
425
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
426
|
+
const value = await parseBody(errorBody, context);
|
|
427
|
+
value.message = value.message ?? value.Message;
|
|
428
|
+
return value;
|
|
429
|
+
};
|
|
430
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
431
|
+
const findKey = (object, key) => Object.keys(object).find(k => k.toLowerCase() === key.toLowerCase());
|
|
432
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
433
|
+
let cleanValue = rawValue;
|
|
434
|
+
if (typeof cleanValue === 'number') {
|
|
435
|
+
cleanValue = cleanValue.toString();
|
|
436
|
+
}
|
|
437
|
+
if (cleanValue.indexOf(',') >= 0) {
|
|
438
|
+
cleanValue = cleanValue.split(',')[0];
|
|
439
|
+
}
|
|
440
|
+
if (cleanValue.indexOf(':') >= 0) {
|
|
441
|
+
cleanValue = cleanValue.split(':')[0];
|
|
442
|
+
}
|
|
443
|
+
if (cleanValue.indexOf('#') >= 0) {
|
|
444
|
+
cleanValue = cleanValue.split('#')[1];
|
|
445
|
+
}
|
|
446
|
+
return cleanValue;
|
|
447
|
+
};
|
|
448
|
+
const headerKey = findKey(output.headers, 'x-amzn-errortype');
|
|
449
|
+
if (headerKey !== undefined) {
|
|
450
|
+
return sanitizeErrorCode(output.headers[headerKey]);
|
|
451
|
+
}
|
|
452
|
+
if (data.code !== undefined) {
|
|
453
|
+
return sanitizeErrorCode(data.code);
|
|
454
|
+
}
|
|
455
|
+
if (data['__type'] !== undefined) {
|
|
456
|
+
return sanitizeErrorCode(data['__type']);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
|
|
7
|
+
const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
|
|
8
|
+
const config_resolver_1 = require("@smithy/config-resolver");
|
|
9
|
+
const eventstream_serde_browser_1 = require("@smithy/eventstream-serde-browser");
|
|
10
|
+
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
|
11
|
+
const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
|
|
12
|
+
const util_retry_1 = require("@smithy/util-retry");
|
|
13
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
14
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
15
|
+
const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
|
|
16
|
+
const getRuntimeConfig = (config) => {
|
|
17
|
+
const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
|
|
18
|
+
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
|
19
|
+
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
|
20
|
+
return {
|
|
21
|
+
...clientSharedValues,
|
|
22
|
+
...config,
|
|
23
|
+
runtime: 'browser',
|
|
24
|
+
defaultsMode,
|
|
25
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
|
|
26
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
27
|
+
(0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
|
28
|
+
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_browser_1.eventStreamSerdeProvider,
|
|
29
|
+
maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
|
|
30
|
+
requestHandler: config?.requestHandler ?? new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider),
|
|
31
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
|
|
32
|
+
sha256: config?.sha256 ?? sha256_browser_1.Sha256,
|
|
33
|
+
streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
|
|
34
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
35
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
|
|
7
|
+
const config_resolver_1 = require("@smithy/config-resolver");
|
|
8
|
+
const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
|
|
9
|
+
const hash_node_1 = require("@smithy/hash-node");
|
|
10
|
+
const middleware_retry_1 = require("@smithy/middleware-retry");
|
|
11
|
+
const node_config_provider_1 = require("@smithy/node-config-provider");
|
|
12
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
13
|
+
const util_body_length_node_1 = require("@smithy/util-body-length-node");
|
|
14
|
+
const util_retry_1 = require("@smithy/util-retry");
|
|
15
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
16
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
17
|
+
const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
|
|
18
|
+
const smithy_client_2 = require("@smithy/smithy-client");
|
|
19
|
+
const getRuntimeConfig = (config) => {
|
|
20
|
+
(0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
|
|
21
|
+
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
|
22
|
+
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
|
|
23
|
+
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
|
|
24
|
+
return {
|
|
25
|
+
...clientSharedValues,
|
|
26
|
+
...config,
|
|
27
|
+
runtime: 'node',
|
|
28
|
+
defaultsMode,
|
|
29
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
|
|
30
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
31
|
+
(0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
|
32
|
+
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
|
|
33
|
+
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
34
|
+
requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider),
|
|
35
|
+
retryMode: config?.retryMode ??
|
|
36
|
+
(0, node_config_provider_1.loadConfig)({
|
|
37
|
+
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
38
|
+
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
|
|
39
|
+
}),
|
|
40
|
+
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, 'sha256'),
|
|
41
|
+
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
|
|
42
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
43
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const sha256_js_1 = require("@aws-crypto/sha256-js");
|
|
5
|
+
const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
|
|
6
|
+
const getRuntimeConfig = (config) => {
|
|
7
|
+
const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
|
|
8
|
+
return {
|
|
9
|
+
...browserDefaults,
|
|
10
|
+
...config,
|
|
11
|
+
runtime: 'react-native',
|
|
12
|
+
sha256: config?.sha256 ?? sha256_js_1.Sha256,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const endpoints_1 = require("./endpoints");
|
|
5
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
6
|
+
const url_parser_1 = require("@smithy/url-parser");
|
|
7
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
8
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
9
|
+
const getRuntimeConfig = (config) => ({
|
|
10
|
+
apiVersion: '2023-11-27',
|
|
11
|
+
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
|
|
12
|
+
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
|
|
13
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
14
|
+
extensions: config?.extensions ?? [],
|
|
15
|
+
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
|
16
|
+
regionInfoProvider: config?.regionInfoProvider ?? endpoints_1.defaultRegionInfoProvider,
|
|
17
|
+
serviceId: config?.serviceId ?? 'CodeWhispererStreaming',
|
|
18
|
+
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
|
19
|
+
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
|
|
20
|
+
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
|
|
21
|
+
});
|
|
22
|
+
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimeExtensions = void 0;
|
|
4
|
+
const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
|
|
5
|
+
const protocol_http_1 = require("@smithy/protocol-http");
|
|
6
|
+
const smithy_client_1 = require("@smithy/smithy-client");
|
|
7
|
+
const asPartial = (t) => t;
|
|
8
|
+
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
9
|
+
const extensionConfiguration = {
|
|
10
|
+
...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
|
|
11
|
+
...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
|
|
12
|
+
...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
|
|
13
|
+
};
|
|
14
|
+
extensions.forEach(extension => extension.configure(extensionConfiguration));
|
|
15
|
+
return {
|
|
16
|
+
...runtimeConfig,
|
|
17
|
+
...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
|
|
18
|
+
...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
|
|
19
|
+
...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CodeWhispererStreamingClient } from './CodeWhispererStreamingClient';
|
|
2
|
+
import { ExportResultArchiveCommand, } from './commands/ExportResultArchiveCommand';
|
|
3
|
+
import { GenerateAssistantResponseCommand, } from './commands/GenerateAssistantResponseCommand';
|
|
4
|
+
import { GenerateTaskAssistPlanCommand, } from './commands/GenerateTaskAssistPlanCommand';
|
|
5
|
+
import { createAggregatedClient } from '@smithy/smithy-client';
|
|
6
|
+
const commands = {
|
|
7
|
+
ExportResultArchiveCommand,
|
|
8
|
+
GenerateAssistantResponseCommand,
|
|
9
|
+
GenerateTaskAssistPlanCommand,
|
|
10
|
+
};
|
|
11
|
+
export class CodeWhispererStreaming extends CodeWhispererStreamingClient {
|
|
12
|
+
}
|
|
13
|
+
createAggregatedClient(commands, CodeWhispererStreaming);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getRuntimeConfig as __getRuntimeConfig } from './runtimeConfig';
|
|
2
|
+
import { resolveRuntimeExtensions } from './runtimeExtensions';
|
|
3
|
+
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from '@aws-sdk/middleware-host-header';
|
|
4
|
+
import { getLoggerPlugin } from '@aws-sdk/middleware-logger';
|
|
5
|
+
import { getRecursionDetectionPlugin } from '@aws-sdk/middleware-recursion-detection';
|
|
6
|
+
import { getTokenPlugin, resolveTokenConfig } from '@aws-sdk/middleware-token';
|
|
7
|
+
import { getUserAgentPlugin, resolveUserAgentConfig, } from '@aws-sdk/middleware-user-agent';
|
|
8
|
+
import { resolveEndpointsConfig, resolveRegionConfig, } from '@smithy/config-resolver';
|
|
9
|
+
import { resolveEventStreamSerdeConfig, } from '@smithy/eventstream-serde-config-resolver';
|
|
10
|
+
import { getContentLengthPlugin } from '@smithy/middleware-content-length';
|
|
11
|
+
import { getRetryPlugin, resolveRetryConfig } from '@smithy/middleware-retry';
|
|
12
|
+
import { Client as __Client, } from '@smithy/smithy-client';
|
|
13
|
+
export { __Client };
|
|
14
|
+
export class CodeWhispererStreamingClient extends __Client {
|
|
15
|
+
constructor(...[configuration]) {
|
|
16
|
+
let _config_0 = __getRuntimeConfig(configuration || {});
|
|
17
|
+
let _config_1 = resolveRegionConfig(_config_0);
|
|
18
|
+
let _config_2 = resolveEndpointsConfig(_config_1);
|
|
19
|
+
let _config_3 = resolveRetryConfig(_config_2);
|
|
20
|
+
let _config_4 = resolveHostHeaderConfig(_config_3);
|
|
21
|
+
let _config_5 = resolveTokenConfig(_config_4);
|
|
22
|
+
let _config_6 = resolveUserAgentConfig(_config_5);
|
|
23
|
+
let _config_7 = resolveEventStreamSerdeConfig(_config_6);
|
|
24
|
+
let _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
|
25
|
+
super(_config_8);
|
|
26
|
+
this.config = _config_8;
|
|
27
|
+
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
28
|
+
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
29
|
+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
|
30
|
+
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
31
|
+
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
32
|
+
this.middlewareStack.use(getTokenPlugin(this.config));
|
|
33
|
+
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
34
|
+
}
|
|
35
|
+
destroy() {
|
|
36
|
+
super.destroy();
|
|
37
|
+
}
|
|
38
|
+
}
|