Skip to content

Commit ec497f4

Browse files
committed
update ts pkg
1 parent 44f952a commit ec497f4

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

packages/smithy-client/src/command.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,45 @@ export abstract class Command<
7676
middlewareQueue: [] as Pluggable<any, any>[],
7777
commandName: "",
7878
clientName: "",
79-
service: "",
80-
operation: "",
79+
smithyContext: {},
8180
inputFilterSensitiveLog: () => {},
8281
outputFilterSensitiveLog: () => {},
8382
};
8483
return {
84+
/**
85+
* Add any number of middleware.
86+
*/
8587
m(...middleware: Pluggable<any, any>[]) {
8688
args.middlewareQueue.push(...middleware);
8789
return this;
8890
},
89-
n(clientName: string, commandName: string, service: string, operation: string) {
91+
/**
92+
* Set the Smithy context record.
93+
*/
94+
sc(smithyContext: Record<string, unknown>) {
95+
args.smithyContext = smithyContext;
96+
return this;
97+
},
98+
/**
99+
* Set constant string identifiers for the operation.
100+
*/
101+
n(clientName: string, commandName: string) {
90102
args.clientName = clientName;
91103
args.commandName = commandName;
92-
args.service = service;
93-
args.operation = operation;
94104
return this;
95105
},
106+
/**
107+
* Set the input and output sensistive log filters.
108+
*/
96109
f(inputFilter: (_: any) => any = (_) => _, outputFilter: (_: any) => any = (_) => _) {
97110
args.inputFilterSensitiveLog = inputFilter;
98111
args.outputFilterSensitiveLog = outputFilter;
99112
return this;
100113
},
101-
build() {
114+
/**
115+
* @returns the implementation of the built resolveMiddleware function.
116+
*/
117+
build: () => {
102118
return (
103119
clientStack: IMiddlewareStack<ClientInput, ClientOutput>,
104120
configuration: ResolvedClientConfiguration & {
@@ -107,7 +123,7 @@ export abstract class Command<
107123
},
108124
options: any
109125
) => {
110-
this.__resolveMiddleware(clientStack, configuration, options, args);
126+
return this.__resolveMiddleware(clientStack, configuration, options, args);
111127
};
112128
},
113129
};
@@ -124,10 +140,9 @@ export abstract class Command<
124140
middlewareQueue,
125141
clientName,
126142
commandName,
127-
service,
128-
operation,
129143
inputFilterSensitiveLog,
130144
outputFilterSensitiveLog,
145+
smithyContext,
131146
}: ResolveMiddlewareContextArgs
132147
) {
133148
for (const mw of middlewareQueue) {
@@ -143,6 +158,7 @@ export abstract class Command<
143158
inputFilterSensitiveLog,
144159
outputFilterSensitiveLog,
145160
[SMITHY_CONTEXT_KEY]: {
161+
<<<<<<< HEAD
146162
<<<<<<< HEAD
147163
...smithyContext,
148164
},
@@ -351,6 +367,9 @@ export interface CommandImpl<
351367
=======
352368
service,
353369
operation,
370+
=======
371+
...smithyContext,
372+
>>>>>>> 8fc21143c (update ts pkg)
354373
},
355374
};
356375
const { requestHandler } = configuration;
@@ -370,8 +389,7 @@ type ResolveMiddlewareContextArgs = {
370389
middlewareQueue: Pluggable<any, any>[];
371390
clientName: string;
372391
commandName: string;
373-
service: string;
374-
operation: string;
392+
smithyContext: Record<string, unknown>;
375393
inputFilterSensitiveLog: (_: any) => any;
376394
outputFilterSensitiveLog: (_: any) => any;
377395
};

0 commit comments

Comments
 (0)