failure-lambda
Version:
Failure injection for AWS Lambda - chaos engineering made simple
53 lines (51 loc) • 1.92 kB
JavaScript
// node_modules/@smithy/smithy-client/dist-es/create-aggregated-client.js
var createAggregatedClient = (commands, Client, options) => {
for (const [command, CommandCtor] of Object.entries(commands)) {
const methodImpl = async function(args, optionsOrCb, cb) {
const command2 = new CommandCtor(args);
if (typeof optionsOrCb === "function") {
this.send(command2, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object")
throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
this.send(command2, optionsOrCb || {}, cb);
} else {
return this.send(command2, optionsOrCb);
}
};
const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
Client.prototype[methodName] = methodImpl;
}
const { paginators = {}, waiters = {} } = options ?? {};
for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
if (Client.prototype[paginatorName] === void 0) {
Client.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
return paginatorFn({
...paginationConfiguration,
client: this
}, commandInput, ...rest);
};
}
}
for (const [waiterName, waiterFn] of Object.entries(waiters)) {
if (Client.prototype[waiterName] === void 0) {
Client.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
let config = waiterConfiguration;
if (typeof waiterConfiguration === "number") {
config = {
maxWaitTime: waiterConfiguration
};
}
return waiterFn({
...config,
client: this
}, commandInput, ...rest);
};
}
}
};
export {
createAggregatedClient
};
//# sourceMappingURL=chunk-V4BSKZG7.js.map