-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.js
executable file
·32 lines (30 loc) · 1.04 KB
/
index.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
27
28
29
30
31
32
'use strict';
var Client = require('./client');
var extend = require('./utils/tiny-extend');
module.exports = {
suppressUnhandledRejections: function suppressUnhandledRejections() {
// no longer uses when, so this is preserved for compatibility
// but is a noop
// require('when').Promise.onPotentiallyUnhandledRejection = function() {};
},
setDefaultRequestOptions: function setDefaultRequestOptions(options) {
Client.defaultRequestOptions = options;
},
client: function client(ctx, config) {
// to support the old lookup: client.platform().adminUser().tenantAdminUserAuthTicket() etc.
config = config || {};
if (ctx) config.context = ctx;
var client = new Client(config);
// instance
return extend(client, {
root: function root(cfg) {
return module.exports.client(extend({}, this, cfg));
},
commerce: require('./clients/commerce'),
content: require('./clients/content'),
event: require('./clients/event'),
platform: require('./clients/platform')
});
}
};
// END INIT