Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: Amplify JS release #12719

Merged
merged 11 commits into from
Dec 18, 2023
4 changes: 2 additions & 2 deletions .github/actions/node-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ inputs:
runs:
using: 'composite'
steps:
- name: Setup Node.js 16
- name: Setup Node.js 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16
node-version: 18
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/callable-canary-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
# Minimal depth 2 so we can checkout the commit before possible merge commit.
fetch-depth: 2
path: amplify-js
- name: Setup Node.js 16
- name: Setup Node.js 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16
node-version: 18
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2

Expand Down
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:
"generateClient.test.ts",
"AWSAppSyncRealTimeProvider.test.ts",
"--runInBand",
"--testTimeout",
"600000", // 10 min timeout so jest doesn't error while we're stepping through code
Expand Down
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<img src="https://s3.amazonaws.com/aws-mobile-hub-images/aws-amplify-logo.png" alt="AWS Amplify" width="550" >

<a href="https://nodei.co/npm/aws-amplify/">
<img src="https://nodei.co/npm/aws-amplify.svg?downloads=true&downloadRank=true&stars=true">
</a>
<p>
<a href="https://discord.gg/jWVbPfC" target="_blank">
<img src="https://img.shields.io/discord/308323056592486420?logo=discord"" alt="Discord Chat" />
</a>
<a href="https://codecov.io/gh/aws-amplify/amplify-js">
<img src="https://codecov.io/gh/aws-amplify/amplify-js/branch/main/graph/badge.svg" />
</a>
<a href="https://lgtm.com/projects/g/aws-amplify/amplify-js/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/aws-amplify/amplify-js.svg?logo=lgtm&logoWidth=18"/>
</a>
<a href="https://circleci.com/gh/aws-amplify/amplify-js">
<img src="https://img.shields.io/circleci/project/github/aws-amplify/amplify-js/main.svg" alt="build:started">
</a>
</p>
[![current aws-amplify package version](https://img.shields.io/npm/v/aws-amplify?color=brightgreen&label=npm%20package)](https://www.npmjs.com/package/aws-amplify)
[![weekly downloads](https://img.shields.io/npm/dw/aws-amplify)](https://www.npmjs.com/package/aws-amplify)
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/aws-amplify/amplify-js/push-main-release.yml)
](https://github.com/aws-amplify/amplify-js/blob/main/.github/workflows/push-main-release.yml)
[![code coverage](https://codecov.io/gh/aws-amplify/amplify-js/branch/main/graph/badge.svg)](https://codecov.io/gh/aws-amplify/amplify-js)
[![join discord](https://img.shields.io/discord/308323056592486420?logo=discord)](https://discord.gg/jWVbPfC)

### Reporting Bugs / Feature Requests

Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('jest').Config} */
module.exports = {
workerIdleMemoryLimit: '512MB',
coveragePathIgnorePatterns: [
'/node_modules/',
'dist',
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"@types/babel__traverse": "7.20.0",
"path-scurry": "1.10.0",
"**/glob/minipass": "6.0.2",
"nx": "16.7.0",
"next": "13.5.6"
"nx": "16.7.0"
}
}
4 changes: 2 additions & 2 deletions packages/adapter-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.7",
"description": "The adapter for the supporting of using Amplify APIs in Next.js.",
"peerDependencies": {
"aws-amplify": "^6.0.0",
"aws-amplify": "^6.0.7",
"next": ">=13.5.0 <15.0.0"
},
"dependencies": {
Expand Down Expand Up @@ -69,7 +69,7 @@
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"test": "npm run lint && jest -w 1 --coverage",
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
}
}
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"access": "public"
},
"scripts": {
"test": "npm run lint && jest -w 1 --coverage",
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
"test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
"build-with-test": "npm run clean && npm run test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,33 @@ describe('AWSAppSyncRealTimeProvider', () => {
);
});

test('authenticating with AWS_LAMBDA/custom w/ custom header function that accepts request options', async () => {
expect.assertions(2);

provider
.subscribe({
appSyncGraphqlEndpoint: 'ws://localhost:8080',
authenticationType: 'none',
additionalHeaders: async requestOptions => {
expect(requestOptions).toEqual(
expect.objectContaining({
queryString: '',
url: 'ws://localhost:8080',
})
);
return { Authorization: 'test' };
},
})
.subscribe({ error: () => {} });

await fakeWebSocketInterface?.readyForUse;

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2772,6 +2772,63 @@ exports[`generateClient basic model operations - custom client and request heade
]
`;

exports[`generateClient basic model operations - custom client and request headers can create() - with custom client header functions that pass requestOptions 1`] = `
[
[
{
"abortController": AbortController {},
"options": {
"body": {
"query": "mutation ($input: CreateTodoInput!) {
createTodo(input: $input) {
id
name
description
status
tags
createdAt
updatedAt
todoMetaId
owner
}
}
",
"variables": {
"input": {
"description": "something something",
"name": "some name",
},
},
},
"headers": {
"X-Api-Key": "FAKE-KEY",
"rq-method": "POST",
"rq-qs": "mutation ($input: CreateTodoInput!) {
createTodo(input: $input) {
id
name
description
status
tags
createdAt
updatedAt
todoMetaId
owner
}
}
",
"rq-url": "https://localhost/graphql",
"x-amz-user-agent": "aws-amplify/latest api/latest framework/latest",
},
"signingServiceInfo": undefined,
"withCredentials": undefined,
},
"url": "https://localhost/graphql",
},
],
]
`;

exports[`generateClient basic model operations - custom client and request headers can create() - with custom client headers 1`] = `
[
[
Expand Down Expand Up @@ -2856,6 +2913,63 @@ exports[`generateClient basic model operations - custom client and request heade
]
`;

exports[`generateClient basic model operations - custom client and request headers can create() - with custom request header function that accept requestOptions 1`] = `
[
[
{
"abortController": AbortController {},
"options": {
"body": {
"query": "mutation ($input: CreateTodoInput!) {
createTodo(input: $input) {
id
name
description
status
tags
createdAt
updatedAt
todoMetaId
owner
}
}
",
"variables": {
"input": {
"description": "something something",
"name": "some name",
},
},
},
"headers": {
"X-Api-Key": "FAKE-KEY",
"rq-method": "POST",
"rq-qs": "mutation ($input: CreateTodoInput!) {
createTodo(input: $input) {
id
name
description
status
tags
createdAt
updatedAt
todoMetaId
owner
}
}
",
"rq-url": "https://localhost/graphql",
"x-amz-user-agent": "aws-amplify/latest api/latest framework/latest",
},
"signingServiceInfo": undefined,
"withCredentials": undefined,
},
"url": "https://localhost/graphql",
},
],
]
`;

exports[`generateClient basic model operations - custom client and request headers can create() - with custom request headers 1`] = `
[
[
Expand Down
Loading
Loading