Skip to content

Commit

Permalink
Merge branch 'attilah-defexport' into defexport
Browse files Browse the repository at this point in the history
  • Loading branch information
attilah committed Oct 29, 2019
2 parents fc7afa2 + de73681 commit a476577
Show file tree
Hide file tree
Showing 423 changed files with 30,748 additions and 29,881 deletions.
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ jobs:
path: packages/amplify-ui-tests/
integration_test_ios:
macos:
xcode: '10.3.0'
xcode: '11.0.0'
steps:
- attach_workspace:
at: ./
Expand Down Expand Up @@ -439,7 +439,6 @@ workflows:
- graphql_e2e_testing
requires:
- build
- integration_test_ios
- mock_e2e_tests
- mock_e2e_tests:
requires:
Expand All @@ -452,7 +451,6 @@ workflows:
- beta
requires:
- build
- integration_test_ios
- mock_e2e_tests
- amplify_e2e_tests:
filters:
Expand All @@ -461,7 +459,6 @@ workflows:
- master
requires:
- build
- integration_test_ios
- mock_e2e_tests
- deploy:
requires:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/enable_api.exp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/expect
spawn ./.circleci/api.sh
expect "Please select from one of the below mentioned services\r"
expect "Please select from one of the below mentioned services:\r"
send -- "\033\[B\r"
expect "Provide a friendly name for your resource to be used as a label for this category in the project:"
send -- "myAPI\r"
Expand Down
7 changes: 7 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ $ npm install -g @aws-amplify/cli
$ amplify configure
```

***Note***: If you're having permission issues on your system installing the CLI, please try the following command:

```bash
$ sudo npm install -g @aws-amplify/cli --unsafe-perm=true
$ amplify configure
```

## Commands Summary

The Amplify CLI supports the commands shown in the following table.
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-lerna-scopes', '@commitlint/config-conventional']
extends: ['@commitlint/config-lerna-scopes', '@commitlint/config-conventional'],
};
37 changes: 20 additions & 17 deletions cypress/integration/api_spec.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@

describe('API test post and get', function() {
beforeEach(function() {
cy.visit('/')
})

it('successfully adds data to dynamodb', function() {
// Check for user not signed up
cy.get('input[name=itemNo]').type('1')
cy.get('.amplify-submit-put-button').contains('Put').click()
cy.get('.amplify-put-result').contains('post call succeed!')
})
beforeEach(function() {
cy.visit('/');
});

it('successfully adds data to dynamodb', function() {
// Check for user not signed up
cy.get('input[name=itemNo]').type('1');
cy.get('.amplify-submit-put-button')
.contains('Put')
.click();
cy.get('.amplify-put-result').contains('post call succeed!');
});

it('successfully get data from dynamodb', function() {
// Check for user not signed up
cy.get('.amplify-submit-get-button').contains('Get').click()
cy.get('.amplify-get-result').contains('"itemNo":1')
})
})
it('successfully get data from dynamodb', function() {
// Check for user not signed up
cy.get('.amplify-submit-get-button')
.contains('Get')
.click();
cy.get('.amplify-get-result').contains('"itemNo":1');
});
});
20 changes: 10 additions & 10 deletions cypress/integration/auth_spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

describe('withAuthenticator Sign In', function() {
beforeEach(function() {
cy.visit('/')
})
cy.visit('/');
});

it('throws error when user is not signed up', function() {
// Check for user not signed up
cy.get('input[name=username]').type('testuser')
cy.get('input[name=password]').type('testPassword')
cy.get('button').contains('Sign In').click()
cy.get('div').contains('User does not exist')
})
})

cy.get('input[name=username]').type('testuser');
cy.get('input[name=password]').type('testPassword');
cy.get('button')
.contains('Sign In')
.click();
cy.get('div').contains('User does not exist');
});
});
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
};
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"author": "Amazon Web Services",
"license": "Apache-2.0",
"dependencies": {
"lerna": "^3.16.4"
"lerna": "^3.16.4",
"tslint": "^5.20.0"
},
"workspaces": [
"packages/*"
Expand Down
6 changes: 3 additions & 3 deletions packages/amplify-appsync-simulator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-appsync-simulator",
"version": "0.18.0",
"version": "0.22.0",
"description": "An AppSync Simulator to test AppSync API.",
"main": "lib/index.js",
"scripts": {
Expand All @@ -21,7 +21,7 @@
"author": "Amazon Web Services",
"license": "Apache-2.0",
"dependencies": {
"amplify-velocity-template": "0.17.0",
"amplify-velocity-template": "0.21.0",
"array-from": "^2.1.1",
"cors": "^2.8.5",
"event-to-promise": "^0.8.0",
Expand Down Expand Up @@ -60,7 +60,7 @@
"@types/moment-timezone": "0.5.12",
"@types/node": "^8.10.51",
"@types/pino": "4.7.1",
"amplify-graphiql-explorer": "0.18.0",
"amplify-graphiql-explorer": "0.22.0",
"aws-sdk": "^2.510.0",
"jest": "^24.8.0",
"ts-jest": "^24.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,25 @@ describe('Velocity $context.util.time', () => {
});

it('parseFormattedToEpochMilliSeconds', () => {
expect(
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)
).toEqual(TEST_TIMESTAMP_MILLIS);
expect(
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED)
).toEqual(TEST_TIMESTAMP_MILLIS);
expect(
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)
).toEqual(TEST_TIMESTAMP_MILLIS);
expect(
time.parseFormattedToEpochMilliSeconds(
TEST_TIMESTAMP_CUSTOM_PLUS8,
FORMAT_CUSTOM_ZONED,
'Australia/Perth'
)
).toEqual(TEST_TIMESTAMP_MILLIS);
expect(
time.parseFormattedToEpochMilliSeconds(
TEST_TIMESTAMP_CUSTOM_UTC_UNZONED,
FORMAT_CUSTOM_UNZONED,
'UTC'
)
).toEqual(TEST_TIMESTAMP_MILLIS);

expect(
time.parseFormattedToEpochMilliSeconds(
TEST_TIMESTAMP_CUSTOM_PLUS8_UNZONED,
FORMAT_CUSTOM_UNZONED,
'Australia/Perth'
)
).toEqual(TEST_TIMESTAMP_MILLIS);
});

it('parseISO8601ToEpochMilliSeconds', () => {
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_ZULU)).toEqual(
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED, 'Australia/Perth')).toEqual(
TEST_TIMESTAMP_MILLIS
);
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC_UNZONED, FORMAT_CUSTOM_UNZONED, 'UTC')).toEqual(
TEST_TIMESTAMP_MILLIS
);
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_PLUS8)).toEqual(

expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8_UNZONED, FORMAT_CUSTOM_UNZONED, 'Australia/Perth')).toEqual(
TEST_TIMESTAMP_MILLIS
);
});

it('parseISO8601ToEpochMilliSeconds', () => {
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_ZULU)).toEqual(TEST_TIMESTAMP_MILLIS);
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_PLUS8)).toEqual(TEST_TIMESTAMP_MILLIS);
});
it('epochMilliSecondsToSeconds', () => {
expect(time.epochMilliSecondsToSeconds(TEST_TIMESTAMP_MILLIS)).toEqual(TEST_TIMESTAMP_SECS);
});
Expand All @@ -86,16 +64,10 @@ describe('Velocity $context.util.time', () => {
});

it('epochMilliSecondsToFormatted', () => {
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED)).toEqual(
TEST_TIMESTAMP_CUSTOM_UTC
);
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_CUSTOM_UTC);

expect(
time.epochMilliSecondsToFormatted(
TEST_TIMESTAMP_MILLIS,
FORMAT_CUSTOM_ZONED,
'Australia/Perth'
)
).toEqual(TEST_TIMESTAMP_CUSTOM_PLUS8);
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED, 'Australia/Perth')).toEqual(
TEST_TIMESTAMP_CUSTOM_PLUS8
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ describe('JavaMap', () => {
it('entrySet', () => {
const obj = { foo: 'Foo Value', bar: 'Bar Value' };
const map = new JavaMap(obj, identityMapper);
expect(map.entrySet().toJSON()).toEqual([
{ key: 'foo', value: 'Foo Value' },
{ key: 'bar', value: 'Bar Value' },
]);
expect(map.entrySet().toJSON()).toEqual([{ key: 'foo', value: 'Foo Value' }, { key: 'bar', value: 'Bar Value' }]);
});

it('equal', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { JavaString } from '../../../velocity/value-mapper/string';

describe('JavaString', () => {
it('replaceAll', () => {
const str = new JavaString('foo bar foo bar foo bar Foo')
const str = new JavaString('foo bar foo bar foo bar Foo');
const replacedStr = str.replaceAll('foo', 'baz');
expect(replacedStr.toString()).toEqual('baz bar baz bar baz bar Foo');
expect(replacedStr.toIdString()).toEqual('baz bar baz bar baz bar Foo');
expect(replacedStr.toJSON()).toEqual('baz bar baz bar baz bar Foo');
})
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Velocity - ValueMapper toJSON', () => {
it('should not call toJSON if the object is null', () => {
expect(toJSON(null)).toEqual(null);
});

it('should return the source object if it doesnot implement toJSON', () => {
const testObj = {
foo: 'Foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,7 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {

return this.getItem({ key, consistentRead: true });
}
private async query({
query: keyCondition,
filter,
index,
nextToken,
limit,
scanIndexForward = true,
consistentRead = false,
select,
}) {
private async query({ query: keyCondition, filter, index, nextToken, limit, scanIndexForward = true, consistentRead = false, select }) {
keyCondition = keyCondition || { expression: null };
filter = filter || { expression: null };
const params = {
Expand All @@ -133,18 +124,14 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
ScanIndexForward: scanIndexForward,
Select: select || 'ALL_ATTRIBUTES',
};
const {
Items: items,
ScannedCount: scannedCount,
LastEvaluatedKey: resultNextToken = null,
} = await this.client.query(params as any).promise();
const { Items: items, ScannedCount: scannedCount, LastEvaluatedKey: resultNextToken = null } = await this.client
.query(params as any)
.promise();

return {
items: items.map(item => unmarshall(item)),
scannedCount,
nextToken: resultNextToken
? Buffer.from(JSON.stringify(resultNextToken)).toString('base64')
: null,
nextToken: resultNextToken ? Buffer.from(JSON.stringify(resultNextToken)).toString('base64') : null,
};
}

Expand Down Expand Up @@ -194,16 +181,7 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
return unmarshall(deleted);
}
private async scan(payload) {
const {
filter,
index,
limit,
consistentRead = false,
nextToken,
select,
totalSegments,
segment,
} = payload;
const { filter, index, limit, consistentRead = false, nextToken, select, totalSegments, segment } = payload;

const params = {
TableName: this.tableName,
Expand All @@ -226,18 +204,12 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
},
});
}
const {
Items: items,
ScannedCount: scannedCount,
LastEvaluatedKey: resultNextToken = null,
} = await this.client.scan(params).promise();
const { Items: items, ScannedCount: scannedCount, LastEvaluatedKey: resultNextToken = null } = await this.client.scan(params).promise();

return {
items: items.map(item => unmarshall(item)),
scannedCount,
nextToken: resultNextToken
? Buffer.from(JSON.stringify(resultNextToken)).toString('base64')
: null,
nextToken: resultNextToken ? Buffer.from(JSON.stringify(resultNextToken)).toString('base64') : null,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function unmarshall(raw, isRaw: boolean = true) {
...sum,
[key]: unmarshall(value, false),
}),
{},
{}
);
}

Expand Down
7 changes: 1 addition & 6 deletions packages/amplify-appsync-simulator/src/mqtt-server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,7 @@ export class Client {
}

// skip delivery of messages in $SYS for wildcards
forward =
forward &&
!(
topic.indexOf('$SYS') >= 0 &&
((indexWildcard >= 0 && indexWildcard < 2) || (indexPlus >= 0 && indexPlus < 2))
);
forward = forward && !(topic.indexOf('$SYS') >= 0 && ((indexWildcard >= 0 && indexWildcard < 2) || (indexPlus >= 0 && indexPlus < 2)));

if (forward) {
if (options._dedupId === undefined) {
Expand Down
Loading

0 comments on commit a476577

Please sign in to comment.