Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit 9fb05ca

Browse files
authored
Merge pull request #39 from ShadowHealth/updateAwsSdk
Upgrade to the latest version of the sdk
2 parents b2be895 + 9c882be commit 9fb05ca

File tree

12 files changed

+20
-29
lines changed

12 files changed

+20
-29
lines changed

flow/aws-sdk-promise.js renamed to flow/aws-sdk.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
declare module 'aws-sdk-promise' {
2+
declare module 'aws-sdk' {
33
declare class DynamoDB {
44
constructor(dynamoDBConfig: DynamoDBConfig): void;
55

@@ -49,13 +49,9 @@ declare module 'aws-sdk-promise' {
4949
}
5050

5151
declare class PromiseRequest<T> {
52-
promise(): Promise<DataResponse<T>>;
52+
promise(): Promise<T>;
5353
}
5454

55-
declare type DataResponse<T> = {
56-
data: T,
57-
};
58-
5955
declare type ListTablesRequest = {
6056
ExclusiveStartTableName?: string,
6157
Limit?: number

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"dependencies": {},
2727
"devDependencies": {
2828
"async": "^2.0.0",
29-
"aws-sdk": "2.2.48",
30-
"aws-sdk-promise": "0.0.2",
29+
"aws-sdk": "2.5.4",
3130
"babel": "^6.5.2",
3231
"babel-cli": "^6.7.7",
3332
"babel-eslint": "^6.0.4",

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CostEstimation from './utils/CostEstimation';
55
import Throughput from './utils/Throughput';
66
import CapacityCalculator from './CapacityCalculator';
77
import { json, stats, log, invariant } from './Global';
8-
import type { UpdateTableRequest } from 'aws-sdk-promise';
8+
import type { UpdateTableRequest } from 'aws-sdk';
99

1010
export default class App {
1111
_provisioner: Provisioner;

src/CapacityCalculator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { invariant } from './Global';
33
import { Region } from './configuration/Region';
44
import CapacityCalculatorBase from './capacity/CapacityCalculatorBase';
5-
import type { GetMetricStatisticsResponse } from 'aws-sdk-promise';
5+
import type { GetMetricStatisticsResponse } from 'aws-sdk';
66
import type { StatisticSettings } from './flow/FlowTypes';
77

88
export default class CapacityCalculator extends CapacityCalculatorBase {

src/aws/CloudWatch.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* @flow */
2-
import AWS from 'aws-sdk-promise';
2+
import AWS from 'aws-sdk';
33
import { json, stats, warning, invariant } from '../Global';
44
import type {
55
CloudWatchOptions,
66
GetMetricStatisticsRequest,
77
GetMetricStatisticsResponse,
8-
} from 'aws-sdk-promise';
8+
} from 'aws-sdk';
99

1010
export default class CloudWatch {
1111
_cw: AWS.CloudWatch;
@@ -30,8 +30,7 @@ export default class CloudWatch {
3030
let sw = stats.timer('CloudWatch.getMetricStatisticsAsync').start();
3131
try {
3232
invariant(params != null, 'Parameter \'params\' is not set');
33-
let res = await this._cw.getMetricStatistics(params).promise();
34-
return res.data;
33+
return await this._cw.getMetricStatistics(params).promise();
3534
} catch (ex) {
3635
warning(JSON.stringify({
3736
class: 'CloudWatch',

src/aws/DynamoDB.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
import AWS from 'aws-sdk-promise';
2+
import AWS from 'aws-sdk';
33
import { json, stats, warning, invariant } from '../Global';
44
import Delay from '../utils/Delay';
55
import Async from 'async';
@@ -11,7 +11,7 @@ import type {
1111
UpdateTableResponse,
1212
ListTablesRequest,
1313
ListTablesResponse,
14-
} from 'aws-sdk-promise';
14+
} from 'aws-sdk';
1515

1616
export default class DynamoDB {
1717
_db: AWS.DynamoDB;
@@ -40,8 +40,7 @@ export default class DynamoDB {
4040
async listTablesAsync(params: ?ListTablesRequest): Promise<ListTablesResponse> {
4141
let sw = stats.timer('DynamoDB.listTablesAsync').start();
4242
try {
43-
let res = await this._db.listTables(params).promise();
44-
return res.data;
43+
return await this._db.listTables(params).promise();
4544
} catch (ex) {
4645
warning(JSON.stringify({
4746
class: 'DynamoDB',
@@ -68,8 +67,7 @@ export default class DynamoDB {
6867
let sw = stats.timer('DynamoDB.describeTableAsync').start();
6968
try {
7069
invariant(params != null, 'Parameter \'params\' is not set');
71-
let res = await this._db.describeTable(params).promise();
72-
return res.data;
70+
return await this._db.describeTable(params).promise();
7371
} catch (ex) {
7472
warning(JSON.stringify({
7573
class: 'DynamoDB',
@@ -128,15 +126,14 @@ export default class DynamoDB {
128126
await this.delayUntilTableIsActiveAsync(params.TableName);
129127
}
130128

131-
return response.data;
129+
return response;
132130
}
133131

134132
async updateTableAsync(params: UpdateTableRequest): Promise<UpdateTableResponse> {
135133
let sw = stats.timer('DynamoDB.updateTableAsync').start();
136134
try {
137135
invariant(params != null, 'Parameter \'params\' is not set');
138-
let res = await this._db.updateTable(params).promise();
139-
return res.data;
136+
return await this._db.updateTable(params).promise();
140137
} catch (ex) {
141138
warning(JSON.stringify({
142139
class: 'DynamoDB',

src/capacity/CapacityCalculatorBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
TableDescription,
1111
GetMetricStatisticsResponse,
1212
Dimension,
13-
} from 'aws-sdk-promise';
13+
} from 'aws-sdk';
1414

1515
export default class CapacityCalculatorBase {
1616
cw: CloudWatch;

src/flow/FlowTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow */
2-
import type { ProvisionedThroughput, Throughput } from 'aws-sdk-promise';
2+
import type { ProvisionedThroughput, Throughput } from 'aws-sdk';
33

44
export type ThrottledEventsDescription = {
55
ThrottledReadEvents: number,

src/provisioning/ProvisionerBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow */
22
/* eslint-disable no-unused-vars */
33
import { invariant } from '../Global';
4-
import type { TableDescription, UpdateTableRequest } from 'aws-sdk-promise';
4+
import type { TableDescription, UpdateTableRequest } from 'aws-sdk';
55
import type { TableConsumedCapacityDescription } from '../flow/FlowTypes';
66
import DynamoDB from '../aws/DynamoDB';
77
import CloudWatch from '../aws/CloudWatch';

src/provisioning/ProvisionerConfigurableBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
UpdateTableRequest,
88
GlobalSecondaryIndexUpdate,
99
Throughput,
10-
} from 'aws-sdk-promise';
10+
} from 'aws-sdk';
1111
import type {
1212
TableProvisionedAndConsumedThroughput,
1313
TableConsumedCapacityDescription,

0 commit comments

Comments
 (0)