stackpress
Version:
Incept is a content management framework.
129 lines (128 loc) • 4.62 kB
TypeScript
import type { UnknownNest, NestedObject } from '@stackpress/lib/types';
import type Engine from '@stackpress/inquire/Engine';
import type Model from '../../schema/spec/Model.js';
import type { SearchParams } from '../types.js';
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 declare class Actions<M extends UnknownNest = UnknownNest> {
readonly engine: Engine;
readonly model: Model;
protected _seed?: string;
constructor(model: Model, engine: Engine, seed?: string);
batch(rows: M[]): Promise<{
code: number;
status: string;
results: any;
total: number;
} | {
code: number;
status: string;
results: any;
total?: number;
} | {
code: number;
status: string;
error: string;
results: Partial<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: Partial<M>;
total?: number;
}>>[];
total: number;
stack: import("@stackpress/lib/types").Trace[];
}>;
create(input: NestedObject): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: Partial<M>;
total?: number;
}>>;
detail(ids: Record<string, string | number>, columns?: string[]): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M | null;
total?: number;
}>>;
get(key: string, value: string | number, columns?: string[]): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M | null;
total?: number;
}>>;
remove(ids: Record<string, string | number>): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M | null;
total?: number;
}>>;
restore(ids: Record<string, string | number>): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M | null;
total?: number;
}>>;
search(query: SearchParams): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M[];
total?: number;
}>>;
update(ids: Record<string, string | number>, input: NestedObject): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: M;
total?: number;
}>>;
upsert(input: NestedObject): Promise<Partial<import("@stackpress/lib/types").ResponseStatus & {
error: string;
errors?: NestedObject<string | string[]>;
start?: number;
end?: number;
stack?: import("@stackpress/lib/types").Trace[];
} & {
results: Partial<M>;
total?: number;
}>>;
}
export default function actions<M extends UnknownNest = UnknownNest>(model: Model, engine: Engine, seed?: string): Actions<M>;