@cdk8s/awscdk-resolver 0.0.161 → 0.0.162
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.
- package/.jsii +2 -2
- package/lib/resolve.js +1 -1
- package/node_modules/@smithy/abort-controller/package.json +2 -2
- package/node_modules/@smithy/config-resolver/package.json +4 -4
- package/node_modules/@smithy/core/package.json +8 -8
- package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
- package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
- package/node_modules/@smithy/hash-node/package.json +2 -2
- package/node_modules/@smithy/invalid-dependency/package.json +2 -2
- package/node_modules/@smithy/middleware-content-length/package.json +4 -4
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +16 -2
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +7 -1
- package/node_modules/@smithy/middleware-endpoint/dist-es/resolveEndpointConfig.js +10 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/adaptors/getEndpointFromConfig.d.ts +4 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +11 -0
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/adaptors/getEndpointFromConfig.d.ts +4 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +11 -0
- package/node_modules/@smithy/middleware-endpoint/package.json +7 -7
- package/node_modules/@smithy/middleware-retry/package.json +9 -9
- package/node_modules/@smithy/middleware-serde/package.json +3 -3
- package/node_modules/@smithy/middleware-stack/package.json +2 -2
- package/node_modules/@smithy/node-config-provider/package.json +4 -4
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +86 -46
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +10 -10
- package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +27 -13
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +18 -5
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +12 -4
- package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +2 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -1
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/property-provider/package.json +2 -2
- package/node_modules/@smithy/protocol-http/package.json +2 -2
- package/node_modules/@smithy/querystring-builder/package.json +2 -2
- package/node_modules/@smithy/querystring-parser/package.json +2 -2
- package/node_modules/@smithy/service-error-classification/package.json +2 -2
- package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +4 -4
- package/node_modules/@smithy/smithy-client/dist-cjs/index.js +21 -4
- package/node_modules/@smithy/smithy-client/dist-es/client.js +22 -4
- package/node_modules/@smithy/smithy-client/dist-types/client.d.ts +22 -1
- package/node_modules/@smithy/smithy-client/dist-types/ts3.4/client.d.ts +22 -1
- package/node_modules/@smithy/smithy-client/package.json +6 -6
- package/node_modules/@smithy/types/README.md +36 -1
- package/node_modules/@smithy/types/dist-types/command.d.ts +14 -1
- package/node_modules/@smithy/types/dist-types/endpoint.d.ts +1 -1
- package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +6 -6
- package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +12 -6
- package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +8 -3
- package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +14 -1
- package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +1 -1
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +6 -6
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +8 -10
- package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +6 -9
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@smithy/url-parser/package.json +3 -3
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@smithy/util-endpoints/dist-cjs/cache/EndpointCache.js +1 -0
- package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +73 -11
- package/node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js +49 -0
- package/node_modules/@smithy/util-endpoints/dist-es/index.js +1 -0
- package/node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js +0 -10
- package/node_modules/@smithy/util-endpoints/dist-types/cache/EndpointCache.d.ts +34 -0
- package/node_modules/@smithy/util-endpoints/dist-types/index.d.ts +1 -0
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/cache/EndpointCache.d.ts +34 -0
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/index.d.ts +1 -0
- package/node_modules/@smithy/util-endpoints/package.json +3 -3
- package/node_modules/@smithy/util-middleware/package.json +2 -2
- package/node_modules/@smithy/util-retry/package.json +3 -3
- package/node_modules/@smithy/util-stream/package.json +5 -5
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/package.json +2 -2
@@ -10,6 +10,22 @@ export interface SmithyConfiguration<HandlerOptions> {
|
|
10
10
|
* @internal
|
11
11
|
*/
|
12
12
|
readonly apiVersion: string;
|
13
|
+
/**
|
14
|
+
* @public
|
15
|
+
*
|
16
|
+
* Default false.
|
17
|
+
*
|
18
|
+
* When true, the client will only resolve the middleware stack once per
|
19
|
+
* Command class. This means modifying the middlewareStack of the
|
20
|
+
* command or client after requests have been made will not be
|
21
|
+
* recognized.
|
22
|
+
*
|
23
|
+
* Calling client.destroy() also clears this cache.
|
24
|
+
*
|
25
|
+
* Enable this only if needing the additional time saved (0-1ms per request)
|
26
|
+
* and not needing middleware modifications between requests.
|
27
|
+
*/
|
28
|
+
cacheMiddleware?: boolean;
|
13
29
|
}
|
14
30
|
/**
|
15
31
|
* @internal
|
@@ -17,13 +33,18 @@ export interface SmithyConfiguration<HandlerOptions> {
|
|
17
33
|
export type SmithyResolvedConfiguration<HandlerOptions> = {
|
18
34
|
requestHandler: RequestHandler<any, any, HandlerOptions>;
|
19
35
|
readonly apiVersion: string;
|
36
|
+
cacheMiddleware?: boolean;
|
20
37
|
};
|
21
38
|
/**
|
22
39
|
* @public
|
23
40
|
*/
|
24
41
|
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
|
25
|
-
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
|
26
42
|
readonly config: ResolvedClientConfiguration;
|
43
|
+
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
|
44
|
+
/**
|
45
|
+
* May be used to cache the resolved handler function for a Command class.
|
46
|
+
*/
|
47
|
+
private handlers?;
|
27
48
|
constructor(config: ResolvedClientConfiguration);
|
28
49
|
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
|
29
50
|
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
|
@@ -10,6 +10,22 @@ export interface SmithyConfiguration<HandlerOptions> {
|
|
10
10
|
* @internal
|
11
11
|
*/
|
12
12
|
readonly apiVersion: string;
|
13
|
+
/**
|
14
|
+
* @public
|
15
|
+
*
|
16
|
+
* Default false.
|
17
|
+
*
|
18
|
+
* When true, the client will only resolve the middleware stack once per
|
19
|
+
* Command class. This means modifying the middlewareStack of the
|
20
|
+
* command or client after requests have been made will not be
|
21
|
+
* recognized.
|
22
|
+
*
|
23
|
+
* Calling client.destroy() also clears this cache.
|
24
|
+
*
|
25
|
+
* Enable this only if needing the additional time saved (0-1ms per request)
|
26
|
+
* and not needing middleware modifications between requests.
|
27
|
+
*/
|
28
|
+
cacheMiddleware?: boolean;
|
13
29
|
}
|
14
30
|
/**
|
15
31
|
* @internal
|
@@ -17,13 +33,18 @@ export interface SmithyConfiguration<HandlerOptions> {
|
|
17
33
|
export type SmithyResolvedConfiguration<HandlerOptions> = {
|
18
34
|
requestHandler: RequestHandler<any, any, HandlerOptions>;
|
19
35
|
readonly apiVersion: string;
|
36
|
+
cacheMiddleware?: boolean;
|
20
37
|
};
|
21
38
|
/**
|
22
39
|
* @public
|
23
40
|
*/
|
24
41
|
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
|
25
|
-
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
|
26
42
|
readonly config: ResolvedClientConfiguration;
|
43
|
+
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
|
44
|
+
/**
|
45
|
+
* May be used to cache the resolved handler function for a Command class.
|
46
|
+
*/
|
47
|
+
private handlers?;
|
27
48
|
constructor(config: ResolvedClientConfiguration);
|
28
49
|
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
|
29
50
|
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smithy/smithy-client",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.3.0",
|
4
4
|
"scripts": {
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
6
6
|
"build:cjs": "node ../../scripts/inline smithy-client",
|
@@ -23,11 +23,11 @@
|
|
23
23
|
},
|
24
24
|
"license": "Apache-2.0",
|
25
25
|
"dependencies": {
|
26
|
-
"@smithy/middleware-endpoint": "^3.1.
|
27
|
-
"@smithy/middleware-stack": "^3.0.
|
28
|
-
"@smithy/protocol-http": "^4.1.
|
29
|
-
"@smithy/types": "^3.
|
30
|
-
"@smithy/util-stream": "^3.1.
|
26
|
+
"@smithy/middleware-endpoint": "^3.1.1",
|
27
|
+
"@smithy/middleware-stack": "^3.0.4",
|
28
|
+
"@smithy/protocol-http": "^4.1.1",
|
29
|
+
"@smithy/types": "^3.4.0",
|
30
|
+
"@smithy/util-stream": "^3.1.4",
|
31
31
|
"tslib": "^2.6.2"
|
32
32
|
},
|
33
33
|
"engines": {
|
@@ -34,7 +34,8 @@ const s3b = new S3({}) as UncheckedClient<S3>;
|
|
34
34
|
// and required outputs are not undefined.
|
35
35
|
const get = await s3a.getObject({
|
36
36
|
Bucket: "",
|
37
|
-
|
37
|
+
// @ts-expect-error (undefined not assignable to string)
|
38
|
+
Key: undefined,
|
38
39
|
});
|
39
40
|
|
40
41
|
// UncheckedClient makes output fields non-nullable.
|
@@ -49,6 +50,40 @@ const body = await (
|
|
49
50
|
).Body.transformToString();
|
50
51
|
```
|
51
52
|
|
53
|
+
When using the transform on non-aggregated client with the `Command` syntax,
|
54
|
+
the input cannot be validated because it goes through another class.
|
55
|
+
|
56
|
+
```ts
|
57
|
+
import { S3Client, ListBucketsCommand, GetObjectCommand, GetObjectCommandInput } from "@aws-sdk/client-s3";
|
58
|
+
import type { AssertiveClient, UncheckedClient, NoUndefined } from "@smithy/types";
|
59
|
+
|
60
|
+
const s3 = new S3Client({}) as UncheckedClient<S3Client>;
|
61
|
+
|
62
|
+
const list = await s3.send(
|
63
|
+
new ListBucketsCommand({
|
64
|
+
// command inputs are not validated by the type transform.
|
65
|
+
// because this is a separate class.
|
66
|
+
})
|
67
|
+
);
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Although less ergonomic, you can use the NoUndefined<T>
|
71
|
+
* transform on the input type.
|
72
|
+
*/
|
73
|
+
const getObjectInput: NoUndefined<GetObjectCommandInput> = {
|
74
|
+
Bucket: "undefined",
|
75
|
+
// @ts-expect-error (undefined not assignable to string)
|
76
|
+
Key: undefined,
|
77
|
+
// optional params can still be undefined.
|
78
|
+
SSECustomerAlgorithm: undefined,
|
79
|
+
};
|
80
|
+
|
81
|
+
const get = s3.send(new GetObjectCommand(getObjectInput));
|
82
|
+
|
83
|
+
// outputs are still transformed.
|
84
|
+
await get.Body.TransformToString();
|
85
|
+
```
|
86
|
+
|
52
87
|
### Scenario: Narrowing a smithy-typescript generated client's output payload blob types
|
53
88
|
|
54
89
|
This is mostly relevant to operations with streaming bodies such as within
|
@@ -3,8 +3,21 @@ import { MetadataBearer } from "./response";
|
|
3
3
|
/**
|
4
4
|
* @public
|
5
5
|
*/
|
6
|
-
export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> {
|
6
|
+
export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> extends CommandIO<InputType, OutputType> {
|
7
7
|
readonly input: InputType;
|
8
8
|
readonly middlewareStack: MiddlewareStack<InputType, OutputType>;
|
9
9
|
resolveMiddleware(stack: MiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedConfiguration, options: any): Handler<InputType, OutputType>;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* @internal
|
13
|
+
*
|
14
|
+
* This is a subset of the Command type used only to detect the i/o types.
|
15
|
+
*/
|
16
|
+
export interface CommandIO<InputType extends object, OutputType extends MetadataBearer> {
|
17
|
+
readonly input: InputType;
|
18
|
+
resolveMiddleware(stack: any, configuration: any, options: any): Handler<InputType, OutputType>;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
export type GetOutputType<Command> = Command extends CommandIO<any, infer O> ? O : never;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { CommandIO } from "../command";
|
2
2
|
import type { MetadataBearer } from "../response";
|
3
3
|
import type { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
|
4
4
|
import type { Transform } from "./type-transform";
|
@@ -7,11 +7,11 @@ import type { Transform } from "./type-transform";
|
|
7
7
|
*
|
8
8
|
* Narrowed version of InvokeFunction used in Client::send.
|
9
9
|
*/
|
10
|
-
export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer
|
11
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
12
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
13
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
14
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
10
|
+
export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer> {
|
11
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
|
12
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
|
13
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
|
14
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions, cb?: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
|
15
15
|
}
|
16
16
|
/**
|
17
17
|
* @internal
|
package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
/// <reference types="node" />
|
3
3
|
import type { IncomingMessage } from "http";
|
4
4
|
import type { ClientHttp2Stream } from "http2";
|
5
|
-
import type {
|
5
|
+
import type { InvokeMethod } from "../client";
|
6
|
+
import type { GetOutputType } from "../command";
|
6
7
|
import type { HttpHandlerOptions } from "../http";
|
7
8
|
import type { SdkStream } from "../serde";
|
8
9
|
import type { BrowserRuntimeStreamingBlobPayloadInputTypes, NodeJsRuntimeStreamingBlobPayloadInputTypes, StreamingBlobPayloadInputTypes } from "../streaming-payload/streaming-blob-payload-input-types";
|
9
|
-
import type {
|
10
|
+
import type { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
|
11
|
+
import type { NarrowedInvokeMethod } from "./client-method-transforms";
|
10
12
|
import type { Transform } from "./type-transform";
|
11
13
|
/**
|
12
14
|
* @public
|
@@ -58,8 +60,10 @@ export type BrowserXhrClient<ClientType extends object> = NarrowPayloadBlobTypes
|
|
58
60
|
*/
|
59
61
|
export type NarrowPayloadBlobOutputType<T, ClientType extends object> = {
|
60
62
|
[key in keyof ClientType]: [ClientType[key]] extends [
|
61
|
-
|
62
|
-
] ?
|
63
|
+
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
64
|
+
] ? NarrowedInvokeMethod<T, HttpHandlerOptions, FunctionInputTypes, FunctionOutputTypes> : ClientType[key];
|
65
|
+
} & {
|
66
|
+
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, T>>;
|
63
67
|
};
|
64
68
|
/**
|
65
69
|
* @public
|
@@ -68,6 +72,8 @@ export type NarrowPayloadBlobOutputType<T, ClientType extends object> = {
|
|
68
72
|
*/
|
69
73
|
export type NarrowPayloadBlobTypes<I, O, ClientType extends object> = {
|
70
74
|
[key in keyof ClientType]: [ClientType[key]] extends [
|
71
|
-
|
72
|
-
] ?
|
75
|
+
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
76
|
+
] ? NarrowedInvokeMethod<O, HttpHandlerOptions, Transform<FunctionInputTypes, StreamingBlobPayloadInputTypes | undefined, I>, FunctionOutputTypes> : ClientType[key];
|
77
|
+
} & {
|
78
|
+
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, O>>;
|
73
79
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import type {
|
1
|
+
import type { InvokeMethod, InvokeMethodOptionalArgs } from "../client";
|
2
|
+
import type { GetOutputType } from "../command";
|
2
3
|
/**
|
3
4
|
* @public
|
4
5
|
*
|
@@ -47,7 +48,9 @@ export type RecursiveRequired<T> = T extends Function ? T : [T] extends [object]
|
|
47
48
|
type NarrowClientIOTypes<ClientType extends object> = {
|
48
49
|
[key in keyof ClientType]: [ClientType[key]] extends [
|
49
50
|
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
|
50
|
-
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : [ClientType[key]] extends [
|
51
|
+
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : [ClientType[key]] extends [InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>] ? InvokeMethod<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : ClientType[key];
|
52
|
+
} & {
|
53
|
+
send<Command>(command: Command, options?: any): Promise<NoUndefined<GetOutputType<Command>>>;
|
51
54
|
};
|
52
55
|
/**
|
53
56
|
* @internal
|
@@ -57,6 +60,8 @@ type NarrowClientIOTypes<ClientType extends object> = {
|
|
57
60
|
type UncheckedClientOutputTypes<ClientType extends object> = {
|
58
61
|
[key in keyof ClientType]: [ClientType[key]] extends [
|
59
62
|
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
|
60
|
-
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : [ClientType[key]] extends [
|
63
|
+
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : [ClientType[key]] extends [InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>] ? InvokeMethod<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : ClientType[key];
|
64
|
+
} & {
|
65
|
+
send<Command>(command: Command, options?: any): Promise<RecursiveRequired<NoUndefined<GetOutputType<Command>>>>;
|
61
66
|
};
|
62
67
|
export {};
|
@@ -3,8 +3,21 @@ import { MetadataBearer } from "./response";
|
|
3
3
|
/**
|
4
4
|
* @public
|
5
5
|
*/
|
6
|
-
export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> {
|
6
|
+
export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> extends CommandIO<InputType, OutputType> {
|
7
7
|
readonly input: InputType;
|
8
8
|
readonly middlewareStack: MiddlewareStack<InputType, OutputType>;
|
9
9
|
resolveMiddleware(stack: MiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedConfiguration, options: any): Handler<InputType, OutputType>;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* @internal
|
13
|
+
*
|
14
|
+
* This is a subset of the Command type used only to detect the i/o types.
|
15
|
+
*/
|
16
|
+
export interface CommandIO<InputType extends object, OutputType extends MetadataBearer> {
|
17
|
+
readonly input: InputType;
|
18
|
+
resolveMiddleware(stack: any, configuration: any, options: any): Handler<InputType, OutputType>;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
export type GetOutputType<Command> = Command extends CommandIO<any, infer O> ? O : never;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { CommandIO } from "../command";
|
2
2
|
import { MetadataBearer } from "../response";
|
3
3
|
import { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
|
4
4
|
import { Transform } from "./type-transform";
|
@@ -7,11 +7,11 @@ import { Transform } from "./type-transform";
|
|
7
7
|
*
|
8
8
|
* Narrowed version of InvokeFunction used in Client::send.
|
9
9
|
*/
|
10
|
-
export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer
|
11
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
12
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
13
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
14
|
-
<InputType extends InputTypes, OutputType extends OutputTypes>(command:
|
10
|
+
export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer> {
|
11
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
|
12
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
|
13
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
|
14
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions, cb?: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
|
15
15
|
}
|
16
16
|
/**
|
17
17
|
* @internal
|
package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { IncomingMessage } from "http";
|
3
3
|
import { ClientHttp2Stream } from "http2";
|
4
|
-
import {
|
4
|
+
import { InvokeMethod } from "../client";
|
5
|
+
import { GetOutputType } from "../command";
|
5
6
|
import { HttpHandlerOptions } from "../http";
|
6
7
|
import { SdkStream } from "../serde";
|
7
8
|
import { BrowserRuntimeStreamingBlobPayloadInputTypes, NodeJsRuntimeStreamingBlobPayloadInputTypes, StreamingBlobPayloadInputTypes } from "../streaming-payload/streaming-blob-payload-input-types";
|
8
|
-
import {
|
9
|
+
import { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
|
10
|
+
import { NarrowedInvokeMethod } from "./client-method-transforms";
|
9
11
|
import { Transform } from "./type-transform";
|
10
12
|
/**
|
11
13
|
* @public
|
@@ -58,13 +60,11 @@ export type BrowserXhrClient<ClientType extends object> = NarrowPayloadBlobTypes
|
|
58
60
|
export type NarrowPayloadBlobOutputType<T, ClientType extends object> = {
|
59
61
|
[key in keyof ClientType]: [
|
60
62
|
ClientType[key]
|
61
|
-
] extends [
|
62
|
-
InvokeFunction<infer InputTypes, infer OutputTypes, infer ConfigType>
|
63
|
-
] ? NarrowedInvokeFunction<T, HttpHandlerOptions, InputTypes, OutputTypes, ConfigType> : [
|
64
|
-
ClientType[key]
|
65
63
|
] extends [
|
66
64
|
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
67
65
|
] ? NarrowedInvokeMethod<T, HttpHandlerOptions, FunctionInputTypes, FunctionOutputTypes> : ClientType[key];
|
66
|
+
} & {
|
67
|
+
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, T>>;
|
68
68
|
};
|
69
69
|
/**
|
70
70
|
* @public
|
@@ -74,11 +74,9 @@ export type NarrowPayloadBlobOutputType<T, ClientType extends object> = {
|
|
74
74
|
export type NarrowPayloadBlobTypes<I, O, ClientType extends object> = {
|
75
75
|
[key in keyof ClientType]: [
|
76
76
|
ClientType[key]
|
77
|
-
] extends [
|
78
|
-
InvokeFunction<infer InputTypes, infer OutputTypes, infer ConfigType>
|
79
|
-
] ? NarrowedInvokeFunction<O, HttpHandlerOptions, Transform<InputTypes, StreamingBlobPayloadInputTypes | undefined, I>, OutputTypes, ConfigType> : [
|
80
|
-
ClientType[key]
|
81
77
|
] extends [
|
82
78
|
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
83
79
|
] ? NarrowedInvokeMethod<O, HttpHandlerOptions, Transform<FunctionInputTypes, StreamingBlobPayloadInputTypes | undefined, I>, FunctionOutputTypes> : ClientType[key];
|
80
|
+
} & {
|
81
|
+
send<Command>(command: Command, options?: any): Promise<Transform<GetOutputType<Command>, StreamingBlobPayloadOutputTypes | undefined, O>>;
|
84
82
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { InvokeMethod, InvokeMethodOptionalArgs } from "../client";
|
2
|
+
import { GetOutputType } from "../command";
|
2
3
|
/**
|
3
4
|
* @public
|
4
5
|
*
|
@@ -59,13 +60,11 @@ type NarrowClientIOTypes<ClientType extends object> = {
|
|
59
60
|
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
|
60
61
|
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : [
|
61
62
|
ClientType[key]
|
62
|
-
] extends [
|
63
|
-
InvokeFunction<infer InputTypes, infer OutputTypes, infer ConfigType>
|
64
|
-
] ? InvokeFunction<NoUndefined<InputTypes>, NoUndefined<OutputTypes>, ConfigType> : [
|
65
|
-
ClientType[key]
|
66
63
|
] extends [
|
67
64
|
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
68
65
|
] ? InvokeMethod<NoUndefined<FunctionInputTypes>, NoUndefined<FunctionOutputTypes>> : ClientType[key];
|
66
|
+
} & {
|
67
|
+
send<Command>(command: Command, options?: any): Promise<NoUndefined<GetOutputType<Command>>>;
|
69
68
|
};
|
70
69
|
/**
|
71
70
|
* @internal
|
@@ -79,12 +78,10 @@ type UncheckedClientOutputTypes<ClientType extends object> = {
|
|
79
78
|
InvokeMethodOptionalArgs<infer FunctionInputTypes, infer FunctionOutputTypes>
|
80
79
|
] ? InvokeMethodOptionalArgs<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : [
|
81
80
|
ClientType[key]
|
82
|
-
] extends [
|
83
|
-
InvokeFunction<infer InputTypes, infer OutputTypes, infer ConfigType>
|
84
|
-
] ? InvokeFunction<NoUndefined<InputTypes>, RecursiveRequired<OutputTypes>, ConfigType> : [
|
85
|
-
ClientType[key]
|
86
81
|
] extends [
|
87
82
|
InvokeMethod<infer FunctionInputTypes, infer FunctionOutputTypes>
|
88
83
|
] ? InvokeMethod<NoUndefined<FunctionInputTypes>, RecursiveRequired<FunctionOutputTypes>> : ClientType[key];
|
84
|
+
} & {
|
85
|
+
send<Command>(command: Command, options?: any): Promise<RecursiveRequired<NoUndefined<GetOutputType<Command>>>>;
|
89
86
|
};
|
90
87
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smithy/url-parser",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.4",
|
4
4
|
"scripts": {
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
6
6
|
"build:cjs": "node ../../scripts/inline url-parser",
|
@@ -22,8 +22,8 @@
|
|
22
22
|
},
|
23
23
|
"license": "Apache-2.0",
|
24
24
|
"dependencies": {
|
25
|
-
"@smithy/querystring-parser": "^3.0.
|
26
|
-
"@smithy/types": "^3.
|
25
|
+
"@smithy/querystring-parser": "^3.0.4",
|
26
|
+
"@smithy/types": "^3.4.0",
|
27
27
|
"tslib": "^2.6.2"
|
28
28
|
},
|
29
29
|
"typesVersions": {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smithy/util-defaults-mode-browser",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.16",
|
4
4
|
"scripts": {
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
6
6
|
"build:cjs": "node ../../scripts/inline util-defaults-mode-browser",
|
@@ -22,9 +22,9 @@
|
|
22
22
|
},
|
23
23
|
"license": "Apache-2.0",
|
24
24
|
"dependencies": {
|
25
|
-
"@smithy/property-provider": "^3.1.
|
26
|
-
"@smithy/smithy-client": "^3.
|
27
|
-
"@smithy/types": "^3.
|
25
|
+
"@smithy/property-provider": "^3.1.4",
|
26
|
+
"@smithy/smithy-client": "^3.3.0",
|
27
|
+
"@smithy/types": "^3.4.0",
|
28
28
|
"bowser": "^2.11.0",
|
29
29
|
"tslib": "^2.6.2"
|
30
30
|
},
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smithy/util-defaults-mode-node",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.16",
|
4
4
|
"scripts": {
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
6
6
|
"build:cjs": "node ../../scripts/inline util-defaults-mode-node",
|
@@ -22,12 +22,12 @@
|
|
22
22
|
},
|
23
23
|
"license": "Apache-2.0",
|
24
24
|
"dependencies": {
|
25
|
-
"@smithy/config-resolver": "^3.0.
|
26
|
-
"@smithy/credential-provider-imds": "^3.2.
|
27
|
-
"@smithy/node-config-provider": "^3.1.
|
28
|
-
"@smithy/property-provider": "^3.1.
|
29
|
-
"@smithy/smithy-client": "^3.
|
30
|
-
"@smithy/types": "^3.
|
25
|
+
"@smithy/config-resolver": "^3.0.6",
|
26
|
+
"@smithy/credential-provider-imds": "^3.2.1",
|
27
|
+
"@smithy/node-config-provider": "^3.1.5",
|
28
|
+
"@smithy/property-provider": "^3.1.4",
|
29
|
+
"@smithy/smithy-client": "^3.3.0",
|
30
|
+
"@smithy/types": "^3.4.0",
|
31
31
|
"tslib": "^2.6.2"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require("../index.js");
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
20
20
|
// src/index.ts
|
21
21
|
var src_exports = {};
|
22
22
|
__export(src_exports, {
|
23
|
+
EndpointCache: () => EndpointCache,
|
23
24
|
EndpointError: () => EndpointError,
|
24
25
|
customEndpointFunctions: () => customEndpointFunctions,
|
25
26
|
isIpAddress: () => isIpAddress,
|
@@ -28,6 +29,75 @@ __export(src_exports, {
|
|
28
29
|
});
|
29
30
|
module.exports = __toCommonJS(src_exports);
|
30
31
|
|
32
|
+
// src/cache/EndpointCache.ts
|
33
|
+
var _EndpointCache = class _EndpointCache {
|
34
|
+
/**
|
35
|
+
* @param [size] - desired average maximum capacity. A buffer of 10 additional keys will be allowed
|
36
|
+
* before keys are dropped.
|
37
|
+
* @param [params] - list of params to consider as part of the cache key.
|
38
|
+
*
|
39
|
+
* If the params list is not populated, no caching will happen.
|
40
|
+
* This may be out of order depending on how the object is created and arrives to this class.
|
41
|
+
*/
|
42
|
+
constructor({ size, params }) {
|
43
|
+
this.data = /* @__PURE__ */ new Map();
|
44
|
+
this.parameters = [];
|
45
|
+
this.capacity = size ?? 50;
|
46
|
+
if (params) {
|
47
|
+
this.parameters = params;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* @param endpointParams - query for endpoint.
|
52
|
+
* @param resolver - provider of the value if not present.
|
53
|
+
* @returns endpoint corresponding to the query.
|
54
|
+
*/
|
55
|
+
get(endpointParams, resolver) {
|
56
|
+
const key = this.hash(endpointParams);
|
57
|
+
if (key === false) {
|
58
|
+
return resolver();
|
59
|
+
}
|
60
|
+
if (!this.data.has(key)) {
|
61
|
+
if (this.data.size > this.capacity + 10) {
|
62
|
+
const keys = this.data.keys();
|
63
|
+
let i = 0;
|
64
|
+
while (true) {
|
65
|
+
const { value, done } = keys.next();
|
66
|
+
this.data.delete(value);
|
67
|
+
if (done || ++i > 10) {
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
this.data.set(key, resolver());
|
73
|
+
}
|
74
|
+
return this.data.get(key);
|
75
|
+
}
|
76
|
+
size() {
|
77
|
+
return this.data.size;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* @returns cache key or false if not cachable.
|
81
|
+
*/
|
82
|
+
hash(endpointParams) {
|
83
|
+
let buffer = "";
|
84
|
+
const { parameters } = this;
|
85
|
+
if (parameters.length === 0) {
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
for (const param of parameters) {
|
89
|
+
const val = String(endpointParams[param] ?? "");
|
90
|
+
if (val.includes("|;")) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
buffer += val + "|;";
|
94
|
+
}
|
95
|
+
return buffer;
|
96
|
+
}
|
97
|
+
};
|
98
|
+
__name(_EndpointCache, "EndpointCache");
|
99
|
+
var EndpointCache = _EndpointCache;
|
100
|
+
|
31
101
|
// src/lib/isIpAddress.ts
|
32
102
|
var IP_V4_REGEX = new RegExp(
|
33
103
|
`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`
|
@@ -443,7 +513,7 @@ var evaluateRules = /* @__PURE__ */ __name((rules, options) => {
|
|
443
513
|
|
444
514
|
// src/resolveEndpoint.ts
|
445
515
|
var resolveEndpoint = /* @__PURE__ */ __name((ruleSetObject, options) => {
|
446
|
-
var _a, _b, _c, _d
|
516
|
+
var _a, _b, _c, _d;
|
447
517
|
const { endpointParams, logger } = options;
|
448
518
|
const { parameters, rules } = ruleSetObject;
|
449
519
|
(_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
|
@@ -460,21 +530,13 @@ var resolveEndpoint = /* @__PURE__ */ __name((ruleSetObject, options) => {
|
|
460
530
|
}
|
461
531
|
}
|
462
532
|
const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
|
463
|
-
|
464
|
-
try {
|
465
|
-
const givenEndpoint = new URL(options.endpointParams.Endpoint);
|
466
|
-
const { protocol, port } = givenEndpoint;
|
467
|
-
endpoint.url.protocol = protocol;
|
468
|
-
endpoint.url.port = port;
|
469
|
-
} catch (e) {
|
470
|
-
}
|
471
|
-
}
|
472
|
-
(_e = (_d = options.logger) == null ? void 0 : _d.debug) == null ? void 0 : _e.call(_d, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
533
|
+
(_d = (_c = options.logger) == null ? void 0 : _c.debug) == null ? void 0 : _d.call(_c, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
473
534
|
return endpoint;
|
474
535
|
}, "resolveEndpoint");
|
475
536
|
// Annotate the CommonJS export names for ESM import in node:
|
476
537
|
|
477
538
|
0 && (module.exports = {
|
539
|
+
EndpointCache,
|
478
540
|
isIpAddress,
|
479
541
|
isValidHostLabel,
|
480
542
|
customEndpointFunctions,
|