🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@smithy/types

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/types - npm Package Compare versions

Comparing version
4.16.0
to
4.16.1
+7
dist-types/ts3.4/abort-handler.d.ts
import { AbortSignal as DeprecatedAbortSignal } from "./abort";
/**
* @public
*/
export interface AbortHandler {
(this: AbortSignal | DeprecatedAbortSignal, ev: any): any;
}
import { AbortHandler } from "./abort-handler";
export { AbortHandler };
/**
* Holders of an AbortSignal object may query if the associated operation has
* been aborted and register an onabort handler.
*
* @public
* @deprecated use platform (global) type for AbortSignal.
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
export interface AbortSignal {
/**
* Whether the action represented by this signal has been cancelled.
*/
readonly aborted: boolean;
/**
* A function to be invoked when the action represented by this signal has
* been cancelled.
*/
onabort: AbortHandler | Function | null;
}
/**
* The AWS SDK uses a Controller/Signal model to allow for cooperative
* cancellation of asynchronous operations. When initiating such an operation,
* the caller can create an AbortController and then provide linked signal to
* subtasks. This allows a single source to communicate to multiple consumers
* that an action has been aborted without dictating how that cancellation
* should be handled.
*
* @public
* @deprecated use platform (global) type for AbortController.
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
*/
export interface AbortController {
/**
* An object that reports whether the action associated with this
* `AbortController` has been cancelled.
*/
readonly signal: AbortSignal;
/**
* Declares the operation associated with this AbortController to have been
* cancelled.
*/
abort(): void;
}
/**
* Authentication schemes represent a way that the service will authenticate the customer’s identity.
*
* @internal
*/
export interface AuthScheme {
/**
* @example "sigv4a" or "sigv4"
*/
name: "sigv4" | "sigv4a" | string;
/**
* @example "s3"
*/
signingName: string;
/**
* @example "us-east-1"
*/
signingRegion: string;
/**
* @example ["*"]
* @example ["us-west-2", "us-east-1"]
*/
signingRegionSet?: string[];
/**
* @deprecated this field was renamed to signingRegion.
*/
signingScope?: never;
properties: Record<string, unknown>;
}
/**
* @deprecated
*
* @internal
*/
export interface HttpAuthDefinition {
/**
* Defines the location of where the Auth is serialized.
*/
in: HttpAuthLocation;
/**
* Defines the name of the HTTP header or query string parameter
* that contains the Auth.
*/
name: string;
/**
* Defines the security scheme to use on the `Authorization` header value.
* This can only be set if the "in" property is set to {@link HttpAuthLocation.HEADER}.
*/
scheme?: string;
}
/**
* @deprecated
*
* @internal
*/
export declare enum HttpAuthLocation {
HEADER = "header",
QUERY = "query"
}
/**
* @internal
*/
export declare enum HttpApiKeyAuthLocation {
HEADER = "header",
QUERY = "query"
}
import { Identity, IdentityProvider } from "../identity/identity";
import { HandlerExecutionContext } from "../middleware";
import { HttpSigner } from "./HttpSigner";
import { IdentityProviderConfig } from "./IdentityProviderConfig";
/**
* ID for {@link HttpAuthScheme}
* @internal
*/
export type HttpAuthSchemeId = string;
/**
* Interface that defines an HttpAuthScheme
* @internal
*/
export interface HttpAuthScheme {
/**
* ID for an HttpAuthScheme, typically the absolute shape ID of a Smithy auth trait.
*/
schemeId: HttpAuthSchemeId;
/**
* Gets the IdentityProvider corresponding to an HttpAuthScheme.
*/
identityProvider(config: IdentityProviderConfig): IdentityProvider<Identity> | undefined;
/**
* HttpSigner corresponding to an HttpAuthScheme.
*/
signer: HttpSigner;
}
/**
* Interface that defines the identity and signing properties when selecting
* an HttpAuthScheme.
* @internal
*/
export interface HttpAuthOption {
schemeId: HttpAuthSchemeId;
identityProperties?: Record<string, unknown>;
signingProperties?: Record<string, unknown>;
propertiesExtractor?: <TConfig extends object, TContext extends HandlerExecutionContext>(config: TConfig, context: TContext) => {
identityProperties?: Record<string, unknown>;
signingProperties?: Record<string, unknown>;
};
}
/**
* @internal
*/
export interface SelectedHttpAuthScheme {
httpAuthOption: HttpAuthOption;
identity: Identity;
signer: HttpSigner;
}
import { HandlerExecutionContext } from "../middleware";
import { HttpAuthOption } from "./HttpAuthScheme";
/**
* @internal
*/
export interface HttpAuthSchemeParameters {
operation?: string;
}
/**
* @internal
*/
export interface HttpAuthSchemeProvider<TParameters extends HttpAuthSchemeParameters> {
(authParameters: TParameters): HttpAuthOption[];
}
/**
* @internal
*/
export interface HttpAuthSchemeParametersProvider<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object> {
(config: TConfig, context: TContext, input: TInput): Promise<TParameters>;
}
import { HttpRequest, HttpResponse } from "../http";
import { Identity } from "../identity/identity";
/**
* @internal
*/
export interface ErrorHandler {
(signingProperties: Record<string, unknown>): <E extends Error>(error: E) => never;
}
/**
* @internal
*/
export interface SuccessHandler {
(httpResponse: HttpResponse | unknown, signingProperties: Record<string, unknown>): void;
}
/**
* Interface to sign identity and signing properties.
* @internal
*/
export interface HttpSigner {
/**
* Signs an HttpRequest with an identity and signing properties.
* @param httpRequest request to sign
* @param identity identity to sing the request with
* @param signingProperties property bag for signing
* @returns signed request in a promise
*/
sign(httpRequest: HttpRequest, identity: Identity, signingProperties: Record<string, unknown>): Promise<HttpRequest>;
/**
* Handler that executes after the {@link HttpSigner.sign} invocation and corresponding
* middleware throws an error.
* The error handler is expected to throw the error it receives, so the return type of the error handler is `never`.
* @internal
*/
errorHandler?: ErrorHandler;
/**
* Handler that executes after the {@link HttpSigner.sign} invocation and corresponding
* middleware succeeds.
* @internal
*/
successHandler?: SuccessHandler;
}
import { Identity, IdentityProvider } from "../identity/identity";
import { HttpAuthSchemeId } from "./HttpAuthScheme";
/**
* Interface to get an IdentityProvider for a specified HttpAuthScheme
* @internal
*/
export interface IdentityProviderConfig {
/**
* Get the IdentityProvider for a specified HttpAuthScheme.
* @param schemeId schemeId of the HttpAuthScheme
* @returns IdentityProvider or undefined if HttpAuthScheme is not found
*/
getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
}
export { HttpAuthLocation } from "./auth";
export { AuthScheme, HttpAuthDefinition } from "./auth";
export { HttpApiKeyAuthLocation } from "./HttpApiKeyAuth";
export { HttpAuthOption, HttpAuthScheme, HttpAuthSchemeId, SelectedHttpAuthScheme } from "./HttpAuthScheme";
export { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, } from "./HttpAuthSchemeProvider";
export { ErrorHandler, HttpSigner, SuccessHandler } from "./HttpSigner";
export { IdentityProviderConfig } from "./IdentityProviderConfig";
import { Readable } from "node:stream";
import { BlobOptionalType, ReadableStreamOptionalType } from "../externals-check/browser-externals-check";
/**
* A union of types that can be used as inputs for the service model
* "blob" type when it represents the request's entire payload or body.
* For example, in Lambda::invoke, the payload is modeled as a blob type
* and this union applies to it.
* In contrast, in Lambda::createFunction the Zip file option is a blob type,
* but is not the (entire) payload and this union does not apply.
* Note: not all types are signable by the standard SignatureV4 signer when
* used as the request body. For example, in Node.js a Readable stream
* is not signable by the default signer.
* They are included in the union because it may work in some cases,
* but the expected types are primarily string and Uint8Array.
* Additional details may be found in the internal
* function "getPayloadHash" in the SignatureV4 module.
*
* @public
*/
export type BlobPayloadInputTypes = string | ArrayBuffer | ArrayBufferView | Uint8Array | NodeJsRuntimeBlobTypes | BrowserRuntimeBlobTypes;
/**
* Additional blob types for the Node.js environment.
*
* @public
*/
export type NodeJsRuntimeBlobTypes = Readable | Buffer;
/**
* Additional blob types for the browser environment.
*
* @public
*/
export type BrowserRuntimeBlobTypes = BlobOptionalType | ReadableStreamOptionalType;
/**
* @internal
* @deprecated renamed to BlobPayloadInputTypes.
*/
export type BlobTypes = BlobPayloadInputTypes;
import { SourceData } from "./crypto";
/**
* An object that provides a checksum of data provided in chunks to `update`.
* The checksum may be performed incrementally as chunks are received or all
* at once when the checksum is finalized, depending on the underlying
* implementation.
* It's recommended to compute checksum incrementally to avoid reading the
* entire payload in memory.
* A class that implements this interface may accept an optional secret key in its
* constructor while computing checksum value, when using HMAC. If provided,
* this secret key would be used when computing checksum.
*
* @public
*/
export interface Checksum {
/**
* Constant length of the digest created by the algorithm in bytes.
*/
digestLength?: number;
/**
* Creates a new checksum object that contains a deep copy of the internal
* state of the current `Checksum` object.
*/
copy?(): Checksum;
/**
* Returns the digest of all of the data passed.
*/
digest(): Promise<Uint8Array>;
/**
* Allows marking a checksum for checksums that support the ability
* to mark and reset.
*
* @param readLimit - The maximum limit of bytes that can be read
* before the mark position becomes invalid.
*/
mark?(readLimit: number): void;
/**
* Resets the checksum to its initial value.
*/
reset(): void;
/**
* Adds a chunk of data for which checksum needs to be computed.
* This can be called many times with new data as it is streamed.
*
* Implementations may override this method which passes second param
* which makes Checksum object stateless.
*
* @param chunk - The buffer to update checksum with.
*/
update(chunk: Uint8Array): void;
}
/**
* A constructor for a Checksum that may be used to calculate an HMAC. Implementing
* classes should not directly hold the provided key in memory beyond the
* lexical scope of the constructor.
*
* @public
*/
export interface ChecksumConstructor {
new (secret?: SourceData): Checksum;
}
import { Command } from "./command";
import { MiddlewareStack } from "./middleware";
import { MetadataBearer } from "./response";
import { OptionalParameter } from "./util";
/**
* A type which checks if the client configuration is optional.
* If all entries of the client configuration are optional, it allows client creation without passing any config.
*
* @public
*/
export type CheckOptionalClientConfig<T> = OptionalParameter<T>;
/**
* function definition for different overrides of client's 'send' function.
*
* @public
*/
export interface InvokeFunction<InputTypes extends object, OutputTypes extends MetadataBearer, ResolvedClientConfiguration> {
<InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options?: any): Promise<OutputType>;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, cb: (err: any, data?: OutputType) => void): void;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options: any, cb: (err: any, data?: OutputType) => void): void;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options?: any, cb?: (err: any, data?: OutputType) => void): Promise<OutputType> | void;
}
/**
* Signature that appears on aggregated clients' methods.
*
* @public
*/
export interface InvokeMethod<InputType extends object, OutputType extends MetadataBearer> {
(input: InputType, options?: any): Promise<OutputType>;
(input: InputType, cb: (err: any, data?: OutputType) => void): void;
(input: InputType, options: any, cb: (err: any, data?: OutputType) => void): void;
(input: InputType, options?: any, cb?: (err: any, data?: OutputType) => void): Promise<OutputType> | void;
}
/**
* Signature that appears on aggregated clients' methods when argument is optional.
*
* @public
*/
export interface InvokeMethodOptionalArgs<InputType extends object, OutputType extends MetadataBearer> {
(): Promise<OutputType>;
(input: InputType, options?: any): Promise<OutputType>;
(input: InputType, cb: (err: any, data?: OutputType) => void): void;
(input: InputType, options: any, cb: (err: any, data?: OutputType) => void): void;
(input: InputType, options?: any, cb?: (err: any, data?: OutputType) => void): Promise<OutputType> | void;
}
/**
* A general interface for service clients, idempotent to browser or node clients
* This type corresponds to SmithyClient(https://github.com/aws/aws-sdk-js-v3/blob/main/packages/smithy-client/src/client.ts).
* It's provided for using without importing the SmithyClient class.
* @internal
*/
export interface Client<Input extends object, Output extends MetadataBearer, ResolvedClientConfiguration> {
readonly config: ResolvedClientConfiguration;
middlewareStack: MiddlewareStack<Input, Output>;
send: InvokeFunction<Input, Output, ResolvedClientConfiguration>;
destroy: () => void;
}
import { Handler, MiddlewareStack } from "./middleware";
import { MetadataBearer } from "./response";
/**
* @public
*/
export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> extends CommandIO<InputType, OutputType> {
readonly input: InputType;
readonly middlewareStack: MiddlewareStack<InputType, OutputType>;
/**
* This should be OperationSchema from @smithy/types, but would
* create problems with the client transform type adaptors.
*/
readonly schema?: any;
resolveMiddleware(stack: MiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedConfiguration, options: any): Handler<InputType, OutputType>;
}
/**
* This is a subset of the Command type used only to detect the i/o types.
*
* @internal
*/
export interface CommandIO<InputType extends object, OutputType extends MetadataBearer> {
readonly input: InputType;
resolveMiddleware(stack: any, configuration: any, options: any): Handler<InputType, OutputType>;
}
/**
* @internal
*/
export type GetOutputType<Command> = Command extends CommandIO<any, infer O> ? O : never;
/**
* @public
*/
export interface ConnectConfiguration {
/**
* The maximum time in milliseconds that the connection phase of a request
* may take before the connection attempt is abandoned.
*/
requestTimeout?: number;
/**
* Signal from the Command class object context,
* tells the connection manager to use a new connection.
*/
isEventStream?: boolean;
}
export { ConnectConfiguration } from "./config";
export { ConnectionManager, ConnectionManagerConfiguration } from "./manager";
export { CacheKey, ConnectionPool } from "./pool";
import { RequestContext } from "../transfer";
import { ConnectConfiguration } from "./config";
/**
* @public
*/
export interface ConnectionManagerConfiguration {
/**
* Maximum number of allowed concurrent requests per connection.
*/
maxConcurrency?: number;
/**
* Disables concurrent requests per connection.
*/
disableConcurrency?: boolean;
}
/**
* @public
*/
export interface ConnectionManager<T> {
/**
* Retrieves a connection from the connection pool if available,
* otherwise establish a new connection
*/
lease(requestContext: RequestContext, connectionConfiguration: ConnectConfiguration): T;
/**
* Releases the connection back to the pool making it potentially
* re-usable by other requests.
*/
release(requestContext: RequestContext, connection: T): void;
/**
* Destroys the connection manager. All connections will be closed.
*/
destroy(): void;
}
/**
* @public
*/
export interface ConnectionPool<T> {
/**
* Retrieve the first connection in the pool
*/
poll(): T | void;
/**
* Release the connection back to the pool making it potentially
* re-usable by other requests.
*/
offerLast(connection: T): void;
/**
* Removes the connection from the pool, and destroys it.
*/
destroy(connection: T): void;
/**
* Implements the iterable protocol and allows arrays to be consumed
* by most syntaxes expecting iterables, such as the spread syntax
* and for...of loops
*/
[Symbol.iterator](): Iterator<T>;
}
/**
* Unused.
* @internal
* @deprecated
*/
export interface CacheKey {
destination: string;
}
/**
* @public
*/
export type SourceData = string | ArrayBuffer | ArrayBufferView;
/**
* An object that provides a hash of data provided in chunks to `update`. The
* hash may be performed incrementally as chunks are received or all at once
* when the hash is finalized, depending on the underlying implementation.
*
* @public
* @deprecated use {@link Checksum}
*/
export interface Hash {
/**
* Adds a chunk of data to the hash. If a buffer is provided, the `encoding`
* argument will be ignored. If a string is provided without a specified
* encoding, implementations must assume UTF-8 encoding.
*
* Not all encodings are supported on all platforms, though all must support
* UTF-8.
*/
update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void;
/**
* Finalizes the hash and provides a promise that will be fulfilled with the
* raw bytes of the calculated hash.
*/
digest(): Promise<Uint8Array>;
}
/**
* A constructor for a hash that may be used to calculate an HMAC. Implementing
* classes should not directly hold the provided key in memory beyond the
* lexical scope of the constructor.
*
* @public
* @deprecated use {@link ChecksumConstructor}
*/
export interface HashConstructor {
new (secret?: SourceData): Hash;
}
/**
* A function that calculates the hash of a data stream. Determining the hash
* will consume the stream, so only replayable streams should be provided to an
* implementation of this interface.
*
* @public
*/
export interface StreamHasher<StreamType = any> {
(hashCtor: HashConstructor, stream: StreamType): Promise<Uint8Array>;
}
/**
* A function that returns a promise fulfilled with bytes from a
* cryptographically secure pseudorandom number generator.
*
* @public
*/
export interface randomValues {
(byteLength: number): Promise<Uint8Array>;
}
/**
* Transforms any members of the object T having type FromType
* to ToType. This applies only to exact type matches.
* This is for the case where FromType is a union and only those fields
* matching the same union should be transformed.
*
* @public
*/
export type Transform<T, FromType, ToType> = RecursiveTransformExact<T, FromType, ToType>;
/**
* Returns ToType if T matches exactly with FromType.
*
* @internal
*/
type TransformExact<T, FromType, ToType> = [
T
] extends [
FromType
] ? ([
FromType
] extends [
T
] ? ToType : T) : T;
/**
* Applies TransformExact to members of an object recursively.
*
* @internal
*/
type RecursiveTransformExact<T, FromType, ToType> = T extends Function ? T : T extends object ? {
[key in keyof T]: [
T[key]
] extends [
FromType
] ? [
FromType
] extends [
T[key]
] ? ToType : RecursiveTransformExact<T[key], FromType, ToType> : RecursiveTransformExact<T[key], FromType, ToType>;
} : TransformExact<T, FromType, ToType>;
export {};
import { Message } from "./eventStream";
/**
* @public
*/
export interface MessageEncoder {
encode(message: Message): Uint8Array;
}
/**
* @public
*/
export interface MessageDecoder {
decode(message: ArrayBufferView): Message;
feed(message: ArrayBufferView): void;
endOfStream(): void;
getMessage(): AvailableMessage;
getAvailableMessages(): AvailableMessages;
}
/**
* @public
*/
export interface AvailableMessage {
getMessage(): Message | undefined;
isEndOfStream(): boolean;
}
/**
* @public
*/
export interface AvailableMessages {
getMessages(): Message[];
isEndOfStream(): boolean;
}
import { AuthScheme } from "./auth/auth";
/**
* @public
*/
export interface EndpointPartition {
name: string;
dnsSuffix: string;
dualStackDnsSuffix: string;
supportsFIPS: boolean;
supportsDualStack: boolean;
}
/**
* @public
*/
export interface EndpointARN {
partition: string;
service: string;
region: string;
accountId: string;
resourceId: Array<string>;
}
/**
* @public
*/
export declare enum EndpointURLScheme {
HTTP = "http",
HTTPS = "https"
}
/**
* @public
*/
export interface EndpointURL {
/**
* The URL scheme such as http or https.
*/
scheme: EndpointURLScheme;
/**
* The authority is the host and optional port component of the URL.
*/
authority: string;
/**
* The parsed path segment of the URL.
* This value is as-is as provided by the user.
*/
path: string;
/**
* The parsed path segment of the URL.
* This value is guranteed to start and end with a "/".
*/
normalizedPath: string;
/**
* A boolean indicating whether the authority is an IP address.
*/
isIp: boolean;
}
/**
* @public
*/
export type EndpointObjectProperty = string | boolean | {
[key: string]: EndpointObjectProperty;
} | EndpointObjectProperty[];
/**
* @public
*/
export interface EndpointV2 {
url: URL;
properties?: {
authSchemes?: AuthScheme[];
} & Record<string, EndpointObjectProperty>;
headers?: Record<string, string[]>;
}
/**
* @public
*/
export type EndpointParameters = {
[name: string]: undefined | boolean | string | string[];
};
/**
* @internal
*/
export interface EndpointParameterInstructions {
[name: string]: BuiltInParamInstruction | ClientContextParamInstruction | StaticContextParamInstruction | ContextParamInstruction | OperationContextParamInstruction;
}
/**
* @internal
*/
export interface BuiltInParamInstruction {
type: "builtInParams";
name: string;
}
/**
* @internal
*/
export interface ClientContextParamInstruction {
type: "clientContextParams";
name: string;
}
/**
* @internal
*/
export interface StaticContextParamInstruction {
type: "staticContextParams";
value: string | boolean;
}
/**
* @internal
*/
export interface ContextParamInstruction {
type: "contextParams";
name: string;
}
/**
* @internal
*/
export interface OperationContextParamInstruction {
type: "operationContextParams";
get(input: any): any;
}
import { EndpointObjectProperty } from "../endpoint";
import { ConditionObject, Expression } from "./shared";
/**
* @public
*/
export type EndpointObjectProperties = Record<string, EndpointObjectProperty>;
/**
* @public
*/
export type EndpointObjectHeaders = Record<string, Expression[]>;
/**
* @public
*/
export type EndpointObject = {
url: Expression;
properties?: EndpointObjectProperties;
headers?: EndpointObjectHeaders;
};
/**
* @public
*/
export type EndpointRuleObject = {
type: "endpoint";
conditions?: ConditionObject[];
endpoint: EndpointObject;
documentation?: string;
};
import { ConditionObject, Expression } from "./shared";
/**
* @public
*/
export type ErrorRuleObject = {
type: "error";
conditions?: ConditionObject[];
error: Expression;
documentation?: string;
};
export { EndpointObject, EndpointObjectHeaders, EndpointObjectProperties, EndpointRuleObject, } from "./EndpointRuleObject";
export { ErrorRuleObject } from "./ErrorRuleObject";
export { DeprecatedObject, ParameterObject, RuleSetObject } from "./RuleSetObject";
export { ConditionObject, EndpointParams, EndpointResolverOptions, EvaluateOptions, Expression, FunctionArgv, FunctionObject, FunctionReturn, ReferenceObject, ReferenceRecord, } from "./shared";
export { RuleSetRules, TreeRuleObject } from "./TreeRuleObject";
import { RuleSetRules } from "./TreeRuleObject";
/**
* @public
*/
export type DeprecatedObject = {
message?: string;
since?: string;
};
/**
* @public
*/
export type ParameterObject = {
type: "String" | "string" | "Boolean" | "boolean";
default?: string | boolean;
required?: boolean;
documentation?: string;
builtIn?: string;
deprecated?: DeprecatedObject;
};
/**
* @public
*/
export type RuleSetObject = {
version: string;
serviceId?: string;
parameters: Record<string, ParameterObject>;
rules: RuleSetRules;
};
import { Logger } from "../logger";
/**
* @public
*/
export type ReferenceObject = {
ref: string;
};
/**
* @public
*/
export type FunctionObject = {
fn: string;
argv: FunctionArgv;
};
/**
* @public
*/
export type FunctionArgv = Array<Expression | boolean | number>;
/**
* @public
*/
export type FunctionReturn = string | boolean | number | {
[key: string]: FunctionReturn;
};
/**
* @public
*/
export type ConditionObject = FunctionObject & {
assign?: string;
};
/**
* @public
*/
export type Expression = string | ReferenceObject | FunctionObject;
/**
* @public
*/
export type EndpointParams = Record<string, string | boolean>;
/**
* @public
*/
export type EndpointResolverOptions = {
endpointParams: EndpointParams;
logger?: Logger;
};
/**
* @public
*/
export type ReferenceRecord = Record<string, FunctionReturn>;
/**
* @public
*/
export type EvaluateOptions = EndpointResolverOptions & {
referenceRecord: ReferenceRecord;
};
import { EndpointRuleObject } from "./EndpointRuleObject";
import { ErrorRuleObject } from "./ErrorRuleObject";
import { ConditionObject } from "./shared";
/**
* @public
*/
export type RuleSetRules = Array<EndpointRuleObject | ErrorRuleObject | TreeRuleObject>;
/**
* @public
*/
export type TreeRuleObject = {
type: "tree";
conditions?: ConditionObject[];
rules: RuleSetRules;
documentation?: string;
};
import { HttpRequest } from "./http";
import { FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput, HandlerExecutionContext } from "./middleware";
import { MetadataBearer } from "./response";
/**
* An event stream message. The headers and body properties will always be
* defined, with empty headers represented as an object with no keys and an
* empty body represented as a zero-length Uint8Array.
*
* @public
*/
export interface Message {
headers: MessageHeaders;
body: Uint8Array;
}
/**
* @public
*/
export type MessageHeaders = Record<string, MessageHeaderValue>;
/**
* @public
*/
export type HeaderValue<K extends string, V> = {
type: K;
value: V;
};
/**
* @public
*/
export type BooleanHeaderValue = HeaderValue<"boolean", boolean>;
/**
* @public
*/
export type ByteHeaderValue = HeaderValue<"byte", number>;
/**
* @public
*/
export type ShortHeaderValue = HeaderValue<"short", number>;
/**
* @public
*/
export type IntegerHeaderValue = HeaderValue<"integer", number>;
/**
* @public
*/
export type LongHeaderValue = HeaderValue<"long", Int64>;
/**
* @public
*/
export type BinaryHeaderValue = HeaderValue<"binary", Uint8Array>;
/**
* @public
*/
export type StringHeaderValue = HeaderValue<"string", string>;
/**
* @public
*/
export type TimestampHeaderValue = HeaderValue<"timestamp", Date>;
/**
* @public
*/
export type UuidHeaderValue = HeaderValue<"uuid", string>;
/**
* @public
*/
export type MessageHeaderValue = BooleanHeaderValue | ByteHeaderValue | ShortHeaderValue | IntegerHeaderValue | LongHeaderValue | BinaryHeaderValue | StringHeaderValue | TimestampHeaderValue | UuidHeaderValue;
/**
* @public
*/
export interface Int64 {
readonly bytes: Uint8Array;
valueOf: () => number;
toString: () => string;
}
/**
* Util functions for serializing or deserializing event stream
*
* @public
*/
export interface EventStreamSerdeContext {
eventStreamMarshaller: EventStreamMarshaller;
}
/**
* A function which deserializes binary event stream message into modeled shape.
*
* @public
*/
export interface EventStreamMarshallerDeserFn<StreamType> {
<T>(body: StreamType, deserializer: (input: Record<string, Message>) => Promise<T>): AsyncIterable<T>;
}
/**
* A function that serializes modeled shape into binary stream message.
*
* @public
*/
export interface EventStreamMarshallerSerFn<StreamType> {
<T>(input: AsyncIterable<T>, serializer: (event: T) => Message): StreamType;
}
/**
* An interface which provides functions for serializing and deserializing binary event stream
* to/from corresponsing modeled shape.
*
* @public
*/
export interface EventStreamMarshaller<StreamType = any> {
deserialize: EventStreamMarshallerDeserFn<StreamType>;
serialize: EventStreamMarshallerSerFn<StreamType>;
}
/**
* @public
*/
export interface EventStreamRequestSigner {
sign(request: HttpRequest): Promise<HttpRequest>;
}
/**
* @public
*/
export interface EventStreamPayloadHandler {
handle: <Input extends object, Output extends MetadataBearer>(next: FinalizeHandler<Input, Output>, args: FinalizeHandlerArguments<Input>, context?: HandlerExecutionContext) => Promise<FinalizeHandlerOutput<Output>>;
}
/**
* @public
*/
export interface EventStreamPayloadHandlerProvider {
(options: any): EventStreamPayloadHandler;
}
/**
* @public
*/
export interface EventStreamSerdeProvider {
(options: any): EventStreamMarshaller;
}
/**
* @public
*/
export interface EventStreamSignerProvider {
(options: any): EventStreamRequestSigner;
}
import { ChecksumConstructor } from "../checksum";
import { HashConstructor } from "../crypto";
/**
* @internal
*/
export declare enum AlgorithmId {
MD5 = "md5",
CRC32 = "crc32",
CRC32C = "crc32c",
SHA1 = "sha1",
SHA256 = "sha256"
}
/**
* @internal
*/
export interface ChecksumAlgorithm {
algorithmId(): AlgorithmId | string;
checksumConstructor(): ChecksumConstructor | HashConstructor;
}
/**
* @deprecated unused.
* @internal
*/
type ChecksumConfigurationLegacy = {
[other in string | number]: any;
};
/**
* @internal
*/
export interface ChecksumConfiguration extends ChecksumConfigurationLegacy {
addChecksumAlgorithm(algo: ChecksumAlgorithm): void;
checksumAlgorithms(): ChecksumAlgorithm[];
}
/**
* @deprecated will be removed for implicit type.
* @internal
*/
type GetChecksumConfigurationType = (runtimeConfig: Partial<{
sha256: ChecksumConstructor | HashConstructor;
md5: ChecksumConstructor | HashConstructor;
}>) => ChecksumConfiguration;
/**
* @internal
* @deprecated will be moved to smithy-client.
*/
export declare const getChecksumConfiguration: GetChecksumConfigurationType;
/**
* @internal
* @deprecated will be removed for implicit type.
*/
type ResolveChecksumRuntimeConfigType = (clientConfig: ChecksumConfiguration) => any;
/**
* @internal
*
* @deprecated will be moved to smithy-client.
*/
export declare const resolveChecksumRuntimeConfig: ResolveChecksumRuntimeConfigType;
export {};
import { ChecksumConfiguration } from "./checksum";
/**
* Default client configuration consisting various configurations for modifying a service client
*
* @internal
* @deprecated will be replaced by DefaultExtensionConfiguration.
*/
export interface DefaultClientConfiguration extends ChecksumConfiguration {
}
/**
* @deprecated will be removed for implicit type.
*/
type GetDefaultConfigurationType = (runtimeConfig: any) => DefaultClientConfiguration;
/**
* Helper function to resolve default client configuration from runtime config
*
* @internal
* @deprecated moving to @smithy/smithy-client.
*/
export declare const getDefaultClientConfiguration: GetDefaultConfigurationType;
/**
* @deprecated will be removed for implicit type.
*/
type ResolveDefaultRuntimeConfigType = (clientConfig: DefaultClientConfiguration) => any;
/**
* Helper function to resolve runtime config from default client configuration
*
* @internal
* @deprecated moving to @smithy/smithy-client.
*/
export declare const resolveDefaultRuntimeConfig: ResolveDefaultRuntimeConfigType;
export {};
import { ChecksumConfiguration } from "./checksum";
import { RetryStrategyConfiguration } from "./retry";
/**
* Default extension configuration consisting various configurations for modifying a service client
*
* @internal
*/
export interface DefaultExtensionConfiguration extends ChecksumConfiguration, RetryStrategyConfiguration {
}
export { getDefaultClientConfiguration, resolveDefaultRuntimeConfig } from "./defaultClientConfiguration";
export { DefaultClientConfiguration } from "./defaultClientConfiguration";
export { DefaultExtensionConfiguration } from "./defaultExtensionConfiguration";
export { AlgorithmId } from "./checksum";
export { ChecksumAlgorithm, ChecksumConfiguration } from "./checksum";
export { RetryStrategyConfiguration } from "./retry";
import { RetryStrategyV2 } from "../retry";
import { Provider, RetryStrategy } from "../util";
/**
* A configuration interface with methods called by runtime extension
* @internal
*/
export interface RetryStrategyConfiguration {
/**
* Set retry strategy used for all http requests
* @param retryStrategy
*/
setRetryStrategy(retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>): void;
/**
* Get retry strategy used for all http requests
* @param retryStrategy
*/
retryStrategy(): Provider<RetryStrategyV2 | RetryStrategy>;
}
import { Exact } from "../transform/exact";
/**
* A checked type that resolves to Blob if it is defined as more than a stub, otherwise
* resolves to 'never' so as not to widen the type of unions containing Blob
* excessively.
*
* @public
*/
export type BlobOptionalType = BlobDefined extends true ? Blob : Unavailable;
/**
* A checked type that resolves to ReadableStream if it is defined as more than a stub, otherwise
* resolves to 'never' so as not to widen the type of unions containing ReadableStream
* excessively.
*
* @public
*/
export type ReadableStreamOptionalType = ReadableStreamDefined extends true ? ReadableStream : Unavailable;
/**
* Indicates a type is unavailable if it resolves to this.
*
* @public
*/
export type Unavailable = never;
/**
* Whether the global types define more than a stub for ReadableStream.
*
* @internal
*/
export type ReadableStreamDefined = Exact<ReadableStream, {}> extends true ? false : true;
/**
* Whether the global types define more than a stub for Blob.
*
* @internal
*/
export type BlobDefined = Exact<Blob, {}> extends true ? false : true;
/**
* @internal
*/
export type SmithyFeatures = Partial<{
RESOURCE_MODEL: "A";
WAITER: "B";
PAGINATOR: "C";
RETRY_MODE_LEGACY: "D";
RETRY_MODE_STANDARD: "E";
RETRY_MODE_ADAPTIVE: "F";
GZIP_REQUEST_COMPRESSION: "L";
PROTOCOL_RPC_V2_CBOR: "M";
ENDPOINT_OVERRIDE: "N";
SIGV4A_SIGNING: "S";
CREDENTIALS_CODE: "e";
}>;
import { AbortSignal as DeprecatedAbortSignal } from "./abort";
import { URI } from "./uri";
/**
* @public
*
* @deprecated use {@link EndpointV2} from `@smithy/types`.
*/
export interface Endpoint {
protocol: string;
hostname: string;
port?: number;
path: string;
query?: QueryParameterBag;
headers?: HeaderBag;
}
/**
* Interface an HTTP request class. Contains
* addressing information in addition to standard message properties.
*
* @public
*/
export interface HttpRequest extends HttpMessage, URI {
method: string;
}
/**
* Represents an HTTP message as received in reply to a request. Contains a
* numeric status code in addition to standard message properties.
*
* @public
*/
export interface HttpResponse extends HttpMessage {
statusCode: number;
reason?: string;
}
/**
* Represents an HTTP message with headers and an optional static or streaming
* body. body: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream;
*
* @public
*/
export interface HttpMessage {
headers: HeaderBag;
body?: any;
}
/**
* A mapping of query parameter names to strings or arrays of strings, with the
* second being used when a parameter contains a list of values. Value can be set
* to null when query is not in key-value pairs shape
*
* @public
*/
export type QueryParameterBag = Record<string, string | Array<string> | null>;
/**
* @public
*/
export type FieldOptions = {
name: string;
kind?: FieldPosition;
values?: string[];
};
/**
* @public
*/
export declare enum FieldPosition {
HEADER = 0,
TRAILER = 1
}
/**
* A mapping of header names to string values. Multiple values for the same
* header should be represented as a single string with values separated by
* `, `.
* Keys should be considered case insensitive, even if this is not enforced by a
* particular implementation. For example, given the following HeaderBag, where
* keys differ only in case:
* ```json
* {
* 'x-request-date': '2000-01-01T00:00:00Z',
* 'X-Request-Date': '2001-01-01T00:00:00Z'
* }
* ```
* The SDK may at any point during processing remove one of the object
* properties in favor of the other. The headers may or may not be combined, and
* the SDK will not deterministically select which header candidate to use.
*
* @public
*/
export type HeaderBag = Record<string, string>;
/**
* Represents an HTTP message with headers and an optional static or streaming
* body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream;
*
* @public
*/
export interface HttpMessage {
headers: HeaderBag;
body?: any;
}
/**
* Represents the options that may be passed to an Http Handler.
*
* @public
*/
export interface HttpHandlerOptions {
abortSignal?: AbortSignal | DeprecatedAbortSignal;
/**
* The maximum time in milliseconds that the connection phase of a request
* may take before the connection attempt is abandoned.
*/
requestTimeout?: number;
}
import { Agent as hAgent, AgentOptions as hAgentOptions } from "node:http";
import { Agent as hsAgent, AgentOptions as hsAgentOptions } from "node:https";
import { HttpRequest as IHttpRequest } from "../http";
import { Logger } from "../logger";
/**
*
* This type represents an alternate client constructor option for the entry
* "requestHandler". Instead of providing an instance of a requestHandler, the user
* may provide the requestHandler's constructor options for either the
* NodeHttpHandler or FetchHttpHandler.
*
* For other RequestHandlers like HTTP2 or WebSocket,
* constructor parameter passthrough is not currently available.
*
* @public
*/
export type RequestHandlerParams = NodeHttpHandlerOptions | FetchHttpHandlerOptions;
/**
* Represents the http options that can be passed to a node http client.
* @public
*/
export interface NodeHttpHandlerOptions {
/**
* The maximum time in milliseconds that the connection phase of a request
* may take before the connection attempt is abandoned.
* Defaults to 0, which disables the timeout.
*/
connectionTimeout?: number;
/**
* The maximum number of milliseconds request & response should take.
* Defaults to 0, which disables the timeout.
*
* If exceeded, a warning will be emitted unless throwOnRequestTimeout=true,
* in which case a TimeoutError will be thrown.
*/
requestTimeout?: number;
/**
* Because requestTimeout was for a long time incorrectly being set as a socket idle timeout,
* users must also opt-in for request timeout thrown errors.
* Without this setting, a breach of the request timeout will be logged as a warning.
*/
throwOnRequestTimeout?: boolean;
/**
* The maximum time in milliseconds that a socket may remain idle before it
* is closed. Defaults to 0, which means no maximum.
*
* This does not affect the server, which may still close the connection due to an idle socket.
*/
socketTimeout?: number;
/**
* Delay before the NodeHttpHandler checks for socket exhaustion,
* and emits a warning if the active sockets and enqueued request count is greater than
* 2x the maxSockets count.
*
* Defaults to connectionTimeout + requestTimeout or 3000ms if those are not set.
*/
socketAcquisitionWarningTimeout?: number;
/**
* You can pass http.Agent or its constructor options.
*/
httpAgent?: hAgent | hAgentOptions;
/**
* You can pass https.Agent or its constructor options.
*/
httpsAgent?: hsAgent | hsAgentOptions;
/**
* Optional logger.
*/
logger?: Logger;
}
/**
* Represents the http options that can be passed to a browser http client.
* @public
*/
export interface FetchHttpHandlerOptions {
/**
* The number of milliseconds a request can take before being automatically
* terminated.
*/
requestTimeout?: number;
/**
* Whether to allow the request to outlive the page. Default value is false.
*
* There may be limitations to the payload size, number of concurrent requests,
* request duration etc. when using keepalive in browsers.
*
* These may change over time, so look for up to date information about
* these limitations before enabling keepalive.
*/
keepAlive?: boolean;
/**
* A string indicating whether credentials will be sent with the request always, never, or
* only when sent to a same-origin URL.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
*/
credentials?: "include" | "omit" | "same-origin" | undefined | string;
/**
* Cache settings for fetch.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request/cache
*/
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
/**
* An optional function that produces additional RequestInit
* parameters for each httpRequest.
*
* This is applied last via merging with Object.assign() and overwrites other values
* set from other sources.
*
* @example
* ```js
* new Client({
* requestHandler: {
* requestInit(httpRequest) {
* return { cache: "no-store" };
* }
* }
* });
* ```
*/
requestInit?: (httpRequest: IHttpRequest) => RequestInit;
}
declare global {
/**
* interface merging stub.
*/
interface RequestInit {
}
}
import { Identity, IdentityProvider } from "../identity/identity";
/**
* @public
*/
export interface ApiKeyIdentity extends Identity {
/**
* The literal API Key
*/
readonly apiKey: string;
}
/**
* @public
*/
export type ApiKeyIdentityProvider = IdentityProvider<ApiKeyIdentity>;
import { Identity, IdentityProvider } from "./identity";
/**
* @public
*/
export interface AwsCredentialIdentity extends Identity {
/**
* AWS access key ID
*/
readonly accessKeyId: string;
/**
* AWS secret access key
*/
readonly secretAccessKey: string;
/**
* A security or session token to use with these credentials. Usually
* present for temporary credentials.
*/
readonly sessionToken?: string;
/**
* AWS credential scope for this set of credentials.
*/
readonly credentialScope?: string;
/**
* AWS accountId.
*/
readonly accountId?: string;
}
/**
* @public
*/
export type AwsCredentialIdentityProvider = IdentityProvider<AwsCredentialIdentity>;
/**
* @public
*/
export interface Identity {
/**
* A `Date` when the identity or credential will no longer be accepted.
*/
readonly expiration?: Date;
}
/**
* @public
*/
export interface IdentityProvider<IdentityT extends Identity> {
(identityProperties?: Record<string, any>): Promise<IdentityT>;
}
export { ApiKeyIdentity, ApiKeyIdentityProvider } from "./apiKeyIdentity";
export { AwsCredentialIdentity, AwsCredentialIdentityProvider } from "./awsCredentialIdentity";
export { Identity, IdentityProvider } from "./identity";
export { TokenIdentity, TokenIdentityProvider } from "./tokenIdentity";
import { Identity, IdentityProvider } from "../identity/identity";
/**
* @internal
*/
export interface TokenIdentity extends Identity {
/**
* The literal token string
*/
readonly token: string;
}
/**
* @internal
*/
export type TokenIdentityProvider = IdentityProvider<TokenIdentity>;
export { AbortController, AbortHandler, AbortSignal } from "./abort";
export { HttpApiKeyAuthLocation, HttpAuthLocation } from "./auth";
export { AuthScheme, ErrorHandler, HttpAuthDefinition, HttpAuthOption, HttpAuthScheme, HttpAuthSchemeId, HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, HttpSigner, IdentityProviderConfig, SelectedHttpAuthScheme, SuccessHandler, } from "./auth";
export { BlobPayloadInputTypes, BlobTypes, BrowserRuntimeBlobTypes, NodeJsRuntimeBlobTypes, } from "./blob/blob-payload-input-types";
export { Checksum, ChecksumConstructor } from "./checksum";
export { CheckOptionalClientConfig, Client, InvokeFunction, InvokeMethod, InvokeMethodOptionalArgs, } from "./client";
export { Command, CommandIO, GetOutputType } from "./command";
export { CacheKey, ConnectConfiguration, ConnectionManager, ConnectionManagerConfiguration, ConnectionPool, } from "./connection";
export { Hash, HashConstructor, SourceData, StreamHasher, randomValues } from "./crypto";
export { AvailableMessage, AvailableMessages, MessageDecoder, MessageEncoder } from "./encode";
export { EndpointURLScheme } from "./endpoint";
export { EndpointARN, EndpointObjectProperty, EndpointParameters, EndpointPartition, EndpointURL, EndpointV2, } from "./endpoint";
export { ConditionObject, DeprecatedObject, EndpointObject, EndpointObjectHeaders, EndpointObjectProperties, EndpointParams, EndpointResolverOptions, EndpointRuleObject, ErrorRuleObject, EvaluateOptions, Expression, FunctionArgv, FunctionObject, FunctionReturn, ParameterObject, ReferenceObject, ReferenceRecord, RuleSetObject, RuleSetRules, TreeRuleObject, } from "./endpoints";
export { EndpointParameterInstructions, BuiltInParamInstruction, ClientContextParamInstruction, StaticContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, } from "./endpoints/EndpointParameterInstructions";
export { BinaryHeaderValue, BooleanHeaderValue, ByteHeaderValue, EventStreamMarshaller, EventStreamMarshallerDeserFn, EventStreamMarshallerSerFn, EventStreamPayloadHandler, EventStreamPayloadHandlerProvider, EventStreamRequestSigner, EventStreamSerdeContext, EventStreamSerdeProvider, EventStreamSignerProvider, HeaderValue, Int64, IntegerHeaderValue, LongHeaderValue, Message, MessageHeaderValue, MessageHeaders, ShortHeaderValue, StringHeaderValue, TimestampHeaderValue, UuidHeaderValue, } from "./eventStream";
export { AlgorithmId, getDefaultClientConfiguration, resolveDefaultRuntimeConfig } from "./extensions";
export { ChecksumAlgorithm, ChecksumConfiguration, DefaultClientConfiguration, DefaultExtensionConfiguration, RetryStrategyConfiguration, } from "./extensions";
export { SmithyFeatures } from "./feature-ids";
export { FieldPosition } from "./http";
export { Endpoint, FieldOptions, HeaderBag, HttpHandlerOptions, HttpMessage, HttpRequest, HttpResponse, QueryParameterBag, } from "./http";
export { FetchHttpHandlerOptions, NodeHttpHandlerOptions, RequestHandlerParams, } from "./http/httpHandlerInitialization";
export { ApiKeyIdentity, ApiKeyIdentityProvider, AwsCredentialIdentity, AwsCredentialIdentityProvider, Identity, IdentityProvider, TokenIdentity, TokenIdentityProvider, } from "./identity";
export { Logger } from "./logger";
export { SMITHY_CONTEXT_KEY } from "./middleware";
export { AbsoluteLocation, BuildHandler, BuildHandlerArguments, BuildHandlerOptions, BuildHandlerOutput, BuildMiddleware, DeserializeHandler, DeserializeHandlerArguments, DeserializeHandlerOptions, DeserializeHandlerOutput, DeserializeMiddleware, FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput, FinalizeRequestHandlerOptions, FinalizeRequestMiddleware, Handler, HandlerExecutionContext, HandlerOptions, InitializeHandler, InitializeHandlerArguments, InitializeHandlerOptions, InitializeHandlerOutput, InitializeMiddleware, MiddlewareStack, MiddlewareType, Pluggable, Priority, Relation, RelativeLocation, RelativeMiddlewareOptions, SerializeHandler, SerializeHandlerArguments, SerializeHandlerOptions, SerializeHandlerOutput, SerializeMiddleware, Step, Terminalware, } from "./middleware";
export { PaginationConfiguration, Paginator } from "./pagination";
export { IniSectionType } from "./profile";
export { IniSection, ParsedIniData, Profile, SharedConfigFiles } from "./profile";
export { MetadataBearer, ResponseMetadata } from "./response";
export { ExponentialBackoffJitterType, ExponentialBackoffStrategyOptions, RetryBackoffStrategy, RetryErrorInfo, RetryErrorType, RetryStrategyOptions, RetryStrategyV2, RetryToken, StandardRetryBackoffStrategy, StandardRetryToken, } from "./retry";
export { $ClientProtocol, $ClientProtocolCtor, $Codec, $MemberSchema, $OperationSchema, $Schema, $SchemaRef, $ShapeDeserializer, $ShapeSerializer, BlobSchemas, CodecSettings, ConfigurableSerdeContext, NormalizedSchema, SchemaTraits, SchemaTraitsObject, SimpleSchema, TimestampSchemas, UnitSchema, } from "./schema/schema";
export { HttpLabelBitMask, HttpPayloadBitMask, HttpQueryParamsBitMask, HttpResponseCodeBitMask, IdempotencyTokenBitMask, IdempotentBitMask, SensitiveBitMask, TraitBitVector, } from "./schema/traits";
export { ClientProtocol, ClientProtocolCtor, Codec, ListSchema, MapSchema, MemberSchema, OperationSchema, Schema, SchemaRef, ShapeDeserializer, ShapeSerializer, StructureSchema, TraitsSchema, } from "./schema/schema-deprecated";
export { BigDecimalSchema, BigIntegerSchema, BlobSchema, BooleanSchema, DocumentSchema, ListSchemaModifier, MapSchemaModifier, NumericSchema, StreamingBlobSchema, StringSchema, TimestampDateTimeSchema, TimestampDefaultSchema, TimestampEpochSecondsSchema, TimestampHttpDateSchema, } from "./schema/sentinels";
export { ShapeName, ShapeNamespace, StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticSchema, StaticSchemaIdError, StaticSchemaIdList, StaticSchemaIdMap, StaticSchemaIdOperation, StaticSchemaIdSimple, StaticSchemaIdStruct, StaticSchemaIdUnion, StaticSimpleSchema, StaticStructureSchema, StaticUnionSchema, } from "./schema/static-schemas";
export { EndpointBearer, RequestSerializer, ResponseDeserializer, SdkStream, SdkStreamMixin, SdkStreamMixinInjector, SdkStreamSerdeContext, SerdeContext, SerdeFunctions, StreamCollector, WithSdkStreamMixin, } from "./serde";
export { DocumentType, RetryableTrait, SdkError, SmithyException } from "./shapes";
export { DateInput, EventSigner, EventSigningArguments, EventStreamRequestScopedCredentials, FormattedEvent, MessageSigner, MessageSigningArguments, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments, SignableMessage, SignedMessage, SigningArguments, StringSigner, } from "./signature";
export { GetAwsChunkedEncodingStream, GetAwsChunkedEncodingStreamOptions } from "./stream";
export { BrowserRuntimeStreamingBlobTypes, NodeJsRuntimeStreamingBlobTypes, StreamingBlobTypes, } from "./streaming-payload/streaming-blob-common-types";
export { BrowserRuntimeStreamingBlobPayloadInputTypes, NodeJsRuntimeStreamingBlobPayloadInputTypes, StreamingBlobPayloadInputTypes, } from "./streaming-payload/streaming-blob-payload-input-types";
export { BrowserRuntimeStreamingBlobPayloadOutputTypes, NodeJsRuntimeStreamingBlobPayloadOutputTypes, StreamingBlobPayloadOutputTypes, } from "./streaming-payload/streaming-blob-payload-output-types";
export { RequestHandlerProtocol } from "./transfer";
export { RequestContext, RequestHandler, RequestHandlerMetadata, RequestHandlerOutput } from "./transfer";
export { BrowserClient, BrowserXhrClient, NarrowPayloadBlobOutputType, NarrowPayloadBlobTypes, NodeJsClient, NodeJsHttp2Client, } from "./transform/client-payload-blob-type-narrow";
export { Mutable } from "./transform/mutable";
export { AssertiveClient, NoUndefined, RecursiveRequired, UncheckedClient } from "./transform/no-undefined";
export { Transform } from "./transform/type-transform";
export { URI } from "./uri";
export { BodyLengthCalculator, Decoder, Encoder, Exact, MemoizedProvider, OptionalParameter, Provider, RegionInfo, RegionInfoProvider, RegionInfoProviderOptions, RetryStrategy, UrlParser, UserAgent, UserAgentPair, } from "./util";
export { WaiterConfiguration } from "./waiter";
export { MetricsRecorder, MetricsRecorderFactory, MetricUnit, RequestOutcome } from "./metrics";
/**
* Represents a logger object that is available in HandlerExecutionContext
* throughout the middleware stack.
*
* @public
*/
export interface Logger {
trace?: (...content: any[]) => void;
debug: (...content: any[]) => void;
info: (...content: any[]) => void;
warn: (...content: any[]) => void;
error: (...content: any[]) => void;
}
/**
* Outcome of a request, recorded by the framework via {@link MetricsRecorder.recordRequestOutcome}.
*
* @public
*/
export type RequestOutcome = "Success" | "Fault";
/**
* Unit attached to a recorded metric value. The vocabulary follows the
* CloudWatch unit names so backends that emit to CloudWatch can pass it
* through, but it carries no backend-specific semantics — a recorder is free
* to map or ignore it.
*
* @public
*/
export type MetricUnit = "Seconds" | "Microseconds" | "Milliseconds" | "Bytes" | "Kilobytes" | "Megabytes" | "Gigabytes" | "Terabytes" | "Bits" | "Kilobits" | "Megabits" | "Gigabits" | "Terabits" | "Percent" | "Count" | "None" | "Bytes/Second" | "Kilobytes/Second" | "Megabytes/Second" | "Gigabytes/Second" | "Terabytes/Second" | "Bits/Second" | "Kilobits/Second" | "Megabits/Second" | "Gigabits/Second" | "Terabits/Second" | "Count/Second";
/**
* Backend-agnostic recorder for per-request metrics. The framework drives the
* lifecycle and records request-level metrics through this interface; user
* handlers record their own business metrics through the same methods. Concrete
* recorders (e.g. an EMF recorder, or a future OpenTelemetry recorder) translate
* these abstract calls into their own primitives.
*
* @typeParam Native - the concrete backend handle returned by
* {@link MetricsRecorder.getMetrics}, e.g. an OpenTelemetry `Meter`. The
* parameter is required so that native access is always typed rather than
* erased to `unknown`.
*
* @public
*/
export interface MetricsRecorder<Native> {
/**
* Open the recorder for the current request. Called by the framework once at
* the start of request handling.
*/
begin(): void;
/**
* Close the recorder for the current request. Called by the framework once at
* the end of request handling; this is where an implementation typically
* flushes its event.
*/
end(): void;
/**
* Records the outcome and duration of a request. The concrete backend decides
* how to express this.
*/
recordRequestOutcome(outcome: RequestOutcome, durationMs: number): void;
/**
* Records a count. Values should be non-negative for cross-backend portability.
*/
addCount(name: string, value: number): void;
/**
* Records a duration in milliseconds.
*/
addTime(name: string, value: number): void;
/**
* Records a level — a sampled value that should average meaningfully across
* calls (e.g. queue depth, batch size).
*/
addLevel(name: string, value: number, unit?: MetricUnit): void;
/**
* Records a discrete data point where percentiles matter (e.g. per-call
* latency, item size).
*/
addMetric(name: string, value: number, unit?: MetricUnit): void;
/**
* Records a unitless ratio (e.g. cache hit rate, throttle rate).
*/
addRatio(name: string, value: number): void;
/**
* Attaches a property to the request's metrics. A nullish or empty value
* removes the property.
*/
setProperty(name: string, value: string | null | undefined): void;
/**
* Returns the recorder's native backend handle, so callers can reach
* library-specific features the abstract methods do not expose (e.g. an
* OpenTelemetry `Meter`).
*/
getMetrics(): Native;
}
/**
* Creates a per-request {@link MetricsRecorder}. Created once at startup and
* passed to the service handler; the framework calls {@link MetricsRecorderFactory.create}
* once per request to obtain a scoped recorder.
*
* @typeParam Native - the native backend handle exposed by recorders this
* factory produces. See {@link MetricsRecorder}.
*
* @public
*/
export interface MetricsRecorderFactory<Native> {
create(): MetricsRecorder<Native>;
}
import { SelectedHttpAuthScheme } from "./auth/HttpAuthScheme";
import { AuthScheme, HttpAuthDefinition } from "./auth/auth";
import { Command } from "./command";
import { EndpointV2 } from "./endpoint";
import { SmithyFeatures } from "./feature-ids";
import { Logger } from "./logger";
import { UserAgent } from "./util";
/**
* @public
*/
export interface InitializeHandlerArguments<Input extends object> {
/**
* User input to a command. Reflects the userland representation of the
* union of data types the command can effectively handle.
*/
input: Input;
}
/**
* @public
*/
export interface InitializeHandlerOutput<Output extends object> extends DeserializeHandlerOutput<Output> {
output: Output;
}
/**
* @public
*/
export interface SerializeHandlerArguments<Input extends object> extends InitializeHandlerArguments<Input> {
/**
* The user input serialized as a request object. The request object is unknown,
* so you cannot modify it directly. When work with request, you need to guard its
* type to e.g. HttpRequest with 'instanceof' operand
*
* During the build phase of the execution of a middleware stack, a built
* request may or may not be available.
*/
request?: unknown;
}
/**
* @public
*/
export interface SerializeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
}
/**
* @public
*/
export interface BuildHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
}
/**
* @public
*/
export interface BuildHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
}
/**
* @public
*/
export interface FinalizeHandlerArguments<Input extends object> extends SerializeHandlerArguments<Input> {
/**
* The user input serialized as a request.
*/
request: unknown;
}
/**
* @public
*/
export interface FinalizeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
}
/**
* @public
*/
export interface DeserializeHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
}
/**
* @public
*/
export interface DeserializeHandlerOutput<Output extends object> {
/**
* The raw response object from runtime is deserialized to structured output object.
* The response object is unknown so you cannot modify it directly. When work with
* response, you need to guard its type to e.g. HttpResponse with 'instanceof' operand.
*
* During the deserialize phase of the execution of a middleware stack, a deserialized
* response may or may not be available
*/
response: unknown;
output?: Output;
}
/**
* @public
*/
export interface InitializeHandler<Input extends object, Output extends object> {
/**
* Asynchronously converts an input object into an output object.
*
* @param args - An object containing a input to the command as well as any
* associated or previously generated execution artifacts.
*/
(args: InitializeHandlerArguments<Input>): Promise<InitializeHandlerOutput<Output>>;
}
/**
* @public
*/
export type Handler<Input extends object, Output extends object> = InitializeHandler<Input, Output>;
/**
* @public
*/
export interface SerializeHandler<Input extends object, Output extends object> {
/**
* Asynchronously converts an input object into an output object.
*
* @param args - An object containing a input to the command as well as any
* associated or previously generated execution artifacts.
*/
(args: SerializeHandlerArguments<Input>): Promise<SerializeHandlerOutput<Output>>;
}
/**
* @public
*/
export interface FinalizeHandler<Input extends object, Output extends object> {
/**
* Asynchronously converts an input object into an output object.
*
* @param args - An object containing a input to the command as well as any
* associated or previously generated execution artifacts.
*/
(args: FinalizeHandlerArguments<Input>): Promise<FinalizeHandlerOutput<Output>>;
}
/**
* @public
*/
export interface BuildHandler<Input extends object, Output extends object> {
(args: BuildHandlerArguments<Input>): Promise<BuildHandlerOutput<Output>>;
}
/**
* @public
*/
export interface DeserializeHandler<Input extends object, Output extends object> {
(args: DeserializeHandlerArguments<Input>): Promise<DeserializeHandlerOutput<Output>>;
}
/**
* A factory function that creates functions implementing the `Handler`
* interface.
*
* @public
*/
export interface InitializeMiddleware<Input extends object, Output extends object> {
/**
* @param next - The handler to invoke after this middleware has operated on
* the user input and before this middleware operates on the output.
*
* @param context - Invariant data and functions for use by the handler.
*/
(next: InitializeHandler<Input, Output>, context: HandlerExecutionContext): InitializeHandler<Input, Output>;
}
/**
* A factory function that creates functions implementing the `BuildHandler`
* interface.
*
* @public
*/
export interface SerializeMiddleware<Input extends object, Output extends object> {
/**
* @param next - The handler to invoke after this middleware has operated on
* the user input and before this middleware operates on the output.
*
* @param context - Invariant data and functions for use by the handler.
*/
(next: SerializeHandler<Input, Output>, context: HandlerExecutionContext): SerializeHandler<Input, Output>;
}
/**
* A factory function that creates functions implementing the `FinalizeHandler`
* interface.
*
* @public
*/
export interface FinalizeRequestMiddleware<Input extends object, Output extends object> {
/**
* @param next - The handler to invoke after this middleware has operated on
* the user input and before this middleware operates on the output.
*
* @param context - Invariant data and functions for use by the handler.
*/
(next: FinalizeHandler<Input, Output>, context: HandlerExecutionContext): FinalizeHandler<Input, Output>;
}
/**
* @public
*/
export interface BuildMiddleware<Input extends object, Output extends object> {
(next: BuildHandler<Input, Output>, context: HandlerExecutionContext): BuildHandler<Input, Output>;
}
/**
* @public
*/
export interface DeserializeMiddleware<Input extends object, Output extends object> {
(next: DeserializeHandler<Input, Output>, context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
}
/**
* @public
*/
export type MiddlewareType<Input extends object, Output extends object> = InitializeMiddleware<Input, Output> | SerializeMiddleware<Input, Output> | BuildMiddleware<Input, Output> | FinalizeRequestMiddleware<Input, Output> | DeserializeMiddleware<Input, Output>;
/**
* A factory function that creates the terminal handler atop which a middleware
* stack sits.
*
* @public
*/
export interface Terminalware {
<Input extends object, Output extends object>(context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
}
/**
* @public
*/
export type Step = "initialize" | "serialize" | "build" | "finalizeRequest" | "deserialize";
/**
* @public
*/
export type Priority = "high" | "normal" | "low";
/**
* @public
*/
export interface HandlerOptions {
/**
* Handlers are ordered using a "step" that describes the stage of command
* execution at which the handler will be executed. The available steps are:
*
* - initialize: The input is being prepared. Examples of typical
* initialization tasks include injecting default options computing
* derived parameters.
* - serialize: The input is complete and ready to be serialized. Examples
* of typical serialization tasks include input validation and building
* an HTTP request from user input.
* - build: The input has been serialized into an HTTP request, but that
* request may require further modification. Any request alterations
* will be applied to all retries. Examples of typical build tasks
* include injecting HTTP headers that describe a stable aspect of the
* request, such as `Content-Length` or a body checksum.
* - finalizeRequest: The request is being prepared to be sent over the wire. The
* request in this stage should already be semantically complete and
* should therefore only be altered as match the recipient's
* expectations. Examples of typical finalization tasks include request
* signing and injecting hop-by-hop headers.
* - deserialize: The response has arrived, the middleware here will deserialize
* the raw response object to structured response
*
* Unlike initialization and build handlers, which are executed once
* per operation execution, finalization and deserialize handlers will be
* executed foreach HTTP request sent.
*
* @defaultValue 'initialize'
*/
step?: Step;
/**
* A list of strings to any that identify the general purpose or important
* characteristics of a given handler.
*/
tags?: Array<string>;
/**
* A unique name to refer to a middleware
*/
name?: string;
/**
* Aliases allows for middleware to be found by multiple names besides {@link HandlerOptions.name}.
* This allows for references to replaced middleware to continue working, e.g. replacing
* multiple auth-specific middleware with a single generic auth middleware.
*
* @internal
*/
aliases?: Array<string>;
/**
* A flag to override the existing middleware with the same name. Without
* setting it, adding middleware with duplicated name will throw an exception.
* @internal
*/
override?: boolean;
}
/**
* @public
*/
export interface AbsoluteLocation {
/**
* By default middleware will be added to individual step in un-guaranteed order.
* In the case that
*
* @defaultValue 'normal'
*/
priority?: Priority;
}
/**
* @public
*/
export type Relation = "before" | "after";
/**
* @public
*/
export interface RelativeLocation {
/**
* Specify the relation to be before or after a know middleware.
*/
relation: Relation;
/**
* A known middleware name to indicate inserting middleware's location.
*/
toMiddleware: string;
}
/**
* @public
*/
export type RelativeMiddlewareOptions = RelativeLocation & Pick<HandlerOptions, Exclude<keyof HandlerOptions, "step">>;
/**
* @public
*/
export interface InitializeHandlerOptions extends HandlerOptions {
step?: "initialize";
}
/**
* @public
*/
export interface SerializeHandlerOptions extends HandlerOptions {
step: "serialize";
}
/**
* @public
*/
export interface BuildHandlerOptions extends HandlerOptions {
step: "build";
}
/**
* @public
*/
export interface FinalizeRequestHandlerOptions extends HandlerOptions {
step: "finalizeRequest";
}
/**
* @public
*/
export interface DeserializeHandlerOptions extends HandlerOptions {
step: "deserialize";
}
/**
* A stack storing middleware. It can be resolved into a handler. It supports 2
* approaches for adding middleware:
* 1. Adding middleware to specific step with `add()`. The order of middleware
* added into same step is determined by order of adding them. If one middleware
* needs to be executed at the front of the step or at the end of step, set
* `priority` options to `high` or `low`.
* 2. Adding middleware to location relative to known middleware with `addRelativeTo()`.
* This is useful when given middleware must be executed before or after specific
* middleware(`toMiddleware`). You can add a middleware relatively to another
* middleware which also added relatively. But eventually, this relative middleware
* chain **must** be 'anchored' by a middleware that added using `add()` API
* with absolute `step` and `priority`. This mothod will throw if specified
* `toMiddleware` is not found.
*
* @public
*/
export interface MiddlewareStack<Input extends object, Output extends object> extends Pluggable<Input, Output> {
/**
* Add middleware to the stack to be executed during the "initialize" step,
* optionally specifying a priority, tags and name
*/
add(middleware: InitializeMiddleware<Input, Output>, options?: InitializeHandlerOptions & AbsoluteLocation): void;
/**
* Add middleware to the stack to be executed during the "serialize" step,
* optionally specifying a priority, tags and name
*/
add(middleware: SerializeMiddleware<Input, Output>, options: SerializeHandlerOptions & AbsoluteLocation): void;
/**
* Add middleware to the stack to be executed during the "build" step,
* optionally specifying a priority, tags and name
*/
add(middleware: BuildMiddleware<Input, Output>, options: BuildHandlerOptions & AbsoluteLocation): void;
/**
* Add middleware to the stack to be executed during the "finalizeRequest" step,
* optionally specifying a priority, tags and name
*/
add(middleware: FinalizeRequestMiddleware<Input, Output>, options: FinalizeRequestHandlerOptions & AbsoluteLocation): void;
/**
* Add middleware to the stack to be executed during the "deserialize" step,
* optionally specifying a priority, tags and name
*/
add(middleware: DeserializeMiddleware<Input, Output>, options: DeserializeHandlerOptions & AbsoluteLocation): void;
/**
* Add middleware to a stack position before or after a known middleware,optionally
* specifying name and tags.
*/
addRelativeTo(middleware: MiddlewareType<Input, Output>, options: RelativeMiddlewareOptions): void;
/**
* Apply a customization function to mutate the middleware stack, often
* used for customizations that requires mutating multiple middleware.
*/
use(pluggable: Pluggable<Input, Output>): void;
/**
* Create a shallow clone of this stack. Step bindings and handler priorities
* and tags are preserved in the copy.
*/
clone(): MiddlewareStack<Input, Output>;
/**
* Removes middleware from the stack.
*
* If a string is provided, it will be treated as middleware name. If a middleware
* is inserted with the given name, it will be removed.
*
* If a middleware class is provided, all usages thereof will be removed.
*/
remove(toRemove: MiddlewareType<Input, Output> | string): boolean;
/**
* Removes middleware that contains given tag
*
* Multiple middleware will potentially be removed
*/
removeByTag(toRemove: string): boolean;
/**
* Create a stack containing the middlewares in this stack as well as the
* middlewares in the `from` stack. Neither source is modified, and step
* bindings and handler priorities and tags are preserved in the copy.
*/
concat<InputType extends Input, OutputType extends Output>(from: MiddlewareStack<InputType, OutputType>): MiddlewareStack<InputType, OutputType>;
/**
* Returns a list of the current order of middleware in the stack.
* This does not execute the middleware functions, nor does it
* provide a reference to the stack itself.
*/
identify(): string[];
/**
* When an operation is called using this stack,
* it will log its list of middleware to the console using
* the identify function.
* If no argument given, returns the current value.
*
* @internal
* @param toggle - set whether to log on resolve.
*/
identifyOnResolve(toggle?: boolean): boolean;
/**
* Builds a single handler function from zero or more middleware classes and
* a core handler. The core handler is meant to send command objects to AWS
* services and return promises that will resolve with the operation result
* or be rejected with an error.
*
* When a composed handler is invoked, the arguments will pass through all
* middleware in a defined order, and the return from the innermost handler
* will pass through all middleware in the reverse of that order.
*/
resolve<InputType extends Input, OutputType extends Output>(handler: DeserializeHandler<InputType, OutputType>, context: HandlerExecutionContext): InitializeHandler<InputType, OutputType>;
}
/**
* @internal
*/
export declare const SMITHY_CONTEXT_KEY = "__smithy_context";
/**
* Data and helper objects that are not expected to change from one execution of
* a composed handler to another.
*
* @public
*/
export interface HandlerExecutionContext {
/**
* A logger that may be invoked by any handler during execution of an
* operation.
*/
logger?: Logger;
/**
* Name of the service the operation is being sent to.
*/
clientName?: string;
/**
* Name of the operation being executed.
*/
commandName?: string;
/**
* Additional user agent that inferred by middleware. It can be used to save
* the internal user agent sections without overriding the `customUserAgent`
* config in clients.
*/
userAgent?: UserAgent;
/**
* Resolved by the endpointMiddleware function of `@smithy/middleware-endpoint`
* in the serialization stage.
*/
endpointV2?: EndpointV2;
/**
* Set at the same time as endpointV2.
*/
authSchemes?: AuthScheme[];
/**
* The current auth configuration that has been set by any auth middleware and
* that will prevent from being set more than once.
*/
currentAuthConfig?: HttpAuthDefinition;
/**
* @deprecated do not extend this field, it is a carryover from AWS SDKs.
* Used by DynamoDbDocumentClient.
*/
dynamoDbDocumentClientOptions?: Partial<{
overrideInputFilterSensitiveLog(...args: any[]): string | void;
overrideOutputFilterSensitiveLog(...args: any[]): string | void;
}>;
/**
* Context for Smithy properties.
*
* @internal
*/
[SMITHY_CONTEXT_KEY]?: {
service?: string;
operation?: string;
commandInstance?: Command<any, any, any, any, any>;
selectedHttpAuthScheme?: SelectedHttpAuthScheme;
features?: SmithyFeatures;
/**
* @deprecated
* Do not assign arbitrary members to the Smithy Context,
* fields should be explicitly declared here to avoid collisions.
*/
[key: string]: unknown;
};
/**
* Set by some operations which instructs the retry behavior to backoff
* after a failed request even when no further retry (of the same request) is expected.
* @internal
*/
__retryLongPoll?: boolean;
/**
* @deprecated
* Do not assign arbitrary members to the context, since
* they can interfere with existing functionality.
*
* Additional members should instead be declared on the SMITHY_CONTEXT_KEY
* or other reserved keys.
*/
[key: string]: any;
}
/**
* @public
*/
export interface Pluggable<Input extends object, Output extends object> {
/**
* A function that mutate the passed in middleware stack. Functions implementing
* this interface can add, remove, modify existing middleware stack from clients
* or commands
*/
applyToStack: (stack: MiddlewareStack<Input, Output>) => void;
}
import { Client } from "./client";
import { Command } from "./command";
/**
* Expected type definition of a paginator.
*
* @public
*/
export type Paginator<T> = AsyncGenerator<T, undefined, unknown>;
/**
* Expected paginator configuration passed to an operation. Services will extend
* this interface definition and may type client further.
*
* @public
*/
export interface PaginationConfiguration {
client: Client<any, any, any>;
pageSize?: number;
startingToken?: any;
/**
* For some APIs, such as CloudWatchLogs events, the next page token will always
* be present.
*
* When true, this config field will have the paginator stop when the token doesn't change
* instead of when it is not present.
*/
stopOnSameToken?: boolean;
/**
* @param command - reference to the instantiated command. This callback is executed
* prior to sending the command with the paginator's client.
* @returns the original command or a replacement, defaulting to the original command object.
*/
withCommand?: (command: Command<any, any, any, any, any>) => typeof command | undefined;
}
/**
* @public
*/
export declare enum IniSectionType {
PROFILE = "profile",
SSO_SESSION = "sso-session",
SERVICES = "services"
}
/**
* @public
*/
export type IniSection = Record<string, string | undefined>;
/**
* @public
*
* @deprecated Please use {@link IniSection}
*/
export interface Profile extends IniSection {
}
/**
* @public
*/
export type ParsedIniData = Record<string, IniSection>;
/**
* @public
*/
export interface SharedConfigFiles {
credentialsFile: ParsedIniData;
configFile: ParsedIniData;
}
/**
* @public
*/
export interface ResponseMetadata {
/**
* The status code of the last HTTP response received for this operation.
*/
httpStatusCode?: number;
/**
* A unique identifier for the last request sent for this operation. Often
* requested by AWS service teams to aid in debugging.
*/
requestId?: string;
/**
* A secondary identifier for the last request sent. Used for debugging.
*/
extendedRequestId?: string;
/**
* A tertiary identifier for the last request sent. Used for debugging.
*/
cfId?: string;
/**
* The number of times this operation was attempted.
*/
attempts?: number;
/**
* The total amount of time (in milliseconds) that was spent waiting between
* retry attempts.
*/
totalRetryDelay?: number;
}
/**
* @public
*/
export interface MetadataBearer {
/**
* Metadata pertaining to this request.
*/
$metadata: ResponseMetadata;
}
import { SdkError } from "./shapes";
/**
* @public
*/
export type RetryErrorType =
/**
* This is a connection level error such as a socket timeout, socket connect
* error, tls negotiation timeout etc...
* Typically these should never be applied for non-idempotent request types
* since in this scenario, it's impossible to know whether the operation had
* a side effect on the server.
*/
"TRANSIENT"
/**
* This is an error where the server explicitly told the client to back off,
* such as a 429 or 503 Http error.
*/
| "THROTTLING"
/**
* This is a server error that isn't explicitly throttling but is considered
* by the client to be something that should be retried.
*/
| "SERVER_ERROR"
/**
* Doesn't count against any budgets. This could be something like a 401
* challenge in Http.
*/
| "CLIENT_ERROR";
/**
* @public
*/
export interface RetryErrorInfo {
/**
* The error thrown during the initial request, if available.
*/
error?: SdkError;
errorType: RetryErrorType;
/**
* Protocol hint. This could come from Http's 'retry-after' header or
* something from MQTT or any other protocol that has the ability to convey
* retry info from a peer.
*
* The Date after which a retry should be attempted.
*/
retryAfterHint?: Date;
}
/**
* @public
*/
export interface RetryBackoffStrategy {
/**
* @returns the number of milliseconds to wait before retrying an action.
*/
computeNextBackoffDelay(retryAttempt: number): number;
}
/**
* @public
*/
export interface StandardRetryBackoffStrategy extends RetryBackoffStrategy {
/**
* Sets the delayBase used to compute backoff delays.
* @param delayBase -
*/
setDelayBase(delayBase: number): void;
}
/**
* @public
*/
export interface RetryStrategyOptions {
backoffStrategy: RetryBackoffStrategy;
maxRetriesBase: number;
}
/**
* @public
*/
export interface RetryToken {
/**
* Starts at 0 for the initial request, which is not a "retry" by definition.
* 1 indicates the first retry.
*
* @returns the current count of retry.
*/
getRetryCount(): number;
/**
* RetryStrategies implemented by `@smithy/core` will return tokens with a
* delay of zero.
*
* This is because the RetryStrategy token acquisition methods took over the
* task of idling for the delay period. If a user-implemented retry token
* contains a delay, the default Smithy retry middleware will still honor it.
*
* That is to say, you may either sleep within the RetryStrategy methods for acquiring
* the token, OR return a token with a retry delay that will cause the retry middleware
* to sleep.
*
* @returns the number of milliseconds to wait before retrying an action.
*/
getRetryDelay(): number;
/**
* @returns whether the operation which generated this token is long polling.
*/
isLongPoll?(): boolean;
/**
* Delays that have already been executed by the time the token
* is accessible. This is needed for the token handler to understand what has happened.
* @internal
*/
$retryLog?: {
acquisitionDelay?: number;
};
}
/**
* @public
*/
export interface StandardRetryToken extends RetryToken {
/**
* @returns the cost of the last retry attempt.
*/
getRetryCost(): number | undefined;
}
/**
* @public
*/
export interface RetryStrategyV2 {
/**
* Called before any retries (for the first call to the operation). It either
* returns a retry token or an error upon the failure to acquire a token prior.
*
* tokenScope is arbitrary and out of scope for this component. However,
* adding it here offers us a lot of future flexibility for outage detection.
* For example, it could be "us-east-1" on a shared retry strategy, or
* "us-west-2-c:dynamodb".
*/
acquireInitialRetryToken(retryTokenScope: string): Promise<RetryToken>;
/**
* After a failed operation call, this function is invoked to refresh the
* retryToken returned by acquireInitialRetryToken(). This function can
* either choose to allow another retry and send a new or updated token,
* or reject the retry attempt and report the error either in an exception
* or returning an error.
*
* This method should either delay internally and return a token with 0 delay, OR
* do not sleep and return a token with the desired delay duration.
*/
refreshRetryTokenForRetry(tokenToRenew: RetryToken, errorInfo: RetryErrorInfo): Promise<RetryToken>;
/**
* Upon successful completion of the operation, this function is called
* to record that the operation was successful.
*/
recordSuccess(token: RetryToken): void;
}
/**
* @public
*/
export type ExponentialBackoffJitterType = "DEFAULT" | "NONE" | "FULL" | "DECORRELATED";
/**
* @public
*/
export interface ExponentialBackoffStrategyOptions {
jitterType: ExponentialBackoffJitterType;
backoffScaleValue?: number;
}
import { EndpointV2 } from "../endpoint";
import { HandlerExecutionContext } from "../middleware";
import { MetadataBearer } from "../response";
import { EndpointBearer, SerdeFunctions } from "../serde";
import { ConfigurableSerdeContext, NormalizedSchema, SchemaTraits, SimpleSchema, UnitSchema } from "./schema";
import { StaticSchema } from "./static-schemas";
/**
* A schema is an object or value that describes how to serialize/deserialize data.
* @internal
* @deprecated use $Schema
*/
export type Schema = UnitSchema | TraitsSchema | SimpleSchema | ListSchema | MapSchema | StructureSchema | MemberSchema | OperationSchema | StaticSchema | NormalizedSchema;
/**
* A schema "reference" is either a schema or a function that
* provides a schema. This is useful for lazy loading, and to allow
* code generation to define schema out of dependency order.
* @internal
* @deprecated use $SchemaRef
*/
export type SchemaRef = Schema | (() => Schema);
/**
* A schema that has traits.
*
* @internal
* @deprecated use static schema.
*/
export interface TraitsSchema {
namespace: string;
name: string;
traits: SchemaTraits;
}
/**
* Indicates the schema is a member of a parent Structure schema.
* It may also have a set of member traits distinct from its target shape's traits.
* @internal
* @deprecated use $MemberSchema
*/
export type MemberSchema = [
SchemaRef,
SchemaTraits
];
/**
* Schema for the structure aggregate type.
* @internal
* @deprecated use static schema.
*/
export interface StructureSchema extends TraitsSchema {
memberNames: string[];
memberList: SchemaRef[];
/**
* @deprecated structure member iteration will be linear on the memberNames and memberList arrays.
* It can be collected into a hashmap form on an ad-hoc basis, but will not initialize as such.
*/
members?: Record<string, [
SchemaRef,
SchemaTraits
]> | undefined;
}
/**
* Schema for the list aggregate type.
* @internal
* @deprecated use static schema.
*/
export interface ListSchema extends TraitsSchema {
valueSchema: SchemaRef;
}
/**
* Schema for the map aggregate type.
* @internal
* @deprecated use static schema.
*/
export interface MapSchema extends TraitsSchema {
keySchema: SchemaRef;
valueSchema: SchemaRef;
}
/**
* Schema for an operation.
* @internal
* @deprecated use StaticOperationSchema or $OperationSchema
*/
export interface OperationSchema {
namespace: string;
name: string;
traits: SchemaTraits;
input: SchemaRef;
output: SchemaRef;
}
/**
* Turns a serialization into a data object.
* @internal
* @deprecated use $ShapeDeserializer
*/
export interface ShapeDeserializer<SerializationType = Uint8Array> extends ConfigurableSerdeContext {
/**
* Optionally async.
*/
read(schema: Schema, data: SerializationType): any | Promise<any>;
}
/**
* Turns a data object into a serialization.
* @internal
* @deprecated use $ShapeSerializer
*/
export interface ShapeSerializer<SerializationType = Uint8Array> extends ConfigurableSerdeContext {
write(schema: Schema, value: unknown): void;
flush(): SerializationType;
}
/**
* A codec creates serializers and deserializers for some format such as JSON, XML, or CBOR.
*
* @internal
* @deprecated use $Codec
*/
export interface Codec<S, D> extends ConfigurableSerdeContext {
createSerializer(): ShapeSerializer<S>;
createDeserializer(): ShapeDeserializer<D>;
}
/**
* A client protocol defines how to convert a message (e.g. HTTP request/response) to and from a data object.
* @internal
* @deprecated use $ClientProtocol
*/
export interface ClientProtocol<Request, Response> extends ConfigurableSerdeContext {
/**
* @returns the Smithy qualified shape id.
*/
getShapeId(): string;
getRequestType(): {
new (...args: any[]): Request;
};
getResponseType(): {
new (...args: any[]): Response;
};
/**
* @returns the payload codec if the requests/responses have a symmetric format.
* It otherwise may return null.
*/
getPayloadCodec(): Codec<any, any>;
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<Request>;
updateServiceEndpoint(request: Request, endpoint: EndpointV2): Request;
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: Response): Promise<Output>;
}
/**
* @public
* @deprecated use $ClientProtocolCtor.
*/
export interface ClientProtocolCtor<Request, Response> {
new (args: any): ClientProtocol<Request, Response>;
}
import { EndpointV2 } from "../endpoint";
import { HandlerExecutionContext } from "../middleware";
import { MetadataBearer } from "../response";
import { EndpointBearer, SerdeFunctions } from "../serde";
import { BigDecimalSchema, BigIntegerSchema, BlobSchema, BooleanSchema, DocumentSchema, NumericSchema, StreamingBlobSchema, StringSchema, TimestampDateTimeSchema, TimestampDefaultSchema, TimestampEpochSecondsSchema, TimestampHttpDateSchema } from "./sentinels";
import { StaticSchema } from "./static-schemas";
import { TraitBitVector } from "./traits";
/**
* A schema is an object or value that describes how to serialize/deserialize data.
* @public
*/
export type $Schema = UnitSchema | SimpleSchema | $MemberSchema | StaticSchema | NormalizedSchema;
/**
* Traits attached to schema objects.
*
* When this is a number, it refers to a pre-allocated
* trait combination that is equivalent to one of the
* object type's variations.
*
* @public
*/
export type SchemaTraits = TraitBitVector | SchemaTraitsObject;
/**
* Simple schemas are those corresponding to simple Smithy types.
* @see https://smithy.io/2.0/spec/simple-types.html
* @public
*/
export type SimpleSchema = BlobSchemas | StringSchema | BooleanSchema | NumericSchema | BigIntegerSchema | BigDecimalSchema | DocumentSchema | TimestampSchemas | number;
/**
* Sentinel value for Timestamp schema.
* "Default" means unspecified and to use the protocol serializer's default format.
*
* @public
*/
export type TimestampSchemas = TimestampDefaultSchema | TimestampDateTimeSchema | TimestampHttpDateSchema | TimestampEpochSecondsSchema;
/**
* Sentinel values for Blob schema.
* @public
*/
export type BlobSchemas = BlobSchema | StreamingBlobSchema;
/**
* Signal value for the Smithy void value. Typically used for
* operation input and outputs.
*
* @public
*/
export type UnitSchema = "unit";
/**
* See https://smithy.io/2.0/trait-index.html for individual definitions.
*
* @public
*/
export type SchemaTraitsObject = {
idempotent?: 1;
idempotencyToken?: 1;
sensitive?: 1;
sparse?: 1;
/**
* timestampFormat is expressed by the schema sentinel values of 4, 5, 6, and 7,
* and not contained in trait objects.
* @deprecated use schema value.
*/
timestampFormat?: never;
httpLabel?: 1;
httpHeader?: string;
httpQuery?: string;
httpPrefixHeaders?: string;
httpQueryParams?: 1;
httpPayload?: 1;
/**
* [method, path, statusCode]
*/
http?: [
string,
string,
number
];
httpResponseCode?: 1;
/**
* [hostPrefix]
*/
endpoint?: [
string
];
xmlAttribute?: 1;
xmlName?: string;
/**
* [prefix, uri]
*/
xmlNamespace?: [
string,
string
];
xmlFlattened?: 1;
jsonName?: string;
mediaType?: string;
error?: "client" | "server";
streaming?: 1;
eventHeader?: 1;
eventPayload?: 1;
[traitName: string]: unknown;
};
/**
* Indicates the schema is a member of a parent Structure schema.
* It may also have a set of member traits distinct from its target shape's traits.
* @public
*/
export type $MemberSchema = [
$SchemaRef,
SchemaTraits
];
/**
* Schema for an operation.
* @public
*/
export interface $OperationSchema {
namespace: string;
name: string;
traits: SchemaTraits;
input: $SchemaRef;
output: $SchemaRef;
}
/**
* Normalization wrapper for various schema data objects.
* @public
*/
export interface NormalizedSchema {
getSchema(): $Schema;
getName(): string | undefined;
isMemberSchema(): boolean;
isListSchema(): boolean;
isMapSchema(): boolean;
isStructSchema(): boolean;
isBlobSchema(): boolean;
isTimestampSchema(): boolean;
isStringSchema(): boolean;
isBooleanSchema(): boolean;
isNumericSchema(): boolean;
isBigIntegerSchema(): boolean;
isBigDecimalSchema(): boolean;
isStreaming(): boolean;
getMergedTraits(): SchemaTraitsObject;
getMemberTraits(): SchemaTraitsObject;
getOwnTraits(): SchemaTraitsObject;
/**
* For list/set/map.
*/
getValueSchema(): NormalizedSchema;
/**
* For struct/union.
*/
getMemberSchema(member: string): NormalizedSchema | undefined;
structIterator(): Generator<[
string,
NormalizedSchema
], undefined, undefined>;
}
/**
* A schema "reference" is either a schema or a function that
* provides a schema. This is useful for lazy loading, and to allow
* code generation to define schema out of dependency order.
* @public
*/
export type $SchemaRef = $Schema | (() => $Schema);
/**
* A codec creates serializers and deserializers for some format such as JSON, XML, or CBOR.
*
* @public
*/
export interface $Codec<S, D> extends ConfigurableSerdeContext {
createSerializer(): $ShapeSerializer<S>;
createDeserializer(): $ShapeDeserializer<D>;
}
/**
* Configuration for codecs. Different protocols may share codecs, but require different behaviors from them.
*
* @public
*/
export type CodecSettings = {
timestampFormat: {
/**
* Whether to use member timestamp format traits.
*/
useTrait: boolean;
/**
* Default timestamp format.
*/
default: TimestampDateTimeSchema | TimestampHttpDateSchema | TimestampEpochSecondsSchema;
};
/**
* Whether to use HTTP binding traits.
*/
httpBindings?: boolean;
};
/**
* Turns a serialization into a data object.
* @public
*/
export interface $ShapeDeserializer<SerializationType = Uint8Array> extends ConfigurableSerdeContext {
/**
* Optionally async.
*/
read(schema: $Schema, data: SerializationType): any | Promise<any>;
}
/**
* Turns a data object into a serialization.
* @public
*/
export interface $ShapeSerializer<SerializationType = Uint8Array> extends ConfigurableSerdeContext {
write(schema: $Schema, value: unknown): void;
flush(): SerializationType;
}
/**
* A client protocol defines how to convert a message (e.g. HTTP request/response) to and from a data object.
* @public
*/
export interface $ClientProtocol<Request, Response> extends ConfigurableSerdeContext {
/**
* @returns the Smithy qualified shape id.
*/
getShapeId(): string;
getRequestType(): {
new (...args: any[]): Request;
};
getResponseType(): {
new (...args: any[]): Response;
};
/**
* @returns the payload codec if the requests/responses have a symmetric format.
* It otherwise may return null.
*/
getPayloadCodec(): $Codec<any, any>;
serializeRequest<Input extends object>(operationSchema: $OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<Request>;
updateServiceEndpoint(request: Request, endpoint: EndpointV2): Request;
deserializeResponse<Output extends MetadataBearer>(operationSchema: $OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: Response): Promise<Output>;
}
/**
* @public
*/
export interface $ClientProtocolCtor<Request, Response> {
new (args: any): $ClientProtocol<Request, Response>;
}
/**
* Allows a protocol, codec, or serde utility to accept the serdeContext
* from a client configuration or request/response handlerExecutionContext.
*
* @public
*/
export interface ConfigurableSerdeContext {
setSerdeContext(serdeContext: SerdeFunctions): void;
}
/**
* The blob Smithy type, in JS as Uint8Array and other representations
* such as Buffer, string, or Readable(Stream) depending on circumstances.
* @public
*/
export type BlobSchema = 21;
/**
* @public
*/
export type StreamingBlobSchema = 42;
/**
* @public
*/
export type BooleanSchema = 2;
/**
* Includes string and enum Smithy types.
* @public
*/
export type StringSchema = 0;
/**
* Includes all numeric Smithy types except bigInteger and bigDecimal.
* byte, short, integer, long, float, double, intEnum.
*
* @public
*/
export type NumericSchema = 1;
/**
* @public
*/
export type BigIntegerSchema = 17;
/**
* @public
*/
export type BigDecimalSchema = 19;
/**
* @public
*/
export type DocumentSchema = 15;
/**
* Smithy type timestamp, in JS as native Date object.
* @public
*/
export type TimestampDefaultSchema = 4;
/**
* @public
*/
export type TimestampDateTimeSchema = 5;
/**
* @public
*/
export type TimestampHttpDateSchema = 6;
/**
* @public
*/
export type TimestampEpochSecondsSchema = 7;
/**
* Additional bit indicating the type is a list.
* @public
*/
export type ListSchemaModifier = 64;
/**
* Additional bit indicating the type is a map.
* @public
*/
export type MapSchemaModifier = 128;
import { $SchemaRef, SchemaTraits } from "../schema/schema";
/**
* @public
*/
export type StaticSchemaIdSimple = 0;
/**
* @public
*/
export type StaticSchemaIdList = 1;
/**
* @public
*/
export type StaticSchemaIdMap = 2;
/**
* @public
*/
export type StaticSchemaIdStruct = 3;
/**
* @public
*/
export type StaticSchemaIdUnion = 4;
/**
* @public
*/
export type StaticSchemaIdError = -3;
/**
* @public
*/
export type StaticSchemaIdOperation = 9;
/**
* @public
*/
export type StaticSchema = StaticSimpleSchema | StaticListSchema | StaticMapSchema | StaticStructureSchema | StaticUnionSchema | StaticErrorSchema | StaticOperationSchema;
/**
* @public
*/
export type ShapeName = string;
/**
* @public
*/
export type ShapeNamespace = string;
/**
* @public
*/
export type StaticSimpleSchema = [
StaticSchemaIdSimple,
ShapeNamespace,
ShapeName,
SchemaTraits,
$SchemaRef
];
/**
* @public
*/
export type StaticListSchema = [
StaticSchemaIdList,
ShapeNamespace,
ShapeName,
SchemaTraits,
$SchemaRef
];
/**
* @public
*/
export type StaticMapSchema = [
StaticSchemaIdMap,
ShapeNamespace,
ShapeName,
SchemaTraits,
$SchemaRef,
$SchemaRef
];
/**
* @public
*/
export type StaticStructureSchema = [
StaticSchemaIdStruct,
ShapeNamespace,
ShapeName,
SchemaTraits,
string[],
$SchemaRef[],
number?
];
/**
* @public
*/
export type StaticUnionSchema = [
StaticSchemaIdUnion,
ShapeNamespace,
ShapeName,
SchemaTraits,
string[],
$SchemaRef[]
];
/**
* @public
*/
export type StaticErrorSchema = [
StaticSchemaIdError,
ShapeNamespace,
ShapeName,
SchemaTraits,
string[],
$SchemaRef[],
number?
];
/**
* @public
*/
export type StaticOperationSchema = [
StaticSchemaIdOperation,
ShapeNamespace,
ShapeName,
SchemaTraits,
$SchemaRef,
$SchemaRef
];
/**
* A bitvector representing a traits object.
*
* Vector index to trait:
* 0 - httpLabel
* 1 - idempotent
* 2 - idempotencyToken
* 3 - sensitive
* 4 - httpPayload
* 5 - httpResponseCode
* 6 - httpQueryParams
*
* The singular trait values are enumerated for quick identification, but
* combination values are left to the `number` union type.
*
* @public
*/
export type TraitBitVector = HttpLabelBitMask | IdempotentBitMask | IdempotencyTokenBitMask | SensitiveBitMask | HttpPayloadBitMask | HttpResponseCodeBitMask | HttpQueryParamsBitMask | number;
/**
* @public
*/
export type HttpLabelBitMask = 1;
/**
* @public
*/
export type IdempotentBitMask = 2;
/**
* @public
*/
export type IdempotencyTokenBitMask = 4;
/**
* @public
*/
export type SensitiveBitMask = 8;
/**
* @public
*/
export type HttpPayloadBitMask = 16;
/**
* @public
*/
export type HttpResponseCodeBitMask = 32;
/**
* @public
*/
export type HttpQueryParamsBitMask = 64;
import { Endpoint } from "./http";
import { $ClientProtocol } from "./schema/schema";
import { RequestHandler } from "./transfer";
import { Decoder, Encoder, Provider } from "./util";
/**
* Interface for object requires an Endpoint set.
*
* @public
*/
export interface EndpointBearer {
endpoint: Provider<Endpoint>;
}
/**
* @public
*/
export interface StreamCollector {
/**
* A function that converts a stream into an array of bytes.
*
* @param stream - The low-level native stream from browser or Nodejs runtime
*/
(stream: any): Promise<Uint8Array>;
}
/**
* Request and Response serde util functions and settings for AWS services
*
* @public
*/
export interface SerdeContext extends SerdeFunctions, EndpointBearer {
requestHandler: RequestHandler<any, any>;
disableHostPrefix: boolean;
protocol?: $ClientProtocol<any, any>;
}
/**
* Serde functions from the client config.
*
* @public
*/
export interface SerdeFunctions {
base64Encoder: Encoder;
base64Decoder: Decoder;
utf8Encoder: Encoder;
utf8Decoder: Decoder;
streamCollector: StreamCollector;
}
/**
* @public
*/
export interface RequestSerializer<Request, Context extends EndpointBearer = any> {
/**
* Converts the provided `input` into a request object
*
* @param input - The user input to serialize.
*
* @param context - Context containing runtime-specific util functions.
*/
(input: any, context: Context): Promise<Request>;
}
/**
* @public
*/
export interface ResponseDeserializer<OutputType, ResponseType = any, Context = any> {
/**
* Converts the output of an operation into JavaScript types.
*
* @param output - The HTTP response received from the service
*
* @param context - context containing runtime-specific util functions.
*/
(output: ResponseType, context: Context): Promise<OutputType>;
}
/**
* The interface contains mix-in utility functions to transfer the runtime-specific
* stream implementation to specified format. Each stream can ONLY be transformed
* once.
* @public
*/
export interface SdkStreamMixin {
transformToByteArray: () => Promise<Uint8Array>;
transformToString: (encoding?: string) => Promise<string>;
transformToWebStream: () => ReadableStream;
}
/**
* The type describing a runtime-specific stream implementation with mix-in
* utility functions.
*
* @public
*/
export type SdkStream<BaseStream> = BaseStream & SdkStreamMixin;
/**
* Indicates that the member of type T with
* key StreamKey have been extended
* with the SdkStreamMixin helper methods.
*
* @public
*/
export type WithSdkStreamMixin<T, StreamKey extends keyof T> = {
[key in keyof T]: key extends StreamKey ? SdkStream<T[StreamKey]> : T[key];
};
/**
* Interface for internal function to inject stream utility functions
* implementation
*
* @internal
*/
export interface SdkStreamMixinInjector {
(stream: unknown): SdkStreamMixin;
}
/**
* @internal
*/
export interface SdkStreamSerdeContext {
sdkStreamMixin: SdkStreamMixinInjector;
}
import { HttpResponse } from "./http";
import { MetadataBearer } from "./response";
/**
* A document type represents an untyped JSON-like value.
* Not all protocols support document types, and the serialization format of a
* document type is protocol specific. All JSON protocols SHOULD support
* document types and they SHOULD serialize document types inline as normal
* JSON values.
*
* @public
*/
export type DocumentType = null | boolean | number | string | DocumentType[] | {
[prop: string]: DocumentType;
};
/**
* A structure shape with the error trait.
* https://smithy.io/2.0/spec/behavior-traits.html#smithy-api-retryable-trait
*
* @public
*/
export interface RetryableTrait {
/**
* Indicates that the error is a retryable throttling error.
*/
readonly throttling?: boolean;
}
/**
* Type that is implemented by all Smithy shapes marked with the
* error trait.
*
* @public
* @deprecated
*/
export interface SmithyException {
/**
* The shape ID name of the exception.
*/
readonly name: string;
/**
* Whether the client or server are at fault.
*/
readonly $fault: "client" | "server";
/**
* The service that encountered the exception.
*/
readonly $service?: string;
/**
* Indicates that an error MAY be retried by the client.
*/
readonly $retryable?: RetryableTrait;
/**
* Reference to low-level HTTP response object.
*/
readonly $response?: HttpResponse;
}
/**
* This type should not be used in your application.
* Users of the AWS SDK for JavaScript v3 service clients should prefer to
* use the specific Exception classes corresponding to each operation.
* These can be found as code in the deserializer for the operation's Command class,
* or as declarations in the service model file in codegen/sdk-codegen/aws-models.
* If no exceptions are enumerated by a particular Command operation,
* the base exception for the service should be used. Each client exports
* a base ServiceException prefixed with the service name.
*
* @public
* @deprecated See {@link https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/}
*/
export type SdkError = Error & Partial<SmithyException> & Partial<MetadataBearer> & {
$metadata?: Partial<MetadataBearer>["$metadata"] & {
/**
* If present, will have value of true and indicates that the error resulted in a
* correction of the clock skew, a.k.a. config.systemClockOffset.
* This is specific to AWS SDK and sigv4.
*/
readonly clockSkewCorrected?: true;
};
cause?: Error;
};
import { Message } from "./eventStream";
import { HttpRequest } from "./http";
import { AwsCredentialIdentity } from "./identity/awsCredentialIdentity";
/**
* A `Date` object, a unix (epoch) timestamp in seconds, or a string that can be
* understood by the JavaScript `Date` constructor.
*
* @public
*/
export type DateInput = number | string | Date;
/**
* @public
*/
export interface SigningArguments {
/**
* The date and time to be used as signature metadata. This value should be
* a Date object, a unix (epoch) timestamp, or a string that can be
* understood by the JavaScript `Date` constructor.If not supplied, the
* value returned by `new Date()` will be used.
*/
signingDate?: DateInput;
/**
* The service signing name. It will override the service name of the signer
* in current invocation
*/
signingService?: string;
/**
* The region name to sign the request. It will override the signing region of the
* signer in current invocation
*/
signingRegion?: string;
}
/**
* @public
*/
export interface RequestSigningArguments extends SigningArguments {
/**
* A set of strings whose members represents headers that cannot be signed.
* All headers in the provided request will have their names converted to
* lower case and then checked for existence in the unsignableHeaders set.
*/
unsignableHeaders?: Set<string>;
/**
* A set of strings whose members represents headers that should be signed.
* Any values passed here will override those provided via unsignableHeaders,
* allowing them to be signed.
*
* All headers in the provided request will have their names converted to
* lower case before signing.
*/
signableHeaders?: Set<string>;
}
/**
* @public
*/
export interface RequestPresigningArguments extends RequestSigningArguments {
/**
* The number of seconds before the presigned URL expires
*/
expiresIn?: number;
/**
* A set of strings whose representing headers that should not be hoisted
* to presigned request's query string. If not supplied, the presigner
* moves all the AWS-specific headers (starting with `x-amz-`) to the request
* query string. If supplied, these headers remain in the presigned request's
* header.
* All headers in the provided request will have their names converted to
* lower case and then checked for existence in the unhoistableHeaders set.
*/
unhoistableHeaders?: Set<string>;
/**
* This overrides any headers with the same name(s) set by unhoistableHeaders.
* These headers will be hoisted into the query string and signed.
*/
hoistableHeaders?: Set<string>;
}
/**
* @public
*/
export interface EventSigningArguments extends SigningArguments, EventStreamRequestScopedCredentials {
priorSignature: string;
}
/**
* @public
*/
export interface MessageSigningArguments extends SigningArguments, EventStreamRequestScopedCredentials {
}
/**
* @internal
*/
export interface EventStreamRequestScopedCredentials {
/**
* Optional, static credentials used for the duration of the event-stream request.
* If not provided, the signer's internal credential provider would be used, if
* the signer is SignatureV4.
*/
eventStreamCredentials?: AwsCredentialIdentity;
}
/**
* @public
*/
export interface RequestPresigner {
/**
* Signs a request for future use.
*
* The request will be valid until either the provided `expiration` time has
* passed or the underlying credentials have expired.
*
* @param requestToSign - The request that should be signed.
* @param options - Additional signing options.
*/
presign(requestToSign: HttpRequest, options?: RequestPresigningArguments): Promise<HttpRequest>;
}
/**
* An object that signs request objects with AWS credentials using one of the
* AWS authentication protocols.
*
* @public
*/
export interface RequestSigner {
/**
* Sign the provided request for immediate dispatch.
*/
sign(requestToSign: HttpRequest, options?: RequestSigningArguments): Promise<HttpRequest>;
}
/**
* @public
*/
export interface StringSigner {
/**
* Sign the provided `stringToSign` for use outside of the context of
* request signing. Typical uses include signed policy generation.
*/
sign(stringToSign: string, options?: SigningArguments): Promise<string>;
}
/**
* @public
*/
export interface FormattedEvent {
headers: Uint8Array;
payload: Uint8Array;
}
/**
* @public
*/
export interface EventSigner {
/**
* Sign the individual event of the event stream.
*/
sign(event: FormattedEvent, options: EventSigningArguments): Promise<string>;
}
/**
* @public
*/
export interface SignableMessage {
message: Message;
priorSignature: string;
}
/**
* @public
*/
export interface SignedMessage {
message: Message;
signature: string;
}
/**
* @public
*/
export interface MessageSigner {
signMessage(message: SignableMessage, args: MessageSigningArguments): Promise<SignedMessage>;
sign(event: SignableMessage, options: MessageSigningArguments): Promise<SignedMessage>;
}
import { ChecksumConstructor } from "./checksum";
import { HashConstructor, StreamHasher } from "./crypto";
import { BodyLengthCalculator, Encoder } from "./util";
/**
* @public
*/
export interface GetAwsChunkedEncodingStreamOptions {
base64Encoder?: Encoder;
bodyLengthChecker: BodyLengthCalculator;
checksumAlgorithmFn?: ChecksumConstructor | HashConstructor;
checksumLocationName?: string;
streamHasher?: StreamHasher;
}
/**
* A function that returns Readable Stream which follows aws-chunked encoding stream.
* It optionally adds checksum if options are provided.
*
* @public
*/
export interface GetAwsChunkedEncodingStream<StreamType = any> {
(readableStream: StreamType, options: GetAwsChunkedEncodingStreamOptions): StreamType;
}
import { Readable } from "node:stream";
import { BlobOptionalType, ReadableStreamOptionalType } from "../externals-check/browser-externals-check";
/**
* This is the union representing the modeled blob type with streaming trait
* in a generic format that does not relate to HTTP input or output payloads.
* Note: the non-streaming blob type is represented by Uint8Array, but because
* the streaming blob type is always in the request/response paylod, it has
* historically been handled with different types.
* For compatibility with its historical representation, it must contain at least
* Readble (Node.js), Blob (browser), and ReadableStream (browser).
*
* @public
* @see https://smithy.io/2.0/spec/simple-types.html#blob
* @see StreamingPayloadInputTypes for FAQ about mixing types from multiple environments.
*/
export type StreamingBlobTypes = NodeJsRuntimeStreamingBlobTypes | BrowserRuntimeStreamingBlobTypes;
/**
* Node.js streaming blob type.
*
* @public
*/
export type NodeJsRuntimeStreamingBlobTypes = Readable;
/**
* Browser streaming blob types.
*
* @public
*/
export type BrowserRuntimeStreamingBlobTypes = ReadableStreamOptionalType | BlobOptionalType;
import { Readable } from "node:stream";
import { BlobOptionalType, ReadableStreamOptionalType } from "../externals-check/browser-externals-check";
/**
* This union represents a superset of the compatible types you
* can use for streaming payload inputs.
* FAQ:
* Why does the type union mix mutually exclusive runtime types, namely
* Node.js and browser types?
* There are several reasons:
* 1. For backwards compatibility.
* 2. As a convenient compromise solution so that users in either environment may use the types
* without customization.
* 3. The SDK does not have static type information about the exact implementation
* of the HTTP RequestHandler being used in your client(s) (e.g. fetch, XHR, node:http, or node:http2),
* given that it is chosen at runtime. There are multiple possible request handlers
* in both the Node.js and browser runtime environments.
* Rather than restricting the type to a known common format (Uint8Array, for example)
* which doesn't include a universal streaming format in the currently supported Node.js versions,
* the type declaration is widened to multiple possible formats.
* It is up to the user to ultimately select a compatible format with the
* runtime and HTTP handler implementation they are using.
* Usage:
* The typical solution we expect users to have is to manually narrow the
* type when needed, picking the appropriate one out of the union according to the
* runtime environment and specific request handler.
* There is also the type utility "NodeJsClient", "BrowserClient" and more
* exported from this package. These can be applied at the client level
* to pre-narrow these streaming payload blobs. For usage see the readme.md
* in the root of the \@smithy/types NPM package.
*
* @public
*/
export type StreamingBlobPayloadInputTypes = NodeJsRuntimeStreamingBlobPayloadInputTypes | BrowserRuntimeStreamingBlobPayloadInputTypes;
/**
* Streaming payload input types in the Node.js environment.
* These are derived from the types compatible with the request body used by node:http.
* Note: not all types are signable by the standard SignatureV4 signer when
* used as the request body. For example, in Node.js a Readable stream
* is not signable by the default signer.
* They are included in the union because it may be intended in some cases,
* but the expected types are primarily string, Uint8Array, and Buffer.
* Additional details may be found in the internal
* function "getPayloadHash" in the SignatureV4 module.
*
* @public
*/
export type NodeJsRuntimeStreamingBlobPayloadInputTypes = string | Uint8Array | Buffer | Readable;
/**
* Streaming payload input types in the browser environment.
* These are derived from the types compatible with fetch's Request.body.
*
* @public
*/
export type BrowserRuntimeStreamingBlobPayloadInputTypes = string | Uint8Array | ReadableStreamOptionalType | BlobOptionalType;
import { IncomingMessage } from "node:http";
import { Readable } from "node:stream";
import { BlobOptionalType, ReadableStreamOptionalType } from "../externals-check/browser-externals-check";
import { SdkStream } from "../serde";
/**
* This union represents a superset of the types you may receive
* in streaming payload outputs.
* To highlight the upstream docs about the SdkStream mixin:
* The interface contains mix-in (via Object.assign) methods to transform the runtime-specific
* stream implementation to specified format. Each stream can ONLY be transformed
* once.
* The available methods are described on the SdkStream type via SdkStreamMixin.
*
* @public
* @see StreamingPayloadInputTypes for FAQ about mixing types from multiple environments.
*/
export type StreamingBlobPayloadOutputTypes = NodeJsRuntimeStreamingBlobPayloadOutputTypes | BrowserRuntimeStreamingBlobPayloadOutputTypes;
/**
* Streaming payload output types in the Node.js environment.
* This is by default the IncomingMessage type from node:http responses when
* using the default node-http-handler in Node.js environments.
* It can be other Readable types like node:http2's ClientHttp2Stream
* such as when using the node-http2-handler.
* The SdkStreamMixin adds methods on this type to help transform (collect) it to
* other formats.
*
* @public
*/
export type NodeJsRuntimeStreamingBlobPayloadOutputTypes = SdkStream<IncomingMessage | Readable>;
/**
* Streaming payload output types in the browser environment.
* This is by default fetch's Response.body type (ReadableStream) when using
* the default fetch-http-handler in browser-like environments.
* It may be a Blob, such as when using the XMLHttpRequest handler
* and receiving an arraybuffer response body.
* The SdkStreamMixin adds methods on this type to help transform (collect) it to
* other formats.
*
* @public
*/
export type BrowserRuntimeStreamingBlobPayloadOutputTypes = SdkStream<ReadableStreamOptionalType | BlobOptionalType>;
/**
* @public
*/
export type RequestHandlerOutput<ResponseType> = {
response: ResponseType;
};
/**
* @public
*/
export interface RequestHandler<RequestType, ResponseType, HandlerOptions = {}> {
/**
* metadata contains information of a handler. For example
* 'h2' refers this handler is for handling HTTP/2 requests,
* whereas 'h1' refers handling HTTP1 requests
*/
metadata?: RequestHandlerMetadata;
destroy?: () => void;
handle: (request: RequestType, handlerOptions?: HandlerOptions) => Promise<RequestHandlerOutput<ResponseType>>;
}
/**
* @public
*/
export interface RequestHandlerMetadata {
handlerProtocol: RequestHandlerProtocol | string;
}
/**
* Values from ALPN Protocol IDs.
*
* @public
* @see https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
*/
export declare enum RequestHandlerProtocol {
HTTP_0_9 = "http/0.9",
HTTP_1_0 = "http/1.0",
TDS_8_0 = "tds/8.0"
}
/**
* @public
*/
export interface RequestContext {
destination: URL;
}
import { CommandIO } from "../command";
import { MetadataBearer } from "../response";
import { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
import { Transform } from "./type-transform";
/**
* Narrowed version of InvokeFunction used in Client::send.
*
* @internal
*/
export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer> {
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions, cb?: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
}
/**
* Narrowed version of InvokeMethod used in aggregated Client methods.
*
* @internal
*/
export interface NarrowedInvokeMethod<NarrowType, HttpHandlerOptions, InputType extends object, OutputType extends MetadataBearer> {
(input: InputType, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
(input: InputType, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
(input: InputType, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
(input: InputType, options?: HttpHandlerOptions, cb?: (err: unknown, data?: OutputType) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
}
import { ClientHttp2Stream } from "node:http2";
import { IncomingMessage } from "node:http";
import { InvokeMethod } from "../client";
import { GetOutputType } from "../command";
import { HttpHandlerOptions } from "../http";
import { SdkStream } from "../serde";
import { BrowserRuntimeStreamingBlobPayloadInputTypes, NodeJsRuntimeStreamingBlobPayloadInputTypes, StreamingBlobPayloadInputTypes } from "../streaming-payload/streaming-blob-payload-input-types";
import { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
import { NarrowedInvokeMethod } from "./client-method-transforms";
import { Transform } from "./type-transform";
/**
* Creates a type with a given client type that narrows payload blob output
* types to SdkStream<IncomingMessage>.
* This can be used for clients with the NodeHttpHandler requestHandler,
* the default in Node.js when not using HTTP2.
* Usage example:
* ```typescript
* const client = new YourClient({}) as NodeJsClient<YourClient>;
* ```
*
* @public
*/
export type NodeJsClient<ClientType extends object> = NarrowPayloadBlobTypes<NodeJsRuntimeStreamingBlobPayloadInputTypes, SdkStream<IncomingMessage>, ClientType>;
/**
* Variant of NodeJsClient for node:http2.
*
* @public
*/
export type NodeJsHttp2Client<ClientType extends object> = NarrowPayloadBlobTypes<NodeJsRuntimeStreamingBlobPayloadInputTypes, SdkStream<ClientHttp2Stream>, ClientType>;
/**
* Creates a type with a given client type that narrows payload blob output
* types to SdkStream<ReadableStream>.
* This can be used for clients with the FetchHttpHandler requestHandler,
* which is the default in browser environments.
* Usage example:
* ```typescript
* const client = new YourClient({}) as BrowserClient<YourClient>;
* ```
*
* @public
*/
export type BrowserClient<ClientType extends object> = NarrowPayloadBlobTypes<BrowserRuntimeStreamingBlobPayloadInputTypes, SdkStream<ReadableStream>, ClientType>;
/**
* Variant of BrowserClient for XMLHttpRequest.
*
* @public
*/
export type BrowserXhrClient<ClientType extends object> = NarrowPayloadBlobTypes<BrowserRuntimeStreamingBlobPayloadInputTypes, SdkStream<ReadableStream | Blob>, ClientType>;
/**
* Narrow a given Client's blob payload outputs to the given type T.
*
* @public
* @deprecated use NarrowPayloadBlobTypes<I, O, ClientType>.
*/
export type NarrowPayloadBlobOutputType<T, ClientType extends object> = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? NarrowedInvokeMethod<T, HttpHandlerOptions, FunctionInputTypes, FunctionOutputTypes> : ClientType[key];
} & {
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, T>>;
};
/**
* Narrow a Client's blob payload input and output types to I and O.
*
* @public
*/
export type NarrowPayloadBlobTypes<I, O, ClientType extends object> = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? NarrowedInvokeMethod<O, HttpHandlerOptions, Transform<FunctionInputTypes, StreamingBlobPayloadInputTypes | undefined, I>, FunctionOutputTypes> : ClientType[key];
} & {
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, O>>;
};
/**
* Checks that A and B extend each other.
*
* @internal
*/
export type Exact<A, B> = [
A
] extends [
B
] ? ([
B
] extends [
A
] ? true : false) : false;
/**
* @internal
*/
export type Mutable<Type> = {
-readonly [Property in keyof Type]: Type[Property];
};
import { InvokeMethod, InvokeMethodOptionalArgs } from "../client";
import { GetOutputType } from "../command";
import { DocumentType } from "../shapes";
/**
* This type is intended as a type helper for generated clients.
* When initializing client, cast it to this type by passing
* the client constructor type as the type parameter.
*
* It will then recursively remove "undefined" as a union type from all
* input and output shapes' members. Note, this does not affect
* any member that is optional (?) such as outputs with no required members.
*
* @example
* ```ts
* const client = new Client({}) as AssertiveClient<Client>;
* ```
*
* @public
*/
export type AssertiveClient<Client extends object> = NarrowClientIOTypes<Client>;
/**
* This is similar to AssertiveClient but additionally changes all
* output types to (recursive) Required<T> so as to bypass all output nullability guards.
*
* @public
*/
export type UncheckedClient<Client extends object> = UncheckedClientOutputTypes<Client>;
/**
* Excludes undefined recursively.
*
* @internal
*/
export type NoUndefined<T> = T extends Function ? T : T extends DocumentType ? T : [
T
] extends [
object
] ? {
[key in keyof T]: NoUndefined<T[key]>;
} : Exclude<T, undefined>;
/**
* Excludes undefined and optional recursively.
*
* @internal
*/
export type RecursiveRequired<T> = T extends Function ? T : T extends DocumentType ? T : [
T
] extends [
object
] ? {
[key in keyof T]-?: RecursiveRequired<T[key]>;
} : Exclude<T, undefined>;
/**
* Removes undefined from unions.
*
* @internal
*/
type NarrowClientIOTypes<ClientType extends object> = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : [
ClientType[key]
] extends [
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? InvokeMethod<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : ClientType[key];
} & {
send<Command>(command: Command, options?: any): Promise<NoUndefined<GetOutputType<Command>>>;
};
/**
* Removes undefined from unions and adds yolo output types.
*
* @internal
*/
type UncheckedClientOutputTypes<ClientType extends object> = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : [
ClientType[key]
] extends [
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
] ? InvokeMethod<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : ClientType[key];
} & {
send<Command>(command: Command, options?: any): Promise<RecursiveRequired<NoUndefined<GetOutputType<Command>>>>;
};
export {};
/**
* Transforms any members of the object T having type FromType
* to ToType. This applies only to exact type matches.
* This is for the case where FromType is a union and only those fields
* matching the same union should be transformed.
*
* @public
*/
export type Transform<T, FromType, ToType> = RecursiveTransformExact<T, FromType, ToType>;
/**
* Returns ToType if T matches exactly with FromType.
*
* @internal
*/
type TransformExact<T, FromType, ToType> = [
T
] extends [
FromType
] ? ([
FromType
] extends [
T
] ? ToType : T) : T;
/**
* Applies TransformExact to members of an object recursively.
*
* @internal
*/
type RecursiveTransformExact<T, FromType, ToType> = T extends Function ? T : T extends object ? {
[key in keyof T]: [
T[key]
] extends [
FromType
] ? [
FromType
] extends [
T[key]
] ? ToType : RecursiveTransformExact<T[key], FromType, ToType> : RecursiveTransformExact<T[key], FromType, ToType>;
} : TransformExact<T, FromType, ToType>;
export {};
import { QueryParameterBag } from "./http";
/**
* Represents the components parts of a Uniform Resource Identifier used to
* construct the target location of a Request.
*
* @internal
*/
export type URI = {
protocol: string;
hostname: string;
port?: number;
path: string;
query?: QueryParameterBag;
username?: string;
password?: string;
fragment?: string;
};
import { Endpoint } from "./http";
import { FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput } from "./middleware";
import { MetadataBearer } from "./response";
/**
* A generic which checks if Type1 is exactly same as Type2.
*
* @public
*/
export type Exact<Type1, Type2> = [
Type1
] extends [
Type2
] ? ([
Type2
] extends [
Type1
] ? true : false) : false;
/**
* A function that, given a Uint8Array of bytes, can produce a string
* representation thereof. The function may optionally attempt to
* convert other input types to Uint8Array before encoding.
*
* @example An encoder function that converts bytes to hexadecimal
* representation would return `'hello'` when given
* `new Uint8Array([104, 101, 108, 108, 111])`.
*
* @public
*/
export interface Encoder {
/**
* Caution: the `any` type on the input is for backwards compatibility.
* Runtime support is limited to Uint8Array and string by default.
*
* You may choose to support more encoder input types if overriding the default
* implementations.
*/
(input: Uint8Array | string | any): string;
}
/**
* A function that, given a string, can derive the bytes represented by that
* string.
*
* @example A decoder function that converts bytes to hexadecimal
* representation would return `new Uint8Array([104, 101, 108, 108, 111])` when
* given the string `'hello'`.
*
* @public
*/
export interface Decoder {
(input: string): Uint8Array;
}
/**
* A function that, when invoked, returns a promise that will be fulfilled with
* a value of type T.
*
* @example A function that reads credentials from shared SDK configuration
* files, assuming roles and collecting MFA tokens as necessary.
*
* @public
*/
export interface Provider<T> {
(): Promise<T>;
}
/**
* A tuple that represents an API name and optional version
* of a library built using the AWS SDK.
*
* @public
*/
export type UserAgentPair = [
/*name*/ string,
/*version*/ string
];
/**
* User agent data that to be put into the request's user
* agent.
*
* @public
*/
export type UserAgent = UserAgentPair[];
/**
* Parses a URL in string form into an Endpoint object.
*
* @public
*/
export interface UrlParser {
(url: string | URL): Endpoint;
}
/**
* A function that, when invoked, returns a promise that will be fulfilled with
* a value of type T. It memoizes the result from the previous invocation
* instead of calling the underlying resources every time.
*
* You can force the provider to refresh the memoized value by invoke the
* function with optional parameter hash with `forceRefresh` boolean key and
* value `true`.
*
* @example A function that reads credentials from IMDS service that could
* return expired credentials. The SDK will keep using the expired credentials
* until an unretryable service error requiring a force refresh of the
* credentials.
*
* @public
*/
export interface MemoizedProvider<T> {
(options?: {
forceRefresh?: boolean;
}): Promise<T>;
}
/**
* A function that, given a request body, determines the
* length of the body. This is used to determine the Content-Length
* that should be sent with a request.
*
* @example A function that reads a file stream and calculates
* the size of the file.
*
* @public
*/
export interface BodyLengthCalculator {
(body: any): number | undefined;
}
/**
* Object containing regionalization information of
* AWS services.
*
* @public
*/
export interface RegionInfo {
hostname: string;
partition: string;
path?: string;
signingService?: string;
signingRegion?: string;
}
/**
* Options to pass when calling {@link RegionInfoProvider}
*
* @public
*/
export interface RegionInfoProviderOptions {
/**
* Enables IPv6/IPv4 dualstack endpoint.
* @defaultValue false
*/
useDualstackEndpoint: boolean;
/**
* Enables FIPS compatible endpoints.
* @defaultValue false
*/
useFipsEndpoint: boolean;
}
/**
* Function returns designated service's regionalization
* information from given region. Each service client
* comes with its regionalization provider. it serves
* to provide the default values of related configurations
*
* @public
*/
export interface RegionInfoProvider {
(region: string, options?: RegionInfoProviderOptions): Promise<RegionInfo | undefined>;
}
/**
* Interface that specifies the retry behavior
*
* @public
*/
export interface RetryStrategy {
/**
* The retry mode describing how the retry strategy control the traffic flow.
*/
mode?: string;
/**
* the retry behavior the will invoke the next handler and handle the retry accordingly.
* This function should also update the $metadata from the response accordingly.
* @see {@link ResponseMetadata}
*/
retry: <Input extends object, Output extends MetadataBearer>(next: FinalizeHandler<Input, Output>, args: FinalizeHandlerArguments<Input>) => Promise<FinalizeHandlerOutput<Output>>;
}
/**
* Indicates the parameter may be omitted if the parameter object T
* is equivalent to a Partial<T>, i.e. all properties optional.
*
* @public
*/
export type OptionalParameter<T> = Exact<Partial<T>, T> extends true ? [
] | [
T
] : [
T
];
import { AbortController as DeprecatedAbortController } from "./abort";
/**
* @public
*/
export interface WaiterConfiguration<Client> {
/**
* Required service client
*/
client: Client;
/**
* The amount of time in seconds a user is willing to wait for a waiter to complete.
*/
maxWaitTime: number;
/**
* @deprecated Use abortSignal
* Abort controller. Used for ending the waiter early.
*/
abortController?: AbortController | DeprecatedAbortController;
/**
* Abort Signal. Used for ending the waiter early.
*/
abortSignal?: AbortController["signal"] | DeprecatedAbortController["signal"];
/**
* The minimum amount of time to delay between retries in seconds. This is the
* floor of the exponential backoff. This value defaults to service default
* if not specified. This value MUST be less than or equal to maxDelay and greater than 0.
*/
minDelay?: number;
/**
* The maximum amount of time to delay between retries in seconds. This is the
* ceiling of the exponential backoff. This value defaults to service default
* if not specified. If specified, this value MUST be greater than or equal to 1.
*/
maxDelay?: number;
}
+2
-2
{
"name": "@smithy/types",
"version": "4.16.0",
"version": "4.16.1",
"scripts": {

@@ -39,3 +39,3 @@ "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",

"typesVersions": {
"<=4.0": {
"<=4.5": {
"dist-types/*": [

@@ -42,0 +42,0 @@ "dist-types/ts3.4/*"