From 003f6f17df7810814286ff375a282ccd7d897971 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Sat, 7 Oct 2023 21:49:34 -0700 Subject: [PATCH] feat(experimentalIdentityAndAuth): reorganize package structure into NPM packages --- .changeset/big-panthers-collect.md | 5 +++++ .../src/index.ts | 18 ++++++------------ .../getHttpAuthSchemeEndpointRuleSetPlugin.ts | 2 +- .../getHttpAuthSchemePlugin.ts | 2 +- .../httpAuthSchemeMiddleware.ts | 6 +++--- .../httpSigningMiddleware.ts | 2 +- .../src/{ => signature-v4}/SigV4Signer.ts | 2 +- .../src/signature-v4/index.ts | 1 + .../src/{ => types/auth}/HttpAuthScheme.ts | 2 +- .../{ => types/auth}/HttpAuthSchemeProvider.ts | 0 .../src/{ => types/auth}/HttpSigner.ts | 0 .../src/types/auth/index.ts | 3 +++ .../types/identity/IdentityProviderConfig.ts | 16 ++++++++++++++++ .../src/{ => types/identity}/apiKeyIdentity.ts | 0 .../src/types/identity/index.ts | 3 +++ .../src/{ => types/identity}/tokenIdentity.ts | 0 .../src/types/index.ts | 2 ++ .../endpointRuleSet.ts | 4 ++-- .../src/util-endpoint-rule-set-auth/index.ts | 1 + .../httpApiKeyAuth.ts | 4 ++-- .../src/util-http-api-key-auth/index.ts | 1 + .../httpBearerAuth.ts | 4 ++-- .../src/util-http-bearer-auth/index.ts | 1 + .../DefaultIdentityProviderConfig.ts} | 16 ++-------------- .../src/util-identity-and-auth/index.ts | 3 +++ .../memoizeIdentityProvider.ts | 0 .../src/{ => util-identity-and-auth}/noAuth.ts | 2 +- 27 files changed, 59 insertions(+), 41 deletions(-) create mode 100644 .changeset/big-panthers-collect.md rename packages/experimental-identity-and-auth/src/{ => signature-v4}/SigV4Signer.ts (95%) create mode 100644 packages/experimental-identity-and-auth/src/signature-v4/index.ts rename packages/experimental-identity-and-auth/src/{ => types/auth}/HttpAuthScheme.ts (93%) rename packages/experimental-identity-and-auth/src/{ => types/auth}/HttpAuthSchemeProvider.ts (100%) rename packages/experimental-identity-and-auth/src/{ => types/auth}/HttpSigner.ts (100%) create mode 100644 packages/experimental-identity-and-auth/src/types/auth/index.ts create mode 100644 packages/experimental-identity-and-auth/src/types/identity/IdentityProviderConfig.ts rename packages/experimental-identity-and-auth/src/{ => types/identity}/apiKeyIdentity.ts (100%) create mode 100644 packages/experimental-identity-and-auth/src/types/identity/index.ts rename packages/experimental-identity-and-auth/src/{ => types/identity}/tokenIdentity.ts (100%) create mode 100644 packages/experimental-identity-and-auth/src/types/index.ts rename packages/experimental-identity-and-auth/src/{ => util-endpoint-rule-set-auth}/endpointRuleSet.ts (97%) create mode 100644 packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/index.ts rename packages/experimental-identity-and-auth/src/{ => util-http-api-key-auth}/httpApiKeyAuth.ts (92%) create mode 100644 packages/experimental-identity-and-auth/src/util-http-api-key-auth/index.ts rename packages/experimental-identity-and-auth/src/{ => util-http-bearer-auth}/httpBearerAuth.ts (80%) create mode 100644 packages/experimental-identity-and-auth/src/util-http-bearer-auth/index.ts rename packages/experimental-identity-and-auth/src/{IdentityProviderConfig.ts => util-identity-and-auth/DefaultIdentityProviderConfig.ts} (64%) create mode 100644 packages/experimental-identity-and-auth/src/util-identity-and-auth/index.ts rename packages/experimental-identity-and-auth/src/{ => util-identity-and-auth}/memoizeIdentityProvider.ts (100%) rename packages/experimental-identity-and-auth/src/{ => util-identity-and-auth}/noAuth.ts (86%) diff --git a/.changeset/big-panthers-collect.md b/.changeset/big-panthers-collect.md new file mode 100644 index 00000000000..c1ddaeb9b98 --- /dev/null +++ b/.changeset/big-panthers-collect.md @@ -0,0 +1,5 @@ +--- +"@smithy/experimental-identity-and-auth": patch +--- + +Reorganize package structure into NPM packages. diff --git a/packages/experimental-identity-and-auth/src/index.ts b/packages/experimental-identity-and-auth/src/index.ts index 8bf555ab453..d750037f4ef 100644 --- a/packages/experimental-identity-and-auth/src/index.ts +++ b/packages/experimental-identity-and-auth/src/index.ts @@ -1,14 +1,8 @@ -export * from "./HttpAuthScheme"; -export * from "./HttpAuthSchemeProvider"; -export * from "./HttpSigner"; -export * from "./IdentityProviderConfig"; -export * from "./SigV4Signer"; -export * from "./apiKeyIdentity"; -export * from "./endpointRuleSet"; -export * from "./httpApiKeyAuth"; -export * from "./httpBearerAuth"; -export * from "./memoizeIdentityProvider"; export * from "./middleware-http-auth-scheme"; export * from "./middleware-http-signing"; -export * from "./noAuth"; -export * from "./tokenIdentity"; +export * from "./signature-v4"; +export * from "./types"; +export * from "./util-endpoint-rule-set-auth"; +export * from "./util-http-api-key-auth"; +export * from "./util-http-bearer-auth"; +export * from "./util-identity-and-auth"; diff --git a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.ts b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.ts index a031255f804..1e499306083 100644 --- a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.ts +++ b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.ts @@ -1,7 +1,7 @@ import { endpointMiddlewareOptions } from "@smithy/middleware-endpoint"; import { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types"; -import { HttpAuthSchemeParameters } from "../HttpAuthSchemeProvider"; +import { HttpAuthSchemeParameters } from "../types/auth/HttpAuthSchemeProvider"; import { httpAuthSchemeMiddleware, PreviouslyResolved } from "./httpAuthSchemeMiddleware"; /** diff --git a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts index 589bb41c564..dbce8786101 100644 --- a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts +++ b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts @@ -1,7 +1,7 @@ import { serializerMiddlewareOption } from "@smithy/middleware-serde"; import { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types"; -import { HttpAuthSchemeParameters } from "../HttpAuthSchemeProvider"; +import { HttpAuthSchemeParameters } from "../types/auth/HttpAuthSchemeProvider"; import { httpAuthSchemeMiddleware, PreviouslyResolved } from "./httpAuthSchemeMiddleware"; /** diff --git a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts index 62239ee29d9..2a58005aa2c 100644 --- a/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts +++ b/packages/experimental-identity-and-auth/src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts @@ -9,13 +9,13 @@ import { } from "@smithy/types"; import { getSmithyContext } from "@smithy/util-middleware"; -import { HttpAuthScheme, HttpAuthSchemeId, SelectedHttpAuthScheme } from "../HttpAuthScheme"; +import { HttpAuthScheme, HttpAuthSchemeId, SelectedHttpAuthScheme } from "../types/auth/HttpAuthScheme"; import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, -} from "../HttpAuthSchemeProvider"; -import { IdentityProviderConfig } from "../IdentityProviderConfig"; +} from "../types/auth/HttpAuthSchemeProvider"; +import { IdentityProviderConfig } from "../types/identity/IdentityProviderConfig"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/middleware-http-signing/httpSigningMiddleware.ts b/packages/experimental-identity-and-auth/src/middleware-http-signing/httpSigningMiddleware.ts index 1181b132ce3..315fc8ca631 100644 --- a/packages/experimental-identity-and-auth/src/middleware-http-signing/httpSigningMiddleware.ts +++ b/packages/experimental-identity-and-auth/src/middleware-http-signing/httpSigningMiddleware.ts @@ -9,7 +9,7 @@ import { } from "@smithy/types"; import { getSmithyContext } from "@smithy/util-middleware"; -import { SelectedHttpAuthScheme } from "../HttpAuthScheme"; +import { SelectedHttpAuthScheme } from "../types/auth/HttpAuthScheme"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/SigV4Signer.ts b/packages/experimental-identity-and-auth/src/signature-v4/SigV4Signer.ts similarity index 95% rename from packages/experimental-identity-and-auth/src/SigV4Signer.ts rename to packages/experimental-identity-and-auth/src/signature-v4/SigV4Signer.ts index 558772079cb..83343a86d75 100644 --- a/packages/experimental-identity-and-auth/src/SigV4Signer.ts +++ b/packages/experimental-identity-and-auth/src/signature-v4/SigV4Signer.ts @@ -2,7 +2,7 @@ import { HttpRequest } from "@smithy/protocol-http"; import { SignatureV4 } from "@smithy/signature-v4"; import { AwsCredentialIdentity, HttpRequest as IHttpRequest } from "@smithy/types"; -import { HttpSigner } from "./HttpSigner"; +import { HttpSigner } from "../types/auth/HttpSigner"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/signature-v4/index.ts b/packages/experimental-identity-and-auth/src/signature-v4/index.ts new file mode 100644 index 00000000000..bf391c1cd44 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/signature-v4/index.ts @@ -0,0 +1 @@ +export * from "./SigV4Signer"; diff --git a/packages/experimental-identity-and-auth/src/HttpAuthScheme.ts b/packages/experimental-identity-and-auth/src/types/auth/HttpAuthScheme.ts similarity index 93% rename from packages/experimental-identity-and-auth/src/HttpAuthScheme.ts rename to packages/experimental-identity-and-auth/src/types/auth/HttpAuthScheme.ts index 110f3404244..27985091f64 100644 --- a/packages/experimental-identity-and-auth/src/HttpAuthScheme.ts +++ b/packages/experimental-identity-and-auth/src/types/auth/HttpAuthScheme.ts @@ -1,7 +1,7 @@ import { Identity, IdentityProvider } from "@smithy/types"; +import { IdentityProviderConfig } from "../identity/IdentityProviderConfig"; import { HttpSigner } from "./HttpSigner"; -import { IdentityProviderConfig } from "./IdentityProviderConfig"; /** * ID for {@link HttpAuthScheme} diff --git a/packages/experimental-identity-and-auth/src/HttpAuthSchemeProvider.ts b/packages/experimental-identity-and-auth/src/types/auth/HttpAuthSchemeProvider.ts similarity index 100% rename from packages/experimental-identity-and-auth/src/HttpAuthSchemeProvider.ts rename to packages/experimental-identity-and-auth/src/types/auth/HttpAuthSchemeProvider.ts diff --git a/packages/experimental-identity-and-auth/src/HttpSigner.ts b/packages/experimental-identity-and-auth/src/types/auth/HttpSigner.ts similarity index 100% rename from packages/experimental-identity-and-auth/src/HttpSigner.ts rename to packages/experimental-identity-and-auth/src/types/auth/HttpSigner.ts diff --git a/packages/experimental-identity-and-auth/src/types/auth/index.ts b/packages/experimental-identity-and-auth/src/types/auth/index.ts new file mode 100644 index 00000000000..c98738b1725 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/types/auth/index.ts @@ -0,0 +1,3 @@ +export * from "./HttpAuthScheme"; +export * from "./HttpAuthSchemeProvider"; +export * from "./HttpSigner"; diff --git a/packages/experimental-identity-and-auth/src/types/identity/IdentityProviderConfig.ts b/packages/experimental-identity-and-auth/src/types/identity/IdentityProviderConfig.ts new file mode 100644 index 00000000000..334c595f610 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/types/identity/IdentityProviderConfig.ts @@ -0,0 +1,16 @@ +import { Identity, IdentityProvider } from "@smithy/types"; + +import { HttpAuthSchemeId } from "../auth/HttpAuthScheme"; + +/** + * Interface to get an IdentityProvider for a specified HttpAuthScheme + * @internal + */ +export interface IdentityProviderConfig { + /** + * Get the IdentityProvider for a specified HttpAuthScheme. + * @param schemeId schemeId of the HttpAuthScheme + * @returns IdentityProvider or undefined if HttpAuthScheme is not found + */ + getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider | undefined; +} diff --git a/packages/experimental-identity-and-auth/src/apiKeyIdentity.ts b/packages/experimental-identity-and-auth/src/types/identity/apiKeyIdentity.ts similarity index 100% rename from packages/experimental-identity-and-auth/src/apiKeyIdentity.ts rename to packages/experimental-identity-and-auth/src/types/identity/apiKeyIdentity.ts diff --git a/packages/experimental-identity-and-auth/src/types/identity/index.ts b/packages/experimental-identity-and-auth/src/types/identity/index.ts new file mode 100644 index 00000000000..6ce226fc5ff --- /dev/null +++ b/packages/experimental-identity-and-auth/src/types/identity/index.ts @@ -0,0 +1,3 @@ +export * from "./apiKeyIdentity"; +export * from "./IdentityProviderConfig"; +export * from "./tokenIdentity"; diff --git a/packages/experimental-identity-and-auth/src/tokenIdentity.ts b/packages/experimental-identity-and-auth/src/types/identity/tokenIdentity.ts similarity index 100% rename from packages/experimental-identity-and-auth/src/tokenIdentity.ts rename to packages/experimental-identity-and-auth/src/types/identity/tokenIdentity.ts diff --git a/packages/experimental-identity-and-auth/src/types/index.ts b/packages/experimental-identity-and-auth/src/types/index.ts new file mode 100644 index 00000000000..8efb8c6db92 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/types/index.ts @@ -0,0 +1,2 @@ +export * from "./auth"; +export * from "./identity"; diff --git a/packages/experimental-identity-and-auth/src/endpointRuleSet.ts b/packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/endpointRuleSet.ts similarity index 97% rename from packages/experimental-identity-and-auth/src/endpointRuleSet.ts rename to packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/endpointRuleSet.ts index 86f12a178e4..c8ae04a37b2 100644 --- a/packages/experimental-identity-and-auth/src/endpointRuleSet.ts +++ b/packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/endpointRuleSet.ts @@ -2,12 +2,12 @@ import { EndpointParameterInstructions, resolveParams } from "@smithy/middleware import { EndpointParameters, EndpointV2, HandlerExecutionContext, Logger } from "@smithy/types"; import { getSmithyContext } from "@smithy/util-middleware"; -import { HttpAuthOption } from "./HttpAuthScheme"; +import { HttpAuthOption } from "../types/auth/HttpAuthScheme"; import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider, -} from "./HttpAuthSchemeProvider"; +} from "../types/auth/HttpAuthSchemeProvider"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/index.ts b/packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/index.ts new file mode 100644 index 00000000000..5f00cd1946b --- /dev/null +++ b/packages/experimental-identity-and-auth/src/util-endpoint-rule-set-auth/index.ts @@ -0,0 +1 @@ +export * from "./endpointRuleSet"; diff --git a/packages/experimental-identity-and-auth/src/httpApiKeyAuth.ts b/packages/experimental-identity-and-auth/src/util-http-api-key-auth/httpApiKeyAuth.ts similarity index 92% rename from packages/experimental-identity-and-auth/src/httpApiKeyAuth.ts rename to packages/experimental-identity-and-auth/src/util-http-api-key-auth/httpApiKeyAuth.ts index 4eaa287db40..1d3d72b982e 100644 --- a/packages/experimental-identity-and-auth/src/httpApiKeyAuth.ts +++ b/packages/experimental-identity-and-auth/src/util-http-api-key-auth/httpApiKeyAuth.ts @@ -1,8 +1,8 @@ import { HttpRequest } from "@smithy/protocol-http"; import { HttpRequest as IHttpRequest } from "@smithy/types"; -import { ApiKeyIdentity } from "./apiKeyIdentity"; -import { HttpSigner } from "./HttpSigner"; +import { HttpSigner } from "../types/auth/HttpSigner"; +import { ApiKeyIdentity } from "../types/identity/apiKeyIdentity"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/util-http-api-key-auth/index.ts b/packages/experimental-identity-and-auth/src/util-http-api-key-auth/index.ts new file mode 100644 index 00000000000..656aad2d12d --- /dev/null +++ b/packages/experimental-identity-and-auth/src/util-http-api-key-auth/index.ts @@ -0,0 +1 @@ +export * from "./httpApiKeyAuth"; diff --git a/packages/experimental-identity-and-auth/src/httpBearerAuth.ts b/packages/experimental-identity-and-auth/src/util-http-bearer-auth/httpBearerAuth.ts similarity index 80% rename from packages/experimental-identity-and-auth/src/httpBearerAuth.ts rename to packages/experimental-identity-and-auth/src/util-http-bearer-auth/httpBearerAuth.ts index 59f35a1557f..e616cabdcca 100644 --- a/packages/experimental-identity-and-auth/src/httpBearerAuth.ts +++ b/packages/experimental-identity-and-auth/src/util-http-bearer-auth/httpBearerAuth.ts @@ -1,8 +1,8 @@ import { HttpRequest } from "@smithy/protocol-http"; import { HttpRequest as IHttpRequest } from "@smithy/types"; -import { HttpSigner } from "./HttpSigner"; -import { TokenIdentity } from "./tokenIdentity"; +import { HttpSigner } from "../types/auth/HttpSigner"; +import { TokenIdentity } from "../types/identity/tokenIdentity"; /** * @internal diff --git a/packages/experimental-identity-and-auth/src/util-http-bearer-auth/index.ts b/packages/experimental-identity-and-auth/src/util-http-bearer-auth/index.ts new file mode 100644 index 00000000000..3785d776d10 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/util-http-bearer-auth/index.ts @@ -0,0 +1 @@ +export * from "./httpBearerAuth"; diff --git a/packages/experimental-identity-and-auth/src/IdentityProviderConfig.ts b/packages/experimental-identity-and-auth/src/util-identity-and-auth/DefaultIdentityProviderConfig.ts similarity index 64% rename from packages/experimental-identity-and-auth/src/IdentityProviderConfig.ts rename to packages/experimental-identity-and-auth/src/util-identity-and-auth/DefaultIdentityProviderConfig.ts index 1507cbb2d73..cd51ed40d08 100644 --- a/packages/experimental-identity-and-auth/src/IdentityProviderConfig.ts +++ b/packages/experimental-identity-and-auth/src/util-identity-and-auth/DefaultIdentityProviderConfig.ts @@ -1,19 +1,7 @@ import { Identity, IdentityProvider } from "@smithy/types"; -import { HttpAuthSchemeId } from "./HttpAuthScheme"; - -/** - * Interface to get an IdentityProvider for a specified HttpAuthScheme - * @internal - */ -export interface IdentityProviderConfig { - /** - * Get the IdentityProvider for a specified HttpAuthScheme. - * @param schemeId schemeId of the HttpAuthScheme - * @returns IdentityProvider or undefined if HttpAuthScheme is not found - */ - getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider | undefined; -} +import { HttpAuthSchemeId } from "../types/auth/HttpAuthScheme"; +import { IdentityProviderConfig } from "../types/identity/IdentityProviderConfig"; /** * Default implementation of IdentityProviderConfig diff --git a/packages/experimental-identity-and-auth/src/util-identity-and-auth/index.ts b/packages/experimental-identity-and-auth/src/util-identity-and-auth/index.ts new file mode 100644 index 00000000000..e7a8246e178 --- /dev/null +++ b/packages/experimental-identity-and-auth/src/util-identity-and-auth/index.ts @@ -0,0 +1,3 @@ +export * from "./DefaultIdentityProviderConfig"; +export * from "./memoizeIdentityProvider"; +export * from "./noAuth"; diff --git a/packages/experimental-identity-and-auth/src/memoizeIdentityProvider.ts b/packages/experimental-identity-and-auth/src/util-identity-and-auth/memoizeIdentityProvider.ts similarity index 100% rename from packages/experimental-identity-and-auth/src/memoizeIdentityProvider.ts rename to packages/experimental-identity-and-auth/src/util-identity-and-auth/memoizeIdentityProvider.ts diff --git a/packages/experimental-identity-and-auth/src/noAuth.ts b/packages/experimental-identity-and-auth/src/util-identity-and-auth/noAuth.ts similarity index 86% rename from packages/experimental-identity-and-auth/src/noAuth.ts rename to packages/experimental-identity-and-auth/src/util-identity-and-auth/noAuth.ts index b70a9820abe..cf59374e066 100644 --- a/packages/experimental-identity-and-auth/src/noAuth.ts +++ b/packages/experimental-identity-and-auth/src/util-identity-and-auth/noAuth.ts @@ -1,6 +1,6 @@ import { HttpRequest, Identity } from "@smithy/types"; -import { HttpSigner } from "./HttpSigner"; +import { HttpSigner } from "../types/auth/HttpSigner"; /** * Signer for the synthetic @smithy.api#noAuth auth scheme.