Skip to content

Commit

Permalink
release(required): Amplify JS release (#12575)
Browse files Browse the repository at this point in the history
  • Loading branch information
erinleigh90 authored Nov 16, 2023
2 parents 6119ba5 + 4953a58 commit f757363
Show file tree
Hide file tree
Showing 32 changed files with 2,936 additions and 1,546 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
// Optionally specify a single test file to run/debug:
"GraphQLAPI.test.ts",
"generateClient.test.ts",
"--runInBand",
"--testTimeout",
"600000", // 10 min timeout so jest doesn't error while we're stepping through code
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[![Closed Issues](https://img.shields.io/github/issues-closed/aws-amplify/amplify-js?color=%2325CC00&label=issues%20closed)](https://github.com/aws-amplify/amplify-js/issues?q=is%3Aissue+is%3Aclosed+)

> **Note**
> aws-amplify 5 has been released. If you are looking for upgrade guidance [click here](#notice)
> aws-amplify 6 has been released. If you are looking for upgrade guidance [click here](#notice)
### AWS Amplify is a JavaScript library for frontend and mobile developers building cloud-enabled applications

Expand Down Expand Up @@ -61,10 +61,12 @@ Our default implementation works with Amazon Web Services (AWS), but AWS Amplify

AWS Amplify is available as `aws-amplify` on [npm](https://www.npmjs.com/package/aws-amplify).

To get started pick your platform from our [**Getting Started** home page](https://docs.amplify.aws/start/?sc_icampaign=start&sc_ichannel=docs-home)
To get started pick your platform from our [**Getting Started** home page](https://docs.amplify.aws/javascript/)

## Notice:

### Amplify 6.x.x has breaking changes. Please see the breaking changes on our [migration guide](https://docs.amplify.aws/javascript/build-a-backend/troubleshooting/migrate-from-javascript-v5-to-v6/)

### Amplify 5.x.x has breaking changes. Please see the breaking changes below:

- If you are using **default exports** from any Amplify package, then you will need to migrate to using named exports. For example:
Expand Down
3 changes: 2 additions & 1 deletion packages/adapter-nextjs/src/api/generateServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { NextServer } from '../types';
import { createServerRunnerForAPI } from './createServerRunnerForAPI';
import { getAmplifyConfig } from '../utils';
import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
import { CustomHeaders } from '@aws-amplify/data-schema-types';

type CookiesClientParams = {
cookies: NextServer.ServerComponentContext['cookies'];
Expand Down Expand Up @@ -116,7 +117,7 @@ export function generateServerClientUsingReqRes<
const wrappedGraphql = (
contextSpec: AmplifyServer.ContextSpec,
options: GraphQLOptionsV6,
additionalHeaders?: { [key: string]: string }
additionalHeaders?: CustomHeaders
) => {
const amplifyInstance = getAmplifyServerContext(contextSpec).amplify;
return prevGraphql.call(
Expand Down
16 changes: 16 additions & 0 deletions packages/adapter-nextjs/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,19 @@ export {
generateServerClientUsingReqRes,
generateServerClientUsingCookies,
} from './generateServerClient';

import {
V6ClientSSRCookies,
V6ClientSSRRequest,
} from '@aws-amplify/api-graphql';

// explicitly defaulting to `never` here resolves
// TS2589: Type instantiation is excessively deep and possibly infinite.
// When this type is used without a generic type arg, i.e. `let client: Client`
type ClientUsingSSRCookies<T extends Record<any, any> = never> =
V6ClientSSRCookies<T>;

type ClientUsingSSRReq<T extends Record<any, any> = never> =
V6ClientSSRRequest<T>;

export { ClientUsingSSRCookies, ClientUsingSSRReq };
21 changes: 21 additions & 0 deletions packages/api-graphql/__tests__/AWSAppSyncRealTimeProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,27 @@ describe('AWSAppSyncRealTimeProvider', () => {
);
});

test('authenticating with AWS_LAMBDA/custom w/ custom header function', async () => {
expect.assertions(1);

provider
.subscribe({
appSyncGraphqlEndpoint: 'ws://localhost:8080',
authenticationType: 'none',
additionalHeaders: async () => ({
Authorization: 'test',
}),
})
.subscribe({ error: () => {} });

await fakeWebSocketInterface?.readyForUse;

expect(loggerSpy).toBeCalledWith(
'DEBUG',
'Authenticating with "none"'
);
});

test('authenticating with AWS_LAMBDA/custom without Authorization', async () => {
expect.assertions(1);

Expand Down
Loading

0 comments on commit f757363

Please sign in to comment.