UNPKG

1.06 kBJavaScriptView Raw
1import { constructStack } from "@aws-sdk/middleware-stack";
2var Client = (function () {
3 function Client(config) {
4 this.middlewareStack = constructStack();
5 this.config = config;
6 }
7 Client.prototype.send = function (command, optionsOrCb, cb) {
8 var options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
9 var callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
10 var handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
11 if (callback) {
12 handler(command)
13 .then(function (result) { return callback(null, result.output); }, function (err) { return callback(err); })
14 .catch(function () { });
15 }
16 else {
17 return handler(command).then(function (result) { return result.output; });
18 }
19 };
20 Client.prototype.destroy = function () {
21 if (this.config.requestHandler.destroy)
22 this.config.requestHandler.destroy();
23 };
24 return Client;
25}());
26export { Client };