@smithy/core 3.28.0 → 3.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1090,6 +1090,23 @@ const _json = (obj) => {
1090
1090
  return obj;
1091
1091
  };
1092
1092
 
1093
+ function makeBuilder(common, service, name, ep) {
1094
+ return function makeCommand(added, plugins, op, $, smithyContext = {}) {
1095
+ const epMerged = Object.assign({}, common, added);
1096
+ return Command.classBuilder()
1097
+ .ep(epMerged)
1098
+ .m(function (CommandCtor, clientStack, config, options) {
1099
+ const list = plugins.call(this, CommandCtor, clientStack, config, options);
1100
+ list.unshift(ep(config, CommandCtor.getEndpointParameterInstructions()));
1101
+ return list;
1102
+ })
1103
+ .s(service, op, smithyContext)
1104
+ .n(name, op.charAt(0).toUpperCase() + op.slice(1) + "Command")
1105
+ .sc($)
1106
+ .build();
1107
+ };
1108
+ }
1109
+
1093
1110
  exports.Client = Client;
1094
1111
  exports.Command = Command;
1095
1112
  exports.NoOpLogger = NoOpLogger;
@@ -1114,6 +1131,7 @@ exports.invalidFunction = invalidFunction;
1114
1131
  exports.invalidProvider = invalidProvider;
1115
1132
  exports.isSerializableHeaderValue = isSerializableHeaderValue;
1116
1133
  exports.loadConfigsForDefaultMode = loadConfigsForDefaultMode;
1134
+ exports.makeBuilder = makeBuilder;
1117
1135
  exports.map = map;
1118
1136
  exports.resolveChecksumRuntimeConfig = resolveChecksumRuntimeConfig;
1119
1137
  exports.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;
@@ -2,7 +2,7 @@ const { createHmac, createHash, getRandomValues } = require("node:crypto");
2
2
  const { ReadStream, lstatSync, fstatSync } = require("node:fs");
3
3
  const { HttpResponse } = require("@smithy/core/transport");
4
4
  const { toEndpointV1 } = require("@smithy/core/endpoints");
5
- const { Duplex, Readable, Writable, PassThrough } = require("node:stream");
5
+ const { Readable, Writable, PassThrough } = require("node:stream");
6
6
 
7
7
  const isArrayBuffer = (arg) => (typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer) ||
8
8
  Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
@@ -987,62 +987,66 @@ function castSourceData(toCast, encoding) {
987
987
  return fromArrayBuffer(toCast);
988
988
  }
989
989
 
990
- let ChecksumStream$1 = class ChecksumStream extends Duplex {
990
+ let ChecksumStream$1 = class ChecksumStream extends Readable {
991
991
  expectedChecksum;
992
992
  checksumSourceLocation;
993
993
  checksum;
994
994
  source;
995
995
  base64Encoder;
996
- pendingCallback = null;
997
996
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }) {
998
997
  super();
999
- if (typeof source.pipe === "function") {
1000
- this.source = source;
1001
- }
1002
- else {
998
+ if (typeof source.pipe !== "function") {
1003
999
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
1004
1000
  }
1001
+ this.source = source;
1005
1002
  this.base64Encoder = base64Encoder ?? toBase64$1;
1006
1003
  this.expectedChecksum = expectedChecksum;
1007
1004
  this.checksum = checksum;
1008
1005
  this.checksumSourceLocation = checksumSourceLocation;
1009
- this.source.pipe(this);
1006
+ this.source.on("data", this.onSourceData);
1007
+ this.source.on("end", this.onSourceEnd);
1008
+ this.source.on("error", this.onSourceError);
1009
+ this.source.pause();
1010
1010
  }
1011
- _read(size) {
1012
- if (this.pendingCallback) {
1013
- const callback = this.pendingCallback;
1014
- this.pendingCallback = null;
1015
- callback();
1011
+ onSourceData = (chunk) => {
1012
+ if (this.destroyed) {
1013
+ return;
1016
1014
  }
1017
- }
1018
- _write(chunk, encoding, callback) {
1019
1015
  try {
1020
1016
  this.checksum.update(chunk);
1021
- const canPushMore = this.push(chunk);
1022
- if (!canPushMore) {
1023
- this.pendingCallback = callback;
1024
- return;
1025
- }
1026
1017
  }
1027
1018
  catch (e) {
1028
- return callback(e);
1019
+ this.destroy(e);
1020
+ return;
1021
+ }
1022
+ if (!this.push(chunk)) {
1023
+ this.source.pause();
1024
+ }
1025
+ };
1026
+ onSourceEnd = async () => {
1027
+ if (this.destroyed) {
1028
+ return;
1029
1029
  }
1030
- return callback();
1031
- }
1032
- async _final(callback) {
1033
1030
  try {
1034
1031
  const digest = await this.checksum.digest();
1035
1032
  const received = this.base64Encoder(digest);
1036
1033
  if (this.expectedChecksum !== received) {
1037
- return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` +
1034
+ this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` +
1038
1035
  ` in response header "${this.checksumSourceLocation}".`));
1036
+ return;
1039
1037
  }
1040
1038
  }
1041
1039
  catch (e) {
1042
- return callback(e);
1040
+ this.destroy(e);
1041
+ return;
1043
1042
  }
1044
1043
  this.push(null);
1045
- return callback();
1044
+ };
1045
+ onSourceError = (error) => {
1046
+ this.destroy(error);
1047
+ };
1048
+ _read(size) {
1049
+ this.source.resume();
1046
1050
  }
1047
1051
  _destroy(error, callback) {
1048
1052
  this.source?.destroy();
@@ -24,3 +24,4 @@ export { map, convertMap, take, } from "./smithy-client/object-mapping";
24
24
  export { schemaLogFilter } from "./smithy-client/schemaLogFilter";
25
25
  export { serializeFloat, serializeDateTime } from "./smithy-client/ser-utils";
26
26
  export { _json } from "./smithy-client/serde-json";
27
+ export { makeBuilder } from "./smithy-client/client-command-builder";
@@ -0,0 +1,17 @@
1
+ import { Command } from "./command";
2
+ export function makeBuilder(common, service, name, ep) {
3
+ return function makeCommand(added, plugins, op, $, smithyContext = {}) {
4
+ const epMerged = Object.assign({}, common, added);
5
+ return Command.classBuilder()
6
+ .ep(epMerged)
7
+ .m(function (CommandCtor, clientStack, config, options) {
8
+ const list = plugins.call(this, CommandCtor, clientStack, config, options);
9
+ list.unshift(ep(config, CommandCtor.getEndpointParameterInstructions()));
10
+ return list;
11
+ })
12
+ .s(service, op, smithyContext)
13
+ .n(name, op.charAt(0).toUpperCase() + op.slice(1) + "Command")
14
+ .sc($)
15
+ .build();
16
+ };
17
+ }
@@ -1,61 +1,65 @@
1
- import { Duplex } from "node:stream";
1
+ import { Readable } from "node:stream";
2
2
  import { toBase64 } from "../../util-base64/toBase64";
3
- export class ChecksumStream extends Duplex {
3
+ export class ChecksumStream extends Readable {
4
4
  expectedChecksum;
5
5
  checksumSourceLocation;
6
6
  checksum;
7
7
  source;
8
8
  base64Encoder;
9
- pendingCallback = null;
10
9
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }) {
11
10
  super();
12
- if (typeof source.pipe === "function") {
13
- this.source = source;
14
- }
15
- else {
11
+ if (typeof source.pipe !== "function") {
16
12
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
17
13
  }
14
+ this.source = source;
18
15
  this.base64Encoder = base64Encoder ?? toBase64;
19
16
  this.expectedChecksum = expectedChecksum;
20
17
  this.checksum = checksum;
21
18
  this.checksumSourceLocation = checksumSourceLocation;
22
- this.source.pipe(this);
19
+ this.source.on("data", this.onSourceData);
20
+ this.source.on("end", this.onSourceEnd);
21
+ this.source.on("error", this.onSourceError);
22
+ this.source.pause();
23
23
  }
24
- _read(size) {
25
- if (this.pendingCallback) {
26
- const callback = this.pendingCallback;
27
- this.pendingCallback = null;
28
- callback();
24
+ onSourceData = (chunk) => {
25
+ if (this.destroyed) {
26
+ return;
29
27
  }
30
- }
31
- _write(chunk, encoding, callback) {
32
28
  try {
33
29
  this.checksum.update(chunk);
34
- const canPushMore = this.push(chunk);
35
- if (!canPushMore) {
36
- this.pendingCallback = callback;
37
- return;
38
- }
39
30
  }
40
31
  catch (e) {
41
- return callback(e);
32
+ this.destroy(e);
33
+ return;
34
+ }
35
+ if (!this.push(chunk)) {
36
+ this.source.pause();
37
+ }
38
+ };
39
+ onSourceEnd = async () => {
40
+ if (this.destroyed) {
41
+ return;
42
42
  }
43
- return callback();
44
- }
45
- async _final(callback) {
46
43
  try {
47
44
  const digest = await this.checksum.digest();
48
45
  const received = this.base64Encoder(digest);
49
46
  if (this.expectedChecksum !== received) {
50
- return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` +
47
+ this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` +
51
48
  ` in response header "${this.checksumSourceLocation}".`));
49
+ return;
52
50
  }
53
51
  }
54
52
  catch (e) {
55
- return callback(e);
53
+ this.destroy(e);
54
+ return;
56
55
  }
57
56
  this.push(null);
58
- return callback();
57
+ };
58
+ onSourceError = (error) => {
59
+ this.destroy(error);
60
+ };
61
+ _read(size) {
62
+ this.source.resume();
59
63
  }
60
64
  _destroy(error, callback) {
61
65
  this.source?.destroy();
@@ -24,3 +24,4 @@ export { map, convertMap, take, type ObjectMappingInstructions, type SourceMappi
24
24
  export { schemaLogFilter } from "./smithy-client/schemaLogFilter";
25
25
  export { serializeFloat, serializeDateTime } from "./smithy-client/ser-utils";
26
26
  export { _json } from "./smithy-client/serde-json";
27
+ export { makeBuilder } from "./smithy-client/client-command-builder";
@@ -0,0 +1,22 @@
1
+ import type { EndpointParameterInstructions, Logger, MetadataBearer, OptionalParameter, Pluggable, RequestHandler, StaticOperationSchema } from "@smithy/types";
2
+ import { type CommandImpl } from "./command";
3
+ /**
4
+ * Higher order factory for Command builders specific to a client.
5
+ * Produces a command factory that creates Command classes with
6
+ * pre-configured endpoint params, middleware, and schema.
7
+ *
8
+ * @param common - common endpoint params.
9
+ * @param service - service shape name.
10
+ * @param name - SDK Client Name.
11
+ * @param ep - endpoint plugin provider.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare function makeBuilder<C extends {
16
+ logger?: Logger;
17
+ requestHandler: RequestHandler<any, any, any>;
18
+ }, 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>) => {
19
+ new (input: I): CommandImpl<I, O, C, SI, SO>;
20
+ new (...[input]: OptionalParameter<I>): CommandImpl<I, O, C, SI, SO>;
21
+ getEndpointParameterInstructions(): EndpointParameterInstructions;
22
+ };
@@ -1,5 +1,4 @@
1
- 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";
2
- type EndpointParameterInstructions = Record<string, unknown>;
1
+ 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";
3
2
  /**
4
3
  * @public
5
4
  */
@@ -12,7 +11,7 @@ export declare abstract class Command<Input extends ClientInput, Output extends
12
11
  * @internal
13
12
  */
14
13
  static classBuilder<I extends SI, O extends SO, C extends {
15
- logger: Logger;
14
+ logger?: Logger;
16
15
  requestHandler: RequestHandler<any, any, any>;
17
16
  }, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>;
18
17
  abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
@@ -20,7 +19,7 @@ export declare abstract class Command<Input extends ClientInput, Output extends
20
19
  * @internal
21
20
  */
22
21
  resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: {
23
- logger: Logger;
22
+ logger?: Logger;
24
23
  requestHandler: RequestHandler<any, any, any>;
25
24
  }, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>;
26
25
  }
@@ -41,7 +40,7 @@ type ResolveMiddlewareContextArgs = {
41
40
  * @internal
42
41
  */
43
42
  declare class ClassBuilder<I extends SI, O extends SO, C extends {
44
- logger: Logger;
43
+ logger?: Logger;
45
44
  requestHandler: RequestHandler<any, any, any>;
46
45
  }, SI extends object = any, SO extends MetadataBearer = any> {
47
46
  private _init;
@@ -110,7 +109,7 @@ declare class ClassBuilder<I extends SI, O extends SO, C extends {
110
109
  * @public
111
110
  */
112
111
  export interface CommandImpl<I extends SI, O extends SO, C extends {
113
- logger: Logger;
112
+ logger?: Logger;
114
113
  requestHandler: RequestHandler<any, any, any>;
115
114
  }, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> {
116
115
  readonly input: I;
@@ -7,18 +7,17 @@ export { isValidHostLabel } from "@smithy/core/transport";
7
7
  export { customEndpointFunctions } from "./util-endpoints/utils/customEndpointFunctions";
8
8
  export { resolveEndpoint } from "./util-endpoints/resolveEndpoint";
9
9
  export * from "./util-endpoints/types";
10
- 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>;
10
+ 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>;
11
11
  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>;
12
12
  export declare const endpointMiddleware: <T extends import("@smithy/types").EndpointParameters>({ config, instructions, }: {
13
13
  config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>;
14
- instructions: import("./middleware-endpoint/types").EndpointParameterInstructions;
14
+ instructions: import("@smithy/types").EndpointParameterInstructions;
15
15
  }) => import("@smithy/types").SerializeMiddleware<any, any>;
16
- 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>;
16
+ 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>;
17
17
  export { resolveParams, type EndpointParameterInstructionsSupplier, } from "./middleware-endpoint/adaptors/getEndpointFromInstructions";
18
18
  export { toEndpointV1 as middlewareEndpointToEndpointV1 } from "./middleware-endpoint/adaptors/toEndpointV1";
19
19
  export { endpointMiddlewareOptions } from "./middleware-endpoint/getEndpointPlugin";
20
20
  export type { EndpointInputConfig, EndpointResolvedConfig } from "./middleware-endpoint/resolveEndpointConfig";
21
21
  export { resolveEndpointRequiredConfig } from "./middleware-endpoint/resolveEndpointRequiredConfig";
22
22
  export type { EndpointRequiredInputConfig, EndpointRequiredResolvedConfig, } from "./middleware-endpoint/resolveEndpointRequiredConfig";
23
- export type { EndpointParameterInstructions } from "./middleware-endpoint/types";
24
- export type { BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "./middleware-endpoint/types";
23
+ export type { EndpointParameterInstructions, BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "@smithy/types";
@@ -7,18 +7,17 @@ export { isValidHostLabel } from "@smithy/core/transport";
7
7
  export { customEndpointFunctions } from "./util-endpoints/utils/customEndpointFunctions";
8
8
  export { resolveEndpoint } from "./util-endpoints/resolveEndpoint";
9
9
  export * from "./util-endpoints/types";
10
- 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>;
10
+ 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>;
11
11
  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>;
12
12
  export declare const endpointMiddleware: <T extends import("@smithy/types").EndpointParameters>({ config, instructions, }: {
13
13
  config: import("./middleware-endpoint/resolveEndpointConfig").EndpointResolvedConfig<T>;
14
- instructions: import("./middleware-endpoint/types").EndpointParameterInstructions;
14
+ instructions: import("@smithy/types").EndpointParameterInstructions;
15
15
  }) => import("@smithy/types").SerializeMiddleware<any, any>;
16
- 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>;
16
+ 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>;
17
17
  export { resolveParams, type EndpointParameterInstructionsSupplier, } from "./middleware-endpoint/adaptors/getEndpointFromInstructions";
18
18
  export { toEndpointV1 as middlewareEndpointToEndpointV1 } from "./middleware-endpoint/adaptors/toEndpointV1";
19
19
  export { endpointMiddlewareOptions } from "./middleware-endpoint/getEndpointPlugin";
20
20
  export type { EndpointInputConfig, EndpointResolvedConfig } from "./middleware-endpoint/resolveEndpointConfig";
21
21
  export { resolveEndpointRequiredConfig } from "./middleware-endpoint/resolveEndpointRequiredConfig";
22
22
  export type { EndpointRequiredInputConfig, EndpointRequiredResolvedConfig, } from "./middleware-endpoint/resolveEndpointRequiredConfig";
23
- export type { EndpointParameterInstructions } from "./middleware-endpoint/types";
24
- export type { BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "./middleware-endpoint/types";
23
+ export type { EndpointParameterInstructions, BuiltInParamInstruction, ClientContextParamInstruction, ContextParamInstruction, OperationContextParamInstruction, StaticContextParamInstruction, } from "@smithy/types";
@@ -1,6 +1,5 @@
1
- import type { EndpointParameters, EndpointV2, HandlerExecutionContext } from "@smithy/types";
1
+ import type { EndpointParameterInstructions, EndpointParameters, EndpointV2, HandlerExecutionContext } from "@smithy/types";
2
2
  import type { EndpointResolvedConfig } from "../resolveEndpointConfig";
3
- import type { EndpointParameterInstructions } from "../types";
4
3
  /**
5
4
  * @internal
6
5
  */
@@ -14,8 +13,8 @@ export type GetEndpointFromConfig = (serviceId?: string) => Promise<string | und
14
13
  /**
15
14
  * @internal
16
15
  */
17
- 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>;
16
+ 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>;
18
17
  /**
19
18
  * @internal
20
19
  */
21
- 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>;
20
+ export declare const resolveParams: <T extends EndpointParameters, CommandInput, Config>(commandInput: CommandInput, instructionsSupplier: EndpointParameterInstructionsSupplier, clientConfig: Partial<EndpointResolvedConfig<T>> & Config) => Promise<EndpointParameters>;
@@ -1,7 +1,6 @@
1
- import type { EndpointParameters, SerializeMiddleware } from "@smithy/types";
1
+ import type { EndpointParameterInstructions, EndpointParameters, SerializeMiddleware } from "@smithy/types";
2
2
  import { type GetEndpointFromConfig } from "./adaptors/getEndpointFromInstructions";
3
3
  import type { EndpointResolvedConfig } from "./resolveEndpointConfig";
4
- import type { EndpointParameterInstructions } from "./types";
5
4
  /**
6
5
  * @internal
7
6
  */
@@ -1,7 +1,6 @@
1
- import type { EndpointParameters, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
1
+ import type { EndpointParameterInstructions, EndpointParameters, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
2
2
  import type { GetEndpointFromConfig } from "./adaptors/getEndpointFromInstructions";
3
3
  import type { EndpointResolvedConfig } from "./resolveEndpointConfig";
4
- import type { EndpointParameterInstructions } from "./types";
5
4
  /**
6
5
  * @internal
7
6
  */
@@ -1,4 +1,4 @@
1
- import { Duplex, type Readable } from "node:stream";
1
+ import { Readable } from "node:stream";
2
2
  import type { Checksum, Encoder } from "@smithy/types";
3
3
  /**
4
4
  * @internal
@@ -29,34 +29,42 @@ export interface ChecksumStreamInit<T extends Readable | ReadableStream> {
29
29
  * Wrapper for throwing checksum errors for streams without
30
30
  * buffering the stream.
31
31
  *
32
+ * Note: this effectively behaves as a duplex, reading from the source on one
33
+ * side and forwarding chunks to its own readable side on the other. It should
34
+ * not be rewritten back into a Duplex (or Transform). The source is observed
35
+ * and driven manually (pause/resume in onSourceData/_read) so data is pulled
36
+ * at the rate it is consumed and never buffered twice; this manual control is
37
+ * used deliberately for performance and would be lost with the built-in duplex
38
+ * machinery.
39
+ *
32
40
  * @internal
33
41
  */
34
- export declare class ChecksumStream extends Duplex {
42
+ export declare class ChecksumStream extends Readable {
35
43
  private expectedChecksum;
36
44
  private checksumSourceLocation;
37
45
  private checksum;
38
- private source?;
46
+ private source;
39
47
  private base64Encoder;
40
- private pendingCallback;
41
48
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }: ChecksumStreamInit<Readable>);
42
49
  /**
43
- * Do not call this directly.
44
- * @internal
50
+ * Update the checksum and forward each source chunk to the readable side,
51
+ * pausing the source when the readable side signals backpressure.
45
52
  */
46
- _read(size: number): void;
53
+ private onSourceData;
47
54
  /**
48
- * When the upstream source flows data to this stream,
49
- * calculate a step update of the checksum.
50
- * Do not call this directly.
51
- * @internal
55
+ * When the source finishes, perform the checksum comparison and end this stream.
56
+ */
57
+ private onSourceEnd;
58
+ /**
59
+ * Surface source errors on this stream.
52
60
  */
53
- _write(chunk: Buffer, encoding: string, callback: (err?: Error) => void): void;
61
+ private onSourceError;
54
62
  /**
55
- * When the upstream source finishes, perform the checksum comparison.
63
+ * Resume the source so it flows at the rate this stream is consumed.
56
64
  * Do not call this directly.
57
65
  * @internal
58
66
  */
59
- _final(callback: (err?: Error) => void): Promise<void>;
67
+ _read(size: number): void;
60
68
  /**
61
69
  * Destroy the upstream source for cleanup so it is not left dangling, then
62
70
  * complete this stream's destruction. The error is intentionally not forwarded
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.28.0",
3
+ "version": "3.29.1",
4
4
  "scripts": {
5
5
  "benchmark:cbor": "node ./scripts/cbor-perf.mjs",
6
6
  "benchmark:checksum": "node ./scripts/checksum-perf.mjs",
@@ -170,7 +170,7 @@
170
170
  "license": "Apache-2.0",
171
171
  "sideEffects": false,
172
172
  "dependencies": {
173
- "@smithy/types": "^4.15.0",
173
+ "@smithy/types": "^4.15.1",
174
174
  "tslib": "^2.6.2"
175
175
  },
176
176
  "devDependencies": {
@@ -1,41 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export interface EndpointParameterInstructions {
5
- [name: string]: BuiltInParamInstruction | ClientContextParamInstruction | StaticContextParamInstruction | ContextParamInstruction | OperationContextParamInstruction;
6
- }
7
- /**
8
- * @internal
9
- */
10
- export interface BuiltInParamInstruction {
11
- type: "builtInParams";
12
- name: string;
13
- }
14
- /**
15
- * @internal
16
- */
17
- export interface ClientContextParamInstruction {
18
- type: "clientContextParams";
19
- name: string;
20
- }
21
- /**
22
- * @internal
23
- */
24
- export interface StaticContextParamInstruction {
25
- type: "staticContextParams";
26
- value: string | boolean;
27
- }
28
- /**
29
- * @internal
30
- */
31
- export interface ContextParamInstruction {
32
- type: "contextParams";
33
- name: string;
34
- }
35
- /**
36
- * @internal
37
- */
38
- export interface OperationContextParamInstruction {
39
- type: "operationContextParams";
40
- get(input: any): any;
41
- }