@smithy/types
Advanced tools
Comparing version 1.0.0 to 1.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FieldPosition = void 0; | ||
var FieldPosition; | ||
(function (FieldPosition) { | ||
FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER"; | ||
FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER"; | ||
})(FieldPosition = exports.FieldPosition || (exports.FieldPosition = {})); |
@@ -5,5 +5,27 @@ "use strict"; | ||
tslib_1.__exportStar(require("./abort"), exports); | ||
tslib_1.__exportStar(require("./auth"), exports); | ||
tslib_1.__exportStar(require("./checksum"), exports); | ||
tslib_1.__exportStar(require("./client"), exports); | ||
tslib_1.__exportStar(require("./command"), exports); | ||
tslib_1.__exportStar(require("./connection"), exports); | ||
tslib_1.__exportStar(require("./crypto"), exports); | ||
tslib_1.__exportStar(require("./encode"), exports); | ||
tslib_1.__exportStar(require("./endpoint"), exports); | ||
tslib_1.__exportStar(require("./endpoints"), exports); | ||
tslib_1.__exportStar(require("./eventStream"), exports); | ||
tslib_1.__exportStar(require("./http"), exports); | ||
tslib_1.__exportStar(require("./identity"), exports); | ||
tslib_1.__exportStar(require("./logger"), exports); | ||
tslib_1.__exportStar(require("./middleware"), exports); | ||
tslib_1.__exportStar(require("./pagination"), exports); | ||
tslib_1.__exportStar(require("./profile"), exports); | ||
tslib_1.__exportStar(require("./response"), exports); | ||
tslib_1.__exportStar(require("./retry"), exports); | ||
tslib_1.__exportStar(require("./serde"), exports); | ||
tslib_1.__exportStar(require("./shapes"), exports); | ||
tslib_1.__exportStar(require("./signature"), exports); | ||
tslib_1.__exportStar(require("./stream"), exports); | ||
tslib_1.__exportStar(require("./transfer"), exports); | ||
tslib_1.__exportStar(require("./uri"), exports); | ||
tslib_1.__exportStar(require("./util"), exports); | ||
tslib_1.__exportStar(require("./waiter"), exports); |
@@ -1,1 +0,5 @@ | ||
export {}; | ||
export var FieldPosition; | ||
(function (FieldPosition) { | ||
FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER"; | ||
FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER"; | ||
})(FieldPosition || (FieldPosition = {})); |
export * from "./abort"; | ||
export * from "./auth"; | ||
export * from "./checksum"; | ||
export * from "./client"; | ||
export * from "./command"; | ||
export * from "./connection"; | ||
export * from "./crypto"; | ||
export * from "./encode"; | ||
export * from "./endpoint"; | ||
export * from "./endpoints"; | ||
export * from "./eventStream"; | ||
export * from "./http"; | ||
export * from "./identity"; | ||
export * from "./logger"; | ||
export * from "./middleware"; | ||
export * from "./pagination"; | ||
export * from "./profile"; | ||
export * from "./response"; | ||
export * from "./retry"; | ||
export * from "./serde"; | ||
export * from "./shapes"; | ||
export * from "./signature"; | ||
export * from "./stream"; | ||
export * from "./transfer"; | ||
export * from "./uri"; | ||
export * from "./util"; | ||
export * from "./waiter"; |
@@ -0,5 +1,7 @@ | ||
import { AbortSignal } from "./abort"; | ||
import { URI } from "./uri"; | ||
/** | ||
* @public | ||
* | ||
* @deprecated use {@link EndpointV2} from `@aws-sdk/types`. | ||
* @deprecated use {@link EndpointV2} from `@smithy/types`. | ||
*/ | ||
@@ -16,2 +18,30 @@ export interface Endpoint { | ||
* | ||
* Interface an HTTP request class. Contains | ||
* addressing information in addition to standard message properties. | ||
*/ | ||
export interface HttpRequest extends HttpMessage, URI { | ||
method: string; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Represents an HTTP message as received in reply to a request. Contains a | ||
* numeric status code in addition to standard message properties. | ||
*/ | ||
export interface HttpResponse extends HttpMessage { | ||
statusCode: number; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Represents an HTTP message with headers and an optional static or streaming | ||
* body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream; | ||
*/ | ||
export interface HttpMessage { | ||
headers: HeaderBag; | ||
body?: any; | ||
} | ||
/** | ||
* @public | ||
* | ||
* A mapping of query parameter names to strings or arrays of strings, with the | ||
@@ -22,1 +52,56 @@ * second being used when a parameter contains a list of values. Value can be set | ||
export type QueryParameterBag = Record<string, string | Array<string> | null>; | ||
export type FieldOptions = { | ||
name: string; | ||
kind?: FieldPosition; | ||
values?: string[]; | ||
}; | ||
export declare enum FieldPosition { | ||
HEADER = 0, | ||
TRAILER = 1 | ||
} | ||
/** | ||
* @public | ||
* | ||
* 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. | ||
*/ | ||
export type HeaderBag = Record<string, string>; | ||
/** | ||
* @public | ||
* | ||
* Represents an HTTP message with headers and an optional static or streaming | ||
* body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream; | ||
*/ | ||
export interface HttpMessage { | ||
headers: HeaderBag; | ||
body?: any; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Represents the options that may be passed to an Http Handler. | ||
*/ | ||
export interface HttpHandlerOptions { | ||
abortSignal?: AbortSignal; | ||
/** | ||
* The maximum time in milliseconds that the connection phase of a request | ||
* may take before the connection attempt is abandoned. | ||
*/ | ||
requestTimeout?: number; | ||
} |
export * from "./abort"; | ||
export * from "./auth"; | ||
export * from "./checksum"; | ||
export * from "./client"; | ||
export * from "./command"; | ||
export * from "./connection"; | ||
export * from "./crypto"; | ||
export * from "./encode"; | ||
export * from "./endpoint"; | ||
export * from "./endpoints"; | ||
export * from "./eventStream"; | ||
export * from "./http"; | ||
export * from "./identity"; | ||
export * from "./logger"; | ||
export * from "./middleware"; | ||
export * from "./pagination"; | ||
export * from "./profile"; | ||
export * from "./response"; | ||
export * from "./retry"; | ||
export * from "./serde"; | ||
export * from "./shapes"; | ||
export * from "./signature"; | ||
export * from "./stream"; | ||
export * from "./transfer"; | ||
export * from "./uri"; | ||
export * from "./util"; | ||
export * from "./waiter"; |
@@ -37,1 +37,69 @@ import { Endpoint } from "./http"; | ||
} | ||
/** | ||
* @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. | ||
*/ | ||
export interface SdkStreamMixin { | ||
transformToByteArray: () => Promise<Uint8Array>; | ||
transformToString: (encoding?: string) => Promise<string>; | ||
transformToWebStream: () => ReadableStream; | ||
} | ||
/** | ||
* @public | ||
* | ||
* The type describing a runtime-specific stream implementation with mix-in | ||
* utility functions. | ||
*/ | ||
export type SdkStream<BaseStream> = BaseStream & SdkStreamMixin; | ||
/** | ||
* @public | ||
* | ||
* Indicates that the member of type T with | ||
* key StreamKey have been extended | ||
* with the SdkStreamMixin helper methods. | ||
*/ | ||
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; | ||
} |
@@ -31,1 +31,4 @@ /** | ||
} | ||
export interface RequestContext { | ||
destination: URL; | ||
} |
@@ -0,1 +1,4 @@ | ||
import { Endpoint } from "./http"; | ||
import { FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput } from "./middleware"; | ||
import { MetadataBearer } from "./response"; | ||
/** | ||
@@ -39,1 +42,115 @@ * @public | ||
} | ||
/** | ||
* @public | ||
* | ||
* A tuple that represents an API name and optional version | ||
* of a library built using the AWS SDK. | ||
*/ | ||
export type UserAgentPair = [name: string, version?: string]; | ||
/** | ||
* @public | ||
* | ||
* User agent data that to be put into the request's user | ||
* agent. | ||
*/ | ||
export type UserAgent = UserAgentPair[]; | ||
/** | ||
* @public | ||
* | ||
* Parses a URL in string form into an Endpoint object. | ||
*/ | ||
export interface UrlParser { | ||
(url: string | URL): Endpoint; | ||
} | ||
/** | ||
* @public | ||
* | ||
* 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. | ||
*/ | ||
export interface MemoizedProvider<T> { | ||
(options?: { | ||
forceRefresh?: boolean; | ||
}): Promise<T>; | ||
} | ||
/** | ||
* @public | ||
* | ||
* 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. | ||
*/ | ||
export interface BodyLengthCalculator { | ||
(body: any): number | undefined; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Object containing regionalization information of | ||
* AWS services. | ||
*/ | ||
export interface RegionInfo { | ||
hostname: string; | ||
partition: string; | ||
path?: string; | ||
signingService?: string; | ||
signingRegion?: string; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Options to pass when calling {@link RegionInfoProvider} | ||
*/ | ||
export interface RegionInfoProviderOptions { | ||
/** | ||
* Enables IPv6/IPv4 dualstack endpoint. | ||
* @defaultValue false | ||
*/ | ||
useDualstackEndpoint: boolean; | ||
/** | ||
* Enables FIPS compatible endpoints. | ||
* @defaultValue false | ||
*/ | ||
useFipsEndpoint: boolean; | ||
} | ||
/** | ||
* @public | ||
* | ||
* 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 | ||
*/ | ||
export interface RegionInfoProvider { | ||
(region: string, options?: RegionInfoProviderOptions): Promise<RegionInfo | undefined>; | ||
} | ||
/** | ||
* @public | ||
* | ||
* Interface that specifies the retry behavior | ||
*/ | ||
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>>; | ||
} |
{ | ||
"name": "@smithy/types", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"scripts": { | ||
@@ -10,2 +10,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", | ||
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz", | ||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo", | ||
@@ -51,2 +52,3 @@ "lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"", | ||
"downlevel-dts": "0.10.1", | ||
"jest": "28.1.1", | ||
"rimraf": "3.0.2", | ||
@@ -58,3 +60,6 @@ "typedoc": "0.23.23", | ||
"entryPoint": "src/index.ts" | ||
}, | ||
"publishConfig": { | ||
"directory": ".release/package" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86109
117
2303
7
1