Skip to content

Commit cfedf05

Browse files
Merge branch 'master' into dwkerwin-iam-role-compatibility
2 parents f4c8687 + 735fffa commit cfedf05

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ var backup = new DynamoBackup({
4747
});
4848
4949
backup.on('error', function(data) {
50-
console.log('Error backing up ' + data.tableName);
51-
console.log(data.error);
50+
console.log('Error backing up ' + data.table);
51+
console.log(data.err);
5252
});
5353
54-
backup.on('start-backup', function(tableName) {
54+
backup.on('start-backup', function(tableName, startTime) {
5555
console.log('Starting to copy table ' + tableName);
5656
});
5757
58-
backup.on('end-backup', function(tableName) {
58+
backup.on('end-backup', function(tableName, backupDuration) {
5959
console.log('Done copying table ' + tableName);
6060
});
6161

lib/dynamo-backup.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ util.inherits(DynamoBackup, events.EventEmitter);
4343
DynamoBackup.prototype.listTables = function (callback) {
4444
var self = this;
4545
self._fetchTables(null, [], callback);
46-
}
46+
};
4747

4848
DynamoBackup.prototype.backupTable = function (tableName, backupPath, callback) {
4949
var self = this;
@@ -115,7 +115,7 @@ DynamoBackup.prototype.backupTable = function (tableName, backupPath, callback)
115115
}
116116
}
117117
);
118-
}
118+
};
119119

120120
DynamoBackup.prototype.backupAllTables = function (callback) {
121121
var self = this;
@@ -143,13 +143,13 @@ DynamoBackup.prototype.backupAllTables = function (callback) {
143143
callback
144144
);
145145
});
146-
}
146+
};
147147

148148
DynamoBackup.prototype._getBackupPath = function () {
149149
var self = this;
150150
var now = moment.utc();
151151
return self.backupPath || ('DynamoDB-backup-' + now.format('YYYY-MM-DD-HH-mm-ss'));
152-
}
152+
};
153153

154154
DynamoBackup.prototype._copyTable = function (tableName, itemsReceived, callback) {
155155
var self = this;
@@ -164,7 +164,7 @@ DynamoBackup.prototype._copyTable = function (tableName, itemsReceived, callback
164164

165165
self._streamItems(tableName, null, limit, itemsReceived, callback);
166166
});
167-
}
167+
};
168168

169169
DynamoBackup.prototype._streamItems = function fetchItems(tableName, startKey, limit, itemsReceived, callback) {
170170
var self = this;
@@ -191,7 +191,7 @@ DynamoBackup.prototype._streamItems = function fetchItems(tableName, startKey, l
191191
}
192192
self._streamItems(tableName, data.LastEvaluatedKey, limit, itemsReceived, callback);
193193
});
194-
}
194+
};
195195

196196
DynamoBackup.prototype._fetchTables = function (lastTable, tables, callback) {
197197
var self = this;
@@ -228,6 +228,10 @@ DynamoBackup.prototype._formatForDataPipeline = function (item) {
228228
var dataPipelineValueKey = self._getDataPipelineAttributeValueKey(k);
229229
value[dataPipelineValueKey] = v;
230230
value[k] = undefined;
231+
// for MAps and Lists, recurse until the elements are created with the correct case
232+
if(k === 'M' || k === 'L') {
233+
self._formatForDataPipeline(v);
234+
}
231235
});
232236
});
233237
return JSON.stringify(item);
@@ -241,8 +245,9 @@ DynamoBackup.prototype._getDataPipelineAttributeValueKey = function (type) {
241245
case 'M':
242246
case 'L':
243247
case 'NULL':
244-
case 'BOOL':
245248
return type.toLowerCase();
249+
case 'BOOL':
250+
return 'bOOL';
246251
case 'SS':
247252
return 'sS';
248253
case 'NS':
@@ -252,6 +257,6 @@ DynamoBackup.prototype._getDataPipelineAttributeValueKey = function (type) {
252257
default:
253258
throw new Error('Unknown AttributeValue key: ' + type);
254259
}
255-
}
260+
};
256261

257262
module.exports = DynamoBackup;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dynamo-backup-to-s3",
3-
"version": "0.4.0",
3+
"version": "0.4.2",
44
"author": "Dylan Lingelbach (https://github.com/dylanlingelbach)",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)