forked from peerlibrary/meteor-aws-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
26 lines (21 loc) · 797 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
AWS = Npm.require('aws-sdk');
var originalDefineMethods = AWS.Service.defineMethods;
function makeBlocking(proto, methodName) {
var syncMethod = methodName + 'Sync';
if (!proto[methodName]) return;
if (!_.isFunction(proto[methodName])) return;
if (proto[syncMethod]) return;
proto[syncMethod] = blocking(proto[methodName]);
}
AWS.Service.defineMethods = function defineMethods(svc) {
originalDefineMethods(svc);
AWS.util.each(svc.prototype.api.operations, function iterator(methodName) {
makeBlocking(svc.prototype, methodName);
});
};
AWS.util.each(AWS, function iterator(name) {
if (!(AWS[name].prototype instanceof AWS.Service)) return;
AWS.util.each(AWS[name].prototype, function iterator(methodName) {
makeBlocking(AWS[name].prototype, methodName);
});
});