@smithy/core
Advanced tools
| import { Command } from "./command"; | ||
| export function makeBuilder(common, service, name, ep) { | ||
| return function makeCommand(added, plugins, op, $, smithyContext = {}) { | ||
| const epMerged = Object.assign({}, common, added); | ||
| return Command.classBuilder() | ||
| .ep(epMerged) | ||
| .m(function (CommandCtor, clientStack, config, options) { | ||
| const list = plugins.call(this, CommandCtor, clientStack, config, options); | ||
| list.unshift(ep(config, CommandCtor.getEndpointParameterInstructions())); | ||
| return list; | ||
| }) | ||
| .s(service, op, smithyContext) | ||
| .n(name, op.charAt(0).toUpperCase() + op.slice(1) + "Command") | ||
| .sc($) | ||
| .build(); | ||
| }; | ||
| } |
| import type { EndpointParameterInstructions, Logger, MetadataBearer, OptionalParameter, Pluggable, RequestHandler, StaticOperationSchema } from "@smithy/types"; | ||
| import { type CommandImpl } from "./command"; | ||
| /** | ||
| * Higher order factory for Command builders specific to a client. | ||
| * Produces a command factory that creates Command classes with | ||
| * pre-configured endpoint params, middleware, and schema. | ||
| * | ||
| * @param common - common endpoint params. | ||
| * @param service - service shape name. | ||
| * @param name - SDK Client Name. | ||
| * @param ep - endpoint plugin provider. | ||
| * | ||
| * @internal | ||
| */ | ||
| export declare function makeBuilder<C extends { | ||
| logger?: Logger; | ||
| requestHandler: RequestHandler<any, any, any>; | ||
| }, SI extends object, SO extends MetadataBearer>(common: EndpointParameterInstructions, service: string, name: string, ep: (config: any, instructions: any) => Pluggable<any, any>): <I extends SI, O extends SO>(added: EndpointParameterInstructions, plugins: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[], op: string, $: StaticOperationSchema, smithyContext?: Record<string, unknown>) => { | ||
| new (input: I): CommandImpl<I, O, C, SI, SO>; | ||
| new (...[input]: OptionalParameter<I>): CommandImpl<I, O, C, SI, SO>; | ||
| getEndpointParameterInstructions(): EndpointParameterInstructions; | ||
| }; |
@@ -1093,2 +1093,19 @@ const { getSmithyContext, normalizeProvider } = require("@smithy/core/transport"); | ||
| function makeBuilder(common, service, name, ep) { | ||
| return function makeCommand(added, plugins, op, $, smithyContext = {}) { | ||
| const epMerged = Object.assign({}, common, added); | ||
| return Command.classBuilder() | ||
| .ep(epMerged) | ||
| .m(function (CommandCtor, clientStack, config, options) { | ||
| const list = plugins.call(this, CommandCtor, clientStack, config, options); | ||
| list.unshift(ep(config, CommandCtor.getEndpointParameterInstructions())); | ||
| return list; | ||
| }) | ||
| .s(service, op, smithyContext) | ||
| .n(name, op.charAt(0).toUpperCase() + op.slice(1) + "Command") | ||
| .sc($) | ||
| .build(); | ||
| }; | ||
| } | ||
| exports.Client = Client; | ||
@@ -1118,2 +1135,3 @@ exports.Command = Command; | ||
| exports.loadConfigsForDefaultMode = loadConfigsForDefaultMode; | ||
| exports.makeBuilder = makeBuilder; | ||
| exports.map = map; | ||
@@ -1120,0 +1138,0 @@ exports.resolveChecksumRuntimeConfig = resolveChecksumRuntimeConfig; |
@@ -27,1 +27,2 @@ export { constructStack } from "./middleware-stack/MiddlewareStack"; | ||
| export { _json } from "./smithy-client/serde-json"; | ||
| export { makeBuilder } from "./smithy-client/client-command-builder"; |
@@ -27,1 +27,2 @@ export { constructStack } from "./middleware-stack/MiddlewareStack"; | ||
| export { _json } from "./smithy-client/serde-json"; | ||
| export { makeBuilder } from "./smithy-client/client-command-builder"; |
@@ -1,3 +0,2 @@ | ||
| import { type Handler, type HandlerExecutionContext, type Command as ICommand, type HttpRequest as IHttpRequest, type HttpResponse as IHttpResponse, type MiddlewareStack as IMiddlewareStack, type Logger, type MetadataBearer, type OperationSchema, type OptionalParameter, type Pluggable, type RequestHandler, type SerdeContext, type StaticOperationSchema } from "@smithy/types"; | ||
| type EndpointParameterInstructions = Record<string, unknown>; | ||
| import { type EndpointParameterInstructions, type Handler, type HandlerExecutionContext, type Command as ICommand, type HttpRequest as IHttpRequest, type HttpResponse as IHttpResponse, type MiddlewareStack as IMiddlewareStack, type Logger, type MetadataBearer, type OperationSchema, type OptionalParameter, type Pluggable, type RequestHandler, type SerdeContext, type StaticOperationSchema } from "@smithy/types"; | ||
| /** | ||
@@ -15,3 +14,3 @@ * @public | ||
| static classBuilder<I extends SI, O extends SO, C extends { | ||
| logger: Logger; | ||
| logger?: Logger; | ||
| requestHandler: RequestHandler<any, any, any>; | ||
@@ -24,3 +23,3 @@ }, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>; | ||
| resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: { | ||
| logger: Logger; | ||
| logger?: Logger; | ||
| requestHandler: RequestHandler<any, any, any>; | ||
@@ -46,3 +45,3 @@ }, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>; | ||
| declare class ClassBuilder<I extends SI, O extends SO, C extends { | ||
| logger: Logger; | ||
| logger?: Logger; | ||
| requestHandler: RequestHandler<any, any, any>; | ||
@@ -116,3 +115,3 @@ }, SI extends object = any, SO extends MetadataBearer = any> { | ||
| export interface CommandImpl<I extends SI, O extends SO, C extends { | ||
| logger: Logger; | ||
| logger?: Logger; | ||
| requestHandler: RequestHandler<any, any, any>; | ||
@@ -119,0 +118,0 @@ }, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> { |
@@ -10,9 +10,9 @@ export { toEndpointV1 } from "@smithy/core/transport"; | ||
| export * from "./util-endpoints/types"; | ||
| export declare const getEndpointFromInstructions: <T extends import("@smithy/types").EndpointParameters, CommandInput extends Record<string, unknown>, Config extends Record<string, unknown>>(commandInput: CommandInput, instructionsSupplier: import("./middleware-endpoint/adaptors/getEndpointFromInstructions").EndpointParameterInstructionsSupplier, clientConfig: Partial<import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>> & Config, context?: import("@smithy/types").HandlerExecutionContext) => Promise<import("@smithy/types").EndpointV2>; | ||
| export declare const getEndpointFromInstructions: <T extends import("@smithy/types").EndpointParameters, CommandInput extends object, Config extends object>(commandInput: CommandInput, instructionsSupplier: import("./middleware-endpoint/adaptors/getEndpointFromInstructions").EndpointParameterInstructionsSupplier, clientConfig: Partial<import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>> & Config, context?: import("@smithy/types").HandlerExecutionContext) => Promise<import("@smithy/types").EndpointV2>; | ||
| export declare const resolveEndpointConfig: <T, P extends import("@smithy/types").EndpointParameters = import("@smithy/types").EndpointParameters>(input: T & import("./middleware-endpoint/resolveEndpointConfig").EndpointInputConfig<P> & import("./middleware-endpoint/resolveEndpointConfig").PreviouslyResolved<P>) => T & import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<P>; | ||
| export declare const endpointMiddleware: <T extends import("@smithy/types").EndpointParameters>({ config, instructions, }: { | ||
| config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>; | ||
| instructions: import("./middleware-endpoint/types").EndpointParameterInstructions; | ||
| instructions: import("@smithy/types").EndpointParameterInstructions; | ||
| }) => import("@smithy/types").SerializeMiddleware<any, any>; | ||
| export declare const getEndpointPlugin: <T extends import("@smithy/types").EndpointParameters>(config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>, instructions: import("./middleware-endpoint/types").EndpointParameterInstructions) => import("@smithy/types").Pluggable<any, any>; | ||
| export declare const getEndpointPlugin: <T extends import("@smithy/types").EndpointParameters>(config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>, instructions: import("@smithy/types").EndpointParameterInstructions) => import("@smithy/types").Pluggable<any, any>; | ||
| export { resolveParams, type EndpointParameterInstructionsSupplier, } from "./middleware-endpoint/adaptors/getEndpointFromInstructions"; | ||
@@ -24,3 +24,2 @@ export { toEndpointV1 as middlewareEndpointToEndpointV1 } from "./middleware-endpoint/adaptors/toEndpointV1"; | ||
| export type { EndpointRequiredInputConfig, EndpointRequiredResolvedConfig, } from "./middleware-endpoint/resolveEndpointRequiredConfig"; | ||
| export type { EndpointParameterInstructions } from "./middleware-endpoint/types"; | ||
| export type { BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "./middleware-endpoint/types"; | ||
| export type { EndpointParameterInstructions, BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "@smithy/types"; |
@@ -10,9 +10,9 @@ export { toEndpointV1 } from "@smithy/core/transport"; | ||
| export * from "./util-endpoints/types"; | ||
| export declare const getEndpointFromInstructions: <T extends import("@smithy/types").EndpointParameters, CommandInput extends Record<string, unknown>, Config extends Record<string, unknown>>(commandInput: CommandInput, instructionsSupplier: import("./middleware-endpoint/adaptors/getEndpointFromInstructions").EndpointParameterInstructionsSupplier, clientConfig: Partial<import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>> & Config, context?: import("@smithy/types").HandlerExecutionContext) => Promise<import("@smithy/types").EndpointV2>; | ||
| export declare const getEndpointFromInstructions: <T extends import("@smithy/types").EndpointParameters, CommandInput extends object, Config extends object>(commandInput: CommandInput, instructionsSupplier: import("./middleware-endpoint/adaptors/getEndpointFromInstructions").EndpointParameterInstructionsSupplier, clientConfig: Partial<import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>> & Config, context?: import("@smithy/types").HandlerExecutionContext) => Promise<import("@smithy/types").EndpointV2>; | ||
| export declare const resolveEndpointConfig: <T, P extends import("@smithy/types").EndpointParameters = import("@smithy/types").EndpointParameters>(input: T & import("./middleware-endpoint/resolveEndpointConfig").EndpointInputConfig<P> & import("./middleware-endpoint/resolveEndpointConfig").PreviouslyResolved<P>) => T & import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<P>; | ||
| export declare const endpointMiddleware: <T extends import("@smithy/types").EndpointParameters>({ config, instructions, }: { | ||
| config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>; | ||
| instructions: import("./middleware-endpoint/types").EndpointParameterInstructions; | ||
| instructions: import("@smithy/types").EndpointParameterInstructions; | ||
| }) => import("@smithy/types").SerializeMiddleware<any, any>; | ||
| export declare const getEndpointPlugin: <T extends import("@smithy/types").EndpointParameters>(config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>, instructions: import("./middleware-endpoint/types").EndpointParameterInstructions) => import("@smithy/types").Pluggable<any, any>; | ||
| export declare const getEndpointPlugin: <T extends import("@smithy/types").EndpointParameters>(config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>, instructions: import("@smithy/types").EndpointParameterInstructions) => import("@smithy/types").Pluggable<any, any>; | ||
| export { resolveParams, type EndpointParameterInstructionsSupplier, } from "./middleware-endpoint/adaptors/getEndpointFromInstructions"; | ||
@@ -24,3 +24,2 @@ export { toEndpointV1 as middlewareEndpointToEndpointV1 } from "./middleware-endpoint/adaptors/toEndpointV1"; | ||
| export type { EndpointRequiredInputConfig, EndpointRequiredResolvedConfig, } from "./middleware-endpoint/resolveEndpointRequiredConfig"; | ||
| export type { EndpointParameterInstructions } from "./middleware-endpoint/types"; | ||
| export type { BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "./middleware-endpoint/types"; | ||
| export type { EndpointParameterInstructions, BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "@smithy/types"; |
@@ -1,4 +0,3 @@ | ||
| import type { EndpointParameters, EndpointV2, HandlerExecutionContext } from "@smithy/types"; | ||
| import type { EndpointParameterInstructions, EndpointParameters, EndpointV2, HandlerExecutionContext } from "@smithy/types"; | ||
| import type { EndpointResolvedConfig } from "../resolveEndpointConfig"; | ||
| import type { EndpointParameterInstructions } from "../types"; | ||
| /** | ||
@@ -17,6 +16,6 @@ * @internal | ||
| */ | ||
| export declare function bindGetEndpointFromInstructions(getEndpointFromConfig: GetEndpointFromConfig): <T extends EndpointParameters, CommandInput extends Record<string, unknown>, Config extends Record<string, unknown>>(commandInput: CommandInput, instructionsSupplier: EndpointParameterInstructionsSupplier, clientConfig: Partial<EndpointResolvedConfig<T>> & Config, context?: HandlerExecutionContext) => Promise<EndpointV2>; | ||
| export declare function bindGetEndpointFromInstructions(getEndpointFromConfig: GetEndpointFromConfig): <T extends EndpointParameters, CommandInput extends object, Config extends object>(commandInput: CommandInput, instructionsSupplier: EndpointParameterInstructionsSupplier, clientConfig: Partial<EndpointResolvedConfig<T>> & Config, context?: HandlerExecutionContext) => Promise<EndpointV2>; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const resolveParams: <T extends EndpointParameters, CommandInput extends Record<string, unknown>, Config extends Record<string, unknown>>(commandInput: CommandInput, instructionsSupplier: EndpointParameterInstructionsSupplier, clientConfig: Partial<EndpointResolvedConfig<T>> & Config) => Promise<EndpointParameters>; | ||
| export declare const resolveParams: <T extends EndpointParameters, CommandInput, Config>(commandInput: CommandInput, instructionsSupplier: EndpointParameterInstructionsSupplier, clientConfig: Partial<EndpointResolvedConfig<T>> & Config) => Promise<EndpointParameters>; |
@@ -1,5 +0,4 @@ | ||
| import type { EndpointParameters, SerializeMiddleware } from "@smithy/types"; | ||
| import type { EndpointParameterInstructions, EndpointParameters, SerializeMiddleware } from "@smithy/types"; | ||
| import { type GetEndpointFromConfig } from "./adaptors/getEndpointFromInstructions"; | ||
| import type { EndpointResolvedConfig } from "./resolveEndpointConfig"; | ||
| import type { EndpointParameterInstructions } from "./types"; | ||
| /** | ||
@@ -6,0 +5,0 @@ * @internal |
@@ -1,5 +0,4 @@ | ||
| import type { EndpointParameters, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types"; | ||
| import type { EndpointParameterInstructions, EndpointParameters, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types"; | ||
| import type { GetEndpointFromConfig } from "./adaptors/getEndpointFromInstructions"; | ||
| import type { EndpointResolvedConfig } from "./resolveEndpointConfig"; | ||
| import type { EndpointParameterInstructions } from "./types"; | ||
| /** | ||
@@ -6,0 +5,0 @@ * @internal |
+2
-2
| { | ||
| "name": "@smithy/core", | ||
| "version": "3.28.0", | ||
| "version": "3.29.0", | ||
| "scripts": { | ||
@@ -173,3 +173,3 @@ "benchmark:cbor": "node ./scripts/cbor-perf.mjs", | ||
| "dependencies": { | ||
| "@smithy/types": "^4.15.0", | ||
| "@smithy/types": "^4.15.1", | ||
| "tslib": "^2.6.2" | ||
@@ -176,0 +176,0 @@ }, |
| /** | ||
| * @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; | ||
| } |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1358775
0.12%34249
0.02%Updated