@godspeedsystems/core
Version:
> 4th Generation Declarative Microservice Framework
107 lines (106 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
GSCachingDataSource: function() {
return GSCachingDataSource;
},
GSDataSource: function() {
return GSDataSource;
},
GSDataSourceAsEventSource: function() {
return GSDataSourceAsEventSource;
},
GSEventSource: function() {
return GSEventSource;
}
});
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _define_property(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class GSDataSource {
init() {
var _this = this;
return _async_to_generator(function*() {
_this.client = yield _this.initClient();
})();
}
constructor(config){
_define_property(this, "config", void 0);
_define_property(this, "client", void 0);
this.config = config;
}
}
class GSCachingDataSource extends GSDataSource {
}
class GSDataSourceAsEventSource {
constructor(config, datasourceClient){
_define_property(this, "config", void 0);
// datasource: PlainObject;
_define_property(this, "client", void 0);
this.config = config;
this.client = datasourceClient;
}
}
class GSEventSource {
init() {
var _this = this;
return _async_to_generator(function*() {
_this.client = yield _this.initClient();
})();
}
constructor(config, datasources){
_define_property(this, "config", void 0);
_define_property(this, "client", void 0);
_define_property(this, "datasources", void 0);
this.config = config;
this.client = false;
this.datasources = datasources;
}
}