@smithy/experimental-identity-and-auth 0.5.54 → 0.6.0

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/dist-cjs/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var protocolHttp = require('@smithy/protocol-http');
3
+ var protocols = require('@smithy/core/protocols');
4
4
  var signatureV4 = require('@smithy/signature-v4');
5
- var middlewareEndpoint = require('@smithy/middleware-endpoint');
6
- var utilMiddleware = require('@smithy/util-middleware');
7
- var middlewareSerde = require('@smithy/middleware-serde');
8
- var middlewareRetry = require('@smithy/middleware-retry');
5
+ var client = require('@smithy/core/client');
6
+ var endpoints = require('@smithy/core/endpoints');
7
+ var serde = require('@smithy/core/serde');
8
+ var retry = require('@smithy/core/retry');
9
9
 
10
10
  class DefaultIdentityProviderConfig {
11
11
  authSchemes = new Map();
@@ -23,7 +23,7 @@ class DefaultIdentityProviderConfig {
23
23
 
24
24
  class SigV4Signer {
25
25
  async sign(httpRequest, identity, signingProperties) {
26
- const clonedRequest = protocolHttp.HttpRequest.clone(httpRequest);
26
+ const clonedRequest = protocols.HttpRequest.clone(httpRequest);
27
27
  const signer = new signatureV4.SignatureV4({
28
28
  applyChecksum: signingProperties.applyChecksum !== undefined ? signingProperties.applyChecksum : true,
29
29
  credentials: identity,
@@ -83,12 +83,12 @@ const createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSc
83
83
  throw new Error(`Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\``);
84
84
  }
85
85
  const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
86
- const instructionsFn = utilMiddleware.getSmithyContext(context)?.endpointRuleSet
86
+ const instructionsFn = client.getSmithyContext(context)?.endpointRuleSet
87
87
  ?.getEndpointParameterInstructions;
88
88
  if (!instructionsFn) {
89
89
  throw new Error(`getEndpointParameterInstructions() is not defined on \`${context.commandName}\``);
90
90
  }
91
- const endpointParameters = await middlewareEndpoint.resolveParams(input, { getEndpointParameterInstructions: instructionsFn }, config);
91
+ const endpointParameters = await endpoints.resolveParams(input, { getEndpointParameterInstructions: instructionsFn }, config);
92
92
  return Object.assign(defaultParameters, endpointParameters);
93
93
  };
94
94
 
@@ -111,7 +111,7 @@ class HttpApiKeyAuthSigner {
111
111
  if (!identity.apiKey) {
112
112
  throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
113
113
  }
114
- const clonedRequest = protocolHttp.HttpRequest.clone(httpRequest);
114
+ const clonedRequest = protocols.HttpRequest.clone(httpRequest);
115
115
  if (signingProperties.in === exports.HttpApiKeyAuthLocation.QUERY) {
116
116
  clonedRequest.query[signingProperties.name] = identity.apiKey;
117
117
  }
@@ -132,7 +132,7 @@ class HttpApiKeyAuthSigner {
132
132
 
133
133
  class HttpBearerAuthSigner {
134
134
  async sign(httpRequest, identity, signingProperties) {
135
- const clonedRequest = protocolHttp.HttpRequest.clone(httpRequest);
135
+ const clonedRequest = protocols.HttpRequest.clone(httpRequest);
136
136
  if (!identity.token) {
137
137
  throw new Error("request could not be signed with `token` since the `token` is not defined");
138
138
  }
@@ -207,7 +207,7 @@ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
207
207
  const httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
208
208
  const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
209
209
  const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
210
- const smithyContext = utilMiddleware.getSmithyContext(context);
210
+ const smithyContext = client.getSmithyContext(context);
211
211
  const failureReasons = [];
212
212
  for (const option of options) {
213
213
  const scheme = authSchemes.get(option.schemeId);
@@ -242,7 +242,7 @@ const httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
242
242
  name: "httpAuthSchemeMiddleware",
243
243
  override: true,
244
244
  relation: "before",
245
- toMiddleware: middlewareEndpoint.endpointMiddlewareOptions.name,
245
+ toMiddleware: endpoints.endpointMiddlewareOptions.name,
246
246
  };
247
247
  const getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }) => ({
248
248
  applyToStack: (clientStack) => {
@@ -259,7 +259,7 @@ const httpAuthSchemeMiddlewareOptions = {
259
259
  name: "httpAuthSchemeMiddleware",
260
260
  override: true,
261
261
  relation: "before",
262
- toMiddleware: middlewareSerde.serializerMiddlewareOption.name,
262
+ toMiddleware: serde.serializerMiddlewareOption.name,
263
263
  };
264
264
  const getHttpAuthSchemePlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }) => ({
265
265
  applyToStack: (clientStack) => {
@@ -271,10 +271,10 @@ const getHttpAuthSchemePlugin = (config, { httpAuthSchemeParametersProvider, ide
271
271
  });
272
272
 
273
273
  const httpSigningMiddleware = (config) => (next, context) => async (args) => {
274
- if (!protocolHttp.HttpRequest.isInstance(args.request)) {
274
+ if (!protocols.HttpRequest.isInstance(args.request)) {
275
275
  return next(args);
276
276
  }
277
- const smithyContext = utilMiddleware.getSmithyContext(context);
277
+ const smithyContext = client.getSmithyContext(context);
278
278
  const scheme = smithyContext.selectedHttpAuthScheme;
279
279
  if (!scheme) {
280
280
  throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
@@ -293,7 +293,7 @@ const httpSigningMiddlewareOptions = {
293
293
  aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
294
294
  override: true,
295
295
  relation: "after",
296
- toMiddleware: middlewareRetry.retryMiddlewareOptions.name,
296
+ toMiddleware: retry.retryMiddlewareOptions.name,
297
297
  };
298
298
  const getHttpSigningPlugin = (config) => ({
299
299
  applyToStack: (clientStack) => {
@@ -1,4 +1,4 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  import { SignatureV4 } from "@smithy/signature-v4";
3
3
  export class SigV4Signer {
4
4
  async sign(httpRequest, identity, signingProperties) {
@@ -1,5 +1,5 @@
1
- import { resolveParams } from "@smithy/middleware-endpoint";
2
- import { getSmithyContext } from "@smithy/util-middleware";
1
+ import { getSmithyContext } from "@smithy/core/client";
2
+ import { resolveParams } from "@smithy/core/endpoints";
3
3
  export const createEndpointRuleSetHttpAuthSchemeProvider = (defaultEndpointResolver, defaultHttpAuthSchemeResolver) => {
4
4
  const endpointRuleSetHttpAuthSchemeProvider = (authParameters) => {
5
5
  const endpoint = defaultEndpointResolver(authParameters);
@@ -1,4 +1,4 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  export var HttpApiKeyAuthLocation;
3
3
  (function (HttpApiKeyAuthLocation) {
4
4
  HttpApiKeyAuthLocation["HEADER"] = "header";
@@ -1,4 +1,4 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  export class HttpBearerAuthSigner {
3
3
  async sign(httpRequest, identity, signingProperties) {
4
4
  const clonedRequest = HttpRequest.clone(httpRequest);
@@ -1,4 +1,4 @@
1
- import { endpointMiddlewareOptions } from "@smithy/middleware-endpoint";
1
+ import { endpointMiddlewareOptions } from "@smithy/core/endpoints";
2
2
  import { httpAuthSchemeMiddleware } from "./httpAuthSchemeMiddleware";
3
3
  export const httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
4
4
  step: "serialize",
@@ -1,4 +1,4 @@
1
- import { serializerMiddlewareOption } from "@smithy/middleware-serde";
1
+ import { serializerMiddlewareOption } from "@smithy/core/serde";
2
2
  import { httpAuthSchemeMiddleware } from "./httpAuthSchemeMiddleware";
3
3
  export const httpAuthSchemeMiddlewareOptions = {
4
4
  step: "serialize",
@@ -1,4 +1,4 @@
1
- import { getSmithyContext } from "@smithy/util-middleware";
1
+ import { getSmithyContext } from "@smithy/core/client";
2
2
  function convertHttpAuthSchemesToMap(httpAuthSchemes) {
3
3
  const map = new Map();
4
4
  for (const scheme of httpAuthSchemes) {
@@ -1,4 +1,4 @@
1
- import { retryMiddlewareOptions } from "@smithy/middleware-retry";
1
+ import { retryMiddlewareOptions } from "@smithy/core/retry";
2
2
  import { httpSigningMiddleware } from "./httpSigningMiddleware";
3
3
  export const httpSigningMiddlewareOptions = {
4
4
  step: "finalizeRequest",
@@ -1,5 +1,5 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { getSmithyContext } from "@smithy/util-middleware";
1
+ import { getSmithyContext } from "@smithy/core/client";
2
+ import { HttpRequest } from "@smithy/core/protocols";
3
3
  export const httpSigningMiddleware = (config) => (next, context) => async (args) => {
4
4
  if (!HttpRequest.isInstance(args.request)) {
5
5
  return next(args);
@@ -1,4 +1,4 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  import type { AwsCredentialIdentity, HttpRequest as IHttpRequest } from "@smithy/types";
3
3
  import type { HttpSigner } from "./HttpSigner";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
1
+ import { type EndpointParameterInstructions } from "@smithy/core/endpoints";
2
2
  import type { EndpointParameters, EndpointV2, HandlerExecutionContext, Logger } from "@smithy/types";
3
3
  import type { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider } from "./HttpAuthSchemeProvider";
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  import type { HttpRequest as IHttpRequest } from "@smithy/types";
3
- import type { ApiKeyIdentity } from "./apiKeyIdentity";
4
3
  import type { HttpSigner } from "./HttpSigner";
4
+ import type { ApiKeyIdentity } from "./apiKeyIdentity";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -1,4 +1,4 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
1
+ import { HttpRequest } from "@smithy/core/protocols";
2
2
  import type { HttpRequest as IHttpRequest } from "@smithy/types";
3
3
  import type { HttpSigner } from "./HttpSigner";
4
4
  import type { TokenIdentity } from "./tokenIdentity";
@@ -1,7 +1,7 @@
1
1
  import type { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
2
2
  import type { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider } from "../HttpAuthSchemeProvider";
3
3
  import type { IdentityProviderConfig } from "../IdentityProviderConfig";
4
- import type { PreviouslyResolved } from "./httpAuthSchemeMiddleware";
4
+ import { type PreviouslyResolved } from "./httpAuthSchemeMiddleware";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import type { HandlerExecutionContext, Pluggable, RelativeMiddlewareOptions, SerializeHandlerOptions } from "@smithy/types";
2
2
  import type { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider } from "../HttpAuthSchemeProvider";
3
3
  import type { IdentityProviderConfig } from "../IdentityProviderConfig";
4
- import type { PreviouslyResolved } from "./httpAuthSchemeMiddleware";
4
+ import { type PreviouslyResolved } from "./httpAuthSchemeMiddleware";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -1,4 +1,4 @@
1
- import type { HandlerExecutionContext, SerializeMiddleware, SMITHY_CONTEXT_KEY } from "@smithy/types";
1
+ import type { HandlerExecutionContext, SMITHY_CONTEXT_KEY, SerializeMiddleware } from "@smithy/types";
2
2
  import type { HttpAuthScheme, SelectedHttpAuthScheme } from "../HttpAuthScheme";
3
3
  import type { HttpAuthSchemeParameters, HttpAuthSchemeParametersProvider, HttpAuthSchemeProvider } from "../HttpAuthSchemeProvider";
4
4
  import type { IdentityProviderConfig } from "../IdentityProviderConfig";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/experimental-identity-and-auth",
3
- "version": "0.5.54",
3
+ "version": "0.6.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
6
  "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline experimental-identity-and-auth",
@@ -26,13 +26,10 @@
26
26
  "license": "Apache-2.0",
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@smithy/middleware-endpoint": "^4.4.32",
30
- "@smithy/middleware-retry": "^4.5.7",
31
- "@smithy/middleware-serde": "^4.2.20",
32
- "@smithy/protocol-http": "^5.3.14",
33
- "@smithy/signature-v4": "^5.3.14",
29
+ "@smithy/core": "^3.24.0",
30
+ "@smithy/middleware-retry": "^4.6.0",
31
+ "@smithy/signature-v4": "^5.4.0",
34
32
  "@smithy/types": "^4.14.1",
35
- "@smithy/util-middleware": "^4.2.14",
36
33
  "tslib": "^2.6.2"
37
34
  },
38
35
  "engines": {