-
Notifications
You must be signed in to change notification settings - Fork 49
/
index.d.ts
36 lines (31 loc) · 1.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// TypeScript Version: 3.0
import { Params, Paginated, Id, NullableId } from '@feathersjs/feathers';
import { AdapterService, ServiceOptions, InternalServiceMethods } from '@feathersjs/adapter-commons';
import { Model } from 'objection';
export interface ObjectionServiceOptions extends ServiceOptions {
model: typeof Model;
idSeparator: string;
jsonSchema: any;
allowedEager: string | object;
namedEagerFilters: any;
eagerFilters: any;
allowedInsert: string | object;
insertGraphOptions: any;
createUseUpsertGraph: any;
allowedUpsert: string | object;
upsertGraphOptions: any;
}
export class Service<T = any> extends AdapterService<T> implements InternalServiceMethods<T> {
Model: typeof Model;
options: ObjectionServiceOptions;
constructor(config?: Partial<ObjectionServiceOptions>);
_find(params?: Params): Promise<T | T[] | Paginated<T>>;
_get(id: Id, params?: Params): Promise<T>;
_create(data: Partial<T> | Array<Partial<T>>, params?: Params): Promise<T | T[]>;
_update(id: NullableId, data: T, params?: Params): Promise<T>;
_patch(id: NullableId, data: Partial<T>, params?: Params): Promise<T>;
_remove(id: NullableId, params?: Params): Promise<T>;
}
// tslint:disable-next-line:no-unnecessary-generics
declare const objection: (<T>(config?: Partial<ObjectionServiceOptions>) => Service<T>);
export default objection;