Skip to content

Commit

Permalink
release(required): Amplify JS release (#13342)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samaritan1011001 authored May 6, 2024
2 parents fc29eeb + c794c14 commit eabab06
Show file tree
Hide file tree
Showing 57 changed files with 808 additions and 215 deletions.
85 changes: 85 additions & 0 deletions .github/integ-config/integ-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ tests:
spec: restful
browser: *minimal_browser_list

# API Gen2
- test_name: integ_react_rest_api_gen2
desc: 'GEN2 Vite + React REST API'
framework: vite
category: api
sample_name: [rest]
spec: restful
backend: gen2
browser: *minimal_browser_list

# AUTH
- test_name: integ_react_javascript_authentication
desc: 'React Authentication'
Expand Down Expand Up @@ -512,6 +522,81 @@ tests:
spec: sign-in-with-oauth
browser: [chrome]

# AUTH GEN2
- test_name: integ_react_javascript_authentication_gen2
desc: 'React Authentication'
framework: react
category: auth
sample_name: [javascript-auth]
spec: functional-auth
browser: *minimal_browser_list
backend: gen2
- test_name: integ_react_auth_1_guest_to_authenticated_user_gen2
desc: 'Guest to Authenticated User'
framework: react
category: auth
sample_name: [guest-to-auth-user]
spec: guest-to-auth-user
browser: *minimal_browser_list
backend: gen2
- test_name: integ_react_typescript_authentication_gen2
desc: 'React Typescript Authentication'
framework: react
category: auth
sample_name: [typescript-auth]
spec: functional-auth
browser: *minimal_browser_list
backend: gen2
- test_name: integ_react_auth_2_sign_in_after_sign_up_gen2
desc: 'Sign In after Sign Up'
framework: react
category: auth
sample_name: [auto-signin-after-signup]
spec: auto-signin-after-signup
browser: *minimal_browser_list
backend: gen2
- test_name: integ_react_device_tracking_gen2
desc: 'cognito-device-tracking'
framework: react
category: auth
sample_name: [device-tracking]
spec: device-tracking
browser: *minimal_browser_list
backend: gen2
- test_name: integ_react_delete_user_gen2
desc: 'delete-user'
framework: react
category: auth
sample_name: [delete-user]
spec: delete-user
browser: *minimal_browser_list
backend: gen2
- test_name: integ_next_auth_authenticator_and_ssr_page_gen2
desc: 'Authenticator and SSR page'
framework: next
category: auth
sample_name: [auth-ssr]
spec: auth-ssr
browser: [chrome]
backend: gen2
- test_name: integ_next_auth_authenticator_and_rsc_page_gen2
desc: 'Authenticator and RSC page'
framework: next
category: auth
sample_name: [auth-rsc]
spec: auth-rsc
browser: [chrome]
backend: gen2
- test_name: integ_next_sign_in_with_oauth_gen2
desc: 'Sign-in with the OAuth flow'
framework: next
category: auth
sample_name: [sign-in-with-oauth]
spec: sign-in-with-oauth
browser: [chrome]
backend: gen2


# DISABLED Angular/Vue tests:
# TODO: delete tests or add custom ui logic to support them.

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/callable-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
browser:
required: true
type: string
backend:
required: true
type: string
amplifyjs_dir:
required: true
type: boolean
Expand Down Expand Up @@ -73,6 +76,7 @@ jobs:
E2E_SAMPLE_NAME: ${{ matrix.sample_name }}
E2E_SPEC: ${{ inputs.spec }}
E2E_BROWSER: ${{ matrix.browser }}
E2E_BACKEND: ${{ inputs.backend }}
E2E_AMPLIFY_JS_DIR: ${{ inputs.amplifyjs_dir == true && env.AMPLIFY_DIR || ''}}
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
E2E_TEST_NAME: ${{ inputs.test_name }}
Expand All @@ -85,6 +89,7 @@ jobs:
$E2E_SPEC \
$E2E_BROWSER \
dev \
$E2E_BACKEND \
$E2E_AMPLIFY_JS_DIR" \
-n $E2E_RETRY_COUNT
Expand All @@ -97,6 +102,7 @@ jobs:
E2E_SAMPLE_NAME: ${{ matrix.sample_name }}
E2E_SPEC: ${{ inputs.spec }}
E2E_BROWSER: ${{ matrix.browser }}
E2E_BACKEND: ${{ inputs.backend }}
E2E_AMPLIFY_JS_DIR: ${{ inputs.amplifyjs_dir == true && env.AMPLIFY_DIR || ''}}
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
E2E_TEST_NAME: ${{ inputs.test_name }}
Expand All @@ -109,6 +115,7 @@ jobs:
$E2E_SPEC \
$E2E_BROWSER \
prod \
$E2E_BACKEND \
$E2E_AMPLIFY_JS_DIR" \
-n $E2E_RETRY_COUNT
- name: Upload artifact
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/callable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
amplifyjs_dir: ${{ matrix.integ-config.amplifyjs_dir || false }}
sample_name: ${{ toJSON(matrix.integ-config.sample_name) || '[""]' }}
browser: ${{ toJSON(matrix.integ-config.browser) || '[""]' }}
backend: ${{ matrix.integ-config.backend }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
retry_count: ${{ matrix.integ-config.retry_count || 3 }}

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"scripts": {
"build": "npm run clean && npm run build:esm-cjs",
"build-with-test": "npm test && npm run build",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"clean": "npm run clean:size && rimraf dist",
"clean:size": "rimraf dual-publish-tmp tmp*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Analytics Pinpoint Provider API: identifyUser', () => {
});

beforeEach(() => {
mockUpdateEndpoint.mockClear();
mockUpdateEndpoint.mockReset();
});

it('passes through parameter along with Analytics boilerplate to core Pinpoint identifyUser API', async () => {
Expand Down Expand Up @@ -82,4 +82,13 @@ describe('Analytics Pinpoint Provider API: identifyUser', () => {
userAttributes,
});
});

it('rejects if underlying promise rejects', async () => {
mockUpdateEndpoint.mockRejectedValue(new Error());
const input: IdentifyUserInput = {
userId: 'user-id',
userProfile: {},
};
await expect(identifyUser(input)).rejects.toBeDefined();
});
});
4 changes: 2 additions & 2 deletions packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
"build-with-test": "npm run clean && npm run test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
Expand Down Expand Up @@ -100,7 +100,7 @@
"tslib": "^2.5.0"
},
"peerDependencies": {
"@aws-amplify/core": "^6.0.0"
"@aws-amplify/core": "^6.1.0"
},
"devDependencies": {
"@aws-amplify/core": "6.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const identifyUser = async ({
const { credentials, identityId } = await resolveCredentials();
const { appId, region } = resolveConfig();
const { userAttributes } = options ?? {};
updateEndpoint({
await updateEndpoint({
appId,
category: 'Analytics',
credentials,
Expand Down
2 changes: 1 addition & 1 deletion packages/api-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
"build-with-test": "npm test && npm build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
"build-with-test": "npm test && npm build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
Expand Down Expand Up @@ -84,7 +84,7 @@
"tslib": "^2.5.0"
},
"peerDependencies": {
"@aws-amplify/core": "^6.0.0"
"@aws-amplify/core": "^6.1.0"
},
"devDependencies": {
"@aws-amplify/core": "6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ describe('fetchDevices', () => {
const dateEpoch = 1.696296885807e9;
const date = new Date(dateEpoch * 1000);
const clientResponseDevice = {
DeviceAttributes: [{ Name: 'attributeName', Value: 'attributeValue' }],
DeviceAttributes: [
{ Name: 'attributeName', Value: 'attributeValue' },
{ Name: 'device_name', Value: 'deviceNameValue' },
],
DeviceCreateDate: dateEpoch,
DeviceKey: 'DeviceKey',
DeviceLastAuthenticatedDate: dateEpoch,
DeviceLastModifiedDate: dateEpoch,
};
const apiOutputDevice = {
id: 'DeviceKey',
name: undefined,
name: 'deviceNameValue',
attributes: {
attributeName: 'attributeValue',
device_name: 'deviceNameValue',
},
createDate: date,
lastModifiedDate: date,
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "yarn lint --fix && jest -w 1 --coverage --logHeapUsage",
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf lib-esm lib dist",
Expand Down Expand Up @@ -94,7 +94,7 @@
"tslib": "^2.5.0"
},
"peerDependencies": {
"@aws-amplify/core": "^6.0.0"
"@aws-amplify/core": "^6.1.0"
},
"devDependencies": {
"@aws-amplify/core": "6.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/auth/src/providers/cognito/apis/fetchDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ const parseDevicesResponse = async (
DeviceLastModifiedDate,
DeviceLastAuthenticatedDate,
}) => {
let deviceName: string | undefined;
const attributes = DeviceAttributes.reduce(
(attrs: any, { Name, Value }) => {
if (Name && Value) {
if (Name === 'device_name') deviceName = Value;
attrs[Name] = Value;
}

Expand All @@ -72,6 +74,7 @@ const parseDevicesResponse = async (

return {
id,
name: deviceName,
attributes,
createDate: DeviceCreateDate
? new Date(DeviceCreateDate * 1000)
Expand Down
2 changes: 2 additions & 0 deletions packages/auth/src/providers/cognito/utils/signInHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AuthAction,
assertTokenProviderConfig,
base64Encoder,
getDeviceName,
} from '@aws-amplify/core/internals/utils';

import { ClientMetadata, ConfirmSignInOptions } from '../types';
Expand Down Expand Up @@ -1072,6 +1073,7 @@ export async function getNewDeviceMetatada(
{ region: getRegion(userPoolId) },
{
AccessToken: accessToken,
DeviceName: await getDeviceName(),
DeviceKey: newDeviceMetadata?.DeviceKey,
DeviceSecretVerifierConfig: deviceSecretVerifierConfig,
},
Expand Down
10 changes: 5 additions & 5 deletions packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
"test:size": "size-limit",
"build-with-test": "npm run clean && npm test && tsc && webpack -p",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
"build:watch": "npm run build:esm-cjs -- --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "rimraf lib-esm lib dist",
Expand Down Expand Up @@ -293,7 +293,7 @@
"name": "[Analytics] record (Pinpoint)",
"path": "./dist/esm/analytics/index.mjs",
"import": "{ record }",
"limit": "17.02 kB"
"limit": "17.05 kB"
},
{
"name": "[Analytics] record (Kinesis)",
Expand All @@ -317,7 +317,7 @@
"name": "[Analytics] identifyUser (Pinpoint)",
"path": "./dist/esm/analytics/index.mjs",
"import": "{ identifyUser }",
"limit": "15.52 kB"
"limit": "15.53 kB"
},
{
"name": "[Analytics] enable",
Expand Down Expand Up @@ -383,7 +383,7 @@
"name": "[Auth] confirmSignIn (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ confirmSignIn }",
"limit": "28.10 kB"
"limit": "28.26 kB"
},
{
"name": "[Auth] updateMFAPreference (Cognito)",
Expand Down Expand Up @@ -449,7 +449,7 @@
"name": "[Auth] Basic Auth Flow (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ signIn, signOut, fetchAuthSession, confirmSignIn }",
"limit": "29.90 kB"
"limit": "30.06 kB"
},
{
"name": "[Auth] OAuth Auth Flow (Cognito)",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/__mocks__/configMocks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory contains equivalent Gen1 & Gen2 configurations which are used to validate interoperability between
different config versions/schemas. Make sure that any updates applied to one are applied to the other.
Loading

0 comments on commit eabab06

Please sign in to comment.