@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
68 lines (67 loc) • 1.92 kB
JavaScript
import {
Repository
} from "../chunk-MKW5GQPP.mjs";
import {
when
} from "../chunk-XAIHCZT4.mjs";
import "../chunk-OFGI5FLG.mjs";
import "../chunk-NCEWAKOZ.mjs";
import "../chunk-Q3WMGUO2.mjs";
import "../chunk-5HENJTR6.mjs";
import {
Exception
} from "../chunk-FKZ4MOTX.mjs";
import "../chunk-WSBULPUZ.mjs";
import "../chunk-JVDKV5HE.mjs";
import "../chunk-WTFW6DLP.mjs";
import "../chunk-NDCIZJXB.mjs";
import "../chunk-MCCIBDEH.mjs";
import "../chunk-H2762RTS.mjs";
import "../chunk-A7C3XND3.mjs";
import "../chunk-JSON7A4X.mjs";
import "../chunk-CO2AFYVD.mjs";
import "../chunk-BDA5LB4S.mjs";
import "../chunk-SJGQU3OG.mjs";
import "../chunk-ZHXKBOK2.mjs";
import "../chunk-ZPNFXK7Y.mjs";
import "../chunk-DXQSIBC7.mjs";
import "../chunk-PIRWVOO2.mjs";
import "../chunk-DEJ7A5PY.mjs";
import "../chunk-4N72FQFX.mjs";
// src/domain/Typo.ts
var Typo = class extends Repository {
constructor(view, gateway) {
super();
this.view = view;
this.gateway = gateway;
}
create = (j) => this.view.from(j);
all(options) {
return this.gateway.all(options).then((js) => js.map(this.create));
}
byId(id) {
return this.gateway.byId(id).then((j) => when(j).not.isDefined.reject(Exception.DoesNotExist)).then((j) => this.create(j));
}
byIds(...ids) {
return this.gateway.byIds(...ids).then((js) => js.map(this.create));
}
byKey(key, options) {
return this.gateway.by("key", key, options).then((js) => js.map(this.create));
}
by(key, value, options) {
return this.gateway.by(key.toString(), value, options).then((js) => js.map(this.create));
}
search(q, options) {
return this.gateway.search(q, options).then((js) => js.map(this.create));
}
filter(options) {
return this.gateway.filter(options).then((js) => js.map((j) => this.create(j)));
}
exists(id) {
return this.gateway.exists(id);
}
};
export {
Typo
};
//# sourceMappingURL=Typo.mjs.map