Socket
Socket
Sign inDemoInstall

@smithy/smithy-client

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/smithy-client - npm Package Compare versions

Comparing version 2.1.18 to 2.2.0

108

dist-cjs/command.js

@@ -5,2 +5,3 @@ "use strict";

const middleware_stack_1 = require("@smithy/middleware-stack");
const types_1 = require("@smithy/types");
class Command {

@@ -10,3 +11,110 @@ constructor() {

}
static classBuilder() {
return new ClassBuilder();
}
resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }) {
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
this.middlewareStack.use(mw);
}
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const handlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog,
outputFilterSensitiveLog,
[types_1.SMITHY_CONTEXT_KEY]: {
...smithyContext,
},
...additionalContext,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
}
exports.Command = Command;
class ClassBuilder {
constructor() {
this._init = () => { };
this._ep = {};
this._middlewareFn = () => [];
this._commandName = "";
this._clientName = "";
this._additionalContext = {};
this._smithyContext = {};
this._inputFilterSensitiveLog = (_) => _;
this._outputFilterSensitiveLog = (_) => _;
this._serializer = null;
this._deserializer = null;
}
init(cb) {
this._init = cb;
}
ep(endpointParameterInstructions) {
this._ep = endpointParameterInstructions;
return this;
}
m(middlewareSupplier) {
this._middlewareFn = middlewareSupplier;
return this;
}
s(service, operation, smithyContext = {}) {
this._smithyContext = {
service,
operation,
...smithyContext,
};
return this;
}
c(additionalContext = {}) {
this._additionalContext = additionalContext;
return this;
}
n(clientName, commandName) {
this._clientName = clientName;
this._commandName = commandName;
return this;
}
f(inputFilter = (_) => _, outputFilter = (_) => _) {
this._inputFilterSensitiveLog = inputFilter;
this._outputFilterSensitiveLog = outputFilter;
return this;
}
ser(serializer) {
this._serializer = serializer;
return this;
}
de(deserializer) {
this._deserializer = deserializer;
return this;
}
build() {
const closure = this;
let CommandRef;
return (CommandRef = class extends Command {
static getEndpointParameterInstructions() {
return closure._ep;
}
constructor(input) {
super();
this.input = input;
this.serialize = closure._serializer;
this.deserialize = closure._deserializer;
closure._init(this);
}
resolveMiddleware(stack, configuration, options) {
return this.resolveMiddlewareWithContext(stack, configuration, options, {
CommandCtor: CommandRef,
middlewareFn: closure._middlewareFn,
clientName: closure._clientName,
commandName: closure._commandName,
inputFilterSensitiveLog: closure._inputFilterSensitiveLog,
outputFilterSensitiveLog: closure._outputFilterSensitiveLog,
smithyContext: closure._smithyContext,
additionalContext: closure._additionalContext,
});
}
});
}
}
import { constructStack } from "@smithy/middleware-stack";
import { SMITHY_CONTEXT_KEY } from "@smithy/types";
export class Command {

@@ -6,2 +7,109 @@ constructor() {

}
static classBuilder() {
return new ClassBuilder();
}
resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }) {
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
this.middlewareStack.use(mw);
}
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const handlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog,
outputFilterSensitiveLog,
[SMITHY_CONTEXT_KEY]: {
...smithyContext,
},
...additionalContext,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
}
class ClassBuilder {
constructor() {
this._init = () => { };
this._ep = {};
this._middlewareFn = () => [];
this._commandName = "";
this._clientName = "";
this._additionalContext = {};
this._smithyContext = {};
this._inputFilterSensitiveLog = (_) => _;
this._outputFilterSensitiveLog = (_) => _;
this._serializer = null;
this._deserializer = null;
}
init(cb) {
this._init = cb;
}
ep(endpointParameterInstructions) {
this._ep = endpointParameterInstructions;
return this;
}
m(middlewareSupplier) {
this._middlewareFn = middlewareSupplier;
return this;
}
s(service, operation, smithyContext = {}) {
this._smithyContext = {
service,
operation,
...smithyContext,
};
return this;
}
c(additionalContext = {}) {
this._additionalContext = additionalContext;
return this;
}
n(clientName, commandName) {
this._clientName = clientName;
this._commandName = commandName;
return this;
}
f(inputFilter = (_) => _, outputFilter = (_) => _) {
this._inputFilterSensitiveLog = inputFilter;
this._outputFilterSensitiveLog = outputFilter;
return this;
}
ser(serializer) {
this._serializer = serializer;
return this;
}
de(deserializer) {
this._deserializer = deserializer;
return this;
}
build() {
const closure = this;
let CommandRef;
return (CommandRef = class extends Command {
static getEndpointParameterInstructions() {
return closure._ep;
}
constructor(input) {
super();
this.input = input;
this.serialize = closure._serializer;
this.deserialize = closure._deserializer;
closure._init(this);
}
resolveMiddleware(stack, configuration, options) {
return this.resolveMiddlewareWithContext(stack, configuration, options, {
CommandCtor: CommandRef,
middlewareFn: closure._middlewareFn,
clientName: closure._clientName,
commandName: closure._commandName,
inputFilterSensitiveLog: closure._inputFilterSensitiveLog,
outputFilterSensitiveLog: closure._outputFilterSensitiveLog,
smithyContext: closure._smithyContext,
additionalContext: closure._additionalContext,
});
}
});
}
}

105

dist-types/command.d.ts

@@ -1,2 +0,3 @@

import { Command as ICommand, Handler, MetadataBearer, MiddlewareStack as IMiddlewareStack } from "@smithy/types";
import type { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
import type { Command as ICommand, Handler, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, Logger, MetadataBearer, MiddlewareStack as IMiddlewareStack, Pluggable, RequestHandler, SerdeContext } from "@smithy/types";
/**

@@ -8,3 +9,105 @@ * @public

readonly middlewareStack: IMiddlewareStack<Input, Output>;
/**
* Factory for Command ClassBuilder.
* @internal
*/
static classBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>;
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
/**
* @internal
*/
resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>;
}
/**
* @internal
*/
type ResolveMiddlewareContextArgs = {
middlewareFn: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[];
clientName: string;
commandName: string;
smithyContext: Record<string, unknown>;
additionalContext: HandlerExecutionContext;
inputFilterSensitiveLog: (_: any) => any;
outputFilterSensitiveLog: (_: any) => any;
CommandCtor: any;
};
/**
* @internal
*/
declare class ClassBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> {
private _init;
private _ep;
private _middlewareFn;
private _commandName;
private _clientName;
private _additionalContext;
private _smithyContext;
private _inputFilterSensitiveLog;
private _outputFilterSensitiveLog;
private _serializer;
private _deserializer;
/**
* Optional init callback.
*/
init(cb: (_: Command<I, O, C, SI, SO>) => void): void;
/**
* Set the endpoint parameter instructions.
*/
ep(endpointParameterInstructions: EndpointParameterInstructions): ClassBuilder<I, O, C, SI, SO>;
/**
* Add any number of middleware.
*/
m(middlewareSupplier: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[]): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context Smithy field.
*/
s(service: string, operation: string, smithyContext?: Record<string, unknown>): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context.
*/
c(additionalContext?: HandlerExecutionContext): ClassBuilder<I, O, C, SI, SO>;
/**
* Set constant string identifiers for the operation.
*/
n(clientName: string, commandName: string): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the input and output sensistive log filters.
*/
f(inputFilter?: (_: any) => any, outputFilter?: (_: any) => any): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the serializer.
*/
ser(serializer: (input: I, context?: SerdeContext | any) => Promise<IHttpRequest>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the deserializer.
*/
de(deserializer: (output: IHttpResponse, context?: SerdeContext | any) => Promise<O>): ClassBuilder<I, O, C, SI, SO>;
/**
* @returns a Command class with the classBuilder properties.
*/
build(): {
new (input: I): CommandImpl<I, O, C, SI, SO>;
getEndpointParameterInstructions(): EndpointParameterInstructions;
};
}
/**
* A concrete implementation of ICommand with no abstract members.
* @public
*/
export interface CommandImpl<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> {
readonly input: I;
resolveMiddleware(stack: IMiddlewareStack<SI, SO>, configuration: C, options: any): Handler<I, O>;
}
export {};

@@ -1,2 +0,3 @@

import { Command as ICommand, Handler, MetadataBearer, MiddlewareStack as IMiddlewareStack } from "@smithy/types";
import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
import { Command as ICommand, Handler, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, Logger, MetadataBearer, MiddlewareStack as IMiddlewareStack, Pluggable, RequestHandler, SerdeContext } from "@smithy/types";
/**

@@ -8,3 +9,105 @@ * @public

readonly middlewareStack: IMiddlewareStack<Input, Output>;
/**
* Factory for Command ClassBuilder.
* @internal
*/
static classBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>;
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
/**
* @internal
*/
resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>;
}
/**
* @internal
*/
type ResolveMiddlewareContextArgs = {
middlewareFn: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[];
clientName: string;
commandName: string;
smithyContext: Record<string, unknown>;
additionalContext: HandlerExecutionContext;
inputFilterSensitiveLog: (_: any) => any;
outputFilterSensitiveLog: (_: any) => any;
CommandCtor: any;
};
/**
* @internal
*/
declare class ClassBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> {
private _init;
private _ep;
private _middlewareFn;
private _commandName;
private _clientName;
private _additionalContext;
private _smithyContext;
private _inputFilterSensitiveLog;
private _outputFilterSensitiveLog;
private _serializer;
private _deserializer;
/**
* Optional init callback.
*/
init(cb: (_: Command<I, O, C, SI, SO>) => void): void;
/**
* Set the endpoint parameter instructions.
*/
ep(endpointParameterInstructions: EndpointParameterInstructions): ClassBuilder<I, O, C, SI, SO>;
/**
* Add any number of middleware.
*/
m(middlewareSupplier: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[]): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context Smithy field.
*/
s(service: string, operation: string, smithyContext?: Record<string, unknown>): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context.
*/
c(additionalContext?: HandlerExecutionContext): ClassBuilder<I, O, C, SI, SO>;
/**
* Set constant string identifiers for the operation.
*/
n(clientName: string, commandName: string): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the input and output sensistive log filters.
*/
f(inputFilter?: (_: any) => any, outputFilter?: (_: any) => any): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the serializer.
*/
ser(serializer: (input: I, context?: SerdeContext | any) => Promise<IHttpRequest>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the deserializer.
*/
de(deserializer: (output: IHttpResponse, context?: SerdeContext | any) => Promise<O>): ClassBuilder<I, O, C, SI, SO>;
/**
* @returns a Command class with the classBuilder properties.
*/
build(): {
new (input: I): CommandImpl<I, O, C, SI, SO>;
getEndpointParameterInstructions(): EndpointParameterInstructions;
};
}
/**
* A concrete implementation of ICommand with no abstract members.
* @public
*/
export interface CommandImpl<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> {
readonly input: I;
resolveMiddleware(stack: IMiddlewareStack<SI, SO>, configuration: C, options: any): Handler<I, O>;
}
export {};

4

package.json
{
"name": "@smithy/smithy-client",
"version": "2.1.18",
"version": "2.2.0",
"scripts": {

@@ -26,3 +26,5 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",

"dependencies": {
"@smithy/middleware-endpoint": "^2.2.3",
"@smithy/middleware-stack": "^2.0.9",
"@smithy/protocol-http": "^3.0.11",
"@smithy/types": "^2.7.0",

@@ -29,0 +31,0 @@ "@smithy/util-stream": "^2.0.23",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc