@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
103 lines (102 loc) • 2.55 kB
JavaScript
import {
Repository
} from "../chunk-FBZHPHXB.mjs";
import {
toJson
} from "../chunk-A7KUHZ3A.mjs";
import {
Exception,
when
} from "../chunk-AVHYDITZ.mjs";
import "../chunk-EBIF6AMC.mjs";
import "../chunk-KCY4RPFR.mjs";
import "../chunk-SSROJBD5.mjs";
import "../chunk-S3NSPQ7M.mjs";
import "../chunk-NNA77YYC.mjs";
import "../chunk-SJGQU3OG.mjs";
import "../chunk-D5IYAIMK.mjs";
import "../chunk-PF7HDF6B.mjs";
import "../chunk-IXK47WKF.mjs";
import "../chunk-PIRWVOO2.mjs";
import "../chunk-AAND4MKF.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);
}
};
var Agent = class extends Repository {
constructor(gateway) {
super();
this.gateway = gateway;
}
all(options) {
return this.gateway.all(options);
}
byId(id) {
return this.gateway.byId(id);
}
byIds(...ids) {
return this.gateway.byIds(...ids);
}
byKey(key, options) {
return this.gateway.by("key", key, options);
}
by(key, value, options) {
return this.gateway.by(key.toString(), value, options);
}
search(q, options) {
return this.gateway.search(q, options);
}
filter(options) {
return this.gateway.filter(options);
}
exists(id) {
return this.gateway.exists(id);
}
add(t) {
return this.gateway.add(toJson(t));
}
update(id, t) {
return this.gateway.update({ ...toJson(t), id });
}
upsert(id, t) {
return this.gateway.upsert({ ...toJson(t), id });
}
remove(id) {
return this.gateway.remove(id);
}
};
export {
Agent,
Typo
};
//# sourceMappingURL=Typo.mjs.map