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

Pin aws-sdk versions and rename presignRequest to presign #5171

Merged
merged 4 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"dependencies": {
"@aws-amplify/cache": "^2.1.6",
"@aws-amplify/core": "^2.2.5",
"@aws-sdk/client-firehose": "^1.0.0-alpha.25",
"@aws-sdk/client-kinesis": "^1.0.0-alpha.25",
"@aws-sdk/client-personalize-events": "^1.0.0-alpha.23",
"@aws-sdk/client-pinpoint": "^1.0.0-alpha.23",
"@aws-sdk/client-firehose": "1.0.0-alpha.26",
"@aws-sdk/client-kinesis": "1.0.0-alpha.26",
"@aws-sdk/client-personalize-events": "1.0.0-alpha.24",
"@aws-sdk/client-pinpoint": "1.0.0-alpha.24",
"uuid": "^3.2.1"
},
"jest": {
Expand Down
16 changes: 8 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@
},
"homepage": "https://aws-amplify.github.io/",
"devDependencies": {
"@react-native-community/netinfo": "4.7.0",
"find": "^0.2.7",
"genversion": "^2.2.0",
"prepend-file": "^1.3.1",
"react-native": "0.59.0",
"@react-native-community/netinfo": "4.7.0"
"react-native": "0.59.0"
},
"dependencies": {
"@aws-crypto/sha256-js": "1.0.0-alpha.0",
"@aws-sdk/client-cognito-identity": "^1.0.0-alpha.25",
"@aws-sdk/credential-provider-cognito-identity": "^1.0.0-alpha.23",
"@aws-sdk/node-http-handler": "^1.0.0-alpha.8",
"@aws-sdk/types": "^1.0.0-alpha.5",
"@aws-sdk/util-hex-encoding": "^1.0.0-alpha.2",
"@aws-sdk/util-user-agent-browser": "^1.0.0-alpha.8",
"@aws-sdk/client-cognito-identity": "1.0.0-alpha.26",
"@aws-sdk/credential-provider-cognito-identity": "1.0.0-alpha.24",
"@aws-sdk/node-http-handler": "1.0.0-alpha.9",
"@aws-sdk/types": "1.0.0-alpha.6",
"@aws-sdk/util-hex-encoding": "1.0.0-alpha.3",
"@aws-sdk/util-user-agent-browser": "1.0.0-alpha.9",
"url": "^0.11.0",
"zen-observable-ts": "0.8.19"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"homepage": "https://aws-amplify.github.io/",
"dependencies": {
"@aws-amplify/core": "^2.2.5",
"@aws-sdk/client-lex-runtime-service": "^1.0.0-alpha.23"
"@aws-sdk/client-lex-runtime-service": "1.0.0-alpha.24"
},
"jest": {
"globals": {
Expand Down
14 changes: 7 additions & 7 deletions packages/predictions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
"dependencies": {
"@aws-amplify/core": "^2.2.5",
"@aws-amplify/storage": "^2.2.1",
"@aws-sdk/client-comprehend": "^1.0.0-alpha.25",
"@aws-sdk/client-polly": "^1.0.0-alpha.24",
"@aws-sdk/client-rekognition": "^1.0.0-alpha.25",
"@aws-sdk/client-textract": "^1.0.0-alpha.24",
"@aws-sdk/client-translate": "^1.0.0-alpha.25",
"@aws-sdk/eventstream-marshaller": "^1.0.0-alpha.7",
"@aws-sdk/util-utf8-node": "^1.0.0-alpha.2",
"@aws-sdk/client-comprehend": "1.0.0-alpha.26",
"@aws-sdk/client-polly": "1.0.0-alpha.25",
"@aws-sdk/client-rekognition": "1.0.0-alpha.26",
"@aws-sdk/client-textract": "1.0.0-alpha.25",
"@aws-sdk/client-translate": "1.0.0-alpha.26",
"@aws-sdk/eventstream-marshaller": "1.0.0-alpha.8",
"@aws-sdk/util-utf8-node": "1.0.0-alpha.3",
"uuid": "^3.2.1"
},
"jest": {
Expand Down
28 changes: 13 additions & 15 deletions packages/storage/__tests__/Providers/AWSS3Provider-unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ S3Client.prototype.send = jest.fn(async command => {
return 'data';
});

S3RequestPresigner.prototype.presignRequest = jest.fn(
async (request, expires) => {
return (Promise as any).resolve();
}
);
S3RequestPresigner.prototype.presign = jest.fn(async (request, expires) => {
return (Promise as any).resolve();
});

const credentials = {
accessKeyId: 'accessKeyId',
Expand Down Expand Up @@ -132,7 +130,7 @@ describe('StorageProvider test', () => {
});
const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

expect.assertions(3);
Expand All @@ -151,7 +149,7 @@ describe('StorageProvider test', () => {
});
const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');
expect.assertions(4);
expect(
Expand Down Expand Up @@ -187,7 +185,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');
const spyon2 = jest.spyOn(Hub, 'dispatch');

Expand Down Expand Up @@ -274,7 +272,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

expect.assertions(3);
Expand All @@ -295,7 +293,7 @@ describe('StorageProvider test', () => {
});
const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');
await storage.get('my_key', { customPrefix: { public: '' } });
expect(spyon.mock.calls[0][0].path).toEqual('/my_key');
Expand All @@ -315,7 +313,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

await storage.get('my_key', { customPrefix: { public: '123/' } });
Expand All @@ -334,7 +332,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

expect.assertions(4);
Expand All @@ -361,7 +359,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

expect.assertions(4);
Expand All @@ -388,7 +386,7 @@ describe('StorageProvider test', () => {

const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValueOnce('url');

expect.assertions(3);
Expand Down Expand Up @@ -425,7 +423,7 @@ describe('StorageProvider test', () => {
test('always ask for the current credentials', async () => {
const storage = new StorageProvider();
storage.configure(options);
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presignRequest');
const spyon = jest.spyOn(S3RequestPresigner.prototype, 'presign');
jest.spyOn(formatURL, 'formatUrl').mockReturnValue('url');
const curCredSpyOn = jest
.spyOn(Credentials, 'get')
Expand Down
8 changes: 4 additions & 4 deletions packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"homepage": "https://aws-amplify.github.io/",
"dependencies": {
"@aws-amplify/core": "^2.2.5",
"@aws-sdk/client-s3": "^1.0.0-alpha.20",
"@aws-sdk/s3-request-presigner": "^1.0.0-alpha.17",
"@aws-sdk/util-create-request": "^1.0.0-alpha.12",
"@aws-sdk/util-format-url": "^1.0.0-alpha.5",
"@aws-sdk/client-s3": "1.0.0-alpha.21",
"@aws-sdk/s3-request-presigner": "1.0.0-alpha.18",
"@aws-sdk/util-create-request": "1.0.0-alpha.13",
"@aws-sdk/util-format-url": "1.0.0-alpha.6",
"events": "^3.1.0",
"sinon": "^7.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/providers/AWSS3Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class AWSS3Provider implements StorageProvider {
const signer = new S3RequestPresigner({ ...s3.config });
const request = await createRequest(s3, new GetObjectCommand(params));
const url = formatUrl(
(await signer.presignRequest(request, params.Expires)) as any
(await signer.presign(request, params.Expires)) as any
);
dispatchStorageEvent(
track,
Expand Down