layered-loader
Version:
Data loader with support for caching and fallback data sources
29 lines • 926 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeneratedDataSource = void 0;
class GeneratedDataSource {
getOneFn;
getManyFn;
name;
constructor(params) {
this.name = params.name ?? 'Generated loader';
this.getOneFn =
params.dataSourceGetOneFn ??
(() => {
throw new Error('Retrieval of a single entity is not implemented');
});
this.getManyFn =
params.dataSourceGetManyFn ??
(() => {
throw new Error('Retrieval of multiple entities is not implemented');
});
}
get(loadParams) {
return this.getOneFn(loadParams);
}
getMany(keys, loadParams) {
return this.getManyFn(keys, loadParams);
}
}
exports.GeneratedDataSource = GeneratedDataSource;
//# sourceMappingURL=GeneratedDataSource.js.map