Skip to content

Commit fbbba52

Browse files
author
Senthil
committed
social: pass REMOTE_API as option to bongo
1 parent 0a839da commit fbbba52

4 files changed

Lines changed: 56 additions & 39 deletions

File tree

client/Main/mq.config.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ KD.remote = new Bongo
1212

1313
getSessionToken: getSessionToken
1414

15+
apiDescriptor: REMOTE_API
16+
1517
# createRoutingKey:(service, event)->
1618
# "client.#{Bongo.createId()}.#{KD.whoami().profile.nickname}.#{service}.#{event}"
1719

node_modules_koding/bongo-client/bongo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Bongo = (function(_super) {
9191

9292
function Bongo(options) {
9393
EventEmitter(this);
94-
this.mq = options.mq, this.getSessionToken = options.getSessionToken, this.getUserArea = options.getUserArea, this.fetchName = options.fetchName, this.resourceName = options.resourceName, this.apiEndpoint = options.apiEndpoint, this.useWebsockets = options.useWebsockets, this.batchRequests = options.batchRequests;
94+
this.mq = options.mq, this.getSessionToken = options.getSessionToken, this.getUserArea = options.getUserArea, this.fetchName = options.fetchName, this.resourceName = options.resourceName, this.apiEndpoint = options.apiEndpoint, this.useWebsockets = options.useWebsockets, this.batchRequests = options.batchRequests, this.apiDescriptor = options.apiDescriptor;
9595
if (this.useWebsockets == null) {
9696
this.useWebsockets = false;
9797
}
@@ -132,7 +132,7 @@ Bongo = (function(_super) {
132132
}
133133
process.nextTick((function(_this) {
134134
return function() {
135-
return _this.api = _this.createRemoteApiShims(REMOTE_API);
135+
return _this.api = _this.createRemoteApiShims(_this.apiDescriptor);
136136
};
137137
})(this));
138138
}

node_modules_koding/bongo-client/browser/bongo.js

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,25 +2997,39 @@ require.define("/node_modules/mongoop/index.js",function(require,module,exports,
29972997
}
29982998

29992999
MongoOp.prototype.applyTo = function(target) {
3000-
var _this = this;
30013000
this.result = {};
3002-
keys(this.operation).forEach(function(operator) {
3003-
if ('function' !== typeof _this[operator]) {
3004-
throw new Error("Unrecognized operator: " + operator);
3005-
} else {
3006-
return _this[operator](target, _this.operation[operator]);
3007-
}
3008-
});
3001+
keys(this.operation).forEach((function(_this) {
3002+
return function(operator) {
3003+
if ('function' !== typeof _this[operator]) {
3004+
throw new Error("Unrecognized operator: " + operator);
3005+
} else {
3006+
return _this[operator](target, _this.operation[operator]);
3007+
}
3008+
};
3009+
})(this));
3010+
return this;
3011+
};
3012+
3013+
MongoOp.prototype.map = function(fn) {
3014+
var op;
3015+
op = this.operation;
3016+
this.operation = {};
3017+
keys(op).forEach((function(_this) {
3018+
return function(operator) {
3019+
return _this.operation[operator] = fn(operator, op[operator]);
3020+
};
3021+
})(this));
30093022
return this;
30103023
};
30113024

30123025
MongoOp.prototype.forEachField = function(fields, fn) {
3013-
var _this = this;
3014-
return keys(fields).map(function(path) {
3015-
var val;
3016-
val = fields[path];
3017-
return _this.result[path] = fn(path, val);
3018-
});
3026+
return keys(fields).map((function(_this) {
3027+
return function(path) {
3028+
var val;
3029+
val = fields[path];
3030+
return _this.result[path] = fn(path, val);
3031+
};
3032+
})(this));
30193033
};
30203034

30213035
MongoOp.prototype.$addToSet = (function() {
@@ -3036,26 +3050,27 @@ require.define("/node_modules/mongoop/index.js",function(require,module,exports,
30363050
}
30373051
};
30383052
return function(target, fields) {
3039-
var _this = this;
3040-
return this.forEachField(fields, function(path, val) {
3041-
var child, collection, _i, _len, _ref1, _results;
3042-
collection = getAt(target, path);
3043-
if (collection == null) {
3044-
collection = [];
3045-
setAt(target, path, collection);
3046-
}
3047-
if (val.$each != null) {
3048-
_ref1 = val.$each;
3049-
_results = [];
3050-
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
3051-
child = _ref1[_i];
3052-
_results.push($addToSet(collection, child));
3053+
return this.forEachField(fields, (function(_this) {
3054+
return function(path, val) {
3055+
var child, collection, _i, _len, _ref1, _results;
3056+
collection = getAt(target, path);
3057+
if (collection == null) {
3058+
collection = [];
3059+
setAt(target, path, collection);
30533060
}
3054-
return _results;
3055-
} else {
3056-
return $addToSet(collection, val);
3057-
}
3058-
});
3061+
if (val.$each != null) {
3062+
_ref1 = val.$each;
3063+
_results = [];
3064+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
3065+
child = _ref1[_i];
3066+
_results.push($addToSet(collection, child));
3067+
}
3068+
return _results;
3069+
} else {
3070+
return $addToSet(collection, val);
3071+
}
3072+
};
3073+
})(this));
30593074
};
30603075
})();
30613076

@@ -4081,7 +4096,7 @@ Bongo = (function(_super) {
40814096

40824097
function Bongo(options) {
40834098
EventEmitter(this);
4084-
this.mq = options.mq, this.getSessionToken = options.getSessionToken, this.getUserArea = options.getUserArea, this.fetchName = options.fetchName, this.resourceName = options.resourceName, this.apiEndpoint = options.apiEndpoint, this.useWebsockets = options.useWebsockets, this.batchRequests = options.batchRequests;
4099+
this.mq = options.mq, this.getSessionToken = options.getSessionToken, this.getUserArea = options.getUserArea, this.fetchName = options.fetchName, this.resourceName = options.resourceName, this.apiEndpoint = options.apiEndpoint, this.useWebsockets = options.useWebsockets, this.batchRequests = options.batchRequests, this.apiDescriptor = options.apiDescriptor;
40854100
if (this.useWebsockets == null) {
40864101
this.useWebsockets = false;
40874102
}
@@ -4122,7 +4137,7 @@ Bongo = (function(_super) {
41224137
}
41234138
process.nextTick((function(_this) {
41244139
return function() {
4125-
return _this.api = _this.createRemoteApiShims(REMOTE_API);
4140+
return _this.api = _this.createRemoteApiShims(_this.apiDescriptor);
41264141
};
41274142
})(this));
41284143
}

node_modules_koding/bongo-client/src/bongo.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Bongo extends EventEmitter
7373
constructor:(options)->
7474
EventEmitter this
7575
{ @mq, @getSessionToken, @getUserArea, @fetchName, @resourceName,
76-
@apiEndpoint, @useWebsockets, @batchRequests } = options
76+
@apiEndpoint, @useWebsockets, @batchRequests, @apiDescriptor } = options
7777
@useWebsockets ?= no
7878
@batchRequests ?= yes
7979
@getUserArea ?= -> # noop
@@ -96,7 +96,7 @@ class Bongo extends EventEmitter
9696
unless @useWebsockets
9797
process.nextTick @bound 'xhrHandshake'
9898
process.nextTick =>
99-
@api = @createRemoteApiShims REMOTE_API
99+
@api = @createRemoteApiShims @apiDescriptor
100100

101101

102102
isConnected: -> return @readyState is CONNECTED

0 commit comments

Comments
 (0)