stackpress
Version:
Incept is a content management framework.
51 lines (50 loc) • 1.53 kB
JavaScript
import batch from './batch.js';
import create from './create.js';
import detail from './detail.js';
import get from './get.js';
import remove from './remove.js';
import restore from './restore.js';
import search from './search.js';
import update from './update.js';
import upsert from './upsert.js';
export { batch, create, detail, get, remove, restore, search, update, upsert };
export class Actions {
engine;
model;
_seed;
constructor(model, engine, seed) {
this.engine = engine;
this.model = model;
this._seed = seed;
}
async batch(rows) {
return batch(this.model, this.engine, rows, this._seed);
}
create(input) {
return create(this.model, this.engine, input, this._seed);
}
detail(ids, columns) {
return detail(this.model, this.engine, ids, columns, this._seed);
}
get(key, value, columns) {
return get(this.model, this.engine, key, value, columns, this._seed);
}
remove(ids) {
return remove(this.model, this.engine, ids);
}
restore(ids) {
return restore(this.model, this.engine, ids);
}
search(query) {
return search(this.model, this.engine, query, this._seed);
}
update(ids, input) {
return update(this.model, this.engine, ids, input, this._seed);
}
upsert(input) {
return upsert(this.model, this.engine, input, this._seed);
}
}
export default function actions(model, engine, seed) {
return new Actions(model, engine, seed);
}