# @theorchard/lambda-apollo

## 3.1.9

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.7

## 3.1.8

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.6

## 3.1.7

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.5

## 3.1.6

### Patch Changes

-   Add lodash-es to lodash jest module mapping for ESM compatibility

## 3.1.5

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.3

## 3.1.4

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.2

## 3.1.3

### Patch Changes

-   Update dependencies

## 3.1.2

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.6.0

## 3.1.1

### Patch Changes

-   Pinning graphql 16.8.1, upgrading graphql-server to Apollo v5, express v5
-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.5.1

## 3.1.0

### Minor Changes

-   PP-1105 Update lambda-apollo to optionally take a different `ApolloLink` to perform the authorization link behavior. If nothing is passed, use the package's existing `authLink` which is based on the Shared M2M JWT Token

If you need to use the Shared M2M JWT Token to pass an Authorization header to authenticate, you can continue to instantiate your ApolloClient like:

```ts
import { createClient, apolloLinks } from '@theorchard/lambda-apollo';
import { APPLICATION_NAME } from '../constants';

export const client = createClient({
    authentication: AUTHENTICATION, // These provide Profile Headers, but we are moving toward deprecating them
    lambdaName: APPLICATION_NAME,
    links: [
        new apolloLinks.RetryLink(), // See Readme for more details
    ],
});
```

However, if you are migrating to use [Dedicated M2M Tokens](https://www.notion.so/How-to-configure-a-machine-to-have-a-dedicated-Auth0-M2M-Client-and-Automated-JWT-Token-Refresh-2e00d3e763ce497abaf6d2e9a0e947ff) to authenticate your Lambda function to make calls to PDE Microservices, you should:

-   Install [`@theorchard/backend-m2m-token-manager`](https://github.com/theorchard/backend-js-packages/tree/master/packages/backend-m2m-token-manager)
-   Install [`@theorchard/backend-secrets-manager-sdk-v3`](https://github.com/theorchard/backend-js-packages/tree/master/packages/backend-secrets-manager-sdk-v3)

Then to instantiate the client:

```ts
import { m2mAuthorizationLink, M2MTokenManager } from '@theorchard/backend-m2m-token-manager';
import { SecretsManager } from '@theorchard/backend-secrets-manager-sdk-v3';
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
import { createClient, apolloLinks } from '@theorchard/lambda-apollo';
import { APPLICATION_NAME, AUTHENTICATION } from '../constants';
import { ENVIRONMENT } from '../config';

const client = createClient({
    authentication: AUTHENTICATION, // These provide Profile Headers, but we are moving toward deprecating them
    lambdaName: APPLICATION_NAME,
    links: [
        new apolloLinks.RetryLink(), // See Readme for more details
    ],
    authorizationLink: m2mAuthorizationLink({
        m2mTokenManager: new M2MTokenManager({
            secretsManager: new SecretsManager({
                secretsManagerClient: new SecretsManagerClient(),
            }),
            environment: ENVIRONMENT,
            serviceName: APPLICATION_NAME,
        }),
    }),
});
```

## 3.0.4

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.5.0

## 3.0.3

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.4.0

## 3.0.2

### Patch Changes

-   Updated dependencies
    -   @theorchard/utils-environment@1.1.0
    -   @theorchard/jwt-service-handler@4.3.2

## 3.0.1

### Patch Changes

-   Updated dependencies
    -   @theorchard/constants@1.6.0
    -   @theorchard/utils-environment@1.0.18
    -   @theorchard/jwt-service-handler@4.3.1

## 3.0.0

### Major Changes

-   Move default GRAPHQL_URL from graphql-gateway to graphql-router.

## 2.1.15

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.3.0

## 2.1.14

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.2.2

## 2.1.13

### Patch Changes

-   Updated dependencies
    -   @theorchard/constants@1.5.0
    -   @theorchard/utils-environment@1.0.17
    -   @theorchard/jwt-service-handler@4.2.1

## 2.1.12

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.2.0

## 2.1.11

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.1.0

## 2.1.10

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.0.6

## 2.1.9

### Patch Changes

-   @theorchard/utils-environment@1.0.16
-   @theorchard/jwt-service-handler@4.0.5

## 2.1.8

### Patch Changes

-   @theorchard/utils-environment@1.0.15
-   @theorchard/jwt-service-handler@4.0.4

## 2.1.7

### Patch Changes

-   @theorchard/utils-environment@1.0.14
-   @theorchard/jwt-service-handler@4.0.3

## 2.1.6

### Patch Changes

-   Updated dependencies
    -   @theorchard/constants@1.4.1
    -   @theorchard/utils-environment@1.0.13
    -   @theorchard/jwt-service-handler@4.0.2

## 2.1.5

### Patch Changes

-   Updated dependencies
    -   @theorchard/constants@1.4.0
    -   @theorchard/utils-environment@1.0.12
    -   @theorchard/jwt-service-handler@4.0.1

## 2.1.4

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@4.0.0

## 2.1.3

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@3.0.0

## 2.1.2

### Patch Changes

-   Updated dependencies
    -   @theorchard/constants@1.3.1
    -   @theorchard/utils-environment@1.0.11
    -   @theorchard/jwt-service-handler@2.1.1

## 2.1.1

### Patch Changes

-   Updated dependencies
    -   @theorchard/jwt-service-handler@2.1.0

## 2.1.0

### Minor Changes

-   Exposed AuthenticationInput type for usage in the lambdas

## 2.0.0

### Major Changes

-   Removing Batch Link and Batch Options from client creation

## 1.2.1

### Patch Changes

-   Export ApolloClient and NormalizedCacheObject to have a consistent version

## 1.2.0

### Minor Changes

-   Avoid importing @apollo/client directly to avoid react dependencies

## 1.1.0

### Minor Changes

-   Add reexports

## 1.0.0

### Major Changes

-   Init Package
