@smithy/experimental-identity-and-auth 0.5.46 → 0.5.48

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/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@smithy/experimental-identity-and-auth",
3
- "version": "0.5.46",
3
+ "version": "0.5.48",
4
4
  "scripts": {
5
- "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
- "build:cjs": "node ../../scripts/inline experimental-identity-and-auth",
7
- "build:es": "yarn g:tsc -p tsconfig.es.json",
5
+ "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
+ "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline experimental-identity-and-auth",
8
7
  "build:types": "yarn g:tsc -p tsconfig.types.json",
9
8
  "build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
10
- "stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
11
9
  "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
12
- "lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
13
10
  "format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
11
+ "lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
12
+ "stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
14
13
  "test": "yarn g:vitest run --passWithNoTests",
15
14
  "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
16
- "test:watch": "yarn g:vitest watch --passWithNoTests",
17
- "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
15
+ "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts",
16
+ "test:watch": "yarn g:vitest watch --passWithNoTests"
18
17
  },
19
18
  "main": "./dist-cjs/index.js",
20
19
  "module": "./dist-es/index.js",
@@ -27,13 +26,13 @@
27
26
  "license": "Apache-2.0",
28
27
  "sideEffects": false,
29
28
  "dependencies": {
30
- "@smithy/middleware-endpoint": "^4.4.28",
31
- "@smithy/middleware-retry": "^4.4.46",
32
- "@smithy/middleware-serde": "^4.2.16",
33
- "@smithy/protocol-http": "^5.3.12",
34
- "@smithy/signature-v4": "^5.3.12",
35
- "@smithy/types": "^4.13.1",
36
- "@smithy/util-middleware": "^4.2.12",
29
+ "@smithy/middleware-endpoint": "^4.4.29",
30
+ "@smithy/middleware-retry": "^4.5.1",
31
+ "@smithy/middleware-serde": "^4.2.17",
32
+ "@smithy/protocol-http": "^5.3.13",
33
+ "@smithy/signature-v4": "^5.3.13",
34
+ "@smithy/types": "^4.14.0",
35
+ "@smithy/util-middleware": "^4.2.13",
37
36
  "tslib": "^2.6.2"
38
37
  },
39
38
  "engines": {
@@ -1,48 +0,0 @@
1
- import { HandlerExecutionContext, Identity, IdentityProvider } from "@smithy/types";
2
- import { HttpSigner } from "./HttpSigner";
3
- import { IdentityProviderConfig } from "./IdentityProviderConfig";
4
- /**
5
- * ID for {@link HttpAuthScheme}
6
- * @internal
7
- */
8
- export type HttpAuthSchemeId = string;
9
- /**
10
- * Interface that defines an HttpAuthScheme
11
- * @internal
12
- */
13
- export interface HttpAuthScheme {
14
- /**
15
- * ID for an HttpAuthScheme, typically the absolute shape ID of a Smithy auth trait.
16
- */
17
- schemeId: HttpAuthSchemeId;
18
- /**
19
- * Gets the IdentityProvider corresponding to an HttpAuthScheme.
20
- */
21
- identityProvider(config: IdentityProviderConfig): IdentityProvider<Identity> | undefined;
22
- /**
23
- * HttpSigner corresponding to an HttpAuthScheme.
24
- */
25
- signer: HttpSigner;
26
- }
27
- /**
28
- * Interface that defines the identity and signing properties when selecting
29
- * an HttpAuthScheme.
30
- * @internal
31
- */
32
- export interface HttpAuthOption {
33
- schemeId: HttpAuthSchemeId;
34
- identityProperties?: Record<string, unknown>;
35
- signingProperties?: Record<string, unknown>;
36
- propertiesExtractor?: <TConfig extends object, TContext extends HandlerExecutionContext>(config: TConfig, context: TContext) => {
37
- identityProperties?: Record<string, unknown>;
38
- signingProperties?: Record<string, unknown>;
39
- };
40
- }
41
- /**
42
- * @internal
43
- */
44
- export interface SelectedHttpAuthScheme {
45
- httpAuthOption: HttpAuthOption;
46
- identity: Identity;
47
- signer: HttpSigner;
48
- }
@@ -1,20 +0,0 @@
1
- import { HandlerExecutionContext } from "@smithy/types";
2
- import { HttpAuthOption } from "./HttpAuthScheme";
3
- /**
4
- * @internal
5
- */
6
- export interface HttpAuthSchemeParameters {
7
- operation?: string;
8
- }
9
- /**
10
- * @internal
11
- */
12
- export interface HttpAuthSchemeProvider<TParameters extends HttpAuthSchemeParameters> {
13
- (authParameters: TParameters): HttpAuthOption[];
14
- }
15
- /**
16
- * @internal
17
- */
18
- export interface HttpAuthSchemeParametersProvider<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object> {
19
- (config: TConfig, context: TContext, input: TInput): Promise<TParameters>;
20
- }
@@ -1,15 +0,0 @@
1
- import { HttpRequest, Identity } from "@smithy/types";
2
- /**
3
- * Interface to sign identity and signing properties.
4
- * @internal
5
- */
6
- export interface HttpSigner {
7
- /**
8
- * Signs an HttpRequest with an identity and signing properties.
9
- * @param httpRequest request to sign
10
- * @param identity identity to sing the request with
11
- * @param signingProperties property bag for signing
12
- * @returns signed request in a promise
13
- */
14
- sign(httpRequest: HttpRequest, identity: Identity, signingProperties: Record<string, unknown>): Promise<HttpRequest>;
15
- }
@@ -1,28 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- import { HttpAuthSchemeId } from "./HttpAuthScheme";
3
- /**
4
- * Interface to get an IdentityProvider for a specified HttpAuthScheme
5
- * @internal
6
- */
7
- export interface IdentityProviderConfig {
8
- /**
9
- * Get the IdentityProvider for a specified HttpAuthScheme.
10
- * @param schemeId schemeId of the HttpAuthScheme
11
- * @returns IdentityProvider or undefined if HttpAuthScheme is not found
12
- */
13
- getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
14
- }
15
- /**
16
- * Default implementation of IdentityProviderConfig
17
- * @internal
18
- */
19
- export declare class DefaultIdentityProviderConfig implements IdentityProviderConfig {
20
- private authSchemes;
21
- /**
22
- * Creates an IdentityProviderConfig with a record of scheme IDs to identity providers.
23
- *
24
- * @param config scheme IDs and identity providers to configure
25
- */
26
- constructor(config: Record<HttpAuthSchemeId, IdentityProvider<Identity> | undefined>);
27
- getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
28
- }
@@ -1,9 +0,0 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { AwsCredentialIdentity, HttpRequest as IHttpRequest } from "@smithy/types";
3
- import { HttpSigner } from "./HttpSigner";
4
- /**
5
- * @internal
6
- */
7
- export declare class SigV4Signer implements HttpSigner {
8
- sign(httpRequest: HttpRequest, identity: AwsCredentialIdentity, signingProperties: Record<string, any>): Promise<IHttpRequest>;
9
- }
@@ -1,11 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export interface ApiKeyIdentity extends Identity {
6
- readonly apiKey: string;
7
- }
8
- /**
9
- * @internal
10
- */
11
- export type ApiKeyIdentityProvider = IdentityProvider<ApiKeyIdentity>;
@@ -1,37 +0,0 @@
1
- import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
2
- import { EndpointParameters, EndpointV2, HandlerExecutionContext, Logger } from "@smithy/types";
3
- import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider } from "./HttpAuthSchemeProvider";
4
- /**
5
- * @internal
6
- */
7
- export interface EndpointRuleSetHttpAuthSchemeProvider<EndpointParametersT extends EndpointParameters, HttpAuthSchemeParametersT extends HttpAuthSchemeParameters> extends HttpAuthSchemeProvider<EndpointParametersT & HttpAuthSchemeParametersT> {
8
- }
9
- /**
10
- * @internal
11
- */
12
- export interface DefaultEndpointResolver<EndpointParametersT extends EndpointParameters> {
13
- (params: EndpointParametersT, context?: {
14
- logger?: Logger;
15
- }): EndpointV2;
16
- }
17
- /**
18
- * @internal
19
- */
20
- export declare const createEndpointRuleSetHttpAuthSchemeProvider: <EndpointParametersT extends EndpointParameters, HttpAuthSchemeParametersT extends HttpAuthSchemeParameters>(defaultEndpointResolver: DefaultEndpointResolver<EndpointParametersT>, defaultHttpAuthSchemeResolver: HttpAuthSchemeProvider<HttpAuthSchemeParametersT>) => EndpointRuleSetHttpAuthSchemeProvider<EndpointParametersT, HttpAuthSchemeParametersT>;
21
- /**
22
- * @internal
23
- */
24
- export interface EndpointRuleSetSmithyContext {
25
- endpointRuleSet?: {
26
- getEndpointParameterInstructions?: () => EndpointParameterInstructions;
27
- };
28
- }
29
- /**
30
- * @internal
31
- */
32
- export interface EndpointRuleSetHttpAuthSchemeParametersProvider<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters & EndpointParameters, TInput extends object> extends HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput> {
33
- }
34
- /**
35
- * @internal
36
- */
37
- export declare const createEndpointRuleSetHttpAuthSchemeParametersProvider: <TConfig extends object, TContext extends HandlerExecutionContext, THttpAuthSchemeParameters extends HttpAuthSchemeParameters, TEndpointParameters extends EndpointParameters, TParameters extends THttpAuthSchemeParameters & TEndpointParameters, TInput extends object>(defaultHttpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, THttpAuthSchemeParameters, TInput>) => EndpointRuleSetHttpAuthSchemeParametersProvider<TConfig, TContext, THttpAuthSchemeParameters & TEndpointParameters, TInput>;
@@ -1,17 +0,0 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { HttpRequest as IHttpRequest } from "@smithy/types";
3
- import { ApiKeyIdentity } from "./apiKeyIdentity";
4
- import { HttpSigner } from "./HttpSigner";
5
- /**
6
- * @internal
7
- */
8
- export declare enum HttpApiKeyAuthLocation {
9
- HEADER = "header",
10
- QUERY = "query"
11
- }
12
- /**
13
- * @internal
14
- */
15
- export declare class HttpApiKeyAuthSigner implements HttpSigner {
16
- sign(httpRequest: HttpRequest, identity: ApiKeyIdentity, signingProperties: Record<string, any>): Promise<IHttpRequest>;
17
- }
@@ -1,10 +0,0 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { HttpRequest as IHttpRequest } from "@smithy/types";
3
- import { HttpSigner } from "./HttpSigner";
4
- import { TokenIdentity } from "./tokenIdentity";
5
- /**
6
- * @internal
7
- */
8
- export declare class HttpBearerAuthSigner implements HttpSigner {
9
- sign(httpRequest: HttpRequest, identity: TokenIdentity, signingProperties: Record<string, any>): Promise<IHttpRequest>;
10
- }
@@ -1,14 +0,0 @@
1
- export * from "./HttpAuthScheme";
2
- export * from "./HttpAuthSchemeProvider";
3
- export * from "./HttpSigner";
4
- export * from "./IdentityProviderConfig";
5
- export * from "./SigV4Signer";
6
- export * from "./apiKeyIdentity";
7
- export * from "./endpointRuleSet";
8
- export * from "./httpApiKeyAuth";
9
- export * from "./httpBearerAuth";
10
- export * from "./memoizeIdentityProvider";
11
- export * from "./middleware-http-auth-scheme";
12
- export * from "./middleware-http-signing";
13
- export * from "./noAuth";
14
- export * from "./tokenIdentity";
@@ -1,30 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export declare const createIsIdentityExpiredFunction: (expirationMs: number) => (identity: Identity) => boolean;
6
- /**
7
- * @internal
8
- * This may need to be configurable in the future, but for now it is defaulted to 5min.
9
- */
10
- export declare const EXPIRATION_MS = 300000;
11
- /**
12
- * @internal
13
- */
14
- export declare const isIdentityExpired: (identity: Identity) => boolean;
15
- /**
16
- * @internal
17
- */
18
- export declare const doesIdentityRequireRefresh: (identity: Identity) => boolean;
19
- /**
20
- * @internal
21
- */
22
- export interface MemoizedIdentityProvider<IdentityT extends Identity> {
23
- (options?: Record<string, any> & {
24
- forceRefresh?: boolean;
25
- }): Promise<IdentityT>;
26
- }
27
- /**
28
- * @internal
29
- */
30
- export declare const memoizeIdentityProvider: <IdentityT extends Identity>(provider: IdentityT | IdentityProvider<IdentityT> | undefined, isExpired: (resolved: Identity) => boolean, requiresRefresh: (resolved: Identity) => boolean) => MemoizedIdentityProvider<IdentityT> | undefined;
@@ -1,20 +0,0 @@
1
- import { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
2
- import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider } from "../HttpAuthSchemeProvider";
3
- import { IdentityProviderConfig } from "../IdentityProviderConfig";
4
- import { PreviouslyResolved } from "./httpAuthSchemeMiddleware";
5
- /**
6
- * @internal
7
- */
8
- export declare const httpAuthSchemeEndpointRuleSetMiddlewareOptions: SerializeHandlerOptions & RelativeMiddlewareOptions;
9
- /**
10
- * @internal
11
- */
12
- interface HttpAuthSchemeEndpointRuleSetPluginOptions<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object> {
13
- httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
14
- identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
15
- }
16
- /**
17
- * @internal
18
- */
19
- export declare const getHttpAuthSchemeEndpointRuleSetPlugin: <TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object>(config: TConfig & PreviouslyResolved<TParameters>, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }: HttpAuthSchemeEndpointRuleSetPluginOptions<TConfig, TContext, TParameters, TInput>) => Pluggable<any, any>;
20
- export {};
@@ -1,20 +0,0 @@
1
- import { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
2
- import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider } from "../HttpAuthSchemeProvider";
3
- import { IdentityProviderConfig } from "../IdentityProviderConfig";
4
- import { PreviouslyResolved } from "./httpAuthSchemeMiddleware";
5
- /**
6
- * @internal
7
- */
8
- export declare const httpAuthSchemeMiddlewareOptions: SerializeHandlerOptions & RelativeMiddlewareOptions;
9
- /**
10
- * @internal
11
- */
12
- interface HttpAuthSchemePluginOptions<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object> {
13
- httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
14
- identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
15
- }
16
- /**
17
- * @internal
18
- */
19
- export declare const getHttpAuthSchemePlugin: <TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object>(config: TConfig & PreviouslyResolved<TParameters>, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }: HttpAuthSchemePluginOptions<TConfig, TContext, TParameters, TInput>) => Pluggable<any, any>;
20
- export {};
@@ -1,35 +0,0 @@
1
- import { HandlerExecutionContext, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
2
- import { HttpAuthScheme, SelectedHttpAuthScheme } from "../HttpAuthScheme";
3
- import { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider } from "../HttpAuthSchemeProvider";
4
- import { IdentityProviderConfig } from "../IdentityProviderConfig";
5
- /**
6
- * @internal
7
- */
8
- export interface PreviouslyResolved<TParameters extends HttpAuthSchemeParameters> {
9
- httpAuthSchemes: HttpAuthScheme[];
10
- httpAuthSchemeProvider: HttpAuthSchemeProvider<TParameters>;
11
- }
12
- /**
13
- * @internal
14
- */
15
- interface HttpAuthSchemeMiddlewareOptions<TConfig extends object, TContext extends HandlerExecutionContext, TParameters extends HttpAuthSchemeParameters, TInput extends object> {
16
- httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
17
- identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
18
- }
19
- /**
20
- * @internal
21
- */
22
- interface HttpAuthSchemeMiddlewareSmithyContext extends Record<string, unknown> {
23
- selectedHttpAuthScheme?: SelectedHttpAuthScheme;
24
- }
25
- /**
26
- * @internal
27
- */
28
- interface HttpAuthSchemeMiddlewareHandlerExecutionContext extends HandlerExecutionContext {
29
- [SMITHY_CONTEXT_KEY]?: HttpAuthSchemeMiddlewareSmithyContext;
30
- }
31
- /**
32
- * @internal
33
- */
34
- export declare const httpAuthSchemeMiddleware: <TInput extends object, Output extends object, TConfig extends object, TContext extends HttpAuthSchemeMiddlewareHandlerExecutionContext, TParameters extends HttpAuthSchemeParameters>(config: TConfig & PreviouslyResolved<TParameters>, mwOptions: HttpAuthSchemeMiddlewareOptions<TConfig, TContext, TParameters, TInput>) => SerializeMiddleware<TInput, Output>;
35
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./httpAuthSchemeMiddleware";
2
- export * from "./getHttpAuthSchemeEndpointRuleSetPlugin";
3
- export * from "./getHttpAuthSchemePlugin";
@@ -1,9 +0,0 @@
1
- import { FinalizeRequestHandlerOptions, Pluggable, RelativeMiddlewareOptions } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export declare const httpSigningMiddlewareOptions: FinalizeRequestHandlerOptions & RelativeMiddlewareOptions;
6
- /**
7
- * @internal
8
- */
9
- export declare const getHttpSigningPlugin: <Input extends object, Output extends object>(config: object) => Pluggable<Input, Output>;
@@ -1,5 +0,0 @@
1
- import { FinalizeRequestMiddleware } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export declare const httpSigningMiddleware: <Input extends object, Output extends object>(config: object) => FinalizeRequestMiddleware<Input, Output>;
@@ -1,2 +0,0 @@
1
- export * from "./httpSigningMiddleware";
2
- export * from "./getHttpSigningMiddleware";
@@ -1,9 +0,0 @@
1
- import { HttpRequest, Identity } from "@smithy/types";
2
- import { HttpSigner } from "./HttpSigner";
3
- /**
4
- * Signer for the synthetic @smithy.api#noAuth auth scheme.
5
- * @internal
6
- */
7
- export declare class NoAuthSigner implements HttpSigner {
8
- sign(httpRequest: HttpRequest, identity: Identity, signingProperties: Record<string, unknown>): Promise<HttpRequest>;
9
- }
@@ -1,14 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export interface TokenIdentity extends Identity {
6
- /**
7
- * The literal token string
8
- */
9
- readonly token: string;
10
- }
11
- /**
12
- * @internal
13
- */
14
- export type TokenIdentityProvider = IdentityProvider<TokenIdentity>;