@smithy/experimental-identity-and-auth 0.0.2 → 0.0.3

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.
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultIdentityProviderConfig = void 0;
4
+ class DefaultIdentityProviderConfig {
5
+ constructor(config) {
6
+ this.authSchemes = new Map();
7
+ for (const [key, value] of Object.entries(config)) {
8
+ this.authSchemes.set(key, value);
9
+ }
10
+ }
11
+ getIdentityProvider(schemeId) {
12
+ return this.authSchemes.get(schemeId);
13
+ }
14
+ }
15
+ exports.DefaultIdentityProviderConfig = DefaultIdentityProviderConfig;
package/dist-cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./IdentityProviderConfiguration"), exports);
5
4
  tslib_1.__exportStar(require("./HttpAuthScheme"), exports);
6
5
  tslib_1.__exportStar(require("./HttpSigner"), exports);
6
+ tslib_1.__exportStar(require("./IdentityProviderConfig"), exports);
7
7
  tslib_1.__exportStar(require("./SigV4Signer"), exports);
8
8
  tslib_1.__exportStar(require("./apiKeyIdentity"), exports);
9
9
  tslib_1.__exportStar(require("./httpApiKeyAuth"), exports);
@@ -0,0 +1,11 @@
1
+ export class DefaultIdentityProviderConfig {
2
+ constructor(config) {
3
+ this.authSchemes = new Map();
4
+ for (const [key, value] of Object.entries(config)) {
5
+ this.authSchemes.set(key, value);
6
+ }
7
+ }
8
+ getIdentityProvider(schemeId) {
9
+ return this.authSchemes.get(schemeId);
10
+ }
11
+ }
package/dist-es/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./IdentityProviderConfiguration";
2
1
  export * from "./HttpAuthScheme";
3
2
  export * from "./HttpSigner";
3
+ export * from "./IdentityProviderConfig";
4
4
  export * from "./SigV4Signer";
5
5
  export * from "./apiKeyIdentity";
6
6
  export * from "./httpApiKeyAuth";
@@ -1,5 +1,6 @@
1
1
  import { Identity, IdentityProvider } from "@smithy/types";
2
2
  import { HttpSigner } from "./HttpSigner";
3
+ import { IdentityProviderConfig } from "./IdentityProviderConfig";
3
4
  /**
4
5
  * ID for {@link HttpAuthScheme}
5
6
  * @internal
@@ -15,9 +16,9 @@ export interface HttpAuthScheme {
15
16
  */
16
17
  schemeId: HttpAuthSchemeId;
17
18
  /**
18
- * IdentityProvider corresponding to an HttpAuthScheme.
19
+ * Gets the IdentityProvider corresponding to an HttpAuthScheme.
19
20
  */
20
- identityProvider: IdentityProvider<Identity>;
21
+ identityProvider(config: IdentityProviderConfig): IdentityProvider<Identity> | undefined;
21
22
  /**
22
23
  * HttpSigner corresponding to an HttpAuthScheme.
23
24
  */
@@ -0,0 +1,28 @@
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 IddentityProviderConfig
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>>);
27
+ getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
28
+ }
@@ -1,6 +1,6 @@
1
- export * from "./IdentityProviderConfiguration";
2
1
  export * from "./HttpAuthScheme";
3
2
  export * from "./HttpSigner";
3
+ export * from "./IdentityProviderConfig";
4
4
  export * from "./SigV4Signer";
5
5
  export * from "./apiKeyIdentity";
6
6
  export * from "./httpApiKeyAuth";
@@ -1,5 +1,6 @@
1
1
  import { Identity, IdentityProvider } from "@smithy/types";
2
2
  import { HttpSigner } from "./HttpSigner";
3
+ import { IdentityProviderConfig } from "./IdentityProviderConfig";
3
4
  /**
4
5
  * ID for {@link HttpAuthScheme}
5
6
  * @internal
@@ -15,9 +16,9 @@ export interface HttpAuthScheme {
15
16
  */
16
17
  schemeId: HttpAuthSchemeId;
17
18
  /**
18
- * IdentityProvider corresponding to an HttpAuthScheme.
19
+ * Gets the IdentityProvider corresponding to an HttpAuthScheme.
19
20
  */
20
- identityProvider: IdentityProvider<Identity>;
21
+ identityProvider(config: IdentityProviderConfig): IdentityProvider<Identity> | undefined;
21
22
  /**
22
23
  * HttpSigner corresponding to an HttpAuthScheme.
23
24
  */
@@ -0,0 +1,28 @@
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 IddentityProviderConfig
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>>);
27
+ getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
28
+ }
@@ -1,6 +1,6 @@
1
- export * from "./IdentityProviderConfiguration";
2
1
  export * from "./HttpAuthScheme";
3
2
  export * from "./HttpSigner";
3
+ export * from "./IdentityProviderConfig";
4
4
  export * from "./SigV4Signer";
5
5
  export * from "./apiKeyIdentity";
6
6
  export * from "./httpApiKeyAuth";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/experimental-identity-and-auth",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/protocol-http": "^2.0.5",
27
- "@smithy/signature-v4": "^2.0.5",
28
- "@smithy/types": "^2.2.2",
26
+ "@smithy/protocol-http": "^3.0.0",
27
+ "@smithy/signature-v4": "^2.0.6",
28
+ "@smithy/types": "^2.3.0",
29
29
  "tslib": "^2.5.0"
30
30
  },
31
31
  "engines": {
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultIdentityProviderConfiguration = void 0;
4
- class DefaultIdentityProviderConfiguration {
5
- constructor(authSchemes) {
6
- this.authSchemes = new Map();
7
- for (const authScheme of authSchemes) {
8
- this.authSchemes.set(authScheme.schemeId, authScheme);
9
- }
10
- }
11
- getIdentityProvider(schemeId) {
12
- var _a;
13
- return (_a = this.authSchemes.get(schemeId)) === null || _a === void 0 ? void 0 : _a.identityProvider;
14
- }
15
- getAuthSchemes() {
16
- return this.authSchemes;
17
- }
18
- }
19
- exports.DefaultIdentityProviderConfiguration = DefaultIdentityProviderConfiguration;
@@ -1,14 +0,0 @@
1
- export class DefaultIdentityProviderConfiguration {
2
- constructor(authSchemes) {
3
- this.authSchemes = new Map();
4
- for (const authScheme of authSchemes) {
5
- this.authSchemes.set(authScheme.schemeId, authScheme);
6
- }
7
- }
8
- getIdentityProvider(schemeId) {
9
- return this.authSchemes.get(schemeId)?.identityProvider;
10
- }
11
- getAuthSchemes() {
12
- return this.authSchemes;
13
- }
14
- }
@@ -1,36 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- import { HttpAuthScheme, HttpAuthSchemeId } from "./HttpAuthScheme";
3
- /**
4
- * Interface to get an IdentityProvider for a specified HttpAuthScheme
5
- * @internal
6
- */
7
- export interface IdentityProviderConfiguration {
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
- * Gets the configured HttpAuthSchemes.
16
- * @returns all configured HttpAuthSchemes
17
- */
18
- getAuthSchemes(): Map<HttpAuthSchemeId, HttpAuthScheme>;
19
- }
20
- /**
21
- * Default implementation of IdentityProviderConfiguration
22
- * @internal
23
- */
24
- export declare class DefaultIdentityProviderConfiguration implements IdentityProviderConfiguration {
25
- private authSchemes;
26
- /**
27
- * Creates an IdentityProviderConfiguration with a list of HttpAuthSchemes.
28
- *
29
- * HttpAuthSchemes that have the same schemeId will be deduped, where the
30
- * HttpAuthScheme later in the list will have priority.
31
- * @param authSchemes auth schemes to configure
32
- */
33
- constructor(authSchemes: HttpAuthScheme[]);
34
- getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
35
- getAuthSchemes(): Map<HttpAuthSchemeId, HttpAuthScheme>;
36
- }
@@ -1,36 +0,0 @@
1
- import { Identity, IdentityProvider } from "@smithy/types";
2
- import { HttpAuthScheme, HttpAuthSchemeId } from "./HttpAuthScheme";
3
- /**
4
- * Interface to get an IdentityProvider for a specified HttpAuthScheme
5
- * @internal
6
- */
7
- export interface IdentityProviderConfiguration {
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
- * Gets the configured HttpAuthSchemes.
16
- * @returns all configured HttpAuthSchemes
17
- */
18
- getAuthSchemes(): Map<HttpAuthSchemeId, HttpAuthScheme>;
19
- }
20
- /**
21
- * Default implementation of IdentityProviderConfiguration
22
- * @internal
23
- */
24
- export declare class DefaultIdentityProviderConfiguration implements IdentityProviderConfiguration {
25
- private authSchemes;
26
- /**
27
- * Creates an IdentityProviderConfiguration with a list of HttpAuthSchemes.
28
- *
29
- * HttpAuthSchemes that have the same schemeId will be deduped, where the
30
- * HttpAuthScheme later in the list will have priority.
31
- * @param authSchemes auth schemes to configure
32
- */
33
- constructor(authSchemes: HttpAuthScheme[]);
34
- getIdentityProvider(schemeId: HttpAuthSchemeId): IdentityProvider<Identity> | undefined;
35
- getAuthSchemes(): Map<HttpAuthSchemeId, HttpAuthScheme>;
36
- }