@wildix/wda-stream-client 1.0.1
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/WdaStream.js +17 -0
- package/dist-cjs/WdaStreamClient.js +35 -0
- package/dist-cjs/commands/ConsumeEventCommand.js +41 -0
- package/dist-cjs/commands/DescribeEventCommand.js +41 -0
- package/dist-cjs/commands/GetOngoingConversationsCommand.js +41 -0
- package/dist-cjs/commands/index.js +6 -0
- package/dist-cjs/extensionConfiguration.js +2 -0
- package/dist-cjs/index.js +10 -0
- package/dist-cjs/models/WdaStreamServiceException.js +12 -0
- package/dist-cjs/models/index.js +4 -0
- package/dist-cjs/models/models_0.js +170 -0
- package/dist-cjs/protocols/Aws_restJson1.js +262 -0
- package/dist-cjs/runtimeConfig.browser.js +28 -0
- package/dist-cjs/runtimeConfig.js +32 -0
- package/dist-cjs/runtimeConfig.native.js +15 -0
- package/dist-cjs/runtimeConfig.shared.js +19 -0
- package/dist-cjs/runtimeExtensions.js +19 -0
- package/dist-es/WdaStream.js +13 -0
- package/dist-es/WdaStreamClient.js +31 -0
- package/dist-es/commands/ConsumeEventCommand.js +37 -0
- package/dist-es/commands/DescribeEventCommand.js +37 -0
- package/dist-es/commands/GetOngoingConversationsCommand.js +37 -0
- package/dist-es/commands/index.js +3 -0
- package/dist-es/extensionConfiguration.js +1 -0
- package/dist-es/index.js +5 -0
- package/dist-es/models/WdaStreamServiceException.js +8 -0
- package/dist-es/models/index.js +1 -0
- package/dist-es/models/models_0.js +165 -0
- package/dist-es/protocols/Aws_restJson1.js +253 -0
- package/dist-es/runtimeConfig.browser.js +24 -0
- package/dist-es/runtimeConfig.js +28 -0
- package/dist-es/runtimeConfig.native.js +11 -0
- package/dist-es/runtimeConfig.shared.js +15 -0
- package/dist-es/runtimeExtensions.js +15 -0
- package/dist-types/WdaStream.d.ts +30 -0
- package/dist-types/WdaStreamClient.d.ts +139 -0
- package/dist-types/commands/ConsumeEventCommand.d.ts +219 -0
- package/dist-types/commands/DescribeEventCommand.d.ts +327 -0
- package/dist-types/commands/GetOngoingConversationsCommand.d.ts +275 -0
- package/dist-types/commands/index.d.ts +3 -0
- package/dist-types/extensionConfiguration.d.ts +7 -0
- package/dist-types/index.d.ts +5 -0
- package/dist-types/models/WdaStreamServiceException.d.ts +13 -0
- package/dist-types/models/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +857 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +29 -0
- package/dist-types/runtimeConfig.browser.d.ts +29 -0
- package/dist-types/runtimeConfig.d.ts +29 -0
- package/dist-types/runtimeConfig.native.d.ts +28 -0
- package/dist-types/runtimeConfig.shared.d.ts +15 -0
- package/dist-types/runtimeExtensions.d.ts +17 -0
- package/package.json +77 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { WdaStreamServiceException as __BaseException } from "../models/WdaStreamServiceException";
|
|
2
|
+
import { ForbiddenException, ValidationException, } from "../models/models_0";
|
|
3
|
+
import { HttpRequest as __HttpRequest, } from "@smithy/protocol-http";
|
|
4
|
+
import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
|
|
5
|
+
export const se_ConsumeEventCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {
|
|
8
|
+
'content-type': 'application/json',
|
|
9
|
+
};
|
|
10
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/events/consume";
|
|
11
|
+
let body;
|
|
12
|
+
body = JSON.stringify(take(input, {
|
|
13
|
+
'event': _ => _json(_),
|
|
14
|
+
}));
|
|
15
|
+
return new __HttpRequest({
|
|
16
|
+
protocol,
|
|
17
|
+
hostname,
|
|
18
|
+
port,
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers,
|
|
21
|
+
path: resolvedPath,
|
|
22
|
+
body,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const se_DescribeEventCommand = async (input, context) => {
|
|
26
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
27
|
+
const headers = {
|
|
28
|
+
'content-type': 'application/json',
|
|
29
|
+
};
|
|
30
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/events/describe";
|
|
31
|
+
let body;
|
|
32
|
+
body = JSON.stringify(take(input, {
|
|
33
|
+
'SmsInboundEvent': _ => _json(_),
|
|
34
|
+
'SmsStatusEvent': _ => _json(_),
|
|
35
|
+
}));
|
|
36
|
+
return new __HttpRequest({
|
|
37
|
+
protocol,
|
|
38
|
+
hostname,
|
|
39
|
+
port,
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers,
|
|
42
|
+
path: resolvedPath,
|
|
43
|
+
body,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export const se_GetOngoingConversationsCommand = async (input, context) => {
|
|
47
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
48
|
+
const headers = {};
|
|
49
|
+
let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/stream/conversations";
|
|
50
|
+
const query = map({
|
|
51
|
+
"company": [, input.company],
|
|
52
|
+
});
|
|
53
|
+
let body;
|
|
54
|
+
return new __HttpRequest({
|
|
55
|
+
protocol,
|
|
56
|
+
hostname,
|
|
57
|
+
port,
|
|
58
|
+
method: "GET",
|
|
59
|
+
headers,
|
|
60
|
+
path: resolvedPath,
|
|
61
|
+
query,
|
|
62
|
+
body,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
export const de_ConsumeEventCommand = async (output, context) => {
|
|
66
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
67
|
+
return de_ConsumeEventCommandError(output, context);
|
|
68
|
+
}
|
|
69
|
+
const contents = map({
|
|
70
|
+
$metadata: deserializeMetadata(output),
|
|
71
|
+
});
|
|
72
|
+
await collectBody(output.body, context);
|
|
73
|
+
return contents;
|
|
74
|
+
};
|
|
75
|
+
const de_ConsumeEventCommandError = async (output, context) => {
|
|
76
|
+
const parsedOutput = {
|
|
77
|
+
...output,
|
|
78
|
+
body: await parseErrorBody(output.body, context)
|
|
79
|
+
};
|
|
80
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
81
|
+
switch (errorCode) {
|
|
82
|
+
case "ValidationException":
|
|
83
|
+
case "smithy.framework#ValidationException":
|
|
84
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
85
|
+
default:
|
|
86
|
+
const parsedBody = parsedOutput.body;
|
|
87
|
+
return throwDefaultError({
|
|
88
|
+
output,
|
|
89
|
+
parsedBody,
|
|
90
|
+
errorCode
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export const de_DescribeEventCommand = async (output, context) => {
|
|
95
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
96
|
+
return de_DescribeEventCommandError(output, context);
|
|
97
|
+
}
|
|
98
|
+
const contents = map({
|
|
99
|
+
$metadata: deserializeMetadata(output),
|
|
100
|
+
});
|
|
101
|
+
const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
|
|
102
|
+
const doc = take(data, {
|
|
103
|
+
'CallAnalyticsLiveCompleteEvent': _json,
|
|
104
|
+
'CallAnalyticsLiveInterruptedEvent': _json,
|
|
105
|
+
'CallAnalyticsLiveProgressEvent': _json,
|
|
106
|
+
'CallAnalyticsLiveTranscriptionCompleteEvent': _json,
|
|
107
|
+
'CallAnalyticsLiveTranscriptionEvent': _json,
|
|
108
|
+
'ConferenceAnalyticsLiveCompleteEvent': _json,
|
|
109
|
+
'ConferenceAnalyticsLiveInterruptedEvent': _json,
|
|
110
|
+
'ConferenceAnalyticsLiveProgressEvent': _json,
|
|
111
|
+
'ConferenceAnalyticsLiveTranscriptionCompleteEvent': _json,
|
|
112
|
+
'ConferenceAnalyticsLiveTranscriptionEvent': _json,
|
|
113
|
+
});
|
|
114
|
+
Object.assign(contents, doc);
|
|
115
|
+
return contents;
|
|
116
|
+
};
|
|
117
|
+
const de_DescribeEventCommandError = async (output, context) => {
|
|
118
|
+
const parsedOutput = {
|
|
119
|
+
...output,
|
|
120
|
+
body: await parseErrorBody(output.body, context)
|
|
121
|
+
};
|
|
122
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
123
|
+
switch (errorCode) {
|
|
124
|
+
case "ValidationException":
|
|
125
|
+
case "smithy.framework#ValidationException":
|
|
126
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
127
|
+
default:
|
|
128
|
+
const parsedBody = parsedOutput.body;
|
|
129
|
+
return throwDefaultError({
|
|
130
|
+
output,
|
|
131
|
+
parsedBody,
|
|
132
|
+
errorCode
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const de_GetOngoingConversationsCommand = async (output, context) => {
|
|
137
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
138
|
+
return de_GetOngoingConversationsCommandError(output, context);
|
|
139
|
+
}
|
|
140
|
+
const contents = map({
|
|
141
|
+
$metadata: deserializeMetadata(output),
|
|
142
|
+
});
|
|
143
|
+
const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
|
|
144
|
+
const doc = take(data, {
|
|
145
|
+
'calls': _json,
|
|
146
|
+
'chats': _json,
|
|
147
|
+
'conferences': _json,
|
|
148
|
+
});
|
|
149
|
+
Object.assign(contents, doc);
|
|
150
|
+
return contents;
|
|
151
|
+
};
|
|
152
|
+
const de_GetOngoingConversationsCommandError = async (output, context) => {
|
|
153
|
+
const parsedOutput = {
|
|
154
|
+
...output,
|
|
155
|
+
body: await parseErrorBody(output.body, context)
|
|
156
|
+
};
|
|
157
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
158
|
+
switch (errorCode) {
|
|
159
|
+
case "ForbiddenException":
|
|
160
|
+
case "smithy.framework#ForbiddenException":
|
|
161
|
+
throw await de_ForbiddenExceptionRes(parsedOutput, context);
|
|
162
|
+
case "ValidationException":
|
|
163
|
+
case "smithy.framework#ValidationException":
|
|
164
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
165
|
+
default:
|
|
166
|
+
const parsedBody = parsedOutput.body;
|
|
167
|
+
return throwDefaultError({
|
|
168
|
+
output,
|
|
169
|
+
parsedBody,
|
|
170
|
+
errorCode
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const throwDefaultError = withBaseException(__BaseException);
|
|
175
|
+
const de_ForbiddenExceptionRes = async (parsedOutput, context) => {
|
|
176
|
+
const contents = map({});
|
|
177
|
+
const data = parsedOutput.body;
|
|
178
|
+
const doc = take(data, {
|
|
179
|
+
'message': __expectString,
|
|
180
|
+
});
|
|
181
|
+
Object.assign(contents, doc);
|
|
182
|
+
const exception = new ForbiddenException({
|
|
183
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
184
|
+
...contents
|
|
185
|
+
});
|
|
186
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
187
|
+
};
|
|
188
|
+
const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
189
|
+
const contents = map({});
|
|
190
|
+
const data = parsedOutput.body;
|
|
191
|
+
const doc = take(data, {
|
|
192
|
+
'message': __expectString,
|
|
193
|
+
});
|
|
194
|
+
Object.assign(contents, doc);
|
|
195
|
+
const exception = new ValidationException({
|
|
196
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
197
|
+
...contents
|
|
198
|
+
});
|
|
199
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
200
|
+
};
|
|
201
|
+
const deserializeMetadata = (output) => ({
|
|
202
|
+
httpStatusCode: output.statusCode,
|
|
203
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
204
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
205
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
206
|
+
});
|
|
207
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then(body => context.utf8Encoder(body));
|
|
208
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
209
|
+
value !== null &&
|
|
210
|
+
value !== "" &&
|
|
211
|
+
(!Object.getOwnPropertyNames(value).includes("length") ||
|
|
212
|
+
value.length != 0) &&
|
|
213
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
214
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
|
|
215
|
+
if (encoded.length) {
|
|
216
|
+
return JSON.parse(encoded);
|
|
217
|
+
}
|
|
218
|
+
return {};
|
|
219
|
+
});
|
|
220
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
221
|
+
const value = await parseBody(errorBody, context);
|
|
222
|
+
value.message = value.message ?? value.Message;
|
|
223
|
+
return value;
|
|
224
|
+
};
|
|
225
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
226
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
227
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
228
|
+
let cleanValue = rawValue;
|
|
229
|
+
if (typeof cleanValue === "number") {
|
|
230
|
+
cleanValue = cleanValue.toString();
|
|
231
|
+
}
|
|
232
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
233
|
+
cleanValue = cleanValue.split(",")[0];
|
|
234
|
+
}
|
|
235
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
236
|
+
cleanValue = cleanValue.split(":")[0];
|
|
237
|
+
}
|
|
238
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
239
|
+
cleanValue = cleanValue.split("#")[1];
|
|
240
|
+
}
|
|
241
|
+
return cleanValue;
|
|
242
|
+
};
|
|
243
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
244
|
+
if (headerKey !== undefined) {
|
|
245
|
+
return sanitizeErrorCode(output.headers[headerKey]);
|
|
246
|
+
}
|
|
247
|
+
if (data.code !== undefined) {
|
|
248
|
+
return sanitizeErrorCode(data.code);
|
|
249
|
+
}
|
|
250
|
+
if (data["__type"] !== undefined) {
|
|
251
|
+
return sanitizeErrorCode(data["__type"]);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
2
|
+
import { FetchHttpHandler as RequestHandler, streamCollector, } from "@smithy/fetch-http-handler";
|
|
3
|
+
import { calculateBodyLength } from "@smithy/util-body-length-browser";
|
|
4
|
+
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE, } from "@smithy/util-retry";
|
|
5
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
6
|
+
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
|
7
|
+
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
|
|
8
|
+
export const getRuntimeConfig = (config) => {
|
|
9
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
10
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
11
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
12
|
+
return {
|
|
13
|
+
...clientSharedValues,
|
|
14
|
+
...config,
|
|
15
|
+
runtime: "browser",
|
|
16
|
+
defaultsMode,
|
|
17
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
18
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
19
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
20
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
21
|
+
sha256: config?.sha256 ?? Sha256,
|
|
22
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Hash } from "@smithy/hash-node";
|
|
2
|
+
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS, } from "@smithy/middleware-retry";
|
|
3
|
+
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
|
|
4
|
+
import { NodeHttpHandler as RequestHandler, streamCollector, } from "@smithy/node-http-handler";
|
|
5
|
+
import { calculateBodyLength } from "@smithy/util-body-length-node";
|
|
6
|
+
import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
|
7
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
8
|
+
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
|
9
|
+
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
|
|
10
|
+
import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
|
|
11
|
+
export const getRuntimeConfig = (config) => {
|
|
12
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
13
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
14
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
15
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
16
|
+
return {
|
|
17
|
+
...clientSharedValues,
|
|
18
|
+
...config,
|
|
19
|
+
runtime: "node",
|
|
20
|
+
defaultsMode,
|
|
21
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
22
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
23
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
24
|
+
retryMode: config?.retryMode ?? loadNodeConfig({ ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }),
|
|
25
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
26
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
+
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
5
|
+
return {
|
|
6
|
+
...browserDefaults,
|
|
7
|
+
...config,
|
|
8
|
+
runtime: "react-native",
|
|
9
|
+
sha256: config?.sha256 ?? Sha256,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NoOpLogger } from "@smithy/smithy-client";
|
|
2
|
+
import { parseUrl } from "@smithy/url-parser";
|
|
3
|
+
import { fromBase64, toBase64, } from "@smithy/util-base64";
|
|
4
|
+
import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
|
|
5
|
+
export const getRuntimeConfig = (config) => ({
|
|
6
|
+
apiVersion: "v2",
|
|
7
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
8
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
9
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
10
|
+
extensions: config?.extensions ?? [],
|
|
11
|
+
logger: config?.logger ?? new NoOpLogger(),
|
|
12
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
13
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
14
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, } from "@smithy/protocol-http";
|
|
2
|
+
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, } from "@smithy/smithy-client";
|
|
3
|
+
const asPartial = (t) => t;
|
|
4
|
+
export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
5
|
+
const extensionConfiguration = {
|
|
6
|
+
...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
|
|
7
|
+
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
8
|
+
};
|
|
9
|
+
extensions.forEach(extension => extension.configure(extensionConfiguration));
|
|
10
|
+
return {
|
|
11
|
+
...runtimeConfig,
|
|
12
|
+
...resolveDefaultRuntimeConfig(extensionConfiguration),
|
|
13
|
+
...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WdaStreamClient } from "./WdaStreamClient";
|
|
2
|
+
import { ConsumeEventCommandInput, ConsumeEventCommandOutput } from "./commands/ConsumeEventCommand";
|
|
3
|
+
import { DescribeEventCommandInput, DescribeEventCommandOutput } from "./commands/DescribeEventCommand";
|
|
4
|
+
import { GetOngoingConversationsCommandInput, GetOngoingConversationsCommandOutput } from "./commands/GetOngoingConversationsCommand";
|
|
5
|
+
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
|
|
6
|
+
export interface WdaStream {
|
|
7
|
+
/**
|
|
8
|
+
* @see {@link ConsumeEventCommand}
|
|
9
|
+
*/
|
|
10
|
+
consumeEvent(args: ConsumeEventCommandInput, options?: __HttpHandlerOptions): Promise<ConsumeEventCommandOutput>;
|
|
11
|
+
consumeEvent(args: ConsumeEventCommandInput, cb: (err: any, data?: ConsumeEventCommandOutput) => void): void;
|
|
12
|
+
consumeEvent(args: ConsumeEventCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ConsumeEventCommandOutput) => void): void;
|
|
13
|
+
/**
|
|
14
|
+
* @see {@link DescribeEventCommand}
|
|
15
|
+
*/
|
|
16
|
+
describeEvent(args: DescribeEventCommandInput, options?: __HttpHandlerOptions): Promise<DescribeEventCommandOutput>;
|
|
17
|
+
describeEvent(args: DescribeEventCommandInput, cb: (err: any, data?: DescribeEventCommandOutput) => void): void;
|
|
18
|
+
describeEvent(args: DescribeEventCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DescribeEventCommandOutput) => void): void;
|
|
19
|
+
/**
|
|
20
|
+
* @see {@link GetOngoingConversationsCommand}
|
|
21
|
+
*/
|
|
22
|
+
getOngoingConversations(args: GetOngoingConversationsCommandInput, options?: __HttpHandlerOptions): Promise<GetOngoingConversationsCommandOutput>;
|
|
23
|
+
getOngoingConversations(args: GetOngoingConversationsCommandInput, cb: (err: any, data?: GetOngoingConversationsCommandOutput) => void): void;
|
|
24
|
+
getOngoingConversations(args: GetOngoingConversationsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetOngoingConversationsCommandOutput) => void): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare class WdaStream extends WdaStreamClient implements WdaStream {
|
|
30
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ConsumeEventCommandInput, ConsumeEventCommandOutput } from "./commands/ConsumeEventCommand";
|
|
2
|
+
import { DescribeEventCommandInput, DescribeEventCommandOutput } from "./commands/DescribeEventCommand";
|
|
3
|
+
import { GetOngoingConversationsCommandInput, GetOngoingConversationsCommandOutput } from "./commands/GetOngoingConversationsCommand";
|
|
4
|
+
import { RuntimeExtension, RuntimeExtensionsConfig } from "./runtimeExtensions";
|
|
5
|
+
import { HttpHandler as __HttpHandler } from "@smithy/protocol-http";
|
|
6
|
+
import { Client as __Client, DefaultsMode as __DefaultsMode, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration } from "@smithy/smithy-client";
|
|
7
|
+
import { BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser } from "@smithy/types";
|
|
8
|
+
import { TokenProvider } from '@wildix/smithy-utils';
|
|
9
|
+
export { __Client };
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type ServiceInputTypes = ConsumeEventCommandInput | DescribeEventCommandInput | GetOngoingConversationsCommandInput;
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export type ServiceOutputTypes = ConsumeEventCommandOutput | DescribeEventCommandOutput | GetOngoingConversationsCommandOutput;
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
|
|
22
|
+
/**
|
|
23
|
+
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
|
|
24
|
+
*/
|
|
25
|
+
requestHandler?: __HttpHandler;
|
|
26
|
+
/**
|
|
27
|
+
* A constructor for a class implementing the {@link @smithy/types#ChecksumConstructor} interface
|
|
28
|
+
* that computes the SHA-256 HMAC or checksum of a string or binary buffer.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
sha256?: __ChecksumConstructor | __HashConstructor;
|
|
32
|
+
/**
|
|
33
|
+
* The function that will be used to convert strings into HTTP endpoints.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
urlParser?: __UrlParser;
|
|
37
|
+
/**
|
|
38
|
+
* A function that can calculate the length of a request body.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
bodyLengthChecker?: __BodyLengthCalculator;
|
|
42
|
+
/**
|
|
43
|
+
* A function that converts a stream into an array of bytes.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
streamCollector?: __StreamCollector;
|
|
47
|
+
/**
|
|
48
|
+
* The function that will be used to convert a base64-encoded string to a byte array.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
base64Decoder?: __Decoder;
|
|
52
|
+
/**
|
|
53
|
+
* The function that will be used to convert binary data to a base64-encoded string.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
base64Encoder?: __Encoder;
|
|
57
|
+
/**
|
|
58
|
+
* The function that will be used to convert a UTF8-encoded string to a byte array.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
utf8Decoder?: __Decoder;
|
|
62
|
+
/**
|
|
63
|
+
* The function that will be used to convert binary data to a UTF-8 encoded string.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
utf8Encoder?: __Encoder;
|
|
67
|
+
/**
|
|
68
|
+
* The runtime environment.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
runtime?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
|
|
74
|
+
* trait of an operation.
|
|
75
|
+
*/
|
|
76
|
+
disableHostPrefix?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Value for how many times a request will be made at most in case of retry.
|
|
79
|
+
*/
|
|
80
|
+
maxAttempts?: number | __Provider<number>;
|
|
81
|
+
/**
|
|
82
|
+
* Specifies which retry algorithm to use.
|
|
83
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-util-retry/Enum/RETRY_MODES/
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
retryMode?: string | __Provider<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Optional logger for logging debug/info/warn/error.
|
|
89
|
+
*/
|
|
90
|
+
logger?: __Logger;
|
|
91
|
+
/**
|
|
92
|
+
* Optional extensions
|
|
93
|
+
*/
|
|
94
|
+
extensions?: RuntimeExtension[];
|
|
95
|
+
/**
|
|
96
|
+
* The {@link @smithy/smithy-client#DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
|
|
97
|
+
*/
|
|
98
|
+
defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export type WdaStreamClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults;
|
|
104
|
+
/**
|
|
105
|
+
* @public
|
|
106
|
+
*
|
|
107
|
+
* The configuration interface of WdaStreamClient class constructor that set the region, credentials and other options.
|
|
108
|
+
*/
|
|
109
|
+
export interface WdaStreamClientConfig extends WdaStreamClientConfigType {
|
|
110
|
+
env?: 'stage' | 'stable' | 'prod';
|
|
111
|
+
token: TokenProvider;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export type WdaStreamClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig;
|
|
117
|
+
/**
|
|
118
|
+
* @public
|
|
119
|
+
*
|
|
120
|
+
* The resolved configuration interface of WdaStreamClient class. This is resolved and normalized from the {@link WdaStreamClientConfig | constructor configuration interface}.
|
|
121
|
+
*/
|
|
122
|
+
export interface WdaStreamClientResolvedConfig extends WdaStreamClientResolvedConfigType {
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export declare class WdaStreamClient extends __Client<__HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, WdaStreamClientResolvedConfig> {
|
|
128
|
+
/**
|
|
129
|
+
* The resolved configuration of WdaStreamClient class. This is resolved and normalized from the {@link WdaStreamClientConfig | constructor configuration interface}.
|
|
130
|
+
*/
|
|
131
|
+
readonly config: WdaStreamClientResolvedConfig;
|
|
132
|
+
constructor(...[configuration]: __CheckOptionalClientConfig<WdaStreamClientConfig>);
|
|
133
|
+
/**
|
|
134
|
+
* Destroy underlying resources, like sockets. It's usually not necessary to do this.
|
|
135
|
+
* However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
|
|
136
|
+
* Otherwise, sockets might stay open for quite a long time before the server terminates them.
|
|
137
|
+
*/
|
|
138
|
+
destroy(): void;
|
|
139
|
+
}
|