1 | var YouBase, exports,
|
2 | __slice = [].slice;
|
3 |
|
4 | YouBase = (function() {
|
5 | function YouBase(custodian) {
|
6 | this.custodian = custodian != null ? custodian : 'http://api.youbase.io';
|
7 | if (!(this instanceof YouBase)) {
|
8 | return new YouBase(this.custodian);
|
9 | }
|
10 | if (typeof this.custodian === 'string') {
|
11 | this.custodian = YouBase.Custodian({
|
12 | storage: 'rest',
|
13 | url: this.custodian
|
14 | });
|
15 | }
|
16 | }
|
17 |
|
18 | YouBase.prototype.wallet = function() {
|
19 | return (function(func, args, ctor) {
|
20 | ctor.prototype = func.prototype;
|
21 | var child = new ctor, result = func.apply(child, args);
|
22 | return Object(result) === result ? result : child;
|
23 | })(YouBase.Wallet, [this.custodian].concat(__slice.call(arguments)), function(){});
|
24 | };
|
25 |
|
26 | YouBase.prototype.document = function() {
|
27 | return (function(func, args, ctor) {
|
28 | ctor.prototype = func.prototype;
|
29 | var child = new ctor, result = func.apply(child, args);
|
30 | return Object(result) === result ? result : child;
|
31 | })(YouBase.Document, [this.custodian].concat(__slice.call(arguments)), function(){});
|
32 | };
|
33 |
|
34 | YouBase.prototype.definition = function() {
|
35 | return (function(func, args, ctor) {
|
36 | ctor.prototype = func.prototype;
|
37 | var child = new ctor, result = func.apply(child, args);
|
38 | return Object(result) === result ? result : child;
|
39 | })(YouBase.Definition, [this.custodian].concat(__slice.call(arguments)), function(){});
|
40 | };
|
41 |
|
42 | YouBase.prototype.collection = function() {
|
43 | return (function(func, args, ctor) {
|
44 | ctor.prototype = func.prototype;
|
45 | var child = new ctor, result = func.apply(child, args);
|
46 | return Object(result) === result ? result : child;
|
47 | })(YouBase.Collection, [this.custodian, YouBase.Document].concat(__slice.call(arguments)), function(){});
|
48 | };
|
49 |
|
50 | return YouBase;
|
51 |
|
52 | })();
|
53 |
|
54 | YouBase.Custodian = require('./custodian');
|
55 |
|
56 | YouBase.Definition = require('./definition');
|
57 |
|
58 | YouBase.Wallet = require('./wallet');
|
59 |
|
60 | YouBase.Document = require('./document');
|
61 |
|
62 | YouBase.Collection = require('./collection');
|
63 |
|
64 | YouBase.Envelope = require('ecc-envelope');
|
65 |
|
66 | exports = module.exports = YouBase;
|