Skip to content

Commit d60afa0

Browse files
committed
rebase
1 parent 316c03a commit d60afa0

File tree

2 files changed

+0
-314
lines changed

2 files changed

+0
-314
lines changed

packages/smithy-client/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
"@smithy/middleware-stack": "workspace:^",
2828
"@smithy/protocol-http": "workspace:^",
2929
"@smithy/types": "workspace:^",
30-
"@smithy/middleware-endpoint": "workspace:^",
31-
"@smithy/protocol-http": "workspace:^",
3230
"@smithy/util-stream": "workspace:^",
3331
"tslib": "^2.5.0"
3432
},

packages/smithy-client/src/command.ts

Lines changed: 0 additions & 312 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
<<<<<<< HEAD
2-
<<<<<<< HEAD
31
import type { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
4-
=======
5-
import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
6-
>>>>>>> d3694aaca (command class builder)
7-
=======
8-
import type { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
9-
>>>>>>> 4c8f1da50 (fix: add check dependency script)
102
import { constructStack } from "@smithy/middleware-stack";
113
import type { HttpRequest } from "@smithy/protocol-http";
124
import type {
@@ -61,8 +53,6 @@ export abstract class Command<
6153
/**
6254
* @internal
6355
*/
64-
<<<<<<< HEAD
65-
<<<<<<< HEAD
6656
public resolveMiddlewareWithContext(
6757
clientStack: IMiddlewareStack<any, any>,
6858
configuration: { logger: Logger; requestHandler: RequestHandler<any, any, any> },
@@ -79,94 +69,6 @@ export abstract class Command<
7969
}: ResolveMiddlewareContextArgs
8070
) {
8171
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
82-
=======
83-
protected resolveBuilder() {
84-
const args: ResolveMiddlewareContextArgs = {
85-
middlewareQueue: [] as Pluggable<any, any>[],
86-
commandName: "",
87-
clientName: "",
88-
smithyContext: {},
89-
inputFilterSensitiveLog: () => {},
90-
outputFilterSensitiveLog: () => {},
91-
};
92-
return {
93-
/**
94-
* Add any number of middleware.
95-
*/
96-
m(...middleware: Pluggable<any, any>[]) {
97-
args.middlewareQueue.push(...middleware);
98-
return this;
99-
},
100-
/**
101-
* Set the context record.
102-
*/
103-
c(smithyContext: Record<string, unknown>) {
104-
args.smithyContext = smithyContext;
105-
return this;
106-
},
107-
/**
108-
* Set constant string identifiers for the operation.
109-
*/
110-
n(clientName: string, commandName: string) {
111-
args.clientName = clientName;
112-
args.commandName = commandName;
113-
return this;
114-
},
115-
/**
116-
* Set the input and output sensistive log filters.
117-
*/
118-
f(inputFilter: (_: any) => any = (_) => _, outputFilter: (_: any) => any = (_) => _) {
119-
args.inputFilterSensitiveLog = inputFilter;
120-
args.outputFilterSensitiveLog = outputFilter;
121-
return this;
122-
},
123-
/**
124-
* @returns the implementation of the built resolveMiddleware function.
125-
*/
126-
build: () => {
127-
return (
128-
clientStack: IMiddlewareStack<ClientInput, ClientOutput>,
129-
configuration: ResolvedClientConfiguration & {
130-
logger: Logger;
131-
requestHandler: RequestHandler<any, any, any>;
132-
},
133-
options: any
134-
) => {
135-
return this.__resolveMiddleware(clientStack, configuration, options, args);
136-
};
137-
},
138-
};
139-
}
140-
141-
/**
142-
* @internal
143-
*/
144-
protected __resolveMiddleware(
145-
clientStack: IMiddlewareStack<ClientInput, ClientOutput>,
146-
configuration: ResolvedClientConfiguration & { logger: Logger; requestHandler: RequestHandler<any, any, any> },
147-
=======
148-
public resolveMiddlewareWithContext(
149-
clientStack: IMiddlewareStack<any, any>,
150-
configuration: { logger: Logger; requestHandler: RequestHandler<any, any, any> },
151-
>>>>>>> d3694aaca (command class builder)
152-
options: any,
153-
{
154-
middlewareFn,
155-
clientName,
156-
commandName,
157-
inputFilterSensitiveLog,
158-
outputFilterSensitiveLog,
159-
smithyContext,
160-
additionalContext,
161-
CommandCtor,
162-
}: ResolveMiddlewareContextArgs
163-
) {
164-
<<<<<<< HEAD
165-
for (const mw of middlewareQueue) {
166-
>>>>>>> 74a500ee1 (feat: command codegen)
167-
=======
168-
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
169-
>>>>>>> d3694aaca (command class builder)
17072
this.middlewareStack.use(mw);
17173
}
17274
const stack = clientStack.concat(this.middlewareStack);
@@ -178,230 +80,16 @@ export abstract class Command<
17880
inputFilterSensitiveLog,
17981
outputFilterSensitiveLog,
18082
[SMITHY_CONTEXT_KEY]: {
181-
<<<<<<< HEAD
182-
<<<<<<< HEAD
18383
...smithyContext,
18484
},
18585
...additionalContext,
186-
<<<<<<< HEAD
187-
};
188-
const { requestHandler } = configuration;
189-
return stack.resolve(
190-
(request: FinalizeHandlerArguments<any>) => requestHandler.handle(request.request as HttpRequest, options || {}),
191-
handlerExecutionContext
192-
);
193-
}
194-
}
195-
196-
/**
197-
* @internal
198-
*/
199-
type ResolveMiddlewareContextArgs = {
200-
middlewareFn: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[];
201-
clientName: string;
202-
commandName: string;
203-
smithyContext: Record<string, unknown>;
204-
additionalContext: HandlerExecutionContext;
205-
inputFilterSensitiveLog: (_: any) => any;
206-
outputFilterSensitiveLog: (_: any) => any;
207-
CommandCtor: any /* Command constructor */;
208-
};
209-
210-
/**
211-
* @internal
212-
*/
213-
class ClassBuilder<
214-
I extends SI,
215-
O extends SO,
216-
C extends { logger: Logger; requestHandler: RequestHandler<any, any, any> },
217-
SI extends object = any,
218-
SO extends MetadataBearer = any
219-
> {
220-
private _init: (_: Command<I, O, C, SI, SO>) => void = () => {};
221-
private _ep: EndpointParameterInstructions = {};
222-
private _middlewareFn: (
223-
CommandCtor: any,
224-
clientStack: any,
225-
config: any,
226-
options: any
227-
) => Pluggable<any, any>[] = () => [];
228-
private _commandName = "";
229-
private _clientName = "";
230-
private _additionalContext = {} as HandlerExecutionContext;
231-
private _smithyContext = {} as Record<string, unknown>;
232-
private _inputFilterSensitiveLog = (_: any) => _;
233-
private _outputFilterSensitiveLog = (_: any) => _;
234-
private _serializer: (input: I, context: SerdeContext | any) => Promise<IHttpRequest> = null as any;
235-
private _deserializer: (output: IHttpResponse, context: SerdeContext | any) => Promise<O> = null as any;
236-
/**
237-
* Optional init callback.
238-
*/
239-
public init(cb: (_: Command<I, O, C, SI, SO>) => void) {
240-
this._init = cb;
241-
}
242-
/**
243-
* Set the endpoint parameter instructions.
244-
*/
245-
public ep(endpointParameterInstructions: EndpointParameterInstructions): ClassBuilder<I, O, C, SI, SO> {
246-
this._ep = endpointParameterInstructions;
247-
return this;
248-
}
249-
/**
250-
* Add any number of middleware.
251-
*/
252-
public m(
253-
middlewareSupplier: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[]
254-
): ClassBuilder<I, O, C, SI, SO> {
255-
this._middlewareFn = middlewareSupplier;
256-
return this;
257-
}
258-
/**
259-
* Set the initial handler execution context Smithy field.
260-
*/
261-
public s(
262-
service: string,
263-
operation: string,
264-
smithyContext: Record<string, unknown> = {}
265-
): ClassBuilder<I, O, C, SI, SO> {
266-
this._smithyContext = {
267-
service,
268-
operation,
269-
...smithyContext,
270-
};
271-
return this;
272-
}
273-
/**
274-
* Set the initial handler execution context.
275-
*/
276-
public c(additionalContext: HandlerExecutionContext = {}): ClassBuilder<I, O, C, SI, SO> {
277-
this._additionalContext = additionalContext;
278-
return this;
279-
}
280-
/**
281-
* Set constant string identifiers for the operation.
282-
*/
283-
public n(clientName: string, commandName: string): ClassBuilder<I, O, C, SI, SO> {
284-
this._clientName = clientName;
285-
this._commandName = commandName;
286-
return this;
287-
}
288-
/**
289-
* Set the input and output sensistive log filters.
290-
*/
291-
public f(
292-
inputFilter: (_: any) => any = (_) => _,
293-
outputFilter: (_: any) => any = (_) => _
294-
): ClassBuilder<I, O, C, SI, SO> {
295-
this._inputFilterSensitiveLog = inputFilter;
296-
this._outputFilterSensitiveLog = outputFilter;
297-
return this;
298-
}
299-
/**
300-
* Sets the serializer.
301-
*/
302-
public ser(
303-
serializer: (input: I, context?: SerdeContext | any) => Promise<IHttpRequest>
304-
): ClassBuilder<I, O, C, SI, SO> {
305-
this._serializer = serializer;
306-
return this;
307-
}
308-
/**
309-
* Sets the deserializer.
310-
*/
311-
public de(
312-
deserializer: (output: IHttpResponse, context?: SerdeContext | any) => Promise<O>
313-
): ClassBuilder<I, O, C, SI, SO> {
314-
this._deserializer = deserializer;
315-
return this;
316-
}
317-
/**
318-
* @returns a Command class with the classBuilder properties.
319-
*/
320-
public build(): {
321-
new (input: I): CommandImpl<I, O, C, SI, SO>;
322-
getEndpointParameterInstructions(): EndpointParameterInstructions;
323-
} {
324-
// eslint-disable-next-line @typescript-eslint/no-this-alias
325-
const closure = this;
326-
let CommandRef: any;
327-
328-
return (CommandRef = class extends Command<I, O, C, SI, SO> {
329-
/**
330-
* @public
331-
*/
332-
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
333-
return closure._ep;
334-
}
335-
336-
/**
337-
* @public
338-
*/
339-
public constructor(readonly input: I) {
340-
super();
341-
closure._init(this);
342-
}
343-
344-
/**
345-
* @internal
346-
*/
347-
public resolveMiddleware(stack: IMiddlewareStack<any, any>, configuration: C, options: any): Handler<any, any> {
348-
return this.resolveMiddlewareWithContext(stack, configuration, options, {
349-
CommandCtor: CommandRef,
350-
middlewareFn: closure._middlewareFn,
351-
clientName: closure._clientName,
352-
commandName: closure._commandName,
353-
inputFilterSensitiveLog: closure._inputFilterSensitiveLog,
354-
outputFilterSensitiveLog: closure._outputFilterSensitiveLog,
355-
smithyContext: closure._smithyContext,
356-
additionalContext: closure._additionalContext,
357-
});
358-
}
359-
360-
/**
361-
* @internal
362-
*/
363-
// @ts-ignore used in middlewareFn closure.
364-
public serialize = closure._serializer;
365-
366-
/**
367-
* @internal
368-
*/
369-
// @ts-ignore used in middlewareFn closure.
370-
public deserialize = closure._deserializer;
371-
});
372-
}
373-
}
374-
375-
/**
376-
* A concrete implementation of ICommand with no abstract members.
377-
* @public
378-
*/
379-
export interface CommandImpl<
380-
I extends SI,
381-
O extends SO,
382-
C extends { logger: Logger; requestHandler: RequestHandler<any, any, any> },
383-
SI extends object = any,
384-
SO extends MetadataBearer = any
385-
> extends Command<I, O, C, SI, SO> {
386-
readonly input: I;
387-
resolveMiddleware(stack: IMiddlewareStack<SI, SO>, configuration: C, options: any): Handler<I, O>;
388-
=======
389-
service,
390-
operation,
391-
=======
392-
...smithyContext,
393-
>>>>>>> 8fc21143c (update ts pkg)
394-
},
395-
=======
396-
>>>>>>> d3694aaca (command class builder)
39786
};
39887
const { requestHandler } = configuration;
39988
return stack.resolve(
40089
(request: FinalizeHandlerArguments<any>) => requestHandler.handle(request.request as HttpRequest, options || {}),
40190
handlerExecutionContext
40291
);
40392
}
404-
>>>>>>> 74a500ee1 (feat: command codegen)
40593
}
40694

40795
/**

0 commit comments

Comments
 (0)