Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
manueliglesias committed Mar 5, 2020
2 parents 5309c61 + dae4824 commit 0e79eea
Show file tree
Hide file tree
Showing 50 changed files with 1,265 additions and 121 deletions.
138 changes: 135 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
version: 2.1
machine:
environment:
PATH: '${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin'
Expand All @@ -14,6 +14,26 @@ defaults: &defaults
## this enables colors in the output
TERM: xterm

defaults_rn: &defaults_rn
macos:
xcode: '11.3.1'
working_directory: ~/amplify-js-samples-staging

commands:
restore_pods:
steps:
- restore_cache:
keys:
- v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }}
- v1-storage-app-pods-

save_pods:
steps:
- save_cache:
key: v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }}
paths:
- ios/Pods

jobs:
build:
<<: *defaults
Expand All @@ -23,8 +43,8 @@ jobs:
- checkout
- run: yarn config set workspaces-experimental true
- run: yarn
- run: yarn run bootstrap
- run: yarn run build
- run: yarn bootstrap
- run: yarn build

- save_cache:
key: amplify-ssh-deps-{{ .Branch }}
Expand Down Expand Up @@ -250,6 +270,108 @@ jobs:
path: amplify-js-samples-staging/cypress/videos
- store_artifacts:
path: amplify-js-samples-staging/cypress/screenshots

integ_rn_ios_storage:
<<: *defaults_rn
working_directory: ~/amplify-js-samples-staging/samples/react-native/storage/StorageApp
steps:
- attach_workspace:
at: ~/
- run:
name: Yarn Install
command: yarn install --non-interactive --no-lockfile
# Metro Bundler doesn't work with linked packages so we're copying them from amplify-js
# TODO: utilize Verdaccio for this instead
- run:
name: 'Link aws-amplify'
command: |
cp -rf ~/amplify-js/packages/aws-amplify/dist ./node_modules/aws-amplify/dist
cp -rf ~/amplify-js/packages/aws-amplify/lib ./node_modules/aws-amplify/lib
cp -rf ~/amplify-js/packages/aws-amplify/lib-esm ./node_modules/aws-amplify/lib-esm
cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/dist ./node_modules/amazon-cognito-identity-js/dist
cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/lib ./node_modules/amazon-cognito-identity-js/lib
cp -rf ~/amplify-js/packages/analytics/dist ./node_modules/@aws-amplify/analytics/dist
cp -rf ~/amplify-js/packages/analytics/lib ./node_modules/@aws-amplify/analytics/lib
cp -rf ~/amplify-js/packages/analytics/lib-esm ./node_modules/@aws-amplify/analytics/lib-esm
cp -rf ~/amplify-js/packages/api/dist ./node_modules/@aws-amplify/api/dist
cp -rf ~/amplify-js/packages/api/lib ./node_modules/@aws-amplify/api/lib
cp -rf ~/amplify-js/packages/api/lib-esm ./node_modules/@aws-amplify/api/lib-esm
cp -rf ~/amplify-js/packages/auth/dist ./node_modules/@aws-amplify/auth/dist
cp -rf ~/amplify-js/packages/auth/lib ./node_modules/@aws-amplify/auth/lib
cp -rf ~/amplify-js/packages/auth/lib-esm ./node_modules/@aws-amplify/auth/lib-esm
cp -rf ~/amplify-js/packages/cache/dist ./node_modules/@aws-amplify/cache/dist
cp -rf ~/amplify-js/packages/cache/lib ./node_modules/@aws-amplify/cache/lib
cp -rf ~/amplify-js/packages/cache/lib-esm ./node_modules/@aws-amplify/cache/lib-esm
cp -rf ~/amplify-js/packages/core/dist ./node_modules/@aws-amplify/core/dist
cp -rf ~/amplify-js/packages/core/lib ./node_modules/@aws-amplify/core/lib
cp -rf ~/amplify-js/packages/core/lib-esm ./node_modules/@aws-amplify/core/lib-esm
cp -rf ~/amplify-js/packages/interactions/dist ./node_modules/@aws-amplify/interactions/dist
cp -rf ~/amplify-js/packages/interactions/lib ./node_modules/@aws-amplify/interactions/lib
cp -rf ~/amplify-js/packages/interactions/lib-esm ./node_modules/@aws-amplify/interactions/lib-esm
cp -rf ~/amplify-js/packages/predictions/dist ./node_modules/@aws-amplify/predictions/dist
cp -rf ~/amplify-js/packages/predictions/lib ./node_modules/@aws-amplify/predictions/lib
cp -rf ~/amplify-js/packages/predictions/lib-esm ./node_modules/@aws-amplify/predictions/lib-esm
cp -rf ~/amplify-js/packages/pubsub/dist ./node_modules/@aws-amplify/pubsub/dist
cp -rf ~/amplify-js/packages/pubsub/lib ./node_modules/@aws-amplify/pubsub/lib
cp -rf ~/amplify-js/packages/pubsub/lib-esm ./node_modules/@aws-amplify/pubsub/lib-esm
cp -rf ~/amplify-js/packages/storage/dist ./node_modules/@aws-amplify/storage/dist
cp -rf ~/amplify-js/packages/storage/lib ./node_modules/@aws-amplify/storage/lib
cp -rf ~/amplify-js/packages/storage/lib-esm ./node_modules/@aws-amplify/storage/lib-esm
cp -rf ~/amplify-js/packages/amplify-ui/dist ./node_modules/@aws-amplify/ui/dist
cp -rf ~/amplify-js/packages/amplify-ui/lib ./node_modules/@aws-amplify/ui/lib
cp -rf ~/amplify-js/packages/xr/dist ./node_modules/@aws-amplify/xr/dist
cp -rf ~/amplify-js/packages/xr/lib ./node_modules/@aws-amplify/xr/lib
cp -rf ~/amplify-js/packages/xr/lib-esm ./node_modules/@aws-amplify/xr/lib-esm
- restore_pods
- run:
name: Install CocoaPods
command: |
cd ios
pod install
- save_pods
- run:
background: true
command: xcrun simctl boot "iPhone 11" || true
name: Start iOS simulator (background)
- run:
background: true
command: yarn start
name: Start Metro Packager (background)
- run:
name: Configure Detox
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
command: |
brew tap wix/brew
brew install applesimutils
yarn global add detox-cli
- run:
name: Detox Build
command: detox build -c ios.sim.debug
- run:
environment:
JEST_JUNIT_OUTPUT_DIR: 'reports/junit'
JEST_JUNIT_OUTPUT_NAME: 'detox-test-results.xml'
name: Detox Test
command: detox test -c ios.sim.debug -u
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit

deploy:
<<: *defaults
working_directory: ~/amplify-js
Expand Down Expand Up @@ -328,6 +450,15 @@ workflows:
- 1.0-stable
requires:
- integ_setup
- integ_rn_ios_storage:
filters:
branches:
only:
- release
- master
- 1.0-stable
requires:
- integ_setup
- deploy:
filters:
branches:
Expand All @@ -342,3 +473,4 @@ workflows:
- integ_react_auth
- integ_angular_auth
- integ_vue_auth
- integ_rn_ios_storage
2 changes: 1 addition & 1 deletion docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ GEM
minitest (5.11.3)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.10.4)
nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
octokit (4.8.0)
sawyer (~> 0.8.0, >= 0.5.3)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/jest": "^24.0.18",
"@types/node": "^8.9.5",
"babel-loader": "^8.0.0",
"codecov": "^1.0.1",
"codecov": "^3.6.5",
"compression-webpack-plugin": "^1.1.3",
"cypress": "^3.2.0",
"husky": "^3.0.5",
Expand Down
8 changes: 8 additions & 0 deletions packages/amazon-cognito-identity-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.2.5](https://github.com/aws-amplify/amplify-js/compare/amazon-cognito-identity-js@3.2.4...amazon-cognito-identity-js@3.2.5) (2020-02-28)

**Note:** Version bump only for package amazon-cognito-identity-js





## [3.2.4](https://github.com/aws-amplify/amplify-js/compare/amazon-cognito-identity-js@3.2.2...amazon-cognito-identity-js@3.2.4) (2020-02-07)

**Note:** Version bump only for package amazon-cognito-identity-js
Expand Down
2 changes: 1 addition & 1 deletion packages/amazon-cognito-identity-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/amazon-cognito-identity-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "amazon-cognito-identity-js",
"description": "Amazon Cognito Identity Provider JavaScript SDK",
"version": "3.2.4",
"version": "3.2.5",
"author": {
"name": "Amazon Web Services",
"email": "aws@amazon.com",
Expand Down Expand Up @@ -63,7 +63,7 @@
"types": "./index.d.ts",
"dependencies": {
"buffer": "4.9.1",
"crypto-js": "^3.1.9-1",
"crypto-js": "3.1.9-1",
"js-cookie": "^2.1.4"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.2.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/analytics@2.2.5...@aws-amplify/analytics@2.2.6) (2020-02-28)

**Note:** Version bump only for package @aws-amplify/analytics





## [2.2.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/analytics@2.2.4...@aws-amplify/analytics@2.2.5) (2020-02-14)

**Note:** Version bump only for package @aws-amplify/analytics
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-amplify/analytics",
"version": "2.2.5",
"version": "2.2.6",
"description": "Analytics category of aws-amplify",
"main": "./lib/index.js",
"module": "./lib-esm/index.js",
Expand Down Expand Up @@ -36,8 +36,8 @@
},
"homepage": "https://aws-amplify.github.io/",
"dependencies": {
"@aws-amplify/cache": "^2.1.5",
"@aws-amplify/core": "^2.2.4",
"@aws-amplify/cache": "^2.1.6",
"@aws-amplify/core": "^2.2.5",
"uuid": "^3.2.1"
},
"jest": {
Expand Down
8 changes: 8 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.1.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@2.1.5...@aws-amplify/api@2.1.6) (2020-02-28)

**Note:** Version bump only for package @aws-amplify/api





## [2.1.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@2.1.3...@aws-amplify/api@2.1.5) (2020-02-07)


Expand Down
94 changes: 94 additions & 0 deletions packages/api/__tests__/API-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,100 @@ describe('API test', () => {

expect(spyon).toBeCalledWith(url, init);
});

test('happy case query with additionalHeaders', async () => {
const spyonAuth = jest
.spyOn(Credentials, 'get')
.mockImplementationOnce(() => {
return new Promise((res, rej) => {
res('cred');
});
});

const spyon = jest
.spyOn(RestClient.prototype, 'post')
.mockImplementationOnce((url, init) => {
return new Promise((res, rej) => {
res({});
});
});

const api = new API(config);
const url = 'https://appsync.amazonaws.com',
region = 'us-east-2',
apiKey = 'secret_api_key',
variables = { id: '809392da-ec91-4ef0-b219-5238a8f942b2' };
api.configure({
aws_appsync_graphqlEndpoint: url,
aws_appsync_region: region,
aws_appsync_authenticationType: 'API_KEY',
aws_appsync_apiKey: apiKey,
graphql_headers: async () =>
Promise.resolve({
someHeaderSetAtConfigThatWillBeOverridden: 'initialValue',
someOtherHeaderSetAtConfig: 'expectedValue',
}),
});
const GetEvent = `query GetEvent($id: ID! $nextToken: String) {
getEvent(id: $id) {
id
name
where
when
description
comments(nextToken: $nextToken) {
items {
commentId
content
createdAt
}
}
}
}`;

const doc = parse(GetEvent);
const query = print(doc);

const headers = {
Authorization: null,
'X-Api-Key': apiKey,
'x-amz-user-agent': Constants.userAgent,
};

const body = {
query,
variables,
};

const init = {
headers,
body,
signerServiceInfo: {
service: 'appsync',
region,
},
};

const additionalHeaders = {
someAddtionalHeader: 'foo',
someHeaderSetAtConfigThatWillBeOverridden: 'expectedValue',
};

await api.graphql(
graphqlOperation(GetEvent, variables),
additionalHeaders
);

expect(spyon).toBeCalledWith(url, {
...init,
headers: {
someAddtionalHeader: 'foo',
someHeaderSetAtConfigThatWillBeOverridden: 'expectedValue',
...init.headers,
someOtherHeaderSetAtConfig: 'expectedValue',
},
});
});
});

describe('configure test', () => {
Expand Down
Loading

0 comments on commit 0e79eea

Please sign in to comment.