@@ -76,29 +76,45 @@ export abstract class Command<
76
76
middlewareQueue : [ ] as Pluggable < any , any > [ ] ,
77
77
commandName : "" ,
78
78
clientName : "" ,
79
- service : "" ,
80
- operation : "" ,
79
+ smithyContext : { } ,
81
80
inputFilterSensitiveLog : ( ) => { } ,
82
81
outputFilterSensitiveLog : ( ) => { } ,
83
82
} ;
84
83
return {
84
+ /**
85
+ * Add any number of middleware.
86
+ */
85
87
m ( ...middleware : Pluggable < any , any > [ ] ) {
86
88
args . middlewareQueue . push ( ...middleware ) ;
87
89
return this ;
88
90
} ,
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 ) {
90
102
args . clientName = clientName ;
91
103
args . commandName = commandName ;
92
- args . service = service ;
93
- args . operation = operation ;
94
104
return this ;
95
105
} ,
106
+ /**
107
+ * Set the input and output sensistive log filters.
108
+ */
96
109
f ( inputFilter : ( _ : any ) => any = ( _ ) => _ , outputFilter : ( _ : any ) => any = ( _ ) => _ ) {
97
110
args . inputFilterSensitiveLog = inputFilter ;
98
111
args . outputFilterSensitiveLog = outputFilter ;
99
112
return this ;
100
113
} ,
101
- build ( ) {
114
+ /**
115
+ * @returns the implementation of the built resolveMiddleware function.
116
+ */
117
+ build : ( ) => {
102
118
return (
103
119
clientStack : IMiddlewareStack < ClientInput , ClientOutput > ,
104
120
configuration : ResolvedClientConfiguration & {
@@ -107,7 +123,7 @@ export abstract class Command<
107
123
} ,
108
124
options : any
109
125
) => {
110
- this . __resolveMiddleware ( clientStack , configuration , options , args ) ;
126
+ return this . __resolveMiddleware ( clientStack , configuration , options , args ) ;
111
127
} ;
112
128
} ,
113
129
} ;
@@ -124,10 +140,9 @@ export abstract class Command<
124
140
middlewareQueue,
125
141
clientName,
126
142
commandName,
127
- service,
128
- operation,
129
143
inputFilterSensitiveLog,
130
144
outputFilterSensitiveLog,
145
+ smithyContext,
131
146
} : ResolveMiddlewareContextArgs
132
147
) {
133
148
for ( const mw of middlewareQueue ) {
@@ -143,6 +158,7 @@ export abstract class Command<
143
158
inputFilterSensitiveLog,
144
159
outputFilterSensitiveLog,
145
160
[ SMITHY_CONTEXT_KEY ] : {
161
+ < << << << HEAD
146
162
< < << << < HEAD
147
163
...smithyContext ,
148
164
} ,
@@ -351,6 +367,9 @@ export interface CommandImpl<
351
367
=== === =
352
368
service ,
353
369
operation ,
370
+ === === =
371
+ ...smithyContext ,
372
+ > >>> >>> 8 fc21143c ( update ts pkg )
354
373
} ,
355
374
} ;
356
375
const { requestHandler } = configuration ;
@@ -370,8 +389,7 @@ type ResolveMiddlewareContextArgs = {
370
389
middlewareQueue : Pluggable < any , any > [ ] ;
371
390
clientName : string ;
372
391
commandName : string ;
373
- service : string ;
374
- operation : string ;
392
+ smithyContext : Record < string , unknown > ;
375
393
inputFilterSensitiveLog : ( _ : any ) => any ;
376
394
outputFilterSensitiveLog : ( _ : any ) => any ;
377
395
} ;
0 commit comments