@aws-sdk/smithy-client
- Version 3.257.0
- Published
- 104 kB
- 3 dependencies
- Apache-2.0 license
Install
npm i @aws-sdk/smithy-client
yarn add @aws-sdk/smithy-client
pnpm add @aws-sdk/smithy-client
Overview
[](https://www.npmjs.com/package/@aws-sdk/smithy-client) [](https://www.npmjs.com/package/@aws-sdk/smit
Index
Variables
Functions
- dateToUtcString()
- emitWarningIfUnsupportedVersion()
- expectBoolean()
- expectByte()
- expectFloat32()
- expectInt()
- expectInt32()
- expectLong()
- expectNonNull()
- expectNumber()
- expectObject()
- expectShort()
- expectString()
- expectUnion()
- extendedEncodeURIComponent()
- getArrayIfSingleItem()
- getValueFromTextNode()
- handleFloat()
- limitedParseDouble()
- limitedParseFloat()
- limitedParseFloat32()
- parseBoolean()
- parseEpochTimestamp()
- parseRfc3339DateTime()
- parseRfc7231DateTime()
- resolvedPath()
- serializeFloat()
- splitEvery()
- strictParseByte()
- strictParseDouble()
- strictParseFloat()
- strictParseFloat32()
- strictParseInt()
- strictParseInt32()
- strictParseLong()
- strictParseShort()
Classes
Interfaces
Type Aliases
Variables
variable logger
const logger: { warn: { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; };};
variable SENSITIVE_STRING
const SENSITIVE_STRING: string;
variable StringWrapper
const StringWrapper: StringWrapper;
Because of https://github.com/microsoft/tslib/issues/95, TS 'extends' shim doesn't support extending native types like String. So here we create StringWrapper that duplicate everything from String class including its prototype chain. So we can extend from here.
Functions
function dateToUtcString
dateToUtcString: (date: Date) => string;
Builds a proper UTC HttpDate timestamp from a Date object since not all environments will have this as the expected format.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString > Prior to ECMAScript 2018, the format of the return value > varied according to the platform. The most common return > value was an RFC-1123 formatted date stamp, which is a > slightly updated version of RFC-822 date stamps.
function emitWarningIfUnsupportedVersion
emitWarningIfUnsupportedVersion: (version: string) => void;
Emits warning if the provided Node.js version string is pending deprecation.
Parameter version
The Node.js version string.
function expectBoolean
expectBoolean: (value: any) => boolean | undefined;
Asserts a value is a boolean and returns it. Casts strings and numbers with a warning if there is evidence that they were intended to be booleans.
Parameter value
A value that is expected to be a boolean.
Returns
The value if it's a boolean, undefined if it's null/undefined, otherwise an error is thrown.
function expectByte
expectByte: (value: any) => number | undefined;
Asserts a value is an 8-bit integer and returns it.
Parameter value
A value that is expected to be an integer.
Returns
The value if it's an integer, undefined if it's null/undefined, otherwise an error is thrown.
function expectFloat32
expectFloat32: (value: any) => number | undefined;
Asserts a value is a 32-bit float and returns it.
Parameter value
A value that is expected to be a 32-bit float.
Returns
The value if it's a float, undefined if it's null/undefined, otherwise an error is thrown.
function expectInt
expectInt: (value: any) => number | undefined;
Deprecated
Use expectLong
function expectInt32
expectInt32: (value: any) => number | undefined;
Asserts a value is a 32-bit integer and returns it.
Parameter value
A value that is expected to be an integer.
Returns
The value if it's an integer, undefined if it's null/undefined, otherwise an error is thrown.
function expectLong
expectLong: (value: any) => number | undefined;
Asserts a value is an integer and returns it.
Parameter value
A value that is expected to be an integer.
Returns
The value if it's an integer, undefined if it's null/undefined, otherwise an error is thrown.
function expectNonNull
expectNonNull: <T>(value: T, location?: string | undefined) => T;
Asserts a value is not null or undefined and returns it, or throws an error.
Parameter value
A value that is expected to be defined
Parameter location
The location where we're expecting to find a defined object (optional)
Returns
The value if it's not undefined, otherwise throws an error
function expectNumber
expectNumber: (value: any) => number | undefined;
Asserts a value is a number and returns it. Casts strings with a warning if the string is a parseable number. This is to unblock slight API definition/implementation inconsistencies.
Parameter value
A value that is expected to be a number.
Returns
The value if it's a number, undefined if it's null/undefined, otherwise an error is thrown.
function expectObject
expectObject: (value: any) => Record<string, any> | undefined;
Asserts a value is an JSON-like object and returns it. This is expected to be used with values parsed from JSON (arrays, objects, numbers, strings, booleans).
Parameter value
A value that is expected to be an object
Returns
The value if it's an object, undefined if it's null/undefined, otherwise an error is thrown.
function expectShort
expectShort: (value: any) => number | undefined;
Asserts a value is a 16-bit integer and returns it.
Parameter value
A value that is expected to be an integer.
Returns
The value if it's an integer, undefined if it's null/undefined, otherwise an error is thrown.
function expectString
expectString: (value: any) => string | undefined;
Asserts a value is a string and returns it. Numbers and boolean will be cast to strings with a warning.
Parameter value
A value that is expected to be a string.
Returns
The value if it's a string, undefined if it's null/undefined, otherwise an error is thrown.
function expectUnion
expectUnion: (value: unknown) => Record<string, any> | undefined;
Asserts a value is a JSON-like object with only one non-null/non-undefined key and returns it.
Parameter value
A value that is expected to be an object with exactly one non-null, non-undefined key. the value if it's a union, undefined if it's null/undefined, otherwise an error is thrown.
function extendedEncodeURIComponent
extendedEncodeURIComponent: (str: string) => string;
Function that wraps encodeURIComponent to encode additional characters to fully adhere to RFC 3986.
function getArrayIfSingleItem
getArrayIfSingleItem: <T>(mayBeArray: T) => T | T[];
The XML parser will set one K:V for a member that could return multiple entries but only has one.
function getValueFromTextNode
getValueFromTextNode: (obj: any) => any;
Recursively parses object and populates value is node from "#text" key if it's available
function handleFloat
handleFloat: (value: string | number) => number | undefined;
Deprecated
Use limitedParseDouble
function limitedParseDouble
limitedParseDouble: (value: string | number) => number | undefined;
Asserts a value is a number and returns it. If the value is a string representation of a non-numeric number type (NaN, Infinity, -Infinity), the value will be parsed. Any other string value will result in an exception being thrown. Null or undefined will be returned as undefined. Any other type will result in an exception being thrown.
Parameter value
A number or string representation of a non-numeric float.
Returns
The value as a number, or undefined if it's null/undefined.
function limitedParseFloat
limitedParseFloat: (value: string | number) => number | undefined;
Deprecated
Use limitedParseDouble
function limitedParseFloat32
limitedParseFloat32: (value: string | number) => number | undefined;
Asserts a value is a 32-bit float and returns it. If the value is a string representation of a non-numeric number type (NaN, Infinity, -Infinity), the value will be parsed. Any other string value will result in an exception being thrown. Null or undefined will be returned as undefined. Any other type will result in an exception being thrown.
Parameter value
A number or string representation of a non-numeric float.
Returns
The value as a number, or undefined if it's null/undefined.
function parseBoolean
parseBoolean: (value: string) => boolean;
Give an input string, strictly parses a boolean value.
Parameter value
The boolean string to parse.
Returns
true for "true", false for "false", otherwise an error is thrown.
function parseEpochTimestamp
parseEpochTimestamp: (value: unknown) => Date | undefined;
Parses a value into a Date. Returns undefined if the input is null or undefined, throws an error if the input is not a number or a parseable string.
Input strings must be an integer or floating point number. Fractional seconds are supported.
Parameter value
the value to parse a Date or undefined
function parseRfc3339DateTime
parseRfc3339DateTime: (value: unknown) => Date | undefined;
Parses a value into a Date. Returns undefined if the input is null or undefined, throws an error if the input is not a string that can be parsed as an RFC 3339 date.
Input strings must conform to RFC3339 section 5.6, and cannot have a UTC offset. Fractional precision is supported.
Parameter value
the value to parse a Date or undefined
function parseRfc7231DateTime
parseRfc7231DateTime: (value: unknown) => Date | undefined;
Parses a value into a Date. Returns undefined if the input is null or undefined, throws an error if the input is not a string that can be parsed as an RFC 7231 IMF-fixdate or obs-date.
Input strings must conform to RFC7231 section 7.1.1.1. Fractional seconds are supported.
Parameter value
the value to parse a Date or undefined
function resolvedPath
resolvedPath: ( resolvedPath: string, input: unknown, memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean) => string;
function serializeFloat
serializeFloat: (value: number) => string | number;
Serializes a number, turning non-numeric values into strings.
Parameter value
The number to serialize.
Returns
A number, or a string if the given number was non-numeric.
function splitEvery
splitEvery: ( value: string, delimiter: string, numDelimiters: number) => Array<string>;
Given an input string, splits based on the delimiter after a given number of delimiters has been encountered.
Parameter value
The input string to split.
Parameter delimiter
The delimiter to split on.
Parameter numDelimiters
The number of delimiters to have encountered to split.
function strictParseByte
strictParseByte: (value: string | number) => number | undefined;
Parses a value into an 8-bit integer. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by parseFloat and the result will be asserted to be an integer. If the parsed value is not an integer, or the raw value is any type other than a string or number, an exception will be thrown.
Parameter value
A number or string representation of an 8-bit integer.
Returns
The value as a number, or undefined if it's null/undefined.
function strictParseDouble
strictParseDouble: (value: string | number) => number | undefined;
Parses a value into a double. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by the standard parseFloat with one exception: NaN may only be explicitly set as the string "NaN", any implicit Nan values will result in an error being thrown. If any other type is provided, an exception will be thrown.
Parameter value
A number or string representation of a double.
Returns
The value as a number, or undefined if it's null/undefined.
function strictParseFloat
strictParseFloat: (value: string | number) => number | undefined;
Deprecated
Use strictParseDouble
function strictParseFloat32
strictParseFloat32: (value: string | number) => number | undefined;
Parses a value into a float. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by the standard parseFloat with one exception: NaN may only be explicitly set as the string "NaN", any implicit Nan values will result in an error being thrown. If any other type is provided, an exception will be thrown.
Parameter value
A number or string representation of a float.
Returns
The value as a number, or undefined if it's null/undefined.
function strictParseInt
strictParseInt: (value: string | number) => number | undefined;
Deprecated
Use strictParseLong
function strictParseInt32
strictParseInt32: (value: string | number) => number | undefined;
Parses a value into a 32-bit integer. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by parseFloat and the result will be asserted to be an integer. If the parsed value is not an integer, or the raw value is any type other than a string or number, an exception will be thrown.
Parameter value
A number or string representation of a 32-bit integer.
Returns
The value as a number, or undefined if it's null/undefined.
function strictParseLong
strictParseLong: (value: string | number) => number | undefined;
Parses a value into an integer. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by parseFloat and the result will be asserted to be an integer. If the parsed value is not an integer, or the raw value is any type other than a string or number, an exception will be thrown.
Parameter value
A number or string representation of an integer.
Returns
The value as a number, or undefined if it's null/undefined.
function strictParseShort
strictParseShort: (value: string | number) => number | undefined;
Parses a value into a 16-bit integer. If the value is null or undefined, undefined will be returned. If the value is a string, it will be parsed by parseFloat and the result will be asserted to be an integer. If the parsed value is not an integer, or the raw value is any type other than a string or number, an exception will be thrown.
Parameter value
A number or string representation of a 16-bit integer.
Returns
The value as a number, or undefined if it's null/undefined.
Classes
class Client
class Client< HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {}
constructor
constructor(config: SmithyConfiguration<HandlerOptions>);
property config
readonly config: SmithyConfiguration<HandlerOptions>;
property middlewareStack
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
method destroy
destroy: () => void;
method send
send: { <InputType extends ClientInput, OutputType extends ClientOutput>( command: Command< ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions> >, options?: HandlerOptions ): Promise<OutputType>; <InputType extends ClientInput, OutputType extends ClientOutput>( command: Command< ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions> >, cb: (err: any, data?: OutputType) => void ): void; <InputType extends ClientInput, OutputType extends ClientOutput>( command: Command< ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions> >, options: HandlerOptions, cb: (err: any, data?: OutputType) => void ): void;};
class Command
abstract class Command< Input extends ClientInput, Output extends ClientOutput, ResolvedClientConfiguration, ClientInput extends object = any, ClientOutput extends MetadataBearer = any> implements ICommand< ClientInput, Input, ClientOutput, Output, ResolvedClientConfiguration > {}
property input
abstract input: {};
property middlewareStack
readonly middlewareStack: IMiddlewareStack<Input, Output>;
method resolveMiddleware
abstract resolveMiddleware: ( stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any) => Handler<Input, Output>;
class LazyJsonString
class LazyJsonString extends StringWrapper {}
method deserializeJSON
deserializeJSON: () => any;
method fromObject
static fromObject: (object: any) => LazyJsonString;
method toJSON
toJSON: () => string;
class NoOpLogger
class NoOpLogger implements Logger {}
class ServiceException
class ServiceException extends Error implements SmithyException, MetadataBearer {}
Base exception class for the exceptions from the server-side.
constructor
constructor(options: ServiceExceptionOptions);
property $fault
readonly $fault: 'client' | 'server';
property $metadata
$metadata: ResponseMetadata;
property $response
$response?: HttpResponse;
property $retryable
$retryable?: RetryableTrait;
Interfaces
interface ServiceExceptionOptions
interface ServiceExceptionOptions extends SmithyException, MetadataBearer {}
property message
message?: string;
interface SmithyConfiguration
interface SmithyConfiguration<HandlerOptions> {}
property requestHandler
requestHandler: RequestHandler<any, any, HandlerOptions>;
Type Aliases
type ConditionalLazyValueInstruction
type ConditionalLazyValueInstruction = [FilterStatusSupplier, ValueSupplier];
type ConditionalValueInstruction
type ConditionalValueInstruction = [ValueFilteringFunction, Value];
type DefaultsMode
type DefaultsMode = | 'standard' | 'in-region' | 'cross-region' | 'mobile' | 'auto' | 'legacy';
Option determining how certain default configuration options are resolved in the SDK. It can be one of the value listed below: *
"standard"
: The STANDARD mode provides the latest recommended default values that should be safe to run in most scenariosNote that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK *"in-region"
: The IN_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services from within the same AWS regionNote that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK *"cross-region"
: The CROSS_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services in a different regionNote that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK *"mobile"
: The MOBILE mode builds on the standard mode and includes optimization tailored for mobile applicationsNote that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK *"auto"
: The AUTO mode is an experimental mode that builds on the standard mode. The SDK will attempt to discover the execution environment to determine the appropriate settings automatically.Note that the auto detection is heuristics-based and does not guarantee 100% accuracy. STANDARD mode will be used if the execution environment cannot be determined. The auto detection might query EC2 Instance Metadata service, which might introduce latency. Therefore we recommend choosing an explicit defaults_mode instead if startup latency is critical to your application *"legacy"
: The LEGACY mode provides default settings that vary per SDK and were used prior to establishment of defaults_mode"legacy"
type FilterStatus
type FilterStatus = boolean | unknown | void;
Filter is considered passed if 1. It is a boolean true. 2. It is not undefined and is itself truthy. 3. It is undefined and the corresponding _value_ is neither null nor undefined.
type FilterStatusSupplier
type FilterStatusSupplier = () => boolean;
Supplies the filter check but not against any value as input.
type LazyValueInstruction
type LazyValueInstruction = [FilterStatus, ValueSupplier];
type ObjectMappingInstruction
type ObjectMappingInstruction = | LazyValueInstruction | ConditionalLazyValueInstruction | SimpleValueInstruction | ConditionalValueInstruction | UnfilteredValue;
An instruction set for assigning a value to a target object.
type ObjectMappingInstructions
type ObjectMappingInstructions = Record<string, ObjectMappingInstruction>;
A set of instructions for multiple keys. The aim is to provide a concise yet readable way to map and filter values onto a target object.
Example 1
const example: ObjectMappingInstructions = {lazyValue1: [, () => 1],lazyValue2: [, () => 2],lazyValue3: [, () => 3],lazyConditionalValue1: [() => true, () => 4],lazyConditionalValue2: [() => true, () => 5],lazyConditionalValue3: [true, () => 6],lazyConditionalValue4: [false, () => 44],lazyConditionalValue5: [() => false, () => 55],lazyConditionalValue6: ["", () => 66],simpleValue1: [, 7],simpleValue2: [, 8],simpleValue3: [, 9],conditionalValue1: [() => true, 10],conditionalValue2: [() => true, 11],conditionalValue3: [{}, 12],conditionalValue4: [false, 110],conditionalValue5: [() => false, 121],conditionalValue6: ["", 132],};const exampleResult: Record<string, any> = {lazyValue1: 1,lazyValue2: 2,lazyValue3: 3,lazyConditionalValue1: 4,lazyConditionalValue2: 5,lazyConditionalValue3: 6,simpleValue1: 7,simpleValue2: 8,simpleValue3: 9,conditionalValue1: 10,conditionalValue2: 11,conditionalValue3: 12,};
type SimpleValueInstruction
type SimpleValueInstruction = [FilterStatus, Value];
type SmithyResolvedConfiguration
type SmithyResolvedConfiguration<HandlerOptions> = SmithyConfiguration<HandlerOptions>;
type UnfilteredValue
type UnfilteredValue = any;
non-array
type Value
type Value = any;
A non-function value.
type ValueFilteringFunction
type ValueFilteringFunction = (value: any) => boolean;
Filter check with the given value.
type ValueSupplier
type ValueSupplier = () => any;
Supplies the value for lazy evaluation.
Package Files (18)
- dist-types/NoOpLogger.d.ts
- dist-types/client.d.ts
- dist-types/command.d.ts
- dist-types/constants.d.ts
- dist-types/date-utils.d.ts
- dist-types/defaults-mode.d.ts
- dist-types/emitWarningIfUnsupportedVersion.d.ts
- dist-types/exceptions.d.ts
- dist-types/extended-encode-uri-component.d.ts
- dist-types/get-array-if-single-item.d.ts
- dist-types/get-value-from-text-node.d.ts
- dist-types/index.d.ts
- dist-types/lazy-json.d.ts
- dist-types/object-mapping.d.ts
- dist-types/parse-utils.d.ts
- dist-types/resolve-path.d.ts
- dist-types/ser-utils.d.ts
- dist-types/split-every.d.ts
Dependencies (3)
Dev Dependencies (7)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-sdk/smithy-client
.
- Markdown[](https://www.jsdocs.io/package/@aws-sdk/smithy-client)
- HTML<a href="https://www.jsdocs.io/package/@aws-sdk/smithy-client"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4871 ms. - Missing or incorrect documentation? Open an issue for this package.